|
|
|
|
@@ -20,6 +20,7 @@ import com.njcn.common.utils.LogUtil;
|
|
|
|
|
import com.njcn.common.utils.PubUtils;
|
|
|
|
|
import com.njcn.device.pq.enums.DeviceResponseEnum;
|
|
|
|
|
import com.njcn.device.pq.enums.LineBaseEnum;
|
|
|
|
|
import com.njcn.device.pq.mapper.*;
|
|
|
|
|
import com.njcn.device.pq.pojo.bo.BaseLineInfo;
|
|
|
|
|
import com.njcn.device.pq.pojo.bo.DeviceType;
|
|
|
|
|
import com.njcn.device.pq.pojo.bo.excel.NodeExcel;
|
|
|
|
|
@@ -29,7 +30,6 @@ import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel;
|
|
|
|
|
import com.njcn.device.pq.pojo.param.*;
|
|
|
|
|
import com.njcn.device.pq.pojo.po.*;
|
|
|
|
|
import com.njcn.device.pq.pojo.vo.*;
|
|
|
|
|
import com.njcn.device.pq.mapper.*;
|
|
|
|
|
import com.njcn.device.pq.service.DeviceBakService;
|
|
|
|
|
import com.njcn.device.pq.service.INodeService;
|
|
|
|
|
import com.njcn.device.pq.service.LineBakService;
|
|
|
|
|
@@ -55,9 +55,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
|
@@ -201,13 +199,13 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
|
//用于记录装置id
|
|
|
|
|
String devIdIndex;
|
|
|
|
|
//监测点序号
|
|
|
|
|
List<Integer> listLineNum = Stream.of(1, 2, 3, 4, 5, 6).collect(Collectors.toList());
|
|
|
|
|
List<Integer> listLineNum = Stream.of(1, 2, 3, 4, 5, 6,7,8,9,10).collect(Collectors.toList());
|
|
|
|
|
//母线序号
|
|
|
|
|
List<Integer> listVoltageNum = Stream.of(1, 2, 3, 4, 5, 6).collect(Collectors.toList());
|
|
|
|
|
List<Integer> listVoltageNum = Stream.of(1, 2, 3, 4, 5, 6,7,8,9,10).collect(Collectors.toList());
|
|
|
|
|
//标识当前装置下的监测点数量
|
|
|
|
|
int lineNum = 0, voltageNum = 0;
|
|
|
|
|
|
|
|
|
|
//校验监测点总数不超过6
|
|
|
|
|
//校验监测点总数不超过10
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceParam.getSubVoltageParam())) {
|
|
|
|
|
for (SubVoltageParam subVoltage : deviceParam.getSubVoltageParam()) {
|
|
|
|
|
if (CollectionUtil.isNotEmpty(subVoltage.getLineParam())) {
|
|
|
|
|
@@ -218,7 +216,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//一台装置母线最多6路
|
|
|
|
|
//一台装置母线最多10路
|
|
|
|
|
if (StrUtil.isBlank(subVoltage.getSubvIndex())) {
|
|
|
|
|
voltageNum++;
|
|
|
|
|
}
|
|
|
|
|
@@ -282,10 +280,10 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (lineNum > 6) {
|
|
|
|
|
if (lineNum > 10) {
|
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DEVICE_LINE_BIG);
|
|
|
|
|
}
|
|
|
|
|
if (voltageNum > 6) {
|
|
|
|
|
if (voltageNum > 10) {
|
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DEVICE_VOLTAGE_BIG);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -443,14 +441,20 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DEVICE_SAME_NAME, String.join(";", stringList));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<String> devIpList = addTerminalParam.getDeviceParam().stream().filter((dev -> dev.getDevIndex() == null)).map(DeviceParam::getIp).collect(Collectors.toList());
|
|
|
|
|
List<DeviceParam> devIpList = addTerminalParam.getDeviceParam().stream().filter((dev -> dev.getDevIndex() == null)).collect(Collectors.toList());
|
|
|
|
|
if (CollectionUtil.isNotEmpty(devIpList)) {
|
|
|
|
|
List<Device> deviceListIpRes = lineMapper.getDeviceBySubId(subIndex, devIpList);
|
|
|
|
|
for(DeviceParam deviceParam : devIpList){
|
|
|
|
|
List<Device> deviceListIpRes = deviceMapper.getDeviceBySubId(subIndex, deviceParam.getIp(),deviceParam.getPort(),null);
|
|
|
|
|
if(CollectionUtil.isNotEmpty(deviceListIpRes)){
|
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DEVICE_SAME_IP,deviceListIpRes.get(0).getIp());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//校验当前变电站下的装置是否有相同ip
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceListIpRes)) {
|
|
|
|
|
/* if (CollectionUtil.isNotEmpty(deviceListIpRes)) {
|
|
|
|
|
List<String> stringList = deviceListIpRes.stream().map(Device::getIp).collect(Collectors.toList());
|
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DEVICE_SAME_IP, String.join(";", stringList));
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -531,12 +535,12 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//IP校验
|
|
|
|
|
List<String> devIpList = devList.stream()
|
|
|
|
|
.filter(item -> item.getUpdateFlag() == 1)
|
|
|
|
|
.map(DeviceParam::getIp).collect(Collectors.toList());
|
|
|
|
|
List<DeviceParam> devIpList = devList.stream()
|
|
|
|
|
.filter(item -> item.getUpdateFlag() == 1).collect(Collectors.toList());
|
|
|
|
|
if (CollectionUtil.isNotEmpty(devIpList)) {
|
|
|
|
|
long ipCount = devIpList.stream().distinct().count();
|
|
|
|
|
if (ipCount != devIpList.size()) {
|
|
|
|
|
Set<String> set = new HashSet<>();
|
|
|
|
|
devIpList.forEach(item-> set.add(item.getIp()+item.getPort()));
|
|
|
|
|
if(devIpList.size()!=set.size()){
|
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DEVICE_IP_REPETITION);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -558,11 +562,13 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DEVICE_SAME_NAME, "重复装置:" + String.join(";", repeatDevNames));
|
|
|
|
|
}
|
|
|
|
|
//校验装置ip
|
|
|
|
|
List<Device> deviceIpList = lineMapper.getDeviceBySubIdForUpdate(deviceValid.getPid(), devIpList, devIndexList);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceIpList)) {
|
|
|
|
|
List<String> repeatDevIps = deviceIpList.stream().map(Device::getIp).collect(Collectors.toList());
|
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DEVICE_SAME_IP, "重复IP:" + String.join(";", repeatDevIps));
|
|
|
|
|
for(DeviceParam deviceParam:devIpList){
|
|
|
|
|
List<Device> deviceIpList = deviceMapper.getDeviceBySubId(deviceValid.getPid(), deviceParam.getIp(),deviceParam.getPort(),deviceParam.getDevIndex());
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceIpList)) {
|
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DEVICE_SAME_IP, "重复IP:" + deviceIpList.get(0).getIp());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (DeviceParam updateDeviceParam : devList) {
|
|
|
|
|
@@ -1546,7 +1552,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
|
if (Objects.isNull(temp)) {
|
|
|
|
|
temp = assembleLine(deviceName, LineBaseEnum.DEVICE_LEVEL.getCode(), pids.get(LineBaseEnum.SUB_LEVEL.getCode()), pids);
|
|
|
|
|
this.baseMapper.insert(temp);
|
|
|
|
|
List<Device> existIp = deviceMapper.getDeviceBySubId(pids.get(LineBaseEnum.SUB_LEVEL.getCode()),oracleTerminalExcel.getIp(),oracleTerminalExcel.getPort());
|
|
|
|
|
List<Device> existIp = deviceMapper.getDeviceBySubId(pids.get(LineBaseEnum.SUB_LEVEL.getCode()),oracleTerminalExcel.getIp(),oracleTerminalExcel.getPort(),null);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(existIp)) {
|
|
|
|
|
Device device = existIp.get(0);
|
|
|
|
|
if (!device.getId().equalsIgnoreCase(temp.getId())) {
|
|
|
|
|
|