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

@@ -580,6 +580,7 @@
update xfsg_shop_info set shop_name = #{item.shopName}, province =#{item.province}, city = #{item.city}, district=#{item.district}, detail_address = #{item.detailAddress} where id = #{item.id} update xfsg_shop_info set shop_name = #{item.shopName}, province =#{item.province}, city = #{item.city}, district=#{item.district}, detail_address = #{item.detailAddress} where id = #{item.id}
</foreach> </foreach>
</update> </update>
<update id="updateManagerRegionId"> <update id="updateManagerRegionId">
<foreach collection="list" item="item" separator=";"> <foreach collection="list" item="item" separator=";">
update xfsg_shop_info set manager_region_id = #{item.managerRegionId} where id = #{item.id} update xfsg_shop_info set manager_region_id = #{item.managerRegionId} where id = #{item.id}

View File

@@ -1175,10 +1175,10 @@ public class DataHandlerServerImpl implements DataHandlerServer {
//查询门店-XX大区下面的管理督导 //查询门店-XX大区下面的管理督导
List<RegionDO> manageRegionList = regionDao.getSubRegionByParentIdsAndRegionType(storeManageIds, "path"); 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"); 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()); List<Long> isShopIds = isCreateStore.stream().map(IsCreateStoreDTO::getShopId).collect(Collectors.toList());
//未建店 //未建店
@@ -1198,7 +1198,7 @@ public class DataHandlerServerImpl implements DataHandlerServer {
continue; continue;
} }
BigRegionDTO bigRegionDTO = bigRegionDTOMap.get(shopInfoDO.getRegionId()); BigRegionDTO bigRegionDTO = bigRegionDTOMap.get(shopInfoDO.getRegionId());
RegionDO regionDO; List<RegionDO> regions = new ArrayList<>();
if (bigRegionDTO==null){ if (bigRegionDTO==null){
log.info("门店所属大区未找到 shopId{}",shopInfoDO.getId()); log.info("门店所属大区未找到 shopId{}",shopInfoDO.getId());
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO(shopInfoDO.getShopCode(), "门店所属大区未找到"); ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO(shopInfoDO.getShopCode(), "门店所属大区未找到");
@@ -1207,18 +1207,30 @@ public class DataHandlerServerImpl implements DataHandlerServer {
continue; continue;
} }
if (bigRegionDTO.getStoreManageRegionId()!=null){ if (bigRegionDTO.getStoreManageRegionId()!=null){
regionDO = manageRegionMap.get(name); regions = manageRegionMap.get(name);
}else{ }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()); log.info("门店所属管理区域未找到 shopId{}",shopInfoDO.getId());
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO(shopInfoDO.getShopCode(), "门店所属管理区域未找到"); ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO(shopInfoDO.getShopCode(), "门店所属管理区域未找到");
errorDTO.setShopName(shopInfoDO.getShopName()); errorDTO.setShopName(shopInfoDO.getShopName());
errorList.add(errorDTO); errorList.add(errorDTO);
continue; 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); updateList.add(shopInfoDO);
} }
shopInfoDAO.updateManagerRegionId(updateList); shopInfoDAO.updateManagerRegionId(updateList);