转换提交

This commit is contained in:
2024-03-01 11:13:26 +08:00
parent d334bb01ec
commit 6f76a4f420
10 changed files with 471 additions and 10 deletions

View File

@@ -0,0 +1,168 @@
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 com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
/**
* data-migration
*
* @author cdf
* @date 2024/2/19
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("PQS_EVENTDETAIL")
public class OracleRmpEventDetailPO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 暂时事件ID
*/
@TableId(value = "EVENTDETAIL_INDEX",type = IdType.ASSIGN_ID)
private String eventId;
/**
* 监测点ID
*/
@TableField(value = "LINEID")
private String measurementPointId;
/**
* 统计指标类型
*/
@TableField(value = "WAVETYPE")
private String eventType;
/**
* 暂降原因字典表PQS_Dicdata
*/
@TableField(value = "EVENTREASON")
private String advanceReason;
/**
* 暂降类型字典表PQS_Dicdata
*/
@TableField(value = "EVENTTYPE")
private String advanceType;
/**
* 事件关联分析表Guid
*/
@TableField(value = "EVENTASS_INDEX")
private String eventassIndex;
@TableField(value = "DQTIME")
private Double dqTime;
/**
* 特征值计算更新时间外键PQS_Relevance的Time字段
*/
@TableField(value = "DEALTIME")
private Date dealTime;
/**
* 默认事件个数为0
*/
@TableField(value = "NUM")
private Integer num;
/**
* 波形文件是否从装置招到本地(0未招1已招)默认值为0
*/
@TableField(value = "FILEFLAG")
private Boolean fileFlag;
/**
* 特征值计算标志0未处理1已处理; 2已处理无结果;3计算失败默认值为0
*/
@TableField(value = "DEALFLAG")
private Boolean dealFlag;
/**
* 处理结果第一条事件发生时间(读comtra文件获取)
*/
@TableField(value = "FIRSTTIME")
private Date firstTime;
/**
* 处理结果第一条事件暂降类型字典表PQS_Dicdata
*/
@TableField(value = "FIRSTTYPE")
private String firstType;
/**
* 处理结果第一条事件发生时间毫秒(读comtra文件获取)
*/
@TableField(value = "FIRSTMS")
private BigDecimal firstMs;
/**
* 暂降能量
*/
@TableField(value = "ENERGY")
private Double energy;
/**
* 暂降严重度
*/
@TableField(value = "SEVERITY")
private Double severity;
/**
* 暂降源与监测位置关系 Upper:上游Lower :下游Unknown :未知;为空则是未计算
*/
@TableField(value = "SAGSOURCE")
private String sagsource;
/**
* 开始时间
*/
@TableField(value = "TIMEID")
private Date startTime;
/**
* 持续时间,单位秒
*/
@TableField(value = "PERSISTTIME")
private BigDecimal duration;
/**
* 特征幅值
*/
@TableField(value = "EVENTVALUE")
private BigDecimal featureAmplitude;
/**
* 相别
*/
@TableField(value = "PHASIC_TYPE")
private String phase;
/**
* 事件描述
*/
@TableField(value = "DESCRIBE")
private String eventDescribe;
/**
* 波形路径
*/
@TableField(value = "WAVENAME")
private String wavePath;
@TableField(value = "TRANSIENTVALUE")
private Double transientValue;
}

View File

@@ -0,0 +1,174 @@
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 com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
/**
* data-migration
*
* @author cdf
* @date 2024/2/19
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("r_mp_event_detail")
@ApiModel(value="RmpEventDetail对象", description="")
public class RmpEventDetailPO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 暂时事件ID
*/
@TableId(value = "event_id")
private String eventId;
/**
* 监测点ID
*/
@TableField(value = "measurement_point_id")
private String measurementPointId;
/**
* 统计指标类型
*/
@TableField(value = "event_type")
private String eventType;
/**
* 暂降原因字典表PQS_Dicdata
*/
@TableField(value = "advance_reason")
private String advanceReason;
/**
* 暂降类型字典表PQS_Dicdata
*/
@TableField(value = "advance_type")
private String advanceType;
/**
* 事件关联分析表Guid
*/
@TableField(value = "eventass_index")
private String eventassIndex;
@TableField(value = "dq_time")
private Double dqTime;
/**
* 特征值计算更新时间外键PQS_Relevance的Time字段
*/
@TableField(value = "deal_time")
private Date dealTime;
/**
* 默认事件个数为0
*/
@TableField(value = "num")
private Integer num;
/**
* 波形文件是否从装置招到本地(0未招1已招)默认值为0
*/
@TableField(value = "file_flag")
private Boolean fileFlag;
/**
* 特征值计算标志0未处理1已处理; 2已处理无结果;3计算失败默认值为0
*/
@TableField(value = "deal_flag")
private Boolean dealFlag;
/**
* 处理结果第一条事件发生时间(读comtra文件获取)
*/
@TableField(value = "first_time")
private Date firstTime;
/**
* 处理结果第一条事件暂降类型字典表PQS_Dicdata
*/
@TableField(value = "first_type")
private String firstType;
/**
* 处理结果第一条事件发生时间毫秒(读comtra文件获取)
*/
@TableField(value = "first_ms")
private BigDecimal firstMs;
/**
* 暂降能量
*/
@TableField(value = "energy")
private Double energy;
/**
* 暂降严重度
*/
@TableField(value = "severity")
private Double severity;
/**
* 暂降源与监测位置关系 Upper:上游Lower :下游Unknown :未知;为空则是未计算
*/
@TableField(value = "sagsource")
private String sagsource;
/**
* 开始时间
*/
@TableField(value = "start_time")
private Date startTime;
/**
* 持续时间,单位秒
*/
@TableField(value = "duration")
private BigDecimal duration;
/**
* 特征幅值
*/
@TableField(value = "feature_amplitude")
private BigDecimal featureAmplitude;
/**
* 相别
*/
@TableField(value = "phase")
private String phase;
/**
* 事件描述
*/
@TableField(value = "event_describe")
private String eventDescribe;
/**
* 波形路径
*/
@TableField(value = "wave_path")
private String wavePath;
/**
* 暂态事件上送时间
*/
@TableField(value = "create_time")
private Date createTime;
@TableField(value = "transient_value")
private Double transientValue;
}

View File

@@ -0,0 +1,17 @@
package com.njcn.influx.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.influx.base.InfluxDbBaseMapper;
import com.njcn.influx.bo.po.OracleRmpEventDetailPO;
/**
* data-migration
*
* @author cdf
* @date 2024/2/19
*/
@DS("master")
public interface OracleRmpEventDetailPOMapper extends BaseMapper<OracleRmpEventDetailPO> {
}

View File

@@ -0,0 +1,18 @@
package com.njcn.influx.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.influx.base.InfluxDbBaseMapper;
import com.njcn.influx.bo.po.OracleRmpEventDetailPO;
import com.njcn.influx.bo.po.RmpEventDetailPO;
/**
* data-migration
*
* @author cdf
* @date 2024/2/19
*/
@DS("target")
public interface RmpEventDetailPOMapper extends BaseMapper<RmpEventDetailPO> {
}

View File

@@ -0,0 +1,17 @@
package com.njcn.influx.service;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* data-migration
*
* @author cdf
* @date 2024/2/19
*/
public interface OracleEventDetailToMysqlService {
void eventBatch(LocalDateTime start, LocalDateTime end);
}

View File

@@ -0,0 +1,50 @@
package com.njcn.influx.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.influx.bo.po.OracleRmpEventDetailPO;
import com.njcn.influx.bo.po.RmpEventDetailPO;
import com.njcn.influx.mapper.OracleRmpEventDetailPOMapper;
import com.njcn.influx.mapper.RmpEventDetailPOMapper;
import com.njcn.influx.service.OracleEventDetailToMysqlService;
import com.njcn.influx.service.PqLineBakService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
/**
* data-migration
*
* @author cdf
* @date 2024/2/19
*/
@RequiredArgsConstructor
@Service
public class OracleEventDetailToMysqlServiceImpl implements OracleEventDetailToMysqlService {
private final PqLineBakService pqLineBakService;
private final OracleRmpEventDetailPOMapper oracleRmpEventDetailPOMapper;
private final RmpEventDetailPOMapper rmpEventDetailPOMapper;
@Override
public void eventBatch(LocalDateTime start, LocalDateTime end){
List<OracleRmpEventDetailPO> oracleRmpEventDetailPOList = oracleRmpEventDetailPOMapper.selectList(new LambdaQueryWrapper<OracleRmpEventDetailPO>().between(OracleRmpEventDetailPO::getStartTime,start,end));
List<RmpEventDetailPO> poList = BeanUtil.copyToList(oracleRmpEventDetailPOList, RmpEventDetailPO.class);
System.out.println("55555");
}
}

View File

@@ -7,6 +7,6 @@ VOLUME /usr/share/zoneinfo
ENV TZ=Asia/Shanghai
# 设置时区信息
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ADD target/oracle_influx.jar oracle_influx.jar
ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /oracle_influx.jar
ADD target/influx-target.jar influx-target.jar
ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /influx-target.jar
EXPOSE 8090

View File

@@ -16,7 +16,7 @@
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--docker仓库地址-->
<docker.server.url>192.168.1.24</docker.server.url>
<docker.server.url>192.168.1.83</docker.server.url>
<!--docker远程守护进程的url-->
<docker.url>http://${docker.server.url}:2375</docker.url>
<!--docker远程harborurl-->
@@ -41,7 +41,7 @@
</dependencies>
<build>
<finalName>oracle_influx</finalName>
<finalName>influx-target</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>

View File

@@ -1,6 +1,7 @@
package com.njcn.influx.job;
import com.njcn.influx.bo.param.TableEnum;
import com.njcn.influx.service.OracleEventDetailToMysqlService;
import com.njcn.influx.service.OracleToInfluxDBService;
import com.njcn.oracle.bo.param.DataAsynParam;
import com.njcn.oracle.bo.param.ServiceTypeEnum;
@@ -29,7 +30,9 @@ public class OracleToInfluxDBJob {
private final OracleToInfluxDBService oracleToInfluxDBService;
@Scheduled(cron="0 5 0 * * ?")
private final OracleEventDetailToMysqlService oracleEventDetailToMysqlService;
/* @Scheduled(cron="0 5 0 * * ?")
public void execute() {
DataAsynParam dataAsynParam = new DataAsynParam();
dataAsynParam.setStartTime(LocalDate.now().plusDays(-1));
@@ -37,7 +40,7 @@ public class OracleToInfluxDBJob {
dataAsynParam.setTableNames(TableEnum.getExecutableTypes());
dataAsynParam.setExcuteType(2);
oracleToInfluxDBService.dataBacthSysc(dataAsynParam);
}
}*/
//每小时03分钟时执行上一个小时的数据同步
@Scheduled(cron="0 3 * * * ?")
@@ -59,4 +62,18 @@ public class OracleToInfluxDBJob {
dataAsynParam.setExcuteType(2);
oracleToInfluxDBService.hourseDataBacthSysc(dataAsynParam);
}
/* @Scheduled(cron="0 55 23 * * ?")
public void executeEvent() {
DataAsynParam dataAsynParam = new DataAsynParam();
// 获取当前时间
LocalDateTime end = LocalDateTime.now();
// 减去24时
LocalDateTime begin = end.minusHours(24);
oracleEventDetailToMysqlService.eventBatch(begin,end);
}*/
}

View File

@@ -18,12 +18,12 @@
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://192.168.1.13:8001/nexus/content/repositories/releases/</url>
<url>http://192.168.1.22:8001/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://192.168.1.13:8001/nexus/content/repositories/snapshots/</url>
<url>http://192.168.1.22:8001/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<properties>