Merge remote-tracking branch 'origin/master'

This commit is contained in:
2023-08-10 16:19:31 +08:00
16 changed files with 222 additions and 49 deletions

View File

@@ -21,23 +21,32 @@
<dependencies> <dependencies>
<!--pq-device-boot和pms-device-boot只能选择一个--> <!--pq-device-boot和pms-device-boot只能选择一个-->
<!-- <dependency>-->
<!-- <groupId>com.njcn</groupId>-->
<!-- <artifactId>pq-device-boot</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->
<dependency> <dependency>
<groupId>com.njcn</groupId>
<artifactId>pq-device-boot</artifactId>
<version>${project.version}</version>
</dependency>
<!-- <dependency>
<groupId>com.njcn</groupId> <groupId>com.njcn</groupId>
<artifactId>pms-device-boot</artifactId> <artifactId>pms-device-boot</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency>--> </dependency>
<dependency> <dependency>
<groupId>com.njcn</groupId> <groupId>com.njcn</groupId>
<artifactId>common-swagger</artifactId> <artifactId>common-swagger</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>4.9.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@@ -58,6 +58,7 @@ public enum PmsDeviceResponseEnum {
TRANSFORMER_ID_REPEAT("A00356","变压器编号重复"), TRANSFORMER_ID_REPEAT("A00356","变压器编号重复"),
NO_ID_STATION("A00357","变电站编号为空"), NO_ID_STATION("A00357","变电站编号为空"),
NO_ID_ORG("A00357","部门编号为空"),
; ;

View File

@@ -1,6 +1,6 @@
package com.njcn.device.pms.pojo.vo; 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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -61,6 +61,7 @@ public class StatationStatVO implements Serializable {
public static class Curve{ public static class Curve{
@ApiModelProperty(name = "time",value = "发生时间") @ApiModelProperty(name = "time",value = "发生时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date time; private Date time;
@ApiModelProperty(name = "num",value = "数值") @ApiModelProperty(name = "num",value = "数值")

View File

@@ -257,7 +257,9 @@ public class SubstationExpendServiceImpl extends ServiceImpl<SubstationExpendMap
List<CommunicateVO.PVCommunicateVO> info =new ArrayList<>(); List<CommunicateVO.PVCommunicateVO> info =new ArrayList<>();
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class); 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)){ if(CollUtil.isNotEmpty(terminalIds)){
influxQueryWrapper.or(PqsCommunicate::getDevId,terminalIds); influxQueryWrapper.or(PqsCommunicate::getDevId,terminalIds);
} }

View File

@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException; 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.enums.PmsDeviceResponseEnum;
import com.njcn.device.pms.mapper.majornetwork.*; import com.njcn.device.pms.mapper.majornetwork.*;
import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.event.pojo.vo.DeptLevelVO; import com.njcn.event.pojo.vo.DeptLevelVO;
import com.njcn.event.utils.DeptUtil; import com.njcn.event.utils.DeptUtil;
import com.njcn.influx.pojo.po.DataHarmPowerP;
import com.njcn.influx.pojo.po.DataV; import com.njcn.influx.pojo.po.DataV;
import com.njcn.influx.service.DataHarmPowerPService;
import com.njcn.influx.service.IDataVService; import com.njcn.influx.service.IDataVService;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum; import com.njcn.system.enums.DicDataEnum;
@@ -40,7 +41,12 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.security.Key;
import java.time.Instant;
import java.util.*; 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.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -71,6 +77,7 @@ public class StatationStatServiceImpl extends ServiceImpl<StatationStatMapper, S
private final DicDataFeignClient dicDataFeignClient; private final DicDataFeignClient dicDataFeignClient;
private final DistributionMonitorMapper distributionMonitorMapper; private final DistributionMonitorMapper distributionMonitorMapper;
private final IDataVService iDataVService; private final IDataVService iDataVService;
private final DataHarmPowerPService dataHarmPowerPService;
/** /**
@@ -356,6 +363,9 @@ public class StatationStatServiceImpl extends ServiceImpl<StatationStatMapper, S
@Override @Override
public List<StatationStat> getStatationStatList(String orgID) { public List<StatationStat> getStatationStatList(String orgID) {
if(StrUtil.isBlank(orgID)){
throw new BusinessException(PmsDeviceResponseEnum.NO_ID_ORG);
}
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(orgID, Stream.of(0, 1).collect(Collectors.toList())).getData(); List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(orgID, Stream.of(0, 1).collect(Collectors.toList())).getData();
List<String> orgIDs = deptInfos.stream().map(DeptDTO::getCode).collect(Collectors.toList()); List<String> orgIDs = deptInfos.stream().map(DeptDTO::getCode).collect(Collectors.toList());
@@ -374,32 +384,21 @@ public class StatationStatServiceImpl extends ServiceImpl<StatationStatMapper, S
//获取主网信息,没有则获取配网信息 //获取主网信息,没有则获取配网信息
List<Monitor> list = iMonitorService.list(new LambdaQueryWrapper<Monitor>() List<Monitor> list = iMonitorService.list(new LambdaQueryWrapper<Monitor>()
.eq(Monitor::getPowerrId, subID) .eq(Monitor::getPowerrId, subID)
.eq(Monitor::getPowerrId,voltageLevel) .eq(Monitor::getVoltageLevel,voltageLevel)
); );
List<DataV> dataV = iDataVService.getDataV("ff2d9674c1f1ecce7f33a5bf17fc4f2d", if (CollUtil.isEmpty(list)) {
DateUtil.beginOfDay(DateUtil.date()).toString() // String lineId = list.get(0).getLineId();
, DateUtil.endOfDay(DateUtil.date()).toString()); addCurves(null,type,curves);
if (CollUtil.isNotEmpty(list)) {
String lineId = list.get(0).getLineId();
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 { }else {
List<PmsMonitorBaseDTO> disMonitorAllList = distributionMonitorMapper.getDisMonitorAllList(subID, type); List<PmsMonitorBaseDTO> disMonitorAllList = distributionMonitorMapper.getDisMonitorAllList(subID, 1);
List<PmsMonitorBaseDTO> disMonitors = disMonitorAllList.stream().filter(x -> x.equals(voltageLevel)).collect(Collectors.toList()); List<PmsMonitorBaseDTO> disMonitors = disMonitorAllList.stream().filter(x -> x.equals(voltageLevel)).collect(Collectors.toList());
if(CollUtil.isNotEmpty(disMonitors)){ 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; return curves;
} }
@@ -427,4 +426,42 @@ public class StatationStatServiceImpl extends ServiceImpl<StatationStatMapper, S
}); });
return voltageIDs; return voltageIDs;
} }
/**
* 对象添加
* @param LineID 监测点id ff2d9674c1f1ecce7f33a5bf17fc4f2d
* @param type 0=谐波 1=总有功
* @param curves 初始集合
* @return
*/
private List<StatationStatVO.Curve> addCurves(String LineID,Integer type,List<StatationStatVO.Curve> curves){
if(type==0){
List<DataV> dataV = iDataVService.getHarmonicDataV(LineID,
DateUtil.beginOfDay(DateUtil.date()).toString()
, DateUtil.endOfDay(DateUtil.date()).toString());
if(CollUtil.isNotEmpty(dataV)){
Map<Instant, Double> 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> dataHarmPowerP = dataHarmPowerPService.getHarmonicPowerP(LineID,
DateUtil.beginOfDay(DateUtil.date()).toString()
, DateUtil.endOfDay(DateUtil.date()).toString());
if(CollUtil.isNotEmpty(dataHarmPowerP)){
Map<Instant, Double> 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;
}
} }

View File

@@ -29,6 +29,7 @@ public enum PvDeviceResponseEnum {
SUBSTATION_CODE_REPEAT("A0351","变电站编号重复"), SUBSTATION_CODE_REPEAT("A0351","变电站编号重复"),
TRANSFORMER_NAME_REPEAT("A0401","变压器名称重复"), TRANSFORMER_NAME_REPEAT("A0401","变压器名称重复"),
TFLGPLOY_NAME_REPEAT("A0402","变压器策略名称重复"), TFLGPLOY_NAME_REPEAT("A0402","变压器策略名称重复"),
THE_NODE_IS_ADDED("A0403","变压器信息节点维护:当前选择节点已绑定,无法再次已绑!"),

View File

@@ -103,7 +103,6 @@ public class PqsTransformerServiceImpl extends ServiceImpl<PqsTransformerMapper,
public Boolean insertTransformer(PqsTransformerParam.TransformerAddParam param) { public Boolean insertTransformer(PqsTransformerParam.TransformerAddParam param) {
List<PqsTransformer> list = this.list(new LambdaQueryWrapper<PqsTransformer>() List<PqsTransformer> list = this.list(new LambdaQueryWrapper<PqsTransformer>()
.eq(PqsTransformer::getTfName, param.getTfName()) .eq(PqsTransformer::getTfName, param.getTfName())
); );
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
throw new BusinessException(PvDeviceResponseEnum.TRANSFORMER_NAME_REPEAT); throw new BusinessException(PvDeviceResponseEnum.TRANSFORMER_NAME_REPEAT);
@@ -168,7 +167,20 @@ public class PqsTransformerServiceImpl extends ServiceImpl<PqsTransformerMapper,
ass.setTfIndex(param.getTfIndex()); ass.setTfIndex(param.getTfIndex());
ass.setLogicBefore(param.getUpNode()); ass.setLogicBefore(param.getUpNode());
ass.setLogicNext(param.getDownNode()); ass.setLogicNext(param.getDownNode());
PqsTflgass tflgass = iPqsTflgassService.getOne(new LambdaQueryWrapper<PqsTflgass>()
.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); fly = iPqsTflgassService.save(ass);
}
} else { } else {
one.setLogicBefore(param.getUpNode()); one.setLogicBefore(param.getUpNode());
one.setLogicNext(param.getDownNode()); one.setLogicNext(param.getDownNode());

View File

@@ -49,7 +49,9 @@ public class SubstationExpendServiceImpl implements ISubstationExpendService {
List<String> terminalIds = generalDeviceDTOS.stream().flatMap(dto -> dto.getDeviceIndexes().stream()).collect(Collectors.toList()); List<String> terminalIds = generalDeviceDTOS.stream().flatMap(dto -> dto.getDeviceIndexes().stream()).collect(Collectors.toList());
List<CommunicateVO.PVCommunicateVO> info = new ArrayList<>(); List<CommunicateVO.PVCommunicateVO> info = new ArrayList<>();
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class); 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)) { if (CollUtil.isNotEmpty(terminalIds)) {
influxQueryWrapper.or(PqsCommunicate::getDevId, terminalIds); influxQueryWrapper.or(PqsCommunicate::getDevId, terminalIds);
} }

View File

@@ -16,8 +16,13 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.biz.enums.DeviceResponseEnum; import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.pms.api.MonitorClient; import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient; 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.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.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.pms.pojo.po.Monitor;
import com.njcn.device.pq.api.GeneralDeviceInfoClient; import com.njcn.device.pq.api.GeneralDeviceInfoClient;
import com.njcn.device.pq.api.LineFeignClient; 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.enums.StatisticsEnum;
import com.njcn.system.pojo.po.DictData; import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient; import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import com.njcn.web.utils.WebUtil;
import freemarker.template.TemplateException; import freemarker.template.TemplateException;
import java.io.*; import java.io.*;
@@ -119,6 +126,7 @@ public class ReportServiceImpl implements ReportService {
private final MonitorClient monitorClient; private final MonitorClient monitorClient;
private final PwMonitorClient pwMonitorClient;
private final EventDetailService eventDetailService; private final EventDetailService eventDetailService;
private final EventDetailMapper eventDetailMapper; private final EventDetailMapper eventDetailMapper;
@@ -394,31 +402,55 @@ public class ReportServiceImpl implements ReportService {
//pq系统 //pq系统
List<GeneralDeviceDTO> deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData(); List<GeneralDeviceDTO> deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData();
lineIds = deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList()); lineIds = deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList());
} else if (waveTypeParam.getType() == 1) { }
if (waveTypeParam.getType() == 1) {
//pms系统 //pms系统
PmsDeviceInfoParam param = new PmsDeviceInfoParam(); PmsDeviceInfoParam param = new PmsDeviceInfoParam();
param.setDeptIndex(waveTypeParam.getDeptIndex()); param.setDeptIndex(waveTypeParam.getDeptIndex());
param.setStatisticalType(waveTypeParam.getStatisticalType()); param.setStatisticalType(waveTypeParam.getStatisticalType());
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(param).getData(); List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(param).getData();
lineIds = data.stream().flatMap(list -> list.getMonitorIdList().stream()).collect(Collectors.toList()); lineIds = data.stream().flatMap(list -> list.getMonitorIdList().stream()).collect(Collectors.toList());
} else { }
if (waveTypeParam.getType() == 2) {
PmsDeviceInfoParam param = new PmsDeviceInfoParam(); PmsDeviceInfoParam param = new PmsDeviceInfoParam();
param.setDeptIndex(waveTypeParam.getDeptIndex()); param.setDeptIndex(waveTypeParam.getDeptIndex());
param.setStatisticalType(waveTypeParam.getStatisticalType()); param.setStatisticalType(waveTypeParam.getStatisticalType());
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPwPmsDeviceInfoWithOrgId(param).getData(); List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPwPmsDeviceInfoWithOrgId(param).getData();
lineIds = data.stream().flatMap(list -> list.getMonitorIdList().stream()).collect(Collectors.toList()); lineIds = data.stream().flatMap(list -> list.getMonitorIdList().stream()).collect(Collectors.toList());
} }
if (waveTypeParam.getType() == 3) {
//获取配网监测点
PwPmsMonitorParam pwPmsMonitorParam = new PwPmsMonitorParam();
pwPmsMonitorParam.setOrgId(waveTypeParam.getDeptIndex());
List<PwPmsMonitorDTO> pwPmsMonitorDTOS = pwMonitorClient.getPwSubsetMonitorList(pwPmsMonitorParam).getData();
//获取主网监测点
List<PmsMonitorDTO> 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)) { if (CollectionUtil.isEmpty(lineIds)) {
throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY); throw new BusinessException(DeviceResponseEnum.DEPT_LINE_EMPTY);
} }
Page<RmpEventDetailPO> pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper<RmpEventDetailPO>() Page<RmpEventDetailPO> pageInfo=new Page<>();
if(waveTypeParam.getType() != 3){
pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper<RmpEventDetailPO>()
.in(RmpEventDetailPO::getMeasurementPointId, lineIds) .in(RmpEventDetailPO::getMeasurementPointId, lineIds)
.eq(StrUtil.isNotBlank(voltageData.getId()), RmpEventDetailPO::getEventType, voltageData.getId()) .eq(StrUtil.isNotBlank(voltageData.getId()), RmpEventDetailPO::getEventType, voltageData.getId())
.ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime()))) .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()))) .le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime())))
.orderByDesc(RmpEventDetailPO::getStartTime) .orderByDesc(RmpEventDetailPO::getStartTime)
); );
}else{
pageInfo.setRecords(eventDetailService.list( new LambdaQueryWrapper<RmpEventDetailPO>()
.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<EventDetailNew> info = BeanUtil.copyToList(pageInfo.getRecords(), EventDetailNew.class); List<EventDetailNew> info = BeanUtil.copyToList(pageInfo.getRecords(), EventDetailNew.class);
if (CollectionUtil.isNotEmpty(info)) { if (CollectionUtil.isNotEmpty(info)) {
ArrayList<String> idlist = new ArrayList<>(); ArrayList<String> idlist = new ArrayList<>();
@@ -475,7 +507,20 @@ public class ReportServiceImpl implements ReportService {
return page; return page;
} }
private List<PmsMonitorDTO> getMonitorList(String orgID) {
//获取所有子部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(orgID, WebUtil.filterDeptType()).getData();
if (CollUtil.isEmpty(deptDTOList)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "部门不存在");
}
//单位code集合
List<String> orgCodeList = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
//查询监测点信息
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
pmsMonitorParam.setOrgIds(orgCodeList); //单位codes
List<PmsMonitorDTO> monitorList = monitorClient.getMonitorInfoListByCond(pmsMonitorParam).getData(); //监测点信息
return monitorList;
}
/** /**
* 暂降次数统计 * 暂降次数统计
* *

View File

@@ -198,6 +198,7 @@ whitelist:
- /*/v2/api-docs - /*/v2/api-docs
- /favicon.ico - /favicon.ico
- /system-boot/theme/getTheme - /system-boot/theme/getTheme
- /cs-system-boot/appinfo/queryAppInfoByType
#- /device-boot/** #- /device-boot/**
#- /system-boot/** #- /system-boot/**
#- /harmonic-boot/** #- /harmonic-boot/**

View File

@@ -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.dto.PmsStatationStatInfoDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam; import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.PmsStatationStatInfoParam; 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.device.pq.pojo.dto.PollutionLineDTO;
import com.njcn.harmonic.mapper.RStatPollutionSubstationDPOMapper; import com.njcn.harmonic.mapper.RStatPollutionSubstationDPOMapper;
import com.njcn.harmonic.mapper.majornetwork.PVOverviewMapper; import com.njcn.harmonic.mapper.majornetwork.PVOverviewMapper;
import com.njcn.harmonic.pojo.param.PVOverviewParam; import com.njcn.harmonic.pojo.param.PVOverviewParam;
import com.njcn.harmonic.pojo.po.RStatPollutionSubstationDPO; import com.njcn.harmonic.pojo.po.RStatPollutionSubstationDPO;
import com.njcn.harmonic.service.majornetwork.PVOverviewService; import com.njcn.harmonic.service.majornetwork.PVOverviewService;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -29,6 +32,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* @author wr * @author wr
@@ -44,8 +48,11 @@ public class PVOverviewServiceImpl implements PVOverviewService {
private final RStatPollutionSubstationDPOMapper pollutionSubstationDPOMapper; private final RStatPollutionSubstationDPOMapper pollutionSubstationDPOMapper;
private final StatationStatClient statationStatClient; private final StatationStatClient statationStatClient;
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient; private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
private final DeptFeignClient deptFeignClient;
@Override @Override
public List<Integer> getPVSynthesisCount(StatisticsBizBaseParam param) { public List<Integer> getPVSynthesisCount(StatisticsBizBaseParam param) {
DeptGetLineParam deptGetLineParam=new DeptGetLineParam(); DeptGetLineParam deptGetLineParam=new DeptGetLineParam();
@@ -64,11 +71,22 @@ public class PVOverviewServiceImpl implements PVOverviewService {
public List<PollutionLineDTO.PVPollution> getPVPollution(PVOverviewParam param) { public List<PollutionLineDTO.PVPollution> getPVPollution(PVOverviewParam param) {
List<PollutionLineDTO.PVPollution> info=new ArrayList<>(); List<PollutionLineDTO.PVPollution> info=new ArrayList<>();
//查询主网台账信息获取遍变电站信息 //查询主网台账信息获取遍变电站信息
List<String> powers;
Boolean fly=param.getSum()!=null&&param.getSum()>0;
if(fly){
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam(); PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
pmsDeviceInfoParam.setStatisticalType(new SimpleDTO()); pmsDeviceInfoParam.setStatisticalType(new SimpleDTO());
pmsDeviceInfoParam.setDeptIndex(param.getId()); pmsDeviceInfoParam.setDeptIndex(param.getId());
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData(); List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
List<String> powers= data.stream().flatMap(dto -> dto.getPowerrIdList().stream()).collect(Collectors.toList()); powers= data.stream().flatMap(dto -> dto.getPowerrIdList().stream()).collect(Collectors.toList());
}else{
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(param.getId(), Stream.of(0, 1).collect(Collectors.toList())).getData();
List<String> orgIDs = deptInfos.stream().map(DeptDTO::getCode).collect(Collectors.toList());
PmsStatationStatInfoParam infoParam = new PmsStatationStatInfoParam();
infoParam.setOrgIds(orgIDs);
List<StatationStat> data = statationStatClient.getPowerInfo(infoParam).getData();
powers=data.stream().map(StatationStat::getPowerId).collect(Collectors.toList());
}
if(CollUtil.isEmpty(powers)){ if(CollUtil.isEmpty(powers)){
return info; return info;
} }
@@ -79,7 +97,7 @@ public class PVOverviewServiceImpl implements PVOverviewService {
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatPollutionSubstationDPO::getDataDate,DateUtil.beginOfDay(DateUtil.parse(param.getStartTime()))) .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()))) .le(StrUtil.isNotBlank(param.getEndTime()), RStatPollutionSubstationDPO::getDataDate, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
.orderByDesc(RStatPollutionSubstationDPO::getValue) .orderByDesc(RStatPollutionSubstationDPO::getValue)
.last("limit "+param.getSum())); .last(fly,"limit "+param.getSum()));
if(CollUtil.isNotEmpty(substationDPOS)){ if(CollUtil.isNotEmpty(substationDPOS)){
List<String> powerIds = substationDPOS.stream().map(RStatPollutionSubstationDPO::getSubstationId).collect(Collectors.toList()); List<String> powerIds = substationDPOS.stream().map(RStatPollutionSubstationDPO::getSubstationId).collect(Collectors.toList());
PmsStatationStatInfoParam statInfoParam=new PmsStatationStatInfoParam(); PmsStatationStatInfoParam statInfoParam=new PmsStatationStatInfoParam();

View File

@@ -2,6 +2,10 @@ package com.njcn.influx.imapper;
import com.njcn.influx.base.InfluxDbBaseMapper; import com.njcn.influx.base.InfluxDbBaseMapper;
import com.njcn.influx.pojo.po.DataHarmPowerP; 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 * @author hongawen
@@ -9,4 +13,6 @@ import com.njcn.influx.pojo.po.DataHarmPowerP;
* @date 2023年05月05日 09:00 * @date 2023年05月05日 09:00
*/ */
public interface DataHarmPowerPMapper extends InfluxDbBaseMapper<DataHarmPowerP> { public interface DataHarmPowerPMapper extends InfluxDbBaseMapper<DataHarmPowerP> {
List<DataHarmPowerP> getStatisticsByWraper(InfluxQueryWrapper influxQueryWrapper);
} }

View File

@@ -1,9 +1,15 @@
package com.njcn.influx.service; package com.njcn.influx.service;
import com.njcn.influx.pojo.po.DataHarmPowerP;
import java.util.List;
/** /**
* @author hongawen * @author hongawen
* @version 1.0.0 * @version 1.0.0
* @date 2023年05月05日 09:51 * @date 2023年05月05日 09:51
*/ */
public interface DataHarmPowerPService { public interface DataHarmPowerPService {
List<DataHarmPowerP> getHarmonicPowerP(String lineIndex, String startTime, String endTime);
} }

View File

@@ -7,4 +7,5 @@ import java.util.List;
public interface IDataVService { public interface IDataVService {
List<DataV> getDataV(String lineIndex, String startTime, String endTime); List<DataV> getDataV(String lineIndex, String startTime, String endTime);
List<DataV> getHarmonicDataV(String lineIndex, String startTime, String endTime);
} }

View File

@@ -1,8 +1,14 @@
package com.njcn.influx.service.impl; 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 com.njcn.influx.service.DataHarmPowerPService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/** /**
* @author hongawen * @author hongawen
* @version 1.0.0 * @version 1.0.0
@@ -10,4 +16,17 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class DataHarmPowerPServiceImpl implements DataHarmPowerPService { public class DataHarmPowerPServiceImpl implements DataHarmPowerPService {
@Resource
private DataHarmPowerPMapper dataHarmPowerPMapper;
@Override
public List<DataHarmPowerP> getHarmonicPowerP(String lineIndex, String startTime, String endTime) {
List<DataHarmPowerP> 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;
}
} }

View File

@@ -48,4 +48,16 @@ public class DataVServiceImpl implements IDataVService {
System.out.println("result1==:" + result1); System.out.println("result1==:" + result1);
return result1; return result1;
} }
@Override
public List<DataV> getHarmonicDataV(String lineIndex, String startTime, String endTime) {
List<DataV> 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;
}
} }