ソースを参照

Merge remote-tracking branch 'origin/master'

zhangkaikai 1 年間 前
コミット
bee31c0548

+ 4 - 1
mp-admin/src/main/java/com/qs/mp/web/controller/api/admin/CouponMgrController.java

@@ -107,7 +107,10 @@ public class CouponMgrController extends BaseApiController {
             // 排除采购商品已绑定的优惠劵
             List<Goods> goodsList = goodsService.list(new LambdaQueryWrapper<Goods>().eq(Goods::getType, 3));
             List<Long> couponIdList = goodsList.stream().map(Goods::getRefId).map(Long::new).collect(Collectors.toList());
-            couponIdList.removeIf(c -> c.equals(Long.valueOf(coupon.getCouponId())));
+            if (coupon.getCouponId() != null) {
+                // 商品自己绑定的优惠劵不去除
+                couponIdList.removeIf(c -> c.equals(Long.valueOf(coupon.getCouponId())));
+            }
             coupon.setExcludeCouponIds(couponIdList);
         }
         List<Coupon> list = new ArrayList<Coupon>();