商品名称
This commit is contained in:
parent
7f48aa15bc
commit
472bb4c700
|
|
@ -294,27 +294,6 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||
Map<Long, JSONObject> coupons = new HashMap<>();
|
||||
for (UserCouponVo tbUserCouponVo : tbUserCouponVos) {
|
||||
int maxShow = 5;
|
||||
if (StrUtil.isNotBlank(tbUserCouponVo.getFoods())) {
|
||||
List<String> productNames = productService.listAs(new QueryWrapper().select(Product::getName)
|
||||
.in(Product::getId, Arrays.stream(tbUserCouponVo.getFoods().split(",")).map(Long::parseLong).toList())
|
||||
.eq(Product::getIsDel, 0), String.class);
|
||||
if (CollUtil.isNotEmpty(productNames)) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (int i = 0; i < productNames.size(); i++) {
|
||||
if (i > 0) {
|
||||
result.append(",");
|
||||
}
|
||||
result.append(productNames.get(i));
|
||||
if (i == maxShow - 1 && i != productNames.size() - 1) {
|
||||
result.append("...");
|
||||
break;
|
||||
}
|
||||
}
|
||||
tbUserCouponVo.setFoods(result.toString());
|
||||
}
|
||||
} else {
|
||||
tbUserCouponVo.setFoods("全部商品");
|
||||
}
|
||||
if ("only".equals(tbUserCouponVo.getUseShopType())) {
|
||||
ShopInfo shopInfo = shopInfoService.getById(tbUserCouponVo.getShopId());
|
||||
tbUserCouponVo.setUseShops("仅本店:" + shopInfo.getShopName());
|
||||
|
|
@ -366,6 +345,10 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||
tbUserCouponVo.setThresholdFoods(JSON.parseObject(JSON.toJSONString(list), new TypeReference<>() {
|
||||
}));
|
||||
}
|
||||
String foods = list.stream().map(Product::getName).collect(Collectors.joining(","));
|
||||
tbUserCouponVo.setFoods(foods);
|
||||
} else {
|
||||
tbUserCouponVo.setFoods("全部商品");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue