店铺名称 增加 主店铺名称
This commit is contained in:
@@ -254,6 +254,15 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||||||
List<String> shopNames = shopInfoService.listAs(new QueryWrapper().select(ShopInfo::getShopName)
|
List<String> shopNames = shopInfoService.listAs(new QueryWrapper().select(ShopInfo::getShopName)
|
||||||
.in(ShopInfo::getId, Arrays.stream(coupon.getUseShops().split(",")).map(Long::parseLong).toList())
|
.in(ShopInfo::getId, Arrays.stream(coupon.getUseShops().split(",")).map(Long::parseLong).toList())
|
||||||
.eq(ShopInfo::getStatus, 1), String.class);
|
.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)) {
|
if (CollUtil.isNotEmpty(shopNames)) {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
for (int i = 0; i < shopNames.size(); i++) {
|
for (int i = 0; i < shopNames.size(); i++) {
|
||||||
@@ -266,6 +275,9 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (StrUtil.isNotBlank(mainShopName)) {
|
||||||
|
coupon.setUseShops(coupon.getUseShops() + ",");
|
||||||
|
}
|
||||||
coupon.setUseShops(result.toString());
|
coupon.setUseShops(result.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user