1.oracle同步influxdb代码,监测点运行中断状态
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package com.njcn.oracle.bo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2024/9/25 11:01
|
||||
*/
|
||||
@Data
|
||||
@TableName("PQS_COMINFORMATION")
|
||||
public class ComInfoRmation implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableField("UPDATETIME")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField("LINE_INDEX")
|
||||
private String lineIndex;
|
||||
|
||||
@TableField("TYPE")
|
||||
private Integer type;
|
||||
|
||||
@TableField("DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
@TableField("REMARK")
|
||||
private String remark;
|
||||
|
||||
@TableField("STATE")
|
||||
private Integer state;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.oracle.mapper;
|
||||
|
||||
import com.njcn.oracle.bo.po.ComInfoRmation;
|
||||
import com.njcn.oracle.mybatis.mapper.BatchBaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2023-12-28
|
||||
*/
|
||||
public interface ComInfoRmationMapper extends BatchBaseMapper<ComInfoRmation> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.oracle.mapper.ComInfoRmationMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.oracle.service;
|
||||
|
||||
import com.njcn.oracle.bo.po.ComInfoRmation;
|
||||
import com.njcn.oracle.mybatis.service.IReplenishMybatisService;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 监测点状态监测数据
|
||||
* @param
|
||||
* @return:
|
||||
* @Author: wr
|
||||
* @Date: 2024/9/25 13:52
|
||||
*/
|
||||
public interface IComInfoRmationService extends IReplenishMybatisService<ComInfoRmation> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.njcn.oracle.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.oracle.bo.param.MigrationParam;
|
||||
import com.njcn.oracle.bo.po.ComInfoRmation;
|
||||
import com.njcn.oracle.mapper.ComInfoRmationMapper;
|
||||
import com.njcn.oracle.mybatis.service.impl.ReplenishMybatisServiceImpl;
|
||||
import com.njcn.oracle.service.IComInfoRmationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StopWatch;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2024/9/25 13:58
|
||||
*/
|
||||
@Service
|
||||
public class ComInfoRmationServiceImpl extends ReplenishMybatisServiceImpl<ComInfoRmationMapper, ComInfoRmation> implements IComInfoRmationService {
|
||||
|
||||
@Override
|
||||
public List<ComInfoRmation> queryData(MigrationParam migrationParam) {
|
||||
//查询时间范围内的数据
|
||||
LambdaQueryWrapper<ComInfoRmation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.between(ComInfoRmation::getUpdateTime, migrationParam.getStartTime(), migrationParam.getEndTime());
|
||||
if (CollectionUtil.isNotEmpty(migrationParam.getLineIds())) {
|
||||
lambdaQueryWrapper.in(ComInfoRmation::getLineIndex, migrationParam.getLineIds());
|
||||
}
|
||||
return this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@DS("target")
|
||||
public void clearTargetData(MigrationParam migrationParam) {
|
||||
LambdaQueryWrapper<ComInfoRmation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.between(ComInfoRmation::getUpdateTime, migrationParam.getStartTime(), migrationParam.getEndTime());
|
||||
if (CollectionUtil.isNotEmpty(migrationParam.getLineIds())) {
|
||||
lambdaQueryWrapper.in(ComInfoRmation::getLineIndex, migrationParam.getLineIds());
|
||||
}
|
||||
this.baseMapper.delete(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认500分片,如果字段超过20以上,建议重写方法调整为1000分片,重写时不要忘记@DS注解
|
||||
*
|
||||
* @param data 数据集合
|
||||
*/
|
||||
@Override
|
||||
@DS("target")
|
||||
public void insertBatchByDB(List<ComInfoRmation> data) {
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
stopWatch.start();
|
||||
this.insertBatchBySlice(data, 100);
|
||||
stopWatch.stop();
|
||||
System.out.printf("pq_ComInfoRmation总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user