|
|
@ -70,6 +70,15 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
return messageReceived; |
|
|
|
} |
|
|
|
|
|
|
|
public void sendMessageToClient(String nextCoord, int taskId) throws IOException { |
|
|
|
DetectionMessage startMessage = DetectionMessage.builder() |
|
|
|
.messageId(IdUtil.randomUUID()) |
|
|
|
.coord(nextCoord) |
|
|
|
.taskId(taskId) |
|
|
|
.build(); |
|
|
|
webSocketServer.sendMessage(startMessage.toString()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public CheckResult autoCheck(int order, String startIndex, int taskId) throws IOException { |
|
|
|
this.changeBreakOff(false); |
|
|
@ -80,12 +89,7 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
this.updateCoordAndStatus(taskId, "1-6", 1); |
|
|
|
String nextCoord = "1-6"; |
|
|
|
// 开始检测 |
|
|
|
DetectionMessage startMessage = DetectionMessage.builder() |
|
|
|
.messageId(IdUtil.randomUUID()) |
|
|
|
.coord(nextCoord) |
|
|
|
.taskId(taskId) |
|
|
|
.build(); |
|
|
|
webSocketServer.sendMessage(startMessage.toString()); |
|
|
|
this.sendMessageToClient(nextCoord, taskId); |
|
|
|
// 如果中间终止 则退出返回 与messagehandler 处理逻辑相同 外部控制while的终止 |
|
|
|
// 下一次进入后则进入其他流程 |
|
|
|
while (!"finish".equals(nextCoord)) { |
|
|
@ -109,13 +113,7 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
// 检测完毕后获取下一个坐标 |
|
|
|
nextCoord = this.getNextCoord(nextCoord, 0); |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 1); |
|
|
|
DetectionMessage detectionMessage = DetectionMessage.builder() |
|
|
|
.messageId(IdUtil.randomUUID()) |
|
|
|
.coord(nextCoord) |
|
|
|
.taskId(taskId) |
|
|
|
.build(); |
|
|
|
JSONObject from = JSONObject.from(detectionMessage); |
|
|
|
webSocketServer.sendMessage(from.toString()); |
|
|
|
this.sendMessageToClient(nextCoord, taskId); |
|
|
|
if ("finish".equals(nextCoord)) { |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 3); |
|
|
|
} |
|
|
@ -125,12 +123,7 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
// 首先需要读取数据库,获得当前taskId的信息 |
|
|
|
Task task = taskService.getById(taskId); |
|
|
|
String nextCoord = task.getCurrentCoord(); |
|
|
|
DetectionMessage startMessage = DetectionMessage.builder() |
|
|
|
.messageId(IdUtil.randomUUID()) |
|
|
|
.coord(nextCoord) |
|
|
|
.taskId(taskId) |
|
|
|
.build(); |
|
|
|
webSocketServer.sendMessage(startMessage.toString()); |
|
|
|
this.sendMessageToClient(nextCoord, taskId); |
|
|
|
// 得到的currentCoord已经检测过,直接进入下一流程 |
|
|
|
while (!"finish".equals(nextCoord)) { |
|
|
|
// 需要一个中断的接口, 中途暂停本次流程 |
|
|
@ -153,13 +146,7 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
// 检测完毕后获取下一个坐标 |
|
|
|
nextCoord = this.getNextCoord(nextCoord, 0); |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 1); |
|
|
|
DetectionMessage detectionMessage = DetectionMessage.builder() |
|
|
|
.messageId(IdUtil.randomUUID()) |
|
|
|
.coord(nextCoord) |
|
|
|
.taskId(taskId) |
|
|
|
.build(); |
|
|
|
JSONObject from = JSONObject.from(detectionMessage); |
|
|
|
webSocketServer.sendMessage(from.toString()); |
|
|
|
this.sendMessageToClient(nextCoord, taskId); |
|
|
|
if ("finish".equals(nextCoord)) { |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 3); |
|
|
|
} |
|
|
|