| | |
| | | if (Objects.isNull(vehicle)) { |
| | | throw new ServiceException("上报失败,未获取到车辆信息", I18nKeyConstant.TASK_VEHICLE_NOT_EXIST); |
| | | } |
| | | VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(vehicle.getVehicleVin())), VehiclePosition.class); |
| | | if (Objects.isNull(vehiclePosition)) { |
| | | log.error("事故上报未获取到车辆当前定位"); |
| | | throw new ServiceException("获取车辆实时定位信息失败,请稍后重试", I18nKeyConstant.TASK_SAVE_ERROR); |
| | | } |
| | | xpTask.setVehicleLon(new BigDecimal(vehiclePosition.getPoint().getX())); |
| | | xpTask.setVehicleLat(new BigDecimal(vehiclePosition.getPoint().getY())); |
| | | Map<String, String> geocode = gdMapGeocodingUtil.geocode(xpTask.getVehicleLon().toString(), xpTask.getVehicleLat().toString()); |
| | | String address = geocode == null ? null : geocode.get("address"); |
| | | if (StringUtils.isBlank(address)) { |
| | | log.error("事故上报通过车辆定位从高德获取地址信息失败"); |
| | | throw new ServiceException("获取车辆实时定位信息失败,请稍后重试", I18nKeyConstant.TASK_SAVE_ERROR); |
| | | } |
| | | xpTask.setVehicleLocation(address); |
| | | // VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(vehicle.getVehicleVin())), VehiclePosition.class); |
| | | // if (Objects.isNull(vehiclePosition)) { |
| | | // log.error("事故上报未获取到车辆当前定位"); |
| | | // throw new ServiceException("获取车辆实时定位信息失败,请稍后重试", I18nKeyConstant.TASK_SAVE_ERROR); |
| | | // } |
| | | // xpTask.setVehicleLon(new BigDecimal(vehiclePosition.getPoint().getX())); |
| | | // xpTask.setVehicleLat(new BigDecimal(vehiclePosition.getPoint().getY())); |
| | | // Map<String, String> geocode = gdMapGeocodingUtil.geocode(xpTask.getVehicleLon().toString(), xpTask.getVehicleLat().toString()); |
| | | // String address = geocode == null ? null : geocode.get("address"); |
| | | // if (StringUtils.isBlank(address)) { |
| | | // log.error("事故上报通过车辆定位从高德获取地址信息失败"); |
| | | // throw new ServiceException("获取车辆实时定位信息失败,请稍后重试", I18nKeyConstant.TASK_SAVE_ERROR); |
| | | // } |
| | | // xpTask.setVehicleLocation(address); |
| | | // 临时处理 |
| | | // xpTask.setVehicleLon(new BigDecimal("104.055683")); |
| | | // xpTask.setVehicleLat(new BigDecimal("30.585991")); |
| | | // xpTask.setVehicleLocation("四川省成都市武侯区石羊街道天府新谷"); |
| | | xpTask.setVehicleLon(new BigDecimal("104.055683")); |
| | | xpTask.setVehicleLat(new BigDecimal("30.585991")); |
| | | xpTask.setVehicleLocation("四川省成都市武侯区石羊街道天府新谷"); |
| | | xpTask.setVehicleId(dto.getId()); |
| | | xpTask.setReportUserId(xpOperationsUser.getId()); |
| | | xpTask.setReportTime(LocalDateTime.now()); |