优惠券店铺信息 返回主店信息
This commit is contained in:
@@ -252,18 +252,11 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||||||
coupon.setUseShops("所有门店");
|
coupon.setUseShops("所有门店");
|
||||||
} else if ("custom".equals(coupon.getUseShopType())) {
|
} else if ("custom".equals(coupon.getUseShopType())) {
|
||||||
if (StrUtil.isNotBlank(coupon.getUseShops())) {
|
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())
|
.in(ShopInfo::getId, Arrays.stream(coupon.getUseShops().split(",")).map(Long::parseLong).toList())
|
||||||
.eq(ShopInfo::getStatus, 1), String.class);
|
.eq(ShopInfo::getStatus, 1);
|
||||||
Long mainId = shopInfoService.getMainIdByShopId(coupon.getShopId());
|
List<String> shopNames = shopInfoService.listAs(queryWrapper, String.class);
|
||||||
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++) {
|
||||||
@@ -276,10 +269,7 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(mainShopName)) {
|
coupon.setUseShops(result.toString());
|
||||||
coupon.setUseShops(coupon.getUseShops() + ",");
|
|
||||||
}
|
|
||||||
coupon.setUseShops(coupon.getUseShops() + result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user