添加数据同步代码
This commit is contained in:
@@ -15,7 +15,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface IReplenishMybatisService<T> extends IService<T> {
|
public interface IReplenishMybatisService<T> extends IService<T> {
|
||||||
|
|
||||||
ServiceType getServiceType();
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 当批量插入数据量过大时,可以指定尺寸交给mybatis,每次插入多少条记录
|
* 当批量插入数据量过大时,可以指定尺寸交给mybatis,每次插入多少条记录
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
package com.njcn.oracle.service;
|
|
||||||
|
|
||||||
import com.njcn.oracle.bo.param.ServiceType;
|
|
||||||
import com.njcn.oracle.mybatis.service.IReplenishMybatisService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
* Date: 2024/1/4 13:43【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class ServiceExecutorStore {
|
|
||||||
|
|
||||||
private final Map<String, IReplenishMybatisService> annotationMap = new HashMap<>();
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public ServiceExecutorStore(List<IReplenishMybatisService> Services) {
|
|
||||||
for (IReplenishMybatisService executor : Services) {
|
|
||||||
annotationMap.put(executor.getServiceType().name(),executor);
|
|
||||||
}
|
|
||||||
for (ServiceType type : ServiceType.getExecutableTypes()) {
|
|
||||||
log.info("ServiceType [{}] doesn't have ServiceType executor", type);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public IReplenishMybatisService getExecutor(String serviceType) {
|
|
||||||
IReplenishMybatisService executor = annotationMap.get(serviceType);
|
|
||||||
return executor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -50,10 +50,6 @@ public class DataFlickerServiceImpl extends ReplenishMybatisServiceImpl<DataFlic
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DataFlicker;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 默认500分片,如果字段超过20以上,建议重写方法调整为1000分片,重写时不要忘记@DS注解
|
* 默认500分片,如果字段超过20以上,建议重写方法调整为1000分片,重写时不要忘记@DS注解
|
||||||
|
|||||||
@@ -54,10 +54,7 @@ public class DataFlucServiceImpl extends ReplenishMybatisServiceImpl<DataFlucMap
|
|||||||
System.out.printf("DataFluc总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DataFluc总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
|
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DataFluc;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,9 +51,6 @@ public class DataHarmphasicIServiceImpl extends ReplenishMybatisServiceImpl<Data
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DataHarmphasicI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DataHarmphasicI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DataHarmphasicI;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,8 +65,5 @@ public class DataHarmphasicVServiceImpl extends ReplenishMybatisServiceImpl<Data
|
|||||||
System.out.printf("DataHarmphasicV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DataHarmphasicV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DataHarmphasicV;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DataHarmpowerPServiceImpl extends ReplenishMybatisServiceImpl<DataH
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DataHarmpowerP总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DataHarmpowerP总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DataHarmpowerP;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,9 +65,5 @@ public class DataHarmpowerQServiceImpl extends ReplenishMybatisServiceImpl<DataH
|
|||||||
System.out.printf("DataHarmpowerQ总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DataHarmpowerQ总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DataHarmpowerQ;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,9 +65,6 @@ public class DataHarmpowerSServiceImpl extends ReplenishMybatisServiceImpl<DataH
|
|||||||
System.out.printf("DataHarmpowerS总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DataHarmpowerS总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DataHarmpowerS;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DataHarmrateIServiceImpl extends ReplenishMybatisServiceImpl<DataHa
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DataHarmrateI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DataHarmrateI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DataHarmrateI;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DataHarmrateVServiceImpl extends ReplenishMybatisServiceImpl<DataHa
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DataHarmrateV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DataHarmrateV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DataHarmrateV;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DataIServiceImpl extends ReplenishMybatisServiceImpl<DataIMapper, D
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DataI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DataI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DataI;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DataInharmIServiceImpl extends ReplenishMybatisServiceImpl<DataInha
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DataInharmI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DataInharmI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DataInharmI;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DataInharmVServiceImpl extends ReplenishMybatisServiceImpl<DataInha
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DataInharmV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DataInharmV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DataInharmV;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DataPltServiceImpl extends ReplenishMybatisServiceImpl<DataPltMappe
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DataPlt总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DataPlt总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DataPlt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DataVServiceImpl extends ReplenishMybatisServiceImpl<DataVMapper, D
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DataV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DataV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DataV;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DayFlickerServiceImpl extends ReplenishMybatisServiceImpl<DayFlicke
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DayFlicker总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DayFlicker总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DayFlicker;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DayFlucServiceImpl extends ReplenishMybatisServiceImpl<DayFlucMappe
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DayFluc总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DayFluc总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DayFluc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,4 @@ public class DayHarmphasicIServiceImpl extends ReplenishMybatisServiceImpl<DayHa
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DayHarmphasicI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DayHarmphasicI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DayHarmphasicI;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DayHarmphasicVServiceImpl extends ReplenishMybatisServiceImpl<DayHa
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DayHarmphasicV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DayHarmphasicV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DayHarmphasicV;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,4 @@ public class DayHarmpowerPServiceImpl extends ReplenishMybatisServiceImpl<DayHar
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DayHarmpowerP总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DayHarmpowerP总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DayHarmpowerP;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DayHarmpowerQServiceImpl extends ReplenishMybatisServiceImpl<DayHar
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DayHarmpowerQ总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DayHarmpowerQ总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DayHarmpowerQ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DayHarmpowerSServiceImpl extends ReplenishMybatisServiceImpl<DayHar
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DayHarmpowerS总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DayHarmpowerS总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DayHarmpowerS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DayHarmrateIServiceImpl extends ReplenishMybatisServiceImpl<DayHarm
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DayHarmrateI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DayHarmrateI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DayHarmrateI;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DayHarmrateVServiceImpl extends ReplenishMybatisServiceImpl<DayHarm
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DayHarmrateV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DayHarmrateV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DayHarmrateV;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DayIServiceImpl extends ReplenishMybatisServiceImpl<DayIMapper, Day
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DayI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DayI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DayI;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DayInharmIServiceImpl extends ReplenishMybatisServiceImpl<DayInharm
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DayInharmI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DayInharmI总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DayInharmI;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DayInharmVServiceImpl extends ReplenishMybatisServiceImpl<DayInharm
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DayInharmV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DayInharmV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DayInharmV;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,8 +63,5 @@ public class DayPltServiceImpl extends ReplenishMybatisServiceImpl<DayPltMapper,
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DayPlt总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DayPlt总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DayPlt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class DayVServiceImpl extends ReplenishMybatisServiceImpl<DayVMapper, Day
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("DayV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("DayV总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.DayV;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class LimitRateServiceImpl extends ReplenishMybatisServiceImpl<LimitRateM
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("LimitRate总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("LimitRate总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.LimitRate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,8 +64,5 @@ public class LimitTargetServiceImpl extends ReplenishMybatisServiceImpl<LimitTar
|
|||||||
stopWatch.stop();
|
stopWatch.stop();
|
||||||
System.out.printf("LimitTarget总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
System.out.printf("LimitTarget总计:%d条,耗时执行时长:%f 秒.%n", data.size(), stopWatch.getTotalTimeSeconds());
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public ServiceType getServiceType() {
|
|
||||||
return ServiceType.LimitTarget;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollectionUtil;
|
|||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.njcn.oracle.bo.param.MigrationParam;
|
import com.njcn.oracle.bo.param.MigrationParam;
|
||||||
import com.njcn.oracle.mybatis.service.IReplenishMybatisService;
|
import com.njcn.oracle.mybatis.service.IReplenishMybatisService;
|
||||||
import com.njcn.oracle.service.ServiceExecutorStore;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -33,17 +32,20 @@ import java.util.List;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class DataSyncController {
|
public class DataSyncController {
|
||||||
|
|
||||||
private final ServiceExecutorStore serviceExecutorStore;
|
|
||||||
|
|
||||||
@PostMapping("/dataSync")
|
@PostMapping("/dataSync")
|
||||||
@ApiOperation("数据同步")
|
@ApiOperation("数据同步")
|
||||||
@ApiImplicitParam(name = "componentParam", value = "组件数据", required = true)
|
@ApiImplicitParam(name = "componentParam", value = "组件数据", required = true)
|
||||||
public void dataSync(@RequestBody MigrationParam migrationParam) {
|
public void dataSync(@RequestBody MigrationParam migrationParam){
|
||||||
|
|
||||||
List<String> tableNames = migrationParam.getTableNames();
|
List<String> tableNames = migrationParam.getTableNames();
|
||||||
tableNames.stream().forEach(temp->{
|
tableNames.stream().forEach(temp->{
|
||||||
// IReplenishMybatisService executor = (IReplenishMybatisService)SpringUtil.getBean("com.njcn.oracle.service.impl." + temp + "ServiceImpl");
|
IReplenishMybatisService executor = null;
|
||||||
IReplenishMybatisService executor = serviceExecutorStore.getExecutor(temp);
|
try {
|
||||||
|
executor = (IReplenishMybatisService) SpringUtil.getBean(Class.forName("com.njcn.oracle.service.impl." + temp + "ServiceImpl"));
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
List list = executor.queryData(migrationParam);
|
List list = executor.queryData(migrationParam);
|
||||||
if(CollectionUtil.isNotEmpty(list)){
|
if(CollectionUtil.isNotEmpty(list)){
|
||||||
executor.clearTargetData(migrationParam);
|
executor.clearTargetData(migrationParam);
|
||||||
|
|||||||
Reference in New Issue
Block a user