fix:修复指令同时创建校验失败问题

This commit is contained in:
2025-09-11 14:59:12 +08:00
parent 139a5c1636
commit 071dfa6efd
2 changed files with 16 additions and 2 deletions

View File

@@ -596,9 +596,22 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
luceneExecuteLogService.deviceExecuteLog(logDto);
throw e;
}
InstructionMybatis entity = ConvertUtil.convert(dto, InstructionMybatis.class);
instructionMapper.insert(entity);
instructions.add(dto);
if (entity.getNext_point_code().equals("RK1034")||entity.getNext_point_code().equals("RK1035")){
synchronized (this){
//判断有无对接位位为终点的指令
boolean present = instructions.stream().filter(a -> a.getNext_point_code().equals(entity.getNext_point_code())).findAny().isPresent();
if (present){
throw new BadRequestException("有DDJ对接位为终点的指令");
}
instructionMapper.insert(entity);
instructions.add(dto);
}
}else {
instructionMapper.insert(entity);
instructions.add(dto);
}
}

View File

@@ -415,6 +415,7 @@ public class CreateDDJInst {
} catch (Exception e) {
taskDto.setRemark(e.getMessage());
taskserver.updateByCodeFromCache(taskDto);
return;
}
//创建指令后修改任务状态
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());