优惠券商品列表
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<>();
|
Map<Long, JSONObject> coupons = new HashMap<>();
|
||||||
for (UserCouponVo tbUserCouponVo : tbUserCouponVos) {
|
for (UserCouponVo tbUserCouponVo : tbUserCouponVos) {
|
||||||
int maxShow = 5;
|
int maxShow = 5;
|
||||||
// if (StrUtil.isNotBlank(tbUserCouponVo.getFoods())) {
|
if (StrUtil.isNotBlank(tbUserCouponVo.getFoods())) {
|
||||||
// List<String> productNames = productService.listAs(new QueryWrapper().select(Product::getName)
|
List<String> productNames = productService.listAs(new QueryWrapper().select(Product::getName)
|
||||||
// .in(Product::getId, Arrays.stream(tbUserCouponVo.getFoods().split(",")).map(Long::parseLong).toList())
|
.in(Product::getId, Arrays.stream(tbUserCouponVo.getFoods().split(",")).map(Long::parseLong).toList())
|
||||||
// .eq(Product::getIsDel, 0), String.class);
|
.eq(Product::getIsDel, 0), String.class);
|
||||||
// if (CollUtil.isNotEmpty(productNames)) {
|
if (CollUtil.isNotEmpty(productNames)) {
|
||||||
// StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
// for (int i = 0; i < productNames.size(); i++) {
|
for (int i = 0; i < productNames.size(); i++) {
|
||||||
// if (i > 0) {
|
if (i > 0) {
|
||||||
// result.append(",");
|
result.append(",");
|
||||||
// }
|
}
|
||||||
// result.append(productNames.get(i));
|
result.append(productNames.get(i));
|
||||||
// if (i == maxShow - 1 && i != productNames.size() - 1) {
|
if (i == maxShow - 1 && i != productNames.size() - 1) {
|
||||||
// result.append("...");
|
result.append("...");
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// tbUserCouponVo.setFoods(result.toString());
|
tbUserCouponVo.setFoods(result.toString());
|
||||||
// }
|
}
|
||||||
// } else {
|
} else {
|
||||||
// tbUserCouponVo.setFoods("全部商品");
|
tbUserCouponVo.setFoods("全部商品");
|
||||||
// }
|
}
|
||||||
if ("only".equals(tbUserCouponVo.getUseShopType())) {
|
if ("only".equals(tbUserCouponVo.getUseShopType())) {
|
||||||
ShopInfo shopInfo = shopInfoService.getById(tbUserCouponVo.getShopId());
|
ShopInfo shopInfo = shopInfoService.getById(tbUserCouponVo.getShopId());
|
||||||
tbUserCouponVo.setUseShops("仅本店:" + shopInfo.getShopName());
|
tbUserCouponVo.setUseShops("仅本店:" + shopInfo.getShopName());
|
||||||
|
|
@ -322,7 +322,6 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
||||||
tbUserCouponVo.setUseShops("所有门店");
|
tbUserCouponVo.setUseShops("所有门店");
|
||||||
} else if ("custom".equals(tbUserCouponVo.getUseShopType())) {
|
} else if ("custom".equals(tbUserCouponVo.getUseShopType())) {
|
||||||
if (StrUtil.isNotBlank(tbUserCouponVo.getUseShops())) {
|
if (StrUtil.isNotBlank(tbUserCouponVo.getUseShops())) {
|
||||||
tbUserCouponVo.setUseShops(tbUserCouponVo.getUseShops() + "," + tbUserCouponVo.getShopId());
|
|
||||||
QueryWrapper queryWrapper = QueryWrapper.create().select(ShopInfo::getShopName)
|
QueryWrapper queryWrapper = QueryWrapper.create().select(ShopInfo::getShopName)
|
||||||
.in(ShopInfo::getId, Arrays.stream(tbUserCouponVo.getUseShops().split(",")).map(Long::parseLong).toList())
|
.in(ShopInfo::getId, Arrays.stream(tbUserCouponVo.getUseShops().split(",")).map(Long::parseLong).toList())
|
||||||
.eq(ShopInfo::getStatus, 1);
|
.eq(ShopInfo::getStatus, 1);
|
||||||
|
|
@ -355,6 +354,7 @@ 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);
|
||||||
if (CollUtil.isEmpty(list)) {
|
if (CollUtil.isEmpty(list)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue