liujie
2026-06-09 c96fbe6b0aeb413a17c429133ee6d81d138144b9
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java
@@ -306,15 +306,21 @@
            for (Long userId : userIds) {
                Operations operations = new Operations();
                operations.setUserId(userId);
                //获取运维人员实时定位
                XpOperationsUserPositionDTO operationsUserPositionDTO = mongoTemplate.findOne(new Query(Criteria.where("id").is(userId)), XpOperationsUserPositionDTO.class);
                if(null != operationsUserPositionDTO){
                    LonLatDto start = new LonLatDto(operationsUserPositionDTO.getLongitude(), operationsUserPositionDTO.getLatitude());
                    LonLatDto end = new LonLatDto(xpTask.getVehicleLon().doubleValue(), xpTask.getVehicleLat().doubleValue());
                    //获取导航线路
                    RouteVo routeVo = gdMapGeocodingUtil.getDistanceAndTime(start, end, null, null, null, null);
                    operations.setDistance(routeVo.getDistance());
                }
                operationsList.add(operations);
            }
            }
            if(operationsList.isEmpty()){
                throw new ServiceException("未找到合适的运维人员");
            }
            //对距离进行排序,去距离最近的人员
            operationsList.sort((o1, o2) -> o1.getDistance().compareTo(o2.getDistance()) * -1);
            Operations operations = operationsList.get(0);
@@ -324,7 +330,7 @@
            if(collect.size() > 1){
                //查询已经上班打卡了的人员
                List<XpClockIn> xpClockIns = xpClockInService.list(new QueryWrapper<XpClockIn>().in("app_user_id", collect)
                        .isNull("clock_out_result").last(" and DATE(now()) = DATE(clock_in_time)"));
                        .isNull("clock_out_result").last(" and DATE(now()) = DATE(clock_in_time) and clock_out_time is null"));
                if(xpClockIns.size() == 1){
                    userId = xpClockIns.get(0).getAppUserId();
                }else if(xpClockIns.size() > 1){
@@ -354,7 +360,7 @@
        xpTask.setExpiredNoticeSent(0);
        xpTask.setWillTimeoutNoticeSent(0);
        this.save(xpTask);
        if (xpTask.getId() == null && StringUtils.isNotBlank(xpTask.getTaskCode())) {
        if (xpTask.getId() == null && StringUtils.isNotEmpty(xpTask.getTaskCode())) {
            XpTask savedTask = this.getOne(new LambdaQueryWrapper<XpTask>()
                    .eq(XpTask::getTaskCode, xpTask.getTaskCode())
                    .last("limit 1"));
@@ -467,9 +473,9 @@
    }
    /**
     * 异步发送事故通知
     *
     * @param xpTask 任务信息
     * @param plateNumber 车牌号
     * @param processingTimeLimit 处理时限(分钟)
@@ -550,6 +556,7 @@
    /**
     * 构建事故推送 body JSON
     *
     * @param content 消息内容
     * @param xpTask 任务信息
     * @return JSON 字符串
@@ -1855,7 +1862,6 @@
    }
    @Override
    public R assigneeTask(Long id, Long handlerUserId, Long assigneeUserId) {
        XpTask task = this.getById(id);
@@ -2411,6 +2417,7 @@
    /**
     * 任务改派操作
     *
     * @param vo
     */
    @Override