| | |
| | | import com.xiaopeng.api.feignClient.account.SysUserClient; |
| | | import com.xiaopeng.api.feignClient.account.XpOperationUserClient; |
| | | import com.xiaopeng.api.feignClient.account.XpOperationUserNotificationClient; |
| | | import com.xiaopeng.api.feignClient.map.XpMapClient; |
| | | import com.xiaopeng.api.feignClient.operation.SmsClient; |
| | | import com.xiaopeng.api.feignClient.pushMessage.WebSocketMessageClient; |
| | | import com.xiaopeng.api.feignClient.pushMessage.XpAliPushMessageClient; |
| | |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.apache.shardingsphere.transaction.annotation.ShardingSphereTransactionType; |
| | | import org.apache.shardingsphere.transaction.core.TransactionType; |
| | | import org.redisson.api.RLock; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.geo.Point; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.geo.GeoJsonPoint; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | |
| | | List<Long> userIds = xpOperationsRoleResult.getData().stream().filter(x -> ids.contains(x.getOperationsUserId())) |
| | | .map(XpOperationsRole::getOperationsUserId) |
| | | .distinct().collect(Collectors.toList()); |
| | | if(CollUtil.isEmpty(userIds)){ |
| | | throw new ServiceException("未配置车队运维人员"); |
| | | } |
| | | //获取首选人的实时定位,计算每个人到事故车辆位置的导航距离 |
| | | List<Operations> operationsList = new ArrayList<>(); |
| | | for (Long userId : userIds) { |
| | |
| | | } |
| | | |
| | | List<XpTask.Reject> rejects = Optional.ofNullable(task.getExcluded()).orElse(new ArrayList<>()); |
| | | if(msg != null && Strings.isNotBlank(task.getHandleUserId())) { |
| | | XpTask.Reject reject = task.reject(msg); |
| | | rejects.add(reject); |
| | | List<Long> id = Collections.singletonList(Long.parseLong(task.getHandleUserId())); |
| | | String roleName = xpOperationUserClient.listByIdsWithRole(id).getData().get(0).getRoleName(); |
| | | reject.setRejectUserRoleName(roleName); |
| | | } |
| | | task.setExcluded(rejects); |
| | | task.setReassignmentStatus(1); |
| | | task.setStatus(4); |
| | |
| | | .map(String::valueOf).collect(Collectors.joining(",")); |
| | | |
| | | |
| | | // VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(vehicle.getVehicleVin())), VehiclePosition.class); |
| | | VehiclePosition vehiclePosition = new VehiclePosition(); |
| | | vehiclePosition.setPoint(new GeoJsonPoint(103.12615621, 30.264561)); |
| | | VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(vehicle.getVehicleVin())), VehiclePosition.class); |
| | | // VehiclePosition vehiclePosition = new VehiclePosition(); |
| | | // vehiclePosition.setPoint(new GeoJsonPoint(103.12615621, 30.264561)); |
| | | String handlerUser = chooseNearestAvailableOperationsUser(belongUserIds, vehiclePosition); |
| | | task.setHandleUserId(handlerUser); |
| | | if(handlerUser == null) { |
| | |
| | | } |
| | | updateById(task); |
| | | if(StringUtils.isNotBlank(task.getHandleUserId())){ |
| | | List<Long> id = Collections.singletonList(Long.parseLong(task.getHandleUserId())); |
| | | String roleName = xpOperationUserClient.listByIdsWithRole(id).getData().get(0).getRoleName(); |
| | | reject.setRejectUserRoleName(roleName); |
| | | sendAccidentNotificationAsync(task, vehicle.getPlateNumber(), taskRule.getProcessingTimeLimit()); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void saveTask(SaveErrorTaskDto dto, Long reportUserId) { |
| | | |
| | | List<XpTask> saveTask = new ArrayList<>(); |
| | |
| | | } |
| | | this.saveBatch(saveTask); |
| | | |
| | | for (XpTask task : saveTask) { |
| | | |
| | | reassign(task.getId(),null); |
| | | } |
| | | } |
| | | |
| | | @Override |