diff --git a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/dto/PmsLedgerStaticDTO.java b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/dto/PmsLedgerStaticDTO.java index 0fe5fc583..cc5741a03 100644 --- a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/dto/PmsLedgerStaticDTO.java +++ b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/dto/PmsLedgerStaticDTO.java @@ -32,11 +32,11 @@ public class PmsLedgerStaticDTO implements Serializable { /** * 根据单位统计监测点数量 */ - private HashMap> monitorStatisticsByDept; + private List> monitorStatisticsByDept; /** * 根据单位统计终端数量 */ - private HashMap> terminalStatisticsByDept; + private List> terminalStatisticsByDept; } diff --git a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/dto/PmsMonitorBaseDTO.java b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/dto/PmsMonitorBaseDTO.java index 2ff4d38bd..f31ed197b 100644 --- a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/dto/PmsMonitorBaseDTO.java +++ b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/dto/PmsMonitorBaseDTO.java @@ -42,10 +42,6 @@ public class PmsMonitorBaseDTO implements Serializable { */ private String terminalId; - /*** - * 母线ID - */ - private String generatrixId; /*** * 监测线路名称 diff --git a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/dto/PmsSimpleDTO.java b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/dto/PmsSimpleDTO.java index b377e6c40..2e0438693 100644 --- a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/dto/PmsSimpleDTO.java +++ b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/dto/PmsSimpleDTO.java @@ -24,4 +24,14 @@ public class PmsSimpleDTO implements Serializable { private String classification; private Integer sort; + + @ApiModelProperty(name = "id", value = "id") + private String id; + + @Data + public static class PmsSimpleOrg extends PmsSimpleDTO{ + + @ApiModelProperty(name = "OrgName", value = "部门名称") + private String OrgName; + } } diff --git a/pqs-device/pms-device/pms-device-boot/pom.xml b/pqs-device/pms-device/pms-device-boot/pom.xml index d18e83f10..d84f153aa 100644 --- a/pqs-device/pms-device/pms-device-boot/pom.xml +++ b/pqs-device/pms-device/pms-device-boot/pom.xml @@ -43,16 +43,16 @@ com.njcn common-web ${project.version} - - - org.slf4j - slf4j-log4j12 - - - ch.qos.logback - logback-classic - - + + + + + + + + + + com.njcn diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/controller/ledgerManger/SubstationExpendController.java b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/controller/ledgerManger/SubstationExpendController.java index 54c03e068..4dc7ec6aa 100644 --- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/controller/ledgerManger/SubstationExpendController.java +++ b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/controller/ledgerManger/SubstationExpendController.java @@ -12,6 +12,8 @@ import com.njcn.device.pms.pojo.param.PmsBaseParam; import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam; import com.njcn.device.pms.pojo.po.SubstationExpend; import com.njcn.device.pms.service.ISubstationExpendService; +import com.njcn.device.pq.pojo.param.CommunicateParam; +import com.njcn.device.pq.pojo.vo.CommunicateVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; @@ -40,7 +42,7 @@ import java.util.Map; @Slf4j @Api(tags = "冀北变电站地图信息") @RestController -@RequestMapping("/pms/substationExpend") +@RequestMapping("/substationExpend") @RequiredArgsConstructor public class SubstationExpendController extends BaseController { @@ -48,7 +50,7 @@ public class SubstationExpendController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/getSubstationExpendInfo") + @PostMapping("/getPVSubstationExpendInfo") @ApiOperation("冀北变电站地图信息") @ApiImplicitParam(name = "param", value = "冀北变电站地图信息参数", required = true) public HttpResult>> getSubstationExpendInfo(@RequestBody StatisticsBizBaseParam param) { @@ -61,11 +63,20 @@ public class SubstationExpendController extends BaseController { @PostMapping("/getLedgerStatic") @ApiOperation("冀北主网监测点台账统计") @ApiImplicitParam(name = "param", value = "冀北主网监测点台账统计参数", required = true) - public HttpResult getLedgerStatic(@RequestBody PmsDeviceInfoParam param) { + public HttpResult getLedgerStatic(@RequestBody StatisticsBizBaseParam param) { String methodDescribe = getMethodDescribe("getLedgerStatic"); PmsLedgerStaticDTO result = substationExpendService.getLedgerStatistics(param); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getPVCommunicationStatus") + @ApiOperation("冀北主网监测点通讯状态统计") + @ApiImplicitParam(name = "param", value = "冀北主网监测点台账统计参数", required = true) + public HttpResult> getPVCommunicationStatus(@RequestBody CommunicateParam param) { + String methodDescribe = getMethodDescribe("getPVCommunicationStatus"); + List communicationStatus = substationExpendService.getCommunicationStatus(param); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, communicationStatus, methodDescribe); + } } diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/mapper/majornetwork/mapping/DistributionMonitorMapper.xml b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/mapper/majornetwork/mapping/DistributionMonitorMapper.xml index 0ed98b762..337a1ea8a 100644 --- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/mapper/majornetwork/mapping/DistributionMonitorMapper.xml +++ b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/mapper/majornetwork/mapping/DistributionMonitorMapper.xml @@ -192,6 +192,7 @@ SELECT + t1.id devId, t1.name devName,t2.ip,t2.dev_type,t2.update_time,sub.name subName,gd.name gdName FROM pq_line t1, diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/ISubstationExpendService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/ISubstationExpendService.java new file mode 100644 index 000000000..58437386c --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/ISubstationExpendService.java @@ -0,0 +1,21 @@ +package com.njcn.device.pq.service; + + +import com.njcn.device.pq.pojo.param.CommunicateParam; +import com.njcn.device.pq.pojo.param.DeviceInfoParam; +import com.njcn.device.pq.pojo.vo.CommunicateVO; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author zhuxinyu + * @since 2023-05-08 + */ +public interface ISubstationExpendService { + + List getCommunicationStatus(DeviceInfoParam.CompareLimitParam param); +} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/SubstationExpendServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/SubstationExpendServiceImpl.java new file mode 100644 index 000000000..03fa11a3a --- /dev/null +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/SubstationExpendServiceImpl.java @@ -0,0 +1,103 @@ +package com.njcn.device.pq.service.impl; + + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.njcn.common.pojo.dto.SimpleDTO; +import com.njcn.common.pojo.param.StatisticsBizBaseParam; +import com.njcn.device.pq.pojo.bo.DeviceType; +import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; +import com.njcn.device.pq.pojo.param.CommunicateParam; +import com.njcn.device.pq.pojo.param.DeviceInfoParam; +import com.njcn.device.pq.pojo.po.Communicate; +import com.njcn.device.pq.pojo.po.Device; +import com.njcn.device.pq.pojo.vo.CommunicateVO; +import com.njcn.device.pq.pojo.vo.TerminalBaseVO; +import com.njcn.device.pq.service.IDeviceService; +import com.njcn.device.pq.service.ISubstationExpendService; +import com.njcn.device.pq.service.TerminalBaseService; +import com.njcn.influxdb.param.InfluxDBPublicParam; +import com.njcn.influxdb.utils.InfluxDbUtils; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.enums.DicDataTypeEnum; +import com.njcn.system.pojo.po.DictData; +import com.njcn.user.api.DeptFeignClient; +import com.njcn.user.pojo.dto.DeptDTO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.influxdb.dto.QueryResult; +import org.influxdb.impl.InfluxDBResultMapper; +import org.springframework.stereotype.Service; + +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + *

+ * 服务实现类 + *

+ * + * @author zhuxinyu + * @since 2023-05-08 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class SubstationExpendServiceImpl implements ISubstationExpendService { + + private final GeneralDeviceService generalDeviceService; + private final InfluxDbUtils influxDbUtils; + private final IDeviceService deviceService; + private final TerminalBaseService terminalBaseService; + + @Override + public List getCommunicationStatus(DeviceInfoParam.CompareLimitParam param) { + List generalDeviceDTOS = generalDeviceService.getDeviceInfo(param, Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList())); + //获取所有终端id + List terminalIds = generalDeviceDTOS.stream().flatMap(dto -> dto.getDeviceIndexes().stream()).collect(Collectors.toList()); + List info =new ArrayList<>(); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime()))).append("' "); + if(CollUtil.isNotEmpty(terminalIds)){ + stringBuilder.append(" and ").append("("); + for (int i = 0; i < terminalIds.size(); i++) { + if (terminalIds.size() - i != 1) { + stringBuilder.append("dev_id = '").append(terminalIds.get(i)).append("' or "); + } else { + stringBuilder.append("dev_id = '").append(terminalIds.get(i)).append("')"); + } + } + } + stringBuilder.append(" limit "+param.getLimit()); + String sql = "select * from " + InfluxDBPublicParam.PQS_COMMUNICATE + " where " + stringBuilder + InfluxDBPublicParam.TIME_ZONE; + // 获取暂降事件 + QueryResult result = influxDbUtils.query(sql); + InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); + List communicates = influxDBResultMapper.toPOJO(result, Communicate.class); + if(CollUtil.isEmpty(communicates)){ + return info; + } + List ids = communicates.stream().map(Communicate::getDevId).distinct().collect(Collectors.toList()); + if(CollUtil.isNotEmpty(ids)){ + List deviceByIds = terminalBaseService.getDeviceByIdOnOrOff(ids, new DeviceType(), 0); + Map terminalNameIp = deviceByIds.stream().collect(Collectors.toMap(TerminalBaseVO::getDevId, x -> x.getDevName() + "_" + x.getIp())); + CommunicateVO.PVCommunicateVO communicate; + for (Communicate cate : communicates) { + communicate=new CommunicateVO.PVCommunicateVO(); + BeanUtil.copyProperties(cate, communicate); + communicate.setTime(cate.getUpdateTime()); + if(terminalNameIp.containsKey(cate.getDevId())){ + communicate.setDevIp(terminalNameIp.get(cate.getDevId())); + } + info.add(communicate); + } + } + return info; + } + +} diff --git a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/param/WaveTypeParam.java b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/param/WaveTypeParam.java index 19c4c4ed4..0cf654ef3 100644 --- a/pqs-event/event-api/src/main/java/com/njcn/event/pojo/param/WaveTypeParam.java +++ b/pqs-event/event-api/src/main/java/com/njcn/event/pojo/param/WaveTypeParam.java @@ -40,4 +40,10 @@ public class WaveTypeParam extends DeviceInfoParam.BusinessParam { value = "通讯状态 0.离线 1.在线" ) private Integer comFlag = 1; + + @ApiModelProperty( + name = "type", + value = "区分 0.pq 1.pms" + ) + private Integer type = 0; } diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java index a0594a08a..4bbde95e0 100644 --- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java +++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/ReportServiceImpl.java @@ -440,14 +440,29 @@ public class ReportServiceImpl implements ReportService { */ @Override public Page getContinueTime(WaveTypeParam waveTypeParam) { + List lineIds =new ArrayList<>(); + String eventType=""; List result = new ArrayList<>(); - List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData(); - List lineIds = deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList()); + if(waveTypeParam.getType()==0){ + //pq系统 + List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData(); + lineIds =deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList()); + }else{ + //pms系统 + PmsDeviceInfoParam param=new PmsDeviceInfoParam(); + param.setDeptIndex(waveTypeParam.getDeptIndex()); + param.setStatisticalType(waveTypeParam.getStatisticalType()); + List data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(param).getData(); + lineIds =data.stream().flatMap(list -> list.getMonitorIdList().stream()).collect(Collectors.toList()); + eventType=dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData().getId(); + } + if (CollectionUtil.isEmpty(lineIds)) { throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY); } Page pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper() .in(RmpEventDetailPO::getMeasurementPointId, lineIds) + .eq(StrUtil.isNotBlank(eventType),RmpEventDetailPO::getEventType,eventType) .ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime()))) .le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime()))) ); @@ -460,15 +475,36 @@ public class ReportServiceImpl implements ReportService { result.add(vo); idlist.add(eventDetail.getLineId()); } - HttpResult> AreaInfo = lineFeignClient.getBaseLineAreaInfo(idlist); - List data = AreaInfo.getData(); - for (DetailVO detailVO : result) { - for (AreaLineInfoVO vo : data) { - if (vo.getLineId().equals(detailVO.getLineId())) { - BeanUtils.copyProperties(vo, detailVO); + if(waveTypeParam.getType()==0){ + //pq系统 + HttpResult> AreaInfo = lineFeignClient.getBaseLineAreaInfo(idlist); + List data = AreaInfo.getData(); + for (DetailVO detailVO : result) { + for (AreaLineInfoVO vo : data) { + if (vo.getLineId().equals(detailVO.getLineId())) { + BeanUtils.copyProperties(vo, detailVO); + } + } + } + + }else{ + //pms系统 + List monitorInfo = monitorClient.getMonitorList(idlist).getData(); + for (DetailVO detailVO : result) { + for (Monitor vo : monitorInfo) { + if (vo.getId().equals(detailVO.getLineId())) { + detailVO.setLineId(vo.getId()); + detailVO.setLineName(vo.getName()); + detailVO.setSubId(vo.getPowerrId()); + detailVO.setSubName(vo.getPowerrName()); + detailVO.setGdId(vo.getOrgId()); + detailVO.setGdName(vo.getOrgName()); + detailVO.setVoltageScale(vo.getVoltageLevel()); + } } } } + HttpResult> reason = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()); List type = reason.getData(); for (DetailVO detailVO : result) {