优惠券商品列表
This commit is contained in:
parent
7fbc7a9b73
commit
7f48aa15bc
|
|
@ -294,27 +294,27 @@ 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 (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());
|
||||
|
|
@ -322,7 +322,6 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||
tbUserCouponVo.setUseShops("所有门店");
|
||||
} else if ("custom".equals(tbUserCouponVo.getUseShopType())) {
|
||||
if (StrUtil.isNotBlank(tbUserCouponVo.getUseShops())) {
|
||||
tbUserCouponVo.setUseShops(tbUserCouponVo.getUseShops() + "," + tbUserCouponVo.getShopId());
|
||||
QueryWrapper queryWrapper = QueryWrapper.create().select(ShopInfo::getShopName)
|
||||
.in(ShopInfo::getId, Arrays.stream(tbUserCouponVo.getUseShops().split(",")).map(Long::parseLong).toList())
|
||||
.eq(ShopInfo::getStatus, 1);
|
||||
|
|
@ -355,6 +354,7 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||
if (CollUtil.isNotEmpty(couponFoodIds)) {
|
||||
List<Product> list = productService.list(new QueryWrapper()
|
||||
.in(Product::getId, couponFoodIds).eq(Product::getIsDel, 0));
|
||||
log.info("优惠券商品列表:{}", list);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue