| | |
| | | |
| | | @Override |
| | | public Boolean hasRunningMotion(String uuid, Long hostId) { |
| | | return null != this.selectOfTop1(uuid, MotionStsType.EXECUTING.val(), hostId) |
| | | || null != this.selectOfTop1(uuid, MotionStsType.ERROR.val(), hostId); |
| | | Motion executeMotion = this.selectOfTop1(uuid, MotionStsType.EXECUTING.val(), hostId); |
| | | Motion errorMotion = this.selectOfTop1(uuid, MotionStsType.ERROR.val(), hostId); |
| | | if(errorMotion != null) { |
| | | return true; |
| | | } |
| | | |
| | | if(executeMotion != null) { |
| | | if (executeMotion.getSync() == 0) { |
| | | //检测是否有同步动作 |
| | | List<Motion> syncMotion = this.list(new LambdaQueryWrapper<Motion>() |
| | | .eq(Motion::getUuid, uuid) |
| | | .eq(Motion::getMotionSts, MotionStsType.EXECUTING.val()) |
| | | .eq(Motion::getHostId, hostId) |
| | | .eq(Motion::getSync, 1)); |
| | | if (!syncMotion.isEmpty()) { |
| | | return true;//存在同步动作 |
| | | } |
| | | return false;//当前动作为异步操作 |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public int batchInsert(List<Motion> motionList, String uuid, Integer taskNo) { |
| | | public int batchInsert(List<Motion> motionList, String uuid, Integer taskNo, Long hostId) { |
| | | int i = motionList.size(); |
| | | for (Motion motion : motionList) { |
| | | motion.setPriority(i); |
| | | motion.setWrkNo(taskNo); |
| | | motion.setTaskNo(taskNo); |
| | | motion.setUuid(uuid); |
| | | if (hostId != null) { |
| | | motion.setHostId(hostId); |
| | | } |
| | | if (!this.save(motion)) { |
| | | throw new CoolException(JSON.toJSONString(motion) + "动作保存失败"); |
| | | } |
| | |
| | | } |
| | | return motionList.size(); |
| | | } |
| | | |
| | | @Override |
| | | public int batchInsert(List<Motion> motionList, String uuid, Integer taskNo) { |
| | | return batchInsert(motionList, uuid, taskNo, null); |
| | | } |
| | | } |