oralce数据转入mysql
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.njcn.mysql;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
@Slf4j
|
||||
@EnableAsync
|
||||
@MapperScan("com.njcn.**.mapper")
|
||||
@SpringBootApplication(scanBasePackages = "com.njcn", exclude = {SecurityAutoConfiguration.class, SecurityFilterAutoConfiguration.class})
|
||||
public class MysqlDataApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MysqlDataApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.mysql.controller;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.njcn.mysql.service.OracleToMysqlService;
|
||||
import com.njcn.oracle.bo.param.DataAsynParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/dataConversion")
|
||||
@Api(tags = "oracle数据转入mysql")
|
||||
@AllArgsConstructor
|
||||
public class OracleToMysqlController {
|
||||
|
||||
private final OracleToMysqlService oracleToMysqlService;
|
||||
|
||||
@GetMapping("/dayHarmRateV")
|
||||
@ApiOperation("day_harmrate_v转成r_stat_data_harmrate_v_d")
|
||||
public Boolean dayHarmRateVSync(@RequestParam("startDateTime")String startDateTime, @RequestParam("endDateTime")String endDateTime) {
|
||||
DataAsynParam dataAsynParam = new DataAsynParam();
|
||||
dataAsynParam.setStartDateTime(LocalDateTimeUtil.parse(startDateTime, DatePattern.NORM_DATE_PATTERN));
|
||||
dataAsynParam.setEndDateTime(LocalDateTimeUtil.parse(endDateTime, DatePattern.NORM_DATE_PATTERN));
|
||||
oracleToMysqlService.insertDayHarmRateV(startDateTime,endDateTime);
|
||||
return true;// HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, "数据同步");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.njcn.mysql.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.mysql.bo.po.PqLineBak;
|
||||
|
||||
public interface PqLineBakMapper extends BaseMapper<PqLineBak> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.njcn.mysql.mapper;
|
||||
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.mysql.bo.po.RStatAssesD;
|
||||
|
||||
public interface RStatAssesDMapper extends MppBaseMapper<RStatAssesD> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.njcn.mysql.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.mysql.bo.po.RStatComassesD;
|
||||
|
||||
public interface RStatComassesDMapper extends MppBaseMapper<RStatComassesD> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.njcn.mysql.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.mysql.bo.po.RStatDataFlickerD;
|
||||
|
||||
public interface RStatDataFlickerDMapper extends MppBaseMapper<RStatDataFlickerD> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.njcn.mysql.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.mysql.bo.po.RStatDataHarmrateVD;
|
||||
|
||||
public interface RStatDataHarmRateVDMapper extends MppBaseMapper<RStatDataHarmrateVD> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.njcn.mysql.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.mysql.bo.po.RStatDataID;
|
||||
|
||||
public interface RStatDataIDMapper extends MppBaseMapper<RStatDataID> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.njcn.mysql.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.mysql.bo.po.RStatDataInharmVD;
|
||||
|
||||
public interface RStatDataInHarmVDMapper extends MppBaseMapper<RStatDataInharmVD> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.njcn.mysql.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.mysql.bo.po.RStatDataPltD;
|
||||
|
||||
public interface RStatDataPltDMapper extends MppBaseMapper<RStatDataPltD> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.njcn.mysql.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.mysql.bo.po.RStatDataVD;
|
||||
|
||||
public interface RStatDataVDMapper extends MppBaseMapper<RStatDataVD> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.njcn.mysql.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.mysql.bo.po.RStatIntegrityD;
|
||||
|
||||
public interface RStatIntegrityDMapper extends MppBaseMapper<RStatIntegrityD> {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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.mysql.mapper.RStatAssesDMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -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.mysql.mapper.RStatComassesDMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -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.mysql.mapper.RStatDataFlickerDMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -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.mysql.mapper.RStatDataHarmRateVDMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -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.mysql.mapper.RStatDataIDMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -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.mysql.mapper.RStatDataInHarmVDMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -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.mysql.mapper.RStatIntegrityDMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -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.mysql.mapper.RStatDataPltDMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -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.mysql.mapper.RStatDataVDMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.njcn.mysql.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.mysql.bo.po.PqLineBak;
|
||||
|
||||
public interface IPqLineBakService extends IService<PqLineBak> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.njcn.mysql.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.mysql.bo.po.RStatDataFlickerD;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IRStatDataFlickerDService extends IMppService<RStatDataFlickerD> {
|
||||
|
||||
void insert(List<RStatDataFlickerD> list);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.njcn.mysql.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.mysql.bo.po.RStatDataHarmrateVD;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IRStatDataHarmRateVDService extends IMppService<RStatDataHarmrateVD> {
|
||||
|
||||
void insert(List<RStatDataHarmrateVD> list);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.njcn.mysql.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.mysql.bo.po.RStatDataID;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IRStatDataIDService extends IMppService<RStatDataID> {
|
||||
|
||||
void insert(List<RStatDataID> list);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.njcn.mysql.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.mysql.bo.po.RStatDataInharmVD;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IRStatDataInharmVDService extends IMppService<RStatDataInharmVD> {
|
||||
|
||||
void insert(List<RStatDataInharmVD> list);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.njcn.mysql.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.mysql.bo.po.RStatDataPltD;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IRStatDataPltDService extends IMppService<RStatDataPltD> {
|
||||
|
||||
void insert(List<RStatDataPltD> list);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.njcn.mysql.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.mysql.bo.po.RStatDataVD;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IRStatDataVDService extends IMppService<RStatDataVD> {
|
||||
|
||||
void insert(List<RStatDataVD> list);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.njcn.mysql.service;
|
||||
|
||||
public interface MysqlService {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.njcn.mysql.service;
|
||||
|
||||
public interface OracleToMysqlService {
|
||||
|
||||
/**
|
||||
* r_stat_data_harmrate_v_d数据插入
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
*/
|
||||
void insertDayHarmRateV(String startTime, String endTime);
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.njcn.mysql.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import com.njcn.mysql.bo.po.PqLineBak;
|
||||
import com.njcn.mysql.bo.po.RStatDataHarmrateVD;
|
||||
import com.njcn.mysql.service.IPqLineBakService;
|
||||
import com.njcn.mysql.service.IRStatDataHarmRateVDService;
|
||||
import com.njcn.mysql.service.OracleDataService;
|
||||
import com.njcn.mysql.service.OracleToMysqlService;
|
||||
import com.njcn.mysql.util.PubUtils;
|
||||
import com.njcn.oracle.bo.po.DayHarmrateV;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class OracleToMysqlServiceImpl implements OracleToMysqlService {
|
||||
|
||||
private final OracleDataService oracleDataService;
|
||||
|
||||
private final IPqLineBakService pqLineBakService;
|
||||
|
||||
private final IRStatDataHarmRateVDService rStatDataHarmRateVDService;
|
||||
|
||||
@Override
|
||||
public void insertDayHarmRateV(String startTime, String endTime) {
|
||||
List<RStatDataHarmrateVD> result = new ArrayList<>();
|
||||
List<String> timeList = PubUtils.getTimeList(startTime,endTime);
|
||||
List<PqLineBak> bakList = pqLineBakService.list();
|
||||
//lineId:Oracle监测点ID id:Mysql监测点ID
|
||||
Map<String, String> oracleRelationMysql = bakList.stream().collect(Collectors.toMap(PqLineBak::getLineId, PqLineBak::getId));
|
||||
ZoneId zoneId = ZoneId.systemDefault();
|
||||
timeList.forEach(item->{
|
||||
System.out.println("数据查询时间:" + item);
|
||||
List<DayHarmrateV> list = oracleDataService.getDayHarmRate(item);
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
System.out.println("oracle数据量:" + list.size());
|
||||
list.forEach(data->{
|
||||
RStatDataHarmrateVD po1 = new RStatDataHarmrateVD();
|
||||
po1.setTime(data.getTimeid().toInstant().atZone(zoneId).toLocalDate());
|
||||
if (ObjUtil.isNotNull(oracleRelationMysql.get(data.getLineid()))) {
|
||||
po1.setLineId(oracleRelationMysql.get(data.getLineid()));
|
||||
po1.setPhaseType(data.getPhasicType());
|
||||
po1.setValueType("AVG");
|
||||
//异常数据判断
|
||||
List<Float> avgData1 = this.getData(data);
|
||||
boolean quality1 = avgData1.stream().anyMatch(o->o>30.0 || o<0.0);
|
||||
if (quality1) {
|
||||
po1.setQualityFlag(1);
|
||||
}
|
||||
setValuesUsingReflection(po1,data,false,"getV","setV",null);
|
||||
|
||||
RStatDataHarmrateVD po2 = new RStatDataHarmrateVD();
|
||||
po2.setTime(data.getTimeid().toInstant().atZone(zoneId).toLocalDate());
|
||||
po2.setLineId(oracleRelationMysql.get(data.getLineid()));
|
||||
po2.setPhaseType(data.getPhasicType());
|
||||
po2.setValueType("MAX");
|
||||
List<Float> avgData2 = this.getData(data);
|
||||
boolean quality2 = avgData2.stream().anyMatch(o->o>30 || o<0.0);
|
||||
if (quality2) {
|
||||
po2.setQualityFlag(1);
|
||||
}
|
||||
setValuesUsingReflection(po2,data,true,"getV","setV","Max");
|
||||
|
||||
RStatDataHarmrateVD po3 = new RStatDataHarmrateVD();
|
||||
po3.setTime(data.getTimeid().toInstant().atZone(zoneId).toLocalDate());
|
||||
po3.setLineId(oracleRelationMysql.get(data.getLineid()));
|
||||
po3.setPhaseType(data.getPhasicType());
|
||||
po3.setValueType("MIN");
|
||||
List<Float> avgData3 = this.getData(data);
|
||||
boolean quality3 = avgData3.stream().anyMatch(o->o>30.0 || o<0.0);
|
||||
if (quality3) {
|
||||
po3.setQualityFlag(1);
|
||||
}
|
||||
setValuesUsingReflection(po3,data,true,"getV","setV","Min");
|
||||
|
||||
RStatDataHarmrateVD po4 = new RStatDataHarmrateVD();
|
||||
po4.setTime(data.getTimeid().toInstant().atZone(zoneId).toLocalDate());
|
||||
po4.setLineId(oracleRelationMysql.get(data.getLineid()));
|
||||
po4.setPhaseType(data.getPhasicType());
|
||||
po4.setValueType("CP95");
|
||||
List<Float> avgData4 = this.getData(data);
|
||||
boolean quality4 = avgData4.stream().anyMatch(o->o>30.0 || o<0.0);
|
||||
if (quality4) {
|
||||
po4.setQualityFlag(1);
|
||||
}
|
||||
setValuesUsingReflection(po4,data,true,"getV","setV","Cp95");
|
||||
|
||||
result.addAll(Arrays.asList(po1,po2,po3,po4));
|
||||
}
|
||||
});
|
||||
}
|
||||
if(CollUtil.isNotEmpty(result)){
|
||||
rStatDataHarmRateVDService.insert(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public List<Float> getData(Object data) {
|
||||
List<Float> avgData = new ArrayList<>();
|
||||
try {
|
||||
for (int i = 1; i <= 50; i++) {
|
||||
String methodName = "getV" + i;
|
||||
Method method = data.getClass().getMethod(methodName);
|
||||
Float value = (Float) method.invoke(data);
|
||||
avgData.add(value);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return avgData;
|
||||
}
|
||||
|
||||
|
||||
public void setValuesUsingReflection(Object po1, Object data, boolean judge, String getString, String setString, String getEndString) {
|
||||
try {
|
||||
for (int i = 1; i <= 50; i++) {
|
||||
String methodNameGet;
|
||||
if (judge) {
|
||||
methodNameGet = getString + i + getEndString;
|
||||
} else {
|
||||
methodNameGet = getString + i;
|
||||
}
|
||||
String methodNameSet = setString + i;
|
||||
Method getMethod = data.getClass().getMethod(methodNameGet);
|
||||
Object value = getMethod.invoke(data);
|
||||
if (value != null) {
|
||||
BigDecimal bigDecimalValue = new BigDecimal(value.toString());
|
||||
double doubleValue = bigDecimalValue.doubleValue();
|
||||
Method setMethod = po1.getClass().getMethod(methodNameSet, Double.class);
|
||||
setMethod.invoke(po1, doubleValue);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.mysql.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.mysql.bo.po.PqLineBak;
|
||||
import com.njcn.mysql.mapper.PqLineBakMapper;
|
||||
import com.njcn.mysql.service.IPqLineBakService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@DS("target")
|
||||
@Service
|
||||
public class PqLineBakServiceImpl extends ServiceImpl<PqLineBakMapper, PqLineBak> implements IPqLineBakService {
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.mysql.service.impl;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.mysql.bo.po.RStatDataFlickerD;
|
||||
import com.njcn.mysql.mapper.RStatDataFlickerDMapper;
|
||||
import com.njcn.mysql.service.IRStatDataFlickerDService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/3/24 9:53
|
||||
*/
|
||||
@Service
|
||||
public class RStatDataFlickerDServiceImpl extends MppServiceImpl<RStatDataFlickerDMapper, RStatDataFlickerD> implements IRStatDataFlickerDService {
|
||||
@Override
|
||||
public void insert(List<RStatDataFlickerD> list) {
|
||||
this.saveOrUpdateBatchByMultiId(list,50);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.mysql.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.mysql.bo.po.RStatDataHarmrateVD;
|
||||
import com.njcn.mysql.mapper.RStatDataHarmRateVDMapper;
|
||||
import com.njcn.mysql.service.IRStatDataHarmRateVDService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/3/24 9:53
|
||||
*/
|
||||
@DS("target")
|
||||
@Service
|
||||
public class RStatDataHarmRateVDServiceImpl extends MppServiceImpl<RStatDataHarmRateVDMapper, RStatDataHarmrateVD> implements IRStatDataHarmRateVDService {
|
||||
|
||||
@Override
|
||||
public void insert(List<RStatDataHarmrateVD> list) {
|
||||
this.saveOrUpdateBatchByMultiId(list,50);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.mysql.service.impl;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.mysql.bo.po.RStatDataID;
|
||||
import com.njcn.mysql.mapper.RStatDataIDMapper;
|
||||
import com.njcn.mysql.service.IRStatDataIDService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/3/24 9:53
|
||||
*/
|
||||
@Service
|
||||
public class RStatDataIDServiceImpl extends MppServiceImpl<RStatDataIDMapper, RStatDataID> implements IRStatDataIDService {
|
||||
|
||||
@Override
|
||||
public void insert(List<RStatDataID> list) {
|
||||
this.saveOrUpdateBatchByMultiId(list,50);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.mysql.service.impl;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.mysql.bo.po.RStatDataInharmVD;
|
||||
import com.njcn.mysql.mapper.RStatDataInHarmVDMapper;
|
||||
import com.njcn.mysql.service.IRStatDataInharmVDService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/3/24 9:53
|
||||
*/
|
||||
@Service
|
||||
public class RStatDataInharmVDServiceImpl extends MppServiceImpl<RStatDataInHarmVDMapper, RStatDataInharmVD> implements IRStatDataInharmVDService {
|
||||
|
||||
@Override
|
||||
public void insert(List<RStatDataInharmVD> list) {
|
||||
this.saveOrUpdateBatchByMultiId(list,50);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.mysql.service.impl;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.mysql.bo.po.RStatDataPltD;
|
||||
import com.njcn.mysql.mapper.RStatDataPltDMapper;
|
||||
import com.njcn.mysql.service.IRStatDataPltDService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/3/24 9:53
|
||||
*/
|
||||
@Service
|
||||
public class RStatDataPltDServiceImpl extends MppServiceImpl<RStatDataPltDMapper, RStatDataPltD> implements IRStatDataPltDService {
|
||||
|
||||
@Override
|
||||
public void insert(List<RStatDataPltD> list) {
|
||||
this.saveOrUpdateBatchByMultiId(list,50);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.mysql.service.impl;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.mysql.bo.po.RStatDataVD;
|
||||
import com.njcn.mysql.mapper.RStatDataVDMapper;
|
||||
import com.njcn.mysql.service.IRStatDataVDService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/3/24 9:53
|
||||
*/
|
||||
@Service
|
||||
public class RStatDataVDServiceImpl extends MppServiceImpl<RStatDataVDMapper, RStatDataVD> implements IRStatDataVDService {
|
||||
|
||||
@Override
|
||||
public void insert(List<RStatDataVD> list) {
|
||||
this.saveOrUpdateBatchByMultiId(list,50);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.njcn.mysql.util;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class PubUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 根据传递的时间范围获取每天时间集合
|
||||
* @param timeBegin
|
||||
* @param timeEnd
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getTimeList(String timeBegin, String timeEnd) {
|
||||
List<String> timeStringList=new ArrayList<>();
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(DatePattern.NORM_DATE_PATTERN);
|
||||
Date begin = sdf.parse(timeBegin);
|
||||
Date end = sdf.parse(timeEnd);
|
||||
List<Date> lDate = new ArrayList<>();
|
||||
lDate.add(begin);
|
||||
Calendar calBegin = Calendar.getInstance();
|
||||
// 使用给定的 Date 设置此 Calendar 的时间
|
||||
calBegin.setTime(begin);
|
||||
Calendar calEnd = Calendar.getInstance();
|
||||
// 使用给定的 Date 设置此 Calendar 的时间
|
||||
calEnd.setTime(end);
|
||||
// 测试此日期是否在指定日期之后
|
||||
while (end.after(calBegin.getTime()))
|
||||
{
|
||||
// 根据日历的规则,为给定的日历字段添加或减去指定的时间量
|
||||
calBegin.add(Calendar.DAY_OF_MONTH, 1);
|
||||
lDate.add(calBegin.getTime());
|
||||
}
|
||||
|
||||
for (Date datePes :lDate){
|
||||
String format = sdf.format(datePes);
|
||||
timeStringList.add(format);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return timeStringList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
96
mysql-data/mysql-target/src/main/resources/application.yml
Normal file
96
mysql-data/mysql-target/src/main/resources/application.yml
Normal file
@@ -0,0 +1,96 @@
|
||||
#文件位置配置
|
||||
business:
|
||||
#分片次数,一定为24的约数,1 2 3 4 6 8 12 24
|
||||
slice: 4
|
||||
server:
|
||||
port: 8093
|
||||
spring:
|
||||
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:orcl
|
||||
# username: pqsadmin_jb
|
||||
# password: pqsadmin
|
||||
# driver-class-name: oracle.jdbc.driver.OracleDriver
|
||||
# target:
|
||||
# url: jdbc:mysql://127.0.0.1:3306/pqsinfo?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
||||
# username: root
|
||||
# password: 123456
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
master:
|
||||
url: jdbc:oracle:thin:@10.118.135.139:1521:pqsbase
|
||||
username: pqsadmin
|
||||
password: Pqsadmin123
|
||||
driver-class-name: oracle.jdbc.driver.OracleDriver
|
||||
target:
|
||||
url: jdbc:mysql://10.118.135.128: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
|
||||
|
||||
Reference in New Issue
Block a user