ids);
+ void updateCause(@Param("code") Integer code, @Param("indexEvt") String indexEvt);
+
+ void updateType(@Param("code") Integer code, @Param("indexEvt") String indexEvt);
+
}
diff --git a/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/PqDeviceMapper.java b/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/PqDeviceMapper.java
index 14c9324..1b18788 100644
--- a/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/PqDeviceMapper.java
+++ b/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/PqDeviceMapper.java
@@ -4,6 +4,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.influx.bo.po.PqDevice;
import com.njcn.influx.bo.po.PqDeviceBak;
+import org.apache.ibatis.annotations.Param;
/**
*
@@ -16,4 +17,6 @@ import com.njcn.influx.bo.po.PqDeviceBak;
@DS("master")
public interface PqDeviceMapper extends BaseMapper {
+ PqDevice selectByLineId(@Param("lineId") String lineId);
+
}
diff --git a/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/PqsEventLogMapper.java b/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/PqsEventLogMapper.java
new file mode 100644
index 0000000..87dddd3
--- /dev/null
+++ b/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/PqsEventLogMapper.java
@@ -0,0 +1,16 @@
+package com.njcn.influx.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.njcn.influx.bo.po.PqsEventLog;
+
+/**
+ * Description:
+ * Date: 2026/04/20 上午 10:21【需求编号】
+ *
+ * @author clam
+ * @version V1.0.0
+ */
+public interface PqsEventLogMapper extends BaseMapper {
+
+}
\ No newline at end of file
diff --git a/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/mapping/OracleRmpEventDetailPOMapper.xml b/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/mapping/OracleRmpEventDetailPOMapper.xml
index 6902932..3fcc2d0 100644
--- a/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/mapping/OracleRmpEventDetailPOMapper.xml
+++ b/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/mapping/OracleRmpEventDetailPOMapper.xml
@@ -37,4 +37,22 @@
+
+
+ update pqs_eventdetail set eventreason = (select
+ a.dic_index from pqs_dicdata a,pqs_dictype b where b.dictype_name =
+ '暂降原因' and a.dic_type = b.dictype_index and a.triphase = #{code} and
+ a.state = 1 and b.state = 1)
+ where
+ eventdetail_index = #{indexEvt}
+
+
+ update pqs_eventdetail set EVENTTYPE = (select
+ a.dic_index from pqs_dicdata a,pqs_dictype b where b.dictype_name =
+ '暂降类型' and a.dic_type = b.dictype_index and a.triphase = #{code} and
+ a.state = 1 and b.state = 1)
+ where
+ eventdetail_index = #{indexEvt}
+
+
diff --git a/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/mapping/PqDeviceMapper.xml b/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/mapping/PqDeviceMapper.xml
new file mode 100644
index 0000000..c9f6b47
--- /dev/null
+++ b/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/mapping/PqDeviceMapper.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+ DEV_INDEX, GD_INDEX, SUB_INDEX, "NAME", "STATUS", DEVTYPE, LOGONTIME, UPDATETIME,
+ NODE_INDEX, PORTID, DEVFLAG, DEV_SERIES, DEV_KEY, IP, DEVMODEL, CALLFLAG, DATATYPE
+
+
+
+
+
\ No newline at end of file
diff --git a/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/mapping/PqsEventLogMapper.xml b/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/mapping/PqsEventLogMapper.xml
new file mode 100644
index 0000000..9826796
--- /dev/null
+++ b/influx-data/influx-source/src/main/java/com/njcn/influx/mapper/mapping/PqsEventLogMapper.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ID, EVENTDETAIL_INDEX, fileupFlag, dealFlag, CreatTime, UpdateTime, REMARK
+
+
\ No newline at end of file
diff --git a/influx-data/influx-source/src/main/java/com/njcn/influx/service/OracleEventDetailToMysqlService.java b/influx-data/influx-source/src/main/java/com/njcn/influx/service/OracleEventDetailToMysqlService.java
index fda22d0..772f120 100644
--- a/influx-data/influx-source/src/main/java/com/njcn/influx/service/OracleEventDetailToMysqlService.java
+++ b/influx-data/influx-source/src/main/java/com/njcn/influx/service/OracleEventDetailToMysqlService.java
@@ -14,4 +14,5 @@ import java.time.LocalDateTime;
public interface OracleEventDetailToMysqlService extends IService {
void eventBatch(LocalDateTime start, LocalDateTime end);
+
}
diff --git a/influx-data/influx-source/src/main/java/com/njcn/influx/service/OracleToMysqlService.java b/influx-data/influx-source/src/main/java/com/njcn/influx/service/OracleToMysqlService.java
new file mode 100644
index 0000000..55ef26d
--- /dev/null
+++ b/influx-data/influx-source/src/main/java/com/njcn/influx/service/OracleToMysqlService.java
@@ -0,0 +1,16 @@
+package com.njcn.influx.service;
+
+import java.time.LocalDateTime;
+
+/**
+ * Description:
+ * Date: 2026/04/20 上午 9:53【需求编号】
+ *
+ * @author clam
+ * @version V1.0.0
+ */
+public interface OracleToMysqlService {
+
+ void OracleToMySqlJob(LocalDateTime result, LocalDateTime modifiedResult);
+ void retryAndCleanEvery10Min();
+}
diff --git a/influx-data/influx-source/src/main/java/com/njcn/influx/service/PqsEventLogService.java b/influx-data/influx-source/src/main/java/com/njcn/influx/service/PqsEventLogService.java
new file mode 100644
index 0000000..0508654
--- /dev/null
+++ b/influx-data/influx-source/src/main/java/com/njcn/influx/service/PqsEventLogService.java
@@ -0,0 +1,17 @@
+package com.njcn.influx.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.njcn.influx.bo.po.PqsEventLog;
+
+/**
+ *
+ * 服务类
+ *
+ *
+ * @author wr
+ * @since 2024-03-05
+ */
+
+public interface PqsEventLogService extends IService {
+
+}
diff --git a/influx-data/influx-source/src/main/java/com/njcn/influx/service/RmpEventDetailService.java b/influx-data/influx-source/src/main/java/com/njcn/influx/service/RmpEventDetailService.java
new file mode 100644
index 0000000..1c81ace
--- /dev/null
+++ b/influx-data/influx-source/src/main/java/com/njcn/influx/service/RmpEventDetailService.java
@@ -0,0 +1,15 @@
+package com.njcn.influx.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.njcn.influx.bo.po.RmpEventDetailPO;
+
+/**
+ * Description:
+ * Date: 2026/04/20 上午 11:28【需求编号】
+ *
+ * @author clam
+ * @version V1.0.0
+ */
+public interface RmpEventDetailService extends IService {
+ void syncToMysql(String eventId);
+}
diff --git a/influx-data/influx-source/src/main/java/com/njcn/influx/service/impl/EventAsyncService.java b/influx-data/influx-source/src/main/java/com/njcn/influx/service/impl/EventAsyncService.java
new file mode 100644
index 0000000..8f4da64
--- /dev/null
+++ b/influx-data/influx-source/src/main/java/com/njcn/influx/service/impl/EventAsyncService.java
@@ -0,0 +1,244 @@
+package com.njcn.influx.service.impl;
+
+import com.jcraft.jsch.ChannelSftp;
+
+import com.njcn.influx.bo.po.OracleRmpEventDetailPO;
+import com.njcn.influx.bo.po.PqDevice;
+import com.njcn.influx.bo.po.PqsEventLog;
+import com.njcn.influx.component.WaveFileComponent;
+import com.njcn.influx.component.dto.WaveDataDTO;
+import com.njcn.influx.config.OtherConfig;
+import com.njcn.influx.config.TargetConfig;
+import com.njcn.influx.event.cause.jna.QvvrCauseDLL;
+import com.njcn.influx.event.cause.model.DataFeature;
+import com.njcn.influx.event.cause.model.EventAnalysisDTO;
+import com.njcn.influx.event.type.jna.QvvrDLL;
+import com.njcn.influx.mapper.OracleRmpEventDetailPOMapper;
+import com.njcn.influx.mapper.PqDeviceMapper;
+import com.njcn.influx.service.PqsEventLogService;
+import com.njcn.influx.service.RmpEventDetailService;
+import com.njcn.influx.sftp.SftpClient;
+import com.sun.jna.Memory;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.io.*;
+import java.nio.file.Files;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class EventAsyncService {
+
+
+
+
+ private final RmpEventDetailService rmpEventDetailService;
+
+ private final PqDeviceMapper pqDeviceMapper;
+ private final WaveFileComponent waveFileComponent;
+
+ private final OtherConfig config;
+
+ private final TargetConfig targetConfig;
+
+ private final OracleRmpEventDetailPOMapper oracleRmpEventDetailPOMapper;
+ private final PqsEventLogService pqsEventLogService;
+
+ @Value("${business.dealFlag:true}")
+ private Boolean dealFlag;
+ @Value("${business.upLoadFlag:true}")
+ private Boolean upLoadFlag;
+
+
+ // ============================
+ // 文件同步 + 高级算法
+ // ============================
+// @Async("eventTaskExecutor")
+ public void asyncHandleEvent(OracleRmpEventDetailPO detail ) {
+ try {
+ log.info("异步处理事件:{} 文件:{}", detail.getEventId(), detail.getWavePath());
+ // ========== 1. 查看波形文件是否存在 ==========
+ PqDevice pqDevice = pqDeviceMapper.selectByLineId(detail.getMeasurementPointId());
+ String wavePath = config.getWavePath();
+ String cfgPath = wavePath + File.separator + pqDevice.getIp() + File.separator + detail.getWavePath() + ".CFG" ;
+ String datPath = wavePath + File.separator + pqDevice.getIp() + File.separator + detail.getWavePath() + ".DAT" ;
+
+
+ log.info("本地磁盘波形文件路径----" + cfgPath);
+ InputStream cfgStream = getFileInputStreamByFilePath(cfgPath);
+ InputStream datStream = getFileInputStreamByFilePath(datPath);
+
+ if((Objects.nonNull(cfgStream)&&Objects.nonNull(datStream))){
+ // ========== 2. 高级算法更新原因/类型 ==========
+ if(dealFlag){
+ EventAnalysisDTO eventAnalysisDTO = null;
+ try {
+ eventAnalysisDTO = advancedAlgorithm(cfgStream, datStream);
+ log.info("暂降原因:"+eventAnalysisDTO.getCause()+"----暂降类型:"+eventAnalysisDTO.getType());
+ oracleRmpEventDetailPOMapper.updateCause(eventAnalysisDTO.getCause(),detail.getEventId());
+ oracleRmpEventDetailPOMapper.updateType(eventAnalysisDTO.getType(),detail.getEventId());
+ pqsEventLogService.lambdaUpdate().set(PqsEventLog::getDealflag,1).set(PqsEventLog::getUpdatetime,new Date()).eq(PqsEventLog::getEventdetailIndex,detail.getEventId()).update();
+ } catch (Exception e) {
+ pqsEventLogService.lambdaUpdate().set(PqsEventLog::getRemark,e.getMessage().length()>50?e.getMessage().substring(50):e.getMessage()).set(PqsEventLog::getUpdatetime,new Date()).eq(PqsEventLog::getEventdetailIndex,detail.getEventId()).update();
+
+ }
+
+ }
+ if(upLoadFlag){
+ // ========== 4. SFTP文件同步 ==========
+ try {
+ syncFileToSftp(pqDevice.getIp(), detail.getWavePath(), cfgPath, datPath);
+ pqsEventLogService.lambdaUpdate().set(PqsEventLog::getFileupflag,1).set(PqsEventLog::getUpdatetime,new Date()).eq(PqsEventLog::getEventdetailIndex,detail.getEventId()).update();
+
+ } catch (Exception e) {
+ pqsEventLogService.lambdaUpdate().set(PqsEventLog::getRemark,e.getMessage().length()>50?e.getMessage().substring(50):e.getMessage()).set(PqsEventLog::getUpdatetime,new Date()).eq(PqsEventLog::getEventdetailIndex,detail.getEventId()).update();
+
+ }
+
+ }
+
+ rmpEventDetailService.syncToMysql(detail.getEventId());
+
+ }
+
+ } catch (Exception e) {
+ log.error("异步处理失败 eventId:{}", detail.getEventId(), e);
+ }
+
+ }
+
+ // ==================
+ // 已修复:SFTP上传(无reset,无mark异常)
+ // ==================
+ private void syncFileToSftp(String deviceIp, String wavePath, String cfgFilePath, String datFilePath) throws Exception {
+ try (SftpClient client = new SftpClient() ) {
+ client.connect(targetConfig);
+ ChannelSftp channel = client.getChannel();
+
+ String remoteDir = targetConfig.getBasePath() + "/" + deviceIp;
+ client.createRemoteDirectory(remoteDir);
+
+ String remoteCfg = remoteDir + "/" + wavePath + ".CFG";
+ String remoteDat = remoteDir + "/" + wavePath + ".DAT";
+
+ channel.put(new FileInputStream(cfgFilePath), remoteCfg);
+ channel.put(new FileInputStream(datFilePath), remoteDat);
+ log.info("SFTP上传成功:{}", remoteCfg);
+
+ } catch (Exception e) {
+ log.error("SFTP上传失败", e);
+ throw new Exception("SFTP上传失败:"+(e.getMessage().length()>50?e.getMessage().substring(50):e.getMessage()));
+ }
+ }
+
+
+ // ==================
+ // 高级算法:更新 EVENTREASON / EVENTTYPE
+ // ==================
+ private EventAnalysisDTO advancedAlgorithm(InputStream cfgStream , InputStream datStream) throws Exception {
+ EventAnalysisDTO eventAnalysis = new EventAnalysisDTO();
+ log.info("执行高级算法:{}");
+ WaveDataDTO waveDataDTO = waveFileComponent.getComtradeNoAddPoints(cfgStream, datStream, 0);
+
+ List> listWaveData = waveDataDTO.getListWaveData();
+ // 暂降类型
+ // 创建数据结构
+ QvvrDLL.QvvrDataStruct typeDataStruct = new QvvrDLL.QvvrDataStruct();
+ System.out.println("初始化qvvrdll成功-----------");
+ typeDataStruct.smp_rate = waveDataDTO.getComtradeCfgDTO().getFinalSampleRate();
+ System.out.println("采样率-----------" + typeDataStruct.smp_rate);
+ typeDataStruct.smp_len = listWaveData.size();
+ System.out.println("波形长度-----------" + listWaveData.size());
+
+ // 获取ABC三相的瞬时数据
+ for (int i = 0; i < listWaveData.size(); i++) {
+ typeDataStruct.smp_va[i] = listWaveData.get(i).get(1);
+ typeDataStruct.smp_vb[i] = listWaveData.get(i).get(2);
+ typeDataStruct.smp_vc[i] = listWaveData.get(i).get(3);
+ }
+
+
+ // 执行算法分析 - 直接调用C DLL
+ try {
+ QvvrDLL.INSTANCE.qvvr_fun(typeDataStruct);
+
+ log.info("调用qvvrdll成功-----------");
+
+ if (typeDataStruct.evt_num > 0) {
+ // 全局比较找出最小三相电压特征值
+ float globalMinVoltage = Float.MAX_VALUE;
+ int globalFaultType = 10;
+ for (int i = 0; i < typeDataStruct.evt_num; i++) {
+ QvvrDLL.EventBuffer evt = typeDataStruct.evt_buf[i];
+ for (int j = 0; j < evt.u_min_num; j++) {
+ float u3min = evt.u3_min[j];
+ if (u3min < globalMinVoltage) {
+ globalMinVoltage = u3min;
+ globalFaultType = evt.qvvr_cata_type[j];
+ }
+ }
+ }
+ eventAnalysis.setType(globalFaultType);
+ } else {
+ eventAnalysis.setType(DataFeature.TYPE10);
+ }
+ System.out.println("结束qvvrdll方法调用-----------");
+ } catch (Exception e) {
+ eventAnalysis.setType(DataFeature.TYPE10);
+ eventAnalysis.setTypeFlag(0);
+ }
+
+
+ // 暂降原因JNA的方式
+ QvvrCauseDLL.QvvrDataStruct causeDataStruct = new QvvrCauseDLL.QvvrDataStruct();
+ causeDataStruct.smp_rate = waveDataDTO.getComtradeCfgDTO().getFinalSampleRate();
+ causeDataStruct.smp_len = listWaveData.size();
+ // 获取ABC三相的瞬时数据
+ for (int i = 0; i < listWaveData.size(); i++) {
+ causeDataStruct.smp_va[i] = listWaveData.get(i).get(1);
+ causeDataStruct.smp_vb[i] = listWaveData.get(i).get(2);
+ causeDataStruct.smp_vc[i] = listWaveData.get(i).get(3);
+ }
+ // 执行算法分析 - 直接调用C DLL
+ try {
+ QvvrCauseDLL.INSTANCE.qvvr_fun_cause(causeDataStruct);
+ eventAnalysis.setCause(causeDataStruct.cause);
+ if (causeDataStruct.no_cal != 0) {
+ eventAnalysis.setCauseFlag(0);
+ }
+ } catch (Exception e) {
+ eventAnalysis.setCause(DataFeature.CAUSE_TYPE0);
+ eventAnalysis.setCauseFlag(0);
+ }
+ System.out.println("暂降原因分析完毕===============");
+ System.out.println("cause:" + eventAnalysis);
+ return eventAnalysis;
+ }
+
+ public InputStream getFileInputStreamByFilePath(String filePath) {
+ File file = new File(filePath);
+ if (file.isFile() && file.exists()) {
+ InputStream inputStream;
+ try {
+ inputStream = Files.newInputStream(file.toPath());
+ if (inputStream.available() < 1) {
+ return null;
+ }
+ return inputStream;
+ } catch (IOException e) {
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/influx-data/influx-source/src/main/java/com/njcn/influx/service/impl/OracleToMysqlServiceImpl.java b/influx-data/influx-source/src/main/java/com/njcn/influx/service/impl/OracleToMysqlServiceImpl.java
new file mode 100644
index 0000000..ac07ce3
--- /dev/null
+++ b/influx-data/influx-source/src/main/java/com/njcn/influx/service/impl/OracleToMysqlServiceImpl.java
@@ -0,0 +1,147 @@
+package com.njcn.influx.service.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.njcn.influx.bo.po.*;
+import com.njcn.influx.mapper.OracleRmpEventDetailPOMapper;
+import com.njcn.influx.mapper.PqDeviceMapper;
+import com.njcn.influx.mapper.RmpEventDetailPOMapper;
+import com.njcn.influx.service.OracleToMysqlService;
+import com.njcn.influx.service.PqLineBakService;
+import com.njcn.influx.service.PqsEventLogService;
+import com.njcn.influx.service.RmpEventDetailService;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.nio.file.Files;
+import java.time.LocalDateTime;
+import java.time.temporal.ChronoUnit;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * Description:
+ * Date: 2026/04/20 上午 9:54【需求编号】
+ *
+ * @author clam
+ * @version V1.0.0
+ */
+@RequiredArgsConstructor
+@Service
+@Slf4j
+public class OracleToMysqlServiceImpl implements OracleToMysqlService {
+
+ private final RmpEventDetailService rmpEventDetailService;
+ private final OracleRmpEventDetailPOMapper oracleRmpEventDetailPOMapper;
+
+
+ private final PqsEventLogService pqsEventLogService;
+ private final EventAsyncService eventAsyncService;
+ @Value("${business.dealFlag:true}")
+ private Boolean dealFlag;
+ @Value("${business.upLoadFlag:true}")
+ private Boolean upLoadFlag;
+ @Override
+ public void OracleToMySqlJob(LocalDateTime start, LocalDateTime end) {
+ log.info("===== 定时扫描事件开始 =====");
+
+ List oracleRmpEventDetailPOList = oracleRmpEventDetailPOMapper.selectList(new LambdaQueryWrapper().between(OracleRmpEventDetailPO::getCreateTime,start,end));
+ for (OracleRmpEventDetailPO detail : oracleRmpEventDetailPOList) {
+ String eventId = detail.getEventId();
+
+ // 2. 判断是否已存在日志,避免重复
+ Integer cnt = pqsEventLogService.lambdaQuery().eq(PqsEventLog::getEventdetailIndex,eventId).count();
+
+ if (cnt == null ||cnt < 1){
+ // 3. 初始化日志:0未上传 0未计算
+ PqsEventLog pqsEventLog = new PqsEventLog();
+ pqsEventLog.setId(UUID.randomUUID().toString());
+ pqsEventLog.setEventdetailIndex(eventId);
+ //判断是否配置数据同步或者高级算法功能
+ if(dealFlag){
+ pqsEventLog.setDealflag(0);
+ }else {
+ pqsEventLog.setDealflag(2);
+ }
+ if(dealFlag){
+ pqsEventLog.setFileupflag(0);
+ }else {
+ pqsEventLog.setFileupflag(2);
+ }
+
+ pqsEventLog.setFileupflag(0);
+ pqsEventLog.setCreattime(new Date());
+ pqsEventLog.setUpdatetime(new Date());
+ pqsEventLogService.save(pqsEventLog);
+
+ String wavename = detail.getWavePath();
+
+ rmpEventDetailService.syncToMysql(eventId);
+
+ // ============================
+ // WAVENAME 为空:直接标记
+ // ============================
+ if (wavename == null || wavename.trim().isEmpty()) {
+
+ continue;
+ }
+
+ // ============================
+ // WAVENAME 非空:线程池异步处理
+ // ============================
+ eventAsyncService.asyncHandleEvent(detail);
+ }
+
+
+ }
+ }
+
+ @Override
+ public void retryAndCleanEvery10Min() {
+ log.info("===== 10分钟重试补偿 + 过期清理 =====");
+
+ // 1. 扫描未处理:fileup=0 deal=0
+ List todoList = pqsEventLogService.lambdaQuery().eq(PqsEventLog::getFileupflag, 0)
+ .or()
+ .eq(PqsEventLog::getDealflag, 0).list();
+
+ for (PqsEventLog log : todoList) {
+ String eventId = log.getEventdetailIndex();
+ Date createTime = log.getCreattime();
+ OracleRmpEventDetailPO oracleRmpEventDetailPO = oracleRmpEventDetailPOMapper.selectById(eventId);
+ // 查询最新WAVENAME
+
+
+ boolean isWaveEmpty = (oracleRmpEventDetailPO.getWavePath() == null || oracleRmpEventDetailPO.getWavePath().isEmpty());
+
+ // ======================
+ // 超过2天:置为2
+ // ======================
+ if (createTime != null && System.currentTimeMillis() - createTime.getTime() > 2 * 86400000L) {
+ if (isWaveEmpty) {
+ pqsEventLogService.lambdaUpdate().set(PqsEventLog::getDealflag,2).set(PqsEventLog::getFileupflag,2).set(PqsEventLog::getUpdatetime,new Date()).eq(PqsEventLog::getEventdetailIndex,eventId);
+ continue;
+ }
+ }
+
+ // ======================
+ // 有文件:重试异步处理
+ // ======================
+ if (!isWaveEmpty) {
+ eventAsyncService.asyncHandleEvent(oracleRmpEventDetailPO);
+ }
+ }
+
+ }
+
+}
diff --git a/influx-data/influx-source/src/main/java/com/njcn/influx/service/impl/PqsEventLogServiceImpl.java b/influx-data/influx-source/src/main/java/com/njcn/influx/service/impl/PqsEventLogServiceImpl.java
new file mode 100644
index 0000000..222aecc
--- /dev/null
+++ b/influx-data/influx-source/src/main/java/com/njcn/influx/service/impl/PqsEventLogServiceImpl.java
@@ -0,0 +1,21 @@
+package com.njcn.influx.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import com.njcn.influx.service.PqsEventLogService;
+import com.njcn.influx.bo.po.PqsEventLog;
+import com.njcn.influx.mapper.PqsEventLogMapper;
+import org.springframework.stereotype.Service;
+
+/**
+ * Description:
+ * Date: 2026/04/20 上午 10:23【需求编号】
+ *
+ * @author clam
+ * @version V1.0.0
+ */
+@Service
+@DS("master")
+public class PqsEventLogServiceImpl extends ServiceImpl implements PqsEventLogService {
+}
diff --git a/influx-data/influx-source/src/main/java/com/njcn/influx/service/impl/RmpEventDetailServiceImpl.java b/influx-data/influx-source/src/main/java/com/njcn/influx/service/impl/RmpEventDetailServiceImpl.java
new file mode 100644
index 0000000..7568396
--- /dev/null
+++ b/influx-data/influx-source/src/main/java/com/njcn/influx/service/impl/RmpEventDetailServiceImpl.java
@@ -0,0 +1,142 @@
+package com.njcn.influx.service.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.njcn.influx.bo.po.DictData;
+import com.njcn.influx.bo.po.OracleRmpEventDetailPO;
+import com.njcn.influx.bo.po.PqLineBak;
+import com.njcn.influx.bo.po.RmpEventDetailPO;
+import com.njcn.influx.mapper.OracleRmpEventDetailPOMapper;
+import com.njcn.influx.mapper.RmpEventDetailPOMapper;
+import com.njcn.influx.service.PqLineBakService;
+import com.njcn.influx.service.RmpEventDetailService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.time.temporal.ChronoUnit;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * Description:
+ * Date: 2026/04/20 上午 11:29【需求编号】
+ *
+ * @author clam
+ * @version V1.0.0
+ */
+@Service
+@RequiredArgsConstructor
+public class RmpEventDetailServiceImpl extends ServiceImpl implements RmpEventDetailService {
+ private final OracleRmpEventDetailPOMapper oracleRmpEventDetailPOMapper;
+ private final PqLineBakService pqLineBakService;
+
+ @Override
+ public void syncToMysql(String eventId) {
+ OracleRmpEventDetailPO oracleDetail = oracleRmpEventDetailPOMapper.selectById(eventId);
+
+ List list = pqLineBakService.list();
+
+ //lineId:Oracle监测点ID id:Mysql监测点ID
+ Map oracleRelationMysql = list.stream().collect(Collectors.toMap(PqLineBak::getLineId, PqLineBak::getId));
+ //获取Oracle字典 暂降类型:12 暂降原因:13
+ List oracleReason= oracleRmpEventDetailPOMapper.selectByDicCodeList("暂降原因");
+ List oracleType= oracleRmpEventDetailPOMapper.selectByDicCodeList("暂降类型");
+ //获取Mysql字典
+ List eventType = this.getBaseMapper().selectByDicCodeList("Event_Statis");
+ List mysqlReason = this.getBaseMapper().selectByDicCodeList("Event_Reason");
+ List mysqlType = this.getBaseMapper().selectByDicCodeList("Event_Type");
+ //字典类型
+ Map mapReason = getRelationList(oracleReason, mysqlReason);
+ Map mapType = getRelationList(oracleType, mysqlType);
+
+ if(oracleRelationMysql.containsKey(oracleDetail.getMeasurementPointId())){
+ String mysqlLineID = oracleRelationMysql.get(oracleDetail.getMeasurementPointId());
+ RmpEventDetailPO po=new RmpEventDetailPO();
+ po.setEventId(eventId);
+ po.setMeasurementPointId(mysqlLineID);
+ po.setEventType(eventTypeId(oracleDetail.getEventType(),eventType));
+ po.setAdvanceReason(getDicId(oracleDetail.getAdvanceReason(),mapReason));
+ po.setAdvanceType(getDicId(oracleDetail.getAdvanceType(),mapType));
+ po.setEventassIndex(oracleDetail.getEventassIndex());
+ po.setDqTime(oracleDetail.getDqTime());
+ po.setDealTime(oracleDetail.getDealTime());
+ po.setNum(oracleDetail.getNum());
+ po.setFileFlag(oracleDetail.getFileFlag());
+ po.setDealFlag(oracleDetail.getDealFlag());
+
+ if(Objects.nonNull(oracleDetail.getFirstTime())) {
+ po.setFirstTime(oracleDetail.getFirstTime().plus(oracleDetail.getFirstMs().intValue(), ChronoUnit.MILLIS));
+ }
+ po.setFirstType(oracleDetail.getFirstType());
+ po.setFirstMs(oracleDetail.getFirstMs());
+ po.setEnergy(oracleDetail.getEnergy());
+ po.setSeverity(oracleDetail.getSeverity());
+ po.setSagsource(oracleDetail.getSagsource());
+ LocalDateTime startTime = oracleDetail.getStartTime();
+ LocalDateTime time = startTime.plus(oracleDetail.getMs(), ChronoUnit.MILLIS);
+ po.setStartTime(time);
+ po.setDuration(oracleDetail.getDuration().divide(BigDecimal.valueOf(1000)));
+ po.setFeatureAmplitude(oracleDetail.getFeatureAmplitude());
+ po.setPhase(oracleDetail.getPhase());
+ po.setEventDescribe(oracleDetail.getEventDescribe());
+ po.setWavePath(oracleDetail.getWavePath());
+ po.setTransientValue(oracleDetail.getTransientValue());
+ this.saveOrUpdate(po);
+ }
+ }
+
+ //获取暂降类型id
+ private String eventTypeId(String eventType, List eventTypeList){
+ String code="";
+ //事件类型(0:扰动,1:暂降,2:暂升,3:中断,4:其他,5:录波)
+ if("0".equals(eventType)){
+ code="Disturbance";
+ }
+ if("1".equals(eventType)){
+ code="Voltage_Dip";
+ }
+ if("2".equals(eventType)){
+ code="Voltage_Rise";
+ }
+ if("3".equals(eventType)){
+ code="Short_Interruptions";
+ }
+ if("4".equals(eventType)){
+ code="Other";
+ }
+ if("5".equals(eventType)){
+ code="Recording_Wave";
+ }
+ String finalCode = code;
+ DictData dictData = eventTypeList.stream().filter(x -> finalCode.equals(x.getCode())).findFirst().get();
+ if(ObjectUtil.isNotNull(dictData)){
+ return dictData.getId();
+ }
+ return "";
+ }
+
+ //类型匹配
+ private Map getRelationList(List oracleReason,List mysqlReason){
+ Map map=new HashMap<>();
+ for (DictData dictData : oracleReason) {
+ for (DictData data : mysqlReason) {
+ if(dictData.getAlgoDescribe().equals(data.getAlgoDescribe())){
+ map.put(dictData.getId(),data.getId());
+ }
+ }
+ }
+ return map;
+ }
+
+ private String getDicId(String dicReason,Map map){
+ if(map.containsKey(dicReason)){
+ return map.get(dicReason);
+ }
+ return "";
+ }
+}
diff --git a/influx-data/influx-source/src/main/java/com/njcn/influx/sftp/SftpClient.java b/influx-data/influx-source/src/main/java/com/njcn/influx/sftp/SftpClient.java
new file mode 100644
index 0000000..053f038
--- /dev/null
+++ b/influx-data/influx-source/src/main/java/com/njcn/influx/sftp/SftpClient.java
@@ -0,0 +1,126 @@
+package com.njcn.influx.sftp;
+
+import com.jcraft.jsch.ChannelSftp;
+import com.jcraft.jsch.*;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.SftpException;
+import com.njcn.influx.config.TargetConfig;
+import lombok.Data;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.util.Vector;
+
+/**
+ * Description:
+ * Date: 2025/10/16 下午 3:00【需求编号】
+ *SFTP客户端实现
+ * @author clam
+ * @version V1.0.0
+ */
+@Service
+@Data
+public class SftpClient implements AutoCloseable{
+ private static final Logger logger = LoggerFactory.getLogger(SftpClient.class);
+
+ private JSch jsch;
+ private Session session;
+ private ChannelSftp channel;
+
+ public void connect(TargetConfig config) throws JSchException {
+ jsch = new JSch();
+
+ // 设置私钥(如果提供)
+ if (config.getPrivateKeyPath() != null && !config.getPrivateKeyPath().isEmpty()) {
+ jsch.addIdentity(config.getPrivateKeyPath());
+ }
+
+ session = jsch.getSession(config.getUsername(), config.getHost(), config.getPort());
+
+ // 设置密码(如果提供)
+ if (config.getPassword() != null && !config.getPassword().isEmpty()) {
+ session.setPassword(config.getPassword());
+ }
+
+ // 配置SSH连接
+ java.util.Properties sshConfig = new java.util.Properties();
+ sshConfig.put("StrictHostKeyChecking", "no");
+ session.setConfig(sshConfig);
+
+ session.connect(30000); // 30秒超时
+
+ // 打开SFTP通道
+ channel = (ChannelSftp) session.openChannel("sftp");
+ channel.connect(30000);
+ }
+ public void uploadFile(String localFile, String remotePath) throws SftpException {
+ File file = new File(localFile);
+ String remoteFile = ensureRemotePath(remotePath, file.getName());
+
+ // 确保远程目录存在
+ createRemoteDirectory(remotePath);
+
+ // 上传文件
+ channel.put(localFile, remoteFile);
+ }
+
+ public ChannelSftp.LsEntry getRemoteFileInfo(String remotePath) throws SftpException {
+ @SuppressWarnings("unchecked")
+ Vector files = channel.ls(remotePath);
+ if (files != null && !files.isEmpty()) {
+ return files.get(0);
+ }
+ return null;
+ }
+
+ private String ensureRemotePath(String remotePath, String fileName) {
+ if (remotePath.endsWith("/")) {
+ return remotePath + fileName;
+ } else {
+ return remotePath + "/" + fileName;
+ }
+ }
+
+ public void createRemoteDirectory(String remotePath) throws SftpException {
+
+ // 处理Windows路径分隔符
+ String normalizedPath = remotePath.replace("\\", "/");
+ // 去掉开头的/(避免根目录重复创建)
+ if (normalizedPath.startsWith("/")) {
+ normalizedPath = normalizedPath.substring(1);
+ }
+ String[] directories = normalizedPath.split("/");
+ StringBuilder currentPath = new StringBuilder();
+
+ // 递归创建多层目录
+ for (String dir : directories) {
+ if (dir.isEmpty()) {
+ continue;
+ }
+ currentPath.append("/").append(dir);
+ try {
+ channel.mkdir(currentPath.toString());
+ logger.debug("创建远程目录成功: {}", currentPath);
+ } catch (SftpException e) {
+ if (e.id != ChannelSftp.SSH_FX_FAILURE) {
+ logger.error("创建远程目录失败: {}", currentPath, e);
+ throw e;
+ } else {
+ logger.debug("远程目录已存在: {}", currentPath);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void close() {
+ if (channel != null) {
+ channel.disconnect();
+ }
+ if (session != null) {
+ session.disconnect();
+ }
+ }
+}
diff --git a/influx-data/influx-target/pom.xml b/influx-data/influx-target/pom.xml
index 70a6e63..066f923 100644
--- a/influx-data/influx-target/pom.xml
+++ b/influx-data/influx-target/pom.xml
@@ -50,6 +50,37 @@
influx-target
+
+
+ src/main/resources
+ true
+
+ *.yml
+
+
+
+ src/main/resources
+ false
+
+ *.dll
+ *.xlsx
+
+
+
+ src/main/resources
+ false
+
+ *.so
+
+
+
+ src/main/java
+ false
+
+ **/*.xml
+
+
+
org.springframework.boot
diff --git a/influx-data/influx-target/src/main/java/com/njcn/influx/controller/OracleToInfluxDBController.java b/influx-data/influx-target/src/main/java/com/njcn/influx/controller/OracleToInfluxDBController.java
index e972a88..6f57206 100644
--- a/influx-data/influx-target/src/main/java/com/njcn/influx/controller/OracleToInfluxDBController.java
+++ b/influx-data/influx-target/src/main/java/com/njcn/influx/controller/OracleToInfluxDBController.java
@@ -3,10 +3,7 @@ package com.njcn.influx.controller;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.StrUtil;
-import com.njcn.influx.service.OracleEventDetailToMysqlService;
-import com.njcn.influx.service.OracleMonitorStatusToMysqlService;
-import com.njcn.influx.service.OracleToInfluxDBService;
-import com.njcn.influx.service.PqsOnlineratePOService;
+import com.njcn.influx.service.*;
import com.njcn.oracle.bo.param.DataAsynParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -44,6 +41,7 @@ public class OracleToInfluxDBController {
private final OracleEventDetailToMysqlService oracleEventDetailToMysqlService;
private final OracleMonitorStatusToMysqlService oracleMonitorStatusToMysqlService;
+ private final OracleToMysqlService oracleToMysqlService;
@PostMapping("/dataSync")
@ApiOperation("数据同步")
@@ -119,6 +117,20 @@ public class OracleToInfluxDBController {
}
return true;
}
+
+ @GetMapping("/eventRecall")
+ @ApiOperation("eventDetail表数据同步补招接口")
+ public Boolean eventRecall(@RequestParam("startDateTime") String startDateTime,@RequestParam("endDateTime") String endDateTime) {
+ try {
+ LocalDateTime startDate = LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(startDateTime, DatePattern.NORM_DATETIME_PATTERN));
+ LocalDateTime endDate = LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(endDateTime, DatePattern.NORM_DATETIME_PATTERN));
+ oracleToMysqlService.OracleToMySqlJob(startDate, endDate );
+
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ return true;
+ }
@GetMapping("/mSync")
@ApiOperation("监测点信息同步")
public Boolean monitorTimeSync() {
diff --git a/influx-data/influx-target/src/main/java/com/njcn/influx/job/OracleToInfluxDBJob.java b/influx-data/influx-target/src/main/java/com/njcn/influx/job/OracleToInfluxDBJob.java
index 97b65d1..ebd4a0c 100644
--- a/influx-data/influx-target/src/main/java/com/njcn/influx/job/OracleToInfluxDBJob.java
+++ b/influx-data/influx-target/src/main/java/com/njcn/influx/job/OracleToInfluxDBJob.java
@@ -1,123 +1,125 @@
-package com.njcn.influx.job;
-
-import com.njcn.influx.bo.param.TableEnum;
-import com.njcn.influx.service.OracleEventDetailToMysqlService;
-import com.njcn.influx.service.OracleMonitorStatusToMysqlService;
-import com.njcn.influx.service.OracleToInfluxDBService;
-import com.njcn.influx.service.PqsOnlineratePOService;
-import com.njcn.oracle.bo.param.DataAsynParam;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.temporal.ChronoUnit;
-
-/**
- * Description:
- * Date: 2024/1/18 10:15【需求编号】
- *
- * @author clam
- * @version V1.0.0
- */
-@Component
-@EnableScheduling
-@RequiredArgsConstructor
-@Slf4j
-public class OracleToInfluxDBJob {
-
-
- private final OracleToInfluxDBService oracleToInfluxDBService;
-
- private final OracleEventDetailToMysqlService oracleEventDetailToMysqlService;
- private final OracleMonitorStatusToMysqlService oracleMonitorStatusToMysqlService;
-
- private final PqsOnlineratePOService pqsOnlineratePOService;
- /*@Scheduled(cron="0 5 0 * * ?")
- public void execute() {
- DataAsynParam dataAsynParam = new DataAsynParam();
- dataAsynParam.setStartTime(LocalDate.now().plusDays(-1));
- dataAsynParam.setEndTime(LocalDate.now().plusDays(-1));
- dataAsynParam.setTableNames(TableEnum.getExecutableTypes());
- dataAsynParam.setExcuteType(2);
- oracleToInfluxDBService.dataBacthSysc(dataAsynParam);
- }*/
-
- //每小时03分钟时执行上一个小时的数据同步
- //河北这边比较特殊,
- @Scheduled(cron="0 15 * * * ?")
- public void executeHours() {
- DataAsynParam dataAsynParam = new DataAsynParam();
- // 获取当前时间
- LocalDateTime now = LocalDateTime.now();
-
- // 减去一个小时
- LocalDateTime oneHourAgo = now.minusHours(2);
-
- // 将分钟和秒设置为0
- LocalDateTime result = oneHourAgo.truncatedTo(ChronoUnit.HOURS);
- // 加上59分钟59秒
- LocalDateTime modifiedResult = result.plusMinutes(59).plusSeconds(59);
- dataAsynParam.setStartDateTime(result);
- dataAsynParam.setEndDateTime(modifiedResult);
- dataAsynParam.setTableNames(TableEnum.getExecutableTypes());
- dataAsynParam.setExcuteType(2);
- oracleToInfluxDBService.hourseDataBacthSysc(dataAsynParam);
- }
- //每10分钟执行一次pqOnlinerate表同步
- @Scheduled(cron="0 0/10 * * * ?")
- public void pqOnlinerate() {
- DataAsynParam dataAsynParam = new DataAsynParam();
- // 获取当前时间
- LocalDateTime now = LocalDateTime.now();
- dataAsynParam.setStartDateTime(now);
- pqsOnlineratePOService.minutesDataBacthSysc(dataAsynParam);
- }
-
- /**
- * 每小时同步oracle数据库暂态事件
- * @date 2024/3/5
- */
- @Scheduled(cron="0 0/10 * * * ?")
- public void executeEvent() {
- // 获取当前时间
- LocalDateTime now = LocalDateTime.now();
- // 减去一个小时
- LocalDateTime oneHourAgo = now.minusHours(1);
- // 将分钟和秒设置为0
- LocalDateTime result = oneHourAgo.truncatedTo(ChronoUnit.HOURS);
- // 加上59分钟59秒
- LocalDateTime modifiedResult = result.plusMinutes(59).plusSeconds(59);
- oracleEventDetailToMysqlService.eventBatch(result,modifiedResult);
- }
-
- /**
- * 每天同步台账装置的运行状态,监测点的运行状态
- * @date 2024/3/5
- */
- @Scheduled(cron="0 0/10 * * * ?")
- public void synLedgerRunFlag() {
- oracleMonitorStatusToMysqlService.monitorStatusSync();
- }
-
- /**
- * 每天同步台账装置的最后更新时间
- * @date 2024/3/5
- */
- @Scheduled(cron="0 45 0 * * ?")
- public void synLedgerUpdateTime() {
- oracleMonitorStatusToMysqlService.devUpdateTimeSync();
- }
-
- /**
- * 每天同步台账监测点部分信息 仅数据中心使用
- * @date 2024/3/5
- */
- /* @Scheduled(cron="0 30 0 * * ?")
- public void synLedgerMonitor() {
- oracleMonitorStatusToMysqlService.monitorTimeSync();
- }*/
-}
+//package com.njcn.influx.job;
+//
+//import com.njcn.influx.bo.param.TableEnum;
+//import com.njcn.influx.service.OracleEventDetailToMysqlService;
+//import com.njcn.influx.service.OracleMonitorStatusToMysqlService;
+//import com.njcn.influx.service.OracleToInfluxDBService;
+//import com.njcn.influx.service.PqsOnlineratePOService;
+//import com.njcn.oracle.bo.param.DataAsynParam;
+//import lombok.RequiredArgsConstructor;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.scheduling.annotation.EnableScheduling;
+//import org.springframework.scheduling.annotation.Scheduled;
+//import org.springframework.stereotype.Component;
+//
+//import java.time.LocalDate;
+//import java.time.LocalDateTime;
+//import java.time.temporal.ChronoUnit;
+//
+///**
+// * Description:
+// * Date: 2024/1/18 10:15【需求编号】
+// *
+// * @author clam
+// * @version V1.0.0
+// */
+//@Component
+//@EnableScheduling
+//@RequiredArgsConstructor
+//@Slf4j
+//public class OracleToInfluxDBJob {
+//
+//
+// private final OracleToInfluxDBService oracleToInfluxDBService;
+//
+// private final OracleEventDetailToMysqlService oracleEventDetailToMysqlService;
+// private final OracleMonitorStatusToMysqlService oracleMonitorStatusToMysqlService;
+//
+// private final PqsOnlineratePOService pqsOnlineratePOService;
+// /*@Scheduled(cron="0 5 0 * * ?")
+// public void execute() {
+// DataAsynParam dataAsynParam = new DataAsynParam();
+// dataAsynParam.setStartTime(LocalDate.now().plusDays(-1));
+// dataAsynParam.setEndTime(LocalDate.now().plusDays(-1));
+// dataAsynParam.setTableNames(TableEnum.getExecutableTypes());
+// dataAsynParam.setExcuteType(2);
+// oracleToInfluxDBService.dataBacthSysc(dataAsynParam);
+// }*/
+//
+// //每小时03分钟时执行上一个小时的数据同步
+// //河北这边比较特殊,
+// @Scheduled(cron="0 15 * * * ?")
+// public void executeHours() {
+// DataAsynParam dataAsynParam = new DataAsynParam();
+// // 获取当前时间
+// LocalDateTime now = LocalDateTime.now();
+//
+// // 减去一个小时
+// LocalDateTime oneHourAgo = now.minusHours(2);
+//
+// // 将分钟和秒设置为0
+// LocalDateTime result = oneHourAgo.truncatedTo(ChronoUnit.HOURS);
+// // 加上59分钟59秒
+// LocalDateTime modifiedResult = result.plusMinutes(59).plusSeconds(59);
+// dataAsynParam.setStartDateTime(result);
+// dataAsynParam.setEndDateTime(modifiedResult);
+// dataAsynParam.setTableNames(TableEnum.getExecutableTypes());
+// dataAsynParam.setExcuteType(2);
+// oracleToInfluxDBService.hourseDataBacthSysc(dataAsynParam);
+// }
+// //每10分钟执行一次pqOnlinerate表同步
+//// @Scheduled(cron="0 0/10 * * * ?")
+//// public void pqOnlinerate() {
+//// DataAsynParam dataAsynParam = new DataAsynParam();
+//// // 获取当前时间
+//// LocalDateTime now = LocalDateTime.now();
+//// dataAsynParam.setStartDateTime(now);
+//// pqsOnlineratePOService.minutesDataBacthSysc(dataAsynParam);
+//// }
+//
+// /**
+// * 每小时同步oracle数据库暂态事件
+// * @date 2024/3/5
+// */
+// @Scheduled(cron="0 0/10 * * * ?")
+// public void executeEvent() {
+// // 获取当前时间
+// LocalDateTime now = LocalDateTime.now();
+// // 减去一个小时
+// LocalDateTime oneHourAgo = now.minusHours(1);
+// // 将分钟和秒设置为0
+// LocalDateTime result = oneHourAgo.truncatedTo(ChronoUnit.HOURS);
+// // 加上59分钟59秒
+// LocalDateTime modifiedResult = result.plusMinutes(59).plusSeconds(59);
+// oracleEventDetailToMysqlService.eventBatch(result,modifiedResult);
+// }
+//
+// /**
+// * 每天同步台账装置的运行状态,监测点的运行状态
+// * @date 2024/3/5
+// */
+// @Scheduled(cron="0 0/10 * * * ?")
+// public void synLedgerRunFlag() {
+// oracleMonitorStatusToMysqlService.monitorStatusSync();
+// }
+//
+// /**
+// * 每天同步台账装置的最后更新时间
+// * @date 2024/3/5
+// */
+// @Scheduled(cron="0 45 0 * * ?")
+// public void synLedgerUpdateTime() {
+// oracleMonitorStatusToMysqlService.devUpdateTimeSync();
+// }
+//
+// /**
+// * 每天同步台账监测点部分信息 仅数据中心使用
+// * @date 2024/3/5
+// */
+// /* @Scheduled(cron="0 30 0 * * ?")
+// public void synLedgerMonitor() {
+// oracleMonitorStatusToMysqlService.monitorTimeSync();
+// }*/
+//}
+//
+//
diff --git a/influx-data/influx-target/src/main/java/com/njcn/influx/job/OracleToMySqlJob.java b/influx-data/influx-target/src/main/java/com/njcn/influx/job/OracleToMySqlJob.java
new file mode 100644
index 0000000..a2bd60d
--- /dev/null
+++ b/influx-data/influx-target/src/main/java/com/njcn/influx/job/OracleToMySqlJob.java
@@ -0,0 +1,50 @@
+package com.njcn.influx.job;
+
+
+import com.njcn.influx.service.OracleToMysqlService;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+import java.time.temporal.ChronoUnit;
+
+
+/**
+ * Description:
+ * Date: 2026/04/20 上午 9:44【需求编号】
+ *
+ * @author clam
+ * @version V1.0.0
+ */
+@Component
+@EnableScheduling
+@RequiredArgsConstructor
+@Slf4j
+public class OracleToMySqlJob {
+
+ private final OracleToMysqlService oracleToMysqlService;
+
+
+ @Scheduled(cron = "${business.executeEventExpression}")
+ public void executeEvent() {
+ // 获取当前时间
+ LocalDateTime now = LocalDateTime.now();
+ // 减去一个小时
+ LocalDateTime oneHourAgo = now.minusHours(3);
+
+ oracleToMysqlService.OracleToMySqlJob(oneHourAgo,now);
+ }
+
+
+ // ==============================
+ // 每10分钟:重试 + 2天过期处理
+ // ==============================
+ @Scheduled(cron = "${business.retryAndCleanEvery10Min}")
+ public void retryAndCleanEvery10Min() {
+
+ oracleToMysqlService.retryAndCleanEvery10Min();;
+ }
+}
diff --git a/influx-data/influx-target/src/main/resources/application-bd.yml b/influx-data/influx-target/src/main/resources/application-bd.yml
new file mode 100644
index 0000000..72a79af
--- /dev/null
+++ b/influx-data/influx-target/src/main/resources/application-bd.yml
@@ -0,0 +1,130 @@
+
+business:
+ #分片次数,一定为24的约数,1 2 3 4 6 8 12 24
+ slice: 4
+ # 0.pq 1.pms
+ type: 0
+ #处理波形数据位置
+ wavePath: D:\Comtrade
+ retryAndCleanEvery10Min: 0 */10 * * * ?
+ executeEventExpression: 0 */3 * * * ?
+server:
+ port: 8093
+ #springsecurity默认过期时间30m
+ servlet:
+ session:
+ timeout: 1440m
+ target:
+ host: 192.168.1.67
+ port: 22
+ username: root
+ password: 'dnzl@#001'
+ basePath: /home/hndnzl
+ privateKeyPath:
+
+spring:
+ security:
+ user:
+ name: data_njcn
+ password: dnzl@#002
+ #influxDB内容配置
+ influx:
+ url: http://192.168.1.103:18086
+ user: admin
+ password: 123456
+ database: pqsbase_wx
+ mapper-location: com.njcn.influx.imapper
+ application:
+ name: oracle-influx
+ autoconfigure:
+ exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+ datasource:
+ dynamic:
+ druid:
+ initial-size: 10
+ # 初始化大小,最小,最大
+ min-idle: 20
+ maxActive: 500
+ # 配置获取连接等待超时的时间
+ maxWait: 60000
+ # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+ timeBetweenEvictionRunsMillis: 60000
+ # 配置一个连接在池中最小生存的时间,单位是毫秒
+ minEvictableIdleTimeMillis: 300000
+ testWhileIdle: true
+ testOnBorrow: true
+ validation-query: SELECT 1 from dual
+ testOnReturn: false
+ # 打开PSCache,并且指定每个连接上PSCache的大小
+ poolPreparedStatements: true
+ maxPoolPreparedStatementPerConnectionSize: 20
+ filters: stat,wall
+ filter:
+ wall:
+ config:
+ multi-statement-allow: true
+ none-base-statement-allow: true
+ enabled: true
+ # 配置DruidStatFilter
+ web-stat-filter:
+ enabled: true
+ url-pattern: "/*"
+ exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"
+ # 配置DruidStatViewServlet
+ stat-view-servlet:
+ enabled: true
+ url-pattern: "/druid/*"
+ # IP白名单(没有配置或者为空,则允许所有访问)
+ allow: #127.0.0.1,192.168.163.1
+ # IP黑名单 (存在共同时,deny优先于allow)
+ deny: #192.168.1.73
+ # 禁用HTML页面上的“Reset All”功能
+ reset-enable: false
+ # 登录名
+ login-username: admin
+ # 登录密码
+ login-password: njcnpqs
+ query-timeout: 36000
+ primary: master
+ strict: false
+ datasource:
+ master:
+ url: jdbc:oracle:thin:@127.0.0.1:1521:pqsbase
+ username: pqsadmin
+ password: '@#001njcnpqs'
+ driver-class-name: oracle.jdbc.driver.OracleDriver
+ target:
+ url: jdbc:mysql://192.168.1.103:13307/pqsinfo_hn?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
+ username: root
+ password: njcnpqs
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ redis:
+ database: 15
+ host: 192.168.1.103
+ port: 16379
+ password: njcnpqs
+ timeout: 5000
+ lettuce:
+ pool:
+ max-active: 8
+ max-wait: -1
+ max-idle: 8
+ min-idle: 0
+ #不做限制的参数配置
+#mybatis配置信息
+mybatis-plus:
+ #别名扫描
+ type-aliases-package: com.njcn.oracle.bo
+ mapper-locations: classpath*:com/njcn/**/mapping/*.xml
+ configuration:
+ #驼峰命名
+ map-underscore-to-camel-case: true
+ #配置sql日志输出
+ # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+ #关闭日志输出
+ log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
+ global-config:
+ db-config:
+ #指定主键生成策略
+ id-type: assign_uuid
+
diff --git a/influx-data/influx-target/src/main/resources/application-hn.yml b/influx-data/influx-target/src/main/resources/application-hn.yml
new file mode 100644
index 0000000..16488df
--- /dev/null
+++ b/influx-data/influx-target/src/main/resources/application-hn.yml
@@ -0,0 +1,130 @@
+
+business:
+ #分片次数,一定为24的约数,1 2 3 4 6 8 12 24
+ slice: 4
+ # 0.pq 1.pms
+ type: 0
+ #处理波形数据位置
+ wavePath: F:\Comtrade
+ retryAndCleanEvery10Min: 0 */10 * * * ?
+ executeEventExpression: 0 */3 * * * ?
+server:
+ port: 8093
+ #springsecurity默认过期时间30m
+ servlet:
+ session:
+ timeout: 1440m
+ target:
+ host: 10.95.53.49
+ port: 9389
+ username: hndnzl
+ password: '@#001njcnPQS'
+ basePath: /home/hndnzl
+ privateKeyPath:
+
+spring:
+ security:
+ user:
+ name: data_njcn
+ password: dnzl@#002
+ #influxDB内容配置
+ influx:
+ url: http://10.95.53.49:8086
+ user: pqsdata
+ password: njcn@#001
+ database: pqsbase
+ mapper-location: com.njcn.influx.imapper
+ application:
+ name: oracle-influx
+ autoconfigure:
+ exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+ datasource:
+ dynamic:
+ druid:
+ initial-size: 10
+ # 初始化大小,最小,最大
+ min-idle: 20
+ maxActive: 500
+ # 配置获取连接等待超时的时间
+ maxWait: 60000
+ # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+ timeBetweenEvictionRunsMillis: 60000
+ # 配置一个连接在池中最小生存的时间,单位是毫秒
+ minEvictableIdleTimeMillis: 300000
+ testWhileIdle: true
+ testOnBorrow: true
+ validation-query: SELECT 1 from dual
+ testOnReturn: false
+ # 打开PSCache,并且指定每个连接上PSCache的大小
+ poolPreparedStatements: true
+ maxPoolPreparedStatementPerConnectionSize: 20
+ filters: stat,wall
+ filter:
+ wall:
+ config:
+ multi-statement-allow: true
+ none-base-statement-allow: true
+ enabled: true
+ # 配置DruidStatFilter
+ web-stat-filter:
+ enabled: true
+ url-pattern: "/*"
+ exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"
+ # 配置DruidStatViewServlet
+ stat-view-servlet:
+ enabled: true
+ url-pattern: "/druid/*"
+ # IP白名单(没有配置或者为空,则允许所有访问)
+ allow: #127.0.0.1,192.168.163.1
+ # IP黑名单 (存在共同时,deny优先于allow)
+ deny: #192.168.1.73
+ # 禁用HTML页面上的“Reset All”功能
+ reset-enable: false
+ # 登录名
+ login-username: admin
+ # 登录密码
+ login-password: njcnpqs
+ query-timeout: 36000
+ primary: master
+ strict: false
+ datasource:
+ master:
+ url: jdbc:oracle:thin:@10.95.53.40:11521:pqsbase
+ username: pqsadmin
+ password: "@#001njcnpqs"
+ driver-class-name: oracle.jdbc.driver.OracleDriver
+ target:
+ url: jdbc:mysql://10.95.53.49:13306/pqsinfo_hn?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
+ username: root
+ password: njcnpqs
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ redis:
+ database: 15
+ host: 10.95.53.49
+ port: 16379
+ password: njcnpqs
+ timeout: 5000
+ lettuce:
+ pool:
+ max-active: 8
+ max-wait: -1
+ max-idle: 8
+ min-idle: 0
+ #不做限制的参数配置
+#mybatis配置信息
+mybatis-plus:
+ #别名扫描
+ type-aliases-package: com.njcn.oracle.bo
+ mapper-locations: classpath*:com/njcn/**/mapping/*.xml
+ configuration:
+ #驼峰命名
+ map-underscore-to-camel-case: true
+ #配置sql日志输出
+ # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+ #关闭日志输出
+ log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
+ global-config:
+ db-config:
+ #指定主键生成策略
+ id-type: assign_uuid
+
diff --git a/influx-data/influx-target/src/main/resources/application.yml b/influx-data/influx-target/src/main/resources/application.yml
index faed30b..dd97f41 100644
--- a/influx-data/influx-target/src/main/resources/application.yml
+++ b/influx-data/influx-target/src/main/resources/application.yml
@@ -1,119 +1,3 @@
-
-business:
- #分片次数,一定为24的约数,1 2 3 4 6 8 12 24
- slice: 4
- # 0.pq 1.pms
- type: 0
-server:
- port: 8090
- #springsecurity默认过期时间30m
- servlet:
- session:
- timeout: 1440m
-
spring:
- security:
- user:
- name: data_njcn
- password: dnzl@#002
- #influxDB内容配置
- influx:
- url: http://192.168.1.102:8086
- user: admin
- password: 123456
- database: pqsbase_sjzx
- mapper-location: com.njcn.influx.imapper
- application:
- name: oracle-influx
- autoconfigure:
- exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
- datasource:
- dynamic:
- druid:
- initial-size: 10
- # 初始化大小,最小,最大
- min-idle: 20
- maxActive: 500
- # 配置获取连接等待超时的时间
- maxWait: 60000
- # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
- timeBetweenEvictionRunsMillis: 60000
- # 配置一个连接在池中最小生存的时间,单位是毫秒
- minEvictableIdleTimeMillis: 300000
- testWhileIdle: true
- testOnBorrow: true
- validation-query: SELECT 1 from dual
- testOnReturn: false
- # 打开PSCache,并且指定每个连接上PSCache的大小
- poolPreparedStatements: true
- maxPoolPreparedStatementPerConnectionSize: 20
- filters: stat,wall
- filter:
- wall:
- config:
- multi-statement-allow: true
- none-base-statement-allow: true
- enabled: true
- # 配置DruidStatFilter
- web-stat-filter:
- enabled: true
- url-pattern: "/*"
- exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"
- # 配置DruidStatViewServlet
- stat-view-servlet:
- enabled: true
- url-pattern: "/druid/*"
- # IP白名单(没有配置或者为空,则允许所有访问)
- allow: #127.0.0.1,192.168.163.1
- # IP黑名单 (存在共同时,deny优先于allow)
- deny: #192.168.1.73
- # 禁用HTML页面上的“Reset All”功能
- reset-enable: false
- # 登录名
- login-username: admin
- # 登录密码
- login-password: njcnpqs
- query-timeout: 36000
- primary: master
- strict: false
- datasource:
- master:
- url: jdbc:oracle:thin:@192.168.1.101:1521:pqsbase
- username: pqsadmin
- password: Pqsadmin123
- driver-class-name: oracle.jdbc.driver.OracleDriver
- target:
- url: jdbc:mysql://192.168.1.102:13306/pqsinfo?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
- username: root
- password: njcnpqs
- driver-class-name: com.mysql.cj.jdbc.Driver
- redis:
- database: 15
- host: 192.168.1.22
- port: 16379
- password: njcnpqs
- timeout: 5000
- lettuce:
- pool:
- max-active: 8
- max-wait: -1
- max-idle: 8
- min-idle: 0
- #不做限制的参数配置
-#mybatis配置信息
-mybatis-plus:
- #别名扫描
- type-aliases-package: com.njcn.oracle.bo
- mapper-locations: classpath*:com/njcn/**/mapping/*.xml
- configuration:
- #驼峰命名
- map-underscore-to-camel-case: true
- #配置sql日志输出
- # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
- #关闭日志输出
- log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
- global-config:
- db-config:
- #指定主键生成策略
- id-type: assign_uuid
-
+ profiles:
+ active: bd
\ No newline at end of file
diff --git a/influx-data/influx-target/src/main/resources/application_hb.yml b/influx-data/influx-target/src/main/resources/application_hb.yml
index 057a2ab..c10dbdf 100644
--- a/influx-data/influx-target/src/main/resources/application_hb.yml
+++ b/influx-data/influx-target/src/main/resources/application_hb.yml
@@ -1,102 +1,102 @@
-#文件位置配置
-business:
- #分片次数,一定为24的约数,1 2 3 4 6 8 12 24
- slice: 4
- # 0.pq 1.pms
- type: 1
-
-server:
- port: 8090
-spring:
- security:
- user:
- name: data_njcn
- password: dnzl@#002
- #influxDB内容配置
- influx:
- url: http://25.36.232.36:8086
- user: admin
- password: admin
- database: pqsbase_hbcs
- mapper-location: com.njcn.influx.imapper
- application:
- name: oracle-influx
- autoconfigure:
- exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
- datasource:
- dynamic:
- druid:
- initial-size: 10
- # 初始化大小,最小,最大
- min-idle: 20
- maxActive: 500
- # 配置获取连接等待超时的时间
- maxWait: 60000
- # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
- timeBetweenEvictionRunsMillis: 60000
- # 配置一个连接在池中最小生存的时间,单位是毫秒
- minEvictableIdleTimeMillis: 300000
- testWhileIdle: true
- testOnBorrow: true
- validation-query: SELECT 1 from dual
- testOnReturn: false
- # 打开PSCache,并且指定每个连接上PSCache的大小
- poolPreparedStatements: true
- maxPoolPreparedStatementPerConnectionSize: 20
- filters: stat,wall
- filter:
- wall:
- config:
- multi-statement-allow: true
- none-base-statement-allow: true
- enabled: true
- # 配置DruidStatFilter
- web-stat-filter:
- enabled: true
- url-pattern: "/*"
- exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"
- # 配置DruidStatViewServlet
- stat-view-servlet:
- enabled: true
- url-pattern: "/druid/*"
- # IP白名单(没有配置或者为空,则允许所有访问)
- allow: #127.0.0.1,192.168.163.1
- # IP黑名单 (存在共同时,deny优先于allow)
- deny: #192.168.1.73
- # 禁用HTML页面上的“Reset All”功能
- reset-enable: false
- # 登录名
- login-username: admin
- # 登录密码
- login-password: njcnpqs
- query-timeout: 36000
- primary: master
- strict: false
- datasource:
- master:
- url: jdbc:oracle:thin:@10.122.32.73:11521/dwxb
- username: pqsadmin
- password: pqsadmin_123
- driver-class-name: oracle.jdbc.driver.OracleDriver
- target:
- url: jdbc:mysql://25.36.232.37:13306/pmsinfo?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
- username: root
- password: Huawei12#
- driver-class-name: com.mysql.cj.jdbc.Driver
-#mybatis配置信息
-mybatis-plus:
- #别名扫描
- type-aliases-package: com.njcn.oracle.bo
- mapper-locations: classpath*:com/njcn/**/mapping/*.xml
- configuration:
- #驼峰命名
- map-underscore-to-camel-case: true
- #配置sql日志输出
- # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
- #关闭日志输出
- log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
- global-config:
- db-config:
- #指定主键生成策略
- id-type: assign_uuid
-
+##文件位置配置
+#business:
+# #分片次数,一定为24的约数,1 2 3 4 6 8 12 24
+# slice: 4
+# # 0.pq 1.pms
+# type: 1
+#
+#server:
+# port: 8090
+#spring:
+# security:
+# user:
+# name: data_njcn
+# password: dnzl@#002
+# #influxDB内容配置
+# influx:
+# url: http://25.36.232.36:8086
+# user: admin
+# password: admin
+# database: pqsbase_hbcs
+# mapper-location: com.njcn.influx.imapper
+# application:
+# name: oracle-influx
+# autoconfigure:
+# exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+# datasource:
+# dynamic:
+# druid:
+# initial-size: 10
+# # 初始化大小,最小,最大
+# min-idle: 20
+# maxActive: 500
+# # 配置获取连接等待超时的时间
+# maxWait: 60000
+# # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+# timeBetweenEvictionRunsMillis: 60000
+# # 配置一个连接在池中最小生存的时间,单位是毫秒
+# minEvictableIdleTimeMillis: 300000
+# testWhileIdle: true
+# testOnBorrow: true
+# validation-query: SELECT 1 from dual
+# testOnReturn: false
+# # 打开PSCache,并且指定每个连接上PSCache的大小
+# poolPreparedStatements: true
+# maxPoolPreparedStatementPerConnectionSize: 20
+# filters: stat,wall
+# filter:
+# wall:
+# config:
+# multi-statement-allow: true
+# none-base-statement-allow: true
+# enabled: true
+# # 配置DruidStatFilter
+# web-stat-filter:
+# enabled: true
+# url-pattern: "/*"
+# exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"
+# # 配置DruidStatViewServlet
+# stat-view-servlet:
+# enabled: true
+# url-pattern: "/druid/*"
+# # IP白名单(没有配置或者为空,则允许所有访问)
+# allow: #127.0.0.1,192.168.163.1
+# # IP黑名单 (存在共同时,deny优先于allow)
+# deny: #192.168.1.73
+# # 禁用HTML页面上的“Reset All”功能
+# reset-enable: false
+# # 登录名
+# login-username: admin
+# # 登录密码
+# login-password: njcnpqs
+# query-timeout: 36000
+# primary: master
+# strict: false
+# datasource:
+# master:
+# url: jdbc:oracle:thin:@10.122.32.73:11521/dwxb
+# username: pqsadmin
+# password: pqsadmin_123
+# driver-class-name: oracle.jdbc.driver.OracleDriver
+# target:
+# url: jdbc:mysql://25.36.232.37:13306/pmsinfo?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
+# username: root
+# password: Huawei12#
+# driver-class-name: com.mysql.cj.jdbc.Driver
+##mybatis配置信息
+#mybatis-plus:
+# #别名扫描
+# type-aliases-package: com.njcn.oracle.bo
+# mapper-locations: classpath*:com/njcn/**/mapping/*.xml
+# configuration:
+# #驼峰命名
+# map-underscore-to-camel-case: true
+# #配置sql日志输出
+# # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+# #关闭日志输出
+# log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
+# global-config:
+# db-config:
+# #指定主键生成策略
+# id-type: assign_uuid
+#
diff --git a/influx-data/influx-target/src/main/resources/application_sjzx.yml b/influx-data/influx-target/src/main/resources/application_sjzx.yml
index e04c7dc..ca9a589 100644
--- a/influx-data/influx-target/src/main/resources/application_sjzx.yml
+++ b/influx-data/influx-target/src/main/resources/application_sjzx.yml
@@ -1,101 +1,101 @@
-#文件位置配置
-business:
-#分片次数,一定为24的约数,1 2 3 4 6 8 12 24
- slice: 4
- # 0.pq 1.pms
- type: 0
-server:
- port: 8090
-spring:
- security:
- user:
- name: data_njcn
- password: dnzl@#002
- #influxDB内容配置
- influx:
- url: http://192.168.1.102:8086
- user: admin
- password: 123456
- database: pqsbase_sjzx
- mapper-location: com.njcn.influx.imapper
- application:
- name: oracle-influx
- autoconfigure:
- exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
- datasource:
- dynamic:
- druid:
- initial-size: 10
- # 初始化大小,最小,最大
- min-idle: 20
- maxActive: 500
- # 配置获取连接等待超时的时间
- maxWait: 60000
- # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
- timeBetweenEvictionRunsMillis: 60000
- # 配置一个连接在池中最小生存的时间,单位是毫秒
- minEvictableIdleTimeMillis: 300000
- testWhileIdle: true
- testOnBorrow: true
- validation-query: SELECT 1 from dual
- testOnReturn: false
- # 打开PSCache,并且指定每个连接上PSCache的大小
- poolPreparedStatements: true
- maxPoolPreparedStatementPerConnectionSize: 20
- filters: stat,wall
- filter:
- wall:
- config:
- multi-statement-allow: true
- none-base-statement-allow: true
- enabled: true
- # 配置DruidStatFilter
- web-stat-filter:
- enabled: true
- url-pattern: "/*"
- exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"
- # 配置DruidStatViewServlet
- stat-view-servlet:
- enabled: true
- url-pattern: "/druid/*"
- # IP白名单(没有配置或者为空,则允许所有访问)
- allow: #127.0.0.1,192.168.163.1
- # IP黑名单 (存在共同时,deny优先于allow)
- deny: #192.168.1.73
- # 禁用HTML页面上的“Reset All”功能
- reset-enable: false
- # 登录名
- login-username: admin
- # 登录密码
- login-password: njcnpqs
- query-timeout: 36000
- primary: master
- strict: false
- datasource:
- master:
- url: jdbc:oracle:thin:@192.168.1.101:1521:pqsbase
- username: pqsadmin
- password: Pqsadmin123
- driver-class-name: oracle.jdbc.driver.OracleDriver
- target:
- url: jdbc:mysql://192.168.1.102:13306/pqsinfo?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
- username: root
- password: njcnpqs
- driver-class-name: com.mysql.cj.jdbc.Driver
-#mybatis配置信息
-mybatis-plus:
- #别名扫描
- type-aliases-package: com.njcn.oracle.bo
- mapper-locations: classpath*:com/njcn/**/mapping/*.xml
- configuration:
- #驼峰命名
- map-underscore-to-camel-case: true
- #配置sql日志输出
-# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
- #关闭日志输出
- log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
- global-config:
- db-config:
- #指定主键生成策略
- id-type: assign_uuid
-
+##文件位置配置
+#business:
+##分片次数,一定为24的约数,1 2 3 4 6 8 12 24
+# slice: 4
+# # 0.pq 1.pms
+# type: 0
+#server:
+# port: 8090
+#spring:
+# security:
+# user:
+# name: data_njcn
+# password: dnzl@#002
+# #influxDB内容配置
+# influx:
+# url: http://192.168.1.102:8086
+# user: admin
+# password: 123456
+# database: pqsbase_sjzx
+# mapper-location: com.njcn.influx.imapper
+# application:
+# name: oracle-influx
+# autoconfigure:
+# exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
+# datasource:
+# dynamic:
+# druid:
+# initial-size: 10
+# # 初始化大小,最小,最大
+# min-idle: 20
+# maxActive: 500
+# # 配置获取连接等待超时的时间
+# maxWait: 60000
+# # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+# timeBetweenEvictionRunsMillis: 60000
+# # 配置一个连接在池中最小生存的时间,单位是毫秒
+# minEvictableIdleTimeMillis: 300000
+# testWhileIdle: true
+# testOnBorrow: true
+# validation-query: SELECT 1 from dual
+# testOnReturn: false
+# # 打开PSCache,并且指定每个连接上PSCache的大小
+# poolPreparedStatements: true
+# maxPoolPreparedStatementPerConnectionSize: 20
+# filters: stat,wall
+# filter:
+# wall:
+# config:
+# multi-statement-allow: true
+# none-base-statement-allow: true
+# enabled: true
+# # 配置DruidStatFilter
+# web-stat-filter:
+# enabled: true
+# url-pattern: "/*"
+# exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"
+# # 配置DruidStatViewServlet
+# stat-view-servlet:
+# enabled: true
+# url-pattern: "/druid/*"
+# # IP白名单(没有配置或者为空,则允许所有访问)
+# allow: #127.0.0.1,192.168.163.1
+# # IP黑名单 (存在共同时,deny优先于allow)
+# deny: #192.168.1.73
+# # 禁用HTML页面上的“Reset All”功能
+# reset-enable: false
+# # 登录名
+# login-username: admin
+# # 登录密码
+# login-password: njcnpqs
+# query-timeout: 36000
+# primary: master
+# strict: false
+# datasource:
+# master:
+# url: jdbc:oracle:thin:@192.168.1.101:1521:pqsbase
+# username: pqsadmin
+# password: Pqsadmin123
+# driver-class-name: oracle.jdbc.driver.OracleDriver
+# target:
+# url: jdbc:mysql://192.168.1.102:13306/pqsinfo?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
+# username: root
+# password: njcnpqs
+# driver-class-name: com.mysql.cj.jdbc.Driver
+##mybatis配置信息
+#mybatis-plus:
+# #别名扫描
+# type-aliases-package: com.njcn.oracle.bo
+# mapper-locations: classpath*:com/njcn/**/mapping/*.xml
+# configuration:
+# #驼峰命名
+# map-underscore-to-camel-case: true
+# #配置sql日志输出
+## log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+# #关闭日志输出
+# log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
+# global-config:
+# db-config:
+# #指定主键生成策略
+# id-type: assign_uuid
+#
diff --git a/influx-data/influx-target/src/main/resources/libqvvr_balance_dll.so b/influx-data/influx-target/src/main/resources/libqvvr_balance_dll.so
new file mode 100644
index 0000000..b305873
Binary files /dev/null and b/influx-data/influx-target/src/main/resources/libqvvr_balance_dll.so differ
diff --git a/influx-data/influx-target/src/main/resources/libqvvr_cause_dll.so b/influx-data/influx-target/src/main/resources/libqvvr_cause_dll.so
new file mode 100644
index 0000000..a410463
Binary files /dev/null and b/influx-data/influx-target/src/main/resources/libqvvr_cause_dll.so differ
diff --git a/influx-data/influx-target/src/main/resources/libqvvr_dll.so b/influx-data/influx-target/src/main/resources/libqvvr_dll.so
new file mode 100644
index 0000000..2d7dc03
Binary files /dev/null and b/influx-data/influx-target/src/main/resources/libqvvr_dll.so differ
diff --git a/influx-data/influx-target/src/main/resources/logback.xml b/influx-data/influx-target/src/main/resources/logback.xml
new file mode 100644
index 0000000..7b92229
--- /dev/null
+++ b/influx-data/influx-target/src/main/resources/logback.xml
@@ -0,0 +1,142 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %logger{36} - %msg%n
+ UTF-8
+
+
+
+
+
+
+
+ ${logHomeDir}/${log.projectName}/debug/debug.log
+
+
+
+
+ DEBUG
+
+ ACCEPT
+
+ DENY
+
+
+
+
+
+ ${logHomeDir}/${log.projectName}/debug/debug.log.%d{yyyy-MM-dd}.%i.log
+
+ 10MB
+
+ ${log.maxHistory:-30}
+
+
+
+
+
+
+
+
+
+ ${log.pattern}
+
+ UTF-8
+
+
+
+
+
+
+ INFO
+ ACCEPT
+ DENY
+
+
+ ${logHomeDir}/${log.projectName}/info/info.log
+
+
+
+ ${logHomeDir}/${log.projectName}/info/info.log.%d{yyyy-MM-dd}.%i.log
+
+ 10MB
+ ${log.maxHistory:-30}
+
+
+
+ ${log.pattern}
+
+ UTF-8
+
+
+
+
+
+
+
+ ${logHomeDir}/${log.projectName}/error/error.log
+
+
+ ERROR
+ ACCEPT
+ DENY
+
+
+
+ ${logHomeDir}/${log.projectName}/error/error.log.%d{yyyy-MM-dd}.%i.log
+
+ 10MB
+ ${log.maxHistory:-30}
+
+
+
+ ${log.pattern}
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/influx-data/influx-target/src/main/resources/qvvr_balance.dll b/influx-data/influx-target/src/main/resources/qvvr_balance.dll
new file mode 100644
index 0000000..97efdf1
Binary files /dev/null and b/influx-data/influx-target/src/main/resources/qvvr_balance.dll differ
diff --git a/influx-data/influx-target/src/main/resources/qvvr_cause_dll.dll b/influx-data/influx-target/src/main/resources/qvvr_cause_dll.dll
new file mode 100644
index 0000000..95328f1
Binary files /dev/null and b/influx-data/influx-target/src/main/resources/qvvr_cause_dll.dll differ
diff --git a/influx-data/influx-target/src/main/resources/qvvr_dll.dll b/influx-data/influx-target/src/main/resources/qvvr_dll.dll
new file mode 100644
index 0000000..60d74a9
Binary files /dev/null and b/influx-data/influx-target/src/main/resources/qvvr_dll.dll differ
diff --git a/influx-data/influx-target/src/main/resources/static/index.html b/influx-data/influx-target/src/main/resources/static/index.html
index 5d97a22..cecab50 100644
--- a/influx-data/influx-target/src/main/resources/static/index.html
+++ b/influx-data/influx-target/src/main/resources/static/index.html
@@ -3,7 +3,7 @@
- 迁移
+ 数据迁移
@@ -35,15 +35,15 @@
style="width: 360px"
>
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
@@ -149,15 +149,15 @@
checkAll: true,
tableNames: [
'DataFlicker',
-
-
-
-
-
-
-
+ 'DataFluc',
+ 'DataHarmphasicI',
+ 'DataHarmphasicV',
+ 'DataHarmpowerP',
+ 'DataHarmpowerQ',
+ 'DataHarmpowerS',
+ 'DataHarmrateI',
'DataHarmrateV',
-
+ 'DataInharmI',
'DataInharmV',
'DataI',
'DataPlt',
@@ -166,15 +166,15 @@
],
tableNames2: [
'DataFlicker',
-
-
-
-
-
-
-
+ 'DataFluc',
+ 'DataHarmphasicI',
+ 'DataHarmphasicV',
+ 'DataHarmpowerP',
+ 'DataHarmpowerQ',
+ 'DataHarmpowerS',
+ 'DataHarmrateI',
'DataHarmrateV',
-
+ 'DataInharmI',
'DataInharmV',
'DataI',
'DataPlt',
diff --git a/influx-data/influx-target/src/test/java/njcn/DataTest.java b/influx-data/influx-target/src/test/java/njcn/DataTest.java
index cfed52d..e4a7140 100644
--- a/influx-data/influx-target/src/test/java/njcn/DataTest.java
+++ b/influx-data/influx-target/src/test/java/njcn/DataTest.java
@@ -6,6 +6,7 @@ import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.njcn.influx.bo.po.InfluxDBDataFlicker;
import com.njcn.influx.core.InfluxExecutor;
+import com.njcn.influx.imapper.InfluxDBDataFlickerMapper;
import com.njcn.oracle.bo.param.MigrationParam;
import com.njcn.oracle.bo.po.DataFlicker;
import com.njcn.oracle.mybatis.service.IReplenishMybatisService;
@@ -18,6 +19,7 @@ import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.temporal.ChronoUnit;
+import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -27,7 +29,7 @@ import java.util.stream.Collectors;
* @date 2021年12月14日 12:55
*/
public class DataTest extends BaseJunitTest {
- private @Autowired InfluxExecutor interpreter;
+ private @Autowired InfluxDBDataFlickerMapper influxDBDataFlickerMapper;
@@ -39,23 +41,42 @@ public class DataTest extends BaseJunitTest {
// LocalDateTime endTime = LocalDateTimeUtil.parse("1970-01-02 00:00:10", DatePattern.NORM_DATETIME_PATTERN);
// LocalDateTime startTime = LocalDateTimeUtil.offset(endTime, -2, ChronoUnit.HOURS);
-
- MigrationParam migrationParam = new MigrationParam();
- migrationParam.setStartTime(startTime);
- migrationParam.setEndTime(endTime);
- IReplenishMybatisService executor = (IReplenishMybatisService) SpringUtil.getBean(Class.forName("com.njcn.oracle.service.impl.DataFlickerServiceImpl"));
- //查询数据
- List temp1 = executor.queryData(migrationParam);
- List collect = temp1.stream().map(temp -> {
- InfluxDBDataFlicker dataFlicker = new InfluxDBDataFlicker();
- dataFlicker = InfluxDBDataFlicker.oralceToInfluxDB(temp);
-
- return dataFlicker;
- }).collect(Collectors.toList());
-
- Object args[] ={collect};
- interpreter.insert(args);
- System.out.println(1111111);
+ List dataFlickers = new ArrayList<>();
+ InfluxDBDataFlicker flicker1 = new InfluxDBDataFlicker();
+ flicker1.setTime(Instant.now().minusSeconds(60*60*24*50));
+ flicker1.setLineId("12345");
+ flicker1.setPhaseType("A");
+ flicker1.setFluc(1.0f);
+ flicker1.setPlt(1.0f);
+ flicker1.setPst(1.0f);
+ flicker1.setQualityFlag("1");
+ InfluxDBDataFlicker flicker2 = new InfluxDBDataFlicker();
+ flicker2.setTime(Instant.now().minusSeconds(60*60*24*24));
+ flicker2.setLineId("12345");
+ flicker2.setPhaseType("A");
+ flicker2.setFluc(1.0f);
+ flicker2.setPlt(1.0f);
+ flicker2.setPst(1.0f);
+ flicker2.setQualityFlag("1");
+ dataFlickers.add(flicker1);
+ dataFlickers.add(flicker2);
+ influxDBDataFlickerMapper.insertBatch(dataFlickers);
+// MigrationParam migrationParam = new MigrationParam();
+// migrationParam.setStartTime(startTime);
+// migrationParam.setEndTime(endTime);
+// IReplenishMybatisService executor = (IReplenishMybatisService) SpringUtil.getBean(Class.forName("com.njcn.oracle.service.impl.DataFlickerServiceImpl"));
+// //查询数据
+// List temp1 = executor.queryData(migrationParam);
+// List collect = temp1.stream().map(temp -> {
+// InfluxDBDataFlicker dataFlicker = new InfluxDBDataFlicker();
+// dataFlicker = InfluxDBDataFlicker.oralceToInfluxDB(temp);
+//
+// return dataFlicker;
+// }).collect(Collectors.toList());
+//
+// Object args[] ={collect};
+// interpreter.insert(args);
+// System.out.println(1111111);
}