高级算法和暂态文件同步合并jar包
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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();
|
||||
// }*/
|
||||
//}
|
||||
//
|
||||
//
|
||||
|
||||
@@ -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();;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user