Commit 887781b1 by weijiguang

test

parent 1c2610b4
package com.soss.system.service.impl; package com.soss.system.service.impl;
import com.alibaba.fastjson.JSON;
import com.soss.common.enums.CouponCategoryType; import com.soss.common.enums.CouponCategoryType;
import com.soss.common.enums.CouponState; import com.soss.common.enums.CouponState;
import com.soss.common.enums.CouponUserType; import com.soss.common.enums.CouponUserType;
...@@ -210,7 +211,7 @@ public class CouponUserServiceImpl implements ICouponUserService { ...@@ -210,7 +211,7 @@ public class CouponUserServiceImpl implements ICouponUserService {
} }
/** 券价值的判断 */ /** 券价值的判断 */
if (couponVo.getType().equals(CouponCategoryType.DEDUCTION.getType())) { // 抵扣 if (couponVo.getType().equals(CouponCategoryType.DEDUCTION.getType())) { // 抵扣
if (couponVo.getPriceLimit() != null && couponVo.getPriceLimit().compareTo(BigDecimal.ZERO) != 0 && couponVo.getPriceLimit().compareTo(orderTotalAmount) > 0) { if (couponVo.getPriceLimit() != null && couponVo.getPriceLimit().compareTo(BigDecimal.ZERO) != 0 && couponVo.getPriceLimit().compareTo(orderTotalOrigDiscount) > 0) {
couponVo.setNotFitableDesc("未达到满减要求"); couponVo.setNotFitableDesc("未达到满减要求");
return; return;
} }
...@@ -225,6 +226,7 @@ public class CouponUserServiceImpl implements ICouponUserService { ...@@ -225,6 +226,7 @@ public class CouponUserServiceImpl implements ICouponUserService {
} else { } else {
orderDetails.forEach(orderDetail -> { orderDetails.forEach(orderDetail -> {
BigDecimal rate = orderDetail.getAmountShould().divide(new BigDecimal(orderDetail.getNum())).divide(orderTotalOrigDiscount); BigDecimal rate = orderDetail.getAmountShould().divide(new BigDecimal(orderDetail.getNum())).divide(orderTotalOrigDiscount);
log.info("rate:{},detail:{}", rate, JSON.toJSON(orderDetail));
orderDetail.setCouponAmount(couponVo.getCouponAmount().multiply(rate)); orderDetail.setCouponAmount(couponVo.getCouponAmount().multiply(rate));
orderDetail.setRealAmount(orderDetail.getAmountShould().divide(new BigDecimal(orderDetail.getNum())).add(orderDetail.getCouponAmount())); orderDetail.setRealAmount(orderDetail.getAmountShould().divide(new BigDecimal(orderDetail.getNum())).add(orderDetail.getCouponAmount()));
}); });
......
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