优惠券店铺信息 返回主店信息
This commit is contained in:
parent
80cc0c2497
commit
8bb4568d0b
|
|
@ -252,18 +252,11 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||
coupon.setUseShops("所有门店");
|
||||
} else if ("custom".equals(coupon.getUseShopType())) {
|
||||
if (StrUtil.isNotBlank(coupon.getUseShops())) {
|
||||
List<String> shopNames = shopInfoService.listAs(new QueryWrapper().select(ShopInfo::getShopName)
|
||||
coupon.setUseShops(coupon.getUseShops() + "," + coupon.getShopId());
|
||||
QueryWrapper queryWrapper = QueryWrapper.create().select(ShopInfo::getShopName)
|
||||
.in(ShopInfo::getId, Arrays.stream(coupon.getUseShops().split(",")).map(Long::parseLong).toList())
|
||||
.eq(ShopInfo::getStatus, 1), String.class);
|
||||
Long mainId = shopInfoService.getMainIdByShopId(coupon.getShopId());
|
||||
String mainShopName = "";
|
||||
if (!mainId.equals(coupon.getShopId())) {
|
||||
ShopInfo mainShop = shopInfoService.getById(mainId);
|
||||
mainShopName = mainShop.getShopName();
|
||||
}
|
||||
if (StrUtil.isNotBlank(mainShopName)) {
|
||||
coupon.setUseShops(mainShopName);
|
||||
}
|
||||
.eq(ShopInfo::getStatus, 1);
|
||||
List<String> shopNames = shopInfoService.listAs(queryWrapper, String.class);
|
||||
if (CollUtil.isNotEmpty(shopNames)) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (int i = 0; i < shopNames.size(); i++) {
|
||||
|
|
@ -276,10 +269,7 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(mainShopName)) {
|
||||
coupon.setUseShops(coupon.getUseShops() + ",");
|
||||
}
|
||||
coupon.setUseShops(coupon.getUseShops() + result);
|
||||
coupon.setUseShops(result.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue