Compare commits
9 Commits
c58bd87a78
...
2026-04
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eed647d3d1 | ||
|
|
4a5fde6a47 | ||
|
|
82ab1de5b9 | ||
|
|
ecc56dd2f6 | ||
| 39ae7412a8 | |||
| 52677f84dc | |||
| abdb855919 | |||
| 64bcbfff91 | |||
|
|
499eee6784 |
@@ -75,7 +75,7 @@ public class EventAdvanceServiceImpl implements IEventAdvanceService {
|
|||||||
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
|
||||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 0);
|
waveDataDTO = waveFileComponent.getComtradeNoAddPoints(cfgStream, datStream, 0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
try {
|
try {
|
||||||
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath2);
|
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath2);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.njcn.advance.utils;
|
package com.njcn.advance.utils;
|
||||||
|
|
||||||
import cn.hutool.core.io.resource.ClassPathResource;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.File;
|
||||||
import java.net.URLDecoder;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pqs
|
* pqs
|
||||||
@@ -20,21 +20,20 @@ public class JnaCallDllOrSo {
|
|||||||
|
|
||||||
public JnaCallDllOrSo(String name) {
|
public JnaCallDllOrSo(String name) {
|
||||||
super();
|
super();
|
||||||
String suffix = ".dll";
|
|
||||||
try {
|
try {
|
||||||
String os = System.getProperty("os.name");
|
String os = System.getProperty("os.name");
|
||||||
// windows操作系统为1 否则为0
|
|
||||||
int beginIndex = os != null && os.startsWith("Windows") ? 1 : 0;
|
int beginIndex = os != null && os.startsWith("Windows") ? 1 : 0;
|
||||||
String nameDll;
|
String nameDll;
|
||||||
if (beginIndex == 0) {
|
if (beginIndex == 0) {
|
||||||
//linux操作系统
|
nameDll = "lib" + name + ".so";
|
||||||
nameDll = "lib" + name + "_dll";
|
|
||||||
suffix = ".so";
|
|
||||||
} else {
|
} else {
|
||||||
nameDll = name;
|
nameDll = name;
|
||||||
|
if (!name.endsWith(".dll")) {
|
||||||
|
nameDll = name + ".dll";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String tem = "/usr/local/dllFile/"+ nameDll.concat(suffix);
|
String tem = "/usr/local/dllFile/"+ nameDll;
|
||||||
File dockerFile = new File(tem);
|
File dockerFile = new File(tem);
|
||||||
if(!dockerFile.exists()){
|
if(!dockerFile.exists()){
|
||||||
boolean f = dockerFile.getParentFile().mkdirs();
|
boolean f = dockerFile.getParentFile().mkdirs();
|
||||||
@@ -42,7 +41,11 @@ public class JnaCallDllOrSo {
|
|||||||
System.out.println("文件夹创建:"+f);
|
System.out.println("文件夹创建:"+f);
|
||||||
System.out.println("文件创建:"+d);
|
System.out.println("文件创建:"+d);
|
||||||
|
|
||||||
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(nameDll.concat(suffix))) {
|
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(nameDll)) {
|
||||||
|
if (inputStream == null) {
|
||||||
|
log.error("找不到资源文件: {}", nameDll);
|
||||||
|
throw new FileNotFoundException("找不到资源文件: " + nameDll);
|
||||||
|
}
|
||||||
try (FileOutputStream outputStream = new FileOutputStream(dockerFile)) {
|
try (FileOutputStream outputStream = new FileOutputStream(dockerFile)) {
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
@@ -53,9 +56,11 @@ public class JnaCallDllOrSo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.path = dockerFile.getAbsolutePath();
|
this.path = dockerFile.getAbsolutePath();
|
||||||
|
System.out.println("动态库路径: " + this.path);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("调用高级算法文件异常,异常信息如下:");
|
log.error("调用高级算法文件异常,异常信息如下:");
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage(), e);
|
||||||
|
throw new RuntimeException("加载动态库失败: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,13 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -79,6 +81,46 @@ public class WaveFileComponent {
|
|||||||
return waveDataDTO;
|
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值数据
|
* 根据波形数据算出rms值数据
|
||||||
* param waveDataDTO 瞬时波形(包含了CFG配置文件)
|
* param waveDataDTO 瞬时波形(包含了CFG配置文件)
|
||||||
@@ -470,6 +512,127 @@ public class WaveFileComponent {
|
|||||||
return comtradeCfgDTO;
|
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方法
|
* 读取dat方法
|
||||||
* param strFilePath .dat访问路径
|
* param strFilePath .dat访问路径
|
||||||
@@ -765,46 +928,46 @@ public class WaveFileComponent {
|
|||||||
return listWaveData;
|
return listWaveData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// private List<List<Float>> getComtradeDat(ComtradeCfgDTO comtradeCfgDTO, InputStream datStream, int iType) {
|
private List<List<Float>> getComtradeDatNoAddPoints(ComtradeCfgDTO comtradeCfgDTO, InputStream datStream, int iType) {
|
||||||
// //返回数据,如果仅仅做展示后期考虑换String类型,降低内存开销
|
//返回数据,如果仅仅做展示后期考虑换String类型,降低内存开销
|
||||||
// List<List<Float>> listWaveData = new ArrayList<>();
|
List<List<Float>> listWaveData = new ArrayList<>();
|
||||||
// //初始化xValue的值
|
//初始化xValue的值
|
||||||
// float xValueAll = 0;
|
float xValueAll = 0;
|
||||||
// //判断是否首次登陆
|
//判断是否首次登陆
|
||||||
// boolean blxValue = false;
|
boolean blxValue = false;
|
||||||
// byte[] datArray;
|
byte[] datArray;
|
||||||
// try {
|
try {
|
||||||
// datArray = IoUtil.readBytes(datStream);
|
datArray = IoUtil.readBytes(datStream);
|
||||||
// if (ArrayUtil.isEmpty(datArray)) {
|
if (ArrayUtil.isEmpty(datArray)) {
|
||||||
// throw new BusinessException(WaveFileResponseEnum.DAT_DATA_ERROR);
|
throw new BusinessException(WaveFileResponseEnum.DAT_DATA_ERROR);
|
||||||
// }
|
}
|
||||||
// // 计算每个单独的数据块的大小 4个字节的序号 4个字节的时间 2个字节的值
|
// 计算每个单独的数据块的大小 4个字节的序号 4个字节的时间 2个字节的值
|
||||||
// // 示例中的排布是 4个字节的序号 4个字节的时间 UA(2字节) UB(2字节) UC(2字节) IA(2字节) IB(2字节) IC(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 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 nBlockSize = 2 * Integer.SIZE / 8 + comtradeCfgDTO.getNAnalogNum() * 2 + nDigSize;
|
||||||
// // 总长度除以每个块的大小
|
// 总长度除以每个块的大小
|
||||||
// int nBlockNum = (int)Math.floor(datArray.length / nBlockSize);
|
int nBlockNum = (int)Math.floor(datArray.length / nBlockSize);
|
||||||
//
|
|
||||||
// // 获取采样率
|
// 获取采样率
|
||||||
// int finalSampleRate = getFinalWaveSample(comtradeCfgDTO.getLstRate(), iType);
|
int finalSampleRate = getFinalWaveSample(comtradeCfgDTO.getLstRate(), iType);
|
||||||
// if (finalSampleRate != -1) {
|
if (finalSampleRate != -1) {
|
||||||
// //设置最终采样率
|
//设置最终采样率
|
||||||
// comtradeCfgDTO.setFinalSampleRate(finalSampleRate);
|
comtradeCfgDTO.setFinalSampleRate(finalSampleRate);
|
||||||
// // 计算转换后的采样率
|
// 计算转换后的采样率
|
||||||
// int nnInd = 0;
|
int nnInd = 0;
|
||||||
// // 抽点后总共多少点数据
|
// 抽点后总共多少点数据
|
||||||
// int nWaveNum;
|
int nWaveNum;
|
||||||
// //抽点后新的的采样率
|
//抽点后新的的采样率
|
||||||
// List<RateDTO> newLstRate = new ArrayList<>();
|
List<RateDTO> newLstRate = new ArrayList<>();
|
||||||
// for (int iRate = 0; iRate < comtradeCfgDTO.getNRates(); iRate++) {
|
for (int iRate = 0; iRate < comtradeCfgDTO.getNRates(); iRate++) {
|
||||||
//// if (comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() >= 32) {
|
if (comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() >= 32) {
|
||||||
// // 计算本段录波总共有多少波形
|
// 计算本段录波总共有多少波形
|
||||||
// nWaveNum = comtradeCfgDTO.getLstRate().get(iRate).getNSampleNum() / comtradeCfgDTO.getLstRate().get(iRate).getNOneSample();
|
nWaveNum = comtradeCfgDTO.getLstRate().get(iRate).getNSampleNum() / comtradeCfgDTO.getLstRate().get(iRate).getNOneSample();
|
||||||
// //设置总波形大小
|
//设置总波形大小
|
||||||
// comtradeCfgDTO.setNAllWaveNum(comtradeCfgDTO.getNAllWaveNum() + nWaveNum);
|
comtradeCfgDTO.setNAllWaveNum(comtradeCfgDTO.getNAllWaveNum() + nWaveNum);
|
||||||
// // 将最低采样率替换到本段录波内
|
// 将最低采样率替换到本段录波内
|
||||||
// RateDTO tmpRateDTO = new RateDTO();
|
RateDTO tmpRateDTO = new RateDTO();
|
||||||
// // 有效值标志,如果是有效值,那么就需要反向补点,而不是抽点
|
// 有效值标志,如果是有效值,那么就需要反向补点,而不是抽点
|
||||||
// if (comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() >= 32) {
|
// if (comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() >= 32) {
|
||||||
// //YXB 2025-08-27
|
// //YXB 2025-08-27
|
||||||
// tmpRateDTO.bRMSFlag = false;
|
// tmpRateDTO.bRMSFlag = false;
|
||||||
@@ -814,52 +977,53 @@ public class WaveFileComponent {
|
|||||||
// //YXB 2025-08-27
|
// //YXB 2025-08-27
|
||||||
// tmpRateDTO.bRMSFlag = true;
|
// tmpRateDTO.bRMSFlag = true;
|
||||||
// }
|
// }
|
||||||
// newLstRate.add(tmpRateDTO);
|
newLstRate.add(tmpRateDTO);
|
||||||
// //iFlag =3 一定不进行抽点算法
|
//iFlag =3 一定不进行抽点算法
|
||||||
// if (iType != 3) {
|
if (iType != 3) {
|
||||||
// //true 抽点算法(当前采样率跟统一采样率不一样则是抽点,否则是未抽点)
|
//true 抽点算法(当前采样率跟统一采样率不一样则是抽点,否则是未抽点)
|
||||||
// if (!Objects.equals(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample(), comtradeCfgDTO.getFinalSampleRate())) {
|
if (!Objects.equals(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample(), comtradeCfgDTO.getFinalSampleRate())) {
|
||||||
// newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getFinalSampleRate());
|
newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getFinalSampleRate());
|
||||||
// // 计算本段录波按照最低采样点应该有多少录波
|
// 计算本段录波按照最低采样点应该有多少录波
|
||||||
// newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getFinalSampleRate() * nWaveNum);
|
newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getFinalSampleRate() * nWaveNum);
|
||||||
// } else {
|
} else {
|
||||||
// newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
||||||
// // 计算本段录波按照最低采样点应该有多少录波
|
// 计算本段录波按照最低采样点应该有多少录波
|
||||||
// newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() * nWaveNum);
|
newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() * nWaveNum);
|
||||||
// }
|
}
|
||||||
// } else {
|
} else {
|
||||||
// newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
newLstRate.get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
||||||
// // 计算本段录波按照最低采样点应该有多少录波
|
// 计算本段录波按照最低采样点应该有多少录波
|
||||||
// newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() * nWaveNum);
|
newLstRate.get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample() * nWaveNum);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // 正常的配置中采样率
|
// 正常的配置中采样率
|
||||||
// /* comtradeCfgDTO.getLstRate().get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
comtradeCfgDTO.getLstRate().get(nnInd).setNOneSample(comtradeCfgDTO.getLstRate().get(iRate).getNOneSample());
|
||||||
// comtradeCfgDTO.getLstRate().get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNSampleNum());*/
|
comtradeCfgDTO.getLstRate().get(nnInd).setNSampleNum(comtradeCfgDTO.getLstRate().get(iRate).getNSampleNum());
|
||||||
//
|
|
||||||
// nnInd++;
|
nnInd++;
|
||||||
//// }
|
}
|
||||||
// }
|
}
|
||||||
// // 偏移量,采样间隔
|
// 偏移量,采样间隔
|
||||||
// long nOffSet = 0, nWaveSpan;
|
long nOffSet = 0, nWaveSpan;
|
||||||
// //两个点之间的时间差
|
//两个点之间的时间差
|
||||||
// float fValue, dfValue;
|
float fValue, dfValue;
|
||||||
// // 计算不同块的采样率
|
// 计算不同块的采样率
|
||||||
// int nIndex = 0;
|
int nIndex = 0;
|
||||||
// // 将最低采样率替换到本段录波内
|
// 将最低采样率替换到本段录波内
|
||||||
// // .CFG中采样率
|
// .CFG中采样率
|
||||||
// RateDTO tmpRateDTO;
|
RateDTO tmpRateDTO;
|
||||||
// // nBlockNum 总循环次数
|
// nBlockNum 总循环次数
|
||||||
// for (int i = 0; i < nBlockNum; i++) {
|
for (int i = 0; i < nBlockNum; i++) {
|
||||||
// tmpRateDTO = comtradeCfgDTO.getLstRate().get(nIndex);
|
tmpRateDTO = comtradeCfgDTO.getLstRate().get(nIndex);
|
||||||
// // 判断是否进入下一段
|
// 判断是否进入下一段
|
||||||
// if (i == tmpRateDTO.getNSampleNum() + nOffSet) {
|
if (i == tmpRateDTO.getNSampleNum() + nOffSet) {
|
||||||
// nOffSet += tmpRateDTO.getNSampleNum();
|
nOffSet += tmpRateDTO.getNSampleNum();
|
||||||
// nIndex++;
|
nIndex++;
|
||||||
// if (nIndex == nnInd) {
|
if (nIndex == nnInd) {
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
nWaveSpan = tmpRateDTO.getNOneSample() / newLstRate.get(nIndex).getNOneSample();
|
||||||
// tmpRateDTO = comtradeCfgDTO.getLstRate().get(nIndex);
|
// tmpRateDTO = comtradeCfgDTO.getLstRate().get(nIndex);
|
||||||
// //YXB 2025-08-27 如果是有效值,那么需要去补点,而不是抽点
|
// //YXB 2025-08-27 如果是有效值,那么需要去补点,而不是抽点
|
||||||
// if (newLstRate.get(nIndex).bRMSFlag == true) {
|
// if (newLstRate.get(nIndex).bRMSFlag == true) {
|
||||||
@@ -869,199 +1033,99 @@ public class WaveFileComponent {
|
|||||||
// // 计算本段抽点采样间隔
|
// // 计算本段抽点采样间隔
|
||||||
// nWaveSpan = tmpRateDTO.getNOneSample() / newLstRate.get(nIndex).getNOneSample();
|
// nWaveSpan = tmpRateDTO.getNOneSample() / newLstRate.get(nIndex).getNOneSample();
|
||||||
// }
|
// }
|
||||||
//
|
|
||||||
// dfValue = (float) 20 / tmpRateDTO.getNOneSample();
|
dfValue = (float) 20 / tmpRateDTO.getNOneSample();
|
||||||
// // 判断是否到了需要抽的采样点
|
// 判断是否到了需要抽的采样点
|
||||||
// if (i % nWaveSpan == 0) {
|
if (i % nWaveSpan == 0) {
|
||||||
// // 计算每个通道的值
|
// 计算每个通道的值
|
||||||
// //存储局部数据集合,包含了时间,A,B,C三相
|
//存储局部数据集合,包含了时间,A,B,C三相
|
||||||
// List<Float> tmpWaveData = new ArrayList<>();
|
List<Float> tmpWaveData = new ArrayList<>();
|
||||||
// //YXB 2025-08-27 如果是有效值,那么需要去补点,而不是抽点
|
for (int j = 0; j < comtradeCfgDTO.getNAnalogNum(); j++) {
|
||||||
// if (newLstRate.get(nIndex).bRMSFlag == true) {
|
//数据只有电压ABC三相数据,不展示U0、I0等数据 YXB2020-10-09 去除相别为N相的数据
|
||||||
// // 计算有多少个周波
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzPhasicName().equalsIgnoreCase("N")) {
|
||||||
// long allWaveTemp = newLstRate.get(nIndex).getNSampleNum() / newLstRate.get(nIndex).getNOneSample();
|
break;
|
||||||
// // 本段需要补多少点
|
}
|
||||||
// long allempSample = newLstRate.get(nIndex).getNOneSample();
|
|
||||||
// //int iStartWaveTemp = i ;// 开始补点的起点
|
float fCoef = comtradeCfgDTO.getLstAnalogDTO().get(j).getFCoefficent();
|
||||||
// for (int iWaveTemp = 0; iWaveTemp < allWaveTemp; iWaveTemp++) {
|
fValue = BitConverter.byte2ToUnsignedShort(datArray, i * nBlockSize + 2 * 4 + j * 2) * fCoef;
|
||||||
// for (int mTempSample = 0; mTempSample < allempSample; mTempSample++) {
|
|
||||||
// //最多只有半波有效值,也就是每周波是1个或者2个点,然后去补最少16个点
|
//WW 2019-11-14
|
||||||
// if (mTempSample / nWaveSpan == 1 && mTempSample % nWaveSpan == 0) {
|
/**************************
|
||||||
// i++;
|
* 1、接口返回的默认是二次值
|
||||||
// }
|
* 2、P是一次值 S是二次值
|
||||||
// //存储局部数据集合,包含了时间,A,B,C三相
|
* 3、S(二次值)情况下:
|
||||||
// tmpWaveData = new ArrayList<>();
|
* ①、单位为"V"时候则直接等于;
|
||||||
// for (int j = 0; j < comtradeCfgDTO.getNAnalogNum(); j++) {
|
* ②、单位为"kV"时候需要乘以1000
|
||||||
// //数据只有电压ABC三相数据,不展示U0、I0等数据 YXB2020-10-09 去除相别为N相的数据
|
* 4、P(一次值)情况下:
|
||||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzPhasicName().equalsIgnoreCase("N")) {
|
* ①、单位为"V"时候则直接等于;
|
||||||
// break;
|
* ②、单位为"kV"时候需要乘以1000
|
||||||
// }
|
**************************/
|
||||||
// float fCoef = comtradeCfgDTO.getLstAnalogDTO().get(j).getFCoefficent();
|
//P是一次值 S是二次值
|
||||||
//
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("S")) {
|
||||||
// if((i * nBlockSize + 2 * 4 + j * 2) == 2437568){
|
//判断单位是V还是kV
|
||||||
// System.out.println(55);
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
||||||
// }
|
fValue = fValue * 1000.0f;
|
||||||
// fValue = BitConverter.byte2ToUnsignedShort(datArray, i * nBlockSize + 2 * 4 + j * 2) * fCoef;
|
} else {
|
||||||
// //WW 2019-11-14
|
fValue = fValue;
|
||||||
// /*************************
|
}
|
||||||
// * 1、接口返回的默认是二次值
|
}
|
||||||
// * 2、P是一次值 S是二次值
|
//P是一次值 S是二次值
|
||||||
// * 3、S(二次值)情况下:
|
else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("P")) {
|
||||||
// * ①、单位为"V"时候则直接等于;
|
//判断单位是V还是kV
|
||||||
// * ②、单位为"kV"时候需要乘以1000
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("V")) {
|
||||||
// * 4、P(一次值)情况下:
|
//根据cfg内的变比,将一次值转换成二次值
|
||||||
// * ①、单位为"V"时候则直接等于;
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||||
// * ②、单位为"kV"时候需要乘以1000
|
fValue = fValue * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||||
// *************************/
|
} else {
|
||||||
// //P是一次值 S是二次值
|
fValue = fValue;
|
||||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("S")) {
|
}
|
||||||
// //判断单位是V还是kV
|
}
|
||||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
//判断单位是V还是kV
|
||||||
// fValue = fValue * 1000.0f;
|
else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
||||||
// } else {
|
//根据cfg内的变比,将一次值转换成二次值
|
||||||
// fValue = fValue;
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||||
// }
|
fValue = fValue * 1000.0f * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||||
// }
|
} else {
|
||||||
// //P是一次值 S是二次值
|
fValue = fValue;
|
||||||
// else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzValueType().equalsIgnoreCase("P")) {
|
}
|
||||||
// //判断单位是V还是kV
|
} else //还有可能是 电流,单位是A
|
||||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("V")) {
|
{
|
||||||
// //根据cfg内的变比,将一次值转换成二次值
|
//根据cfg内的变比,将一次值转换成二次值
|
||||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
||||||
// fValue = fValue * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
fValue = fValue *comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
||||||
// } else {
|
} else {
|
||||||
// fValue = fValue;
|
fValue = fValue;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// //判断单位是V还是kV
|
}
|
||||||
// else if (comtradeCfgDTO.getLstAnalogDTO().get(j).getSzUnitName().equalsIgnoreCase("KV")) {
|
//xValue前移量,假如是第一次时候则需要前移
|
||||||
// //根据cfg内的变比,将一次值转换成二次值
|
if (!blxValue && j == 0) {
|
||||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
xValueAll = (float) (i * 20) / tmpRateDTO.getNOneSample() - comtradeCfgDTO.getNPush();
|
||||||
// fValue = fValue * 1000.0f * comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
blxValue = true;
|
||||||
// } else {
|
//只增加一个xValue的值 //增加时间值
|
||||||
// fValue = fValue;
|
tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
||||||
// }
|
} else if (j == 0) {
|
||||||
// } else //还有可能是 电流,单位是A
|
xValueAll += (float) nWaveSpan * dfValue;
|
||||||
// {
|
//只增加一个xValue的值 //增加时间值
|
||||||
// //根据cfg内的变比,将一次值转换成二次值
|
tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
||||||
// if (comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary() != 0.0f) {
|
}
|
||||||
// fValue = comtradeCfgDTO.getLstAnalogDTO().get(j).getFSecondary() / comtradeCfgDTO.getLstAnalogDTO().get(j).getFPrimary();
|
|
||||||
// } else {
|
//不同通道yValue的值都需要增加,最终成ABC三相 //每个通道的值
|
||||||
// fValue = fValue;
|
tmpWaveData.add((float) (Math.round(fValue * 100)) / 100);
|
||||||
// }
|
}
|
||||||
// }
|
//把每个单独的值赋予到整体里面去
|
||||||
// }
|
listWaveData.add(tmpWaveData);
|
||||||
//
|
|
||||||
// //xValue前移量,假如是第一次时候则需要前移
|
}
|
||||||
// if (!blxValue && j == 0) {
|
}
|
||||||
// xValueAll = (float) (i * 20) / tmpRateDTO.getNOneSample() - comtradeCfgDTO.getNPush();
|
}
|
||||||
// blxValue = true;
|
} catch (Exception e) {
|
||||||
// //只增加一个xValue的值 //增加时间值
|
e.printStackTrace();
|
||||||
// tmpWaveData.add((float) (Math.round(xValueAll * 100)) / 100);
|
throw new BusinessException(WaveFileResponseEnum.DAT_DATA_ERROR);
|
||||||
// } else if (j == 0) {
|
}
|
||||||
// xValueAll += (float) dfValue / nWaveSpan;
|
|
||||||
// //只增加一个xValue的值 //增加时间值
|
return listWaveData;
|
||||||
// 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;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
@@ -1656,10 +1720,10 @@ public class WaveFileComponent {
|
|||||||
s = sdf.format(d);
|
s = sdf.format(d);
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
WaveFileComponent waveFileComponent = new WaveFileComponent();
|
WaveFileComponent waveFileComponent = new WaveFileComponent();
|
||||||
InputStream cfgStream = waveFileComponent.getFileInputStreamByFilePath("C:\\Users\\Administrator\\Desktop\\wave\\PQMonitor_PQM2_006970_20260320_175033_734.CFG");
|
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\\Administrator\\Desktop\\wave\\PQMonitor_PQM2_006970_20260320_175033_734.DAT");
|
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();
|
d = new Date();
|
||||||
s = sdf.format(d);
|
s = sdf.format(d);
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ package com.njcn.redis.utils;
|
|||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||||
import org.springframework.data.redis.core.RedisCallback;
|
import org.springframework.data.redis.core.*;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
@@ -325,8 +323,25 @@ public class RedisUtil {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<?> getLikeListAllValues(String key) {
|
public List<?> getLikeListAllValues(String key) {
|
||||||
List<Object> info=new ArrayList<>();
|
List<Object> info = new ArrayList<>();
|
||||||
for (String s : redisTemplate.keys(key + "*")) {
|
// 使用 SCAN 替代 keys,解决 Tair 禁用 KEYS 命令的问题
|
||||||
|
Set<String> keys = redisTemplate.execute((RedisCallback<Set<String>>) connection -> {
|
||||||
|
Set<String> keySet = new HashSet<>();
|
||||||
|
ScanOptions options = ScanOptions.scanOptions()
|
||||||
|
.match(key + "*")
|
||||||
|
.count(1000)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try (Cursor<byte[]> cursor = connection.scan(options)) {
|
||||||
|
while (cursor.hasNext()) {
|
||||||
|
keySet.add(new String(cursor.next()));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Redis SCAN 模糊查询失败", e);
|
||||||
|
}
|
||||||
|
return keySet;
|
||||||
|
});
|
||||||
|
for (String s : keys) {
|
||||||
info.add(redisTemplate.opsForValue().get(s));
|
info.add(redisTemplate.opsForValue().get(s));
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.njcn.device.pq.pojo.po;
|
package com.njcn.device.pq.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -17,6 +19,7 @@ import java.io.Serializable;
|
|||||||
public class DeviceProcess implements Serializable {
|
public class DeviceProcess implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
//设备id
|
//设备id
|
||||||
|
@TableId("Id")
|
||||||
private String id;
|
private String id;
|
||||||
//设备设备所在前置机进程号
|
//设备设备所在前置机进程号
|
||||||
private Integer processNo;
|
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> devIndexes = generalDeviceDTOList.stream().flatMap(list -> list.getDeviceIndexes().stream()).collect(Collectors.toList());
|
||||||
List<String> manuList = runManageParam.getManufacturer().stream().map(SimpleDTO::getId).collect(Collectors.toList());
|
List<String> manuList = runManageParam.getManufacturer().stream().map(SimpleDTO::getId).collect(Collectors.toList());
|
||||||
if (CollectionUtil.isEmpty(devIndexes)) {
|
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());
|
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())
|
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.getPt1(), lineDetailRes.getPt1()) || !Objects.equals(lineDetail.getPt2(), lineDetailRes.getPt2())
|
||||||
|| !Objects.equals(lineDetail.getDevCapacity(), lineDetailRes.getDevCapacity()) || !Objects.equals(lineDetail.getShortCapacity(), lineDetailRes.getShortCapacity())
|
|| !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();
|
String index = RequestUtil.getUserIndex();
|
||||||
queryUpdateAndInsertLog(userName, index, lineDetail, lineDetailRes);
|
queryUpdateAndInsertLog(userName, index, lineDetail, lineDetailRes);
|
||||||
@@ -959,6 +960,11 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
sbNew.append("协议容量: ").append(newLine.getDealCapacity()).append(";");
|
sbNew.append("协议容量: ").append(newLine.getDealCapacity()).append(";");
|
||||||
sbOld.append("协议容量: ").append(oldLine.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);
|
sb.append(sbNew).append(sbOld);
|
||||||
HttpResult<DictData> dicDataByCode = dicDataFeignClient.getDicDataByCode(DicDataEnum.LINE_PARAMETER.getCode());
|
HttpResult<DictData> dicDataByCode = dicDataFeignClient.getDicDataByCode(DicDataEnum.LINE_PARAMETER.getCode());
|
||||||
DictData data = dicDataByCode.getData();
|
DictData data = dicDataByCode.getData();
|
||||||
@@ -3851,14 +3857,29 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
|||||||
}
|
}
|
||||||
//设备删除找不到设备名称,重日志截取
|
//设备删除找不到设备名称,重日志截取
|
||||||
if (Objects.equals(temp.getOperateType(), Param.DEL)) {
|
if (Objects.equals(temp.getOperateType(), Param.DEL)) {
|
||||||
String temLos = "%s名称:%s;前置信息:%s";
|
//删除有2种情况,1.设备删除,2,设备状态修改;
|
||||||
List<String> strings = this.parseTemplateValues(temLos, temp.getTerminalDescribe());
|
if (lineMap.containsKey(deviceId)) {
|
||||||
String devName = strings.get(1); // 设备名称
|
pqsTerminalPushLogDTO.setDevName(lineMap.get(deviceId).getName());
|
||||||
String nodeName = strings.get(2); // 进程名称
|
String nodeId = deviceMap.get(deviceId).getNodeId();
|
||||||
pqsTerminalPushLogDTO.setDevName(devName);
|
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
||||||
String nodeId = nodeNameMap.get(nodeName).getId();
|
pqsTerminalPushLogDTO.setNodeName(nodeMap.containsKey(nodeId)?nodeMap.get(nodeId).getName():"删除前置");
|
||||||
pqsTerminalPushLogDTO.setNodeId(nodeId);
|
|
||||||
pqsTerminalPushLogDTO.setNodeName(nodeName);
|
}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 {
|
} else {
|
||||||
//如果存在说明设备未被删除,不存在说明有一条删除日志,直接return;
|
//如果存在说明设备未被删除,不存在说明有一条删除日志,直接return;
|
||||||
if (lineMap.containsKey(deviceId)) {
|
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.mapper.SuperDataMapper;
|
||||||
import com.njcn.device.common.service.GeneralDeviceService;
|
import com.njcn.device.common.service.GeneralDeviceService;
|
||||||
import com.njcn.device.device.mapper.DevFuctionMapper;
|
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.IDevMealService;
|
||||||
import com.njcn.device.device.service.IDevStrategyService;
|
import com.njcn.device.device.service.IDevStrategyService;
|
||||||
import com.njcn.device.device.service.IDeviceService;
|
import com.njcn.device.device.service.IDeviceService;
|
||||||
import com.njcn.device.line.service.LineService;
|
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.enums.LineBaseEnum;
|
||||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||||
import com.njcn.device.pq.pojo.param.*;
|
import com.njcn.device.pq.pojo.param.*;
|
||||||
@@ -84,6 +86,7 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService {
|
|||||||
|
|
||||||
private final CldStatisticsFlowMapper cldStatisticsFlowMapper;
|
private final CldStatisticsFlowMapper cldStatisticsFlowMapper;
|
||||||
private final LineService lineService;
|
private final LineService lineService;
|
||||||
|
private final DeviceProcessService deviceProcessService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TerminalMaintainVO> getTerminalMainList(TerminalMainQueryParam terminalMainQueryParam) {
|
public List<TerminalMaintainVO> getTerminalMainList(TerminalMainQueryParam terminalMainQueryParam) {
|
||||||
@@ -205,7 +208,19 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService {
|
|||||||
terminalLogsNew.setObjIndex(device.getId());
|
terminalLogsNew.setObjIndex(device.getId());
|
||||||
terminalLogsNew.setTerminalDescribe(sb.toString());
|
terminalLogsNew.setTerminalDescribe(sb.toString());
|
||||||
terminalLogsNew.setIsPush(0);
|
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.setLogsType(data.getId());
|
||||||
terminalLogsNew.setTerminalType(LineBaseEnum.DEVICE_LEVEL.getCode());
|
terminalLogsNew.setTerminalType(LineBaseEnum.DEVICE_LEVEL.getCode());
|
||||||
terminalLogsNew.setState(DataStateEnum.ENABLE.getCode());
|
terminalLogsNew.setState(DataStateEnum.ENABLE.getCode());
|
||||||
|
|||||||
@@ -175,37 +175,40 @@ public class EventDetailServiceImpl extends ServiceImpl<RmpEventDetailMapper, Rm
|
|||||||
//如果不为空,说明是二次上传波形文件了;
|
//如果不为空,说明是二次上传波形文件了;
|
||||||
String reason,type;
|
String reason,type;
|
||||||
if(!StringUtils.isEmpty(rmpEventDetailPO.getWavePath())){
|
if(!StringUtils.isEmpty(rmpEventDetailPO.getWavePath())){
|
||||||
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(rmpEventDetailPO.getLineId()).getData();
|
try {
|
||||||
String ip = lineDetailData.getIp();
|
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(rmpEventDetailPO.getLineId()).getData();
|
||||||
EventAnalysisDTO eventAnalysisDTO = new EventAnalysisDTO();
|
String ip = lineDetailData.getIp();
|
||||||
eventAnalysisDTO.setIp(ip);
|
EventAnalysisDTO eventAnalysisDTO = new EventAnalysisDTO();
|
||||||
eventAnalysisDTO.setWaveName(rmpEventDetailPO.getWavePath());
|
eventAnalysisDTO.setIp(ip);
|
||||||
|
eventAnalysisDTO.setWaveName(rmpEventDetailPO.getWavePath());
|
||||||
|
|
||||||
EventAnalysisDTO result = eventCauseFeignClient.analysisCauseAndType(eventAnalysisDTO).getData();
|
EventAnalysisDTO result = eventCauseFeignClient.analysisCauseAndType(eventAnalysisDTO).getData();
|
||||||
if(Objects.isNull(result.getCause())){
|
if(Objects.isNull(result.getCause())){
|
||||||
reason =reasonReflection(0);
|
reason =reasonReflection(0);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
reason =reasonReflection(result.getCause());
|
reason =reasonReflection(result.getCause());
|
||||||
|
|
||||||
}
|
}
|
||||||
if(Objects.isNull(result.getType())){
|
if(Objects.isNull(result.getType())){
|
||||||
type =advanceTypeReflection(10);
|
type =advanceTypeReflection(10);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
type =advanceTypeReflection(result.getType());
|
type =advanceTypeReflection(result.getType());
|
||||||
|
|
||||||
}
|
}
|
||||||
DictData advancereason = dicDataFeignClient.getDicDataByCode(reason).getData();
|
DictData advancereason = dicDataFeignClient.getDicDataByCode(reason).getData();
|
||||||
DictData advanceType = dicDataFeignClient.getDicDataByCode(type).getData();
|
DictData advanceType = dicDataFeignClient.getDicDataByCode(type).getData();
|
||||||
if(Objects.equals(result.getCauseFlag(),1)&&Objects.equals(result.getTypeFlag(),1)){
|
if(Objects.equals(result.getCauseFlag(),1)&&Objects.equals(result.getTypeFlag(),1)){
|
||||||
rmpEventDetailPO.setDealFlag(1);
|
rmpEventDetailPO.setDealFlag(1);
|
||||||
}else {
|
}else {
|
||||||
|
rmpEventDetailPO.setDealFlag(0);
|
||||||
|
}
|
||||||
|
rmpEventDetailPO.setAdvanceReason(advancereason.getId());
|
||||||
|
rmpEventDetailPO.setAdvanceType(advanceType.getId());
|
||||||
|
}catch (Exception e){
|
||||||
rmpEventDetailPO.setDealFlag(0);
|
rmpEventDetailPO.setDealFlag(0);
|
||||||
}
|
}
|
||||||
rmpEventDetailPO.setAdvanceReason(advancereason.getId());
|
|
||||||
rmpEventDetailPO.setAdvanceType(advanceType.getId());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//默认都是其他
|
//默认都是其他
|
||||||
// DictData reason = dicDataFeignClient.getDicDataByCode(DicDataEnum.RESON_REST.getCode()).getData();
|
// DictData reason = dicDataFeignClient.getDicDataByCode(DicDataEnum.RESON_REST.getCode()).getData();
|
||||||
|
|||||||
@@ -80,11 +80,11 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<!-- <dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>energy-api</artifactId>
|
<artifactId>energy-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.algorithm.pojo.bo.BaseParam;
|
import com.njcn.algorithm.pojo.bo.BaseParam;
|
||||||
import com.njcn.algorithm.pojo.liteflow.LiteFlowAlgorithmFeignClient;
|
import com.njcn.algorithm.pojo.liteflow.LiteFlowAlgorithmFeignClient;
|
||||||
import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|||||||
@@ -1,39 +1,39 @@
|
|||||||
package com.njcn.system.timer.tasks;
|
//package com.njcn.system.timer.tasks;
|
||||||
|
//
|
||||||
import cn.hutool.core.date.DatePattern;
|
//import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
//import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
//import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
//import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
||||||
import com.njcn.prepare.harmonic.pojo.bo.BaseParam;
|
//import com.njcn.prepare.harmonic.pojo.bo.BaseParam;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 类的介绍:母线算法执行链定时任务
|
// * 类的介绍:母线算法执行链定时任务
|
||||||
*
|
// *
|
||||||
* @author xuyang
|
// * @author xuyang
|
||||||
* @version 1.0.0
|
// * @version 1.0.0
|
||||||
* @createTime 2023/12/6 9:35
|
// * @createTime 2023/12/6 9:35
|
||||||
*/
|
// */
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
public class GeneraTrixTaskRunner implements TimerTaskRunner {
|
//public class GeneraTrixTaskRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final LiteFlowFeignClient liteFlowFeignClient;
|
// private final LiteFlowFeignClient liteFlowFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
BaseParam baseParam = new BaseParam();
|
// BaseParam baseParam = new BaseParam();
|
||||||
baseParam.setFullChain(true);
|
// baseParam.setFullChain(true);
|
||||||
baseParam.setRepair(false);
|
// baseParam.setRepair(false);
|
||||||
if(StrUtil.isBlank(date)){
|
// if(StrUtil.isBlank(date)){
|
||||||
baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
|
// baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
|
||||||
}else {
|
// }else {
|
||||||
baseParam.setDataDate(date);
|
// baseParam.setDataDate(date);
|
||||||
}
|
// }
|
||||||
liteFlowFeignClient.generaTrixExecutor(baseParam);
|
// liteFlowFeignClient.generaTrixExecutor(baseParam);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,42 +1,42 @@
|
|||||||
package com.njcn.system.timer.tasks;
|
//package com.njcn.system.timer.tasks;
|
||||||
|
//
|
||||||
import cn.hutool.core.date.DatePattern;
|
//import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
//import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
//import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
//import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
||||||
import com.njcn.prepare.harmonic.pojo.bo.BaseParam;
|
//import com.njcn.prepare.harmonic.pojo.bo.BaseParam;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 类的介绍:监测点算法执行链定时任务
|
// * 类的介绍:监测点算法执行链定时任务
|
||||||
*
|
// *
|
||||||
* @author xuyang
|
// * @author xuyang
|
||||||
* @version 1.0.0
|
// * @version 1.0.0
|
||||||
* @createTime 2023/12/6 9:35
|
// * @createTime 2023/12/6 9:35
|
||||||
*/
|
// */
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
public class MeasurementHourTaskRunner implements TimerTaskRunner {
|
//public class MeasurementHourTaskRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final LiteFlowFeignClient liteFlowFeignClient;
|
// private final LiteFlowFeignClient liteFlowFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
BaseParam baseParam = new BaseParam();
|
// BaseParam baseParam = new BaseParam();
|
||||||
baseParam.setFullChain(true);
|
// baseParam.setFullChain(true);
|
||||||
//由于是按小时跑的,前端其他算法都是按天跑的,因此修改参数
|
// //由于是按小时跑的,前端其他算法都是按天跑的,因此修改参数
|
||||||
if(StrUtil.isBlank(date)){
|
// if(StrUtil.isBlank(date)){
|
||||||
baseParam.setRepair(false);
|
// baseParam.setRepair(false);
|
||||||
baseParam.setDataDate(DateUtil.now());
|
// baseParam.setDataDate(DateUtil.now());
|
||||||
}else {
|
// }else {
|
||||||
baseParam.setRepair(true);
|
// baseParam.setRepair(true);
|
||||||
baseParam.setBeginTime(date+ " 00:00:00");
|
// baseParam.setBeginTime(date+ " 00:00:00");
|
||||||
baseParam.setEndTime(date+ " 24:00:00");
|
// baseParam.setEndTime(date+ " 24:00:00");
|
||||||
}
|
// }
|
||||||
liteFlowFeignClient.measurementPointExecutorByHour(baseParam);
|
// liteFlowFeignClient.measurementPointExecutorByHour(baseParam);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.algorithm.pojo.bo.BaseParam;
|
import com.njcn.algorithm.pojo.bo.BaseParam;
|
||||||
import com.njcn.algorithm.pojo.liteflow.LiteFlowAlgorithmFeignClient;
|
import com.njcn.algorithm.pojo.liteflow.LiteFlowAlgorithmFeignClient;
|
||||||
import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -21,8 +20,6 @@ import org.springframework.stereotype.Component;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class MeasurementTaskRunner implements TimerTaskRunner {
|
public class MeasurementTaskRunner implements TimerTaskRunner {
|
||||||
|
|
||||||
private final LiteFlowFeignClient liteFlowFeignClient;
|
|
||||||
|
|
||||||
private final LiteFlowAlgorithmFeignClient liteFlowAlgorithmFeignClient;
|
private final LiteFlowAlgorithmFeignClient liteFlowAlgorithmFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,39 +1,39 @@
|
|||||||
package com.njcn.system.timer.tasks;
|
//package com.njcn.system.timer.tasks;
|
||||||
|
//
|
||||||
import cn.hutool.core.date.DatePattern;
|
//import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
//import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
//import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
//import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
||||||
import com.njcn.prepare.harmonic.pojo.bo.BaseParam;
|
//import com.njcn.prepare.harmonic.pojo.bo.BaseParam;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 类的介绍:监测点算法执行链定时任务
|
// * 类的介绍:监测点算法执行链定时任务
|
||||||
*
|
// *
|
||||||
* @author xuyang
|
// * @author xuyang
|
||||||
* @version 1.0.0
|
// * @version 1.0.0
|
||||||
* @createTime 2023/12/6 9:35
|
// * @createTime 2023/12/6 9:35
|
||||||
*/
|
// */
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
public class OrgSubStationTaskRunner implements TimerTaskRunner {
|
//public class OrgSubStationTaskRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final LiteFlowFeignClient liteFlowFeignClient;
|
// private final LiteFlowFeignClient liteFlowFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
BaseParam baseParam = new BaseParam();
|
// BaseParam baseParam = new BaseParam();
|
||||||
baseParam.setFullChain(true);
|
// baseParam.setFullChain(true);
|
||||||
baseParam.setRepair(false);
|
// baseParam.setRepair(false);
|
||||||
if(StrUtil.isBlank(date)){
|
// if(StrUtil.isBlank(date)){
|
||||||
baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
|
// baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
|
||||||
}else {
|
// }else {
|
||||||
baseParam.setDataDate(date);
|
// baseParam.setDataDate(date);
|
||||||
}
|
// }
|
||||||
liteFlowFeignClient.orgSubStationExecutor(baseParam);
|
// liteFlowFeignClient.orgSubStationExecutor(baseParam);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,38 +1,38 @@
|
|||||||
package com.njcn.system.timer.tasks;
|
//package com.njcn.system.timer.tasks;
|
||||||
|
//
|
||||||
import cn.hutool.core.date.DatePattern;
|
//import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
//import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
//import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.algorithm.pojo.bo.BaseParam;
|
//import com.njcn.algorithm.pojo.bo.BaseParam;
|
||||||
import com.njcn.algorithm.pojo.liteflow.LiteFlowAlgorithmFeignClient;
|
//import com.njcn.algorithm.pojo.liteflow.LiteFlowAlgorithmFeignClient;
|
||||||
import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
//import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 类的介绍:单位监测点算法执行链定时任务
|
// * 类的介绍:单位监测点算法执行链定时任务
|
||||||
*
|
// *
|
||||||
* @author xuyang
|
// * @author xuyang
|
||||||
* @version 1.0.0
|
// * @version 1.0.0
|
||||||
* @createTime 2023/12/6 9:35
|
// * @createTime 2023/12/6 9:35
|
||||||
*/
|
// */
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
public class OrgTaskRunner implements TimerTaskRunner {
|
//public class OrgTaskRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final LiteFlowAlgorithmFeignClient liteFlowFeignClient;
|
// private final LiteFlowAlgorithmFeignClient liteFlowFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
BaseParam baseParam = new BaseParam();
|
// BaseParam baseParam = new BaseParam();
|
||||||
baseParam.setFullChain(true);
|
// baseParam.setFullChain(true);
|
||||||
baseParam.setRepair(false);
|
// baseParam.setRepair(false);
|
||||||
if(StrUtil.isBlank(date)){
|
// if(StrUtil.isBlank(date)){
|
||||||
baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
|
// baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
|
||||||
}else {
|
// }else {
|
||||||
baseParam.setDataDate(date);
|
// baseParam.setDataDate(date);
|
||||||
}
|
// }
|
||||||
liteFlowFeignClient.orgPointExecutor(baseParam);
|
// liteFlowFeignClient.orgPointExecutor(baseParam);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,37 +1,37 @@
|
|||||||
package com.njcn.system.timer.tasks;
|
//package com.njcn.system.timer.tasks;
|
||||||
|
//
|
||||||
import cn.hutool.core.date.DatePattern;
|
//import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
//import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
//import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
//import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
||||||
import com.njcn.prepare.harmonic.pojo.bo.BaseParam;
|
//import com.njcn.prepare.harmonic.pojo.bo.BaseParam;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 类的介绍:变电站母线算法执行链定时任务
|
// * 类的介绍:变电站母线算法执行链定时任务
|
||||||
*
|
// *
|
||||||
* @author xuyang
|
// * @author xuyang
|
||||||
* @version 1.0.0
|
// * @version 1.0.0
|
||||||
* @createTime 2023/12/6 9:35
|
// * @createTime 2023/12/6 9:35
|
||||||
*/
|
// */
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
public class PmsDimTaskRunner implements TimerTaskRunner {
|
//public class PmsDimTaskRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final LiteFlowFeignClient liteFlowFeignClient;
|
// private final LiteFlowFeignClient liteFlowFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
BaseParam baseParam = new BaseParam();
|
// BaseParam baseParam = new BaseParam();
|
||||||
baseParam.setFullChain(true);
|
// baseParam.setFullChain(true);
|
||||||
baseParam.setRepair(false);
|
// baseParam.setRepair(false);
|
||||||
if(StrUtil.isBlank(date)){
|
// if(StrUtil.isBlank(date)){
|
||||||
baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
|
// baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
|
||||||
}else {
|
// }else {
|
||||||
baseParam.setDataDate(date);
|
// baseParam.setDataDate(date);
|
||||||
}
|
// }
|
||||||
liteFlowFeignClient.pmsDimExecutor(baseParam);
|
// liteFlowFeignClient.pmsDimExecutor(baseParam);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,32 +1,32 @@
|
|||||||
package com.njcn.system.timer.tasks;
|
//package com.njcn.system.timer.tasks;
|
||||||
|
//
|
||||||
import cn.hutool.core.date.DatePattern;
|
//import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
//import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
//import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
//import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||||
import com.njcn.prepare.harmonic.api.upload.DimBusGlobalFeignClient;
|
//import com.njcn.prepare.harmonic.api.upload.DimBusGlobalFeignClient;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* pqs
|
// * pqs
|
||||||
*
|
// *
|
||||||
* @author cdf
|
// * @author cdf
|
||||||
* @date 2024/4/17
|
// * @date 2024/4/17
|
||||||
*/
|
// */
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
public class PmsRunStatisticTaskRunner implements TimerTaskRunner {
|
//public class PmsRunStatisticTaskRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final DimBusGlobalFeignClient dimBusGlobalFeignClient;
|
// private final DimBusGlobalFeignClient dimBusGlobalFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
if(StrUtil.isBlank(date)){
|
// if(StrUtil.isBlank(date)){
|
||||||
date = DateUtil.format(DateUtil.yesterday(),DatePattern.NORM_DATE_PATTERN);
|
// date = DateUtil.format(DateUtil.yesterday(),DatePattern.NORM_DATE_PATTERN);
|
||||||
}
|
// }
|
||||||
dimBusGlobalFeignClient.runLedgerStatistic(date);
|
// dimBusGlobalFeignClient.runLedgerStatistic(date);
|
||||||
dimBusGlobalFeignClient.dimBusUpEveryDay(date);
|
// dimBusGlobalFeignClient.dimBusUpEveryDay(date);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,113 +1,113 @@
|
|||||||
package com.njcn.system.timer.tasks;
|
//package com.njcn.system.timer.tasks;
|
||||||
|
//
|
||||||
import cn.hutool.core.date.DateUtil;
|
//import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
//import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
//import com.njcn.common.pojo.constant.BizParamConstant;
|
||||||
import com.njcn.prepare.harmonic.api.newalgorithm.PmsStatisticsSpecialMonitorFeignClient;
|
//import com.njcn.prepare.harmonic.api.newalgorithm.PmsStatisticsSpecialMonitorFeignClient;
|
||||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
//import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
import java.text.SimpleDateFormat;
|
//import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
//import java.time.LocalDateTime;
|
||||||
import java.util.Calendar;
|
//import java.util.Calendar;
|
||||||
import java.util.Date;
|
//import java.util.Date;
|
||||||
import java.util.Objects;
|
//import java.util.Objects;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 类的介绍:专项分析-台账统计定时任务
|
// * 类的介绍:专项分析-台账统计定时任务
|
||||||
*
|
// *
|
||||||
* @author xuyang
|
// * @author xuyang
|
||||||
* @version 1.0.0
|
// * @version 1.0.0
|
||||||
* @createTime 2023/12/08 11:23
|
// * @createTime 2023/12/08 11:23
|
||||||
*/
|
// */
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
public class PmsStatisticsSpecialMonitorTaskRunner implements TimerTaskRunner {
|
//public class PmsStatisticsSpecialMonitorTaskRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final PmsStatisticsSpecialMonitorFeignClient pmsStatisticsSpecialMonitorFeignClient;
|
// private final PmsStatisticsSpecialMonitorFeignClient pmsStatisticsSpecialMonitorFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
log.info(LocalDateTime.now()+"专项分析-台账统计调度开始");
|
// log.info(LocalDateTime.now()+"专项分析-台账统计调度开始");
|
||||||
LineParam lineParam = new LineParam();
|
// LineParam lineParam = new LineParam();
|
||||||
lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
|
// lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
|
||||||
lineParam.setDataDate(this.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
|
// lineParam.setDataDate(this.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
|
||||||
this.commDefineDate(BizParamConstant.STAT_BIZ_MONTH,lineParam);
|
// this.commDefineDate(BizParamConstant.STAT_BIZ_MONTH,lineParam);
|
||||||
pmsStatisticsSpecialMonitorFeignClient.pmsStatisticsSpecialMonitorHandler(lineParam);
|
// pmsStatisticsSpecialMonitorFeignClient.pmsStatisticsSpecialMonitorHandler(lineParam);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String prepareTimeDeal(String command) {
|
// public String prepareTimeDeal(String command) {
|
||||||
if (StrUtil.isBlank(command)) {
|
// if (StrUtil.isBlank(command)) {
|
||||||
log.error(LocalDateTime.now() + "xxl调度任务参数未设置");
|
// log.error(LocalDateTime.now() + "xxl调度任务参数未设置");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
Calendar calendar = Calendar.getInstance();
|
// Calendar calendar = Calendar.getInstance();
|
||||||
if (Objects.equals(BizParamConstant.STAT_BIZ_DAY, command)) {
|
// if (Objects.equals(BizParamConstant.STAT_BIZ_DAY, command)) {
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
// calendar.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
} else if (Objects.equals(BizParamConstant.STAT_BIZ_MONTH, command)) {
|
// } else if (Objects.equals(BizParamConstant.STAT_BIZ_MONTH, command)) {
|
||||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
// calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
} else if (Objects.equals(BizParamConstant.STAT_BIZ_QUARTER, command)) {
|
// } else if (Objects.equals(BizParamConstant.STAT_BIZ_QUARTER, command)) {
|
||||||
int nowMonth = calendar.get(Calendar.MONTH);
|
// int nowMonth = calendar.get(Calendar.MONTH);
|
||||||
calendar.set(Calendar.MONTH, nowMonth - (nowMonth % 3));
|
// calendar.set(Calendar.MONTH, nowMonth - (nowMonth % 3));
|
||||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
// calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
// calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
calendar.set(Calendar.MINUTE, 0);
|
// calendar.set(Calendar.MINUTE, 0);
|
||||||
calendar.set(Calendar.SECOND, 0);
|
// calendar.set(Calendar.SECOND, 0);
|
||||||
calendar.set(Calendar.MILLISECOND, 0);
|
// calendar.set(Calendar.MILLISECOND, 0);
|
||||||
} else if (Objects.equals(BizParamConstant.STAT_BIZ_YEAR, command)) {
|
// } else if (Objects.equals(BizParamConstant.STAT_BIZ_YEAR, command)) {
|
||||||
calendar.set(Calendar.DAY_OF_YEAR, 1);
|
// calendar.set(Calendar.DAY_OF_YEAR, 1);
|
||||||
}
|
// }
|
||||||
log.info("job调度时间:" + sdf.format(calendar.getTime()));
|
// log.info("job调度时间:" + sdf.format(calendar.getTime()));
|
||||||
return sdf.format(calendar.getTime());
|
// return sdf.format(calendar.getTime());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 根据xxl-job的参数,生成一个任务的起始时间和结束时间
|
// * 根据xxl-job的参数,生成一个任务的起始时间和结束时间
|
||||||
*
|
// *
|
||||||
* @author cdf
|
// * @author cdf
|
||||||
* @date 2023/9/20
|
// * @date 2023/9/20
|
||||||
*/
|
// */
|
||||||
public void commDefineDate(String command, LineParam lineParam) {
|
// public void commDefineDate(String command, LineParam lineParam) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
String begin;
|
// String begin;
|
||||||
String end;
|
// String end;
|
||||||
Calendar calendar = Calendar.getInstance();
|
// Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
// calendar.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
Date temDate = calendar.getTime();
|
// Date temDate = calendar.getTime();
|
||||||
switch (command) {
|
// switch (command) {
|
||||||
case BizParamConstant.STAT_BIZ_DAY:
|
// case BizParamConstant.STAT_BIZ_DAY:
|
||||||
begin = sdf.format(DateUtil.beginOfDay(temDate));
|
// begin = sdf.format(DateUtil.beginOfDay(temDate));
|
||||||
end = sdf.format(DateUtil.endOfDay(temDate));
|
// end = sdf.format(DateUtil.endOfDay(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_WEEK:
|
// case BizParamConstant.STAT_BIZ_WEEK:
|
||||||
begin = sdf.format(DateUtil.beginOfWeek(temDate));
|
// begin = sdf.format(DateUtil.beginOfWeek(temDate));
|
||||||
end = sdf.format(DateUtil.endOfWeek(temDate));
|
// end = sdf.format(DateUtil.endOfWeek(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_MONTH:
|
// case BizParamConstant.STAT_BIZ_MONTH:
|
||||||
begin = sdf.format(DateUtil.beginOfMonth(temDate));
|
// begin = sdf.format(DateUtil.beginOfMonth(temDate));
|
||||||
end = sdf.format(DateUtil.endOfMonth(temDate));
|
// end = sdf.format(DateUtil.endOfMonth(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_QUARTER:
|
// case BizParamConstant.STAT_BIZ_QUARTER:
|
||||||
begin = sdf.format(DateUtil.beginOfQuarter(temDate));
|
// begin = sdf.format(DateUtil.beginOfQuarter(temDate));
|
||||||
end = sdf.format(DateUtil.endOfQuarter(temDate));
|
// end = sdf.format(DateUtil.endOfQuarter(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_YEAR:
|
// case BizParamConstant.STAT_BIZ_YEAR:
|
||||||
begin = sdf.format(DateUtil.beginOfYear(temDate));
|
// begin = sdf.format(DateUtil.beginOfYear(temDate));
|
||||||
end = sdf.format(DateUtil.endOfYear(temDate));
|
// end = sdf.format(DateUtil.endOfYear(temDate));
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
begin = sdf.format(DateUtil.beginOfDay(temDate));
|
// begin = sdf.format(DateUtil.beginOfDay(temDate));
|
||||||
end = sdf.format(DateUtil.endOfDay(temDate));
|
// end = sdf.format(DateUtil.endOfDay(temDate));
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
lineParam.setBeginTime(begin);
|
// lineParam.setBeginTime(begin);
|
||||||
lineParam.setEndTime(end);
|
// lineParam.setEndTime(end);
|
||||||
lineParam.setDataDate(begin.substring(0, 10));
|
// lineParam.setDataDate(begin.substring(0, 10));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,113 +1,113 @@
|
|||||||
package com.njcn.system.timer.tasks;
|
//package com.njcn.system.timer.tasks;
|
||||||
|
//
|
||||||
import cn.hutool.core.date.DateUtil;
|
//import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
//import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
//import com.njcn.common.pojo.constant.BizParamConstant;
|
||||||
import com.njcn.prepare.harmonic.api.newalgorithm.RMpEmissionFeignClient;
|
//import com.njcn.prepare.harmonic.api.newalgorithm.RMpEmissionFeignClient;
|
||||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
//import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
import java.text.SimpleDateFormat;
|
//import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
//import java.time.LocalDateTime;
|
||||||
import java.util.Calendar;
|
//import java.util.Calendar;
|
||||||
import java.util.Date;
|
//import java.util.Date;
|
||||||
import java.util.Objects;
|
//import java.util.Objects;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 类的介绍:发射特性定时任务
|
// * 类的介绍:发射特性定时任务
|
||||||
*
|
// *
|
||||||
* @author xuyang
|
// * @author xuyang
|
||||||
* @version 1.0.0
|
// * @version 1.0.0
|
||||||
* @createTime 2023/12/20 13:55
|
// * @createTime 2023/12/20 13:55
|
||||||
*/
|
// */
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
public class RMpEmissionTaskRunner implements TimerTaskRunner {
|
//public class RMpEmissionTaskRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final RMpEmissionFeignClient rMpEmissionFeignClient;
|
// private final RMpEmissionFeignClient rMpEmissionFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
log.info(LocalDateTime.now()+"发射特性调度开始");
|
// log.info(LocalDateTime.now()+"发射特性调度开始");
|
||||||
LineParam lineParam = new LineParam();
|
// LineParam lineParam = new LineParam();
|
||||||
lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
|
// lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
|
||||||
lineParam.setDataDate(this.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
|
// lineParam.setDataDate(this.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
|
||||||
this.commDefineDate(BizParamConstant.STAT_BIZ_MONTH,lineParam);
|
// this.commDefineDate(BizParamConstant.STAT_BIZ_MONTH,lineParam);
|
||||||
rMpEmissionFeignClient.rMpEmissionMHandler(lineParam);
|
// rMpEmissionFeignClient.rMpEmissionMHandler(lineParam);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String prepareTimeDeal(String command) {
|
// public String prepareTimeDeal(String command) {
|
||||||
if (StrUtil.isBlank(command)) {
|
// if (StrUtil.isBlank(command)) {
|
||||||
log.error(LocalDateTime.now() + "xxl调度任务参数未设置");
|
// log.error(LocalDateTime.now() + "xxl调度任务参数未设置");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
Calendar calendar = Calendar.getInstance();
|
// Calendar calendar = Calendar.getInstance();
|
||||||
if (Objects.equals(BizParamConstant.STAT_BIZ_DAY, command)) {
|
// if (Objects.equals(BizParamConstant.STAT_BIZ_DAY, command)) {
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
// calendar.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
} else if (Objects.equals(BizParamConstant.STAT_BIZ_MONTH, command)) {
|
// } else if (Objects.equals(BizParamConstant.STAT_BIZ_MONTH, command)) {
|
||||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
// calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
} else if (Objects.equals(BizParamConstant.STAT_BIZ_QUARTER, command)) {
|
// } else if (Objects.equals(BizParamConstant.STAT_BIZ_QUARTER, command)) {
|
||||||
int nowMonth = calendar.get(Calendar.MONTH);
|
// int nowMonth = calendar.get(Calendar.MONTH);
|
||||||
calendar.set(Calendar.MONTH, nowMonth - (nowMonth % 3));
|
// calendar.set(Calendar.MONTH, nowMonth - (nowMonth % 3));
|
||||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
// calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
// calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
calendar.set(Calendar.MINUTE, 0);
|
// calendar.set(Calendar.MINUTE, 0);
|
||||||
calendar.set(Calendar.SECOND, 0);
|
// calendar.set(Calendar.SECOND, 0);
|
||||||
calendar.set(Calendar.MILLISECOND, 0);
|
// calendar.set(Calendar.MILLISECOND, 0);
|
||||||
} else if (Objects.equals(BizParamConstant.STAT_BIZ_YEAR, command)) {
|
// } else if (Objects.equals(BizParamConstant.STAT_BIZ_YEAR, command)) {
|
||||||
calendar.set(Calendar.DAY_OF_YEAR, 1);
|
// calendar.set(Calendar.DAY_OF_YEAR, 1);
|
||||||
}
|
// }
|
||||||
log.info("job调度时间:" + sdf.format(calendar.getTime()));
|
// log.info("job调度时间:" + sdf.format(calendar.getTime()));
|
||||||
return sdf.format(calendar.getTime());
|
// return sdf.format(calendar.getTime());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 根据xxl-job的参数,生成一个任务的起始时间和结束时间
|
// * 根据xxl-job的参数,生成一个任务的起始时间和结束时间
|
||||||
*
|
// *
|
||||||
* @author cdf
|
// * @author cdf
|
||||||
* @date 2023/9/20
|
// * @date 2023/9/20
|
||||||
*/
|
// */
|
||||||
public void commDefineDate(String command, LineParam lineParam) {
|
// public void commDefineDate(String command, LineParam lineParam) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
String begin;
|
// String begin;
|
||||||
String end;
|
// String end;
|
||||||
Calendar calendar = Calendar.getInstance();
|
// Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
// calendar.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
Date temDate = calendar.getTime();
|
// Date temDate = calendar.getTime();
|
||||||
switch (command) {
|
// switch (command) {
|
||||||
case BizParamConstant.STAT_BIZ_DAY:
|
// case BizParamConstant.STAT_BIZ_DAY:
|
||||||
begin = sdf.format(DateUtil.beginOfDay(temDate));
|
// begin = sdf.format(DateUtil.beginOfDay(temDate));
|
||||||
end = sdf.format(DateUtil.endOfDay(temDate));
|
// end = sdf.format(DateUtil.endOfDay(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_WEEK:
|
// case BizParamConstant.STAT_BIZ_WEEK:
|
||||||
begin = sdf.format(DateUtil.beginOfWeek(temDate));
|
// begin = sdf.format(DateUtil.beginOfWeek(temDate));
|
||||||
end = sdf.format(DateUtil.endOfWeek(temDate));
|
// end = sdf.format(DateUtil.endOfWeek(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_MONTH:
|
// case BizParamConstant.STAT_BIZ_MONTH:
|
||||||
begin = sdf.format(DateUtil.beginOfMonth(temDate));
|
// begin = sdf.format(DateUtil.beginOfMonth(temDate));
|
||||||
end = sdf.format(DateUtil.endOfMonth(temDate));
|
// end = sdf.format(DateUtil.endOfMonth(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_QUARTER:
|
// case BizParamConstant.STAT_BIZ_QUARTER:
|
||||||
begin = sdf.format(DateUtil.beginOfQuarter(temDate));
|
// begin = sdf.format(DateUtil.beginOfQuarter(temDate));
|
||||||
end = sdf.format(DateUtil.endOfQuarter(temDate));
|
// end = sdf.format(DateUtil.endOfQuarter(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_YEAR:
|
// case BizParamConstant.STAT_BIZ_YEAR:
|
||||||
begin = sdf.format(DateUtil.beginOfYear(temDate));
|
// begin = sdf.format(DateUtil.beginOfYear(temDate));
|
||||||
end = sdf.format(DateUtil.endOfYear(temDate));
|
// end = sdf.format(DateUtil.endOfYear(temDate));
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
begin = sdf.format(DateUtil.beginOfDay(temDate));
|
// begin = sdf.format(DateUtil.beginOfDay(temDate));
|
||||||
end = sdf.format(DateUtil.endOfDay(temDate));
|
// end = sdf.format(DateUtil.endOfDay(temDate));
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
lineParam.setBeginTime(begin);
|
// lineParam.setBeginTime(begin);
|
||||||
lineParam.setEndTime(end);
|
// lineParam.setEndTime(end);
|
||||||
lineParam.setDataDate(begin.substring(0, 10));
|
// lineParam.setDataDate(begin.substring(0, 10));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,113 +1,113 @@
|
|||||||
package com.njcn.system.timer.tasks;
|
//package com.njcn.system.timer.tasks;
|
||||||
|
//
|
||||||
import cn.hutool.core.date.DateUtil;
|
//import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
//import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
//import com.njcn.common.pojo.constant.BizParamConstant;
|
||||||
import com.njcn.prepare.harmonic.api.newalgorithm.RMpInfluenceFeignClient;
|
//import com.njcn.prepare.harmonic.api.newalgorithm.RMpInfluenceFeignClient;
|
||||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
//import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
import java.text.SimpleDateFormat;
|
//import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
//import java.time.LocalDateTime;
|
||||||
import java.util.Calendar;
|
//import java.util.Calendar;
|
||||||
import java.util.Date;
|
//import java.util.Date;
|
||||||
import java.util.Objects;
|
//import java.util.Objects;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 类的介绍:
|
// * 类的介绍:
|
||||||
*
|
// *
|
||||||
* @author xuyang
|
// * @author xuyang
|
||||||
* @version 1.0.0
|
// * @version 1.0.0
|
||||||
* @createTime 2023/12/20 14:12
|
// * @createTime 2023/12/20 14:12
|
||||||
*/
|
// */
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
public class RMpInfluenceTaskRunner implements TimerTaskRunner {
|
//public class RMpInfluenceTaskRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final RMpInfluenceFeignClient rMpInfluenceFeignClient;
|
// private final RMpInfluenceFeignClient rMpInfluenceFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
log.info(LocalDateTime.now()+"影响特性调度开始");
|
// log.info(LocalDateTime.now()+"影响特性调度开始");
|
||||||
LineParam lineParam = new LineParam();
|
// LineParam lineParam = new LineParam();
|
||||||
lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
|
// lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
|
||||||
lineParam.setDataDate(this.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
|
// lineParam.setDataDate(this.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
|
||||||
this.commDefineDate(BizParamConstant.STAT_BIZ_MONTH,lineParam);
|
// this.commDefineDate(BizParamConstant.STAT_BIZ_MONTH,lineParam);
|
||||||
rMpInfluenceFeignClient.rMpInfluenceMHandler(lineParam);
|
// rMpInfluenceFeignClient.rMpInfluenceMHandler(lineParam);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String prepareTimeDeal(String command) {
|
// public String prepareTimeDeal(String command) {
|
||||||
if (StrUtil.isBlank(command)) {
|
// if (StrUtil.isBlank(command)) {
|
||||||
log.error(LocalDateTime.now() + "xxl调度任务参数未设置");
|
// log.error(LocalDateTime.now() + "xxl调度任务参数未设置");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
Calendar calendar = Calendar.getInstance();
|
// Calendar calendar = Calendar.getInstance();
|
||||||
if (Objects.equals(BizParamConstant.STAT_BIZ_DAY, command)) {
|
// if (Objects.equals(BizParamConstant.STAT_BIZ_DAY, command)) {
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
// calendar.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
} else if (Objects.equals(BizParamConstant.STAT_BIZ_MONTH, command)) {
|
// } else if (Objects.equals(BizParamConstant.STAT_BIZ_MONTH, command)) {
|
||||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
// calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
} else if (Objects.equals(BizParamConstant.STAT_BIZ_QUARTER, command)) {
|
// } else if (Objects.equals(BizParamConstant.STAT_BIZ_QUARTER, command)) {
|
||||||
int nowMonth = calendar.get(Calendar.MONTH);
|
// int nowMonth = calendar.get(Calendar.MONTH);
|
||||||
calendar.set(Calendar.MONTH, nowMonth - (nowMonth % 3));
|
// calendar.set(Calendar.MONTH, nowMonth - (nowMonth % 3));
|
||||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
// calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
// calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
calendar.set(Calendar.MINUTE, 0);
|
// calendar.set(Calendar.MINUTE, 0);
|
||||||
calendar.set(Calendar.SECOND, 0);
|
// calendar.set(Calendar.SECOND, 0);
|
||||||
calendar.set(Calendar.MILLISECOND, 0);
|
// calendar.set(Calendar.MILLISECOND, 0);
|
||||||
} else if (Objects.equals(BizParamConstant.STAT_BIZ_YEAR, command)) {
|
// } else if (Objects.equals(BizParamConstant.STAT_BIZ_YEAR, command)) {
|
||||||
calendar.set(Calendar.DAY_OF_YEAR, 1);
|
// calendar.set(Calendar.DAY_OF_YEAR, 1);
|
||||||
}
|
// }
|
||||||
log.info("job调度时间:" + sdf.format(calendar.getTime()));
|
// log.info("job调度时间:" + sdf.format(calendar.getTime()));
|
||||||
return sdf.format(calendar.getTime());
|
// return sdf.format(calendar.getTime());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 根据xxl-job的参数,生成一个任务的起始时间和结束时间
|
// * 根据xxl-job的参数,生成一个任务的起始时间和结束时间
|
||||||
*
|
// *
|
||||||
* @author cdf
|
// * @author cdf
|
||||||
* @date 2023/9/20
|
// * @date 2023/9/20
|
||||||
*/
|
// */
|
||||||
public void commDefineDate(String command, LineParam lineParam) {
|
// public void commDefineDate(String command, LineParam lineParam) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
String begin;
|
// String begin;
|
||||||
String end;
|
// String end;
|
||||||
Calendar calendar = Calendar.getInstance();
|
// Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
// calendar.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
Date temDate = calendar.getTime();
|
// Date temDate = calendar.getTime();
|
||||||
switch (command) {
|
// switch (command) {
|
||||||
case BizParamConstant.STAT_BIZ_DAY:
|
// case BizParamConstant.STAT_BIZ_DAY:
|
||||||
begin = sdf.format(DateUtil.beginOfDay(temDate));
|
// begin = sdf.format(DateUtil.beginOfDay(temDate));
|
||||||
end = sdf.format(DateUtil.endOfDay(temDate));
|
// end = sdf.format(DateUtil.endOfDay(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_WEEK:
|
// case BizParamConstant.STAT_BIZ_WEEK:
|
||||||
begin = sdf.format(DateUtil.beginOfWeek(temDate));
|
// begin = sdf.format(DateUtil.beginOfWeek(temDate));
|
||||||
end = sdf.format(DateUtil.endOfWeek(temDate));
|
// end = sdf.format(DateUtil.endOfWeek(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_MONTH:
|
// case BizParamConstant.STAT_BIZ_MONTH:
|
||||||
begin = sdf.format(DateUtil.beginOfMonth(temDate));
|
// begin = sdf.format(DateUtil.beginOfMonth(temDate));
|
||||||
end = sdf.format(DateUtil.endOfMonth(temDate));
|
// end = sdf.format(DateUtil.endOfMonth(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_QUARTER:
|
// case BizParamConstant.STAT_BIZ_QUARTER:
|
||||||
begin = sdf.format(DateUtil.beginOfQuarter(temDate));
|
// begin = sdf.format(DateUtil.beginOfQuarter(temDate));
|
||||||
end = sdf.format(DateUtil.endOfQuarter(temDate));
|
// end = sdf.format(DateUtil.endOfQuarter(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_YEAR:
|
// case BizParamConstant.STAT_BIZ_YEAR:
|
||||||
begin = sdf.format(DateUtil.beginOfYear(temDate));
|
// begin = sdf.format(DateUtil.beginOfYear(temDate));
|
||||||
end = sdf.format(DateUtil.endOfYear(temDate));
|
// end = sdf.format(DateUtil.endOfYear(temDate));
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
begin = sdf.format(DateUtil.beginOfDay(temDate));
|
// begin = sdf.format(DateUtil.beginOfDay(temDate));
|
||||||
end = sdf.format(DateUtil.endOfDay(temDate));
|
// end = sdf.format(DateUtil.endOfDay(temDate));
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
lineParam.setBeginTime(begin);
|
// lineParam.setBeginTime(begin);
|
||||||
lineParam.setEndTime(end);
|
// lineParam.setEndTime(end);
|
||||||
lineParam.setDataDate(begin.substring(0, 10));
|
// lineParam.setDataDate(begin.substring(0, 10));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.algorithm.pojo.bo.BaseParam;
|
import com.njcn.algorithm.pojo.bo.BaseParam;
|
||||||
import com.njcn.algorithm.pojo.liteflow.LiteFlowAlgorithmFeignClient;
|
import com.njcn.algorithm.pojo.liteflow.LiteFlowAlgorithmFeignClient;
|
||||||
import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
|
||||||
|
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|||||||
@@ -1,31 +1,31 @@
|
|||||||
package com.njcn.system.timer.tasks;
|
//package com.njcn.system.timer.tasks;
|
||||||
|
//
|
||||||
import cn.hutool.core.date.DatePattern;
|
//import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
//import cn.hutool.core.date.DateUtil;
|
||||||
import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
//import com.njcn.prepare.harmonic.api.liteflow.LiteFlowFeignClient;
|
||||||
import com.njcn.prepare.harmonic.pojo.bo.BaseParam;
|
//import com.njcn.prepare.harmonic.pojo.bo.BaseParam;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* pqs
|
// * pqs
|
||||||
* 每日定时统计河北两级贯通接口主网数据,用于后续定时上送国网
|
// * 每日定时统计河北两级贯通接口主网数据,用于后续定时上送国网
|
||||||
* @author cdf
|
// * @author cdf
|
||||||
* @date 2024/2/22
|
// * @date 2024/2/22
|
||||||
*/
|
// */
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
public class UploadGwOrgAllRunner implements TimerTaskRunner {
|
//public class UploadGwOrgAllRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final LiteFlowFeignClient liteFlowFeignClient;
|
// private final LiteFlowFeignClient liteFlowFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
BaseParam baseParam = new BaseParam();
|
// BaseParam baseParam = new BaseParam();
|
||||||
baseParam.setFullChain(true);
|
// baseParam.setFullChain(true);
|
||||||
baseParam.setRepair(false);
|
// baseParam.setRepair(false);
|
||||||
baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
|
// baseParam.setDataDate(DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN));
|
||||||
liteFlowFeignClient.uploadOrgExecutor(baseParam);
|
// liteFlowFeignClient.uploadOrgExecutor(baseParam);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
package com.njcn.system.timer.tasks.energy;
|
//package com.njcn.system.timer.tasks.energy;
|
||||||
|
//
|
||||||
|
//
|
||||||
import com.njcn.energy.pojo.api.EleAirStrategyFeignClient;
|
//import com.njcn.energy.pojo.api.EleAirStrategyFeignClient;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
public class AirControllerRunner implements TimerTaskRunner {
|
//public class AirControllerRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final EleAirStrategyFeignClient eleAirStrategyFeignClient;
|
// private final EleAirStrategyFeignClient eleAirStrategyFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
eleAirStrategyFeignClient.dealAirStrategyId("close");
|
// eleAirStrategyFeignClient.dealAirStrategyId("close");
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
package com.njcn.system.timer.tasks.energy;
|
//package com.njcn.system.timer.tasks.energy;
|
||||||
|
//
|
||||||
import com.njcn.energy.pojo.api.EnergyStatisticFeignClient;
|
//import com.njcn.energy.pojo.api.EnergyStatisticFeignClient;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
public class EleIntegrityRunner implements TimerTaskRunner {
|
//public class EleIntegrityRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final EnergyStatisticFeignClient energyStatisticFeignClient;
|
// private final EnergyStatisticFeignClient energyStatisticFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
energyStatisticFeignClient.eleIntegrityJobHandler();
|
// energyStatisticFeignClient.eleIntegrityJobHandler();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
package com.njcn.system.timer.tasks.energy;
|
//package com.njcn.system.timer.tasks.energy;
|
||||||
|
//
|
||||||
import com.njcn.energy.pojo.api.EnergyStatisticFeignClient;
|
//import com.njcn.energy.pojo.api.EnergyStatisticFeignClient;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
public class EleOnlineRateRunner implements TimerTaskRunner {
|
//public class EleOnlineRateRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final EnergyStatisticFeignClient energyStatisticFeignClient;
|
// private final EnergyStatisticFeignClient energyStatisticFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
energyStatisticFeignClient.eleOnlineRateJobHandler();
|
// energyStatisticFeignClient.eleOnlineRateJobHandler();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
package com.njcn.system.timer.tasks.energy;
|
//package com.njcn.system.timer.tasks.energy;
|
||||||
|
//
|
||||||
|
//
|
||||||
import com.njcn.energy.pojo.api.EnergyStatisticFeignClient;
|
//import com.njcn.energy.pojo.api.EnergyStatisticFeignClient;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
public class EnergyStatisticRunner implements TimerTaskRunner {
|
//public class EnergyStatisticRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final EnergyStatisticFeignClient energyStatisticFeignClient;
|
// private final EnergyStatisticFeignClient energyStatisticFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
|
//
|
||||||
energyStatisticFeignClient.electricCalJob();
|
// energyStatisticFeignClient.electricCalJob();
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,38 +1,38 @@
|
|||||||
package com.njcn.system.timer.tasks.report;
|
//package com.njcn.system.timer.tasks.report;
|
||||||
|
//
|
||||||
import cn.hutool.core.date.DatePattern;
|
//import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateTime;
|
//import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
//import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
//import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.harmonic.api.ReportFeignClient;
|
//import com.njcn.harmonic.api.ReportFeignClient;
|
||||||
import com.njcn.prepare.harmonic.api.line.CustomReportFeignClient;
|
//import com.njcn.prepare.harmonic.api.line.CustomReportFeignClient;
|
||||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
//import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 自定义报表预处理
|
// * 自定义报表预处理
|
||||||
*/
|
// */
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
public class CustomReportRunner implements TimerTaskRunner {
|
//public class CustomReportRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final CustomReportFeignClient customReportFeignClient;
|
// private final CustomReportFeignClient customReportFeignClient;
|
||||||
|
//
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
LineParam lineParam = new LineParam();
|
// LineParam lineParam = new LineParam();
|
||||||
if(StrUtil.isNotBlank(date)){
|
// if(StrUtil.isNotBlank(date)){
|
||||||
lineParam.setDataDate(date);
|
// lineParam.setDataDate(date);
|
||||||
}else {
|
// }else {
|
||||||
DateTime dealDate = DateUtil.yesterday();
|
// DateTime dealDate = DateUtil.yesterday();
|
||||||
String end = DateUtil.format(dealDate, DatePattern.NORM_DATE_PATTERN);
|
// String end = DateUtil.format(dealDate, DatePattern.NORM_DATE_PATTERN);
|
||||||
lineParam.setDataDate(end);
|
// lineParam.setDataDate(end);
|
||||||
}
|
// }
|
||||||
customReportFeignClient.batchReport(lineParam);
|
// customReportFeignClient.batchReport(lineParam);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,113 +1,113 @@
|
|||||||
package com.njcn.system.timer.tasks;
|
//package com.njcn.system.timer.tasks;
|
||||||
|
//
|
||||||
import cn.hutool.core.date.DateUtil;
|
//import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
//import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.common.pojo.constant.BizParamConstant;
|
//import com.njcn.common.pojo.constant.BizParamConstant;
|
||||||
import com.njcn.prepare.harmonic.api.specialanalysis.SpecialAnalysisFeignClient;
|
//import com.njcn.prepare.harmonic.api.specialanalysis.SpecialAnalysisFeignClient;
|
||||||
import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
//import com.njcn.prepare.harmonic.pojo.param.LineParam;
|
||||||
import com.njcn.system.timer.TimerTaskRunner;
|
//import com.njcn.system.timer.TimerTaskRunner;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.stereotype.Component;
|
||||||
|
//
|
||||||
import java.text.SimpleDateFormat;
|
//import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
//import java.time.LocalDateTime;
|
||||||
import java.util.Calendar;
|
//import java.util.Calendar;
|
||||||
import java.util.Date;
|
//import java.util.Date;
|
||||||
import java.util.Objects;
|
//import java.util.Objects;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 类的介绍:
|
// * 类的介绍:
|
||||||
*
|
// *
|
||||||
* @author xuyang
|
// * @author xuyang
|
||||||
* @version 1.0.0
|
// * @version 1.0.0
|
||||||
* @createTime 2023/12/20 14:15
|
// * @createTime 2023/12/20 14:15
|
||||||
*/
|
// */
|
||||||
@Component
|
//@Component
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
@Slf4j
|
//@Slf4j
|
||||||
public class specialAnalysisIndexOverviewTaskRunner implements TimerTaskRunner {
|
//public class specialAnalysisIndexOverviewTaskRunner implements TimerTaskRunner {
|
||||||
|
//
|
||||||
private final SpecialAnalysisFeignClient specialAnalysisFeignClient;
|
// private final SpecialAnalysisFeignClient specialAnalysisFeignClient;
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void action(String date) {
|
// public void action(String date) {
|
||||||
log.info(LocalDateTime.now()+"专项分析-指标总览开始执行");
|
// log.info(LocalDateTime.now()+"专项分析-指标总览开始执行");
|
||||||
LineParam lineParam = new LineParam();
|
// LineParam lineParam = new LineParam();
|
||||||
lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
|
// lineParam.setType(Integer.valueOf(BizParamConstant.STAT_BIZ_MONTH));
|
||||||
lineParam.setDataDate(this.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
|
// lineParam.setDataDate(this.prepareTimeDeal(BizParamConstant.STAT_BIZ_MONTH));
|
||||||
this.commDefineDate(BizParamConstant.STAT_BIZ_MONTH,lineParam);
|
// this.commDefineDate(BizParamConstant.STAT_BIZ_MONTH,lineParam);
|
||||||
specialAnalysisFeignClient.hanlder(lineParam);
|
// specialAnalysisFeignClient.hanlder(lineParam);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public String prepareTimeDeal(String command) {
|
// public String prepareTimeDeal(String command) {
|
||||||
if (StrUtil.isBlank(command)) {
|
// if (StrUtil.isBlank(command)) {
|
||||||
log.error(LocalDateTime.now() + "xxl调度任务参数未设置");
|
// log.error(LocalDateTime.now() + "xxl调度任务参数未设置");
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
Calendar calendar = Calendar.getInstance();
|
// Calendar calendar = Calendar.getInstance();
|
||||||
if (Objects.equals(BizParamConstant.STAT_BIZ_DAY, command)) {
|
// if (Objects.equals(BizParamConstant.STAT_BIZ_DAY, command)) {
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
// calendar.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
} else if (Objects.equals(BizParamConstant.STAT_BIZ_MONTH, command)) {
|
// } else if (Objects.equals(BizParamConstant.STAT_BIZ_MONTH, command)) {
|
||||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
// calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
} else if (Objects.equals(BizParamConstant.STAT_BIZ_QUARTER, command)) {
|
// } else if (Objects.equals(BizParamConstant.STAT_BIZ_QUARTER, command)) {
|
||||||
int nowMonth = calendar.get(Calendar.MONTH);
|
// int nowMonth = calendar.get(Calendar.MONTH);
|
||||||
calendar.set(Calendar.MONTH, nowMonth - (nowMonth % 3));
|
// calendar.set(Calendar.MONTH, nowMonth - (nowMonth % 3));
|
||||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
// calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
// calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
calendar.set(Calendar.MINUTE, 0);
|
// calendar.set(Calendar.MINUTE, 0);
|
||||||
calendar.set(Calendar.SECOND, 0);
|
// calendar.set(Calendar.SECOND, 0);
|
||||||
calendar.set(Calendar.MILLISECOND, 0);
|
// calendar.set(Calendar.MILLISECOND, 0);
|
||||||
} else if (Objects.equals(BizParamConstant.STAT_BIZ_YEAR, command)) {
|
// } else if (Objects.equals(BizParamConstant.STAT_BIZ_YEAR, command)) {
|
||||||
calendar.set(Calendar.DAY_OF_YEAR, 1);
|
// calendar.set(Calendar.DAY_OF_YEAR, 1);
|
||||||
}
|
// }
|
||||||
log.info("job调度时间:" + sdf.format(calendar.getTime()));
|
// log.info("job调度时间:" + sdf.format(calendar.getTime()));
|
||||||
return sdf.format(calendar.getTime());
|
// return sdf.format(calendar.getTime());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 根据xxl-job的参数,生成一个任务的起始时间和结束时间
|
// * 根据xxl-job的参数,生成一个任务的起始时间和结束时间
|
||||||
*
|
// *
|
||||||
* @author cdf
|
// * @author cdf
|
||||||
* @date 2023/9/20
|
// * @date 2023/9/20
|
||||||
*/
|
// */
|
||||||
public void commDefineDate(String command, LineParam lineParam) {
|
// public void commDefineDate(String command, LineParam lineParam) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
String begin;
|
// String begin;
|
||||||
String end;
|
// String end;
|
||||||
Calendar calendar = Calendar.getInstance();
|
// Calendar calendar = Calendar.getInstance();
|
||||||
calendar.add(Calendar.DAY_OF_MONTH, -1);
|
// calendar.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
Date temDate = calendar.getTime();
|
// Date temDate = calendar.getTime();
|
||||||
switch (command) {
|
// switch (command) {
|
||||||
case BizParamConstant.STAT_BIZ_DAY:
|
// case BizParamConstant.STAT_BIZ_DAY:
|
||||||
begin = sdf.format(DateUtil.beginOfDay(temDate));
|
// begin = sdf.format(DateUtil.beginOfDay(temDate));
|
||||||
end = sdf.format(DateUtil.endOfDay(temDate));
|
// end = sdf.format(DateUtil.endOfDay(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_WEEK:
|
// case BizParamConstant.STAT_BIZ_WEEK:
|
||||||
begin = sdf.format(DateUtil.beginOfWeek(temDate));
|
// begin = sdf.format(DateUtil.beginOfWeek(temDate));
|
||||||
end = sdf.format(DateUtil.endOfWeek(temDate));
|
// end = sdf.format(DateUtil.endOfWeek(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_MONTH:
|
// case BizParamConstant.STAT_BIZ_MONTH:
|
||||||
begin = sdf.format(DateUtil.beginOfMonth(temDate));
|
// begin = sdf.format(DateUtil.beginOfMonth(temDate));
|
||||||
end = sdf.format(DateUtil.endOfMonth(temDate));
|
// end = sdf.format(DateUtil.endOfMonth(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_QUARTER:
|
// case BizParamConstant.STAT_BIZ_QUARTER:
|
||||||
begin = sdf.format(DateUtil.beginOfQuarter(temDate));
|
// begin = sdf.format(DateUtil.beginOfQuarter(temDate));
|
||||||
end = sdf.format(DateUtil.endOfQuarter(temDate));
|
// end = sdf.format(DateUtil.endOfQuarter(temDate));
|
||||||
break;
|
// break;
|
||||||
case BizParamConstant.STAT_BIZ_YEAR:
|
// case BizParamConstant.STAT_BIZ_YEAR:
|
||||||
begin = sdf.format(DateUtil.beginOfYear(temDate));
|
// begin = sdf.format(DateUtil.beginOfYear(temDate));
|
||||||
end = sdf.format(DateUtil.endOfYear(temDate));
|
// end = sdf.format(DateUtil.endOfYear(temDate));
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
begin = sdf.format(DateUtil.beginOfDay(temDate));
|
// begin = sdf.format(DateUtil.beginOfDay(temDate));
|
||||||
end = sdf.format(DateUtil.endOfDay(temDate));
|
// end = sdf.format(DateUtil.endOfDay(temDate));
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
lineParam.setBeginTime(begin);
|
// lineParam.setBeginTime(begin);
|
||||||
lineParam.setEndTime(end);
|
// lineParam.setEndTime(end);
|
||||||
lineParam.setDataDate(begin.substring(0, 10));
|
// lineParam.setDataDate(begin.substring(0, 10));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|||||||
Reference in New Issue
Block a user