数据处理

This commit is contained in:
shuo.wang
2025-07-15 15:37:20 +08:00
parent b3c6e52685
commit e8805ee6bc
6 changed files with 27 additions and 10 deletions

View File

@@ -325,7 +325,7 @@ public class ShopInfoDAO {
Example example = new Example(ShopInfoDO.class); Example example = new Example(ShopInfoDO.class);
example.createCriteria(). example.createCriteria().
andNotIn("id", isCreateShopIds).andNotEqualTo("shopStatus", 2).andEqualTo("deleted", false) andNotIn("id", isCreateShopIds).andNotEqualTo("shopStatus", 2).andEqualTo("deleted", false)
.andNotEqualTo("region_id",459); .andNotEqualTo("regionId",459);
return shopInfoMapper.selectByExample(example); return shopInfoMapper.selectByExample(example);
} }
public Integer updateManagerRegionId(List<ShopInfoDO> shopList){ public Integer updateManagerRegionId(List<ShopInfoDO> shopList){

View File

@@ -22,7 +22,8 @@
<select id="queryAllBigRegion" resultType="com.cool.store.dto.region.BigRegionDTO"> <select id="queryAllBigRegion" resultType="com.cool.store.dto.region.BigRegionDTO">
select DISTINCT select DISTINCT
region_id as regionId, region_id as regionId,
region_name as regionName region_name as regionName,
group_name as groupName
FROM `xfsg_big_region` FROM `xfsg_big_region`
<where> <where>
<if test="keyword!=null and keyword !=''"> <if test="keyword!=null and keyword !=''">

View File

@@ -545,10 +545,10 @@
</select> </select>
<select id="selectIsCreateStore" resultType="com.cool.store.dto.IsCreateStoreDTO"> <select id="selectIsCreateStore" resultType="com.cool.store.dto.IsCreateStoreDTO">
SELECT a.id as shopId, c.parent_id as `pid` SELECT a.shop_name as shopName,a.id as shopId, c.id as `pid`,c.name as pidName
FROM xfsg_shop_info a FROM xfsg_shop_info a
LEFT JOIN store_214ac5a3a517472a87268e02a2e6410a b ON a.shop_code = b.store_num LEFT JOIN store_${enterpriseId} b ON a.shop_code = b.store_num
LEFT JOIN `region_214ac5a3a517472a87268e02a2e6410a` c on b.region_id = c.`id` LEFT JOIN region_${enterpriseId} c on b.region_id = c.`id`
WHERE b.store_num is not null WHERE b.store_num is not null
and a.shop_code is not null and a.shop_code is not null
and a.deleted =0 and a.deleted =0

View File

@@ -16,10 +16,14 @@ public class ImportOaOldShopDataErrorDTO {
@ExcelProperty(value = "门店编码", order = 1) @ExcelProperty(value = "门店编码", order = 1)
@ColumnWidth(30) @ColumnWidth(30)
private String shopCode; private String shopCode;
@ExcelProperty(value = "错误原因", order = 2) @ExcelProperty(value = "门店", order = 2)
@ColumnWidth(30)
private String shopName;
@ExcelProperty(value = "错误原因", order =3)
@ColumnWidth(40) @ColumnWidth(40)
private String errorReason; private String errorReason;
public ImportOaOldShopDataErrorDTO() { public ImportOaOldShopDataErrorDTO() {
} }

View File

@@ -11,6 +11,8 @@ import lombok.Data;
@Data @Data
public class IsCreateStoreDTO { public class IsCreateStoreDTO {
private String shopName;
private Long shopId; private Long shopId;
private Long pid; private Long pid;

View File

@@ -1155,6 +1155,7 @@ public class DataHandlerServerImpl implements DataHandlerServer {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void dataHandlerCreateStore() { public void dataHandlerCreateStore() {
//已经创建了的门店 //已经创建了的门店
List<IsCreateStoreDTO> isCreateStore = shopInfoDAO.selectIsCreateStore( ); List<IsCreateStoreDTO> isCreateStore = shopInfoDAO.selectIsCreateStore( );
@@ -1191,11 +1192,19 @@ public class DataHandlerServerImpl implements DataHandlerServer {
if (StringUtils.isBlank(name)){ if (StringUtils.isBlank(name)){
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());
errorList.add(errorDTO); errorList.add(errorDTO);
continue; continue;
} }
BigRegionDTO bigRegionDTO = bigRegionDTOMap.get(shopInfoDO.getId()); BigRegionDTO bigRegionDTO = bigRegionDTOMap.get(shopInfoDO.getRegionId());
RegionDO regionDO; RegionDO regionDO;
if (bigRegionDTO==null){
log.info("门店所属大区未找到 shopId{}",shopInfoDO.getId());
ImportOaOldShopDataErrorDTO errorDTO = new ImportOaOldShopDataErrorDTO(shopInfoDO.getShopCode(), "门店所属大区未找到");
errorDTO.setShopName(shopInfoDO.getShopName());
errorList.add(errorDTO);
continue;
}
if (bigRegionDTO.getStoreManageRegionId()==null){ if (bigRegionDTO.getStoreManageRegionId()==null){
regionDO = manageRegionMap.get(name); regionDO = manageRegionMap.get(name);
}else{ }else{
@@ -1204,6 +1213,7 @@ public class DataHandlerServerImpl implements DataHandlerServer {
if (Objects.isNull(regionDO)){ if (Objects.isNull(regionDO)){
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());
errorList.add(errorDTO); errorList.add(errorDTO);
continue; continue;
} }
@@ -1224,8 +1234,8 @@ public class DataHandlerServerImpl implements DataHandlerServer {
importTaskDO.setFileName("同步门店数据错误列表"); importTaskDO.setFileName("同步门店数据错误列表");
importTaskDO.setFileType(FileTypeEnum.IMPORT_FITMENT_SHOP_STAGE.getFileType()); importTaskDO.setFileType(FileTypeEnum.IMPORT_FITMENT_SHOP_STAGE.getFileType());
importTaskDO.setIsImport(true); importTaskDO.setIsImport(true);
importTaskDO.setFileType(url); importTaskDO.setFileUrl(url);
importTaskDO.setStatus(ImportTaskStatusEnum.PROGRESS.getCode()); importTaskDO.setStatus(ImportTaskStatusEnum.ERROR.getCode());
importTaskDO.setCreateUserId(CurrentUserHolder.getUserId()); importTaskDO.setCreateUserId(CurrentUserHolder.getUserId());
importTaskDO.setCreateName(CurrentUserHolder.getUser().getName()); importTaskDO.setCreateName(CurrentUserHolder.getUser().getName());
importTaskDO.setCreateTime(System.currentTimeMillis()); importTaskDO.setCreateTime(System.currentTimeMillis());