admin
2025-08-08 035edfa382d349ba66240fbfef68c14c7cfc95d1
src/main/java/com/taoke/autopay/service/impl/js2/OrderTaskServiceImpl.java
@@ -95,7 +95,15 @@
        }
        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) {
@@ -203,13 +211,18 @@
            }
        }
        // 统计所有设备正在执行任务的数量
        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