Commit fd318436 by weijiguang

.

parent f19ff496
...@@ -213,6 +213,7 @@ public class CouponUserServiceImpl implements ICouponUserService { ...@@ -213,6 +213,7 @@ public class CouponUserServiceImpl implements ICouponUserService {
List<OrderDetail> fitOrderDetails = orderDetails.stream().filter(orderDetail -> fitCouponGoodsIdList.contains(orderDetail.getGoodsId())).collect(Collectors.toList()); List<OrderDetail> fitOrderDetails = orderDetails.stream().filter(orderDetail -> fitCouponGoodsIdList.contains(orderDetail.getGoodsId())).collect(Collectors.toList());
BigDecimal fitGoodsAmount = fitOrderDetails.stream().map(OrderDetail::getAmountShould).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal fitGoodsAmount = fitOrderDetails.stream().map(OrderDetail::getAmountShould).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal fitGoodsOrigDiscount = fitOrderDetails.stream().map(OrderDetail::getOrigDiscount).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal fitGoodsOrigDiscount = fitOrderDetails.stream().map(OrderDetail::getOrigDiscount).reduce(BigDecimal.ZERO, BigDecimal::add);
log.info("fitGoodsOrigDiscount:{}, fitGoodsAmount:{}", fitGoodsOrigDiscount, fitGoodsAmount);
if (couponVo.getPriceLimit() != null && couponVo.getPriceLimit().compareTo(BigDecimal.ZERO) != 0 && couponVo.getPriceLimit().compareTo(fitGoodsAmount) > 0) { if (couponVo.getPriceLimit() != null && couponVo.getPriceLimit().compareTo(BigDecimal.ZERO) != 0 && couponVo.getPriceLimit().compareTo(fitGoodsAmount) > 0) {
if (couponVo.getType().equals(CouponCategoryType.DISCOUNT.getType())) { // 折扣 if (couponVo.getType().equals(CouponCategoryType.DISCOUNT.getType())) { // 折扣
couponVo.setNotFitableDesc("未达到满减要求"); couponVo.setNotFitableDesc("未达到满减要求");
...@@ -260,6 +261,7 @@ public class CouponUserServiceImpl implements ICouponUserService { ...@@ -260,6 +261,7 @@ public class CouponUserServiceImpl implements ICouponUserService {
private void wrapperCouponAmount(CouponVo couponVo, List<OrderDetail> fitOrderDetails, BigDecimal fitGoodsAmount, BigDecimal fitGoodsOrigDiscount) { private void wrapperCouponAmount(CouponVo couponVo, List<OrderDetail> fitOrderDetails, BigDecimal fitGoodsAmount, BigDecimal fitGoodsOrigDiscount) {
Map<Long, BigDecimal> couponAmountMap = new HashMap<>(); Map<Long, BigDecimal> couponAmountMap = new HashMap<>();
log.info("couponVo, getOrderLimit:{}, getType:{}", couponVo.getOrderLimit(), couponVo.getType());
if (couponVo.getOrderLimit() != null && couponVo.getOrderLimit()) { // 单杯 if (couponVo.getOrderLimit() != null && couponVo.getOrderLimit()) { // 单杯
OrderDetail orderDetail = fitOrderDetails.stream().max(Comparator.comparing(OrderDetail::getUnitPrice)).get(); OrderDetail orderDetail = fitOrderDetails.stream().max(Comparator.comparing(OrderDetail::getUnitPrice)).get();
BigDecimal discountAmount = orderDetail.getUnitPrice(); BigDecimal discountAmount = orderDetail.getUnitPrice();
......
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