|
@@ -11,6 +11,7 @@ import com.fdkankan.manage.constant.RtkTypeEnum;
|
|
import com.fdkankan.manage.entity.*;
|
|
import com.fdkankan.manage.entity.*;
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
import com.fdkankan.manage.mapper.IRtkDeviceMapper;
|
|
import com.fdkankan.manage.mapper.IRtkDeviceMapper;
|
|
|
|
+import com.fdkankan.manage.service.ICameraService;
|
|
import com.fdkankan.manage.service.IExcelService;
|
|
import com.fdkankan.manage.service.IExcelService;
|
|
import com.fdkankan.manage.service.IRtkDeviceService;
|
|
import com.fdkankan.manage.service.IRtkDeviceService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -24,10 +25,7 @@ import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Set;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -46,6 +44,8 @@ public class RtkDeviceServiceImpl extends ServiceImpl<IRtkDeviceMapper, RtkDevic
|
|
ISysUserService sysUserService;
|
|
ISysUserService sysUserService;
|
|
@Autowired
|
|
@Autowired
|
|
IExcelService excelService;
|
|
IExcelService excelService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ICameraService cameraService;
|
|
@Override
|
|
@Override
|
|
public RtkDevice getByRtkSnCode(String rtkSnCode) {
|
|
public RtkDevice getByRtkSnCode(String rtkSnCode) {
|
|
LambdaQueryWrapper<RtkDevice> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<RtkDevice> wrapper = new LambdaQueryWrapper<>();
|
|
@@ -112,6 +112,10 @@ public class RtkDeviceServiceImpl extends ServiceImpl<IRtkDeviceMapper, RtkDevic
|
|
}
|
|
}
|
|
RtkDevice rtkDevice3 = null;
|
|
RtkDevice rtkDevice3 = null;
|
|
if(StringUtils.isNotBlank(param.getCameraSn())){
|
|
if(StringUtils.isNotBlank(param.getCameraSn())){
|
|
|
|
+ Camera camera = cameraService.getBySnCode(param.getCameraSn());
|
|
|
|
+ if(camera == null){
|
|
|
|
+ throw new BusinessException(ResultCode.CAMERA_NOT_EXIST);
|
|
|
|
+ }
|
|
rtkDevice3 = this.getByCameraSn(param.getCameraSn());
|
|
rtkDevice3 = this.getByCameraSn(param.getCameraSn());
|
|
}
|
|
}
|
|
if(rtkDevice3 != null && param.getId() == null){
|
|
if(rtkDevice3 != null && param.getId() == null){
|
|
@@ -168,6 +172,8 @@ public class RtkDeviceServiceImpl extends ServiceImpl<IRtkDeviceMapper, RtkDevic
|
|
public Integer insExcelList(List<HashMap<Integer, String>> excelRowList) {
|
|
public Integer insExcelList(List<HashMap<Integer, String>> excelRowList) {
|
|
List<RtkDeviceInParam> params = new ArrayList<>();
|
|
List<RtkDeviceInParam> params = new ArrayList<>();
|
|
List<Integer> errorIndex = new ArrayList<>();
|
|
List<Integer> errorIndex = new ArrayList<>();
|
|
|
|
+ HashSet<String> rtkSnSet = new HashSet<>();
|
|
|
|
+ HashSet<String> cameraSnSet = new HashSet<>();
|
|
Integer index = 0;
|
|
Integer index = 0;
|
|
for (HashMap<Integer, String> map : excelRowList) {
|
|
for (HashMap<Integer, String> map : excelRowList) {
|
|
index ++;
|
|
index ++;
|
|
@@ -198,12 +204,28 @@ public class RtkDeviceServiceImpl extends ServiceImpl<IRtkDeviceMapper, RtkDevic
|
|
errorIndex.add(index -3);
|
|
errorIndex.add(index -3);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ if(rtkSnSet.contains(rtkSn)){
|
|
|
|
+ errorIndex.add(index -3);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ rtkSnSet.add(rtkSn);
|
|
if(StringUtils.isNotBlank(cameraSn)){
|
|
if(StringUtils.isNotBlank(cameraSn)){
|
|
|
|
+ Camera camera = cameraService.getBySnCode(cameraSn);
|
|
|
|
+ if(camera == null){
|
|
|
|
+ errorIndex.add(index -3);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
RtkDevice rtkDevice2 = this.getByCameraSn(cameraSn);
|
|
RtkDevice rtkDevice2 = this.getByCameraSn(cameraSn);
|
|
if(rtkDevice2 !=null){
|
|
if(rtkDevice2 !=null){
|
|
errorIndex.add(index -3);
|
|
errorIndex.add(index -3);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ if(cameraSnSet.contains(cameraSn)){
|
|
|
|
+ errorIndex.add(index -3);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ cameraSnSet.add(cameraSn);
|
|
|
|
+
|
|
}
|
|
}
|
|
RtkDeviceInParam param = new RtkDeviceInParam(cameraSn,rtkTypeEnum.getCode(),rtkSn,rtkSgSn);
|
|
RtkDeviceInParam param = new RtkDeviceInParam(cameraSn,rtkTypeEnum.getCode(),rtkSn,rtkSgSn);
|
|
params.add(param);
|
|
params.add(param);
|