mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-19 03:30:06 +08:00
【代码评审】商城:满减送订单
This commit is contained in:
parent
f3dd628aba
commit
e5453028f1
@ -1,16 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.convert.reward;
|
|
||||||
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 满减送活动 Convert
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface RewardActivityConvert {
|
|
||||||
|
|
||||||
RewardActivityConvert INSTANCE = Mappers.getMapper(RewardActivityConvert.class);
|
|
||||||
|
|
||||||
}
|
|
@ -110,6 +110,10 @@ public class TradeRewardActivityPriceCalculator implements TradePriceCalculator
|
|||||||
if (CollUtil.isNotEmpty(rule.getGiveCouponTemplateCounts())) {
|
if (CollUtil.isNotEmpty(rule.getGiveCouponTemplateCounts())) {
|
||||||
for (Map.Entry<Long, Integer> entry : rule.getGiveCouponTemplateCounts().entrySet()) {
|
for (Map.Entry<Long, Integer> entry : rule.getGiveCouponTemplateCounts().entrySet()) {
|
||||||
Map<Long, Integer> giveCouponTemplateCounts = result.getGiveCouponTemplateCounts();
|
Map<Long, Integer> giveCouponTemplateCounts = result.getGiveCouponTemplateCounts();
|
||||||
|
// TODO @puhui999:是不是有一种可能性,这个 key 没有,别的 key 有哈。
|
||||||
|
// TODO 这里还有一种简化的写法。就是下面,大概两行就可以啦
|
||||||
|
// result.getGiveCouponTemplateCounts().put(entry.getKey(),
|
||||||
|
// result.getGiveCouponTemplateCounts().getOrDefault(entry.getKey(), 0) + entry.getValue());
|
||||||
if (giveCouponTemplateCounts.get(entry.getKey()) == null) { // 情况一:还没有赠送的优惠券
|
if (giveCouponTemplateCounts.get(entry.getKey()) == null) { // 情况一:还没有赠送的优惠券
|
||||||
result.setGiveCouponTemplateCounts(rule.getGiveCouponTemplateCounts());
|
result.setGiveCouponTemplateCounts(rule.getGiveCouponTemplateCounts());
|
||||||
} else { // 情况二:别的满减活动送过同类优惠券,则直接增加数量
|
} else { // 情况二:别的满减活动送过同类优惠券,则直接增加数量
|
||||||
|
Loading…
Reference in New Issue
Block a user