|
@@ -62,6 +62,8 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
|
|
@Autowired
|
|
@Autowired
|
|
IOrderService orderService;
|
|
IOrderService orderService;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ ICameraWifiPrefixService cameraWifiPrefixService;
|
|
|
|
+ @Autowired
|
|
ICameraTypeService cameraTypeService;
|
|
ICameraTypeService cameraTypeService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -112,8 +114,8 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
|
|
if(StringUtils.isEmpty(wifiName) ){
|
|
if(StringUtils.isEmpty(wifiName) ){
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
}
|
|
}
|
|
- List<CameraType> list = cameraTypeService.list();
|
|
|
|
- Set<String> wifiNamePrefixList = list.stream().map(CameraType::getWifiNamePrefix).collect(Collectors.toSet());
|
|
|
|
|
|
+ List<CameraWifiPrefix> list = cameraWifiPrefixService.list();
|
|
|
|
+ Set<String> wifiNamePrefixList = list.stream().map(CameraWifiPrefix::getWifiNamePrefix).collect(Collectors.toSet());
|
|
|
|
|
|
if(!wifiName.contains("_")){
|
|
if(!wifiName.contains("_")){
|
|
throw new BusinessException(ResultCode.WIFI_NAME_ERROR);
|
|
throw new BusinessException(ResultCode.WIFI_NAME_ERROR);
|
|
@@ -125,7 +127,7 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
|
|
if(!wifiNamePrefixList.contains(cameraPrefix)){
|
|
if(!wifiNamePrefixList.contains(cameraPrefix)){
|
|
throw new BusinessException(ResultCode.WIFI_NAME_ERROR);
|
|
throw new BusinessException(ResultCode.WIFI_NAME_ERROR);
|
|
}
|
|
}
|
|
- HashMap<String,CameraType> cameraTypeMap = new HashMap<>();
|
|
|
|
|
|
+ HashMap<String,CameraWifiPrefix> cameraTypeMap = new HashMap<>();
|
|
list.forEach(entity->cameraTypeMap.put(entity.getWifiNamePrefix(),entity));
|
|
list.forEach(entity->cameraTypeMap.put(entity.getWifiNamePrefix(),entity));
|
|
|
|
|
|
if(cameraTypeMap.get(cameraPrefix) == null){
|
|
if(cameraTypeMap.get(cameraPrefix) == null){
|
|
@@ -141,7 +143,7 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
|
|
saveBatchCamera(Collections.singletonList(wifiName),cameraTypeMap);
|
|
saveBatchCamera(Collections.singletonList(wifiName),cameraTypeMap);
|
|
}
|
|
}
|
|
|
|
|
|
- private Integer saveBatchCamera(List<String> wifiNameList,HashMap<String,CameraType> cameraTypeMap){
|
|
|
|
|
|
+ private Integer saveBatchCamera(List<String> wifiNameList,HashMap<String,CameraWifiPrefix> cameraTypeMap){
|
|
HashSet<String> wifiNameSet = new HashSet<>(wifiNameList);
|
|
HashSet<String> wifiNameSet = new HashSet<>(wifiNameList);
|
|
List<Camera> cameraList = new ArrayList<>();
|
|
List<Camera> cameraList = new ArrayList<>();
|
|
for (String wifiName : wifiNameSet) {
|
|
for (String wifiName : wifiNameSet) {
|
|
@@ -171,7 +173,7 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
|
|
cameraDetail.setCameraId(camera.getId());
|
|
cameraDetail.setCameraId(camera.getId());
|
|
cameraDetail.setCountry(0);//默认中国
|
|
cameraDetail.setCountry(0);//默认中国
|
|
String wifiNamePrix = camera.getWifiName().split("_")[0]+"_";
|
|
String wifiNamePrix = camera.getWifiName().split("_")[0]+"_";
|
|
- CameraType cameraType = cameraTypeMap.get(wifiNamePrix);
|
|
|
|
|
|
+ CameraWifiPrefix cameraType = cameraTypeMap.get(wifiNamePrix);
|
|
cameraDetail.setType(cameraType.getCameraType());
|
|
cameraDetail.setType(cameraType.getCameraType());
|
|
|
|
|
|
if (1 == cameraDetail.getType() || 9 == cameraDetail.getType() || 10 == cameraDetail.getType() || 11 == cameraDetail.getType()){
|
|
if (1 == cameraDetail.getType() || 9 == cameraDetail.getType() || 10 == cameraDetail.getType() || 11 == cameraDetail.getType()){
|
|
@@ -209,10 +211,10 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
|
|
}
|
|
}
|
|
@Override
|
|
@Override
|
|
public Integer ins(List<String> wifiNameList){
|
|
public Integer ins(List<String> wifiNameList){
|
|
- List<CameraType> cameraTypeList = cameraTypeService.list();
|
|
|
|
- Set<String> wifiNamePrefixList = cameraTypeList.stream().map(CameraType::getWifiNamePrefix).collect(Collectors.toSet());
|
|
|
|
|
|
+ List<CameraWifiPrefix> cameraTypeList = cameraWifiPrefixService.list();
|
|
|
|
+ Set<String> wifiNamePrefixList = cameraTypeList.stream().map(CameraWifiPrefix::getWifiNamePrefix).collect(Collectors.toSet());
|
|
List<Integer> errorRow = getErrorRow(wifiNameList,wifiNamePrefixList);
|
|
List<Integer> errorRow = getErrorRow(wifiNameList,wifiNamePrefixList);
|
|
- HashMap<String,CameraType> cameraTypeMap = new HashMap<>();
|
|
|
|
|
|
+ HashMap<String,CameraWifiPrefix> cameraTypeMap = new HashMap<>();
|
|
cameraTypeList.forEach(entity->cameraTypeMap.put(entity.getWifiNamePrefix(),entity));
|
|
cameraTypeList.forEach(entity->cameraTypeMap.put(entity.getWifiNamePrefix(),entity));
|
|
|
|
|
|
excelService.toExcelError(errorRow);
|
|
excelService.toExcelError(errorRow);
|