Commit 87101fa0 authored by 周健威's avatar 周健威

Merge branch 'master-modify-cutAmount' into dev

parents f6194b69 8f3631a4
...@@ -11,7 +11,7 @@ public class CancelNoStartVO extends CostDetailExtend{ ...@@ -11,7 +11,7 @@ public class CancelNoStartVO extends CostDetailExtend{
/** /**
* 违约金描述 * 违约金描述
*/ */
private String violateDesc; private String violateDesc = "";
/** /**
* 违约金额 * 违约金额
......
...@@ -60,4 +60,9 @@ public class CancelStartedVO extends CostDetailExtend { ...@@ -60,4 +60,9 @@ public class CancelStartedVO extends CostDetailExtend {
* 原订单是否包含优惠券 * 原订单是否包含优惠券
*/ */
private Boolean hadConpon = Boolean.FALSE; private Boolean hadConpon = Boolean.FALSE;
/**
* 赔偿金
*/
private BigDecimal damagesAmount = BigDecimal.ZERO;
} }
...@@ -3,6 +3,8 @@ package com.xxfc.platform.order.pojo.price; ...@@ -3,6 +3,8 @@ package com.xxfc.platform.order.pojo.price;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
@Data @Data
public class CostDetailExtend { public class CostDetailExtend {
...@@ -10,14 +12,25 @@ public class CostDetailExtend { ...@@ -10,14 +12,25 @@ public class CostDetailExtend {
public static final int CANCEL_STARTED = 2; public static final int CANCEL_STARTED = 2;
public static final int FINLISH_ADVANCE = 3; public static final int FINLISH_ADVANCE = 3;
public static final int FINLISH_DELAY = 4; public static final int FINLISH_DELAY = 4;
public static final int FINLISH_ONTIME = 5;
private String costDetail; private String costDetail = "";
/** /**
* type:1--取消违约金;2--取消费用明细;3--提前还车费用明细;4--延期还车费用明细 * type:1--取消违约金;2--取消费用明细;3--提前还车费用明细;4--延期还车费用明细
*/ */
protected Integer type; protected Integer type;
/**
* 违约金描述
*/
private String violateDesc;
/**
* 违约金金额
*/
private BigDecimal violateAmount = BigDecimal.ZERO;
/** /**
* 参数json * 参数json
*/ */
......
...@@ -8,31 +8,31 @@ import java.math.BigDecimal; ...@@ -8,31 +8,31 @@ import java.math.BigDecimal;
@Data @Data
public class RentVehiclePriceVO extends OrderPriceVO{ public class RentVehiclePriceVO extends OrderPriceVO{
@ApiModelProperty(value = "车辆价格") @ApiModelProperty(value = "车辆价格")
BigDecimal vehicleAmount; BigDecimal vehicleAmount = BigDecimal.ZERO;
@ApiModelProperty(value = "司机价格") @ApiModelProperty(value = "司机价格")
BigDecimal driverAmount; BigDecimal driverAmount = BigDecimal.ZERO;
@ApiModelProperty(value = "免赔付价格") @ApiModelProperty(value = "免赔付价格")
BigDecimal damageSafeAmount; BigDecimal damageSafeAmount = BigDecimal.ZERO;
@ApiModelProperty(value = "押金价格") @ApiModelProperty(value = "押金价格")
BigDecimal deposit; BigDecimal deposit = BigDecimal.ZERO;
@ApiModelProperty(value = "天数") @ApiModelProperty(value = "天数")
Integer dayNum; Integer dayNum = 0;
@ApiModelProperty(value = "车辆天数") @ApiModelProperty(value = "车辆天数")
Integer vehicleDayNum; Integer vehicleDayNum = 0;
@ApiModelProperty(value = "车辆个数") @ApiModelProperty(value = "车辆个数")
Integer vehicleNum; Integer vehicleNum = 0;
@ApiModelProperty(value = "司机个数") @ApiModelProperty(value = "司机个数")
Integer driverNum; Integer driverNum = 0;
@ApiModelProperty(value = "车型名称") @ApiModelProperty(value = "车型名称")
String modelName; String modelName = "";
@ApiModelProperty(value = "车型价格") @ApiModelProperty(value = "车型价格")
BigDecimal modelAmount; BigDecimal modelAmount = BigDecimal.ZERO;
@ApiModelProperty(value = "司机单价") @ApiModelProperty(value = "司机单价")
BigDecimal driverPrice; BigDecimal driverPrice = BigDecimal.ZERO;
@ApiModelProperty(value = "免赔付单价") @ApiModelProperty(value = "免赔付单价")
BigDecimal damageSafePrice; BigDecimal damageSafePrice = BigDecimal.ZERO;
@ApiModelProperty(value = "费用详情") @ApiModelProperty(value = "费用详情")
private String costDetail; private String costDetail = "";
// /** // /**
// * 原租车天数 // * 原租车天数
...@@ -42,17 +42,17 @@ public class RentVehiclePriceVO extends OrderPriceVO{ ...@@ -42,17 +42,17 @@ public class RentVehiclePriceVO extends OrderPriceVO{
/** /**
* 免费天数 * 免费天数
*/ */
private Integer freeDayNum; private Integer freeDayNum = 0;
/** /**
* 免费价格 * 免费价格
*/ */
private BigDecimal freeAmount; private BigDecimal freeAmount = BigDecimal.ZERO;
/** /**
* 购买的租车金额 * 购买的租车金额
*/ */
private BigDecimal buyVehicleAmount; private BigDecimal buyVehicleAmount = BigDecimal.ZERO;
/** /**
* 优惠描述 * 优惠描述
......
...@@ -8,49 +8,49 @@ import java.math.BigDecimal; ...@@ -8,49 +8,49 @@ import java.math.BigDecimal;
@Data @Data
public class TourPriceVO extends OrderPriceVO{ public class TourPriceVO extends OrderPriceVO{
@ApiModelProperty(value = "费用详情") @ApiModelProperty(value = "费用详情")
private String costDetail; private String costDetail = "";
@ApiModelProperty(value = "成人人数") @ApiModelProperty(value = "成人人数")
private Integer number; private Integer number = 0;
@ApiModelProperty(value = "儿童人数") @ApiModelProperty(value = "儿童人数")
private Integer childNumber; private Integer childNumber = 0;
//大人单价" //大人单价"
@ApiModelProperty(value = "大人单价") @ApiModelProperty(value = "大人单价")
private BigDecimal price; private BigDecimal price = BigDecimal.ZERO;
//大人总价 //大人总价
@ApiModelProperty(value = "大人总价") @ApiModelProperty(value = "大人总价")
private BigDecimal totalPrice; private BigDecimal totalPrice = BigDecimal.ZERO;
//大人真实总价(优惠后的价格) //大人真实总价(优惠后的价格)
@ApiModelProperty(value = "大人真实总价(优惠后的价格)") @ApiModelProperty(value = "大人真实总价(优惠后的价格)")
private BigDecimal realPrice; private BigDecimal realPrice = BigDecimal.ZERO;
//儿童单价 //儿童单价
@ApiModelProperty(value = "儿童单价") @ApiModelProperty(value = "儿童单价")
private BigDecimal childPrice; private BigDecimal childPrice = BigDecimal.ZERO;
//儿童总价 //儿童总价
@ApiModelProperty(value = "儿童总价") @ApiModelProperty(value = "儿童总价")
private BigDecimal totalChildPrice; private BigDecimal totalChildPrice = BigDecimal.ZERO;
//儿童真实总价(优惠后的价格) //儿童真实总价(优惠后的价格)
@ApiModelProperty(value = "儿童真实总价(优惠后的价格)") @ApiModelProperty(value = "儿童真实总价(优惠后的价格)")
private BigDecimal realChildPrice; private BigDecimal realChildPrice = BigDecimal.ZERO;
//保险费用 //保险费用
@ApiModelProperty(value = "保险费用") @ApiModelProperty(value = "保险费用")
private BigDecimal insureAmount; private BigDecimal insureAmount = BigDecimal.ZERO;
//保险单价 //保险单价
@ApiModelProperty(value = "保险单价") @ApiModelProperty(value = "保险单价")
private BigDecimal insurePrice; private BigDecimal insurePrice = BigDecimal.ZERO;
//天数 //天数
@ApiModelProperty(value = "天数") @ApiModelProperty(value = "天数")
private Integer dayNum; private Integer dayNum = 0;
//总人数 //总人数
@ApiModelProperty(value = "总人数") @ApiModelProperty(value = "总人数")
private Integer totalNumber; private Integer totalNumber = 0;
} }
...@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.IntervalUtil; import com.github.wxiaoqi.security.common.util.IntervalUtil;
...@@ -12,11 +13,15 @@ import com.xxfc.platform.order.biz.inner.OrderCalculateBiz; ...@@ -12,11 +13,15 @@ import com.xxfc.platform.order.biz.inner.OrderCalculateBiz;
import com.xxfc.platform.order.biz.inner.OrderMsgBiz; import com.xxfc.platform.order.biz.inner.OrderMsgBiz;
import com.xxfc.platform.order.contant.enumerate.*; import com.xxfc.platform.order.contant.enumerate.*;
import com.xxfc.platform.order.entity.*; import com.xxfc.platform.order.entity.*;
import com.xxfc.platform.order.mapper.OrderAccountMapper;
import com.xxfc.platform.order.pojo.DedDetailDTO; import com.xxfc.platform.order.pojo.DedDetailDTO;
import com.xxfc.platform.order.pojo.account.OrderAccountDTO; import com.xxfc.platform.order.pojo.account.OrderAccountDTO;
import com.xxfc.platform.order.pojo.account.OrderAccountDeduction; import com.xxfc.platform.order.pojo.account.OrderAccountDeduction;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail; import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import com.xxfc.platform.order.pojo.calculate.InProgressVO;
import com.xxfc.platform.order.pojo.mq.OrderMQDTO; import com.xxfc.platform.order.pojo.mq.OrderMQDTO;
import com.xxfc.platform.order.pojo.price.CancelStartedVO;
import com.xxfc.platform.order.pojo.price.CostDetailExtend;
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;
...@@ -27,9 +32,6 @@ import org.mockito.internal.util.collections.Sets; ...@@ -27,9 +32,6 @@ import org.mockito.internal.util.collections.Sets;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.order.mapper.OrderAccountMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.List; import java.util.List;
...@@ -248,6 +250,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -248,6 +250,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
return refundStatus; return refundStatus;
} }
public void refundTrigger(BaseOrder baseOrder, OrderRentVehicleDetail orvd, BigDecimal residueAmount, BigDecimal originalRefundAmount, BigDecimal refundAmont, String refundDesc, Integer refundStatus, AccountTypeEnum accountTypeEnum, OrderAccountDetail oad) { public void refundTrigger(BaseOrder baseOrder, OrderRentVehicleDetail orvd, BigDecimal residueAmount, BigDecimal originalRefundAmount, BigDecimal refundAmont, String refundDesc, Integer refundStatus, AccountTypeEnum accountTypeEnum, OrderAccountDetail oad) {
//退款子流程: 订单基础,退款描述,退款金额 //退款子流程: 订单基础,退款描述,退款金额
refundSubProcess(baseOrder, refundDesc, originalRefundAmount, refundAmont, accountTypeEnum.getCode(), refundStatus, oad); refundSubProcess(baseOrder, refundDesc, originalRefundAmount, refundAmont, accountTypeEnum.getCode(), refundStatus, oad);
...@@ -298,7 +301,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -298,7 +301,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
} }
OrderAccountDetail oad = new OrderAccountDetail(); OrderAccountDetail oad = new OrderAccountDetail();
orderCalculateBiz.calculateOrderComplete(orderMQDTO, orderMQDTO.getOrderRentVehicleDetail(), oad, orderItem, orderMQDTO.getOrderRentVehicleDetail().getUsedDay()); InProgressVO inProgressVO = orderCalculateBiz.calculateOrderComplete(orderMQDTO, orderMQDTO.getOrderRentVehicleDetail(), oad, orderItem, orderMQDTO.getOrderRentVehicleDetail().getUsedDay());
//还车扣除款 剩余的 钱,再减去违章预备金 //还车扣除款 剩余的 钱,再减去违章预备金
oad.getDeductions().add( oad.getDeductions().add(
...@@ -318,6 +321,33 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -318,6 +321,33 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
refundTrigger(orderMQDTO, orderMQDTO.getOrderRentVehicleDetail(), illegalReserve, originalRefundAmount, refundAmont, refundDesc, RefundStatusEnum.RESIDUE_ILLEGAL.getCode(), AccountTypeEnum.OUT_PART_DEPOSIT, oad); refundTrigger(orderMQDTO, orderMQDTO.getOrderRentVehicleDetail(), illegalReserve, originalRefundAmount, refundAmont, refundDesc, RefundStatusEnum.RESIDUE_ILLEGAL.getCode(), AccountTypeEnum.OUT_PART_DEPOSIT, oad);
orderDepositRefundRecordBiz.completeRecordStatus(crosstown.getId(), depositRefundRecordStatus); 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.setUsedFreeAmount(inProgressVO.getUsedFreeDaysAmount());
csv.setHadConpon((StrUtil.isNotBlank(orderMQDTO.getCouponTickerNos())? Boolean.TRUE: Boolean.FALSE));
if(csv.getUsedDayNum() == orderMQDTO.getOrderRentVehicleDetail().getDayNum()) {
csv.setType(CostDetailExtend.FINLISH_ONTIME);
}else if(csv.getUsedDayNum() > orderMQDTO.getOrderRentVehicleDetail().getDayNum()){
csv.setType(CostDetailExtend.FINLISH_DELAY);
}else if(csv.getUsedDayNum() < orderMQDTO.getOrderRentVehicleDetail().getDayNum()){
csv.setType(CostDetailExtend.FINLISH_ADVANCE);
}
csv.initParamJson();
//设置明细
orderRentVehicleBiz.updateSelectiveById(new OrderRentVehicleDetail(){{
setId(orderMQDTO.getId());
handelCostDetailExtend(csv);
}});
orderMsgBiz.handelMsgDeposit(orderMQDTO.getOrderRentVehicleDetail(), orderMQDTO, userFeign.userDetailById(orderMQDTO.getUserId()).getData()); orderMsgBiz.handelMsgDeposit(orderMQDTO.getOrderRentVehicleDetail(), orderMQDTO, userFeign.userDetailById(orderMQDTO.getUserId()).getData());
} }
} }
......
...@@ -159,13 +159,15 @@ public class OrderCancelBiz { ...@@ -159,13 +159,15 @@ public class OrderCancelBiz {
orderAccountBiz.refundSubProcess(baseOrder, "", baseOrder.getRealAmount().subtract(orvd.getDeposit()), oad.getDepositAmount().add(oad.getOrderAmount()), AccountTypeEnum.OUT_ORDER_FUND.getCode(), RefundStatusEnum.ALL.getCode(), oad); orderAccountBiz.refundSubProcess(baseOrder, "", baseOrder.getRealAmount().subtract(orvd.getDeposit()), oad.getDepositAmount().add(oad.getOrderAmount()), AccountTypeEnum.OUT_ORDER_FUND.getCode(), RefundStatusEnum.ALL.getCode(), oad);
//如果有扣款项,则生成额外的费用明细 //生成额外的费用明细
CancelStartedVO csv = new CancelStartedVO(); CancelStartedVO csv = new CancelStartedVO();
csv.setConsumeAmount(inProgressVO.getConsumeAmount()); csv.setConsumeAmount(inProgressVO.getConsumeAmount());
csv.setModelAmount(orderItem.getUnitPrice()); csv.setModelAmount(orderItem.getUnitPrice());
csv.setUsedAmount(inProgressVO.getUsedAmount()); csv.setUsedAmount(inProgressVO.getUsedAmount());
csv.setUsedDayNum(inProgressVO.getUsedDays()); csv.setUsedDayNum(inProgressVO.getUsedDays());
csv.setUsedFreeAmount(inProgressVO.getUsedFreeDaysAmount()); csv.setUsedFreeAmount(inProgressVO.getUsedFreeDaysAmount());
csv.setHadConpon((StrUtil.isNotBlank(baseOrder.getCouponTickerNos())? Boolean.TRUE: Boolean.FALSE));
//如果有扣款项,则生成额外的费用明细
if(oad.getDeductions().size() > 0) { if(oad.getDeductions().size() > 0) {
for(OrderAccountDeduction deduction : oad.getDeductions()) { for(OrderAccountDeduction deduction : oad.getDeductions()) {
if(DeductionTypeEnum.VIOLATE_CANCEL.getCode().equals(deduction.getType())) { if(DeductionTypeEnum.VIOLATE_CANCEL.getCode().equals(deduction.getType())) {
...@@ -258,7 +260,7 @@ public class OrderCancelBiz { ...@@ -258,7 +260,7 @@ public class OrderCancelBiz {
cnsv.initParamJson(); cnsv.initParamJson();
//orderTemplateBiz.handleCostDetailExtend(cnsv); //orderTemplateBiz.handleCostDetailExtend(cnsv);
otd.setCostDetailExtend(cnsv.getCostDetail()); otd.handelCostDetailExtend(cnsv);
orderTourDetailBiz.updateSelectiveByIdRe(otd); orderTourDetailBiz.updateSelectiveByIdRe(otd);
} }
} }
......
...@@ -181,7 +181,7 @@ ...@@ -181,7 +181,7 @@
select b.* select b.*
from base_order b from base_order b
LEFT JOIN order_rent_vehicle_detail r on r.order_id = b.id LEFT JOIN order_rent_vehicle_detail r on r.order_id = b.id
where b.type = 1 and r.end_time &gt;= now() where b.type = 1 and r.end_time &gt;= unix_timestamp(now())*1000
<if test="userIds != null and userIds.size > 0"> <if test="userIds != null and userIds.size > 0">
and b.user_id in and b.user_id in
<foreach collection="userIds" item="id" open="(" separator="," close=")"> <foreach collection="userIds" item="id" open="(" separator="," close=")">
...@@ -209,7 +209,6 @@ ...@@ -209,7 +209,6 @@
<foreach collection="companyIds" item="id" open="(" separator="," close=")"> <foreach collection="companyIds" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</if> </if>
<if test="status == 4"> <if test="status == 4">
order by r.start_time order by r.start_time
......
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