API数据表更新

This commit is contained in:
2025-08-27 23:53:49 +08:00
parent 97c43d6ec0
commit c55871d134

View File

@@ -336,16 +336,16 @@ public class taskDbSync {
errorMsg = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(); errorMsg = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName();
System.err.println("同步数据失败: " + errorMsg); System.err.println("同步数据失败: " + errorMsg);
} }
syncTaskService.updateById(task);
DbConfig sourceDbConfig = dbConfigService.getById(task.getSourceDbId()); DbConfig sourceDbConfig = dbConfigService.getById(task.getSourceDbId());
DbConfig targetDbConfig = dbConfigService.getById(task.getTargetDbId()); DbConfig targetDbConfig = dbConfigService.getById(task.getTargetDbId());
LocalDateTime endTime = LocalDateTime.now(); LocalDateTime endTime = LocalDateTime.now();
task.setLastSyncTime(endTime);
SyncTaskLog taskLog = new SyncTaskLog(task.getTaskId(), task.getTaskName(), task.getSourceDbId(), SyncTaskLog taskLog = new SyncTaskLog(task.getTaskId(), task.getTaskName(), task.getSourceDbId(),
sourceDbConfig.getDbName(), sourceTable, task.getTargetDbId(), targetDbConfig.getDbName(), targetTable, sourceDbConfig.getDbName(), sourceTable, task.getTargetDbId(), targetDbConfig.getDbName(), targetTable,
startTime, endTime, (long) totalRows, (long) successRows, (long) failRows, ustatus, startTime, endTime, (long) totalRows, (long) successRows, (long) failRows, ustatus,
errorMsg, (int) Duration.between(startTime, endTime).getSeconds(), "0"); errorMsg, (int) Duration.between(startTime, endTime).getSeconds(), "0");
task.setLastSyncTime(endTime);
taskLogService.save(taskLog); taskLogService.save(taskLog);
syncTaskService.updateById(task);
} }
/** /**