店铺名称 增加 主店铺名称

This commit is contained in:
wangw 2025-09-26 11:02:59 +08:00
parent c7f5acf2e1
commit 339ac0ff8b
1 changed files with 12 additions and 0 deletions

View File

@ -254,6 +254,15 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
List<String> shopNames = shopInfoService.listAs(new QueryWrapper().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);
}
if (CollUtil.isNotEmpty(shopNames)) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < shopNames.size(); i++) {
@ -266,6 +275,9 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
break;
}
}
if (StrUtil.isNotBlank(mainShopName)) {
coupon.setUseShops(coupon.getUseShops() + ",");
}
coupon.setUseShops(result.toString());
}
}