Compare commits
4 Commits
39ae7412a8
...
2026-04
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eed647d3d1 | ||
|
|
4a5fde6a47 | ||
|
|
82ab1de5b9 | ||
|
|
ecc56dd2f6 |
@@ -75,7 +75,7 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
||||
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||
}
|
||||
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 0);
|
||||
waveDataDTO = waveFileComponent.getComtradeNoAddPoints(cfgStream, datStream, 0);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath2);
|
||||
|
||||
@@ -14,11 +14,13 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
@@ -79,6 +81,46 @@ public class WaveFileComponent {
|
||||
return waveDataDTO;
|
||||
}
|
||||
|
||||
public WaveDataDTO getComtradeNoAddPoints(InputStream cfgStream, InputStream datStream, int iType) {
|
||||
WaveDataDTO waveDataDTO = new WaveDataDTO();
|
||||
// 首先判断文件路径是否为空
|
||||
// 读取cfg文件
|
||||
ComtradeCfgDTO comtradeCfgDTO = getComtradeCfgNoAddPoints(cfgStream);
|
||||
// 为空或者未找到结束符号
|
||||
if (comtradeCfgDTO == null || !"BINARY".equalsIgnoreCase(comtradeCfgDTO.getStrBinType())) {
|
||||
throw new BusinessException(WaveFileResponseEnum.CFG_DATA_ERROR);
|
||||
}
|
||||
|
||||
/*****根据通道号计算相别** add by yexb -----Start****
|
||||
* 1、判断是否是3的倍数,是3的倍数则是3相
|
||||
* 2、假如不是3的倍数 ,是1的倍数则是单相
|
||||
********************************************************/
|
||||
if (comtradeCfgDTO.getNAnalogNum() % 3 == 0) {
|
||||
comtradeCfgDTO.setNPhasic(3);
|
||||
} else {
|
||||
comtradeCfgDTO.setNPhasic(1);
|
||||
}
|
||||
|
||||
// 给相别数量赋值
|
||||
waveDataDTO.setIPhasic(comtradeCfgDTO.getNPhasic());
|
||||
|
||||
// 组装解析抬头
|
||||
getWaveTitle(waveDataDTO, comtradeCfgDTO);
|
||||
|
||||
// 解析.dat文件
|
||||
List<List<Float>> listWaveData = getComtradeDatNoAddPoints(comtradeCfgDTO, datStream, iType);
|
||||
|
||||
waveDataDTO.setComtradeCfgDTO(comtradeCfgDTO);
|
||||
|
||||
waveDataDTO.setListWaveData(listWaveData);
|
||||
|
||||
//add by hongawen,将暂态触发起始时间记录下来
|
||||
waveDataDTO.setTime(DateUtil.format(comtradeCfgDTO.getTimeTrige(), DatePattern.NORM_DATETIME_MS_PATTERN));
|
||||
/*****根据通道号计算相别** add by yexb -----end****/
|
||||
|
||||
return waveDataDTO;
|
||||
}
|
||||
|
||||
/*********************************
|
||||
* 根据波形数据算出rms值数据
|
||||
* param waveDataDTO 瞬时波形(包含了CFG配置文件)
|
||||
@@ -470,6 +512,127 @@ public class WaveFileComponent {
|
||||
return comtradeCfgDTO;
|
||||
}
|
||||
|
||||
private ComtradeCfgDTO getComtradeCfgNoAddPoints(InputStream cfgStream) {
|
||||
ComtradeCfgDTO comtradeCfgDTO = new ComtradeCfgDTO();
|
||||
try (InputStreamReader read = new InputStreamReader(cfgStream, CharsetUtil.CHARSET_GBK); BufferedReader bufferedReader = new BufferedReader(read);) {
|
||||
// 第一行不关心仅仅是一些描述类的信息
|
||||
String strFileLine = bufferedReader.readLine();
|
||||
|
||||
// 第二行需要关心第二个(模拟量的个数)和第三个参数(开关量的个数)
|
||||
strFileLine = bufferedReader.readLine();
|
||||
// 按“,”进行分割
|
||||
String[] strTempArray = strFileLine.split(StrUtil.COMMA);
|
||||
// 总个数
|
||||
comtradeCfgDTO.setNChannelNum(Integer.parseInt(strTempArray[0]));
|
||||
// 模拟量的个数
|
||||
comtradeCfgDTO.setNAnalogNum(Integer.parseInt(strTempArray[1].substring(0, strTempArray[1].length() - 1)));
|
||||
// 开关量的个数
|
||||
comtradeCfgDTO.setNDigitalNum(Integer.parseInt(strTempArray[2].substring(0, strTempArray[2].length() - 1)));
|
||||
|
||||
// 从第三行开始的ComtradeCfg.nChannelNum行是模拟量通道和数字量通道
|
||||
List<AnalogDTO> lstAnalogDTO = new ArrayList<>();
|
||||
comtradeCfgDTO.setLstAnalogDTO(lstAnalogDTO);
|
||||
for (int i = 0; i < comtradeCfgDTO.getNChannelNum(); i++) {
|
||||
AnalogDTO analogDTO = new AnalogDTO();
|
||||
lstAnalogDTO.add(analogDTO);
|
||||
strFileLine = bufferedReader.readLine();
|
||||
strTempArray = strFileLine.split(StrUtil.COMMA);
|
||||
//通道序号
|
||||
analogDTO.setNIndex(Integer.parseInt(strTempArray[0]));
|
||||
// 通道名称
|
||||
analogDTO.setSzChannleName(strTempArray[1]);
|
||||
// 相位名称
|
||||
analogDTO.setSzPhasicName(strTempArray[2]);
|
||||
// 监视的通道名称
|
||||
analogDTO.setSzMonitoredChannleName(strTempArray[3]);
|
||||
// 通道的单位
|
||||
analogDTO.setSzUnitName(strTempArray[4]);
|
||||
// 通道的系数
|
||||
analogDTO.setFCoefficent(Float.parseFloat(strTempArray[5]));
|
||||
// 通道的偏移量
|
||||
analogDTO.setFOffset(Float.parseFloat(strTempArray[6]));
|
||||
// 起始采样时间的偏移量
|
||||
analogDTO.setFTimeOffset(Float.parseFloat(strTempArray[7]));
|
||||
// 采样值的最小值
|
||||
analogDTO.setNMin(Integer.parseInt(strTempArray[8]));
|
||||
// 采样值的最大值
|
||||
analogDTO.setNMax(Integer.parseInt(strTempArray[9]));
|
||||
// 一次变比
|
||||
analogDTO.setFPrimary(Float.parseFloat(strTempArray[10]));
|
||||
// 二次变比
|
||||
analogDTO.setFSecondary(Float.parseFloat(strTempArray[11]));
|
||||
// 一次值还是二次值标志
|
||||
analogDTO.setSzValueType(strTempArray[12]);
|
||||
}
|
||||
|
||||
//WW 2019-11-14 // 采样频率
|
||||
String freqLine = bufferedReader.readLine();
|
||||
int nFreq;
|
||||
try {
|
||||
// 先尝试解析为double再四舍五入为整数,以兼容"50.00"这样的格式
|
||||
nFreq = (int) Math.round(Double.parseDouble(freqLine));
|
||||
} catch (NumberFormatException e) {
|
||||
// 如果失败则使用原来的整数解析方式
|
||||
nFreq = Integer.parseInt(freqLine);
|
||||
}
|
||||
|
||||
// 获取采样段数
|
||||
strFileLine = bufferedReader.readLine();
|
||||
int nRates = Integer.parseInt(strFileLine);
|
||||
comtradeCfgDTO.setNRates(nRates);
|
||||
// 获得每段的采样率 //采样率
|
||||
List<RateDTO> lstRate = new ArrayList<>();
|
||||
int nOffset = 0;
|
||||
for (int i = 0; i < nRates; i++) {
|
||||
strFileLine = bufferedReader.readLine();
|
||||
strTempArray = strFileLine.split(StrUtil.COMMA);
|
||||
RateDTO rateDTO = new RateDTO();
|
||||
// 单周波采样点数 //WW 2019-11-14
|
||||
double doubleValue = Double.parseDouble(strTempArray[0]); // 解析为 double
|
||||
int result = (int) (doubleValue / nFreq); // 强制转换为 int
|
||||
rateDTO.setNOneSample(result);
|
||||
// 总点数 //这里的strTemp是一个偏移量
|
||||
rateDTO.setNSampleNum((Integer.parseInt(strTempArray[1]) - nOffset));
|
||||
nOffset = rateDTO.getNSampleNum();
|
||||
lstRate.add(rateDTO);
|
||||
}
|
||||
comtradeCfgDTO.setLstRate(lstRate);
|
||||
// 增加读取波形起始时间个结束时间
|
||||
String timeFormat = "dd/MM/yyyy,HH:mm:ss.SSS";
|
||||
// 波形起始时间
|
||||
strFileLine = bufferedReader.readLine();
|
||||
strFileLine = strFileLine.substring(0, strFileLine.length() - 3);
|
||||
comtradeCfgDTO.setTimeStart(DateUtil.parse(strFileLine, timeFormat));
|
||||
|
||||
// 暂态触发时间
|
||||
strFileLine = bufferedReader.readLine();
|
||||
strFileLine = strFileLine.substring(0, strFileLine.length() - 3);
|
||||
comtradeCfgDTO.setTimeTrige(DateUtil.parse(strFileLine, timeFormat));
|
||||
|
||||
// 获取触发时间的时间 + 毫秒
|
||||
Calendar calendar = DateUtil.calendar(comtradeCfgDTO.getTimeTrige());
|
||||
comtradeCfgDTO.setFirstMs(calendar.get(Calendar.MILLISECOND));
|
||||
comtradeCfgDTO.setFirstTime(calendar.getTime());
|
||||
|
||||
|
||||
long a = comtradeCfgDTO.getTimeStart().getTime();
|
||||
long b = comtradeCfgDTO.getTimeTrige().getTime();
|
||||
|
||||
int c = (int) (b - a);
|
||||
if (c >= 90 && c <= 110) {
|
||||
comtradeCfgDTO.setNPush(100);
|
||||
} else if (c >= 190 && c <= 210) {
|
||||
comtradeCfgDTO.setNPush(200);
|
||||
}
|
||||
// 赋值编码格式(二进制)
|
||||
comtradeCfgDTO.setStrBinType(bufferedReader.readLine().toUpperCase());
|
||||
} catch (Exception e) {
|
||||
// 解析.cfg文件出错
|
||||
comtradeCfgDTO = null;
|
||||
}
|
||||
return comtradeCfgDTO;
|
||||
}
|
||||
|
||||
/*********************************
|
||||
* 读取dat方法
|
||||
* param strFilePath .dat访问路径
|
||||
@@ -765,46 +928,46 @@ public class WaveFileComponent {
|
||||
return listWaveData;
|
||||
}
|
||||
|
||||
// private List<List<Float>> getComtradeDat(ComtradeCfgDTO comtradeCfgDTO, InputStream datStream, int iType) {
|
||||
// //返回数据,如果仅仅做展示后期考虑换String类型,降低内存开销
|
||||
// List<List<Float>> listWaveData = new ArrayList<>();
|
||||
// //初始化xValue的值
|
||||
// float xValueAll = 0;
|
||||
// //判断是否首次登陆
|
||||
// boolean blxValue = false;
|
||||
// byte[] datArray;
|
||||
// try {
|
||||
// datArray = IoUtil.readBytes(datStream);
|
||||
// if (ArrayUtil.isEmpty(datArray)) {
|
||||
// throw new BusinessException(WaveFileResponseEnum.DAT_DATA_ERROR);
|
||||
// }
|
||||
// // 计算每个单独的数据块的大小 4个字节的序号 4个字节的时间 2个字节的值
|
||||
// // 示例中的排布是 4个字节的序号 4个字节的时间 UA(2字节) UB(2字节) UC(2字节) IA(2字节) IB(2字节) IC(2字节)
|
||||
// int nDigSize = (comtradeCfgDTO.getNDigitalNum() % 16) > 0 ? (comtradeCfgDTO.getNDigitalNum() / 16 + 1) * 2 : comtradeCfgDTO.getNDigitalNum() / 16 * 2;
|
||||
// int nBlockSize = 2 * Integer.SIZE / 8 + comtradeCfgDTO.getNAnalogNum() * 2 + nDigSize;
|
||||
// // 总长度除以每个块的大小
|
||||
// int nBlockNum = (int)Math.floor(datArray.length / nBlockSize);
|
||||
//
|
||||
// // 获取采样率
|
||||
// int finalSampleRate = getFinalWaveSample(comtradeCfgDTO.getLstRate(), iType);
|
||||
// if (finalSampleRate != -1) {
|
||||
// //设置最终采样率
|
||||
// comtradeCfgDTO.setFinalSampleRate(finalSampleRate);
|
||||
// // 计算转换后的采样率
|
||||
// int nnInd = 0;
|
||||
// // 抽点后总共多少点数据
|
||||
// int nWaveNum;
|
||||
// //抽点后新的的采样率
|
||||
// List<RateDTO> newLstRate = new ArrayList<>();
|
||||
// for (int iRate = 0; iRate < comtradeCfgDTO.getNRates(); iRate++) {
|
||||
//// if (comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() >= 32) {
|
||||
// // 计算本段录波总共有多少波形
|
||||
// nWaveNum = comtradeCfgDTO.getLstRate().get(iRate).getNSampleNum() / comtradeCfgDTO.getLstRate().get(iRate).getNOneSample();
|
||||
// //设置总波形大小
|
||||
// comtradeCfgDTO.setNAllWaveNum(comtradeCfgDTO.getNAllWaveNum() + nWaveNum);
|
||||
// // 将最低采样率替换到本段录波内
|
||||
// RateDTO tmpRateDTO = new RateDTO();
|
||||
// // 有效值标志,如果是有效值,那么就需要反向补点,而不是抽点
|
||||
private List<List<Float>> getComtradeDatNoAddPoints(ComtradeCfgDTO comtradeCfgDTO, InputStream datStream, int iType) {
|
||||
//返回数据,如果仅仅做展示后期考虑换String类型,降低内存开销
|
||||
List<List<Float>> listWaveData = new ArrayList<>();
|
||||
//初始化xValue的值
|
||||
float xValueAll = 0;
|
||||
//判断是否首次登陆
|
||||
boolean blxValue = false;
|
||||
byte[] datArray;
|
||||
try {
|
||||
datArray = IoUtil.readBytes(datStream);
|
||||
if (ArrayUtil.isEmpty(datArray)) {
|
||||
throw new BusinessException(WaveFileResponseEnum.DAT_DATA_ERROR);
|
||||
}
|
||||
// 计算每个单独的数据块的大小 4个字节的序号 4个字节的时间 2个字节的值
|
||||
// 示例中的排布是 4个字节的序号 4个字节的时间 UA(2字节) UB(2字节) UC(2字节) IA(2字节) IB(2字节) IC(2字节)
|
||||
int nDigSize = (comtradeCfgDTO.getNDigitalNum() % 16) > 0 ? (comtradeCfgDTO.getNDigitalNum() / 16 + 1) * 2 : comtradeCfgDTO.getNDigitalNum() / 16 * 2;
|
||||
int nBlockSize = 2 * Integer.SIZE / 8 + comtradeCfgDTO.getNAnalogNum() * 2 + nDigSize;
|
||||
// 总长度除以每个块的大小
|
||||
int nBlockNum = (int)Math.floor(datArray.length / nBlockSize);
|
||||
|
||||
// 获取采样率
|
||||
int finalSampleRate = getFinalWaveSample(comtradeCfgDTO.getLstRate(), iType);
|
||||
if (finalSampleRate != -1) {
|
||||
//设置最终采样率
|
||||
comtradeCfgDTO.setFinalSampleRate(finalSampleRate);
|
||||
// 计算转换后的采样率
|
||||
int nnInd = 0;
|
||||
// 抽点后总共多少点数据
|
||||
int nWaveNum;
|
||||
//抽点后新的的采样率
|
||||
List<RateDTO> newLstRate = new ArrayList<>();
|
||||
for (int iRate = 0; iRate < comtradeCfgDTO.getNRates(); iRate++) {
|
||||
if (comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() >= 32) {
|
||||
// 计算本段录波总共有多少波形
|
||||
nWaveNum = comtradeCfgDTO.getLstRate().get(iRate).getNSampleNum() / comtradeCfgDTO.getLstRate().get(iRate).getNOneSample();
|
||||
//设置总波形大小
|
||||
comtradeCfgDTO.setNAllWaveNum(comtradeCfgDTO.getNAllWaveNum() + nWaveNum);
|
||||
// 将最低采样率替换到本段录波内
|
||||
RateDTO tmpRateDTO = new RateDTO();
|
||||
// 有效值标志,如果是有效值,那么就需要反向补点,而不是抽点
|
||||
// if (comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() >= 32) {
|
||||
// //YXB 2025-08-27
|
||||
// tmpRateDTO.bRMSFlag = false;
|
||||
@@ -814,52 +977,53 @@ public class WaveFileComponent {
|
||||
// //YXB 2025-08-27
|
||||
// tmpRateDTO.bRMSFlag = true;
|
||||
// }
|
||||
// newLstRate.add(tmpRateDTO);
|
||||
// //iFlag =3 一定不进行抽点算法
|
||||
// if (iType != 3) {
|
||||
// //true 抽点算法(当前采样率跟统一采样率不一样则是抽点,否则是未抽点)
|
||||
// if (!Objects.equals(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample(), comtradeCfgDTO.getFinalSampleRate())) {
|
||||
// newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getFinalSampleRate());
|
||||
// // 计算本段录波按照最低采样点应该有多少录波
|
||||
// newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getFinalSampleRate() * nWaveNum);
|
||||
// } else {
|
||||
// newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
||||
// // 计算本段录波按照最低采样点应该有多少录波
|
||||
// newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() * nWaveNum);
|
||||
// }
|
||||
// } else {
|
||||
// newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
||||
// // 计算本段录波按照最低采样点应该有多少录波
|
||||
// newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() * nWaveNum);
|
||||
// }
|
||||
//
|
||||
// // 正常的配置中采样率
|
||||
// /* comtradeCfgDTO.getLstRate().get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
||||
// comtradeCfgDTO.getLstRate().get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNSampleNum());*/
|
||||
//
|
||||
// nnInd++;
|
||||
//// }
|
||||
// }
|
||||
// // 偏移量,采样间隔
|
||||
// long nOffSet = 0, nWaveSpan;
|
||||
// //两个点之间的时间差
|
||||
// float fValue, dfValue;
|
||||
// // 计算不同块的采样率
|
||||
// int nIndex = 0;
|
||||
// // 将最低采样率替换到本段录波内
|
||||
// // .CFG中采样率
|
||||
// RateDTO tmpRateDTO;
|
||||
// // nBlockNum 总循环次数
|
||||
// for (int i = 0; i < nBlockNum; i++) {
|
||||
// tmpRateDTO = comtradeCfgDTO.getLstRate().get(nIndex);
|
||||
// // 判断是否进入下一段
|
||||
// if (i == tmpRateDTO.getNSampleNum() + nOffSet) {
|
||||
// nOffSet += tmpRateDTO.getNSampleNum();
|
||||
// nIndex++;
|
||||
// if (nIndex == nnInd) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
newLstRate.add(tmpRateDTO);
|
||||
//iFlag =3 一定不进行抽点算法
|
||||
if (iType != 3) {
|
||||
//true 抽点算法(当前采样率跟统一采样率不一样则是抽点,否则是未抽点)
|
||||
if (!Objects.equals(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample(), comtradeCfgDTO.getFinalSampleRate())) {
|
||||
newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getFinalSampleRate());
|
||||
// 计算本段录波按照最低采样点应该有多少录波
|
||||
newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getFinalSampleRate() * nWaveNum);
|
||||
} else {
|
||||
newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
||||
// 计算本段录波按照最低采样点应该有多少录波
|
||||
newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() * nWaveNum);
|
||||
}
|
||||
} else {
|
||||
newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
||||
// 计算本段录波按照最低采样点应该有多少录波
|
||||
newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() * nWaveNum);
|
||||
}
|
||||
|
||||
// 正常的配置中采样率
|
||||
comtradeCfgDTO.getLstRate().get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
||||
comtradeCfgDTO.getLstRate().get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNSampleNum());
|
||||
|
||||
nnInd++;
|
||||
}
|
||||
}
|
||||
// 偏移量,采样间隔
|
||||
long nOffSet = 0, nWaveSpan;
|
||||
//两个点之间的时间差
|
||||
float fValue, dfValue;
|
||||
// 计算不同块的采样率
|
||||
int nIndex = 0;
|
||||
// 将最低采样率替换到本段录波内
|
||||
// .CFG中采样率
|
||||
RateDTO tmpRateDTO;
|
||||
// nBlockNum 总循环次数
|
||||
for (int i = 0; i < nBlockNum; i++) {
|
||||
tmpRateDTO = comtradeCfgDTO.getLstRate().get(nIndex);
|
||||
// 判断是否进入下一段
|
||||
if (i == tmpRateDTO.getNSampleNum() + nOffSet) {
|
||||
nOffSet += tmpRateDTO.getNSampleNum();
|
||||
nIndex++;
|
||||
if (nIndex == nnInd) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
nWaveSpan = tmpRateDTO.getNOneSample() / newLstRate.get(nIndex).getNOneSample();
|
||||
// tmpRateDTO = comtradeCfgDTO.getLstRate().get(nIndex);
|
||||
// //YXB 2025-08-27 如果是有效值,那么需要去补点,而不是抽点
|
||||
// if (newLstRate.get(nIndex).bRMSFlag == true) {
|
||||
@@ -869,199 +1033,99 @@ public class WaveFileComponent {
|
||||
// // 计算本段抽点采样间隔
|
||||
// nWaveSpan = tmpRateDTO.getNOneSample() / newLstRate.get(nIndex).getNOneSample();
|
||||
// }
|
||||
//
|
||||
// dfValue = (float) 20 / tmpRateDTO.getNOneSample();
|
||||
// // 判断是否到了需要抽的采样点
|
||||
// if (i % nWaveSpan == 0) {
|
||||
// // 计算每个通道的值
|
||||
// //存储局部数据集合,包含了时间,A,B,C三相
|
||||
// List<Float> tmpWaveData = new ArrayList<>();
|
||||
// //YXB 2025-08-27 如果是有效值,那么需要去补点,而不是抽点
|
||||
// if (newLstRate.get(nIndex).bRMSFlag == true) {
|
||||
// // 计算有多少个周波
|
||||
// long allWaveTemp = newLstRate.get(nIndex).getNSampleNum() / newLstRate.get(nIndex).getNOneSample();
|
||||
// // 本段需要补多少点
|
||||
// long allempSample = newLstRate.get(nIndex).getNOneSample();
|
||||
// //int iStartWaveTemp = i ;// 开始补点的起点
|
||||
// for (int iWaveTemp = 0; iWaveTemp < allWaveTemp; iWaveTemp++) {
|
||||
// for (int mTempSample = 0; mTempSample < allempSample; mTempSample++) {
|
||||
// //最多只有半波有效值,也就是每周波是1个或者2个点,然后去补最少16个点
|
||||
// if (mTempSample / nWaveSpan == 1 && mTempSample % nWaveSpan == 0) {
|
||||
// i++;
|
||||
// }
|
||||
// //存储局部数据集合,包含了时间,A,B,C三相
|
||||
// tmpWaveData = new ArrayList<>();
|
||||
// for (int j = 0; j < comtradeCfgDTO.getNAnalogNum(); j++) {
|
||||
// //数据只有电压ABC三相数据,不展示U0、I0等数据 YXB2020-10-09 去除相别为N相的数据
|
||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzPhasicName().equalsIgnoreCase("N")) {
|
||||
// break;
|
||||
// }
|
||||
// float fCoef = comtradeCfgDTO.getLstAnalogDTO().get(j).getFCoefficent();
|
||||
//
|
||||
// if((i * nBlockSize + 2 * 4 + j * 2) == 2437568){
|
||||
// System.out.println(55);
|
||||
// }
|
||||
// fValue = BitConverter.byte2ToUnsignedShort(datArray, i * nBlockSize + 2 * 4 + j * 2) * fCoef;
|
||||
// //WW 2019-11-14
|
||||
// /*************************
|
||||
// * 1、接口返回的默认是二次值
|
||||
// * 2、P是一次值 S是二次值
|
||||
// * 3、S(二次值)情况下:
|
||||
// * ①、单位为"V"时候则直接等于;
|
||||
// * ②、单位为"kV"时候需要乘以1000
|
||||
// * 4、P(一次值)情况下:
|
||||
// * ①、单位为"V"时候则直接等于;
|
||||
// * ②、单位为"kV"时候需要乘以1000
|
||||
// *************************/
|
||||
// //P是一次值 S是二次值
|
||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("S")) {
|
||||
// //判断单位是V还是kV
|
||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
||||
// fValue = fValue * 1000.0f;
|
||||
// } else {
|
||||
// fValue = fValue;
|
||||
// }
|
||||
// }
|
||||
// //P是一次值 S是二次值
|
||||
// else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("P")) {
|
||||
// //判断单位是V还是kV
|
||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("V")) {
|
||||
// //根据cfg内的变比,将一次值转换成二次值
|
||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||
// fValue = fValue * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||
// } else {
|
||||
// fValue = fValue;
|
||||
// }
|
||||
// }
|
||||
// //判断单位是V还是kV
|
||||
// else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
||||
// //根据cfg内的变比,将一次值转换成二次值
|
||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||
// fValue = fValue * 1000.0f * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||
// } else {
|
||||
// fValue = fValue;
|
||||
// }
|
||||
// } else //还有可能是 电流,单位是A
|
||||
// {
|
||||
// //根据cfg内的变比,将一次值转换成二次值
|
||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||
// fValue = comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||
// } else {
|
||||
// fValue = fValue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //xValue前移量,假如是第一次时候则需要前移
|
||||
// if (!blxValue && j == 0) {
|
||||
// xValueAll = (float) (i * 20) / tmpRateDTO.getNOneSample() - comtradeCfgDTO.getNPush();
|
||||
// blxValue = true;
|
||||
// //只增加一个xValue的值 //增加时间值
|
||||
// tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
||||
// } else if (j == 0) {
|
||||
// xValueAll += (float) dfValue / nWaveSpan;
|
||||
// //只增加一个xValue的值 //增加时间值
|
||||
// tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
||||
// }
|
||||
//
|
||||
// //不同通道yValue的值都需要增加,最终成ABC三相 //每个通道的值
|
||||
// tmpWaveData.add((float) (Math.round(fValue * 100)) / 100);
|
||||
// }
|
||||
// //把每个单独的值赋予到整体里面去
|
||||
// listWaveData.add(tmpWaveData);
|
||||
// }
|
||||
// // 把每个单独的值赋予到整体里面去
|
||||
// if (iWaveTemp < (allWaveTemp - 1)) {
|
||||
// i++;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// for (int j = 0; j < comtradeCfgDTO.getNAnalogNum(); j++) {
|
||||
// //数据只有电压ABC三相数据,不展示U0、I0等数据 YXB2020-10-09 去除相别为N相的数据
|
||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzPhasicName().equalsIgnoreCase("N")) {
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// float fCoef = comtradeCfgDTO.getLstAnalogDTO().get(j).getFCoefficent();
|
||||
// fValue = BitConverter.byte2ToUnsignedShort(datArray, i * nBlockSize + 2 * 4 + j * 2) * fCoef;
|
||||
//
|
||||
// //WW 2019-11-14
|
||||
// /**************************
|
||||
// * 1、接口返回的默认是二次值
|
||||
// * 2、P是一次值 S是二次值
|
||||
// * 3、S(二次值)情况下:
|
||||
// * ①、单位为"V"时候则直接等于;
|
||||
// * ②、单位为"kV"时候需要乘以1000
|
||||
// * 4、P(一次值)情况下:
|
||||
// * ①、单位为"V"时候则直接等于;
|
||||
// * ②、单位为"kV"时候需要乘以1000
|
||||
// **************************/
|
||||
// //P是一次值 S是二次值
|
||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("S")) {
|
||||
// //判断单位是V还是kV
|
||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
||||
// fValue = fValue * 1000.0f;
|
||||
// } else {
|
||||
// fValue = fValue;
|
||||
// }
|
||||
// }
|
||||
// //P是一次值 S是二次值
|
||||
// else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("P")) {
|
||||
// //判断单位是V还是kV
|
||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("V")) {
|
||||
// //根据cfg内的变比,将一次值转换成二次值
|
||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||
// fValue = fValue * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||
// } else {
|
||||
// fValue = fValue;
|
||||
// }
|
||||
// }
|
||||
// //判断单位是V还是kV
|
||||
// else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
||||
// //根据cfg内的变比,将一次值转换成二次值
|
||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||
// fValue = fValue * 1000.0f * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||
// } else {
|
||||
// fValue = fValue;
|
||||
// }
|
||||
// } else //还有可能是 电流,单位是A
|
||||
// {
|
||||
// //根据cfg内的变比,将一次值转换成二次值
|
||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||
// fValue = comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||
// } else {
|
||||
// fValue = fValue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //xValue前移量,假如是第一次时候则需要前移
|
||||
// if (!blxValue && j == 0) {
|
||||
// xValueAll = (float) (i * 20) / tmpRateDTO.getNOneSample() - comtradeCfgDTO.getNPush();
|
||||
// blxValue = true;
|
||||
// //只增加一个xValue的值 //增加时间值
|
||||
// tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
||||
// } else if (j == 0) {
|
||||
// xValueAll += (float) nWaveSpan * dfValue;
|
||||
// //只增加一个xValue的值 //增加时间值
|
||||
// tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
||||
// }
|
||||
//
|
||||
// //不同通道yValue的值都需要增加,最终成ABC三相 //每个通道的值
|
||||
// tmpWaveData.add((float) (Math.round(fValue * 100)) / 100);
|
||||
// }
|
||||
// //把每个单独的值赋予到整体里面去
|
||||
// listWaveData.add(tmpWaveData);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// throw new BusinessException(WaveFileResponseEnum.DAT_DATA_ERROR);
|
||||
// }
|
||||
//
|
||||
// return listWaveData;
|
||||
// }
|
||||
|
||||
dfValue = (float) 20 / tmpRateDTO.getNOneSample();
|
||||
// 判断是否到了需要抽的采样点
|
||||
if (i % nWaveSpan == 0) {
|
||||
// 计算每个通道的值
|
||||
//存储局部数据集合,包含了时间,A,B,C三相
|
||||
List<Float> tmpWaveData = new ArrayList<>();
|
||||
for (int j = 0; j < comtradeCfgDTO.getNAnalogNum(); j++) {
|
||||
//数据只有电压ABC三相数据,不展示U0、I0等数据 YXB2020-10-09 去除相别为N相的数据
|
||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzPhasicName().equalsIgnoreCase("N")) {
|
||||
break;
|
||||
}
|
||||
|
||||
float fCoef = comtradeCfgDTO.getLstAnalogDTO().get(j).getFCoefficent();
|
||||
fValue = BitConverter.byte2ToUnsignedShort(datArray, i * nBlockSize + 2 * 4 + j * 2) * fCoef;
|
||||
|
||||
//WW 2019-11-14
|
||||
/**************************
|
||||
* 1、接口返回的默认是二次值
|
||||
* 2、P是一次值 S是二次值
|
||||
* 3、S(二次值)情况下:
|
||||
* ①、单位为"V"时候则直接等于;
|
||||
* ②、单位为"kV"时候需要乘以1000
|
||||
* 4、P(一次值)情况下:
|
||||
* ①、单位为"V"时候则直接等于;
|
||||
* ②、单位为"kV"时候需要乘以1000
|
||||
**************************/
|
||||
//P是一次值 S是二次值
|
||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("S")) {
|
||||
//判断单位是V还是kV
|
||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
||||
fValue = fValue * 1000.0f;
|
||||
} else {
|
||||
fValue = fValue;
|
||||
}
|
||||
}
|
||||
//P是一次值 S是二次值
|
||||
else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("P")) {
|
||||
//判断单位是V还是kV
|
||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("V")) {
|
||||
//根据cfg内的变比,将一次值转换成二次值
|
||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||
fValue = fValue * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||
} else {
|
||||
fValue = fValue;
|
||||
}
|
||||
}
|
||||
//判断单位是V还是kV
|
||||
else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
||||
//根据cfg内的变比,将一次值转换成二次值
|
||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||
fValue = fValue * 1000.0f * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||
} else {
|
||||
fValue = fValue;
|
||||
}
|
||||
} else //还有可能是 电流,单位是A
|
||||
{
|
||||
//根据cfg内的变比,将一次值转换成二次值
|
||||
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||
fValue = fValue *comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||
} else {
|
||||
fValue = fValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
//xValue前移量,假如是第一次时候则需要前移
|
||||
if (!blxValue && j == 0) {
|
||||
xValueAll = (float) (i * 20) / tmpRateDTO.getNOneSample() - comtradeCfgDTO.getNPush();
|
||||
blxValue = true;
|
||||
//只增加一个xValue的值 //增加时间值
|
||||
tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
||||
} else if (j == 0) {
|
||||
xValueAll += (float) nWaveSpan * dfValue;
|
||||
//只增加一个xValue的值 //增加时间值
|
||||
tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
||||
}
|
||||
|
||||
//不同通道yValue的值都需要增加,最终成ABC三相 //每个通道的值
|
||||
tmpWaveData.add((float) (Math.round(fValue * 100)) / 100);
|
||||
}
|
||||
//把每个单独的值赋予到整体里面去
|
||||
listWaveData.add(tmpWaveData);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new BusinessException(WaveFileResponseEnum.DAT_DATA_ERROR);
|
||||
}
|
||||
|
||||
return listWaveData;
|
||||
}
|
||||
|
||||
|
||||
/*********************************
|
||||
@@ -1656,10 +1720,10 @@ public class WaveFileComponent {
|
||||
s = sdf.format(d);
|
||||
System.out.println(s);
|
||||
WaveFileComponent waveFileComponent = new WaveFileComponent();
|
||||
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath("C:\\Users\\Administrator\\Desktop\\wave\\PQMonitor_PQM2_006970_20260320_175033_734.CFG");
|
||||
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath("C:\\Users\\Administrator\\Desktop\\wave\\PQMonitor_PQM2_006970_20260320_175033_734.DAT");
|
||||
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath("C:\\Users\\无名\\Desktop\\月报\\2026\\202603\\文档\\暂态事件及波形\\新建文件夹 (3)\\Comtrade\\Comtrade\\10.95.0.201\\PQMonitor_PQM1_001183_20260320_175042_316.CFG");
|
||||
InputStream datStream = waveFileComponent.getFileInputStreamByFilePath("C:\\Users\\无名\\Desktop\\月报\\2026\\202603\\文档\\暂态事件及波形\\新建文件夹 (3)\\Comtrade\\Comtrade\\10.95.0.201\\PQMonitor_PQM1_001183_20260320_175042_316.DAT");
|
||||
// 获取瞬时波形 //获取原始波形值
|
||||
WaveDataDTO waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
|
||||
WaveDataDTO waveDataDTO = waveFileComponent.getComtradeNoAddPoints(cfgStream, datStream, 0);
|
||||
d = new Date();
|
||||
s = sdf.format(d);
|
||||
System.out.println(s);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.njcn.device.pq.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -17,6 +19,7 @@ import java.io.Serializable;
|
||||
public class DeviceProcess implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
//设备id
|
||||
@TableId("Id")
|
||||
private String id;
|
||||
//设备设备所在前置机进程号
|
||||
private Integer processNo;
|
||||
|
||||
@@ -139,7 +139,7 @@ public class RunManageServiceImpl implements RunManageService {
|
||||
List<String> devIndexes = generalDeviceDTOList.stream().flatMap(list -> list.getDeviceIndexes().stream()).collect(Collectors.toList());
|
||||
List<String> manuList = runManageParam.getManufacturer().stream().map(SimpleDTO::getId).collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(devIndexes)) {
|
||||
throw new BusinessException("当前部门没有装置台账");
|
||||
return new Page<>(PageFactory.getPageNum(runManageParam), PageFactory.getPageSize(runManageParam));
|
||||
}
|
||||
return deviceMapper.getRunManageDevList(new Page<>(PageFactory.getPageNum(runManageParam), PageFactory.getPageSize(runManageParam)),devIndexes, runManageParam.getComFlag(), runManageParam.getRunFlag(), manuList, runManageParam.getSearchValue());
|
||||
}
|
||||
|
||||
@@ -853,7 +853,8 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
if (!Objects.equals(lineDetail.getCt1(), lineDetailRes.getCt1()) || !Objects.equals(lineDetail.getCt2(), lineDetailRes.getCt2())
|
||||
|| !Objects.equals(lineDetail.getPt1(), lineDetailRes.getPt1()) || !Objects.equals(lineDetail.getPt2(), lineDetailRes.getPt2())
|
||||
|| !Objects.equals(lineDetail.getDevCapacity(), lineDetailRes.getDevCapacity()) || !Objects.equals(lineDetail.getShortCapacity(), lineDetailRes.getShortCapacity())
|
||||
|| !Objects.equals(lineDetail.getStandardCapacity(), lineDetailRes.getStandardCapacity()) || !Objects.equals(lineDetail.getDealCapacity(), lineDetailRes.getDealCapacity())) {
|
||||
|| !Objects.equals(lineDetail.getStandardCapacity(), lineDetailRes.getStandardCapacity()) || !Objects.equals(lineDetail.getDealCapacity(), lineDetailRes.getDealCapacity())
|
||||
|| !Objects.equals(lineDetail.getPtType(), lineDetailRes.getPtType())) {
|
||||
//获取用户信息
|
||||
String index = RequestUtil.getUserIndex();
|
||||
queryUpdateAndInsertLog(userName, index, lineDetail, lineDetailRes);
|
||||
@@ -959,6 +960,11 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
sbNew.append("协议容量: ").append(newLine.getDealCapacity()).append(";");
|
||||
sbOld.append("协议容量: ").append(oldLine.getDealCapacity()).append(";");
|
||||
}
|
||||
//接线方式
|
||||
if (!Objects.equals(newLine.getPtType(), oldLine.getPtType())) {
|
||||
sbNew.append("接线方式: ").append(newLine.getPtType()).append(";");
|
||||
sbOld.append("接线方式: ").append(oldLine.getPtType()).append(";");
|
||||
}
|
||||
sb.append(sbNew).append(sbOld);
|
||||
HttpResult<DictData> dicDataByCode = dicDataFeignClient.getDicDataByCode(DicDataEnum.LINE_PARAMETER.getCode());
|
||||
DictData data = dicDataByCode.getData();
|
||||
@@ -3851,14 +3857,29 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
//设备删除找不到设备名称,重日志截取
|
||||
if (Objects.equals(temp.getOperateType(), Param.DEL)) {
|
||||
String temLos = "%s名称:%s;前置信息:%s";
|
||||
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
||||
String devName = strings.get(1); // 设备名称
|
||||
String nodeName = strings.get(2); // 进程名称
|
||||
pqsTerminalPushLogDTO.setDevName(devName);
|
||||
String nodeId = nodeNameMap.get(nodeName).getId();
|
||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeName);
|
||||
//删除有2种情况,1.设备删除,2,设备状态修改;
|
||||
if (lineMap.containsKey(deviceId)) {
|
||||
pqsTerminalPushLogDTO.setDevName(lineMap.get(deviceId).getName());
|
||||
String nodeId = deviceMap.get(deviceId).getNodeId();
|
||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeMap.containsKey(nodeId)?nodeMap.get(nodeId).getName():"删除前置");
|
||||
|
||||
}else {
|
||||
if(temp.getTerminalDescribe().contains("前置信息")){
|
||||
String temLos = "%s名称:%s;前置信息:%s";
|
||||
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
||||
String devName = strings.get(1); // 设备名称
|
||||
String nodeName = strings.get(2); // 进程名称
|
||||
pqsTerminalPushLogDTO.setDevName(devName);
|
||||
String nodeId = nodeNameMap.get(nodeName).getId();
|
||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||
pqsTerminalPushLogDTO.setNodeName(nodeName);
|
||||
}else {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
//如果存在说明设备未被删除,不存在说明有一条删除日志,直接return;
|
||||
if (lineMap.containsKey(deviceId)) {
|
||||
|
||||
@@ -13,10 +13,12 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.common.mapper.SuperDataMapper;
|
||||
import com.njcn.device.common.service.GeneralDeviceService;
|
||||
import com.njcn.device.device.mapper.DevFuctionMapper;
|
||||
import com.njcn.device.device.service.DeviceProcessService;
|
||||
import com.njcn.device.device.service.IDevMealService;
|
||||
import com.njcn.device.device.service.IDevStrategyService;
|
||||
import com.njcn.device.device.service.IDeviceService;
|
||||
import com.njcn.device.line.service.LineService;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
import com.njcn.device.pq.enums.LineBaseEnum;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pq.pojo.param.*;
|
||||
@@ -84,6 +86,7 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService {
|
||||
|
||||
private final CldStatisticsFlowMapper cldStatisticsFlowMapper;
|
||||
private final LineService lineService;
|
||||
private final DeviceProcessService deviceProcessService;
|
||||
|
||||
@Override
|
||||
public List<TerminalMaintainVO> getTerminalMainList(TerminalMainQueryParam terminalMainQueryParam) {
|
||||
@@ -205,7 +208,19 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService {
|
||||
terminalLogsNew.setObjIndex(device.getId());
|
||||
terminalLogsNew.setTerminalDescribe(sb.toString());
|
||||
terminalLogsNew.setIsPush(0);
|
||||
terminalLogsNew.setOperateType("update");
|
||||
if(device.getRunFlag() == 0&&device1.getRunFlag()!=0){
|
||||
terminalLogsNew.setOperateType(Param.DEL);
|
||||
|
||||
}
|
||||
if(device1.getRunFlag() == 0&&device.getRunFlag()!=0){
|
||||
terminalLogsNew.setOperateType(Param.ADD);
|
||||
//判断device是否绑定进程号;
|
||||
DeviceProcess deviceProcess = new DeviceProcess();
|
||||
deviceProcess.setId(device1.getId());
|
||||
deviceProcess.setProcessNo(1);
|
||||
|
||||
deviceProcessService.saveOrUpdate(deviceProcess);
|
||||
}
|
||||
terminalLogsNew.setLogsType(data.getId());
|
||||
terminalLogsNew.setTerminalType(LineBaseEnum.DEVICE_LEVEL.getCode());
|
||||
terminalLogsNew.setState(DataStateEnum.ENABLE.getCode());
|
||||
|
||||
@@ -175,37 +175,40 @@ public class EventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper, Rm
|
||||
//如果不为空,说明是二次上传波形文件了;
|
||||
String reason,type;
|
||||
if(!StringUtils.isEmpty(rmpEventDetailPO.getWavePath())){
|
||||
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(rmpEventDetailPO.getLineId()).getData();
|
||||
String ip = lineDetailData.getIp();
|
||||
EventAnalysisDTO eventAnalysisDTO = new EventAnalysisDTO();
|
||||
eventAnalysisDTO.setIp(ip);
|
||||
eventAnalysisDTO.setWaveName(rmpEventDetailPO.getWavePath());
|
||||
try {
|
||||
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(rmpEventDetailPO.getLineId()).getData();
|
||||
String ip = lineDetailData.getIp();
|
||||
EventAnalysisDTO eventAnalysisDTO = new EventAnalysisDTO();
|
||||
eventAnalysisDTO.setIp(ip);
|
||||
eventAnalysisDTO.setWaveName(rmpEventDetailPO.getWavePath());
|
||||
|
||||
EventAnalysisDTO result = eventCauseFeignClient.analysisCauseAndType(eventAnalysisDTO).getData();
|
||||
if(Objects.isNull(result.getCause())){
|
||||
reason =reasonReflection(0);
|
||||
EventAnalysisDTO result = eventCauseFeignClient.analysisCauseAndType(eventAnalysisDTO).getData();
|
||||
if(Objects.isNull(result.getCause())){
|
||||
reason =reasonReflection(0);
|
||||
|
||||
}else {
|
||||
reason =reasonReflection(result.getCause());
|
||||
}else {
|
||||
reason =reasonReflection(result.getCause());
|
||||
|
||||
}
|
||||
if(Objects.isNull(result.getType())){
|
||||
type =advanceTypeReflection(10);
|
||||
}
|
||||
if(Objects.isNull(result.getType())){
|
||||
type =advanceTypeReflection(10);
|
||||
|
||||
}else {
|
||||
type =advanceTypeReflection(result.getType());
|
||||
}else {
|
||||
type =advanceTypeReflection(result.getType());
|
||||
|
||||
}
|
||||
DictData advancereason = dicDataFeignClient.getDicDataByCode(reason).getData();
|
||||
DictData advanceType = dicDataFeignClient.getDicDataByCode(type).getData();
|
||||
if(Objects.equals(result.getCauseFlag(),1)&&Objects.equals(result.getTypeFlag(),1)){
|
||||
rmpEventDetailPO.setDealFlag(1);
|
||||
}else {
|
||||
}
|
||||
DictData advancereason = dicDataFeignClient.getDicDataByCode(reason).getData();
|
||||
DictData advanceType = dicDataFeignClient.getDicDataByCode(type).getData();
|
||||
if(Objects.equals(result.getCauseFlag(),1)&&Objects.equals(result.getTypeFlag(),1)){
|
||||
rmpEventDetailPO.setDealFlag(1);
|
||||
}else {
|
||||
rmpEventDetailPO.setDealFlag(0);
|
||||
}
|
||||
rmpEventDetailPO.setAdvanceReason(advancereason.getId());
|
||||
rmpEventDetailPO.setAdvanceType(advanceType.getId());
|
||||
}catch (Exception e){
|
||||
rmpEventDetailPO.setDealFlag(0);
|
||||
}
|
||||
rmpEventDetailPO.setAdvanceReason(advancereason.getId());
|
||||
rmpEventDetailPO.setAdvanceType(advanceType.getId());
|
||||
|
||||
}
|
||||
//默认都是其他
|
||||
// DictData reason = dicDataFeignClient.getDicDataByCode(DicDataEnum.RESON_REST.getCode()).getData();
|
||||
|
||||
Reference in New Issue
Block a user