Commit 2009486c authored by 周健威's avatar 周健威

Merge branch 'master-modify-cutAmount' into dev

parents 39eb1eab 6969ee68
...@@ -115,20 +115,7 @@ public class OrderCalculateBiz { ...@@ -115,20 +115,7 @@ public class OrderCalculateBiz {
consumeAmount = consumeAmount.add(otherItemRealAmount); consumeAmount = consumeAmount.add(otherItemRealAmount);
inProgressVO.setConsumeAmount(consumeAmount); inProgressVO.setConsumeAmount(consumeAmount);
if(consumeAmount.compareTo(BigDecimal.ZERO) > 0) { refundAmount = handleConsumeAmount(oad, refundAmount, consumeAmount, goodsRealAmount, inProgressVO);
//消费金额 大于0 增加额外费用
OrderAccountDeduction extraDeduction = orderAccountBiz.initDeduction(consumeAmount, "消费金额", DeductionTypeEnum.CONSUME, OrderAccountDeduction.ORIGIN_ORDER_DEPOSIT);
oad.getDeductions().add(extraDeduction);
}
//消费金额 小于商品真实的金额 返回钱
if(consumeAmount.compareTo(goodsRealAmount) <= 0) {
//设置返回钱
refundAmount = refundAmount.add(goodsRealAmount.subtract(consumeAmount));
}else {
//设置额外扣减(押金里面扣)
inProgressVO.setExtraAmount(consumeAmount.subtract(goodsRealAmount));
}
}else { }else {
//设置免费天数 //设置免费天数
inProgressVO.setUsedfreeDays(useDays); inProgressVO.setUsedfreeDays(useDays);
...@@ -138,6 +125,18 @@ public class OrderCalculateBiz { ...@@ -138,6 +125,18 @@ public class OrderCalculateBiz {
refundAmount = refundAmount.add(goodsRealAmount); refundAmount = refundAmount.add(goodsRealAmount);
inProgressVO.setBackFreeDays(backFreeDays); inProgressVO.setBackFreeDays(backFreeDays);
//返回优惠券
if(StrUtil.isNotBlank(baseOrder.getCouponTickerNos())) {
//返回所有优惠券
inProgressVO.setBackCoupons(StrUtil.split(baseOrder.getCouponTickerNos(), ','));
}
//设置消费金额 由于返回了优惠券,所以添加优惠券之前减免的金额
consumeAmount = consumeAmount.add(otherItemRealAmount).add(baseOrder.getCouponAmount());
inProgressVO.setConsumeAmount(consumeAmount);
refundAmount = handleConsumeAmount(oad, refundAmount, consumeAmount, goodsRealAmount, inProgressVO);
} }
inProgressVO.setRefundOrderAmount(refundAmount); inProgressVO.setRefundOrderAmount(refundAmount);
...@@ -177,6 +176,24 @@ public class OrderCalculateBiz { ...@@ -177,6 +176,24 @@ public class OrderCalculateBiz {
return inProgressVO; return inProgressVO;
} }
private BigDecimal handleConsumeAmount(OrderAccountDetail oad, BigDecimal refundAmount, BigDecimal consumeAmount, BigDecimal goodsRealAmount, InProgressVO inProgressVO) {
if (consumeAmount.compareTo(BigDecimal.ZERO) > 0) {
//消费金额 大于0 增加额外费用
OrderAccountDeduction consumeDeduction = orderAccountBiz.initDeduction(consumeAmount, "消费金额", DeductionTypeEnum.CONSUME, OrderAccountDeduction.ORIGIN_ORDER_DEPOSIT);
oad.getDeductions().add(consumeDeduction);
}
//消费金额 小于商品真实的金额 返回钱
if (consumeAmount.compareTo(goodsRealAmount) <= 0) {
//设置返回钱
refundAmount = refundAmount.add(goodsRealAmount.subtract(consumeAmount));
} else {
//设置额外扣减(押金里面扣)
inProgressVO.setExtraAmount(consumeAmount.subtract(goodsRealAmount));
}
return refundAmount;
}
public InProgressVO inProgressCalculate(BaseOrder baseOrder, Integer useDays) { public InProgressVO inProgressCalculate(BaseOrder baseOrder, Integer useDays) {
OrderItem orderItem = orderItemBiz.selectOne(new OrderItem(){{ OrderItem orderItem = orderItemBiz.selectOne(new OrderItem(){{
setType(ItemTypeEnum.VEHICLE_MODEL.getCode()); setType(ItemTypeEnum.VEHICLE_MODEL.getCode());
......
...@@ -143,6 +143,8 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe ...@@ -143,6 +143,8 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
, orderPageVO.getOrderTourDetail().getStartTime() - System.currentTimeMillis() , orderPageVO.getOrderTourDetail().getStartTime() - System.currentTimeMillis()
, DictionaryKey.APP_ORDER+ "_"+ key , DictionaryKey.APP_ORDER+ "_"+ key
, refundDescBuilder); , refundDescBuilder);
totalDeductAmount = deductionAmount;
totalRefundAmount = orderPageVO.getRealAmount().subtract(deductionAmount); totalRefundAmount = orderPageVO.getRealAmount().subtract(deductionAmount);
refundDesc = refundDescBuilder.toString(); refundDesc = refundDescBuilder.toString();
break; break;
......
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