fix:设备信息展示
This commit is contained in:
parent
312391052f
commit
1f9b7297a2
@ -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<String, CompletableFuture<Void>> activeExecutions = new ConcurrentHashMap<>();
|
||||
|
||||
InitServiceImpl(
|
||||
InitTaskRepository initTaskRepository,
|
||||
InitTaskStepRepository initTaskStepRepository,
|
||||
CisdPresetProperties cisdPresetProperties,
|
||||
ObjectMapper objectMapper,
|
||||
InitStepExecutor initStepExecutor,
|
||||
InitCommandProfileService initCommandProfileService,
|
||||
InitExecutorProperties initExecutorProperties,
|
||||
Executor backgroundExecutor,
|
||||
ConcurrentMap<String, CompletableFuture<Void>> 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<String, CompletableFuture<Void>> 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<InitTaskEntity> 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<InitTaskEntity> 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<InitTaskStepResponse> 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());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user