添加数据同步代码

This commit is contained in:
hzj
2024-01-11 13:43:11 +08:00
parent 4dcb3af7ae
commit 7b31e0376c
4 changed files with 30 additions and 18 deletions

View File

@@ -53,26 +53,10 @@ public class DataSyncController {
@ApiImplicitParam(name = "dataAsynParam", value = "数据同步参数", required = true)
public Boolean dataSync(@RequestBody DataAsynParam dataAsynParam){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
List<String> tableNames = dataAsynParam.getTableNames();
tableNames.stream().forEach(temp->{
IReplenishMybatisService executor = null;
try {
executor = (IReplenishMybatisService) SpringUtil.getBean(Class.forName("com.njcn.oracle.service.impl." + temp + "ServiceImpl"));
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
List<LocalDate> dateList = LocalDateUtil.getDateList(dataAsynParam.getStartTime(), dataAsynParam.getEndTime());
IReplenishMybatisService finalExecutor = executor;
dateList.forEach(date->{
dataSyncService.dataSync(finalExecutor,temp,date);
});
dataSyncService.dataBacthSysc(dataAsynParam);
});
return true;// HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, "数据同步");
}