From 1f9b7297a280b680151bd9d57a46de3f73983f41 Mon Sep 17 00:00:00 2001 From: waner Date: Thu, 16 Apr 2026 10:18:17 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E8=AE=BE=E5=A4=87=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../init/service/impl/InitServiceImpl.java | 40 +++++++------------ 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/cisd/tms/modules/init/service/impl/InitServiceImpl.java b/src/main/java/com/cisd/tms/modules/init/service/impl/InitServiceImpl.java index 598c2eb..4607042 100644 --- a/src/main/java/com/cisd/tms/modules/init/service/impl/InitServiceImpl.java +++ b/src/main/java/com/cisd/tms/modules/init/service/impl/InitServiceImpl.java @@ -44,7 +44,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service -@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RequiredArgsConstructor public class InitServiceImpl implements InitService { private static final String TASK_TYPE_INIT = "INIT"; @@ -64,35 +64,14 @@ public class InitServiceImpl implements InitService { private final InitStepExecutor initStepExecutor; private final InitCommandProfileService initCommandProfileService; private final InitExecutorProperties initExecutorProperties; - private Executor backgroundExecutor = Executors.newCachedThreadPool(); - private ConcurrentMap> activeExecutions = new ConcurrentHashMap<>(); - - InitServiceImpl( - InitTaskRepository initTaskRepository, - InitTaskStepRepository initTaskStepRepository, - CisdPresetProperties cisdPresetProperties, - ObjectMapper objectMapper, - InitStepExecutor initStepExecutor, - InitCommandProfileService initCommandProfileService, - InitExecutorProperties initExecutorProperties, - Executor backgroundExecutor, - ConcurrentMap> activeExecutions - ) { - this.initTaskRepository = initTaskRepository; - this.initTaskStepRepository = initTaskStepRepository; - this.cisdPresetProperties = cisdPresetProperties; - this.objectMapper = objectMapper; - this.initStepExecutor = initStepExecutor; - this.initCommandProfileService = initCommandProfileService; - this.initExecutorProperties = initExecutorProperties; - this.backgroundExecutor = backgroundExecutor; - this.activeExecutions = activeExecutions; - } + private final Executor backgroundExecutor = Executors.newCachedThreadPool(); + private final ConcurrentMap> activeExecutions = new ConcurrentHashMap<>(); /** * 读取后端预制产品类型和版本。 * 该接口是前端动态渲染“企业/间参/直参”初始化页的入口。 */ + @Override public InitPlanTemplateResponse loadTemplate(String ignoredVersion) { String productType = resolvePresetProductType(); @@ -104,6 +83,7 @@ public class InitServiceImpl implements InitService { return response; } + @Override public InitPreviewResponse preview(InitPreviewRequest request) { if (request == null) { throw new IllegalArgumentException("request must not be null"); @@ -124,6 +104,7 @@ public class InitServiceImpl implements InitService { return response; } + @Override public ResetPreviewResponse previewReset() { ResolvedResetContext context = resolveCurrentResetContext(); String productType = context.productType(); @@ -136,6 +117,7 @@ public class InitServiceImpl implements InitService { return response; } + @Override public InitCreateTaskResponse createTask(InitPreviewRequest request) { if (request == null) { throw new IllegalArgumentException("request must not be null"); @@ -197,6 +179,7 @@ public class InitServiceImpl implements InitService { return response; } + @Override public ResetCreateTaskResponse createResetTask() { ResolvedResetContext context = resolveCurrentResetContext(); String productType = context.productType(); @@ -244,6 +227,7 @@ public class InitServiceImpl implements InitService { return response; } + @Override public DeviceInitStateSnapshot getDeviceInitStateSnapshot() { Optional running = initTaskRepository.findLatestByStatus("RUNNING"); if (running.isPresent()) { @@ -268,6 +252,7 @@ public class InitServiceImpl implements InitService { return new DeviceInitStateSnapshot("INITIALIZED", TASK_TYPE_INIT, latestInit.get().getStatus(), context.orgCode(), context.mqType()); } + @Override public CurrentInitConfigResponse loadCurrentInitConfig() { Optional latestInit = initTaskRepository.findLatestByTaskTypeAndStatus(TASK_TYPE_INIT, "SUCCESS"); if (latestInit.isEmpty()) { @@ -276,6 +261,7 @@ public class InitServiceImpl implements InitService { return resolveCurrentInitConfigFromTask(latestInit.get()); } + @Override public InitTaskDetailResponse getTask(String taskId) { InitTaskEntity entity = requireTask(taskId); @@ -292,6 +278,7 @@ public class InitServiceImpl implements InitService { return response; } + @Override public List getTaskSteps(String taskId) { requireTask(taskId); @@ -308,6 +295,7 @@ public class InitServiceImpl implements InitService { }).toList(); } + @Override public InitTaskStepLogResponse getTaskStepLog(String taskId, int stepNo) { if (stepNo <= 0) { throw new IllegalArgumentException("stepNo must be > 0"); @@ -343,10 +331,12 @@ public class InitServiceImpl implements InitService { } } + @Override public InitTaskExecuteResponse executeTask(String taskId) { return executeTaskInternal(taskId); } + @Override public InitTaskExecuteResponse executeResetTask(String taskId) { InitTaskEntity task = requireTask(taskId); String taskType = normalize(task.getTaskType());