| | |
| | | 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); |
| | |
| | | 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){ |
| | |
| | | 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")); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 异步发送事故通知 |
| | | * |
| | | * @param xpTask 任务信息 |
| | | * @param plateNumber 车牌号 |
| | | * @param processingTimeLimit 处理时限(分钟) |
| | |
| | | |
| | | /** |
| | | * 构建事故推送 body JSON |
| | | * |
| | | * @param content 消息内容 |
| | | * @param xpTask 任务信息 |
| | | * @return JSON 字符串 |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public R assigneeTask(Long id, Long handlerUserId, Long assigneeUserId) { |
| | | XpTask task = this.getById(id); |
| | |
| | | |
| | | /** |
| | | * 任务改派操作 |
| | | * |
| | | * @param vo |
| | | */ |
| | | @Override |