package com.iflytop.nuclear.controller; import com.iflytop.nuclear.entity.CheckInfo; import com.iflytop.nuclear.entity.CheckResult; import com.iflytop.nuclear.service.CheckService; import com.iflytop.nuclear.utils.ResponseData; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; /** * @author cool * @date 2023/7/2 09:41 */ @Slf4j @RestController @CrossOrigin @RequestMapping("/check") public class CheckController { @Autowired CheckService checkService; @GetMapping("/auto/{id}") public ResponseData checkAuto(@PathVariable(name = "id") int taskId) { CheckInfo checkInfo = checkService.getCheckInfoByTaskId(taskId); int order = checkInfo.getOrder(); String startIndex = checkInfo.getCurrentCoord(); int status = checkInfo.getStatus(); if (status == 3) { // 已经完成 return ResponseData.fail("该任务已经完成,无法自动检测"); } // 判断当前order 0为横向检查 1为纵向检查 CheckResult checkResult = checkService.autoCheck(order, startIndex, taskId); return ResponseData.success(); } }