Browse Source

导入行政区域拦截去除

v1.0
15989082884@163.com 2 years ago
parent
commit
b8c9a883c0
  1. 44
      src/main/java/com/qs/serve/modules/bms/controller/BmsChannelPointController.java

44
src/main/java/com/qs/serve/modules/bms/controller/BmsChannelPointController.java

@ -307,9 +307,9 @@ public class BmsChannelPointController {
if(!StringUtils.hasText(a.getPointType())){
a.setErrorInfo(a.getErrorInfo()+"网点类型不能为空;");
}
if(!StringUtils.hasText(a.getBizRegionCode())){
a.setErrorInfo(a.getErrorInfo()+"行政区域编码不能为空;");
}
// if(!StringUtils.hasText(a.getBizRegionCode())){
// a.setErrorInfo(a.getErrorInfo()+"行政区域编码不能为空;");
// }
if(!StringUtils.hasText(a.getShopArea())){
a.setErrorInfo(a.getErrorInfo()+"店铺面积不能为空;");
}
@ -359,17 +359,17 @@ public class BmsChannelPointController {
LambdaQueryWrapper<BmsRegion2> region2LambdaQueryWrapper = new LambdaQueryWrapper<>();
region2LambdaQueryWrapper.in(BmsRegion2::getCode,bizRegionCodes);
region2List = bmsRegion2Service.list(region2LambdaQueryWrapper);
List<String> existRegion2Code = region2List.stream().map(a -> a.getCode()).collect(Collectors.toList());
if(region2List.size()<bizRegionCodes.size()) {
param.forEach(a -> {
if(a.getType().equals("4")){
return;
}
if(!existRegion2Code.contains(a.getBizRegionCode())){
a.setErrorInfo(a.getErrorInfo()+"不存在该行政区域编码;");
}
});
}
// List<String> existRegion2Code = region2List.stream().map(a -> a.getCode()).collect(Collectors.toList());
// if(region2List.size()<bizRegionCodes.size()) {
// param.forEach(a -> {
// if(a.getType().equals("4")){
// return;
// }
// if(!existRegion2Code.contains(a.getBizRegionCode())){
// a.setErrorInfo(a.getErrorInfo()+"不存在该行政区域编码;");
// }
// });
// }
}
Map<String,BmsRegion2> codeToBizRegion = region2List.stream().collect(Collectors.toMap(BmsRegion2::getCode, a->a));
@ -465,9 +465,11 @@ public class BmsChannelPointController {
bmsChannelPoint.setChannelId(channel.getId());
bmsChannelPoint.setChannelName(channel.getChannelName());
bmsChannelPoint.setChannelType(channel.getChannelType());
bmsChannelPoint.setBizRegionId(region2.getId());
bmsChannelPoint.setBizRegionPath(region2.getPathNames());
bmsChannelPoint.setBizRegionPathIds(region2.getPathIds());
if(region2!=null) {
bmsChannelPoint.setBizRegionId(region2.getId());
bmsChannelPoint.setBizRegionPath(region2.getPathNames());
bmsChannelPoint.setBizRegionPathIds(region2.getPathIds());
}
return bmsChannelPoint;
}).collect(Collectors.toList());
bmsChannelPointService.saveBatch(saveBmsChannels);
@ -483,9 +485,11 @@ public class BmsChannelPointController {
bmsChannelPoint.setChannelId(channel.getId());
bmsChannelPoint.setChannelName(channel.getChannelName());
bmsChannelPoint.setChannelType(channel.getChannelType());
bmsChannelPoint.setBizRegionId(region2.getId());
bmsChannelPoint.setBizRegionPath(region2.getPathNames());
bmsChannelPoint.setBizRegionPathIds(region2.getPathIds());
if(region2!=null) {
bmsChannelPoint.setBizRegionId(region2.getId());
bmsChannelPoint.setBizRegionPath(region2.getPathNames());
bmsChannelPoint.setBizRegionPathIds(region2.getPathIds());
}
return bmsChannelPoint;
}).collect(Collectors.toList());
List<String> updateCodes = updateBmsChannelPoints.stream().map(a -> a.getPointCode()).collect(Collectors.toList());

Loading…
Cancel
Save