Commit 07c6ab4d authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/master-modify-cutAmount' into master-modify-cutAmount

parents b6ee679e 26422e89
......@@ -17,7 +17,7 @@ public class CostDetailExtend {
private String costDetail = "";
/**
* type:1--取消违约金;2--取消费用明细;3--提前还车费用明细;4--延期还车费用明细
* type:1--取消违约金;2--取消费用明细;3--提前还车费用明细;4--延期还车费用明细 5--订单按时还车
*/
protected Integer type;
......
......@@ -273,6 +273,9 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
if(RefundStatusEnum.NONE.getCode().equals(orderMQDTO.getRefundStatus())) {
Integer crosstownTypeEnum;
DepositRefundStatus depositRefundRecordStatus;
//生成额外的费用明细
CancelStartedVO csv = new CancelStartedVO();
//判断是否定损过
if(SYS_TRUE.equals(orderMQDTO.getOrderRentVehicleDetail().getFixedLossStatus())) {
crosstownTypeEnum = CrosstownTypeEnum.FIXED_LOSS.getCode();
......@@ -307,10 +310,16 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
oad.getDeductions().add(
initDeduction(illegalReserve, "违章保证金", DeductionTypeEnum.VIOLATE_TRAFFIC_KEEP, OrderAccountDeduction.ORIGIN_DEPOSIT)
);
oad.getDeductions().add(
initDeduction(crosstown.getDeductionCost(), "定损赔偿金", DeductionTypeEnum.DAMAGES, OrderAccountDeduction.ORIGIN_DEPOSIT)
);
//剩余押金 -
//设置定损金额
csv.setDamagesAmount(crosstown.getDeductionCost());
if(crosstown.getDeductionCost().compareTo(BigDecimal.ZERO) > 0) {
oad.getDeductions().add(
initDeduction(crosstown.getDeductionCost(), "定损赔偿金", DeductionTypeEnum.DAMAGES, OrderAccountDeduction.ORIGIN_DEPOSIT)
);
}
//剩余押金 = 押金 - 违章保证金 - 定损金额
oad.setDepositAmount(oad.getDepositAmount().subtract(illegalReserve).subtract(crosstown.getDeductionCost()));
handleCrosstownDetail(crosstown, oad);
BigDecimal refundAmont = crosstown.getRestDeposit().subtract(illegalReserve);
......@@ -323,11 +332,11 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
orderDepositRefundRecordBiz.completeRecordStatus(crosstown.getId(), depositRefundRecordStatus);
//生成额外的费用明细
CancelStartedVO csv = new CancelStartedVO();
csv.setConsumeAmount(inProgressVO.getConsumeAmount());
csv.setModelAmount(orderItem.getUnitPrice());
csv.setUsedAmount(inProgressVO.getUsedAmount());
csv.setUsedDayNum(inProgressVO.getUsedDays());
csv.setUsedfreeDayNum(inProgressVO.getUsedfreeDays());
csv.setUsedFreeAmount(inProgressVO.getUsedFreeDaysAmount());
csv.setHadConpon((StrUtil.isNotBlank(orderMQDTO.getCouponTickerNos())? Boolean.TRUE: Boolean.FALSE));
if(csv.getUsedDayNum() == orderMQDTO.getOrderRentVehicleDetail().getDayNum()) {
......
......@@ -17,11 +17,13 @@ import com.xxfc.platform.order.pojo.calculate.InProgressVO;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import com.xxfc.platform.order.pojo.price.CancelNoStartVO;
import com.xxfc.platform.order.pojo.price.CancelStartedVO;
import com.xxfc.platform.order.pojo.price.CostDetailExtend;
import com.xxfc.platform.tour.feign.TourFeign;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -29,6 +31,7 @@ import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
......@@ -122,7 +125,7 @@ public class OrderCancelBiz {
setCancelReason(baseOrder.getCancelReason());
setVersion(baseOrder.getVersion());
}};
BaseOrder hasUpdateOrder = baseOrderBiz.updateSelectiveByIdReT(updateOrder);
BeanUtils.copyProperties(baseOrderBiz.updateSelectiveByIdReT(updateOrder), baseOrder);;
InProgressVO inProgressVO = null;
OrderAccountDetail oad = new OrderAccountDetail();
......@@ -158,7 +161,9 @@ public class OrderCancelBiz {
Long beginOfStartDay = DateUtil.beginOfDay(DateUtil.date(orvd.getStartTime())).getTime();
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long useTimeLag = System.currentTimeMillis() - beginOfStartDay;
Integer useDays = new BigDecimal(useTimeLag + "").divide(new BigDecimal((24 * 60 * 60 * 1000)+ "")).setScale(0, BigDecimal.ROUND_UP).intValue();
log.info("useTimeLag {}", new BigDecimal(useTimeLag + ""));
log.info("divide {}", new BigDecimal((24 * 60 * 60 * 1000)+ ""));
Integer useDays = new BigDecimal(useTimeLag + "").divide(new BigDecimal((24 * 60 * 60 * 1000)+ ""), 0, RoundingMode.UP).intValue();
inProgressVO = orderCalculateBiz.calculateOrderComplete(baseOrder, orvd, oad, orderItem, useDays);
//结合
//退款子流程: 订单基础,退款描述,退款金额
......@@ -167,10 +172,12 @@ public class OrderCancelBiz {
//生成额外的费用明细
CancelStartedVO csv = new CancelStartedVO();
csv.setType(CostDetailExtend.CANCEL_STARTED);
csv.setConsumeAmount(inProgressVO.getConsumeAmount());
csv.setModelAmount(orderItem.getUnitPrice());
csv.setUsedAmount(inProgressVO.getUsedAmount());
csv.setUsedDayNum(inProgressVO.getUsedDays());
csv.setUsedfreeDayNum(inProgressVO.getUsedfreeDays());
csv.setUsedFreeAmount(inProgressVO.getUsedFreeDaysAmount());
csv.setHadConpon((StrUtil.isNotBlank(baseOrder.getCouponTickerNos())? Boolean.TRUE: Boolean.FALSE));
//如果有扣款项,则生成额外的费用明细
......@@ -200,7 +207,7 @@ public class OrderCancelBiz {
}
}
//退款流程
orderAccountBiz.rentRefundProcessCancel(hasUpdateOrder, orderItem.getRealAmount(), timeLag, APP_ORDER+ "_"+ RENT_REFUND, orvd.getDeposit(), freeDayAmount, oad);
orderAccountBiz.rentRefundProcessCancel(baseOrder, orderItem.getRealAmount(), timeLag, APP_ORDER+ "_"+ RENT_REFUND, orvd.getDeposit(), freeDayAmount, oad);
//如果有扣款项,则生成额外的费用明细
if(oad.getDeductions().size() > 0) {
......@@ -253,7 +260,7 @@ public class OrderCancelBiz {
}
//退款流程
orderAccountBiz.rentRefundProcessCancel(hasUpdateOrder, adultItem.getRealAmount().add(childItem.getRealAmount()), timeLag, APP_ORDER+ "_"+ key, BigDecimal.ZERO, BigDecimal.ZERO, oad);
orderAccountBiz.rentRefundProcessCancel(baseOrder, adultItem.getRealAmount().add(childItem.getRealAmount()), timeLag, APP_ORDER+ "_"+ key, BigDecimal.ZERO, BigDecimal.ZERO, oad);
//如果有扣款项,则生成额外的费用明细
if(oad.getDeductions().size() > 0) {
......@@ -324,4 +331,9 @@ public class OrderCancelBiz {
throw new BaseException(ResultCode.FAILED_CODE);
}
}
// public static void main(String[] args) {
// Integer aaa = new BigDecimal(140119562.00 + "").divide(new BigDecimal((24 * 60 * 60 * 1000)+ ""), 0, RoundingMode.UP).intValue();
// System.out.println(aaa);
// }
}
\ No newline at end of file
......@@ -126,7 +126,6 @@ public class RentDepositJobHandler extends IJobHandler {
}
OrderAccountDetail oad = new OrderAccountDetail();
orderAccountBiz.refundTrigger(baseOrder, orvd, BigDecimal.ZERO, orvd.getReturnPayResidue(), refundAmont, refundDesc, RefundStatusEnum.REFUND_DEPOSIT.getCode(), AccountTypeEnum.OUT_RESIDUE_DEPOSIT, oad);
//orderRefundBiz.refundTrigger(baseOrder, orvd, BigDecimal.ZERO, orvd.getReturnPayResidue(), refundAmont, refundDesc, RefundStatusEnum.REFUND_DEPOSIT.getCode(), RefundTypeEnum.RESIDUE_DEPOSIT);
orderDepositRefundRecordBiz.completeRecordStatus(crosstown.getId(), DepositRefundStatus.VIOLATIONARRIVAL);
orderMsgBiz.handelMsgDeposit(orvd, baseOrder, userFeign.userDetailById(baseOrder.getUserId()).getData());
}
......
......@@ -3,6 +3,8 @@ package com.xxfc.platform.order.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Dict;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO;
import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import com.github.wxiaoqi.security.common.exception.BaseException;
......@@ -314,9 +316,12 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
OrderTemplate template = orderTemplateBiz.selectByCode(OrderCostEnum.RENT_VEHICLE.getCode());
template.setTemplate(orderTemplateBiz.result(template.getTemplate(), new HashMap(){{
put("children", children);
put("paramJson", vo.getParamJson());
put("paramJson", "");
}}));
String result = orderTemplateBiz.result(template, Dict.parse(vo));
JSONObject jsonObject = JSONUtil.parseObj(result);
jsonObject.put("paramJson", vo.getParamJson());
result = JSONUtil.toJsonStr(jsonObject);
vo.setCostDetail(result);
}
}
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