Commit 33ce5b6f authored by 周健威's avatar 周健威

Merge branch 'feature-delay-add' into dev

parents a9e6fa96 daf90664
......@@ -357,6 +357,22 @@ public class OrderRentVehicleDetail implements Serializable {
@ApiModelProperty(value = "延期结束时间")
private Long delayAddEndTime;
public Long obtainRealEndTime() {
if(null != getDelayAddEndTime()) {
return getDelayAddEndTime();
}else {
return getEndTime();
}
}
// public Integer obtainRealDayNum() {
// if(null != getDelayAddDays()) {
// return (getDelayAddDays() + getDayNum());
// }else {
// return getDayNum();
// }
// }
public Integer obtainRealDayNum() {
return this.dayNum + this.delayAddDays;
}
......
......@@ -341,8 +341,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
DedDetailDTO dedDetailDTO = new DedDetailDTO();
//提前还车,结束时间大于当前时间
Long nowTime = System.currentTimeMillis();
Long endTime = (null == orderPageVO.getOrderRentVehicleDetail().getDelayAddEndTime()) ?
orderPageVO.getOrderRentVehicleDetail().getEndTime() : orderPageVO.getOrderRentVehicleDetail().getDelayAddEndTime();
Long endTime = orderPageVO.getOrderRentVehicleDetail().obtainRealEndTime();
Long startTime = orderPageVO.getOrderRentVehicleDetail().getStartTime();
//设置使用天数
......
......@@ -517,13 +517,13 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
csv.setOverAmountList(inProgressVO.getOverAmountList());
csv.setViolateAmountList(inProgressVO.getViolateAmountList());
if(csv.getUsedDayNum() == orderMQDTO.getOrderRentVehicleDetail().getDayNum()) {
if(csv.getUsedDayNum() == orderMQDTO.getOrderRentVehicleDetail().obtainRealDayNum()) {
csv.setType(CostDetailExtend.FINLISH_ONTIME);
}else if(csv.getUsedDayNum() > orderMQDTO.getOrderRentVehicleDetail().getDayNum()){
}else if(csv.getUsedDayNum() > orderMQDTO.getOrderRentVehicleDetail().obtainRealDayNum()){
csv.setType(CostDetailExtend.FINLISH_DELAY);
}else if(csv.getUsedDayNum() < orderMQDTO.getOrderRentVehicleDetail().getDayNum()){
}else if(csv.getUsedDayNum() < orderMQDTO.getOrderRentVehicleDetail().obtainRealDayNum()){
csv.setType(CostDetailExtend.FINLISH_ADVANCE);
}
......
......@@ -237,7 +237,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
OrderRentVehicleDetail orderRentVehicleDetail = orderRentVehicleBiz.selectById(baseOrder.getDetailId());
if (orderVehicleCrosstownDto.getType() == CrosstownTypeEnum.DEPARTURE.getCode()) {
boolean flag = getTodayTime(orderRentVehicleDetail.getStartTime(), orderRentVehicleDetail.getEndTime());
boolean flag = getTodayTime(orderRentVehicleDetail.getStartTime(), orderRentVehicleDetail.obtainRealEndTime());
if (!flag) {
return ObjectRestResponse.createFailedResult(3502, "已超过预定还车时间,不能进行交车操作!");
}
......
......@@ -393,43 +393,81 @@ public class OrderCalculateBiz {
InProgressVO inProgressVO = new InProgressVO();
BigDecimal topAmount = BigDecimal.ZERO;
//缓冲取消时间(一个小时)
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
Long autoCancelTime = Long.valueOf(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.CANCEL_TIME_BUFFER).getDetail());
autoCancelTime = autoCancelTime * 60L * 1000L;
//判断是否支付超过缓冲取消时间(一个小时)
Long orderCrtLag = System.currentTimeMillis() - orderPageVO.getPayTime();
Boolean overCancelBuffer = (orderCrtLag > autoCancelTime)? Boolean.TRUE: Boolean.FALSE;
switch (orderTypeEnum) {
case RENT_VEHICLE:
Long timeLag = orderPageVO.getOrderRentVehicleDetail().getStartTime() - System.currentTimeMillis();
if(SYS_TRUE.equals(orderPageVO.getHasPay()) && null != orderPageVO.getPayTime()) {
//缓冲取消时间(一个小时)
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
Long autoCancelTime = Long.valueOf(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.CANCEL_TIME_BUFFER).getDetail());
autoCancelTime = autoCancelTime * 60L * 1000L;
//判断是否支付超过缓冲取消时间(一个小时)
Long orderCrtLag = System.currentTimeMillis() - orderPageVO.getPayTime();
Boolean overCancelBuffer = (orderCrtLag > autoCancelTime)? Boolean.TRUE: Boolean.FALSE;
switch (orderTypeEnum) {
case RENT_VEHICLE:
Long timeLag = orderPageVO.getOrderRentVehicleDetail().getStartTime() - System.currentTimeMillis();
VehicleItemDTO vehicleItemDTO = BeanUtil.toBean(orderItemBiz.selectOne(new OrderItem(){{
setType(ItemTypeEnum.VEHICLE_MODEL.getCode());
setOrderId(orderPageVO.getId());
}}), VehicleItemDTO.class);
//融入日期价格
List<VehicleModelCalendarPriceDTO> vmcpds = JSONUtil.toList(JSONUtil.parseArray(vehicleItemDTO.getDetail()), VehicleModelCalendarPriceDTO.class);
if(timeLag < 0 && overCancelBuffer) {
Integer useDays = getIncludeDays(orderPageVO.getOrderRentVehicleDetail().getStartTime(), DateTime.now().getMillis());
OrderAccountDetail oad = new OrderAccountDetail();
inProgressVO = inProgressCalculate(orderPageVO, vehicleItemDTO, orderPageVO.getOrderRentVehicleDetail(), useDays, oad, Boolean.FALSE);
topAmount = vehicleItemDTO.getTopAmount(useDays);
totalDeductAmount = oad.realTotalDeduct();
totalRefundAmount = oad.getOrderAmount().add(oad.getDepositAmount());
refundDesc = inProgressVO.getViolateDesc();
}else {
String key = RENT_REFUND;
BigDecimal deductionAmount = orderAccountBiz.calculateDeduction(vehicleItemDTO.getBuyAmount()
, orderPageVO.getOrderRentVehicleDetail().getStartTime() - System.currentTimeMillis()
, DictionaryKey.APP_ORDER+ "_"+ key
, refundDescBuilder);
if(!overCancelBuffer) {
deductionAmount = BigDecimal.ZERO;
refundDescBuilder = new StringBuilder("");
}
VehicleItemDTO vehicleItemDTO = BeanUtil.toBean(orderItemBiz.selectOne(new OrderItem(){{
setType(ItemTypeEnum.VEHICLE_MODEL.getCode());
setOrderId(orderPageVO.getId());
}}), VehicleItemDTO.class);
topAmount = vehicleItemDTO.getTopAmount(0);
totalDeductAmount = (topAmount.compareTo(deductionAmount) < 0) ? topAmount: deductionAmount;
totalRefundAmount = orderPageVO.getRealAmount().subtract(totalDeductAmount);
refundDesc = refundDescBuilder.toString();
}
//融入日期价格
List<VehicleModelCalendarPriceDTO> vmcpds = JSONUtil.toList(JSONUtil.parseArray(vehicleItemDTO.getDetail()), VehicleModelCalendarPriceDTO.class);
break;
case TOUR:
//判断是省内还是省外
String key = TOUR_IN_REFUND;
if(SYS_TRUE.equals(orderPageVO.getOrderTourDetail().getIsOutside())) {
key = TOUR_REFUND;
}
if(timeLag < 0 && overCancelBuffer) {
Integer useDays = getIncludeDays(orderPageVO.getOrderRentVehicleDetail().getStartTime(), DateTime.now().getMillis());
OrderAccountDetail oad = new OrderAccountDetail();
inProgressVO = inProgressCalculate(orderPageVO, vehicleItemDTO, orderPageVO.getOrderRentVehicleDetail(), useDays, oad, Boolean.FALSE);
OrderItem adultItem = orderItemBiz.selectOne(new OrderItem(){{
setType(ItemTypeEnum.TOUR_ADULT.getCode());
setOrderId(orderPageVO.getId());
}});
topAmount = vehicleItemDTO.getTopAmount(useDays);
totalDeductAmount = oad.realTotalDeduct();
totalRefundAmount = oad.getOrderAmount().add(oad.getDepositAmount());
refundDesc = inProgressVO.getViolateDesc();
}else {
OrderItem childItem = orderItemBiz.selectOne(new OrderItem(){{
setType(ItemTypeEnum.TOUR_CHILD.getCode());
setOrderId(orderPageVO.getId());
}});
String key = RENT_REFUND;
BigDecimal adultItemAmount = (null == adultItem)? BigDecimal.ZERO: adultItem.getRealAmount();
BigDecimal childItemAmount = (null == childItem)? BigDecimal.ZERO: childItem.getRealAmount();
BigDecimal deductionAmount = orderAccountBiz.calculateDeduction(vehicleItemDTO.getBuyAmount()
, orderPageVO.getOrderRentVehicleDetail().getStartTime() - System.currentTimeMillis()
BigDecimal deductionAmount = orderAccountBiz.calculateDeduction(adultItemAmount.add(childItemAmount)
, orderPageVO.getOrderTourDetail().getStartTime() - System.currentTimeMillis()
, DictionaryKey.APP_ORDER+ "_"+ key
, refundDescBuilder);
......@@ -438,52 +476,17 @@ public class OrderCalculateBiz {
refundDescBuilder = new StringBuilder("");
}
topAmount = vehicleItemDTO.getTopAmount(0);
totalDeductAmount = (topAmount.compareTo(deductionAmount) < 0) ? topAmount: deductionAmount;
totalRefundAmount = orderPageVO.getRealAmount().subtract(totalDeductAmount);
topAmount = adultItemAmount.add(childItemAmount);
totalDeductAmount = deductionAmount;
totalRefundAmount = orderPageVO.getRealAmount().subtract(deductionAmount);
refundDesc = refundDescBuilder.toString();
}
break;
case TOUR:
//判断是省内还是省外
String key = TOUR_IN_REFUND;
if(SYS_TRUE.equals(orderPageVO.getOrderTourDetail().getIsOutside())) {
key = TOUR_REFUND;
}
OrderItem adultItem = orderItemBiz.selectOne(new OrderItem(){{
setType(ItemTypeEnum.TOUR_ADULT.getCode());
setOrderId(orderPageVO.getId());
}});
OrderItem childItem = orderItemBiz.selectOne(new OrderItem(){{
setType(ItemTypeEnum.TOUR_CHILD.getCode());
setOrderId(orderPageVO.getId());
}});
BigDecimal adultItemAmount = (null == adultItem)? BigDecimal.ZERO: adultItem.getRealAmount();
BigDecimal childItemAmount = (null == childItem)? BigDecimal.ZERO: childItem.getRealAmount();
BigDecimal deductionAmount = orderAccountBiz.calculateDeduction(adultItemAmount.add(childItemAmount)
, orderPageVO.getOrderTourDetail().getStartTime() - System.currentTimeMillis()
, DictionaryKey.APP_ORDER+ "_"+ key
, refundDescBuilder);
if(!overCancelBuffer) {
deductionAmount = BigDecimal.ZERO;
refundDescBuilder = new StringBuilder("");
}
topAmount = adultItemAmount.add(childItemAmount);
totalDeductAmount = deductionAmount;
totalRefundAmount = orderPageVO.getRealAmount().subtract(deductionAmount);
refundDesc = refundDescBuilder.toString();
break;
default:
break;
break;
default:
break;
}
}
OrderRefundPriceVO orpv = new OrderRefundPriceVO();
orpv.setRealAmount(orderPageVO.getRealAmount());
orpv.setRefundAmount(totalRefundAmount);
......
......@@ -506,7 +506,7 @@ public class OrderMsgBiz {
private void handelSmsParam(OrderRentVehicleDetail orvd, BaseOrder baseOrder, List<String> smsParams, AppUserDTO appUserDTO, int handelType) {
if(RENT_DELIVERY == handelType) {
smsParams.add(appUserDTO.obtainRealname());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getEndTime())));
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.obtainRealEndTime())));
smsParams.add(orvd.getEndAddr());
smsParams.add(baseOrder.getName());
smsParams.add(appUserDTO.getUsername());
......@@ -516,8 +516,8 @@ public class OrderMsgBiz {
smsParams.add(orvd.getStartAddr());
smsParams.add(orvd.getEndAddr());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getStartTime())));
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.getEndTime())));
smsParams.add(orvd.getDayNum().toString());
smsParams.add(DateUtil.formatDateTime(DateUtil.date(orvd.obtainRealEndTime())));
smsParams.add(orvd.obtainRealDayNum().toString());
smsParams.add(appUserDTO.getUsername());
}
}
......
......@@ -434,9 +434,9 @@ public class BackStageOrderController extends CommonBaseController implements Us
bo.setOrder(orderPageVO);
bo.setBookVehicleVO(new BookVehicleVO() {{
setBookStartDate(YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getStartTime()), ZoneOffset.ofHours(8))));
setBookEndDate(YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getEndTime()), ZoneOffset.ofHours(8))));
setBookEndDate(YMR_SLASH_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.obtainRealEndTime()), ZoneOffset.ofHours(8))));
setBookStartDateTime(DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getStartTime()), ZoneOffset.ofHours(8))));
setBookEndDateTime(DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.getEndTime()), ZoneOffset.ofHours(8))));
setBookEndDateTime(DATE_TIME_LINE_FORMATTER.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(bo.obtainRealEndTime()), ZoneOffset.ofHours(8))));
}});
List<OrderAccompanyDTO> oads = JSONUtil.toList(JSONUtil.parseArray(orderItemBiz.selectOne(new OrderItem() {{
......
......@@ -400,7 +400,7 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
log.info("参数:【{}==当前时间:{}==价格:{}==折扣:{}】", festivalDayMap, current_date, vehicle_price, discount);
Map<String, Object> vehicle_price_days_map = new HashMap<>(3);
Integer free_days = DEFAULT_FREE_DAYS;
vehicle_price_days_map.put(BASE_PRICE_VAL, vehicle_price);
//vehicle_price_days_map.put(BASE_PRICE_VAL, vehicle_price);
if (MapUtil.isNotEmpty(festivalDayMap)) {
VehicleModelHolidayPriceDTO vehicleModelHolidayPriceDTO = festivalDayMap.get(current_date);
if (Objects.nonNull(vehicleModelHolidayPriceDTO)) {
......@@ -408,6 +408,7 @@ public class VehicleModelCalendarPriceBiz extends BaseBiz<VehicleModelCalendarPr
free_days = vehicleModelHolidayPriceDTO.getFreeDays() == null ? free_days : vehicleModelHolidayPriceDTO.getFreeDays();
}
}
vehicle_price_days_map.put(BASE_PRICE_VAL, vehicle_price);
vehicle_price = vehicle_price.multiply(new BigDecimal(Objects.toString(discount / 100.00)));
vehicle_price_days_map.put(PRICE_VAL, vehicle_price);
vehicle_price_days_map.put(DAYS_VAL, free_days);
......
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