分店配置同步
This commit is contained in:
@@ -2,6 +2,7 @@ package com.czg.service.account.service.impl;
|
|||||||
|
|
||||||
import com.czg.account.dto.ShopConfigDTO;
|
import com.czg.account.dto.ShopConfigDTO;
|
||||||
import com.czg.account.entity.ShopConfig;
|
import com.czg.account.entity.ShopConfig;
|
||||||
|
import com.czg.account.entity.ShopInfo;
|
||||||
import com.czg.account.service.ShopConfigService;
|
import com.czg.account.service.ShopConfigService;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.service.RedisService;
|
import com.czg.service.RedisService;
|
||||||
@@ -20,6 +21,8 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店铺配置扩展
|
* 店铺配置扩展
|
||||||
@@ -59,19 +62,17 @@ public class ShopConfigServiceImpl extends ServiceImpl<ShopConfigMapper, ShopCon
|
|||||||
shopIdList = new ArrayList<>();
|
shopIdList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
// 防止报错
|
// 防止报错
|
||||||
shopIdList.add(-9999L);
|
Set<Long> childShopIdList = shopInfoMapper.selectListByQuery(new QueryWrapper().eq(ShopInfo::getMainId, mainShopId)
|
||||||
List<Long> extistList;
|
.select(ShopInfo::getId)).stream().map(ShopInfo::getId).collect(Collectors.toSet());
|
||||||
if (!shopIdList.isEmpty()) {
|
childShopIdList.add(mainShopId);
|
||||||
extistList = list(new QueryWrapper().in(ShopConfig::getId, shopIdList).select(ShopConfig::getId)).stream().map(ShopConfig::getId).toList();
|
List<Long> extistList = new ArrayList<>(list(new QueryWrapper().in(ShopConfig::getId, childShopIdList)).stream().map(ShopConfig::getId).toList());
|
||||||
List<Long> finalShopIdList2 = shopIdList;
|
extistList.add(mainShopId);
|
||||||
extistList.stream().filter(id -> !finalShopIdList2.contains(id)).forEach(id -> {
|
childShopIdList.stream().filter(id -> !extistList.contains(id)).forEach(id -> {
|
||||||
save(new ShopConfig().setId(id).setMainId(mainShopId).setIsEnableDiscount(0).setIsProductSuggest(0));
|
save(new ShopConfig().setId(id).setMainId(id.equals(mainShopId) ? null : mainShopId).setIsEnableDiscount(0).setIsProductSuggest(0));
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
extistList = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isEnable == 0 && !onyUpValid) {
|
if (isEnable == 0 && !onyUpValid) {
|
||||||
|
|
||||||
List<Long> finalShopIdList = shopIdList;
|
List<Long> finalShopIdList = shopIdList;
|
||||||
updateChain().or(or -> {
|
updateChain().or(or -> {
|
||||||
or.eq(ShopConfig::getId, mainShopId);
|
or.eq(ShopConfig::getId, mainShopId);
|
||||||
|
|||||||
Reference in New Issue
Block a user