You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.3 KiB
37 lines
1.3 KiB
package com.iflytop.gd.app.controller;
|
|
|
|
import com.iflytop.gd.app.core.device.SelfTestState;
|
|
import com.iflytop.gd.app.service.DeviceStateService;
|
|
import com.iflytop.gd.app.service.SelfTestService;
|
|
import com.iflytop.gd.common.result.Result;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
@Tag(name = "自检")
|
|
@RestController
|
|
@RequestMapping("/api/self-test")
|
|
@RequiredArgsConstructor
|
|
@Slf4j
|
|
public class SelfTestController {
|
|
private final SelfTestService selfTestService;
|
|
private final DeviceStateService deviceStateService;
|
|
|
|
@Operation(summary = "获取自检状态")
|
|
@GetMapping("/status")
|
|
public Result<SelfTestState> getSelfTestStatus() {
|
|
return Result.success(selfTestService.getSelfTestState());
|
|
}
|
|
|
|
@Operation(summary = "自检完毕")
|
|
@PostMapping("/finish")
|
|
public Result<?> selfTestFinish() {
|
|
deviceStateService.setSelfTest(true);
|
|
return Result.success();
|
|
}
|
|
}
|