diff --git a/pqs-device/device-boot/pom.xml b/pqs-device/device-boot/pom.xml
index 91973a7ab..ff807b7c4 100644
--- a/pqs-device/device-boot/pom.xml
+++ b/pqs-device/device-boot/pom.xml
@@ -21,23 +21,32 @@
+
+
+
+
+
- com.njcn
- pq-device-boot
- ${project.version}
-
-
+
com.njcn
common-swagger
${project.version}
-
+
+ com.squareup.okhttp3
+ okhttp
+ 4.9.0
+
+
+ com.squareup.okhttp3
+ logging-interceptor
+ 4.9.0
+
diff --git a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/enums/PmsDeviceResponseEnum.java b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/enums/PmsDeviceResponseEnum.java
index 2b7ef3f23..cd12e4a40 100644
--- a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/enums/PmsDeviceResponseEnum.java
+++ b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/enums/PmsDeviceResponseEnum.java
@@ -58,6 +58,7 @@ public enum PmsDeviceResponseEnum {
TRANSFORMER_ID_REPEAT("A00356","变压器编号重复"),
NO_ID_STATION("A00357","变电站编号为空"),
+ NO_ID_ORG("A00357","部门编号为空"),
;
diff --git a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/vo/StatationStatVO.java b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/vo/StatationStatVO.java
index 784c75615..305331b7e 100644
--- a/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/vo/StatationStatVO.java
+++ b/pqs-device/pms-device/pms-device-api/src/main/java/com/njcn/device/pms/pojo/vo/StatationStatVO.java
@@ -1,6 +1,6 @@
package com.njcn.device.pms.pojo.vo;
-import cn.hutool.core.date.DateTime;
+import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -61,6 +61,7 @@ public class StatationStatVO implements Serializable {
public static class Curve{
@ApiModelProperty(name = "time",value = "发生时间")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date time;
@ApiModelProperty(name = "num",value = "数值")
diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/impl/SubstationExpendServiceImpl.java b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/impl/SubstationExpendServiceImpl.java
index 348ce20f7..c6912b711 100644
--- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/impl/SubstationExpendServiceImpl.java
+++ b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/impl/SubstationExpendServiceImpl.java
@@ -257,7 +257,9 @@ public class SubstationExpendServiceImpl extends ServiceImpl info =new ArrayList<>();
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
- influxQueryWrapper.between(InfluxDBTableConstant.TIME,DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())),DateUtil.beginOfDay(DateUtil.parse(param.getEndTime())));
+ influxQueryWrapper.between(InfluxDBTableConstant.TIME,
+ DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString(),
+ DateUtil.beginOfDay(DateUtil.parse(param.getEndTime()))).toString();
if(CollUtil.isNotEmpty(terminalIds)){
influxQueryWrapper.or(PqsCommunicate::getDevId,terminalIds);
}
diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/StatationStatServiceImpl.java b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/StatationStatServiceImpl.java
index 082a073c8..0316580ce 100644
--- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/StatationStatServiceImpl.java
+++ b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/StatationStatServiceImpl.java
@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
-import com.njcn.common.utils.PubUtils;
import com.njcn.device.pms.enums.PmsDeviceResponseEnum;
import com.njcn.device.pms.mapper.majornetwork.*;
import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO;
@@ -23,7 +22,9 @@ import com.njcn.device.pms.service.majornetwork.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.event.pojo.vo.DeptLevelVO;
import com.njcn.event.utils.DeptUtil;
+import com.njcn.influx.pojo.po.DataHarmPowerP;
import com.njcn.influx.pojo.po.DataV;
+import com.njcn.influx.service.DataHarmPowerPService;
import com.njcn.influx.service.IDataVService;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
@@ -40,7 +41,12 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.security.Key;
+import java.time.Instant;
import java.util.*;
+import java.util.concurrent.TimeUnit;
+import java.util.function.BinaryOperator;
+import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -71,6 +77,7 @@ public class StatationStatServiceImpl extends ServiceImpl getStatationStatList(String orgID) {
+ if(StrUtil.isBlank(orgID)){
+ throw new BusinessException(PmsDeviceResponseEnum.NO_ID_ORG);
+ }
List deptInfos = deptFeignClient.getDeptDescendantIndexes(orgID, Stream.of(0, 1).collect(Collectors.toList())).getData();
List orgIDs = deptInfos.stream().map(DeptDTO::getCode).collect(Collectors.toList());
@@ -374,32 +384,21 @@ public class StatationStatServiceImpl extends ServiceImpl list = iMonitorService.list(new LambdaQueryWrapper()
.eq(Monitor::getPowerrId, subID)
- .eq(Monitor::getPowerrId,voltageLevel)
+ .eq(Monitor::getVoltageLevel,voltageLevel)
);
- List dataV = iDataVService.getDataV("ff2d9674c1f1ecce7f33a5bf17fc4f2d",
- DateUtil.beginOfDay(DateUtil.date()).toString()
- , DateUtil.endOfDay(DateUtil.date()).toString());
- if (CollUtil.isNotEmpty(list)) {
- String lineId = list.get(0).getLineId();
+ if (CollUtil.isEmpty(list)) {
+// String lineId = list.get(0).getLineId();
+ addCurves(null,type,curves);
-
- dataV.stream().filter(x->!x.getPhasicType().equals("T")
- &&x.getValueType().equals("CP95")
- ).peek(x->{
- StatationStatVO.Curve curve =new StatationStatVO.Curve();
- curve.setTime(PubUtils.instantToDate(x.getTime()));
- curve.setNum( BigDecimal.valueOf(x.getVThd()).setScale(2, RoundingMode.HALF_UP));
- curves.add(curve);
- }
- );
}else {
- List disMonitorAllList = distributionMonitorMapper.getDisMonitorAllList(subID, type);
+ List disMonitorAllList = distributionMonitorMapper.getDisMonitorAllList(subID, 1);
List disMonitors = disMonitorAllList.stream().filter(x -> x.equals(voltageLevel)).collect(Collectors.toList());
if(CollUtil.isNotEmpty(disMonitors)){
-// curves = pvDataFeignClient.getPVDailyCurve(disMonitors.get(0).getMonitorId(), 0).getData();
-
+ String monitorId = disMonitors.get(0).getMonitorId();
+ addCurves(monitorId,type,curves);
}
}
+ curves.sort(Comparator.comparing(r -> r.getTime()));
return curves;
}
@@ -427,4 +426,42 @@ public class StatationStatServiceImpl extends ServiceImpl addCurves(String LineID,Integer type,List curves){
+ if(type==0){
+ List dataV = iDataVService.getHarmonicDataV(LineID,
+ DateUtil.beginOfDay(DateUtil.date()).toString()
+ , DateUtil.endOfDay(DateUtil.date()).toString());
+ if(CollUtil.isNotEmpty(dataV)){
+ Map collect = dataV.stream().collect(Collectors.toMap(DataV::getTime, DataV::getVThd, (c1, c2) -> c1 > c2 ? c1 : c2));
+ collect.forEach((key,value)->{
+ StatationStatVO.Curve curve =new StatationStatVO.Curve();
+ curve.setTime(Date.from(key));
+ curve.setNum( BigDecimal.valueOf(value).setScale(3, RoundingMode.HALF_UP));
+ curves.add(curve);
+ });
+ }
+ }else{
+ List dataHarmPowerP = dataHarmPowerPService.getHarmonicPowerP(LineID,
+ DateUtil.beginOfDay(DateUtil.date()).toString()
+ , DateUtil.endOfDay(DateUtil.date()).toString());
+ if(CollUtil.isNotEmpty(dataHarmPowerP)){
+ Map dataHarmPowerPMap = dataHarmPowerP.stream().collect(Collectors.toMap(DataHarmPowerP::getTime, DataHarmPowerP::getP, (c1, c2) -> c1 > c2 ? c1 : c2));
+ dataHarmPowerPMap.forEach((key,value)->{
+ StatationStatVO.Curve curve =new StatationStatVO.Curve();
+ curve.setTime(Date.from(key));
+ curve.setNum( BigDecimal.valueOf(value).setScale(3, RoundingMode.HALF_UP));
+ curves.add(curve);
+ });
+ }
+ }
+ return curves;
+ }
}
diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/enums/PvDeviceResponseEnum.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/enums/PvDeviceResponseEnum.java
index e9d966b42..a934951c7 100644
--- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/enums/PvDeviceResponseEnum.java
+++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/enums/PvDeviceResponseEnum.java
@@ -29,6 +29,7 @@ public enum PvDeviceResponseEnum {
SUBSTATION_CODE_REPEAT("A0351","变电站编号重复"),
TRANSFORMER_NAME_REPEAT("A0401","变压器名称重复"),
TFLGPLOY_NAME_REPEAT("A0402","变压器策略名称重复"),
+ THE_NODE_IS_ADDED("A0403","变压器信息节点维护:当前选择节点已绑定,无法再次已绑!"),
diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqsTransformerServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqsTransformerServiceImpl.java
index d13dbc902..d8cc9ec4d 100644
--- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqsTransformerServiceImpl.java
+++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/PqsTransformerServiceImpl.java
@@ -103,7 +103,6 @@ public class PqsTransformerServiceImpl extends ServiceImpl list = this.list(new LambdaQueryWrapper()
.eq(PqsTransformer::getTfName, param.getTfName())
-
);
if (CollectionUtil.isNotEmpty(list)) {
throw new BusinessException(PvDeviceResponseEnum.TRANSFORMER_NAME_REPEAT);
@@ -168,7 +167,20 @@ public class PqsTransformerServiceImpl extends ServiceImpl()
+ .eq(PqsTflgass::getTfIndex, param.getTfIndex())
+ .or(wrapper ->
+ wrapper.eq(PqsTflgass::getLogicBefore, param.getUpNode())
+ .eq(PqsTflgass::getLogicNext, param.getDownNode())
+ )
+ );
+ if(ObjectUtil.isNotNull(tflgass)){
+ throw new BusinessException(PvDeviceResponseEnum.TRANSFORMER_NAME_REPEAT);
+ }else{
+ fly = iPqsTflgassService.save(ass);
+ }
+
+
} else {
one.setLogicBefore(param.getUpNode());
one.setLogicNext(param.getDownNode());
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
index d5f621db6..47006e3c2 100644
--- 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
@@ -49,7 +49,9 @@ public class SubstationExpendServiceImpl implements ISubstationExpendService {
List terminalIds = generalDeviceDTOS.stream().flatMap(dto -> dto.getDeviceIndexes().stream()).collect(Collectors.toList());
List info = new ArrayList<>();
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
- influxQueryWrapper.between(InfluxDBTableConstant.TIME, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())), DateUtil.beginOfDay(DateUtil.parse(param.getSearchEndTime())));
+ influxQueryWrapper.between(InfluxDBTableConstant.TIME,
+ DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString(),
+ DateUtil.beginOfDay(DateUtil.parse(param.getSearchEndTime()))).toString();
if (CollUtil.isNotEmpty(terminalIds)) {
influxQueryWrapper.or(PqsCommunicate::getDevId, terminalIds);
}
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 18f093bc6..dffa80d88 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
@@ -16,8 +16,13 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
+import com.njcn.device.pms.api.PwMonitorClient;
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
+import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
+import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
+import com.njcn.device.pms.pojo.param.PmsMonitorParam;
+import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
import com.njcn.device.pq.api.LineFeignClient;
@@ -52,6 +57,8 @@ import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.enums.StatisticsEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient;
+import com.njcn.user.pojo.dto.DeptDTO;
+import com.njcn.web.utils.WebUtil;
import freemarker.template.TemplateException;
import java.io.*;
@@ -119,6 +126,7 @@ public class ReportServiceImpl implements ReportService {
private final MonitorClient monitorClient;
+ private final PwMonitorClient pwMonitorClient;
private final EventDetailService eventDetailService;
private final EventDetailMapper eventDetailMapper;
@@ -394,31 +402,55 @@ public class ReportServiceImpl implements ReportService {
//pq系统
List deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData();
lineIds = deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList());
- } else if (waveTypeParam.getType() == 1) {
+ }
+ if (waveTypeParam.getType() == 1) {
//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());
- } else {
+ }
+ if (waveTypeParam.getType() == 2) {
PmsDeviceInfoParam param = new PmsDeviceInfoParam();
param.setDeptIndex(waveTypeParam.getDeptIndex());
param.setStatisticalType(waveTypeParam.getStatisticalType());
List data = pmsGeneralDeviceInfoClient.getPwPmsDeviceInfoWithOrgId(param).getData();
lineIds = data.stream().flatMap(list -> list.getMonitorIdList().stream()).collect(Collectors.toList());
}
+ if (waveTypeParam.getType() == 3) {
+ //获取配网监测点
+ PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
+ pwPmsMonitorParam.setOrgId(waveTypeParam.getDeptIndex());
+ List pwPmsMonitorDTOS = pwMonitorClient.getPwSubsetMonitorList(pwPmsMonitorParam).getData();
+ //获取主网监测点
+ List monitorList = this.getMonitorList(waveTypeParam.getDeptIndex());
+ if (CollUtil.isNotEmpty(monitorList)) {
+ lineIds.addAll(monitorList.stream().map(PmsMonitorDTO::getId).collect(Collectors.toList()));
+ }
+ lineIds.addAll(pwPmsMonitorDTOS.stream().map(PwPmsMonitorDTO::getMonitorId).collect(Collectors.toList()));
+ }
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(voltageData.getId()), RmpEventDetailPO::getEventType, voltageData.getId())
- .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())))
- .orderByDesc(RmpEventDetailPO::getStartTime)
- );
+ Page pageInfo=new Page<>();
+ if(waveTypeParam.getType() != 3){
+ pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper()
+ .in(RmpEventDetailPO::getMeasurementPointId, lineIds)
+ .eq(StrUtil.isNotBlank(voltageData.getId()), RmpEventDetailPO::getEventType, voltageData.getId())
+ .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())))
+ .orderByDesc(RmpEventDetailPO::getStartTime)
+ );
+ }else{
+ pageInfo.setRecords(eventDetailService.list( new LambdaQueryWrapper()
+ .in(RmpEventDetailPO::getMeasurementPointId, lineIds)
+ .eq(StrUtil.isNotBlank(voltageData.getId()), RmpEventDetailPO::getEventType, voltageData.getId())
+ .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())))
+ .orderByDesc(RmpEventDetailPO::getStartTime)));
+ }
List info = BeanUtil.copyToList(pageInfo.getRecords(), EventDetailNew.class);
if (CollectionUtil.isNotEmpty(info)) {
ArrayList idlist = new ArrayList<>();
@@ -475,7 +507,20 @@ public class ReportServiceImpl implements ReportService {
return page;
}
-
+ private List getMonitorList(String orgID) {
+ //获取所有子部门信息
+ List deptDTOList = deptFeignClient.getDeptDescendantIndexes(orgID, WebUtil.filterDeptType()).getData();
+ if (CollUtil.isEmpty(deptDTOList)) {
+ throw new BusinessException(CommonResponseEnum.NO_DATA, "部门不存在");
+ }
+ //单位code集合
+ List orgCodeList = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
+ //查询监测点信息
+ PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
+ pmsMonitorParam.setOrgIds(orgCodeList); //单位codes
+ List monitorList = monitorClient.getMonitorInfoListByCond(pmsMonitorParam).getData(); //监测点信息
+ return monitorList;
+ }
/**
* 暂降次数统计
*
diff --git a/pqs-gateway/src/main/resources/bootstrap.yml b/pqs-gateway/src/main/resources/bootstrap.yml
index 3a2befcf0..0ca119d3d 100644
--- a/pqs-gateway/src/main/resources/bootstrap.yml
+++ b/pqs-gateway/src/main/resources/bootstrap.yml
@@ -198,6 +198,7 @@ whitelist:
- /*/v2/api-docs
- /favicon.ico
- /system-boot/theme/getTheme
+ - /cs-system-boot/appinfo/queryAppInfoByType
#- /device-boot/**
#- /system-boot/**
#- /harmonic-boot/**
diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/majornetwork/impl/PVOverviewServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/majornetwork/impl/PVOverviewServiceImpl.java
index bb52381a3..3ff65ad50 100644
--- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/majornetwork/impl/PVOverviewServiceImpl.java
+++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/majornetwork/impl/PVOverviewServiceImpl.java
@@ -15,12 +15,15 @@ import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.dto.PmsStatationStatInfoDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.PmsStatationStatInfoParam;
+import com.njcn.device.pms.pojo.po.StatationStat;
import com.njcn.device.pq.pojo.dto.PollutionLineDTO;
import com.njcn.harmonic.mapper.RStatPollutionSubstationDPOMapper;
import com.njcn.harmonic.mapper.majornetwork.PVOverviewMapper;
import com.njcn.harmonic.pojo.param.PVOverviewParam;
import com.njcn.harmonic.pojo.po.RStatPollutionSubstationDPO;
import com.njcn.harmonic.service.majornetwork.PVOverviewService;
+import com.njcn.user.api.DeptFeignClient;
+import com.njcn.user.pojo.dto.DeptDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -29,6 +32,7 @@ import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
/**
* @author wr
@@ -44,8 +48,11 @@ public class PVOverviewServiceImpl implements PVOverviewService {
private final RStatPollutionSubstationDPOMapper pollutionSubstationDPOMapper;
private final StatationStatClient statationStatClient;
-
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
+ private final DeptFeignClient deptFeignClient;
+
+
+
@Override
public List getPVSynthesisCount(StatisticsBizBaseParam param) {
DeptGetLineParam deptGetLineParam=new DeptGetLineParam();
@@ -64,11 +71,22 @@ public class PVOverviewServiceImpl implements PVOverviewService {
public List getPVPollution(PVOverviewParam param) {
List info=new ArrayList<>();
//查询主网台账信息获取遍变电站信息
- PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
- pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
- pmsDeviceInfoParam.setDeptIndex(param.getId());
- List data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
- List powers= data.stream().flatMap(dto -> dto.getPowerrIdList().stream()).collect(Collectors.toList());
+ List powers;
+ Boolean fly=param.getSum()!=null&¶m.getSum()>0;
+ if(fly){
+ PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
+ pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
+ pmsDeviceInfoParam.setDeptIndex(param.getId());
+ List data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
+ powers= data.stream().flatMap(dto -> dto.getPowerrIdList().stream()).collect(Collectors.toList());
+ }else{
+ List deptInfos = deptFeignClient.getDeptDescendantIndexes(param.getId(), Stream.of(0, 1).collect(Collectors.toList())).getData();
+ List orgIDs = deptInfos.stream().map(DeptDTO::getCode).collect(Collectors.toList());
+ PmsStatationStatInfoParam infoParam = new PmsStatationStatInfoParam();
+ infoParam.setOrgIds(orgIDs);
+ List data = statationStatClient.getPowerInfo(infoParam).getData();
+ powers=data.stream().map(StatationStat::getPowerId).collect(Collectors.toList());
+ }
if(CollUtil.isEmpty(powers)){
return info;
}
@@ -79,7 +97,7 @@ public class PVOverviewServiceImpl implements PVOverviewService {
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatPollutionSubstationDPO::getDataDate,DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
.le(StrUtil.isNotBlank(param.getEndTime()), RStatPollutionSubstationDPO::getDataDate, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
.orderByDesc(RStatPollutionSubstationDPO::getValue)
- .last("limit "+param.getSum()));
+ .last(fly,"limit "+param.getSum()));
if(CollUtil.isNotEmpty(substationDPOS)){
List powerIds = substationDPOS.stream().map(RStatPollutionSubstationDPO::getSubstationId).collect(Collectors.toList());
PmsStatationStatInfoParam statInfoParam=new PmsStatationStatInfoParam();
diff --git a/pqs-influx/src/main/java/com/njcn/influx/imapper/DataHarmPowerPMapper.java b/pqs-influx/src/main/java/com/njcn/influx/imapper/DataHarmPowerPMapper.java
index 3fcafa5ef..c1f8d8009 100644
--- a/pqs-influx/src/main/java/com/njcn/influx/imapper/DataHarmPowerPMapper.java
+++ b/pqs-influx/src/main/java/com/njcn/influx/imapper/DataHarmPowerPMapper.java
@@ -2,6 +2,10 @@ package com.njcn.influx.imapper;
import com.njcn.influx.base.InfluxDbBaseMapper;
import com.njcn.influx.pojo.po.DataHarmPowerP;
+import com.njcn.influx.pojo.po.DataV;
+import com.njcn.influx.query.InfluxQueryWrapper;
+
+import java.util.List;
/**
* @author hongawen
@@ -9,4 +13,6 @@ import com.njcn.influx.pojo.po.DataHarmPowerP;
* @date 2023年05月05日 09:00
*/
public interface DataHarmPowerPMapper extends InfluxDbBaseMapper {
+
+ List getStatisticsByWraper(InfluxQueryWrapper influxQueryWrapper);
}
diff --git a/pqs-influx/src/main/java/com/njcn/influx/service/DataHarmPowerPService.java b/pqs-influx/src/main/java/com/njcn/influx/service/DataHarmPowerPService.java
index ca2ff1108..0285d79ec 100644
--- a/pqs-influx/src/main/java/com/njcn/influx/service/DataHarmPowerPService.java
+++ b/pqs-influx/src/main/java/com/njcn/influx/service/DataHarmPowerPService.java
@@ -1,9 +1,15 @@
package com.njcn.influx.service;
+
+import com.njcn.influx.pojo.po.DataHarmPowerP;
+
+import java.util.List;
+
/**
* @author hongawen
* @version 1.0.0
* @date 2023年05月05日 09:51
*/
public interface DataHarmPowerPService {
+ List getHarmonicPowerP(String lineIndex, String startTime, String endTime);
}
diff --git a/pqs-influx/src/main/java/com/njcn/influx/service/IDataVService.java b/pqs-influx/src/main/java/com/njcn/influx/service/IDataVService.java
index 3ca995781..38dce60a1 100644
--- a/pqs-influx/src/main/java/com/njcn/influx/service/IDataVService.java
+++ b/pqs-influx/src/main/java/com/njcn/influx/service/IDataVService.java
@@ -7,4 +7,5 @@ import java.util.List;
public interface IDataVService {
List getDataV(String lineIndex, String startTime, String endTime);
+ List getHarmonicDataV(String lineIndex, String startTime, String endTime);
}
diff --git a/pqs-influx/src/main/java/com/njcn/influx/service/impl/DataHarmPowerPServiceImpl.java b/pqs-influx/src/main/java/com/njcn/influx/service/impl/DataHarmPowerPServiceImpl.java
index 2976ba512..d0f9b7447 100644
--- a/pqs-influx/src/main/java/com/njcn/influx/service/impl/DataHarmPowerPServiceImpl.java
+++ b/pqs-influx/src/main/java/com/njcn/influx/service/impl/DataHarmPowerPServiceImpl.java
@@ -1,8 +1,14 @@
package com.njcn.influx.service.impl;
+import com.njcn.influx.imapper.DataHarmPowerPMapper;
+import com.njcn.influx.pojo.po.DataHarmPowerP;
+import com.njcn.influx.query.InfluxQueryWrapper;
import com.njcn.influx.service.DataHarmPowerPService;
import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import java.util.List;
+
/**
* @author hongawen
* @version 1.0.0
@@ -10,4 +16,17 @@ import org.springframework.stereotype.Service;
*/
@Service
public class DataHarmPowerPServiceImpl implements DataHarmPowerPService {
+ @Resource
+ private DataHarmPowerPMapper dataHarmPowerPMapper;
+ @Override
+ public List getHarmonicPowerP(String lineIndex, String startTime, String endTime) {
+ List result1 ;
+ InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmPowerP.class);
+ influxQueryWrapper.eq(DataHarmPowerP::getLineId, lineIndex)
+ .eq(DataHarmPowerP::getValueType, "AVG")
+ .eq(DataHarmPowerP::getPhaseType, "T")
+ .between(DataHarmPowerP::getTime, startTime, endTime);
+ result1 = dataHarmPowerPMapper.getStatisticsByWraper(influxQueryWrapper);
+ return result1;
+ }
}
diff --git a/pqs-influx/src/main/java/com/njcn/influx/service/impl/DataVServiceImpl.java b/pqs-influx/src/main/java/com/njcn/influx/service/impl/DataVServiceImpl.java
index 2b43af7fb..e5bb376f9 100644
--- a/pqs-influx/src/main/java/com/njcn/influx/service/impl/DataVServiceImpl.java
+++ b/pqs-influx/src/main/java/com/njcn/influx/service/impl/DataVServiceImpl.java
@@ -48,4 +48,16 @@ public class DataVServiceImpl implements IDataVService {
System.out.println("result1==:" + result1);
return result1;
}
+
+ @Override
+ public List getHarmonicDataV(String lineIndex, String startTime, String endTime) {
+ List result1 ;
+ InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
+ influxQueryWrapper.eq(DataV::getLineId, lineIndex)
+ .eq(DataV::getValueType, "CP95")
+ .ne(DataV::getPhasicType, "T")
+ .between(DataV::getTime, startTime, endTime);;
+ result1 = dataVMapper.getStatisticsByWraper(influxQueryWrapper);
+ return result1;
+ }
}