|
|
|
|
@@ -2,6 +2,7 @@ package com.njcn.event.service.Impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.njcn.common.config.GeneralInfo;
|
|
|
|
|
@@ -179,7 +180,7 @@ public class TransientServiceImpl implements TransientService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WaveDataDTO getTransientAnalyseWave(String timeId, String lineId) {
|
|
|
|
|
WaveDataDTO waveDataDTO = new WaveDataDTO();
|
|
|
|
|
WaveDataDTO waveDataDTO;
|
|
|
|
|
//根据监测点id获取监测点详情
|
|
|
|
|
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(lineId).getData();
|
|
|
|
|
EventDetail eventDetailByTime = eventDetailService.getEventDetailByTime(lineId, timeId);
|
|
|
|
|
@@ -199,7 +200,6 @@ public class TransientServiceImpl implements TransientService {
|
|
|
|
|
if (Objects.isNull(comtrade.getComtradeCfgDTO())) {
|
|
|
|
|
throw new BusinessException(EventResponseEnum.ANALYSEWAVE_NOT_FOUND);
|
|
|
|
|
}
|
|
|
|
|
// WaveDataDTO comtrade = analyWave.getComtrade("C:\\Users\\陈超\\Desktop\\comtrade\\192.168.0.58\\222.CFG", 1);
|
|
|
|
|
waveDataDTO = analyWave.getValidData(comtrade);
|
|
|
|
|
waveDataDTO.setPtType(PubUtils.ptTypeName(lineDetailData.getPtType()));
|
|
|
|
|
double pt1 = Double.parseDouble(lineDetailData.getPt().split("/")[0]);
|
|
|
|
|
@@ -218,15 +218,12 @@ public class TransientServiceImpl implements TransientService {
|
|
|
|
|
List<String> timeId = waveFileParam.getTimeId();
|
|
|
|
|
copyTempData(timeId, lineId);
|
|
|
|
|
zipCompress(new File(generalInfo.getBusinessTempPath() + File.separator + "comtrade"));
|
|
|
|
|
|
|
|
|
|
String zipPath = generalInfo.getBusinessTempPath() + File.separator + "comtrade.zip";
|
|
|
|
|
try {
|
|
|
|
|
// path是指欲下载的文件的路径。
|
|
|
|
|
File file = new File(zipPath);
|
|
|
|
|
// 取得文件名。
|
|
|
|
|
String filename = file.getName();
|
|
|
|
|
// 取得文件的后缀名。
|
|
|
|
|
String ext = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase();
|
|
|
|
|
// 以流的形式下载文件。
|
|
|
|
|
InputStream fis = new BufferedInputStream(new FileInputStream(zipPath));
|
|
|
|
|
byte[] buffer = new byte[fis.available()];
|
|
|
|
|
@@ -439,11 +436,11 @@ public class TransientServiceImpl implements TransientService {
|
|
|
|
|
//根据监测点id获取监测点详情
|
|
|
|
|
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(lineId.get(i)).getData();
|
|
|
|
|
EventDetail eventDetailByTime = eventDetailService.getEventDetailByTime(lineId.get(i), timeId.get(i));
|
|
|
|
|
if (Objects.isNull(lineDetailData.getIp()) && Objects.isNull(eventDetailByTime.getWaveName())) {
|
|
|
|
|
throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND);
|
|
|
|
|
}
|
|
|
|
|
String ip = lineDetailData.getIp();
|
|
|
|
|
String waveName = eventDetailByTime.getWaveName();
|
|
|
|
|
if (StrUtil.isBlank(ip) && StrUtil.isBlank(waveName)) {
|
|
|
|
|
throw new BusinessException(EventResponseEnum.EVENT_NOT_FOUND);
|
|
|
|
|
}
|
|
|
|
|
File srcCFGFile = new File(generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + ".CFG");
|
|
|
|
|
File srcDATFile = new File(generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + ".DAT");
|
|
|
|
|
if (!srcCFGFile.exists() && !srcDATFile.exists()) {
|
|
|
|
|
@@ -451,11 +448,8 @@ public class TransientServiceImpl implements TransientService {
|
|
|
|
|
}
|
|
|
|
|
File temp = new File(generalInfo.getBusinessTempPath() + File.separator + "comtrade" + File.separator + ip);
|
|
|
|
|
temp.mkdirs();
|
|
|
|
|
// File cfg = new File("C:\\Users\\陈超\\Desktop\\YSWJ\\comtrade\\a1234567890\\"+srcCFGFile.getName());
|
|
|
|
|
// File dat = new File("C:\\Users\\陈超\\Desktop\\YSWJ\\comtrade\\a1234567890\\"+srcDATFile.getName());
|
|
|
|
|
File cfg = new File(generalInfo.getBusinessTempPath() + File.separator + "comtrade" + File.separator + ip + File.separator + srcCFGFile.getName());
|
|
|
|
|
File dat = new File(generalInfo.getBusinessTempPath() + File.separator + "comtrade" + File.separator + ip + File.separator + srcDATFile.getName());
|
|
|
|
|
|
|
|
|
|
writeFile(srcCFGFile, cfg);
|
|
|
|
|
writeFile(srcDATFile, dat);
|
|
|
|
|
}
|
|
|
|
|
|