Commit d42f183d by weijiguang

test

parent af237c33
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;
...@@ -218,18 +219,17 @@ public class CouponUserServiceImpl implements ICouponUserService { ...@@ -218,18 +219,17 @@ public class CouponUserServiceImpl implements ICouponUserService {
AtomicReference<Integer> nums = new AtomicReference<>(0); AtomicReference<Integer> nums = new AtomicReference<>(0);
orderDetails.forEach(x -> nums.updateAndGet(v -> v + x.getNum())); orderDetails.forEach(x -> nums.updateAndGet(v -> v + x.getNum()));
log.info("nums:{}", nums);
if (nums.get() <= 1) { if (nums.get() <= 1) {
OrderDetail orderDetail = orderDetails.get(0); OrderDetail orderDetail = orderDetails.get(0);
orderDetail.setCouponAmount(couponVo.getCouponAmount()); orderDetail.setCouponAmount(couponVo.getCouponAmount());
orderDetail.setRealAmount(orderDetail.getAmountShould().add(orderDetail.getCouponAmount())); orderDetail.setRealAmount(orderDetail.getAmountShould().add(orderDetail.getCouponAmount()));
} else { } else {
orderDetails.forEach(orderDetail -> { orderDetails.forEach(orderDetail -> {
// BigDecimal rate = orderDetail.getAmountShould().divide(new BigDecimal(orderDetail.getNum())).divide(orderTotalOrigDiscount); BigDecimal rate = orderDetail.getAmountShould().divide(orderTotalOrigDiscount);
// log.info("rate:{},detail:{}", rate, JSON.toJSON(orderDetail)); 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().add(orderDetail.getCouponAmount()));
orderDetail.setCouponAmount(BigDecimal.TEN);
orderDetail.setRealAmount(BigDecimal.TEN.max(BigDecimal.TEN));
}); });
} }
} else { } else {
......
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