bug调整

This commit is contained in:
xy
2025-07-31 09:41:10 +08:00
parent 0bfea394b8
commit e336bc14b7
12 changed files with 97 additions and 49 deletions

View File

@@ -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<RmpEventDetailPO> info = eventDetailService.list(new QueryWrapper<RmpEventDetailPO>()
.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<String, RmpEventDetailPO> map = info.stream().collect(Collectors.toMap(RmpEventDetailPO::getMeasurementPointId, Function.identity()));
List<String> lineIds = info.stream().map(RmpEventDetailPO::getMeasurementPointId).distinct().collect(Collectors.toList());
List<AreaLineInfoVO> areaAnalysisVOList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
for (AreaLineInfoVO areaLineInfoVO : areaAnalysisVOList) {
List<AreaLineInfoVO> 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);
}

View File

@@ -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<EventDetailMapper, RmpEv
private final CommTerminalGeneralClient commTerminalGeneralClient;
private final LineFeignClient lineFeignClient;
private final DeptLineFeignClient deptLineFeignClient;
private final DeptFeignClient deptFeignClient;
@Override
@@ -195,14 +198,10 @@ public class EventDetailServiceImpl extends ServiceImpl<EventDetailMapper, RmpEv
deptLineList.forEach(item->{
String deptLineId = item.getId();
dept.add(deptLineId);
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
deptGetLineParam.setDeptId(deptLineId);
List<DeptGetBase> 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);

View File

@@ -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<TransientVO> getTransientData(TransientParam transientParam) {
@@ -467,16 +472,18 @@ public class TransientServiceImpl implements TransientService {
public void copyTempData(List<String> eventIds) {
List<RmpEventDetailPO> rmpEventDetailPOList = eventDetailService.listByIds(eventIds);
List<RmpEventDetailPO> 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();