fix:执行引擎

1.取消任务的逻辑增加停止录屏请求。
hz_1122_temp
李杰应 2024-11-27 19:24:21 +08:00
parent ea30141d14
commit a5cd812519
1 changed files with 21 additions and 1 deletions

View File

@ -123,6 +123,24 @@ public class DefaultExecThread implements AtuExecThread{
} }
} }
private String stopRecord() {
String filePath = null;
//停止录屏
boolean isSave = Integer.parseInt(task.getScreenRecordSet()) != 0;
if (this.startRecordFlag && this.deviceConnection != null) {
Map<String, Object> stopRequest = new HashMap<>();
stopRequest.put("save",isSave);
stopRequest.put("tenantId",task.getTenantId());
stopRequest.put("taskId",task.getTaskId());
try {
filePath = this.deviceConnection.stopRecord(stopRequest);
} catch (Exception e) {
log.error("关闭录屏失败", e);
}
}
return filePath;
}
@Override @Override
public void destroy(String taskId) { public void destroy(String taskId) {
@ -175,7 +193,7 @@ public class DefaultExecThread implements AtuExecThread{
private boolean sendCancelResult(String taskId) { private boolean sendCancelResult(String taskId) {
try { try {
log.debug("任务取消更新步骤结果。。。"); log.debug("任务取消更新步骤结果。。。");
ScriptStep step = (ScriptStep)this.scriptExecutor.getCurrentStep(); // // todo: 没有开始执行,导致取消任务时候空指针 ScriptStep step = (ScriptStep)this.scriptExecutor.getCurrentStep(); // // 没有开始执行,导致取消任务时候空指针
if (step == null) { if (step == null) {
try{ try{
Thread.sleep(500); Thread.sleep(500);
@ -184,6 +202,8 @@ public class DefaultExecThread implements AtuExecThread{
} }
step = (ScriptStep)this.scriptExecutor.getCurrentStep(); step = (ScriptStep)this.scriptExecutor.getCurrentStep();
} }
// 停止录屏请求
stopRecord();
StepExecuteResult stepResult = createStepResult(step, taskId); StepExecuteResult stepResult = createStepResult(step, taskId);
updateTaskResult(stepResult); updateTaskResult(stepResult);