From c3db9597fea25b6999bbef22fa92ac6d365624f0 Mon Sep 17 00:00:00 2001 From: chendaofei <857448963@qq.com> Date: Wed, 9 Apr 2025 17:52:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=88=E7=AB=AF=E9=87=8D=E8=A6=81=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=8A=9F=E8=83=BD=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/biz/enums/DeviceResponseEnum.java | 4 +- .../pq/controller/SubstationController.java | 11 + .../device/pq/service/ISubstationService.java | 3 + .../service/impl/SubstationServiceImpl.java | 18 + .../service/impl/TerminalBaseServiceImpl.java | 416 ++++-------------- .../service/impl/TerminalTreeServiceImpl.java | 7 + .../pojo/param/user/UserReportParam.java | 7 + .../user/impl/UserReportPOServiceImpl.java | 3 + 8 files changed, 142 insertions(+), 327 deletions(-) diff --git a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/enums/DeviceResponseEnum.java b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/enums/DeviceResponseEnum.java index 3ccf38814..4c1d38c33 100644 --- a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/enums/DeviceResponseEnum.java +++ b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/enums/DeviceResponseEnum.java @@ -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","用户对象所属电站不匹配") ; diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/SubstationController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/SubstationController.java index b05f8aba4..e6db54f7e 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/SubstationController.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/SubstationController.java @@ -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> getSubstationSelect(){ + String methodDescribe = getMethodDescribe("getSubstationSelect"); + List substationDTOList = substationService.getSubstationSelect(); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, substationDTOList, methodDescribe); + } + } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/ISubstationService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/ISubstationService.java index a4f983a56..1b1604566 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/ISubstationService.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/ISubstationService.java @@ -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 { * @return 变电站信息 */ List getSubstationById(List subId); + + List getSubstationSelect(); } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/SubstationServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/SubstationServiceImpl.java index bca8479eb..72e10b9a7 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/SubstationServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/SubstationServiceImpl.java @@ -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 implements ISubstationService { + private final LineMapper lineMapper; + @Override public List getSubstationById(List subId) { return this.baseMapper.getSubstationById(subId); } + + @Override + public List getSubstationSelect() { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(Line::getLevel, LineBaseEnum.SUB_LEVEL.getCode()) + .eq(Line::getState, DataStateEnum.ENABLE.getCode()).orderByAsc(Line::getCreateTime); + return lineMapper.selectList(lambdaQueryWrapper); + } } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalBaseServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalBaseServiceImpl.java index e8c9b2c72..25a731383 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalBaseServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalBaseServiceImpl.java @@ -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 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 imple } - List logsList = new ArrayList<>(); + + List pqsTerminalLogsList = new ArrayList<>(); + Map 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 imple this.updateById(device); deviceMapper.updateById(deviceDetail); - logsList.add(device); } //母线 @@ -829,10 +844,11 @@ public class TerminalBaseServiceImpl extends ServiceImpl 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 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 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 imple } private void deleteProvinceAndChildren(String provinceId,List logsList) { + this.removeById(provinceId); + // 1. 查询并删除所有供电公司 List powerCompanies = findChildren(provinceId); if (CollectionUtil.isEmpty(powerCompanies)) return; @@ -1412,6 +1434,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl imple } private void deletePowerCompanyAndChildren(String companyId,List logsList) { + this.removeById(companyId); // 1. 查询并删除所有变电站 List substations = findChildren(companyId); if (CollectionUtil.isEmpty(substations)) return; @@ -1428,6 +1451,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl imple } private void deleteSubstationAndChildren(String substationId,List logsList) { + this.removeById(substationId); + substationMapper.deleteById(substationId); // 1. 查询并删除所有装置 List devices = findChildren(substationId); if (CollectionUtil.isEmpty(devices)) return; @@ -1447,6 +1472,9 @@ public class TerminalBaseServiceImpl extends ServiceImpl imple } private void deleteDeviceAndChildren(String deviceId,List logsList) { + this.removeById(deviceId); + deviceMapper.deleteById(deviceId); + // 1. 查询并删除所有母线 List busbars = findChildren(deviceId); if (CollectionUtil.isEmpty(busbars)) return; @@ -1466,6 +1494,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl imple } private void deleteBusbarAndChildren(String busbarId,List logsList) { + this.removeById(busbarId); + voltageMapper.deleteById(busbarId); // 1. 查询并删除所有监测点 List monitoringPoints = findChildren(busbarId); if (CollectionUtil.isEmpty(monitoringPoints)) return; @@ -1560,323 +1590,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl imple if(CollUtil.isNotEmpty(logsList)){ terminalLogsCat(logsList,2); } -/* - this.removeById(obj.getId()); - LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); - if (obj.getLevel().equals(PROJECT_LEVEL.getCode())) { - //项目 - lambdaQueryWrapper.eq(Line::getPid, obj.getId()) - .eq(Line::getState, DataStateEnum.ENABLE.getCode()); - List provinceList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(provinceList)) { - List provinceIndexList = provinceList.stream().map(Line::getId).collect(Collectors.toList()); - //省份 - this.removeByIds(provinceIndexList); - for (String provinceIndex : provinceIndexList) { - lambdaQueryWrapper.clear(); - lambdaQueryWrapper.eq(Line::getPid, provinceIndex); - List gdInformationList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(gdInformationList)) { - List gdIndexList = gdInformationList.stream().map(Line::getId).collect(Collectors.toList()); - //供电公司 - this.removeByIds(gdIndexList); - - for (String gdIndex : gdIndexList) { - lambdaQueryWrapper.clear(); - lambdaQueryWrapper.eq(Line::getPid, gdIndex); - List subStationList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(subStationList)) { - List 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 deviceList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(deviceList)) { - List 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 subVoltageList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(subVoltageList)) { - List 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 lineList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(lineList)) { - List lineIndexList = lineList.stream().map(Line::getId).collect(Collectors.toList()); - - this.removeByIds(lineIndexList); - lineDetailMapper.deleteBatchIds(lineIndexList); - overlimitMapper.deleteBatchIds(lineIndexList); - - LambdaQueryWrapper 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 gdInformationList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(gdInformationList)) { - List gdIndexList = gdInformationList.stream().map(Line::getId).collect(Collectors.toList()); - //供电公司 - this.removeByIds(gdIndexList); - - for (String gdIndex : gdIndexList) { - lambdaQueryWrapper.clear(); - lambdaQueryWrapper.eq(Line::getPid, gdIndex); - List subStationList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(subStationList)) { - List 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 deviceList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(deviceList)) { - List 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 subVoltageList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(subVoltageList)) { - List 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 lineList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(lineList)) { - List lineIndexList = lineList.stream().map(Line::getId).collect(Collectors.toList()); - - this.removeByIds(lineIndexList); - lineDetailMapper.deleteBatchIds(lineIndexList); - overlimitMapper.deleteBatchIds(lineIndexList); - - LambdaQueryWrapper 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 subStationList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(subStationList)) { - List 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 deviceList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(deviceList)) { - List 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 subVoltageList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(subVoltageList)) { - List 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 lineList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(lineList)) { - List lineIndexList = lineList.stream().map(Line::getId).collect(Collectors.toList()); - - this.removeByIds(lineIndexList); - lineDetailMapper.deleteBatchIds(lineIndexList); - overlimitMapper.deleteBatchIds(lineIndexList); - - LambdaQueryWrapper 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 deviceList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(deviceList)) { - List 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 subVoltageList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(subVoltageList)) { - List 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 lineList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(lineList)) { - List lineIndexList = lineList.stream().map(Line::getId).collect(Collectors.toList()); - - this.removeByIds(lineIndexList); - lineDetailMapper.deleteBatchIds(lineIndexList); - overlimitMapper.deleteBatchIds(lineIndexList); - - LambdaQueryWrapper 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 subVoltageList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(subVoltageList)) { - List 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 lineList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(lineList)) { - List lineIndexList = lineList.stream().map(Line::getId).collect(Collectors.toList()); - - this.removeByIds(lineIndexList); - lineDetailMapper.deleteBatchIds(lineIndexList); - overlimitMapper.deleteBatchIds(lineIndexList); - - LambdaQueryWrapper 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 lineList = this.list(lambdaQueryWrapper); - if (CollectionUtil.isNotEmpty(lineList)) { - List lineIndexList = lineList.stream().map(Line::getId).collect(Collectors.toList()); - - this.removeByIds(lineIndexList); - lineDetailMapper.deleteBatchIds(lineIndexList); - overlimitMapper.deleteBatchIds(lineIndexList); - - LambdaQueryWrapper 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 userEntity = RestTemplateUtil.post(urlDelete, delete, String.class); - }*/ return true; } @@ -3989,6 +3703,58 @@ public class TerminalBaseServiceImpl extends ServiceImpl imple } } + } + + public void devLogsCat(DeviceParam updateDeviceParam, List pqsTerminalLogsList, Map 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; } } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalTreeServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalTreeServiceImpl.java index 18ebc5fa2..e35ac3a14 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalTreeServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalTreeServiceImpl.java @@ -145,6 +145,10 @@ public class TerminalTreeServiceImpl implements TerminalTreeService { private List specialDealSubChildren(TerminalTree sub,List lineUserList,List devOtherList,List busBarList,List devAllList,List userReportPOList){ List list = new ArrayList<>(); + if("c325fb29fbf56612018a571e950ada5a".equals(sub.getId())){ + System.out.println(666); + } + if(CollUtil.isNotEmpty(userReportPOList)) { Map 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()); diff --git a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/user/UserReportParam.java b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/user/UserReportParam.java index 9018afbf0..453b0b433 100644 --- a/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/user/UserReportParam.java +++ b/pqs-supervision/supervision-api/src/main/java/com/njcn/supervision/pojo/param/user/UserReportParam.java @@ -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; + /** * 电压等级 */ diff --git a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportPOServiceImpl.java b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportPOServiceImpl.java index 3e5bf7de4..4a5751410 100644 --- a/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportPOServiceImpl.java +++ b/pqs-supervision/supervision-boot/src/main/java/com/njcn/supervision/service/user/impl/UserReportPOServiceImpl.java @@ -1162,6 +1162,9 @@ public class UserReportPOServiceImpl extends ServiceImpl