Merge remote-tracking branch 'origin/liaoning' into liaoning
This commit is contained in:
@@ -100,8 +100,8 @@ public enum DeviceResponseEnum {
|
||||
NEWSTATION_IS_BIND_LINE("A0365","已绑定监测点"),
|
||||
|
||||
LINE_USER_EMPTY("A0366","用户侧监测点用户对象名称不可为空"),
|
||||
LINE_NO_USER_EMPTY("A0367","电网侧监测点无需绑定用户对象")
|
||||
|
||||
LINE_NO_USER_EMPTY("A0367","电网侧监测点无需绑定用户对象"),
|
||||
STATION_USER_HAS_BIND("A0368","用户对象所属电站不匹配")
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pq.pojo.dto.SubstationDTO;
|
||||
import com.njcn.device.pq.pojo.param.AlarmStrategyParam;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
||||
import com.njcn.device.pq.service.AlarmStrategyService;
|
||||
import com.njcn.device.pq.service.ISubstationService;
|
||||
@@ -47,4 +48,14 @@ public class SubstationController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("获取变电站列表")
|
||||
@GetMapping("getSubstationSelect")
|
||||
HttpResult<List<Line>> getSubstationSelect(){
|
||||
String methodDescribe = getMethodDescribe("getSubstationSelect");
|
||||
List<Line> substationDTOList = substationService.getSubstationSelect();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, substationDTOList, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.device.pq.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.pq.pojo.dto.SubstationDTO;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.Substation;
|
||||
|
||||
import java.util.List;
|
||||
@@ -20,4 +21,6 @@ public interface ISubstationService extends IService<Substation> {
|
||||
* @return 变电站信息
|
||||
*/
|
||||
List<SubstationDTO> getSubstationById(List<String> subId);
|
||||
|
||||
List<Line> getSubstationSelect();
|
||||
}
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.SubstationMapper;
|
||||
import com.njcn.device.pq.pojo.dto.SubstationDTO;
|
||||
import com.njcn.device.pq.pojo.po.Line;
|
||||
import com.njcn.device.pq.pojo.po.Substation;
|
||||
import com.njcn.device.pq.service.ISubstationService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -15,10 +22,21 @@ import java.util.List;
|
||||
* @date 2022年10月13日 20:11
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SubstationServiceImpl extends ServiceImpl<SubstationMapper, Substation> implements ISubstationService {
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
@Override
|
||||
public List<SubstationDTO> getSubstationById(List<String> subId) {
|
||||
return this.baseMapper.getSubstationById(subId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Line> getSubstationSelect() {
|
||||
LambdaQueryWrapper<Line> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Line::getLevel, LineBaseEnum.SUB_LEVEL.getCode())
|
||||
.eq(Line::getState, DataStateEnum.ENABLE.getCode()).orderByAsc(Line::getCreateTime);
|
||||
return lineMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.enums.DicTreeEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
@@ -84,6 +85,7 @@ import java.net.HttpURLConnection;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -491,9 +493,15 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
|
||||
lineDetailMapper.insert(lineDetail);
|
||||
if(StrUtil.isNotBlank(lineDetail.getObjId())){
|
||||
/* if(StrUtil.isNotBlank(lineDetail.getObjId())){
|
||||
UserLedgerVO userLedgerVO = userLedgerFeignClient.selectUserInfo(lineDetail.getObjId()).getData();
|
||||
if(StrUtil.isNotBlank(userLedgerVO.getStationId())){
|
||||
if(!userLedgerVO.getStationId().equals(subIndex)){
|
||||
throw new BusinessException(DeviceResponseEnum.STATION_USER_HAS_BIND);
|
||||
}
|
||||
}
|
||||
userLedgerFeignClient.bindUserStation(lineDetail.getObjId(),subIndex);
|
||||
}
|
||||
}*/
|
||||
//通过监测点id获取母线电压等级
|
||||
Voltage voltage = lineMapper.getVoltageByLineId(line.getId());
|
||||
//监测点限值
|
||||
@@ -682,9 +690,17 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
|
||||
}
|
||||
|
||||
List<Line> logsList = new ArrayList<>();
|
||||
|
||||
List<PqsTerminalLogs> pqsTerminalLogsList = new ArrayList<>();
|
||||
Map<String,DictData> dictDataMap = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_TYPE.getCode()).getData().stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
DictData dicDataByCode = dicDataFeignClient.getDicDataByCode(DicDataEnum.LINE_PARAMETER.getCode()).getData();
|
||||
String userName= RequestUtil.getUserNickname();
|
||||
|
||||
for (DeviceParam updateDeviceParam : devList) {
|
||||
if (updateDeviceParam.getUpdateFlag() == 1) {
|
||||
devLogsCat(updateDeviceParam,pqsTerminalLogsList,dictDataMap,dicDataByCode,userName);
|
||||
|
||||
|
||||
Line device = new Line();
|
||||
BeanUtils.copyProperties(updateDeviceParam, device);
|
||||
device.setId(updateDeviceParam.getDevIndex());
|
||||
@@ -695,7 +711,6 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
this.updateById(device);
|
||||
deviceMapper.updateById(deviceDetail);
|
||||
|
||||
logsList.add(device);
|
||||
}
|
||||
|
||||
//母线
|
||||
@@ -829,10 +844,11 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
|
||||
lineDetailMapper.updateById(lineDetail);
|
||||
|
||||
if(StrUtil.isNotBlank(lineDetail.getObjId())){
|
||||
/* if(StrUtil.isNotBlank(lineDetail.getObjId())){
|
||||
Line tem = this.getById(lineDetail.getId());
|
||||
userLedgerFeignClient.bindUserStation(lineDetail.getObjId(),tem.getPids().split(StrUtil.COMMA)[LineBaseEnum.SUB_LEVEL.getCode()]);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
Overlimit overlimitTem = overlimitMapper.selectById(lineId);
|
||||
if ((!lineDetailRes.getDevCapacity().equals(lineDetail.getDevCapacity()))
|
||||
@@ -869,7 +885,6 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
|| !Objects.equals(lineDetail.getDevCapacity(), lineDetailRes.getDevCapacity()) || !Objects.equals(lineDetail.getShortCapacity(), lineDetailRes.getShortCapacity())
|
||||
|| !Objects.equals(lineDetail.getStandardCapacity(), lineDetailRes.getStandardCapacity()) || !Objects.equals(lineDetail.getDealCapacity(), lineDetailRes.getDealCapacity())) {
|
||||
//获取用户信息
|
||||
String userName = RequestUtil.getUsername();
|
||||
String index = RequestUtil.getUserIndex();
|
||||
queryUpdateAndInsertLog(userName, index, lineDetail, lineDetailRes);
|
||||
}
|
||||
@@ -882,10 +897,15 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
}
|
||||
|
||||
if(CollUtil.isNotEmpty(logsList)){
|
||||
terminalLogsCat(logsList,1);
|
||||
if(CollUtil.isNotEmpty(pqsTerminalLogsList)){
|
||||
for(PqsTerminalLogs pqsTerminalLogs : pqsTerminalLogsList){
|
||||
pqsTerminalLogsMapper.insert(pqsTerminalLogs);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (isSync) {
|
||||
/***
|
||||
* oracle http远程调用接口
|
||||
@@ -1397,6 +1417,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
|
||||
private void deleteProvinceAndChildren(String provinceId,List<Line> logsList) {
|
||||
this.removeById(provinceId);
|
||||
|
||||
// 1. 查询并删除所有供电公司
|
||||
List<Line> powerCompanies = findChildren(provinceId);
|
||||
if (CollectionUtil.isEmpty(powerCompanies)) return;
|
||||
@@ -1412,6 +1434,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
|
||||
private void deletePowerCompanyAndChildren(String companyId,List<Line> logsList) {
|
||||
this.removeById(companyId);
|
||||
// 1. 查询并删除所有变电站
|
||||
List<Line> substations = findChildren(companyId);
|
||||
if (CollectionUtil.isEmpty(substations)) return;
|
||||
@@ -1428,6 +1451,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
|
||||
private void deleteSubstationAndChildren(String substationId,List<Line> logsList) {
|
||||
this.removeById(substationId);
|
||||
substationMapper.deleteById(substationId);
|
||||
// 1. 查询并删除所有装置
|
||||
List<Line> devices = findChildren(substationId);
|
||||
if (CollectionUtil.isEmpty(devices)) return;
|
||||
@@ -1447,6 +1472,9 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
|
||||
private void deleteDeviceAndChildren(String deviceId,List<Line> logsList) {
|
||||
this.removeById(deviceId);
|
||||
deviceMapper.deleteById(deviceId);
|
||||
|
||||
// 1. 查询并删除所有母线
|
||||
List<Line> busbars = findChildren(deviceId);
|
||||
if (CollectionUtil.isEmpty(busbars)) return;
|
||||
@@ -1466,6 +1494,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
|
||||
private void deleteBusbarAndChildren(String busbarId,List<Line> logsList) {
|
||||
this.removeById(busbarId);
|
||||
voltageMapper.deleteById(busbarId);
|
||||
// 1. 查询并删除所有监测点
|
||||
List<Line> monitoringPoints = findChildren(busbarId);
|
||||
if (CollectionUtil.isEmpty(monitoringPoints)) return;
|
||||
@@ -1560,323 +1590,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
if(CollUtil.isNotEmpty(logsList)){
|
||||
terminalLogsCat(logsList,2);
|
||||
}
|
||||
/*
|
||||
this.removeById(obj.getId());
|
||||
LambdaQueryWrapper<Line> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if (obj.getLevel().equals(PROJECT_LEVEL.getCode())) {
|
||||
//项目
|
||||
lambdaQueryWrapper.eq(Line::getPid, obj.getId())
|
||||
.eq(Line::getState, DataStateEnum.ENABLE.getCode());
|
||||
List<Line> provinceList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(provinceList)) {
|
||||
List<String> provinceIndexList = provinceList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
//省份
|
||||
this.removeByIds(provinceIndexList);
|
||||
|
||||
for (String provinceIndex : provinceIndexList) {
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.eq(Line::getPid, provinceIndex);
|
||||
List<Line> gdInformationList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(gdInformationList)) {
|
||||
List<String> gdIndexList = gdInformationList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
//供电公司
|
||||
this.removeByIds(gdIndexList);
|
||||
|
||||
for (String gdIndex : gdIndexList) {
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.eq(Line::getPid, gdIndex);
|
||||
List<Line> subStationList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(subStationList)) {
|
||||
List<String> subIndexList = subStationList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
this.removeByIds(subIndexList);
|
||||
substationMapper.deleteBatchIds(subIndexList);
|
||||
|
||||
for (String subIndex : subIndexList) {
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.in(Line::getPid, subIndex);
|
||||
List<Line> deviceList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(deviceList)) {
|
||||
List<String> devIndexList = deviceList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
|
||||
|
||||
|
||||
this.removeByIds(devIndexList);
|
||||
deviceMapper.deleteBatchIds(devIndexList);
|
||||
devFuctionMapper.deleteBatchIds(devIndexList);
|
||||
|
||||
for (String devIndex : devIndexList) {
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.eq(Line::getPid, devIndex);
|
||||
List<Line> subVoltageList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(subVoltageList)) {
|
||||
List<String> subvIndexList = subVoltageList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
this.removeByIds(subvIndexList);
|
||||
voltageMapper.deleteBatchIds(subvIndexList);
|
||||
|
||||
for (String subvIndex : subvIndexList) {
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.eq(Line::getPid, subvIndex);
|
||||
List<Line> lineList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
List<String> lineIndexList = lineList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
|
||||
this.removeByIds(lineIndexList);
|
||||
lineDetailMapper.deleteBatchIds(lineIndexList);
|
||||
overlimitMapper.deleteBatchIds(lineIndexList);
|
||||
|
||||
LambdaQueryWrapper<DeptLine> lineLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lineLambdaQueryWrapper.in(DeptLine::getLineId, lineIndexList);
|
||||
deptLineMapper.delete(lineLambdaQueryWrapper);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else if (obj.getLevel().equals(PROVINCE_LEVEL.getCode())) {
|
||||
//省份
|
||||
lambdaQueryWrapper.eq(Line::getPid, obj.getId());
|
||||
List<Line> gdInformationList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(gdInformationList)) {
|
||||
List<String> gdIndexList = gdInformationList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
//供电公司
|
||||
this.removeByIds(gdIndexList);
|
||||
|
||||
for (String gdIndex : gdIndexList) {
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.eq(Line::getPid, gdIndex);
|
||||
List<Line> subStationList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(subStationList)) {
|
||||
List<String> subIndexList = subStationList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
this.removeByIds(subIndexList);
|
||||
substationMapper.deleteBatchIds(subIndexList);
|
||||
|
||||
for (String subIndex : subIndexList) {
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.in(Line::getPid, subIndex);
|
||||
List<Line> deviceList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(deviceList)) {
|
||||
List<String> devIndexList = deviceList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
this.removeByIds(devIndexList);
|
||||
deviceMapper.deleteBatchIds(devIndexList);
|
||||
devFuctionMapper.deleteBatchIds(devIndexList);
|
||||
|
||||
for (String devIndex : devIndexList) {
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.eq(Line::getPid, devIndex);
|
||||
List<Line> subVoltageList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(subVoltageList)) {
|
||||
List<String> subvIndexList = subVoltageList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
this.removeByIds(subvIndexList);
|
||||
voltageMapper.deleteBatchIds(subvIndexList);
|
||||
|
||||
for (String subvIndex : subvIndexList) {
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.eq(Line::getPid, subvIndex);
|
||||
List<Line> lineList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
List<String> lineIndexList = lineList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
|
||||
this.removeByIds(lineIndexList);
|
||||
lineDetailMapper.deleteBatchIds(lineIndexList);
|
||||
overlimitMapper.deleteBatchIds(lineIndexList);
|
||||
|
||||
LambdaQueryWrapper<DeptLine> lineLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lineLambdaQueryWrapper.in(DeptLine::getLineId, lineIndexList);
|
||||
deptLineMapper.delete(lineLambdaQueryWrapper);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (obj.getLevel().equals(GD_LEVEL.getCode())) {
|
||||
//供电公司
|
||||
lambdaQueryWrapper.eq(Line::getPid, obj.getId());
|
||||
List<Line> subStationList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(subStationList)) {
|
||||
List<String> subIndexList = subStationList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
this.removeByIds(subIndexList);
|
||||
substationMapper.deleteBatchIds(subIndexList);
|
||||
|
||||
|
||||
for (String subIndex : subIndexList) {
|
||||
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.in(Line::getPid, subIndex);
|
||||
List<Line> deviceList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(deviceList)) {
|
||||
List<String> devIndexList = deviceList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
this.removeByIds(devIndexList);
|
||||
deviceMapper.deleteBatchIds(devIndexList);
|
||||
devFuctionMapper.deleteBatchIds(devIndexList);
|
||||
|
||||
for (String devIndex : devIndexList) {
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.eq(Line::getPid, devIndex);
|
||||
List<Line> subVoltageList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(subVoltageList)) {
|
||||
List<String> subvIndexList = subVoltageList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
this.removeByIds(subvIndexList);
|
||||
voltageMapper.deleteBatchIds(subvIndexList);
|
||||
|
||||
for (String subvIndex : subvIndexList) {
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.eq(Line::getPid, subvIndex);
|
||||
List<Line> lineList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
List<String> lineIndexList = lineList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
|
||||
this.removeByIds(lineIndexList);
|
||||
lineDetailMapper.deleteBatchIds(lineIndexList);
|
||||
overlimitMapper.deleteBatchIds(lineIndexList);
|
||||
|
||||
LambdaQueryWrapper<DeptLine> lineLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lineLambdaQueryWrapper.in(DeptLine::getLineId, lineIndexList);
|
||||
deptLineMapper.delete(lineLambdaQueryWrapper);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else if (obj.getLevel().equals(LineBaseEnum.SUB_LEVEL.getCode())) {
|
||||
//变电站
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.in(Line::getPid, obj.getId());
|
||||
List<Line> deviceList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(deviceList)) {
|
||||
List<String> devIndexList = deviceList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
|
||||
this.removeByIds(devIndexList);
|
||||
deviceMapper.deleteBatchIds(devIndexList);
|
||||
devFuctionMapper.deleteBatchIds(devIndexList);
|
||||
|
||||
for (String devIndex : devIndexList) {
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.eq(Line::getPid, devIndex);
|
||||
List<Line> subVoltageList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(subVoltageList)) {
|
||||
List<String> subvIndexList = subVoltageList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
this.removeByIds(subvIndexList);
|
||||
voltageMapper.deleteBatchIds(subvIndexList);
|
||||
|
||||
for (String subvIndex : subvIndexList) {
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.eq(Line::getPid, subvIndex);
|
||||
List<Line> lineList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
List<String> lineIndexList = lineList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
|
||||
this.removeByIds(lineIndexList);
|
||||
lineDetailMapper.deleteBatchIds(lineIndexList);
|
||||
overlimitMapper.deleteBatchIds(lineIndexList);
|
||||
|
||||
LambdaQueryWrapper<DeptLine> lineLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lineLambdaQueryWrapper.in(DeptLine::getLineId, lineIndexList);
|
||||
deptLineMapper.delete(lineLambdaQueryWrapper);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else if (obj.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())) {
|
||||
deviceMapper.deleteById(obj.getId());
|
||||
lambdaQueryWrapper.eq(Line::getPid, obj.getId());
|
||||
List<Line> subVoltageList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(subVoltageList)) {
|
||||
List<String> subvIndexList = subVoltageList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
this.removeByIds(subvIndexList);
|
||||
voltageMapper.deleteBatchIds(subvIndexList);
|
||||
|
||||
for (String subvIndex : subvIndexList) {
|
||||
lambdaQueryWrapper.clear();
|
||||
lambdaQueryWrapper.eq(Line::getPid, subvIndex);
|
||||
List<Line> lineList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
List<String> lineIndexList = lineList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
|
||||
this.removeByIds(lineIndexList);
|
||||
lineDetailMapper.deleteBatchIds(lineIndexList);
|
||||
overlimitMapper.deleteBatchIds(lineIndexList);
|
||||
|
||||
LambdaQueryWrapper<DeptLine> lineLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lineLambdaQueryWrapper.in(DeptLine::getLineId, lineIndexList);
|
||||
deptLineMapper.delete(lineLambdaQueryWrapper);
|
||||
// 删除终端通知前置重启
|
||||
this.askRestartDevice(id,DeviceRebootType.DELETE_TERMINAL);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else if (obj.getLevel().equals(LineBaseEnum.SUB_V_LEVEL.getCode())) {
|
||||
//母线
|
||||
lambdaQueryWrapper.eq(Line::getPid, obj.getId());
|
||||
List<Line> lineList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
List<String> lineIndexList = lineList.stream().map(Line::getId).collect(Collectors.toList());
|
||||
|
||||
this.removeByIds(lineIndexList);
|
||||
lineDetailMapper.deleteBatchIds(lineIndexList);
|
||||
overlimitMapper.deleteBatchIds(lineIndexList);
|
||||
|
||||
LambdaQueryWrapper<DeptLine> lineLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lineLambdaQueryWrapper.in(DeptLine::getLineId, lineIndexList);
|
||||
deptLineMapper.delete(lineLambdaQueryWrapper);
|
||||
//通知前置删除监测点
|
||||
// String[] split = obj.getPids().split(",");
|
||||
// this.askRestartDevice(split[4],DeviceRebootType.LEDGER_MODIFY);
|
||||
|
||||
}
|
||||
|
||||
} else if (obj.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())) {
|
||||
//监测点
|
||||
|
||||
lineDetailMapper.deleteById(obj.getId());
|
||||
overlimitMapper.deleteById(obj.getId());
|
||||
deptLineMapper.deleteById(obj.getId());
|
||||
//通知前置删除监测点
|
||||
// String[] split = obj.getPids().split(",");
|
||||
// this.askRestartDevice(split[4],DeviceRebootType.LEDGER_MODIFY);
|
||||
|
||||
} else {
|
||||
throw new BusinessException(CommonResponseEnum.FAIL);
|
||||
}
|
||||
if (isSync) {
|
||||
SyncLedgerDelete delete = oracleSyncLedgerDelete(obj);
|
||||
ResponseEntity<String> userEntity = RestTemplateUtil.post(urlDelete, delete, String.class);
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3989,6 +3703,58 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void devLogsCat(DeviceParam updateDeviceParam, List<PqsTerminalLogs> pqsTerminalLogsList, Map<String, DictData> dictDataMap, DictData dicDataByCode, String userName) {
|
||||
Line devicePO = this.getById(updateDeviceParam.getDevIndex());
|
||||
Line sub = this.getById(devicePO.getPid());
|
||||
Device devDetail = deviceMapper.selectById(updateDeviceParam.getDevIndex());
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder(String.format("%s进行修改装置(%s_%s)操作,详细信息:", userName, sub.getName(), devicePO.getName()));
|
||||
boolean flag = false;
|
||||
|
||||
// 比较装置名称
|
||||
flag |= compareAndAppend(stringBuilder, devicePO.getName(), updateDeviceParam.getName(), "装置名称");
|
||||
|
||||
// 比较装置 IP
|
||||
flag |= compareAndAppend(stringBuilder, devDetail.getIp(), updateDeviceParam.getIp(), "装置ip");
|
||||
|
||||
// 比较装置端口号
|
||||
flag |= compareAndAppend(stringBuilder, devDetail.getPort(), updateDeviceParam.getPort(), "装置端口号");
|
||||
|
||||
// 比较装置型号
|
||||
if (updateDeviceParam.getDevType() != null) {
|
||||
String oldDevTypeName = dictDataMap.get(devDetail.getDevType()) != null ? dictDataMap.get(devDetail.getDevType()).getName() : null;
|
||||
String newDevTypeName = dictDataMap.get(updateDeviceParam.getDevType()) != null ? dictDataMap.get(updateDeviceParam.getDevType()).getName() : null;
|
||||
flag |= compareAndAppend(stringBuilder, oldDevTypeName, newDevTypeName, "装置型号");
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
PqsTerminalLogs pqsTerminalLogs = new PqsTerminalLogs();
|
||||
pqsTerminalLogs.setOperateType(Param.UPDATE_ZN);
|
||||
pqsTerminalLogs.setTerminalType(DEVICE_LEVEL.getCode());
|
||||
pqsTerminalLogs.setState(DataStateEnum.ENABLE.getCode());
|
||||
pqsTerminalLogs.setObjIndex(devicePO.getId());
|
||||
pqsTerminalLogs.setIsPush(DataStateEnum.ENABLE.getCode());
|
||||
pqsTerminalLogs.setLogsType(dicDataByCode.getId());
|
||||
pqsTerminalLogs.setTerminalDescribe(stringBuilder.toString());
|
||||
pqsTerminalLogsList.add(pqsTerminalLogs);
|
||||
}
|
||||
}
|
||||
private boolean compareAndAppend(StringBuilder sb, String oldValue, String newValue, String fieldName) {
|
||||
if (oldValue != null && !oldValue.equals(newValue)) {
|
||||
sb.append(String.format("%s由 %s 改为> %s;", fieldName, oldValue, newValue));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean compareAndAppend(StringBuilder sb, Integer oldValue, Integer newValue, String fieldName) {
|
||||
if (oldValue != null && !oldValue.equals(newValue)) {
|
||||
sb.append(String.format("%s由 %s 改为> %s;", fieldName, oldValue, newValue));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,6 +145,10 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
private List<TerminalTree> specialDealSubChildren(TerminalTree sub,List<TerminalTree> lineUserList,List<TerminalTree> devOtherList,List<TerminalTree> busBarList,List<TerminalTree> devAllList,List<UserLedgerVO> userReportPOList){
|
||||
List<TerminalTree> list = new ArrayList<>();
|
||||
|
||||
if("c325fb29fbf56612018a571e950ada5a".equals(sub.getId())){
|
||||
System.out.println(666);
|
||||
}
|
||||
|
||||
if(CollUtil.isNotEmpty(userReportPOList)) {
|
||||
Map<String, UserLedgerVO> userLedgerVOMap = userReportPOList.stream().collect(Collectors.toMap(UserLedgerVO::getId, Function.identity()));
|
||||
|
||||
@@ -188,6 +192,9 @@ public class TerminalTreeServiceImpl implements TerminalTreeService {
|
||||
});
|
||||
|
||||
UserLedgerVO userReportPO = userLedgerVOMap.get(objId);
|
||||
if(Objects.isNull(userReportPO)){
|
||||
System.out.println(map);
|
||||
}
|
||||
TerminalTree terminalTree = new TerminalTree();
|
||||
terminalTree.setName(userReportPO.getProjectName());
|
||||
terminalTree.setId(userReportPO.getId());
|
||||
|
||||
@@ -97,6 +97,13 @@ public class UserReportParam {
|
||||
@Pattern(regexp = PatternRegex.DES32_REGEX, message = ValidMessage.DATA_TOO_LONG)
|
||||
private String substation;
|
||||
|
||||
/**
|
||||
* 变电站
|
||||
*/
|
||||
@ApiModelProperty(value = "变电站id")
|
||||
@Pattern(regexp = PatternRegex.DES32_REGEX, message = ValidMessage.DATA_TOO_LONG)
|
||||
private String stationId;
|
||||
|
||||
/**
|
||||
* 电压等级
|
||||
*/
|
||||
|
||||
@@ -1162,6 +1162,9 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
if(StrUtil.isNotBlank(userReportParam.getCity())){
|
||||
lambdaQueryWrapper.in(UserReportPO::getCity,Stream.of(userReportParam.getCity()).collect(Collectors.toList()));
|
||||
}
|
||||
if(StrUtil.isNotBlank(userReportParam.getStationId())){
|
||||
lambdaQueryWrapper.eq(UserReportPO::getStationId,userReportParam.getStationId());
|
||||
}
|
||||
|
||||
lambdaQueryWrapper.eq(UserReportPO::getState,DataStateEnum.ENABLE.getCode());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user