Browse Source

导入行政区域拦截去除

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

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

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

Loading…
Cancel
Save