|
|
@ -8,9 +8,13 @@ import com.iflytop.nuclear.model.Account; |
|
|
|
import com.iflytop.nuclear.model.Task; |
|
|
|
import com.iflytop.nuclear.service.CheckService; |
|
|
|
import com.iflytop.nuclear.service.TaskService; |
|
|
|
import com.iflytop.nuclear.websocket.WebSocketServer; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author cool |
|
|
|
* @date 2023/7/2 09:44 |
|
|
@ -20,6 +24,8 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
TaskService taskService; |
|
|
|
@Autowired |
|
|
|
WebSocketServer webSocketServer; |
|
|
|
|
|
|
|
@Override |
|
|
|
public CheckInfo getCheckInfoByTaskId(int taskId) { |
|
|
@ -38,23 +44,30 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
Task task = new Task(); |
|
|
|
task.setCurrentCoord(currentCoord); |
|
|
|
task.setStatus(status); |
|
|
|
task.setStartTime(new Date()); |
|
|
|
boolean update = taskService.update(task, taskUpdateWrapper); |
|
|
|
return update; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public CheckResult autoCheck(int order, String startIndex, int taskId) { |
|
|
|
public CheckResult autoCheck(int order, String startIndex, int taskId) throws IOException { |
|
|
|
if (order == 0) { |
|
|
|
if (startIndex == null) { |
|
|
|
if (startIndex == null || "".equals(startIndex)) { |
|
|
|
// 指定初始化index为1-6 |
|
|
|
this.updateCoordAndStatus(taskId, "1-6", 1); |
|
|
|
// 开始检测 |
|
|
|
// 检测完毕后获取下一个坐标 |
|
|
|
webSocketServer.sendMessage("开始检测 1-6"); |
|
|
|
String nextCoord = "1-6"; |
|
|
|
// 检测完毕后获取下一个坐标 用messagehandler处理检测完毕的消息 从而启动以下流程 |
|
|
|
// TODO |
|
|
|
// 检测下一个坐标 while |
|
|
|
// 如果中间终止 则退出返回 |
|
|
|
// 如果中间终止 则退出返回 与messagehandler 处理逻辑相同 外部控制while的终止 |
|
|
|
// 下一次进入后则进入其他流程 |
|
|
|
String nextCoord = this.getNextCoord("1-6", 0); |
|
|
|
System.out.println(nextCoord); |
|
|
|
while (!"finish".equals(nextCoord)) { |
|
|
|
nextCoord = this.getNextCoord(nextCoord, 0); |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 1); |
|
|
|
System.out.println(nextCoord); |
|
|
|
} |
|
|
|
// !!! 记录规则路径上的路过但是不检测的坐标 进行排除即可 |
|
|
|
}else { |
|
|
|
|
|
|
@ -171,7 +184,7 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
if (minorLine < 8){ |
|
|
|
return mainLine + "-" + (minorLine + 1); |
|
|
|
}else { |
|
|
|
return null; |
|
|
|
return "finish"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|