From e336bc14b781dfebfbff1a2bc836dd7d42712268 Mon Sep 17 00:00:00 2001
From: xy <748613696@qq.com>
Date: Thu, 31 Jul 2025 09:41:10 +0800
Subject: [PATCH] =?UTF-8?q?bug=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../njcn/oss/constant/GeneralConstant.java | 4 +
.../device/biz/pojo/dto/PollutionLineDTO.java | 3 +
.../device/pq/mapper/mapping/LineMapper.xml | 1 +
.../mapping/TerminalOnlineRateDataMapper.xml | 1 +
.../Impl/AreaLineServiceImpl.java | 22 +++---
.../Impl/EventDetailServiceImpl.java | 15 ++--
.../Impl/TransientServiceImpl.java | 75 +++++++++++++------
.../njcn/harmonic/pojo/vo/THDistortionVO.java | 4 +
.../mapper/mapping/THDistortionMapper.xml | 4 +-
.../mapper/mapping/TerminalDataMapper.xml | 1 +
.../service/impl/ComAssessServiceImpl.java | 13 ++--
.../service/impl/TerminalServiceImpl.java | 3 +-
12 files changed, 97 insertions(+), 49 deletions(-)
diff --git a/pqs-common/common-oss/src/main/java/com/njcn/oss/constant/GeneralConstant.java b/pqs-common/common-oss/src/main/java/com/njcn/oss/constant/GeneralConstant.java
index 3f9dc5458..a4b58c7c8 100644
--- a/pqs-common/common-oss/src/main/java/com/njcn/oss/constant/GeneralConstant.java
+++ b/pqs-common/common-oss/src/main/java/com/njcn/oss/constant/GeneralConstant.java
@@ -21,4 +21,8 @@ public interface GeneralConstant {
String DAT =".DAT";
String HDR =".HDR";
+ String CFG_LOWER =".cfg";
+ String DAT_LOWER =".dat";
+ String HDR_LOWER =".hdr";
+
}
diff --git a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/PollutionLineDTO.java b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/PollutionLineDTO.java
index 9ccfb34f7..e883430e8 100644
--- a/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/PollutionLineDTO.java
+++ b/pqs-device/common-device-biz/src/main/java/com/njcn/device/biz/pojo/dto/PollutionLineDTO.java
@@ -40,6 +40,9 @@ public class PollutionLineDTO {
@ApiModelProperty("变电站id")
private String substationId;
+ @ApiModelProperty("变电站排序")
+ private Integer substationSort;
+
@ApiModelProperty("母线")
private String busBar;
diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineMapper.xml b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineMapper.xml
index 7afe48f89..6744e8099 100644
--- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineMapper.xml
+++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineMapper.xml
@@ -676,6 +676,7 @@
A1.Name busBar,
A3.Name substation,
A3.Id substationId,
+ A3.sort substationSort,
A4.Name powerCompany
FROM
pq_line A,
diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/TerminalOnlineRateDataMapper.xml b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/TerminalOnlineRateDataMapper.xml
index bba7aa63d..c2d536b90 100644
--- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/TerminalOnlineRateDataMapper.xml
+++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/TerminalOnlineRateDataMapper.xml
@@ -124,6 +124,7 @@
#{item}
+ order by sub.Sort asc
diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaLineServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaLineServiceImpl.java
index 6e1a40971..dfaf08c84 100644
--- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaLineServiceImpl.java
+++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/AreaLineServiceImpl.java
@@ -5,7 +5,6 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.njcn.common.pojo.enums.common.ServerEnum;
import com.njcn.common.pojo.exception.BusinessException;
@@ -15,7 +14,6 @@ import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
-import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
import com.njcn.device.pq.pojo.vo.SubstationDetailVO;
import com.njcn.event.mapper.majornetwork.PqDeviceMapper;
import com.njcn.event.mapper.majornetwork.RStatOnlinerateDMapper;
@@ -50,7 +48,8 @@ import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.Collectors;
-import static com.njcn.event.influxdb.QueryBuilder.*;
+import static com.njcn.event.influxdb.QueryBuilder.beginOfDay;
+import static com.njcn.event.influxdb.QueryBuilder.endOfDay;
/**
* @author denghuajun
@@ -141,8 +140,8 @@ public class AreaLineServiceImpl implements AreaLineService {
GeneralDeviceDTO generalDeviceDTO = generalDeviceDTOList.get(i);
lineIndexs = generalDeviceDTO.getLineIndexes();
// 获取暂降数据
- if (lineIndexs.size() > 0) {
- Integer tail = 0;
+ if (!lineIndexs.isEmpty()) {
+ int tail = 0;
//数据暂降查询
List info = eventDetailService.list(new QueryWrapper()
.select("measurement_point_id as measurementPointId,count(file_flag) as fileFlag")
@@ -153,17 +152,18 @@ public class AreaLineServiceImpl implements AreaLineService {
.groupBy("measurement_point_id")
);
- if (info.size() > 0) {
+ if (!info.isEmpty()) {
+ Map map = info.stream().collect(Collectors.toMap(RmpEventDetailPO::getMeasurementPointId, Function.identity()));
List lineIds = info.stream().map(RmpEventDetailPO::getMeasurementPointId).distinct().collect(Collectors.toList());
List areaAnalysisVOList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
for (AreaLineInfoVO areaLineInfoVO : areaAnalysisVOList) {
List ev = new ArrayList<>();
- Integer count = info.stream()
- .filter(obj -> obj.getMeasurementPointId().equals( areaLineInfoVO.getLineId()))
- .collect(Collectors.toList()).size();
- tail+=count;
- areaLineInfoVO.setTail(count);
+ RmpEventDetailPO po = map.get(areaLineInfoVO.getLineId());
+ if (po != null) {
+ tail = tail + po.getFileFlag();
+ areaLineInfoVO.setTail(po.getFileFlag());
+ }
ev.add(areaLineInfoVO);
eventHeatMapDetailList.add(ev);
}
diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDetailServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDetailServiceImpl.java
index e9b8e0109..2df5cdff1 100644
--- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDetailServiceImpl.java
+++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/EventDetailServiceImpl.java
@@ -30,6 +30,8 @@ import com.njcn.influx.utils.InfluxDbUtils;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataEnum;
import com.njcn.system.pojo.po.DictData;
+import com.njcn.user.api.DeptFeignClient;
+import com.njcn.user.pojo.po.Dept;
import com.njcn.web.utils.RequestUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -61,6 +63,7 @@ public class EventDetailServiceImpl extends ServiceImpl{
String deptLineId = item.getId();
dept.add(deptLineId);
- DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
- deptGetLineParam.setDeptId(deptLineId);
- List deptList = commTerminalGeneralClient.getDeptChildrenByParent(deptGetLineParam).getData();
- if (CollectionUtil.isNotEmpty(deptList)) {
- deptList.forEach(item2->{
- dept.addAll(item2.getUnitChildrenList());
- });
- }
+ //获取上级部门
+ Dept deptInfo = deptFeignClient.getDeptById(deptLineId).getData();
+ String[] idsArray = deptInfo.getPids().split(",");
+ dept.addAll(Arrays.asList(idsArray));
});
SendEventVO vo = new SendEventVO();
vo.setDeptList(dept);
diff --git a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/TransientServiceImpl.java b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/TransientServiceImpl.java
index e114391df..a78c9aec0 100644
--- a/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/TransientServiceImpl.java
+++ b/pqs-event/event-boot/src/main/java/com/njcn/event/service/majornetwork/Impl/TransientServiceImpl.java
@@ -14,30 +14,31 @@ import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.pojo.param.MonitorTerminalParam;
import com.njcn.device.pms.pojo.vo.MonitorVO;
import com.njcn.device.pq.api.DeviceTreeClient;
-import com.njcn.device.pq.pojo.vo.TerminalTree;
-import com.njcn.event.file.pojo.dto.WaveDataDTO;
-import com.njcn.event.file.component.WaveFileComponent;
-import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
-import com.njcn.event.mapper.distribution.PwRmpEventDetailMapper;
-import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
-import com.njcn.event.pojo.param.EventVerifyReasonParam;
-import com.njcn.event.pojo.po.RmpEventDetailPO;
-import com.njcn.oss.constant.GeneralConstant;
-import com.njcn.oss.constant.OssPath;
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
+import com.njcn.device.pq.pojo.vo.TerminalTree;
import com.njcn.event.enums.EventResponseEnum;
+import com.njcn.event.file.component.WaveFileComponent;
+import com.njcn.event.file.pojo.dto.WaveDataDTO;
+import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
+import com.njcn.event.mapper.distribution.PwRmpEventDetailMapper;
+import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
import com.njcn.event.mapper.majornetwork.TransientMapper;
+import com.njcn.event.pojo.param.EventVerifyReasonParam;
import com.njcn.event.pojo.param.TransientParam;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.po.EventDetailNew;
+import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.event.pojo.vo.TransientVO;
import com.njcn.event.service.majornetwork.EventDetailService;
import com.njcn.event.service.majornetwork.TransientService;
-
+import com.njcn.minioss.config.MinIossProperties;
+import com.njcn.minioss.util.MinIoUtils;
+import com.njcn.oss.constant.GeneralConstant;
+import com.njcn.oss.constant.OssPath;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
@@ -96,6 +97,10 @@ public class TransientServiceImpl implements TransientService {
private final DeviceTreeClient deviceTreeClient;
+ private final MinIoUtils minIoUtils;
+
+ private final MinIossProperties minIossProperties;
+
@Override
public Page getTransientData(TransientParam transientParam) {
@@ -467,16 +472,18 @@ public class TransientServiceImpl implements TransientService {
public void copyTempData(List eventIds) {
List rmpEventDetailPOList = eventDetailService.listByIds(eventIds);
List nullWave = rmpEventDetailPOList.stream().filter(item -> Objects.isNull(item.getWavePath())).collect(Collectors.toList());
- if (nullWave.size() != 0) {
+ if (!nullWave.isEmpty()) {
throw new BusinessException("请选择存在波形的事件导出!");
}
if (CollUtil.isNotEmpty(rmpEventDetailPOList)) {
- for (int i = 0; i < rmpEventDetailPOList.size(); i++) {
+ String cfg = GeneralConstant.CFG;
+ String dat = GeneralConstant.DAT;
+ for (RmpEventDetailPO po : rmpEventDetailPOList) {
//根据监测点id获取监测点详情
- LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(rmpEventDetailPOList.get(i).getMeasurementPointId()).getData();
+ LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(po.getMeasurementPointId()).getData();
if (Objects.nonNull(lineDetailData)) {
String ip = lineDetailData.getIp();
- String waveName = rmpEventDetailPOList.get(i).getWavePath();
+ String waveName = po.getWavePath();
if (StrUtil.isBlank(ip) && StrUtil.isBlank(waveName)) {
throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND);
}
@@ -488,23 +495,45 @@ public class TransientServiceImpl implements TransientService {
try {
if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) {
cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG;
+ //判断文件是否存在
+ boolean result1 = minIoUtils.checkFileIsExist(minIossProperties.getBucket(), cfgPath);
+ if (!result1) {
+ cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG_LOWER;
+ cfg = GeneralConstant.CFG_LOWER;
+ }
+
datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT;
+ boolean result2 = minIoUtils.checkFileIsExist(minIossProperties.getBucket(), datPath);
+ if (!result2) {
+ datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT_LOWER;
+ dat = GeneralConstant.DAT_LOWER;
+ }
+
cfgStream = waveFileComponent.getFileInputStreamByFilePath(cfgPath);
datStream = waveFileComponent.getFileInputStreamByFilePath(datPath);
- if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
- throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
- }
} else {
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
+ boolean result1 = minIoUtils.checkFileIsExist(minIossProperties.getBucket(), cfgPath);
+ if (!result1) {
+ cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG_LOWER;
+ cfg = GeneralConstant.CFG_LOWER;
+ }
+
datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT;
+ boolean result2 = minIoUtils.checkFileIsExist(minIossProperties.getBucket(), datPath);
+ if (!result2) {
+ datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT_LOWER;
+ dat = GeneralConstant.DAT_LOWER;
+ }
+
System.out.println("波形路径-------------------" + cfgPath);
cfgStream = fileStorageUtil.getFileStream(cfgPath);
datStream = fileStorageUtil.getFileStream(datPath);
- if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
- throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
- }
+ }
+ if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
+ throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
}
String fileMu = generalInfo.getBusinessTempPath() + File.separator + "comtrade" + File.separator + ip;
@@ -512,8 +541,8 @@ public class TransientServiceImpl implements TransientService {
if (!mulu.exists()) {
mulu.mkdirs();
}
- File fileCfg = new File(fileMu + File.separator + waveName + GeneralConstant.CFG);
- File fileDat = new File(fileMu + File.separator + waveName + GeneralConstant.DAT);
+ File fileCfg = new File(fileMu + File.separator + waveName + cfg);
+ File fileDat = new File(fileMu + File.separator + waveName + dat);
fileCfg.createNewFile();
fileDat.createNewFile();
diff --git a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/vo/THDistortionVO.java b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/vo/THDistortionVO.java
index 7f4e93132..f0d7324fc 100644
--- a/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/vo/THDistortionVO.java
+++ b/pqs-harmonic/harmonic-api/src/main/java/com/njcn/harmonic/pojo/vo/THDistortionVO.java
@@ -62,6 +62,10 @@ public class THDistortionVO implements Serializable {
*/
@ApiModelProperty("总畸变率")
private Double distortion = 3.14159;
+
+ @ApiModelProperty("排序")
+ private Integer sort;
+
/**
* 子集
*/
diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/mapping/THDistortionMapper.xml b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/mapping/THDistortionMapper.xml
index 7c164e30e..7bb81fc05 100644
--- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/mapping/THDistortionMapper.xml
+++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/mapping/THDistortionMapper.xml
@@ -37,7 +37,8 @@
Id,
Pid,
Pids,
- Name
+ Name,
+ Sort
FROM
pq_line
WHERE
@@ -45,6 +46,7 @@
#{item}
+ order by Sort asc
diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/mapping/TerminalDataMapper.xml b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/mapping/TerminalDataMapper.xml
index 42743f34f..9f3539e4f 100644
--- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/mapping/TerminalDataMapper.xml
+++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/mapper/mapping/TerminalDataMapper.xml
@@ -35,6 +35,7 @@
#{item}
+ order by sort asc
diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/ComAssessServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/ComAssessServiceImpl.java
index 9046a6f38..d985d45e1 100644
--- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/ComAssessServiceImpl.java
+++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/ComAssessServiceImpl.java
@@ -40,10 +40,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -126,7 +123,13 @@ public class ComAssessServiceImpl extends ServiceImpl> map = lineInfo.stream().collect(Collectors.groupingBy(PollutionLineDTO::getSubstationId));
+ Map> map = lineInfo.stream()
+ .sorted(Comparator.comparing(PollutionLineDTO::getSubstationSort))
+ .collect(Collectors.groupingBy(
+ PollutionLineDTO::getSubstationId,
+ LinkedHashMap::new,
+ Collectors.toList()
+ ));
List childrenDTOS = new ArrayList<>();
map.forEach((sub,list) -> {
//获取变电站信息
diff --git a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/TerminalServiceImpl.java b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/TerminalServiceImpl.java
index 0725ed65f..3ba448839 100644
--- a/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/TerminalServiceImpl.java
+++ b/pqs-harmonic/harmonic-boot/src/main/java/com/njcn/harmonic/service/impl/TerminalServiceImpl.java
@@ -76,7 +76,8 @@ public class TerminalServiceImpl implements TerminalService {
public TerminalCensusVO getTerminalDataCensus(DeviceInfoParam.BusinessParam terminalCensusParam) {
TerminalCensusVO terminalCensusVO = new TerminalCensusVO();
terminalCensusParam.setServerName(generalInfo.getMicroServiceName());
- List generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(terminalCensusParam).getData();
+// List generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(terminalCensusParam).getData();
+ List generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(new DeviceInfoParam(terminalCensusParam.getStatisticalType(), terminalCensusParam.getDeptIndex(), generalInfo.getMicroServiceName(), null, terminalCensusParam.getManufacturer(), null)).getData();
List type = new ArrayList<>();
List single = new ArrayList<>();
List runFlag = new ArrayList<>(),reaFlag = new ArrayList<>(),stopFlag = new ArrayList<>();