|
@@ -279,7 +279,7 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
|
|
return cameraDetailService.saveOrUpdateBatch(cameraDetails) ? cameraDetails.size() : 0;
|
|
return cameraDetailService.saveOrUpdateBatch(cameraDetails) ? cameraDetails.size() : 0;
|
|
}
|
|
}
|
|
|
|
|
|
- private void checkSnCode(List<String> snCodeList) {
|
|
|
|
|
|
+ private void checkSnCode(List<String> snCodeList,List<String> dbSnCode) {
|
|
HashMap<String,Integer> map = new HashMap<>();
|
|
HashMap<String,Integer> map = new HashMap<>();
|
|
for (String snCode : snCodeList) {
|
|
for (String snCode : snCodeList) {
|
|
if(StringUtils.isBlank(snCode)){
|
|
if(StringUtils.isBlank(snCode)){
|
|
@@ -300,6 +300,11 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
|
|
if(errorSnCode.size() >0){
|
|
if(errorSnCode.size() >0){
|
|
throw new BusinessException(-1,"存在重复的snCode:"+errorSnCode);
|
|
throw new BusinessException(-1,"存在重复的snCode:"+errorSnCode);
|
|
}
|
|
}
|
|
|
|
+ for (String snCode : snCodeList) {
|
|
|
|
+ if(!dbSnCode.contains(snCode)){
|
|
|
|
+ throw new BusinessException(-1,"snCode:"+snCode+",不存在");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -374,11 +379,12 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
|
|
private HashMap<String, Object> getResultMap(List<CameraInOutParam> params){
|
|
private HashMap<String, Object> getResultMap(List<CameraInOutParam> params){
|
|
HashMap<String,Object> resultMap = new HashMap<>();
|
|
HashMap<String,Object> resultMap = new HashMap<>();
|
|
List<String> snCodeList = params.parallelStream().map(CameraInOutParam::getSnCode).collect(Collectors.toList());
|
|
List<String> snCodeList = params.parallelStream().map(CameraInOutParam::getSnCode).collect(Collectors.toList());
|
|
- checkSnCode(snCodeList);
|
|
|
|
- List<Camera> cameraList = this.getBySnCodes(snCodeList);
|
|
|
|
- if(cameraList.size() <=0){
|
|
|
|
- throw new BusinessException(-1,"snCode不存在");
|
|
|
|
|
|
+ if(snCodeList.size() <=0){
|
|
|
|
+ throw new BusinessException(-1,"snCode为空");
|
|
}
|
|
}
|
|
|
|
+ List<Camera> cameraList = this.getBySnCodes(snCodeList);
|
|
|
|
+ checkSnCode(snCodeList,cameraList.stream().map(Camera::getSnCode).collect(Collectors.toList()));
|
|
|
|
+
|
|
List<Long> cameraIds = cameraList.parallelStream().map(Camera::getId).collect(Collectors.toList());
|
|
List<Long> cameraIds = cameraList.parallelStream().map(Camera::getId).collect(Collectors.toList());
|
|
List<CameraDetail> cameraDetails = cameraDetailService.getByCameraIds(cameraIds);
|
|
List<CameraDetail> cameraDetails = cameraDetailService.getByCameraIds(cameraIds);
|
|
HashMap<Long,CameraDetail> detailMap = new HashMap<>();
|
|
HashMap<Long,CameraDetail> detailMap = new HashMap<>();
|