|
|
@ -55,13 +55,19 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
return checkInfo; |
|
|
|
} |
|
|
|
|
|
|
|
public boolean updateCoordAndStatus(int taskId, String currentCoord, int status) throws IOException { |
|
|
|
public boolean updateCoordAndStatus(int taskId, String currentCoord, int status, boolean updateStartTime, boolean updateEndTime) throws IOException { |
|
|
|
UpdateWrapper<Task> taskUpdateWrapper = new UpdateWrapper<>(); |
|
|
|
taskUpdateWrapper.eq("id",taskId); |
|
|
|
Task task = new Task(); |
|
|
|
if (currentCoord != null){ |
|
|
|
task.setCurrentCoord(currentCoord); |
|
|
|
} |
|
|
|
if (updateStartTime) { |
|
|
|
task.setStartTime(new Date()); |
|
|
|
} |
|
|
|
if (updateEndTime) { |
|
|
|
task.setEndTime(new Date()); |
|
|
|
} |
|
|
|
task.setStatus(status); |
|
|
|
boolean update = taskService.update(task, taskUpdateWrapper); |
|
|
|
this.sendMessageToPage(); |
|
|
@ -88,7 +94,7 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
public void initCheck(String initNextCoord,int order, int taskId) throws IOException { |
|
|
|
// 指定初始化index为1-6 |
|
|
|
String nextCoord = initNextCoord; |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 1); |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 1, true, false); |
|
|
|
// 开始检测 |
|
|
|
this.sendMessageToDevice(nextCoord, taskId); |
|
|
|
// 如果中间终止 则退出返回 与messagehandler 处理逻辑相同 外部控制while的终止 |
|
|
@ -100,7 +106,7 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
while (true) { |
|
|
|
if (this.breakOff) { |
|
|
|
breakFirst = true; |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 2); |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 2, false, false); |
|
|
|
break; |
|
|
|
} |
|
|
|
if (this.isMessageReceived()) { |
|
|
@ -113,10 +119,10 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
} |
|
|
|
// 检测完毕后获取下一个坐标 |
|
|
|
nextCoord = this.getNextCoord(nextCoord, order); |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 1); |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 1, false, false); |
|
|
|
this.sendMessageToDevice(nextCoord, taskId); |
|
|
|
if ("finish".equals(nextCoord)) { |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 3); |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 3, false, true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -135,7 +141,7 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
while (true) { |
|
|
|
if (this.breakOff) { |
|
|
|
breakFirst = true; |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 2); |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 2, false, false); |
|
|
|
break; |
|
|
|
} |
|
|
|
if (this.isMessageReceived()) { |
|
|
@ -148,10 +154,10 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
} |
|
|
|
// 检测完毕后获取下一个坐标 |
|
|
|
nextCoord = this.getNextCoord(nextCoord, order); |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 1); |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 1, false, false); |
|
|
|
this.sendMessageToDevice(nextCoord, taskId); |
|
|
|
if ("finish".equals(nextCoord)) { |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 3); |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 3, false, true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -159,7 +165,7 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
@Override |
|
|
|
public CheckResult autoCheck(int order, String startIndex, int taskId) throws IOException { |
|
|
|
this.changeBreakOff(false); |
|
|
|
this.updateCoordAndStatus(taskId, null, 1); |
|
|
|
this.updateCoordAndStatus(taskId, null, 1, false, false); |
|
|
|
currentTaskId = taskId; |
|
|
|
if (order == 0) { |
|
|
|
if (startIndex == null || "".equals(startIndex)) { |
|
|
|