#
vincentlu
2025-05-13 ebd2f4397a92c6a5096de1b86d59154363344720
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/MissionServiceImpl.java
@@ -10,8 +10,10 @@
import com.zy.acs.manager.manager.enums.SegmentStateType;
import com.zy.acs.manager.manager.enums.TaskStsType;
import com.zy.acs.manager.manager.service.*;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
@@ -32,6 +34,10 @@
    private AgvDetailService agvDetailService;
    @Autowired
    private TaskService taskService;
    @Autowired
    private BusService busService;
    @Autowired
    private SqlSession sqlSession;
    @Override
    public List<MissionVo> getList(Long agvId, String groupNo) {
@@ -64,12 +70,12 @@
        Long recentCode = agvDetail.getRecentCode();
        String currCode = null;
        if (null != recentCode) {
            currCode = codeService.getById(recentCode).getData();
            currCode = codeService.getCacheById(recentCode).getData();
        }
        // action -------------------------------
        List<Action> actionList = actionService.list(new LambdaQueryWrapper<Action>()
                .eq(Action::getGroupId, groupNo).orderByDesc(Action::getPriority));
                .eq(Action::getGroupId, groupNo).ne(Action::getActionSts, ActionStsType.EXPIRED.val()).orderByDesc(Action::getPriority));
        if (Cools.isEmpty(actionList)) {
            return null;
        }
@@ -98,7 +104,7 @@
            return null;
        }
        List<Action> actionList = actionService.list(new LambdaQueryWrapper<Action>()
                .eq(Action::getGroupId, groupNo).orderByDesc(Action::getPriority));
                .eq(Action::getGroupId, groupNo).ne(Action::getActionSts, ActionStsType.EXPIRED.val()).orderByDesc(Action::getPriority));
        if (Cools.isEmpty(actionList)) {
            return null;
        }
@@ -116,16 +122,21 @@
    }
    @Override
    @Transactional
    public Boolean resend(List<Action> actionList) {
        if (Cools.isEmpty(actionList)) {
            return Boolean.FALSE;
        }
        String actionGroupId = actionService.getById(actionList.get(0).getId()).getGroupId();
        List<Long> actionIds = actionList.stream().map(Action::getId).collect(Collectors.toList());
        String actionGroupId = actionService.getById(actionIds.get(0)).getGroupId();
        actionService.updateStsByGroupId(actionGroupId, ActionStsType.EXPIRED.val());
        List<Action> newActionList = new ArrayList<>();
        Date now = new Date();
        for (Action item : actionList) {
            Action action = actionService.getById(item.getId());
        for (Long actionId : actionIds) {
            sqlSession.clearCache();
            Action action = actionService.getById(actionId);
            action.setActionSts(ActionStsType.PREPARE.val());
            action.setIoTime(now);
            action.setUpdateTime(now);
@@ -135,7 +146,7 @@
        for (Action action : newActionList) {
            action.setPriority(i);
            if (!actionService.save(action)) {
                throw new BusinessException(action.getName() + "动作更新失败");
                throw new BusinessException(action.getName() + " Action Update Fail!");
            }
            i -= 1;
        }
@@ -149,7 +160,7 @@
                task.setUpdateTime(now);
                task.setIoTime(now);
                if (!taskService.updateById(task)) {
                    throw new BusinessException(task.getUuid() + "任务更新失败");
                    throw new BusinessException(task.getUuid() + " Task Update Fail!");
                }
                busIds.add(task.getBusId());
            }
@@ -160,7 +171,7 @@
                bus.setBusSts(BusStsType.PROGRESS.val());
                bus.setUpdateTime(now);
                if (!busService.updateById(bus)) {
                    throw new BusinessException(bus.getUuid() + "总线更新失败");
                    throw new BusinessException(bus.getUuid() + " Bus Update Fail!");
                }
            }
        }