|
@@ -112,15 +112,19 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
|
|
|
List<CameraType> list = cameraTypeService.list();
|
|
|
Set<String> wifiNamePrefixList = list.stream().map(CameraType::getWifiNamePrefix).collect(Collectors.toSet());
|
|
|
|
|
|
- if(!wifiNamePrefixList.contains(wifiName)){
|
|
|
+ if(!wifiName.contains("_")){
|
|
|
+ throw new BusinessException(ResultCode.WIFI_NAME_ERROR);
|
|
|
+ }
|
|
|
+ String[] split = wifiName.split("_");
|
|
|
+ String cameraPrefix = split[0] +"_";
|
|
|
+ String snCode = split[1];
|
|
|
+
|
|
|
+ if(!wifiNamePrefixList.contains(cameraPrefix)){
|
|
|
throw new BusinessException(ResultCode.WIFI_NAME_ERROR);
|
|
|
}
|
|
|
HashMap<String,CameraType> cameraTypeMap = new HashMap<>();
|
|
|
list.forEach(entity->cameraTypeMap.put(entity.getWifiNamePrefix(),entity));
|
|
|
|
|
|
- String[] split = wifiName.split("_");
|
|
|
- String cameraPrefix = split[0];
|
|
|
- String snCode = split[1];
|
|
|
if(cameraTypeMap.get(cameraPrefix) == null){
|
|
|
throw new BusinessException(ResultCode.WIFI_NAME_ERROR);
|
|
|
}
|
|
@@ -163,7 +167,7 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
|
|
|
cameraDetail.setAgency(CameraConstant.DEFAULT_AGENT);
|
|
|
cameraDetail.setCameraId(camera.getId());
|
|
|
cameraDetail.setCountry(0);//默认中国
|
|
|
- String wifiNamePrix = camera.getWifiName().split("_")[0];
|
|
|
+ String wifiNamePrix = camera.getWifiName().split("_")[0]+"_";
|
|
|
CameraType cameraType = cameraTypeMap.get(wifiNamePrix);
|
|
|
cameraDetail.setType(cameraType.getCameraType());
|
|
|
|
|
@@ -226,7 +230,12 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
|
|
|
errorIndexList.add(index);
|
|
|
continue;
|
|
|
}
|
|
|
- if( !wifiNamePrefixList.contains(wifiName)){
|
|
|
+
|
|
|
+ String[] split = wifiName.split("_");
|
|
|
+ String cameraPrefix = split[0] +"_";
|
|
|
+ String snCode = split[1];
|
|
|
+
|
|
|
+ if(!wifiNamePrefixList.contains(cameraPrefix)){
|
|
|
errorIndexList.add(index);
|
|
|
}
|
|
|
wifiNameSet.add(wifiName);
|