石墨消解仪后端服务
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

  1. package com.iflytop.gd.app.controller;
  2. import com.iflytop.gd.app.core.device.SelfTestState;
  3. import com.iflytop.gd.app.service.DeviceStateService;
  4. import com.iflytop.gd.app.service.SelfTestService;
  5. import com.iflytop.gd.common.result.Result;
  6. import io.swagger.v3.oas.annotations.Operation;
  7. import io.swagger.v3.oas.annotations.tags.Tag;
  8. import lombok.RequiredArgsConstructor;
  9. import lombok.extern.slf4j.Slf4j;
  10. import org.springframework.web.bind.annotation.GetMapping;
  11. import org.springframework.web.bind.annotation.PostMapping;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13. import org.springframework.web.bind.annotation.RestController;
  14. @Tag(name = "自检")
  15. @RestController
  16. @RequestMapping("/api/self-test")
  17. @RequiredArgsConstructor
  18. @Slf4j
  19. public class SelfTestController {
  20. private final SelfTestService selfTestService;
  21. private final DeviceStateService deviceStateService;
  22. @Operation(summary = "获取自检状态")
  23. @GetMapping("/status")
  24. public Result<SelfTestState> getSelfTestStatus() {
  25. return Result.success(selfTestService.getSelfTestState());
  26. }
  27. @Operation(summary = "自检完毕")
  28. @PostMapping("/finish")
  29. public Result<?> selfTestFinish() {
  30. deviceStateService.setSelfTest(true);
  31. return Result.success();
  32. }
  33. }