Commit 321a895b authored by 周健威's avatar 周健威

修改租车 和 申请接口

parent ddedcb87
......@@ -97,6 +97,21 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro
return ObjectRestResponse.succ(baseBiz.selectList(entity));
}
@ApiOperation("根据参数查询,等于")
@RequestMapping(value = "/entityListPost",method = RequestMethod.POST)
@ResponseBody
public ObjectRestResponse<List<Entity>> entityListPost(@RequestBody Entity entity){
//查询列表数据
return ObjectRestResponse.succ(baseBiz.selectList(entity));
}
//
// @ApiOperation("根据参数查询,等于")
// @RequestMapping(value = "/entityListPost",method = RequestMethod.POST)
// @ResponseBody
// public ObjectRestResponse<List<Entity>> entityListPost(@RequestBody Entity entity){
// //查询列表数据
// return ObjectRestResponse.succ(baseBiz.selectList(entity));
// }
@ApiOperation("查询所有")
@RequestMapping(value = "/alls",method = RequestMethod.GET)
......
......@@ -273,8 +273,12 @@ public class OrderRentVehicleDetail implements Serializable {
@Column(name = "free_days")
@ApiModelProperty(value = "优惠天数")
private Integer freeDays;
/**
public void setFreeDays(Integer freeDays) {
this.freeDays = freeDays;
}
/**
* 折扣 80 即 8折
*/
@Column(name = "rebate")
......@@ -295,6 +299,10 @@ public class OrderRentVehicleDetail implements Serializable {
@ApiModelProperty(value = "剩余需要退还的钱(押金)")
private BigDecimal returnPayResidue;
public void setReturnPayResidue(BigDecimal returnPayResidue) {
this.returnPayResidue = returnPayResidue;
}
/**
* 预定记录id
*/
......@@ -392,6 +400,20 @@ public class OrderRentVehicleDetail implements Serializable {
@ApiModelProperty(value = "车辆公司(门店)id")
private Integer vehicleCompanyId;
@Column(name = "vehicle_deposit")
@ApiModelProperty(value = "车辆押金")
private BigDecimal vehicleDeposit;
@Column(name = "traffic_deposit")
@ApiModelProperty(value = "交通违章押金")
private BigDecimal trafficDeposit;
/**
* 商品押金方式 1--线上;2--线下
*/
@Column(name = "goods_deposit_type")
private Integer goodsDepositType;
public Long getEndTime() {
return endTime;
}
......
......@@ -205,4 +205,11 @@ public class ShuntApply implements Serializable {
@ApiModelProperty(value = "预约记录id", hidden = true )
private Long bookRecordId;
@Column(name = "brand_id")
@ApiModelProperty("品牌id")
private Integer brandId;
@Column(name = "category_id")
@ApiModelProperty("型号id")
private Integer categoryId;
}
......@@ -22,6 +22,7 @@ public class RentVehicleBO extends OrderRentVehicleDetail implements OrderDetail
private BaseOrder order;
private VehicleModel vehicleModel;
private BookVehicleVO bookVehicleVO;
private Vehicle vehicle;
/**
* 是否调车申请下订单
......@@ -93,6 +94,6 @@ public class RentVehicleBO extends OrderRentVehicleDetail implements OrderDetail
this.startDate = DateUtil.date(getStartTime());
this.endDate = DateUtil.date(getEndTime());
this.startDateStr = DateUtil.formatDate(this.startDate);
this.startDateStr = DateUtil.formatDate(this.endDate);
this.endDateStr = DateUtil.formatDate(this.endDate);
}
}
......@@ -131,6 +131,12 @@ public class AddRentVehicleDTO extends AddOrderCommonDTO{
@ApiModelProperty(value = "车辆id")
private String vehicleId;
//
@ApiModelProperty(value = "商品押金类型 1--线上;2--线下")
private Integer goodsDepositType;
public static final int GOODS_DEPOSIT_TYPE_UP = 1;
public static final int GOODS_DEPOSIT_TYPE_DOWN = 2;
public void setStartTime(Long startTime) {
this.startTime = startTime;
this.bookStartDate = YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(startTime), ZoneOffset.ofHours(8)));
......
......@@ -764,7 +764,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
RestResponse<Integer> result = vehicleFeign.rentProveVehicleBooking(orvd.getBookRecordId());
//确认免费天数
if (orvd.getFreeDays() > 0) {
if (null != orvd.getFreeDays() && orvd.getFreeDays() > 0) {
userFeign.memberDays(baseOrder.getUserId(), orvd.getFreeDays(), UserFeign.MEMBER_DAYS_CONFIRM);
}
......
......@@ -27,9 +27,8 @@ import com.xxfc.platform.order.mqhandler.RabbitProduct;
import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.order.pojo.order.RentVehicleBO;
import com.xxfc.platform.order.pojo.order.add.AddRentVehicleDTO;
import com.xxfc.platform.order.pojo.order.add.BgAddRentDTO;
import com.xxfc.platform.order.rest.background.BgShuntApplyController;
import com.xxfc.platform.order.service.OrderRentVehicleService;
import com.xxfc.platform.vehicle.entity.VehicleCategory;
import com.xxfc.platform.vehicle.entity.VehicleModel;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.BookVehicleVO;
......@@ -136,7 +135,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
return w;
}, " crt_time desc "), ShuntApplyVO.class);
pages.getData().forEach(data -> {
data.setVehicleModel(vehicleFeign.get(data.getModelId()).getData());
data.setVehicleCategory(vehicleFeign.getVehicleCategory(data.getCategoryId()).getData());
});
return ObjectRestResponse.succ(pages);
......@@ -189,8 +188,9 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
@Data
public static class ShuntApplyVO extends ShuntApply {
VehicleModel vehicleModel;
// VehicleModel vehicleModel;
OrderPageVO orderPageVO;
VehicleCategory vehicleCategory;
}
@Data
......@@ -208,20 +208,20 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
@RequestMapping(value = "/appBusiness/list", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据城市查询待确认申请列表")
public ObjectRestResponse<PageDataVO<BgShuntApplyController.StewardShuntApply>> stewardList(BgShuntApplyController.ListDTO dto) {
public ObjectRestResponse<PageDataVO<StewardShuntApply>> stewardList(ListDTO dto) {
AssertUtils.isBlank(getBusinessUserByAppUser());
//获取该城市的申请最大和最小时间
//获取该店铺
PageDataVO<BgShuntApplyController.StewardShuntApply> list = PageDataVO.pageInfo(dto.initQuery(), () -> baseBiz.selectByWeekend(w -> {
PageDataVO<StewardShuntApply> list = PageDataVO.pageInfo(dto.initQuery(), () -> baseBiz.selectByWeekend(w -> {
if(null != dto.getCityCode()) {
w.andEqualTo(ShuntApply::getStartCityCode, dto.getCityCode());
}
w.andEqualTo(ShuntApply::getStatus, STATUS_CRT);
return w;
}, " crt_time desc "), BgShuntApplyController.StewardShuntApply.class);
}, " crt_time desc "), StewardShuntApply.class);
list.getData().forEach(data -> {
data.setVehicleModel(vehicleFeign.get(data.getModelId()).getData());
data.setVehicleCategory(vehicleFeign.getVehicleCategory(data.getCategoryId()).getData());
});
return ObjectRestResponse.succ(list);
......@@ -230,7 +230,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
@RequestMapping(value = "/appBusiness/confirmApply", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "app商家用户确认申请")
public ObjectRestResponse stewardConfirmApply(@RequestBody BgShuntApplyController.ConfirmApplyDTO dto) {
public ObjectRestResponse stewardConfirmApply(@RequestBody ConfirmApplyDTO dto) {
UserDTO userDTO = getBusinessUserByAppUser();
AssertUtils.isBlank(userDTO);
//查询列表数据
......@@ -289,8 +289,8 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
AssertUtils.isBlank(userDTO);
Integer companyId = userDTO.getCompanyId();
ShuntApply shuntApply = baseBiz.selectById(applyId);
BgShuntApplyController.StewardShuntApply shuntApplyVO = BeanUtil.toBean(shuntApply, BgShuntApplyController.StewardShuntApply.class);
shuntApplyVO.setVehicleModel(vehicleFeign.get(shuntApply.getModelId()).getData());
StewardShuntApply shuntApplyVO = BeanUtil.toBean(shuntApply, StewardShuntApply.class);
shuntApplyVO.setVehicleCategory(vehicleFeign.getVehicleCategory(shuntApply.getCategoryId()).getData());
RentVehicleBookDTO rbd = new RentVehicleBookDTO();
rbd.setModelId(shuntApply.getModelId());
rbd.setParkBranchCompanyId(companyId);
......@@ -334,7 +334,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
@RequestMapping(value = "/appBusiness/myApplyList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "我的申请")
public ObjectRestResponse myApplyList(BgShuntApplyController.PageDTO dto) {
public ObjectRestResponse myApplyList(PageDTO dto) {
UserDTO userDTO = getBusinessUserByAppUser();
AssertUtils.isBlank(userDTO);
PageDataVO<ShuntApplyController.ShuntApplyVO> pages = PageDataVO.pageInfo(dto.initQuery(), () -> baseBiz.selectByWeekend(w -> {
......@@ -346,7 +346,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
}), ShuntApplyController.ShuntApplyVO.class);
pages.getData().forEach(data -> {
data.setVehicleModel(vehicleFeign.get(data.getModelId()).getData());
data.setVehicleCategory(vehicleFeign.getVehicleCategory(data.getCategoryId()).getData());
if(StrUtil.isNotBlank(data.getOrderNo())) {
Map<String, Object> map = CollUtil.newHashMap();
......@@ -381,14 +381,6 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
@Data
public static class StewardShuntApply extends ShuntApply {
List<UsableVeicleVO> vehicles;
VehicleModel vehicleModel;
public VehicleModel getVehicleModel() {
return vehicleModel;
}
public void setVehicleModel(VehicleModel vehicleModel) {
this.vehicleModel = vehicleModel;
}
VehicleCategory vehicleCategory;
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
......@@ -58,6 +59,7 @@ import static com.github.wxiaoqi.security.admin.constant.enumerate.MemberEnum.NO
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.order.contant.enumerate.ItemTypeEnum.ACCOMPANY;
import static com.xxfc.platform.order.pojo.order.add.AddRentVehicleDTO.GOODS_DEPOSIT_TYPE_UP;
import static com.xxfc.platform.universal.constant.DictionaryKey.APP_ORDER;
@Service
......@@ -195,6 +197,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//商品类型
bo.getOrder().setGoodsType(vehicle.getGoodsType());
bo.setVehicle(vehicle);
}
}
......@@ -397,6 +400,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//车型信息
VehicleModel vehicleModel = vehicleFeign.get(detail.getModelId()).getData();
//车型信息
Vehicle vehicle = detail.getVehicle();
detail.initDate();
List<VehicleModelCalendarPriceDTO> metaVmcpds = vehicleFeign.getPriceByVehicleIdFeignV2(detail.getVehicleId(), detail.getStartDateStr(), detail.getEndDateStr(), dto.getUserid(), detail.getStartCompanyId()).getData();
......@@ -513,7 +519,15 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
}
//总价格(包含押金)
orderAmount = orderAmount.add(goodsAmount).add(vehicleModel.getDeposit());
//判断商品押金方式
detail.setVehicleDeposit(vehicle.getDeposit());
detail.setTrafficDeposit(vehicle.getVioDeposit());
detail.setReturnPayResidue(vehicle.getVioDeposit());
if(GOODS_DEPOSIT_TYPE_UP == detail.getGoodsDepositType()) {
orderAmount = orderAmount.add(goodsAmount).add(detail.getVehicleDeposit()).add(detail.getTrafficDeposit());
}else {
orderAmount = orderAmount.add(goodsAmount).add(detail.getTrafficDeposit());
}
realAmount = orderAmount.subtract(couponAmount);
//生成订单明细
......@@ -571,6 +585,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//车型信息
VehicleModel vehicleModel = vehicleFeign.get(detail.getModelId()).getData();
//车辆信息
Vehicle vehicle = detail.getVehicle();
detail.initDate();
List<VehicleModelCalendarPriceDTO> metaVmcpds = vehicleFeign.getPriceByVehicleIdFeignV2(detail.getVehicleId(), detail.getStartDateStr(), detail.getEndDateStr(), dto.getUserid(), detail.getStartCompanyId()).getData();
......@@ -619,20 +636,20 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//如果用户存在,并且为会员,并且车辆有优惠价
//默认折扣默认100
detail.setRebate(100);
if(null != dto && SYS_TRUE.equals(dto.getIsMember()) && !NONE.getCode().equals(dto.getMemberLevel()) && !DISCOUNT_STATUS_NONE.equals(vehicleModel.getRentDiscountStatus())) {
String[] prices = StrUtil.isBlank(vehicleModel.getRentDiscountPrice())
?new String[]{vehicleModel.getPrice().toString(),vehicleModel.getPrice().toString(),vehicleModel.getPrice().toString()}
:vehicleModel.getRentDiscountPrice().split(",");
//设置是否使用会员权益
for(VMCalendarPriceCostDTO vmcpcd : vehicleOrderItem.getVehicleDetail()) {
if(!vmcpcd.getNo_discount_price().equals(vmcpcd.getPrice())) {
detail.getOrder().setHasMemberRight(SYS_TRUE);
break;
}
}
detail.setRebate(dto.getDiscount());
}
// if(null != dto && SYS_TRUE.equals(dto.getIsMember()) && !NONE.getCode().equals(dto.getMemberLevel()) && !DISCOUNT_STATUS_NONE.equals(vehicleModel.getRentDiscountStatus())) {
// String[] prices = StrUtil.isBlank(vehicleModel.getRentDiscountPrice())
// ?new String[]{vehicleModel.getPrice().toString(),vehicleModel.getPrice().toString(),vehicleModel.getPrice().toString()}
// :vehicleModel.getRentDiscountPrice().split(",");
// //设置是否使用会员权益
// for(VMCalendarPriceCostDTO vmcpcd : vehicleOrderItem.getVehicleDetail()) {
// if(!vmcpcd.getNo_discount_price().equals(vmcpcd.getPrice())) {
// detail.getOrder().setHasMemberRight(SYS_TRUE);
// break;
// }
// }
//
// detail.setRebate(dto.getDiscount());
// }
//计算价格
if(vehicleHourNum > 0) {
......@@ -690,8 +707,15 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
}
//总价格(包含押金)
orderAmount = orderAmount.add(goodsAmount).add(vehicleModel.getDeposit());
realAmount = orderAmount.subtract(couponAmount);
//判断商品押金方式
detail.setVehicleDeposit(vehicle.getDeposit());
detail.setTrafficDeposit(vehicle.getVioDeposit());
detail.setReturnPayResidue(vehicle.getVioDeposit());
if(GOODS_DEPOSIT_TYPE_UP == detail.getGoodsDepositType()) {
orderAmount = orderAmount.add(goodsAmount).add(detail.getVehicleDeposit()).add(detail.getTrafficDeposit());
}else {
orderAmount = orderAmount.add(goodsAmount).add(detail.getTrafficDeposit());
}
//生成订单明细
RentVehiclePriceVO rvp = new RentVehiclePriceVO();
......@@ -713,6 +737,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
rvp.setVehicleHourNum(vehicleHourNum);
rvp.setFreeHourNum(0);
rvp.setFreeDayNum(0);
rvp.setCutDayNum(offsetNum);
rvp.setFreeAmount(vehicleOrderItem.getCutAmount());
rvp.setBuyVehicleAmount(vehicleOrderItem.getBuyAmount());
......@@ -771,7 +796,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
if(DRIVER_TYPE_DAMAGE_SAFE.equals(detail.getDamageSafe())) {
childrenStr.append(",${tem_0104}");
}
if(detail.getFreeDays() > 0) {
if(null != detail.getFreeDays() && detail.getFreeDays() > 0) {
childrenStr.append(",${tem_0105}");
}
if(StrUtil.isNotBlank(detail.getOrder().getCouponTickerNos())) {
......
......@@ -26,6 +26,9 @@ import java.util.*;
*/
@FeignClient(name = "vehicle", contextId = "vh")
public interface VehicleFeign {
@GetMapping(value = "/vehicleCategory/{id}")
public ObjectRestResponse<VehicleCategory> getVehicleCategory(@PathVariable(value = "id") int id);
@GetMapping(value = "/vehicleModel/{id}")
public ObjectRestResponse<VehicleModel> get(@PathVariable(value = "id") int id);
......
......@@ -5,6 +5,7 @@ import com.xxfc.platform.vehicle.entity.VehiclePlatCata;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
......@@ -16,6 +17,13 @@ public class RentVehicleBookDTO extends PageParam {
//根据车型、时间、距离,门店,预定车辆
@ApiModelProperty("车型id")
private Integer modelId;
@ApiModelProperty("品牌id")
private Integer brandId;
@ApiModelProperty("型号id")
private Integer categoryId;
/**
* 预定目标日期(开始)
*/
......
......@@ -411,7 +411,7 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
public List<VehicleModelCalendarPriceDTO> getSynthesizePrice (String vehicleId, String startDate, String endDate, Integer userId, Integer companyId) {
List<VehicleModelCalendarPriceDTO> priceDTOS = CollUtil.newArrayList();
cn.hutool.core.date.DateTime beginOfStartDate = DateUtil.beginOfDay(DateUtil.parse(startDate));
cn.hutool.core.date.DateTime endOfStartDate = DateUtil.endOfDay(DateUtil.parse(endDate));
cn.hutool.core.date.DateTime endOfEndDate = DateUtil.endOfDay(DateUtil.parse(endDate));
//获取基本和周末价格
Vehicle vehicle = vehicleBiz.selectOne(new Vehicle(){{
setParkBranchCompanyId(companyId);
......@@ -424,7 +424,7 @@ public class RentVehicleController extends BaseController<VehicleBiz> implements
//Date currentDate = DateUtil.beginOfDay(DateUtil.parse(startDate));
for(cn.hutool.core.date.DateTime currentDate = DateUtil.beginOfDay(DateUtil.parse(startDate));
(currentDate.isAfterOrEquals(beginOfStartDate) && currentDate.isBeforeOrEquals(endOfStartDate));
(currentDate.isAfterOrEquals(beginOfStartDate) && currentDate.isBeforeOrEquals(endOfEndDate));
currentDate = DateUtil.offsetDay(currentDate, 1)) {
cn.hutool.core.date.DateTime finalCurrentDate = currentDate;
VehicleModelCalendarPriceDTO dto = new VehicleModelCalendarPriceDTO(){{
......
......@@ -1135,6 +1135,12 @@
<if test="memberUse != null and memberUse>0">
and (v.member_use = 1 or v.member_use = #{memberUse})
</if>
<if test="brandId != null ">
and brand_id = #{brandId}
</if>
<if test="categoryId != null ">
and category_id = #{categoryId}
</if>
<if test="lon != null and lat != null">
order by
distance asc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment