|
|
|
@@ -135,28 +135,23 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
if (Objects.nonNull(addTerminalParam.getProjectParam())) {
|
|
|
|
if (Objects.nonNull(addTerminalParam.getProjectParam())) {
|
|
|
|
if (StrUtil.isBlank(projectIndex)) {
|
|
|
|
if (StrUtil.isBlank(projectIndex)) {
|
|
|
|
checkName(addTerminalParam, LineBaseEnum.PROJECT_LEVEL.getCode(), null);
|
|
|
|
checkName(addTerminalParam, LineBaseEnum.PROJECT_LEVEL.getCode(), null);
|
|
|
|
Line line = assembleLine(addTerminalParam.getProjectParam().getName(),LineBaseEnum.PROJECT_LEVEL.getCode(),"0","0",addTerminalParam.getProjectParam().getSort());
|
|
|
|
Line line = assembleLine(addTerminalParam.getProjectParam().getName(), LineBaseEnum.PROJECT_LEVEL.getCode(), "0", "0", addTerminalParam.getProjectParam().getSort());
|
|
|
|
this.baseMapper.insert(line);
|
|
|
|
this.baseMapper.insert(line);
|
|
|
|
projectIndex = line.getId();
|
|
|
|
projectIndex = line.getId();
|
|
|
|
} else {
|
|
|
|
|
|
|
|
//throw new BusinessException(DeviceResponseEnum.REQUEST_DATA_ERROR);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//省份
|
|
|
|
//省份
|
|
|
|
if (Objects.nonNull(addTerminalParam.getProvinceParam())) {
|
|
|
|
if (Objects.nonNull(addTerminalParam.getProvinceParam())) {
|
|
|
|
if (StrUtil.isBlank(provinceIndex) && StrUtil.isNotBlank(projectIndex)) {
|
|
|
|
if (StrUtil.isBlank(provinceIndex) && StrUtil.isNotBlank(projectIndex)) {
|
|
|
|
HttpResult<Area> provinceDic = areaFeignClient.selectIdArea(addTerminalParam.getProvinceParam().getName());
|
|
|
|
Area result = areaFeignClient.selectIdArea(addTerminalParam.getProvinceParam().getName()).getData();
|
|
|
|
Area result = provinceDic.getData();
|
|
|
|
|
|
|
|
if (Objects.isNull(result)) {
|
|
|
|
if (Objects.isNull(result)) {
|
|
|
|
throw new BusinessException(DeviceResponseEnum.PROVINCE_GET_ERROR);
|
|
|
|
throw new BusinessException(DeviceResponseEnum.PROVINCE_GET_ERROR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LogUtil.njcnDebug(log, "获取区域信息:{}", result.toString());
|
|
|
|
LogUtil.njcnDebug(log, "获取区域信息:{}", result.toString());
|
|
|
|
checkName(addTerminalParam, LineBaseEnum.PROVINCE_LEVEL.getCode(), projectIndex);
|
|
|
|
checkName(addTerminalParam, LineBaseEnum.PROVINCE_LEVEL.getCode(), projectIndex);
|
|
|
|
Line province = assembleLine(result.getId(),LineBaseEnum.PROVINCE_LEVEL.getCode(),projectIndex,projectIndex,addTerminalParam.getProvinceParam().getSort());
|
|
|
|
Line province = assembleLine(result.getId(), LineBaseEnum.PROVINCE_LEVEL.getCode(), projectIndex, projectIndex, addTerminalParam.getProvinceParam().getSort());
|
|
|
|
this.baseMapper.insert(province);
|
|
|
|
this.baseMapper.insert(province);
|
|
|
|
provinceIndex = province.getId();
|
|
|
|
provinceIndex = province.getId();
|
|
|
|
} else {
|
|
|
|
|
|
|
|
//throw new BusinessException(DeviceResponseEnum.REQUEST_DATA_ERROR);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -164,7 +159,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
if (Objects.nonNull(addTerminalParam.getGdInformationParam())) {
|
|
|
|
if (Objects.nonNull(addTerminalParam.getGdInformationParam())) {
|
|
|
|
if (StrUtil.isBlank(gdIndex) && StrUtil.isNotBlank(provinceIndex)) {
|
|
|
|
if (StrUtil.isBlank(gdIndex) && StrUtil.isNotBlank(provinceIndex)) {
|
|
|
|
checkName(addTerminalParam, LineBaseEnum.GD_LEVEL.getCode(), provinceIndex);
|
|
|
|
checkName(addTerminalParam, LineBaseEnum.GD_LEVEL.getCode(), provinceIndex);
|
|
|
|
Line gdInformation = assembleLine(addTerminalParam.getGdInformationParam().getName(),LineBaseEnum.GD_LEVEL.getCode(),provinceIndex,projectIndex + StrUtil.COMMA + provinceIndex,addTerminalParam.getGdInformationParam().getSort());
|
|
|
|
Line gdInformation = assembleLine(addTerminalParam.getGdInformationParam().getName(), LineBaseEnum.GD_LEVEL.getCode(), provinceIndex, projectIndex + StrUtil.COMMA + provinceIndex, addTerminalParam.getGdInformationParam().getSort());
|
|
|
|
this.baseMapper.insert(gdInformation);
|
|
|
|
this.baseMapper.insert(gdInformation);
|
|
|
|
gdIndex = gdInformation.getId();
|
|
|
|
gdIndex = gdInformation.getId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -174,7 +169,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
if (Objects.nonNull(addTerminalParam.getSubStationParam())) {
|
|
|
|
if (Objects.nonNull(addTerminalParam.getSubStationParam())) {
|
|
|
|
if (StrUtil.isBlank(subIndex) && StrUtil.isNotBlank(gdIndex)) {
|
|
|
|
if (StrUtil.isBlank(subIndex) && StrUtil.isNotBlank(gdIndex)) {
|
|
|
|
checkName(addTerminalParam, LineBaseEnum.SUB_LEVEL.getCode(), gdIndex);
|
|
|
|
checkName(addTerminalParam, LineBaseEnum.SUB_LEVEL.getCode(), gdIndex);
|
|
|
|
Line subStation = assembleLine(addTerminalParam.getSubStationParam().getName(),LineBaseEnum.SUB_LEVEL.getCode(),gdIndex,projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex,addTerminalParam.getSubStationParam().getSort());
|
|
|
|
Line subStation = assembleLine(addTerminalParam.getSubStationParam().getName(), LineBaseEnum.SUB_LEVEL.getCode(), gdIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex, addTerminalParam.getSubStationParam().getSort());
|
|
|
|
this.baseMapper.insert(subStation);
|
|
|
|
this.baseMapper.insert(subStation);
|
|
|
|
subIndex = subStation.getId();
|
|
|
|
subIndex = subStation.getId();
|
|
|
|
|
|
|
|
|
|
|
|
@@ -190,39 +185,21 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
|
|
|
|
|
|
|
|
//装置
|
|
|
|
//装置
|
|
|
|
if (Objects.nonNull(addTerminalParam.getDeviceParam())) {
|
|
|
|
if (Objects.nonNull(addTerminalParam.getDeviceParam())) {
|
|
|
|
|
|
|
|
LambdaQueryWrapper<Line> lineLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
if (CollectionUtil.isNotEmpty(addTerminalParam.getDeviceParam()) && StrUtil.isNotBlank(subIndex)) {
|
|
|
|
if (CollectionUtil.isNotEmpty(addTerminalParam.getDeviceParam()) && StrUtil.isNotBlank(subIndex)) {
|
|
|
|
List<String> devNameList = addTerminalParam.getDeviceParam().stream()
|
|
|
|
//校验变电站下的装置名称ip是否重复
|
|
|
|
.filter((dev -> dev.getDevIndex() == null))
|
|
|
|
checkDev(addTerminalParam, subIndex,lineLambdaQueryWrapper);
|
|
|
|
.map(DeviceParam::getName)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
LambdaQueryWrapper<Line> lineLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(devNameList)) {
|
|
|
|
|
|
|
|
lineLambdaQueryWrapper.eq(Line::getPid, subIndex).in(Line::getName, devNameList);
|
|
|
|
|
|
|
|
List<Line> deviceListRes = this.list(lineLambdaQueryWrapper);
|
|
|
|
|
|
|
|
//校验当前变电站下是否有同名设备
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceListRes)) {
|
|
|
|
|
|
|
|
List<String> stringList = deviceListRes.stream().map(Line::getName).collect(Collectors.toList());
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(devIpList)) {
|
|
|
|
|
|
|
|
List<Device> deviceListIpRes = lineMapper.getDeviceBySubId(subIndex, devIpList);
|
|
|
|
|
|
|
|
//校验当前变电站下是否有相同ip
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (DeviceParam deviceParam : addTerminalParam.getDeviceParam()) {
|
|
|
|
for (DeviceParam deviceParam : addTerminalParam.getDeviceParam()) {
|
|
|
|
//用于记录装置id
|
|
|
|
//用于记录装置id
|
|
|
|
String devIdIndex;
|
|
|
|
String devIdIndex;
|
|
|
|
//监测点索引最后一位数
|
|
|
|
//监测点序号
|
|
|
|
List<Integer> listId = Stream.of(1, 2, 3, 4, 5, 6).collect(Collectors.toList());
|
|
|
|
List<Integer> listLineNum = Stream.of(1, 2, 3, 4, 5, 6).collect(Collectors.toList());
|
|
|
|
|
|
|
|
//母线序号
|
|
|
|
|
|
|
|
List<Integer> listVoltageNum = Stream.of(1, 2, 3, 4, 5, 6).collect(Collectors.toList());
|
|
|
|
//标识当前装置下的监测点数量
|
|
|
|
//标识当前装置下的监测点数量
|
|
|
|
int lineNum = 0;
|
|
|
|
int lineNum = 0, voltageNum = 0;
|
|
|
|
//校验监测点总数不超过6
|
|
|
|
//校验监测点总数不超过6
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceParam.getSubVoltageParam())) {
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceParam.getSubVoltageParam())) {
|
|
|
|
for (SubVoltageParam subVoltage : deviceParam.getSubVoltageParam()) {
|
|
|
|
for (SubVoltageParam subVoltage : deviceParam.getSubVoltageParam()) {
|
|
|
|
@@ -238,7 +215,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isBlank(deviceParam.getDevIndex())) {
|
|
|
|
if (StrUtil.isBlank(deviceParam.getDevIndex())) {
|
|
|
|
Line device = assembleLine(deviceParam.getName(),LineBaseEnum.DEVICE_LEVEL.getCode(),subIndex,projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex,deviceParam.getSort());
|
|
|
|
Line device = assembleLine(deviceParam.getName(), LineBaseEnum.DEVICE_LEVEL.getCode(), subIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex, deviceParam.getSort());
|
|
|
|
this.baseMapper.insert(device);
|
|
|
|
this.baseMapper.insert(device);
|
|
|
|
devIdIndex = device.getId();
|
|
|
|
devIdIndex = device.getId();
|
|
|
|
|
|
|
|
|
|
|
|
@@ -256,8 +233,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
deviceDetail.setUpdateTime(LocalDateTime.now());
|
|
|
|
deviceDetail.setUpdateTime(LocalDateTime.now());
|
|
|
|
deviceMapper.insert(deviceDetail);
|
|
|
|
deviceMapper.insert(deviceDetail);
|
|
|
|
//装置功能
|
|
|
|
//装置功能
|
|
|
|
HttpResult<List<DictData>> httpResult = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_FUN.getName());
|
|
|
|
List<DictData> funList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_FUN.getName()).getData();
|
|
|
|
List<DictData> funList = httpResult.getData();
|
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(funList)) {
|
|
|
|
if (CollectionUtil.isEmpty(funList)) {
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DIC_GET_EMPTY);
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DIC_GET_EMPTY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -281,7 +257,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
if (CollectionUtil.isNotEmpty(lineDetails)) {
|
|
|
|
if (CollectionUtil.isNotEmpty(lineDetails)) {
|
|
|
|
lineNum = lineNum + lineDetails.size();
|
|
|
|
lineNum = lineNum + lineDetails.size();
|
|
|
|
for (LineDetail sline : lineDetails) {
|
|
|
|
for (LineDetail sline : lineDetails) {
|
|
|
|
listId.removeIf(integer -> sline.getNum().equals(integer));
|
|
|
|
listLineNum.removeIf(integer -> sline.getNum().equals(integer));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -317,17 +293,17 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
String subvIndex;
|
|
|
|
String subvIndex;
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isBlank(subVoltageParam.getSubvIndex()) && StrUtil.isNotBlank(devIdIndex)) {
|
|
|
|
if (StrUtil.isBlank(subVoltageParam.getSubvIndex()) && StrUtil.isNotBlank(devIdIndex)) {
|
|
|
|
HttpResult<DictData> scaleRes = dicDataFeignClient.getDicDataById(subVoltageParam.getScale());
|
|
|
|
DictData scaleRes = dicDataFeignClient.getDicDataById(subVoltageParam.getScale()).getData();
|
|
|
|
if (Objects.isNull(scaleRes.getData())) {
|
|
|
|
if (Objects.isNull(scaleRes)) {
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DIC_GET_EMPTY);
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DIC_GET_EMPTY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Line subVoltage = assembleLine(subVoltageParam.getName(),LineBaseEnum.SUB_V_LEVEL.getCode(),devIdIndex,projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex + StrUtil.COMMA + devIdIndex,subVoltageParam.getSort());
|
|
|
|
Line subVoltage = assembleLine(subVoltageParam.getName(), LineBaseEnum.SUB_V_LEVEL.getCode(), devIdIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex + StrUtil.COMMA + devIdIndex, subVoltageParam.getSort());
|
|
|
|
this.baseMapper.insert(subVoltage);
|
|
|
|
this.baseMapper.insert(subVoltage);
|
|
|
|
subvIndex = subVoltage.getId();
|
|
|
|
subvIndex = subVoltage.getId();
|
|
|
|
Voltage voltage = new Voltage();
|
|
|
|
Voltage voltage = new Voltage();
|
|
|
|
voltage.setId(subVoltage.getId());
|
|
|
|
voltage.setId(subVoltage.getId());
|
|
|
|
voltage.setNum(subVoltageParam.getNum());
|
|
|
|
voltage.setNum(subVoltageParam.getNum());
|
|
|
|
voltage.setScale(scaleRes.getData().getId());
|
|
|
|
voltage.setScale(scaleRes.getId());
|
|
|
|
voltage.setModel(subVoltageParam.getModel());
|
|
|
|
voltage.setModel(subVoltageParam.getModel());
|
|
|
|
voltageMapper.insert(voltage);
|
|
|
|
voltageMapper.insert(voltage);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@@ -353,18 +329,18 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
for (LineParam lineParam : subVoltageParam.getLineParam()) {
|
|
|
|
for (LineParam lineParam : subVoltageParam.getLineParam()) {
|
|
|
|
if (StrUtil.isBlank(lineParam.getLineIndex()) && StrUtil.isNotBlank(subvIndex)) {
|
|
|
|
if (StrUtil.isBlank(lineParam.getLineIndex()) && StrUtil.isNotBlank(subvIndex)) {
|
|
|
|
//判断监测点序号是否重复
|
|
|
|
//判断监测点序号是否重复
|
|
|
|
if (CollectionUtil.isNotEmpty(listId)) {
|
|
|
|
if (CollectionUtil.isNotEmpty(listLineNum)) {
|
|
|
|
if (!listId.contains(lineParam.getNum())) {
|
|
|
|
if (!listLineNum.contains(lineParam.getNum())) {
|
|
|
|
throw new BusinessException(DeviceResponseEnum.LINE_NUM_USE, "监测点序号:" + lineParam.getNum());
|
|
|
|
throw new BusinessException(DeviceResponseEnum.LINE_NUM_USE, "监测点序号:" + lineParam.getNum());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DEVICE_LINE_BIG);
|
|
|
|
throw new BusinessException(DeviceResponseEnum.DEVICE_LINE_BIG);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//删除与当前线路号重复的项
|
|
|
|
//删除与当前线路号重复的项
|
|
|
|
listId.removeIf(lineNo -> lineNo.equals(lineParam.getNum()));
|
|
|
|
listLineNum.removeIf(lineNo -> lineNo.equals(lineParam.getNum()));
|
|
|
|
HttpResult<DictData> httpScale = dicDataFeignClient.getDicDataById(subVoltageParam.getScale());
|
|
|
|
HttpResult<DictData> httpScale = dicDataFeignClient.getDicDataById(subVoltageParam.getScale());
|
|
|
|
Float jcap = DeviceUtil.getJCAPByScale(httpScale.getData().getName());
|
|
|
|
Float jcap = DeviceUtil.getJCAPByScale(httpScale.getData().getName());
|
|
|
|
Line line = assembleLine(lineParam.getName(),LineBaseEnum.LINE_LEVEL.getCode(),subvIndex,projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex + StrUtil.COMMA + devIdIndex+ StrUtil.COMMA + subvIndex,lineParam.getSort());
|
|
|
|
Line line = assembleLine(lineParam.getName(), LineBaseEnum.LINE_LEVEL.getCode(), subvIndex, projectIndex + StrUtil.COMMA + provinceIndex + StrUtil.COMMA + gdIndex + StrUtil.COMMA + subIndex + StrUtil.COMMA + devIdIndex + StrUtil.COMMA + subvIndex, lineParam.getSort());
|
|
|
|
this.baseMapper.insert(line);
|
|
|
|
this.baseMapper.insert(line);
|
|
|
|
LineDetail lineDetail = new LineDetail();
|
|
|
|
LineDetail lineDetail = new LineDetail();
|
|
|
|
BeanUtils.copyProperties(lineParam, lineDetail);
|
|
|
|
BeanUtils.copyProperties(lineParam, lineDetail);
|
|
|
|
@@ -399,6 +375,34 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 校验装置
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private void checkDev(AddTerminalParam addTerminalParam, String subIndex,LambdaQueryWrapper<Line> lineLambdaQueryWrapper) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> devNameList = addTerminalParam.getDeviceParam().stream().filter((dev -> dev.getDevIndex() == null)).map(DeviceParam::getName).collect(Collectors.toList());
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(devNameList)) {
|
|
|
|
|
|
|
|
lineLambdaQueryWrapper.eq(Line::getPid, subIndex).in(Line::getName, devNameList);
|
|
|
|
|
|
|
|
List<Line> deviceListRes = this.list(lineLambdaQueryWrapper);
|
|
|
|
|
|
|
|
//校验当前变电站下是否有同名设备
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(deviceListRes)) {
|
|
|
|
|
|
|
|
List<String> stringList = deviceListRes.stream().map(Line::getName).collect(Collectors.toList());
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(devIpList)) {
|
|
|
|
|
|
|
|
List<Device> deviceListIpRes = lineMapper.getDeviceBySubId(subIndex, devIpList);
|
|
|
|
|
|
|
|
//校验当前变电站下的装置是否有相同ip
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public Boolean updateTerminal(UpdateTerminalParam updateTerminalParam) {
|
|
|
|
public Boolean updateTerminal(UpdateTerminalParam updateTerminalParam) {
|
|
|
|
@@ -657,30 +661,30 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
TerminalVO terminalVO = new TerminalVO();
|
|
|
|
TerminalVO terminalVO = new TerminalVO();
|
|
|
|
if (obj.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())) {
|
|
|
|
if (obj.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())) {
|
|
|
|
//点击项目节点
|
|
|
|
//点击项目节点
|
|
|
|
assProject(obj,terminalVO);
|
|
|
|
assProject(obj, terminalVO);
|
|
|
|
} else if (obj.getLevel().equals(LineBaseEnum.PROVINCE_LEVEL.getCode())) {
|
|
|
|
} else if (obj.getLevel().equals(LineBaseEnum.PROVINCE_LEVEL.getCode())) {
|
|
|
|
//点击省份节点
|
|
|
|
//点击省份节点
|
|
|
|
Line project = this.getById(obj.getPid());
|
|
|
|
Line project = this.getById(obj.getPid());
|
|
|
|
assProject(project,terminalVO);
|
|
|
|
assProject(project, terminalVO);
|
|
|
|
assProvince(obj,terminalVO);
|
|
|
|
assProvince(obj, terminalVO);
|
|
|
|
} else if (obj.getLevel().equals(LineBaseEnum.GD_LEVEL.getCode())) {
|
|
|
|
} else if (obj.getLevel().equals(LineBaseEnum.GD_LEVEL.getCode())) {
|
|
|
|
//点击供电公司节点
|
|
|
|
//点击供电公司节点
|
|
|
|
assGd(obj,terminalVO);
|
|
|
|
assGd(obj, terminalVO);
|
|
|
|
Line province = this.getById(obj.getPid());
|
|
|
|
Line province = this.getById(obj.getPid());
|
|
|
|
assProvince(province,terminalVO);
|
|
|
|
assProvince(province, terminalVO);
|
|
|
|
Line project = this.getById(province.getPid());
|
|
|
|
Line project = this.getById(province.getPid());
|
|
|
|
assProject(project,terminalVO);
|
|
|
|
assProject(project, terminalVO);
|
|
|
|
} else if (obj.getLevel().equals(LineBaseEnum.SUB_LEVEL.getCode())) {
|
|
|
|
} else if (obj.getLevel().equals(LineBaseEnum.SUB_LEVEL.getCode())) {
|
|
|
|
//变电站
|
|
|
|
//变电站
|
|
|
|
assSub(obj,terminalVO);
|
|
|
|
assSub(obj, terminalVO);
|
|
|
|
Line gdInformation = this.getById(obj.getPid());
|
|
|
|
Line gdInformation = this.getById(obj.getPid());
|
|
|
|
assGd(gdInformation,terminalVO);
|
|
|
|
assGd(gdInformation, terminalVO);
|
|
|
|
|
|
|
|
|
|
|
|
Line province = this.getById(gdInformation.getPid());
|
|
|
|
Line province = this.getById(gdInformation.getPid());
|
|
|
|
assProvince(province,terminalVO);
|
|
|
|
assProvince(province, terminalVO);
|
|
|
|
|
|
|
|
|
|
|
|
Line project = this.getById(province.getPid());
|
|
|
|
Line project = this.getById(province.getPid());
|
|
|
|
assProject(project,terminalVO);
|
|
|
|
assProject(project, terminalVO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//展示所有下级装置母线监测点
|
|
|
|
//展示所有下级装置母线监测点
|
|
|
|
@@ -1255,8 +1259,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<TerminalBaseVO> getDeviceByIdOnOrOff(List<String> devIds, DeviceType deviceType,Integer comFlag){
|
|
|
|
public List<TerminalBaseVO> getDeviceByIdOnOrOff(List<String> devIds, DeviceType deviceType, Integer comFlag) {
|
|
|
|
return this.baseMapper.getDeviceByIdOnOrOff(devIds, deviceType,comFlag);
|
|
|
|
return this.baseMapper.getDeviceByIdOnOrOff(devIds, deviceType, comFlag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@@ -1613,7 +1617,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
lineDetailMapper.insert(lineDetail);
|
|
|
|
lineDetailMapper.insert(lineDetail);
|
|
|
|
LineBak lineBak= new LineBak();
|
|
|
|
LineBak lineBak = new LineBak();
|
|
|
|
lineBak.setId(temp.getId());
|
|
|
|
lineBak.setId(temp.getId());
|
|
|
|
lineBak.setLineId(oracleTerminalExcel.getId());
|
|
|
|
lineBak.setLineId(oracleTerminalExcel.getId());
|
|
|
|
lineBakService.save(lineBak);
|
|
|
|
lineBakService.save(lineBak);
|
|
|
|
@@ -1931,7 +1935,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
return line;
|
|
|
|
return line;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Line assembleLine(String name, Integer level, String pid, String pids,Integer sort) {
|
|
|
|
private Line assembleLine(String name, Integer level, String pid, String pids, Integer sort) {
|
|
|
|
Line line = new Line();
|
|
|
|
Line line = new Line();
|
|
|
|
line.setName(name);
|
|
|
|
line.setName(name);
|
|
|
|
line.setLevel(level);
|
|
|
|
line.setLevel(level);
|
|
|
|
@@ -2089,16 +2093,16 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
|
|
|
|
|
|
|
|
Line subStation = this.getById(subId);
|
|
|
|
Line subStation = this.getById(subId);
|
|
|
|
if (Objects.nonNull(subStation)) {
|
|
|
|
if (Objects.nonNull(subStation)) {
|
|
|
|
assSub(subStation,terminalVO);
|
|
|
|
assSub(subStation, terminalVO);
|
|
|
|
|
|
|
|
|
|
|
|
Line gdInformation = this.getById(subStation.getPid());
|
|
|
|
Line gdInformation = this.getById(subStation.getPid());
|
|
|
|
assGd(gdInformation,terminalVO);
|
|
|
|
assGd(gdInformation, terminalVO);
|
|
|
|
|
|
|
|
|
|
|
|
Line province = this.getById(gdInformation.getPid());
|
|
|
|
Line province = this.getById(gdInformation.getPid());
|
|
|
|
assProvince(province,terminalVO);
|
|
|
|
assProvince(province, terminalVO);
|
|
|
|
|
|
|
|
|
|
|
|
Line project = this.getById(province.getPid());
|
|
|
|
Line project = this.getById(province.getPid());
|
|
|
|
assProject(project,terminalVO);
|
|
|
|
assProject(project, terminalVO);
|
|
|
|
|
|
|
|
|
|
|
|
return terminalVO;
|
|
|
|
return terminalVO;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@@ -2110,7 +2114,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 组装项目
|
|
|
|
* 组装项目
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void assProject(Line project,TerminalVO terminalVO){
|
|
|
|
private void assProject(Line project, TerminalVO terminalVO) {
|
|
|
|
ProjectVO projectVO = new ProjectVO();
|
|
|
|
ProjectVO projectVO = new ProjectVO();
|
|
|
|
projectVO.setProjectIndex(project.getId());
|
|
|
|
projectVO.setProjectIndex(project.getId());
|
|
|
|
projectVO.setName(project.getName());
|
|
|
|
projectVO.setName(project.getName());
|
|
|
|
@@ -2122,7 +2126,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 组装省份
|
|
|
|
* 组装省份
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void assProvince(Line province,TerminalVO terminalVO){
|
|
|
|
private void assProvince(Line province, TerminalVO terminalVO) {
|
|
|
|
ProvinceVO provinceVO = new ProvinceVO();
|
|
|
|
ProvinceVO provinceVO = new ProvinceVO();
|
|
|
|
provinceVO.setProvinceIndex(province.getId());
|
|
|
|
provinceVO.setProvinceIndex(province.getId());
|
|
|
|
provinceVO.setName(province.getName());
|
|
|
|
provinceVO.setName(province.getName());
|
|
|
|
@@ -2133,7 +2137,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 组装供电公司
|
|
|
|
* 组装供电公司
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void assGd(Line gdInformation,TerminalVO terminalVO){
|
|
|
|
private void assGd(Line gdInformation, TerminalVO terminalVO) {
|
|
|
|
GdInformationVO gdInformationVO = new GdInformationVO();
|
|
|
|
GdInformationVO gdInformationVO = new GdInformationVO();
|
|
|
|
gdInformationVO.setGdIndex(gdInformation.getId());
|
|
|
|
gdInformationVO.setGdIndex(gdInformation.getId());
|
|
|
|
gdInformationVO.setName(gdInformation.getName());
|
|
|
|
gdInformationVO.setName(gdInformation.getName());
|
|
|
|
@@ -2144,7 +2148,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 组装变电站
|
|
|
|
* 组装变电站
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void assSub(Line subStation,TerminalVO terminalVO){
|
|
|
|
private void assSub(Line subStation, TerminalVO terminalVO) {
|
|
|
|
Substation substation = substationMapper.selectById(subStation.getId());
|
|
|
|
Substation substation = substationMapper.selectById(subStation.getId());
|
|
|
|
SubStationVO subStationVO = new SubStationVO();
|
|
|
|
SubStationVO subStationVO = new SubStationVO();
|
|
|
|
subStationVO.setSubIndex(subStation.getId());
|
|
|
|
subStationVO.setSubIndex(subStation.getId());
|
|
|
|
|