| | |
| | | throw new OrderTaskException(OrderTaskException.CODE_COMMON, "下单任务需求下单数量不能为空"); |
| | | } |
| | | |
| | | if(orderTask.getReceiveCycleHours()==null){ |
| | | if(orderTask.getReceiveCycleMinutes()==null){ |
| | | throw new OrderTaskException(OrderTaskException.CODE_COMMON, "下单任务收货周期不能为空"); |
| | | } |
| | | |
| | |
| | | } |
| | | return orderTaskMapper.selectByPrimaryKey(id); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<OrderTask> getOrderTaskByIds(List<Long> ids) { |
| | | if(ids==null||ids.isEmpty()){ |
| | | return new ArrayList<>(); |
| | | } |
| | | return orderTaskMapper.listByIds(ids); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public OrderTask getOrderTaskByIdForUpdate(Long id) { |
| | |
| | | } |
| | | } |
| | | // 统计所有设备正在执行任务的数量 |
| | | |
| | | List<ClientCountDTO> clientCountList = orderTaskExecutionDetailMapper.statisticClientIdsCountByStatus(Arrays.asList( new Integer[]{OrderTaskExecutionDetail.STATUS_NOT_ORDERED})); |
| | | Map<Long, Integer> clientCountMap = new HashMap<>(); |
| | | for(ClientCountDTO dto:clientCountList){ |
| | | clientCountMap.put(dto.getClientId(), dto.getCount()); |
| | | } |
| | | |
| | | // 剔除已经存在2个任务以上的设备 |
| | | for(int i=0;i<clientInfoList.size();i++){ |
| | | if(clientCountMap.containsKey(clientInfoList.get(i).getId())&&clientCountMap.get(clientInfoList.get(i).getId())>=2){ |
| | | clientInfoList.remove(i); |
| | | i--; |
| | | } |
| | | } |
| | | |
| | | clientInfoList.sort(new Comparator<ClientInfo>() { |
| | | @Override |