| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.manager.common.exception.BusinessException; |
| | | import com.zy.acs.manager.manager.controller.result.MissionVo; |
| | | import com.zy.acs.manager.manager.entity.*; |
| | | import com.zy.acs.manager.manager.enums.ActionStsType; |
| | | import com.zy.acs.manager.manager.enums.BusStsType; |
| | | 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.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | if (Cools.isEmpty(actionList)) { |
| | | return Boolean.FALSE; |
| | | } |
| | | String actionGroupId = actionService.getById(actionList.get(0).getId()).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()); |
| | | action.setActionSts(ActionStsType.PREPARE.val()); |
| | | action.setIoTime(now); |
| | | action.setUpdateTime(now); |
| | | newActionList.add(action); |
| | | } |
| | | int i = newActionList.size(); |
| | | for (Action action : newActionList) { |
| | | action.setPriority(i); |
| | | if (!actionService.save(action)) { |
| | | throw new BusinessException(action.getName() + "动作更新失败"); |
| | | } |
| | | i -= 1; |
| | | } |
| | | |
| | | Set<Long> busIds = new HashSet<>(); |
| | | List<Long> taskIds = actionService.selectTaskIdsByGroupId(actionGroupId); |
| | | for (Long taskId : taskIds) { |
| | | Task task = taskService.getById(taskId); |
| | | if (null != task) { |
| | | task.setTaskSts(TaskStsType.ASSIGN.val()); |
| | | task.setUpdateTime(now); |
| | | task.setIoTime(now); |
| | | if (!taskService.updateById(task)) { |
| | | throw new BusinessException(task.getUuid() + "任务更新失败"); |
| | | } |
| | | busIds.add(task.getBusId()); |
| | | } |
| | | } |
| | | for (Long busId : busIds) { |
| | | Bus bus = busService.getById(busId); |
| | | if (null != bus) { |
| | | bus.setBusSts(BusStsType.PROGRESS.val()); |
| | | bus.setUpdateTime(now); |
| | | if (!busService.updateById(bus)) { |
| | | throw new BusinessException(bus.getUuid() + "总线更新失败"); |
| | | } |
| | | } |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |