|
|
@ -2,6 +2,7 @@ package com.iflytop.nuclear.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
import com.alibaba.fastjson2.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
import com.iflytop.nuclear.entity.CheckInfo; |
|
|
|
import com.iflytop.nuclear.entity.CheckResult; |
|
|
@ -91,7 +92,7 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
webSocketServer.sendMessage("update"); |
|
|
|
} |
|
|
|
|
|
|
|
public void initCheck(String initNextCoord,int order, int taskId) throws IOException { |
|
|
|
public String initCheck(String initNextCoord,int order, int taskId) throws IOException { |
|
|
|
// 指定初始化index为1-6 |
|
|
|
String nextCoord = initNextCoord; |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 1, true, false); |
|
|
@ -125,9 +126,10 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 3, false, true); |
|
|
|
} |
|
|
|
} |
|
|
|
return nextCoord; |
|
|
|
} |
|
|
|
|
|
|
|
public void continueCheck(int taskId, int order) throws IOException { |
|
|
|
public String continueCheck(int taskId, int order) throws IOException { |
|
|
|
// 被中断过,需要从中断的currentCoord坐标继续 |
|
|
|
// 首先需要读取数据库,获得当前taskId的信息 |
|
|
|
Task task = taskService.getById(taskId); |
|
|
@ -160,10 +162,20 @@ public class CheckServiceImpl implements CheckService { |
|
|
|
this.updateCoordAndStatus(taskId, nextCoord, 3, false, true); |
|
|
|
} |
|
|
|
} |
|
|
|
return nextCoord; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public CheckResult autoCheck(int order, String startIndex, int taskId) throws IOException { |
|
|
|
// 检测是否有正在进行的任务 |
|
|
|
QueryWrapper<Task> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("status", 1); |
|
|
|
Task one = taskService.getOne(queryWrapper); |
|
|
|
if (one != null) { |
|
|
|
CheckResult checkResult = new CheckResult(); |
|
|
|
checkResult.setError("当前已有一个任务正在进行中,请暂停该任务后重试。"); |
|
|
|
return checkResult; |
|
|
|
} |
|
|
|
this.changeBreakOff(false); |
|
|
|
this.updateCoordAndStatus(taskId, null, 1, false, false); |
|
|
|
currentTaskId = taskId; |
|
|
|