Commit e5453028f10c1e7879739ebeca1dc5966edc1fd7

Authored by YunaiV
1 parent f3dd628a

【代码评审】商城:满减送订单

yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/reward/RewardActivityConvert.java deleted
1 -package cn.iocoder.yudao.module.promotion.convert.reward;  
2 -  
3 -import org.mapstruct.Mapper;  
4 -import org.mapstruct.factory.Mappers;  
5 -  
6 -/**  
7 - * 满减送活动 Convert  
8 - *  
9 - * @author 芋道源码  
10 - */  
11 -@Mapper  
12 -public interface RewardActivityConvert {  
13 -  
14 - RewardActivityConvert INSTANCE = Mappers.getMapper(RewardActivityConvert.class);  
15 -  
16 -}  
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/calculator/TradeRewardActivityPriceCalculator.java
@@ -110,6 +110,10 @@ public class TradeRewardActivityPriceCalculator implements TradePriceCalculator @@ -110,6 +110,10 @@ public class TradeRewardActivityPriceCalculator implements TradePriceCalculator
110 if (CollUtil.isNotEmpty(rule.getGiveCouponTemplateCounts())) { 110 if (CollUtil.isNotEmpty(rule.getGiveCouponTemplateCounts())) {
111 for (Map.Entry<Long, Integer> entry : rule.getGiveCouponTemplateCounts().entrySet()) { 111 for (Map.Entry<Long, Integer> entry : rule.getGiveCouponTemplateCounts().entrySet()) {
112 Map<Long, Integer> giveCouponTemplateCounts = result.getGiveCouponTemplateCounts(); 112 Map<Long, Integer> giveCouponTemplateCounts = result.getGiveCouponTemplateCounts();
  113 + // TODO @puhui999:是不是有一种可能性,这个 key 没有,别的 key 有哈。
  114 + // TODO 这里还有一种简化的写法。就是下面,大概两行就可以啦
  115 +// result.getGiveCouponTemplateCounts().put(entry.getKey(),
  116 +// result.getGiveCouponTemplateCounts().getOrDefault(entry.getKey(), 0) + entry.getValue());
113 if (giveCouponTemplateCounts.get(entry.getKey()) == null) { // 情况一:还没有赠送的优惠券 117 if (giveCouponTemplateCounts.get(entry.getKey()) == null) { // 情况一:还没有赠送的优惠券
114 result.setGiveCouponTemplateCounts(rule.getGiveCouponTemplateCounts()); 118 result.setGiveCouponTemplateCounts(rule.getGiveCouponTemplateCounts());
115 } else { // 情况二:别的满减活动送过同类优惠券,则直接增加数量 119 } else { // 情况二:别的满减活动送过同类优惠券,则直接增加数量