门槛商品 可用商品

This commit is contained in:
2025-10-09 17:08:29 +08:00
parent 9a9b72e038
commit 5054534e01

View File

@@ -333,17 +333,16 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
if (CollUtil.isNotEmpty(couponFoodIds)) { if (CollUtil.isNotEmpty(couponFoodIds)) {
List<Product> list = productService.list(new QueryWrapper() List<Product> list = productService.list(new QueryWrapper()
.in(Product::getId, couponFoodIds).eq(Product::getIsDel, 0)); .in(Product::getId, couponFoodIds).eq(Product::getIsDel, 0));
log.info("优惠券商品列表:{}", list); // log.info("优惠券商品列表:{}", list);
if (CollUtil.isEmpty(list)) { if (CollUtil.isEmpty(list)) {
continue; continue;
} }
if (tbUserCouponVo.getType() == 2) { if (tbUserCouponVo.getType() == 1 || tbUserCouponVo.getType() == 3) {
tbUserCouponVo.setUseFoods(JSON.parseObject(JSON.toJSONString(list), new TypeReference<>() {
}));
} else {
tbUserCouponVo.setThresholdFoods(JSON.parseObject(JSON.toJSONString(list), new TypeReference<>() { tbUserCouponVo.setThresholdFoods(JSON.parseObject(JSON.toJSONString(list), new TypeReference<>() {
})); }));
} else {
tbUserCouponVo.setUseFoods(JSON.parseObject(JSON.toJSONString(list), new TypeReference<>() {
}));
} }
String foods = list.stream().map(Product::getName).collect(Collectors.joining(",")); String foods = list.stream().map(Product::getName).collect(Collectors.joining(","));
tbUserCouponVo.setFoods(foods); tbUserCouponVo.setFoods(foods);