修改oralcetooralcejob数据同步由现在往以前同步
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package com.njcn.influx.bo.param;
|
package com.njcn.influx.bo.param;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -11,6 +13,7 @@ import java.util.stream.Collectors;
|
|||||||
* @author clam
|
* @author clam
|
||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
public enum TableEnum {
|
public enum TableEnum {
|
||||||
DATAFLICKER("DataFlicker","电压闪变数据表", 1),
|
DATAFLICKER("DataFlicker","电压闪变数据表", 1),
|
||||||
// DATAFLUC("DataFluc","电压波动数据表", 1),
|
// DATAFLUC("DataFluc","电压波动数据表", 1),
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.njcn.influx.bo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Date: 2024/1/18 11:11【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@TableName(value = "JOB_HISTORY_LOG_InfluxDB")
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class JobHistoryLogInfluxdb {
|
||||||
|
/**
|
||||||
|
* 执行日期
|
||||||
|
*/
|
||||||
|
@TableId(value = "LAST_DATE", type = IdType.INPUT)
|
||||||
|
private LocalDate lastDate;
|
||||||
|
|
||||||
|
@TableField(value = "UPDATE_TIME")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.njcn.influx.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.influx.bo.po.JobHistoryLogInfluxdb;
|
||||||
|
import com.njcn.oracle.bo.po.JobHistoryLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Date: 2024/1/18 11:11【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
public interface JobHistoryLogInfluxdbMapper extends BaseMapper<JobHistoryLogInfluxdb> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.njcn.influx.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.influx.bo.po.JobHistoryLogInfluxdb;
|
||||||
|
import com.njcn.oracle.bo.po.JobHistoryLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Date: 2024/1/18 11:11【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
public interface JobHistoryLogInfluxdbService extends IService<JobHistoryLogInfluxdb>{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.njcn.influx.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.influx.bo.po.JobHistoryLogInfluxdb;
|
||||||
|
import com.njcn.influx.mapper.JobHistoryLogInfluxdbMapper;
|
||||||
|
import com.njcn.influx.service.JobHistoryLogInfluxdbService;
|
||||||
|
import com.njcn.oracle.bo.po.JobHistoryLog;
|
||||||
|
import com.njcn.oracle.mybatis.mapper.JobHistoryLogMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2024/1/22 9:07【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class JobHistoryLogInfluxdbServiceImpl extends ServiceImpl<JobHistoryLogInfluxdbMapper, JobHistoryLogInfluxdb> implements JobHistoryLogInfluxdbService {
|
||||||
|
}
|
||||||
@@ -7,11 +7,15 @@ import cn.hutool.core.text.StrPool;
|
|||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.njcn.influx.bo.param.TableEnum;
|
import com.njcn.influx.bo.param.TableEnum;
|
||||||
import com.njcn.influx.bo.po.JobDetailInfluxDB;
|
import com.njcn.influx.bo.po.JobDetailInfluxDB;
|
||||||
|
import com.njcn.influx.bo.po.JobHistoryLogInfluxdb;
|
||||||
import com.njcn.influx.config.IdMappingCache;
|
import com.njcn.influx.config.IdMappingCache;
|
||||||
import com.njcn.influx.service.JobDetailInfluxDBService;
|
import com.njcn.influx.service.JobDetailInfluxDBService;
|
||||||
|
import com.njcn.influx.service.JobHistoryLogInfluxdbService;
|
||||||
import com.njcn.influx.service.OracleToInfluxDBService;
|
import com.njcn.influx.service.OracleToInfluxDBService;
|
||||||
import com.njcn.oracle.bo.param.DataAsynParam;
|
import com.njcn.oracle.bo.param.DataAsynParam;
|
||||||
import com.njcn.oracle.bo.param.MigrationParam;
|
import com.njcn.oracle.bo.param.MigrationParam;
|
||||||
|
import com.njcn.oracle.bo.param.ServiceTypeEnum;
|
||||||
|
import com.njcn.oracle.bo.po.JobHistoryLog;
|
||||||
import com.njcn.oracle.mybatis.service.IReplenishMybatisService;
|
import com.njcn.oracle.mybatis.service.IReplenishMybatisService;
|
||||||
import com.njcn.oracle.util.LocalDateUtil;
|
import com.njcn.oracle.util.LocalDateUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -56,6 +60,8 @@ public class OracleToInfluxDBServiceImpl implements OracleToInfluxDBService {
|
|||||||
|
|
||||||
private final IdMappingCache idMappingCache;
|
private final IdMappingCache idMappingCache;
|
||||||
|
|
||||||
|
private final JobHistoryLogInfluxdbService jobHistoryLogInfluxdbService;
|
||||||
|
|
||||||
@Value("${business.slice:2}")
|
@Value("${business.slice:2}")
|
||||||
private int slice;
|
private int slice;
|
||||||
|
|
||||||
@@ -78,6 +84,14 @@ public class OracleToInfluxDBServiceImpl implements OracleToInfluxDBService {
|
|||||||
}
|
}
|
||||||
List<LocalDate> dateList = LocalDateUtil.getDateList(dataAsynParam.getStartTime(), dataAsynParam.getEndTime());
|
List<LocalDate> dateList = LocalDateUtil.getDateList(dataAsynParam.getStartTime(), dataAsynParam.getEndTime());
|
||||||
for (LocalDate date : dateList) {
|
for (LocalDate date : dateList) {
|
||||||
|
|
||||||
|
|
||||||
|
//添加记录批处理日志,执行为批处理且最后一张表执行完记录
|
||||||
|
if(dataAsynParam.getExcuteType()==2&&Objects.equals(tableName, TableEnum.DATAV.getCode())){
|
||||||
|
JobHistoryLogInfluxdb jobHistoryLogInfluxdbLog = new JobHistoryLogInfluxdb(date,LocalDateTime.now());
|
||||||
|
jobHistoryLogInfluxdbService.save(jobHistoryLogInfluxdbLog);
|
||||||
|
}
|
||||||
|
|
||||||
//日志记录
|
//日志记录
|
||||||
JobDetailInfluxDB jobDetailInfluxDB = jobDetailInfluxDBService.select(tableName, date);
|
JobDetailInfluxDB jobDetailInfluxDB = jobDetailInfluxDBService.select(tableName, date);
|
||||||
if (Objects.nonNull(jobDetailInfluxDB) && (jobDetailInfluxDB.getState() == 1 || jobDetailInfluxDB.getState() == 0)) {
|
if (Objects.nonNull(jobDetailInfluxDB) && (jobDetailInfluxDB.getState() == 1 || jobDetailInfluxDB.getState() == 0)) {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class OracleToInfluxDBJob {
|
|||||||
dataAsynParam.setStartTime(LocalDate.now().plusDays(-1));
|
dataAsynParam.setStartTime(LocalDate.now().plusDays(-1));
|
||||||
dataAsynParam.setEndTime(LocalDate.now().plusDays(-1));
|
dataAsynParam.setEndTime(LocalDate.now().plusDays(-1));
|
||||||
dataAsynParam.setTableNames(TableEnum.getExecutableTypes());
|
dataAsynParam.setTableNames(TableEnum.getExecutableTypes());
|
||||||
|
dataAsynParam.setExcuteType(2);
|
||||||
oracleToInfluxDBService.dataBacthSysc(dataAsynParam);
|
oracleToInfluxDBService.dataBacthSysc(dataAsynParam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user