Commit 06460f19 authored by libin's avatar libin

Merge remote-tracking branch 'origin/dev' into dev

parents 97726b5a 56b07609
...@@ -139,16 +139,16 @@ public class MsgBiz { ...@@ -139,16 +139,16 @@ public class MsgBiz {
} }
query.with(new Sort(Sort.Direction.DESC, "count.praise")); query.with(new Sort(Sort.Direction.DESC, "count.praise"));
List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId); List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
List<MsgVo> msgVoList = replaceMsgResult(msgList);
Set<Msg> resultList = new HashSet<>(); Set<MsgVo> resultList = new HashSet<>();
if(CollectionUtils.isNotEmpty(msgList)) { if(CollectionUtils.isNotEmpty(msgVoList)) {
if(number >= msgList.size()) { if(number >= msgVoList.size()) {
return ObjectRestResponse.succ(msgList); return ObjectRestResponse.succ(msgVoList);
} }
Set<Integer> set = new HashSet<>(); Set<Integer> set = new HashSet<>();
RandomUtil.randomSet(msgList.size(), number, set, number); RandomUtil.randomSet(msgVoList.size(), number, set, number);
for(Integer i : set) { for(Integer i : set) {
resultList.add(msgList.get(i)); resultList.add(msgVoList.get(i));
} }
} }
return ObjectRestResponse.succ(resultList); return ObjectRestResponse.succ(resultList);
......
...@@ -8,7 +8,7 @@ import java.util.List; ...@@ -8,7 +8,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public enum DeductionTypeEnum { public enum DeductionTypeEnum {
//账款类型 1--违约金;2--消费金额;3--赔偿金(定损);4--违章相关 //账款类型 1--违约金;2--消费金额;3--赔偿金(定损);4--违章相关;5--其他
VIOLATE_CANCEL(101, "提前取消违约金"), VIOLATE_CANCEL(101, "提前取消违约金"),
VIOLATE_ADVANCE(102, "提前还车违约金"), VIOLATE_ADVANCE(102, "提前还车违约金"),
VIOLATE_DELAY(103, "延迟还车违约金"), VIOLATE_DELAY(103, "延迟还车违约金"),
...@@ -17,6 +17,7 @@ public enum DeductionTypeEnum { ...@@ -17,6 +17,7 @@ public enum DeductionTypeEnum {
DAMAGES(301, "赔偿金(定损)"), DAMAGES(301, "赔偿金(定损)"),
VIOLATE_TRAFFIC_DEDUCT(401, "违章扣款"), VIOLATE_TRAFFIC_DEDUCT(401, "违章扣款"),
VIOLATE_TRAFFIC_KEEP(402, "违章扣款保留金"), VIOLATE_TRAFFIC_KEEP(402, "违章扣款保留金"),
OTHER_DELAY_SAFE(501, "其他费用-延迟用车不记免赔"),
; ;
/** /**
* 编码 * 编码
......
...@@ -31,7 +31,7 @@ public class DelayAddPriceVO { ...@@ -31,7 +31,7 @@ public class DelayAddPriceVO {
List<VMCalendarPriceCostDTO> delayAmountList = CollUtil.newArrayList(); List<VMCalendarPriceCostDTO> delayAmountList = CollUtil.newArrayList();
public void initDelayDamageSafeAmount() { public void initDelayDamageSafeAmount() {
this.delayDamageSafeAmount = this.damageSafePrice.add(new BigDecimal(delayAddDays+ "")); this.delayDamageSafeAmount = this.damageSafePrice.multiply(new BigDecimal(delayAddDays+ ""));
} }
public Integer residueDelayFreeDays(Integer realResidueDays) { public Integer residueDelayFreeDays(Integer realResidueDays) {
......
...@@ -341,7 +341,8 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -341,7 +341,8 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
DedDetailDTO dedDetailDTO = new DedDetailDTO(); DedDetailDTO dedDetailDTO = new DedDetailDTO();
//提前还车,结束时间大于当前时间 //提前还车,结束时间大于当前时间
Long nowTime = System.currentTimeMillis(); Long nowTime = System.currentTimeMillis();
Long endTime = orderPageVO.getOrderRentVehicleDetail().getEndTime(); Long endTime = (null == orderPageVO.getOrderRentVehicleDetail().getDelayAddEndTime()) ?
orderPageVO.getOrderRentVehicleDetail().getEndTime() : orderPageVO.getOrderRentVehicleDetail().getDelayAddEndTime();
Long startTime = orderPageVO.getOrderRentVehicleDetail().getStartTime(); Long startTime = orderPageVO.getOrderRentVehicleDetail().getStartTime();
//设置使用天数 //设置使用天数
...@@ -364,7 +365,10 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -364,7 +365,10 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
initDedDetail(dedDetailDTO, OrderViolateEnum.DELAY_VEHICLE.getCode(), inProgressVO.getDelayAddPriceVO().getDelayDamageSafeAmount(), stringBuilder); initDedDetail(dedDetailDTO, OrderViolateEnum.DELAY_VEHICLE.getCode(), inProgressVO.getDelayAddPriceVO().getDelayDamageSafeAmount(), stringBuilder);
jsonArray.add(dedDetailDTO); jsonArray.add(dedDetailDTO);
orderPageVO.setDelayVehicleDetail(jsonArray.toJSONString()); orderPageVO.setDelayVehicleDetail(jsonArray.toJSONString());
jsonArray.clear(); jsonArray = new JSONArray();
dedDetailDTO = new DedDetailDTO();
} else {
orderPageVO.setDelayVehicleDetail(jsonArray.toJSONString());
} }
/** /**
* 提前还车 * 提前还车
...@@ -483,6 +487,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -483,6 +487,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
/** /**
* 获取驾驶人驾照 * 获取驾驶人驾照
*
* @param orderPageVo * @param orderPageVo
*/ */
public void getUserLicense(OrderPageVO orderPageVo) { public void getUserLicense(OrderPageVO orderPageVo) {
...@@ -500,14 +505,17 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements ...@@ -500,14 +505,17 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
} }
//设置违约明细 //设置违约明细
for (OrderVehicleCrosstownDto a : orderVehicleCrosstown) { for (OrderVehicleCrosstownDto a : orderVehicleCrosstown) {
if(a.getType() != CrosstownTypeEnum.DEPARTURE.getCode()) { if (a.getType() != CrosstownTypeEnum.DEPARTURE.getCode()) {
if(StringUtils.isNotBlank(a.getViolateDetail())) { if (StringUtils.isNotBlank(a.getViolateDetail())) {
orderPageVo.setDedDetailDTO(a.getViolateDetail()); orderPageVo.setDedDetailDTO(a.getViolateDetail());
} }
if (StringUtils.isNotBlank(a.getDelayVehicleDetail())) {
orderPageVo.setDelayVehicleDetail(a.getDelayVehicleDetail());
}
} }
} }
} }
if (StringUtils.isBlank(orderPageVo.getDedDetailDTO())) { if (StringUtils.isBlank(orderPageVo.getDedDetailDTO()) || StringUtils.isBlank(orderPageVo.getDelayVehicleDetail())) {
updateCrossRefund(orderPageVo); updateCrossRefund(orderPageVo);
} }
orderPageVo.setOrderVehicleCrosstownDto(orderVehicleCrosstownDto); orderPageVo.setOrderVehicleCrosstownDto(orderVehicleCrosstownDto);
......
...@@ -106,8 +106,10 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -106,8 +106,10 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
* @param orderViolateCoverAmount 订单违约金覆盖值 * @param orderViolateCoverAmount 订单违约金覆盖值
* @param depositViolateCoverAmount 押金违约金覆盖值 * @param depositViolateCoverAmount 押金违约金覆盖值
*/ */
public BigDecimal rentRefundProcessCancel(BaseOrder baseOrder, BigDecimal orderDeductSource, Long timeLag, String dicParentKey, BigDecimal depositAmount, BigDecimal depositDeductSource public BigDecimal rentRefundProcessCancel(BaseOrder baseOrder, BigDecimal orderDeductSource, Long timeLag
, OrderAccountDetail oad, BigDecimal topAmount, BigDecimal orderViolateCoverAmount, BigDecimal depositViolateCoverAmount) { , String dicParentKey, BigDecimal depositAmount, BigDecimal depositDeductSource
, OrderAccountDetail oad, BigDecimal topAmount, BigDecimal orderViolateCoverAmount, BigDecimal depositViolateCoverAmount
, Boolean noDeduct) {
//原来退款 和 最终退款 //原来退款 和 最终退款
BigDecimal originalRefundAmount = BigDecimal.ZERO; BigDecimal originalRefundAmount = BigDecimal.ZERO;
BigDecimal refundAmount = BigDecimal.ZERO; BigDecimal refundAmount = BigDecimal.ZERO;
...@@ -124,6 +126,11 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -124,6 +126,11 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
if(null != orderDeductSource && BigDecimal.ZERO.compareTo(orderDeductSource) < 0) { if(null != orderDeductSource && BigDecimal.ZERO.compareTo(orderDeductSource) < 0) {
BigDecimal orderDeductAmount = calculateDeduction(orderDeductSource, timeLag, dicParentKey, orderRefundDescBuilder); BigDecimal orderDeductAmount = calculateDeduction(orderDeductSource, timeLag, dicParentKey, orderRefundDescBuilder);
//如果属于免扣费情况
if(noDeduct) {
orderDeductAmount = BigDecimal.ZERO;
orderRefundDescBuilder = new StringBuilder("");
}
orderDeductAmount = orderDeductAmount.setScale(2, RoundingMode.HALF_UP); orderDeductAmount = orderDeductAmount.setScale(2, RoundingMode.HALF_UP);
if(null != orderViolateCoverAmount) { if(null != orderViolateCoverAmount) {
orderDeductAmount = orderViolateCoverAmount; orderDeductAmount = orderViolateCoverAmount;
...@@ -157,6 +164,11 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -157,6 +164,11 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
if(null != depositDeductSource && BigDecimal.ZERO.compareTo(depositDeductSource) < 0) { if(null != depositDeductSource && BigDecimal.ZERO.compareTo(depositDeductSource) < 0) {
//通过原扣除款 计算剩余款 //通过原扣除款 计算剩余款
BigDecimal depositDeductAmount = calculateDeduction(depositDeductSource, timeLag, dicParentKey, depositRefundDescBuilder); BigDecimal depositDeductAmount = calculateDeduction(depositDeductSource, timeLag, dicParentKey, depositRefundDescBuilder);
//如果属于免扣费情况
if(noDeduct) {
depositDeductAmount = BigDecimal.ZERO;
depositRefundDescBuilder = new StringBuilder("");
}
depositDeductAmount = depositDeductAmount.setScale(2, RoundingMode.HALF_UP); depositDeductAmount = depositDeductAmount.setScale(2, RoundingMode.HALF_UP);
if(null != orderViolateCoverAmount) { if(null != orderViolateCoverAmount) {
depositDeductAmount = orderViolateCoverAmount; depositDeductAmount = orderViolateCoverAmount;
...@@ -580,6 +592,24 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -580,6 +592,24 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
} }
} }
private void handleCrosstownDelayDetail(OrderVehicleCrosstown crosstown, OrderAccountDetail oad, CancelStartedVO csv) {
try{
if(null != crosstown.getDelayVehicleDetail()) {
//修改代码
List<DedDetailDTO> vios = JSONUtil.toList(JSONUtil.parseArray(crosstown.getViolateDetail()), DedDetailDTO.class);
//DedDetailDTO vio = JSONUtil.toBean(crosstown.getViolateDetail(), DedDetailDTO.class);
for(DedDetailDTO vio : vios) {
if(OrderViolateEnum.DELAY_VEHICLE.getCode().equals(vio.getType())) {
handleViolateDetail(DeductionTypeEnum.OTHER_DELAY_SAFE, oad, vio, csv);
}
}
}
}catch (Exception e) {
log.error("crosstown.getDelayVehicleDetail() crosstown id :"+crosstown.getId() +" 转换失败");
}
}
private void handleViolateDetail(DeductionTypeEnum dte, OrderAccountDetail oad, DedDetailDTO vio, CancelStartedVO csv) { private void handleViolateDetail(DeductionTypeEnum dte, OrderAccountDetail oad, DedDetailDTO vio, CancelStartedVO csv) {
Boolean flag = Boolean.FALSE; Boolean flag = Boolean.FALSE;
for(OrderAccountDeduction deduction : oad.getDeductions()) { for(OrderAccountDeduction deduction : oad.getDeductions()) {
......
...@@ -30,7 +30,7 @@ public class OrderLogBiz extends BaseBiz<OrderLogMapper,OrderLog> { ...@@ -30,7 +30,7 @@ public class OrderLogBiz extends BaseBiz<OrderLogMapper,OrderLog> {
setDetail(StrUtil.format(orderLogEnum.getDesc(), oldObj, newObj)); setDetail(StrUtil.format(orderLogEnum.getDesc(), oldObj, newObj));
}}; }};
updateSelectiveByIdRe(orderLog); insertSelectiveRe(orderLog);
}catch (Exception e) { }catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
......
...@@ -26,6 +26,7 @@ import com.xxfc.platform.order.pojo.calculate.InProgressVO; ...@@ -26,6 +26,7 @@ import com.xxfc.platform.order.pojo.calculate.InProgressVO;
import com.xxfc.platform.order.pojo.calculate.OrderRefundPriceVO; import com.xxfc.platform.order.pojo.calculate.OrderRefundPriceVO;
import com.xxfc.platform.order.pojo.order.OrderPageVO; import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.order.pojo.order.VehicleItemDTO; import com.xxfc.platform.order.pojo.order.VehicleItemDTO;
import com.xxfc.platform.order.pojo.price.DelayAddPriceVO;
import com.xxfc.platform.universal.constant.DictionaryKey; import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary; import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign; import com.xxfc.platform.universal.feign.ThirdFeign;
...@@ -108,6 +109,13 @@ public class OrderCalculateBiz { ...@@ -108,6 +109,13 @@ public class OrderCalculateBiz {
InProgressVO inProgressVO = new InProgressVO(); InProgressVO inProgressVO = new InProgressVO();
inProgressVO.setUsedDays(useDays); inProgressVO.setUsedDays(useDays);
//处理不记免赔违约金
if(useDays > 0) {
inProgressVO.setDelayAddPriceVO(orvd.obtainDelayAddDetail());
OrderAccountDeduction violateDeduction = orderAccountBiz.initDeduction(orvd.obtainDelayAddDetail().getDelayDamageSafeAmount(), "", DeductionTypeEnum.OTHER_DELAY_SAFE, OrderAccountDeduction.ORIGIN_DEPOSIT);
oad.getDeductions().add(violateDeduction);
}
inProgressVO.setMetaOrderUsedAmount(vehicleItemDTO.getUsedAmount(useDays)); inProgressVO.setMetaOrderUsedAmount(vehicleItemDTO.getUsedAmount(useDays));
//查看是否有增加的延期天数-->添加分别原订单和延期的使用金额 //查看是否有增加的延期天数-->添加分别原订单和延期的使用金额
if(orvd.getDelayAddDays() > 0 && useDays > vehicleItemDTO.getTotalNum()) { if(orvd.getDelayAddDays() > 0 && useDays > vehicleItemDTO.getTotalNum()) {
...@@ -246,7 +254,7 @@ public class OrderCalculateBiz { ...@@ -246,7 +254,7 @@ public class OrderCalculateBiz {
//"{}元/天 x{}天" //"{}元/天 x{}天"
BigDecimal residueAmount = BigDecimal.ZERO; BigDecimal residueAmount = BigDecimal.ZERO;
for(int i = useDays; i < vehicleItemDTO.getTotalNum(); i++) { for(int i = useDays; i < realVmcpds.size(); i++) {
residueAmount = residueAmount.add(realVmcpds.get(i).getPrice()); residueAmount = residueAmount.add(realVmcpds.get(i).getPrice());
inProgressVO.getViolateAmountList().add(realVmcpds.get(i)); inProgressVO.getViolateAmountList().add(realVmcpds.get(i));
} }
...@@ -385,6 +393,15 @@ public class OrderCalculateBiz { ...@@ -385,6 +393,15 @@ public class OrderCalculateBiz {
InProgressVO inProgressVO = new InProgressVO(); InProgressVO inProgressVO = new InProgressVO();
BigDecimal topAmount = BigDecimal.ZERO; 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) { switch (orderTypeEnum) {
case RENT_VEHICLE: case RENT_VEHICLE:
...@@ -398,7 +415,7 @@ public class OrderCalculateBiz { ...@@ -398,7 +415,7 @@ public class OrderCalculateBiz {
//融入日期价格 //融入日期价格
List<VehicleModelCalendarPriceDTO> vmcpds = JSONUtil.toList(JSONUtil.parseArray(vehicleItemDTO.getDetail()), VehicleModelCalendarPriceDTO.class); List<VehicleModelCalendarPriceDTO> vmcpds = JSONUtil.toList(JSONUtil.parseArray(vehicleItemDTO.getDetail()), VehicleModelCalendarPriceDTO.class);
if(timeLag < 0 ) { if(timeLag < 0 && overCancelBuffer) {
Integer useDays = getIncludeDays(orderPageVO.getOrderRentVehicleDetail().getStartTime(), DateTime.now().getMillis()); Integer useDays = getIncludeDays(orderPageVO.getOrderRentVehicleDetail().getStartTime(), DateTime.now().getMillis());
OrderAccountDetail oad = new OrderAccountDetail(); OrderAccountDetail oad = new OrderAccountDetail();
inProgressVO = inProgressCalculate(orderPageVO, vehicleItemDTO, orderPageVO.getOrderRentVehicleDetail(), useDays, oad, Boolean.FALSE); inProgressVO = inProgressCalculate(orderPageVO, vehicleItemDTO, orderPageVO.getOrderRentVehicleDetail(), useDays, oad, Boolean.FALSE);
...@@ -416,6 +433,11 @@ public class OrderCalculateBiz { ...@@ -416,6 +433,11 @@ public class OrderCalculateBiz {
, DictionaryKey.APP_ORDER+ "_"+ key , DictionaryKey.APP_ORDER+ "_"+ key
, refundDescBuilder); , refundDescBuilder);
if(!overCancelBuffer) {
deductionAmount = BigDecimal.ZERO;
refundDescBuilder = new StringBuilder("");
}
topAmount = vehicleItemDTO.getTopAmount(0); topAmount = vehicleItemDTO.getTopAmount(0);
totalDeductAmount = (topAmount.compareTo(deductionAmount) < 0) ? topAmount: deductionAmount; totalDeductAmount = (topAmount.compareTo(deductionAmount) < 0) ? topAmount: deductionAmount;
totalRefundAmount = orderPageVO.getRealAmount().subtract(totalDeductAmount); totalRefundAmount = orderPageVO.getRealAmount().subtract(totalDeductAmount);
...@@ -448,6 +470,11 @@ public class OrderCalculateBiz { ...@@ -448,6 +470,11 @@ public class OrderCalculateBiz {
, DictionaryKey.APP_ORDER+ "_"+ key , DictionaryKey.APP_ORDER+ "_"+ key
, refundDescBuilder); , refundDescBuilder);
if(!overCancelBuffer) {
deductionAmount = BigDecimal.ZERO;
refundDescBuilder = new StringBuilder("");
}
topAmount = adultItemAmount.add(childItemAmount); topAmount = adultItemAmount.add(childItemAmount);
totalDeductAmount = deductionAmount; totalDeductAmount = deductionAmount;
totalRefundAmount = orderPageVO.getRealAmount().subtract(deductionAmount); totalRefundAmount = orderPageVO.getRealAmount().subtract(deductionAmount);
......
...@@ -21,6 +21,8 @@ import com.xxfc.platform.order.pojo.price.CancelNoStartVO; ...@@ -21,6 +21,8 @@ import com.xxfc.platform.order.pojo.price.CancelNoStartVO;
import com.xxfc.platform.order.pojo.price.CancelStartedVO; import com.xxfc.platform.order.pojo.price.CancelStartedVO;
import com.xxfc.platform.order.pojo.price.CostDetailExtend; import com.xxfc.platform.order.pojo.price.CostDetailExtend;
import com.xxfc.platform.tour.feign.TourFeign; import com.xxfc.platform.tour.feign.TourFeign;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign; import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
...@@ -131,6 +133,16 @@ public class OrderCancelBiz { ...@@ -131,6 +133,16 @@ public class OrderCancelBiz {
//触发退款流程 //触发退款流程
//判断是否已支付 //判断是否已支付
if(SYS_TRUE.equals(baseOrder.getHasPay())) { if(SYS_TRUE.equals(baseOrder.getHasPay())) {
//缓冲取消时间(一个小时)
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() - baseOrder.getPayTime();
Boolean overCancelBuffer = (orderCrtLag > autoCancelTime)? Boolean.TRUE: Boolean.FALSE;
//判断订单类型 //判断订单类型
if(OrderTypeEnum.RENT_VEHICLE.getCode().equals(baseOrder.getType())) { if(OrderTypeEnum.RENT_VEHICLE.getCode().equals(baseOrder.getType())) {
orvd = orderRentVehicleBiz.selectOne(new OrderRentVehicleDetail(){{ orvd = orderRentVehicleBiz.selectOne(new OrderRentVehicleDetail(){{
...@@ -146,7 +158,8 @@ public class OrderCancelBiz { ...@@ -146,7 +158,8 @@ public class OrderCancelBiz {
//根据时间处理goodsAmount //根据时间处理goodsAmount
//获取出发时间 到现在 距离时间 //获取出发时间 到现在 距离时间
Long timeLag = orvd.getStartTime() - System.currentTimeMillis(); Long timeLag = orvd.getStartTime() - System.currentTimeMillis();
if(timeLag < 0 ) {
if(timeLag < 0 && overCancelBuffer) {
Integer useDays = orderCalculateBiz.getIncludeDays(orvd.getStartTime(), System.currentTimeMillis()); Integer useDays = orderCalculateBiz.getIncludeDays(orvd.getStartTime(), System.currentTimeMillis());
if(useDays > orvd.obtainRealDayNum()) { if(useDays > orvd.obtainRealDayNum()) {
useDays = orvd.obtainRealDayNum(); useDays = orvd.obtainRealDayNum();
...@@ -221,7 +234,7 @@ public class OrderCancelBiz { ...@@ -221,7 +234,7 @@ public class OrderCancelBiz {
//退款流程 //退款流程
//违约金封顶 租车身份价 * 2天 //违约金封顶 租车身份价 * 2天
orderAccountBiz.rentRefundProcessCancel(baseOrder, BigDecimal.ZERO, timeLag, APP_ORDER+ "_"+ RENT_REFUND, orvd.getDeposit(), vehicleItemDTO.getBuyAmount(), oad, vehicleItemDTO.getTopAmount(0), null, changeViolateAmount); orderAccountBiz.rentRefundProcessCancel(baseOrder, BigDecimal.ZERO, timeLag, APP_ORDER+ "_"+ RENT_REFUND, orvd.getDeposit(), vehicleItemDTO.getBuyAmount(), oad, vehicleItemDTO.getTopAmount(0), null, changeViolateAmount, (!overCancelBuffer));
//设置订单数据 //设置订单数据
//baseOrder.setDamagesAmount(csv.getDamagesAmount()); //baseOrder.setDamagesAmount(csv.getDamagesAmount());
...@@ -264,6 +277,7 @@ public class OrderCancelBiz { ...@@ -264,6 +277,7 @@ public class OrderCancelBiz {
} }
}else if (OrderTypeEnum.TOUR.getCode().equals(baseOrder.getType())) { }else if (OrderTypeEnum.TOUR.getCode().equals(baseOrder.getType())) {
otd = orderTourDetailBiz.selectOne(new OrderTourDetail(){{ otd = orderTourDetailBiz.selectOne(new OrderTourDetail(){{
setOrderId(baseOrder.getId()); setOrderId(baseOrder.getId());
}}); }});
...@@ -290,7 +304,7 @@ public class OrderCancelBiz { ...@@ -290,7 +304,7 @@ public class OrderCancelBiz {
} }
//退款流程 //退款流程
orderAccountBiz.rentRefundProcessCancel(baseOrder, adultItemAmount.add(childItemAmount), timeLag, APP_ORDER+ "_"+ key, BigDecimal.ZERO, BigDecimal.ZERO, oad, adultItemAmount.add(childItemAmount), changeViolateAmount, null); orderAccountBiz.rentRefundProcessCancel(baseOrder, adultItemAmount.add(childItemAmount), timeLag, APP_ORDER+ "_"+ key, BigDecimal.ZERO, BigDecimal.ZERO, oad, adultItemAmount.add(childItemAmount), changeViolateAmount, null, (!overCancelBuffer));
//如果有扣款项,则生成额外的费用明细 //如果有扣款项,则生成额外的费用明细
if(oad.getDeductions().size() > 0) { if(oad.getDeductions().size() > 0) {
......
...@@ -128,8 +128,14 @@ public class OrderDelayBiz { ...@@ -128,8 +128,14 @@ public class OrderDelayBiz {
List<VMCalendarPriceCostDTO> delayAmountList; List<VMCalendarPriceCostDTO> delayAmountList;
if(delayAddDays > 0) { if(delayAddDays > 0) {
VehicleItemDTO vehicleItemDTO = BeanUtil.toBean(orderItemBiz.selectOne(new OrderItem(){{
setType(ItemTypeEnum.VEHICLE_MODEL.getCode());
setOrderId(orderPageVO.getId());
}}), VehicleItemDTO.class);
List<VMCalendarPriceCostDTO> vmcpcds = vehicleItemDTO.getVehicleDetail();
//获得延期天数费用 //获得延期天数费用
delayAmountList = orderItemBiz.getOverAmountList(DateUtil.date(orvd.getEndTime()), delayAddDays, orvd.getModelId(), orderPageVO.getUserId()); delayAmountList = orderItemBiz.getOverAmountList(vmcpcds.get(vmcpcds.size() - 1).getDate(), delayAddDays, orvd.getModelId(), orderPageVO.getUserId());
//处理免费天数和免费金额 //处理免费天数和免费金额
delayAmountList.parallelStream().forEach( vmcpcd -> { delayAmountList.parallelStream().forEach( vmcpcd -> {
vmcpcd.setValidFreeDays(vmcpcd.getFreeDays()); vmcpcd.setValidFreeDays(vmcpcd.getFreeDays());
......
...@@ -535,7 +535,11 @@ public class OrderMsgBiz { ...@@ -535,7 +535,11 @@ public class OrderMsgBiz {
smsParams.add(startCompanyDetail.detailAddr()); smsParams.add(startCompanyDetail.detailAddr());
break; break;
case SmsTemplateDTO.PAY_B : case SmsTemplateDTO.PAY_B :
smsParams.add(appUserDTO.obtainRealname()); String realName_B = appUserDTO.obtainRealnameNUL();
if(StrUtil.isNotBlank(realName_B)) {
realName_B = "您好";
}
smsParams.add(realName_B);
smsParams.add(orvd.getFreeDays().toString()); smsParams.add(orvd.getFreeDays().toString());
smsParams.add(appUserDTO.getRentFreeDays().toString()); smsParams.add(appUserDTO.getRentFreeDays().toString());
smsParams.add(baseOrder.getRealAmount().toString()); smsParams.add(baseOrder.getRealAmount().toString());
......
...@@ -102,7 +102,8 @@ public class RentDepositJobHandler extends IJobHandler { ...@@ -102,7 +102,8 @@ public class RentDepositJobHandler extends IJobHandler {
setType(crosstownTypeEnum); setType(crosstownTypeEnum);
}}); }});
if(crosstown.getCrtTime().compareTo(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60L * 1000L)) < 0) { //提前31分钟 31 * 60L * 1000L 退钱
if(crosstown.getCrtTime().compareTo(System.currentTimeMillis() - (rentDepositAutoRefundTime * 60L * 1000L - (31 * 60L * 1000L))) < 0) {
orderAccountBiz.handleRentDepositMargin(baseOrder, orvd, crosstown); orderAccountBiz.handleRentDepositMargin(baseOrder, orvd, crosstown);
} }
......
...@@ -25,6 +25,7 @@ import com.xxfc.platform.activity.entity.Coupon; ...@@ -25,6 +25,7 @@ import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.feign.ActivityFeign; import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.order.biz.*; import com.xxfc.platform.order.biz.*;
import com.xxfc.platform.order.biz.inner.OrderCalculateBiz; import com.xxfc.platform.order.biz.inner.OrderCalculateBiz;
import com.xxfc.platform.order.biz.inner.OrderDelayBiz;
import com.xxfc.platform.order.contant.enumerate.ItemTypeEnum; import com.xxfc.platform.order.contant.enumerate.ItemTypeEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum; import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.entity.OrderItem; import com.xxfc.platform.order.entity.OrderItem;
...@@ -96,6 +97,9 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -96,6 +97,9 @@ public class BackStageOrderController extends CommonBaseController implements Us
@Autowired @Autowired
OrderCalculateBiz orderCalculateBiz; OrderCalculateBiz orderCalculateBiz;
@Autowired
OrderDelayBiz orderDelayBiz;
@Autowired @Autowired
UserFeign userFeign; UserFeign userFeign;
...@@ -469,6 +473,8 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -469,6 +473,8 @@ public class BackStageOrderController extends CommonBaseController implements Us
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, Sets.newSet("订单不存在,或不是租车订单")); throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, Sets.newSet("订单不存在,或不是租车订单"));
} }
orderDelayBiz.delayRentOrder(orderPageVO, dto);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
......
...@@ -50,7 +50,7 @@ public class DictionaryKey { ...@@ -50,7 +50,7 @@ public class DictionaryKey {
public static final String TOUR_IN_REFUND = "TOUR_IN_REFUND"; public static final String TOUR_IN_REFUND = "TOUR_IN_REFUND";
/** /**
* 租车:公司司机租金、免赔费用、违章预备金 * 租车:公司司机租金、免赔费用、违章预备金、租车时间缓冲(小时)
*/ */
public static final String DRIVER_PRICE = "DRIVER_PRICE"; public static final String DRIVER_PRICE = "DRIVER_PRICE";
public static final String DAMAGE_SAFE = "DAMAGE_SAFE"; public static final String DAMAGE_SAFE = "DAMAGE_SAFE";
...@@ -78,4 +78,9 @@ public class DictionaryKey { ...@@ -78,4 +78,9 @@ public class DictionaryKey {
* 自动退款保留押金的时间(小时) * 自动退款保留押金的时间(小时)
*/ */
public static final String RENT_DEPOSIT_AUTO_REFUND_TIME = "RENT_DEPOSIT_AUTO_REFUND_TIME"; public static final String RENT_DEPOSIT_AUTO_REFUND_TIME = "RENT_DEPOSIT_AUTO_REFUND_TIME";
/**
* 取消时间缓冲(分钟)
*/
public static final String CANCEL_TIME_BUFFER = "CANCEL_TIME_BUFFER";
} }
...@@ -145,7 +145,6 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> { ...@@ -145,7 +145,6 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> {
return JsonResultUtil.createFailedResult(40004, "退款失败!"); return JsonResultUtil.createFailedResult(40004, "退款失败!");
} }
public ObjectRestResponse tradeRefund(String tradNo, Integer refundAmount, String refundReason, String outRequestNo) { public ObjectRestResponse tradeRefund(String tradNo, Integer refundAmount, String refundReason, String outRequestNo) {
AlipayTradeRefundResponse refundResponse = payBiz.testTradeRefund(tradNo, refundAmount, refundReason, outRequestNo); AlipayTradeRefundResponse refundResponse = payBiz.testTradeRefund(tradNo, refundAmount, refundReason, outRequestNo);
log.info("预授权转支付退款: {}", refundResponse.getBody()); log.info("预授权转支付退款: {}", refundResponse.getBody());
......
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