Merge branch 'cc_20250710_userRegion' into 'master'

fix

See merge request hangzhou/java/custom_zxjp!132
This commit is contained in:
苏竹红
2025-07-17 11:39:42 +00:00
2 changed files with 20 additions and 7 deletions

View File

@@ -1175,10 +1175,10 @@ public class DataHandlerServerImpl implements DataHandlerServer {
//查询门店-XX大区下面的管理督导
List<RegionDO> manageRegionList = regionDao.getSubRegionByParentIdsAndRegionType(storeManageIds, "path");
Map<String, RegionDO> manageRegionMap = manageRegionList.stream().collect(Collectors.toMap(regionDO -> regionDO.getName(), Function.identity()));
Map<String, List<RegionDO>> manageRegionMap = manageRegionList.stream().collect(Collectors.groupingBy(RegionDO::getName));
//查询加盟分部下的管理督导
List<RegionDO> branchStoreManageList = regionDao.getSubRegionByParentIdsAndRegionType(branchStoreManageIds, "path");
Map<String, RegionDO> branchStoreManageMap = branchStoreManageList.stream().collect(Collectors.toMap(regionDO -> regionDO.getName(), Function.identity()));
Map<String, List<RegionDO>> branchStoreManageMap = branchStoreManageList.stream().collect(Collectors.groupingBy(RegionDO::getName));
List<Long> isShopIds = isCreateStore.stream().map(IsCreateStoreDTO::getShopId).collect(Collectors.toList());
//未建店
@@ -1198,7 +1198,7 @@ public class DataHandlerServerImpl implements DataHandlerServer {
continue;
}
BigRegionDTO bigRegionDTO = bigRegionDTOMap.get(shopInfoDO.getRegionId());
RegionDO regionDO;
List<RegionDO> regions = new ArrayList<>();
if (bigRegionDTO==null){
log.info("门店所属大区未找到 shopId{}",shopInfoDO.getId());
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO(shopInfoDO.getShopCode(), "门店所属大区未找到");
@@ -1207,18 +1207,30 @@ public class DataHandlerServerImpl implements DataHandlerServer {
continue;
}
if (bigRegionDTO.getStoreManageRegionId()!=null){
regionDO = manageRegionMap.get(name);
regions = manageRegionMap.get(name);
}else{
regionDO= branchStoreManageMap.get(name);
regions= branchStoreManageMap.get(name);
}
if (Objects.isNull(regionDO)||!Long.valueOf(regionDO.getParentId()).equals(bigRegionDTO.getStoreManageRegionId())){
if (CollectionUtils.isEmpty(regions)){
log.info("门店所属管理区域未找到 shopId{}",shopInfoDO.getId());
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO(shopInfoDO.getShopCode(), "门店所属管理区域未找到");
errorDTO.setShopName(shopInfoDO.getShopName());
errorList.add(errorDTO);
continue;
}
shopInfoDO.setManagerRegionId(regionDO.getId());
for(RegionDO regionDO:regions){
if (Long.valueOf(regionDO.getParentId()).equals(bigRegionDTO.getStoreManageRegionId())){
shopInfoDO.setManagerRegionId(regionDO.getId());
break;
}
}
if (shopInfoDO.getManagerRegionId()==null){
log.info("门店所属管理区域未找到 shopId{}",shopInfoDO.getId());
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO(shopInfoDO.getShopCode(), "门店所属管理区域未找到");
errorDTO.setShopName(shopInfoDO.getShopName());
errorList.add(errorDTO);
continue;
}
updateList.add(shopInfoDO);
}
shopInfoDAO.updateManagerRegionId(updateList);