xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java
@@ -2161,7 +2161,7 @@ if (null != distance) { Double distance1 = distance.get("WGS84"); if (distance1 > 50 && xpOrder.getStatus() == 6) {//大于50米表示在移动,且在服务中的时候记录里程 xpOrder.setMileageKilometers(BigDecimal.valueOf(xpOrder.getMileageKilometers()).add(new BigDecimal(distance1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue()); xpOrder.setMileageKilometers(BigDecimal.valueOf(xpOrder.getMileageKilometers()).add(new BigDecimal(distance1)).divide(new BigDecimal(1000)).setScale(4, RoundingMode.HALF_EVEN).doubleValue()); xpOrder.setAppUserId(null); this.updateById(xpOrder); // 存储本次距离 xp-robotaxi-vehicle-convoy-boot/src/main/java/com/xiaopeng/vehicleConvoy/constant/I18nKeyConstant.java
@@ -32,6 +32,7 @@ // ========== 车辆开关车门 ========== String VEHICLE_NOT_P_GEAR = "vehicle.not.p.gear"; String VEHICLE_DISTANCE_TOO_LONG = "vehicle.distance.too.long"; // ========== 车辆温度控制 ========== xp-robotaxi-vehicle-convoy-boot/src/main/java/com/xiaopeng/vehicleConvoy/controller/XpVehicleController.java
@@ -699,7 +699,7 @@ /** * 业务流程-车门解锁/后备箱解锁 */ @ApiOperation(value = "打开车门操作", tags = {"小程序-业务流程"}) @ApiOperation(value = "打开车门解锁/后备箱解锁", tags = {"小程序-业务流程"}) @PostMapping("/api/v1/mini-program/order/vehicle/unlock") public R<Integer> unlock(@RequestBody UnlockAppletDTO dto) { return R.ok(xpVehicleService.unlock(dto)); xp-robotaxi-vehicle-convoy-boot/src/main/java/com/xiaopeng/vehicleConvoy/model/dto/UnlockAppletDTO.java
@@ -16,4 +16,10 @@ @ApiModelProperty(value = "要开启的车门类型,取值: \"door\" — 主副驾车门 \"trunk\" — 后备箱") private String doorType; @ApiModelProperty(value = "用户经度") private Double longitude; @ApiModelProperty(value = "用户纬度") private Double latitude; } xp-robotaxi-vehicle-convoy-boot/src/main/java/com/xiaopeng/vehicleConvoy/service/impl/XpVehicleServiceImpl.java
@@ -23,6 +23,7 @@ import com.xiaopeng.common.core.constant.CacheConstants; import com.xiaopeng.common.core.domain.R; import com.xiaopeng.common.core.exception.ServiceException; import com.xiaopeng.common.core.utils.GeodesyUtil; import com.xiaopeng.common.core.web.page.PageInfo; import com.xiaopeng.common.redis.service.RedisService; import com.xiaopeng.vehicleConvoy.constant.I18nKeyConstant; @@ -229,6 +230,20 @@ if (Objects.isNull(xpVehicle)) { throw new ServiceException("未查询到有效车辆信息", I18nKeyConstant.VEHICLE_NOT_EXISTS); } // 判断距离是否在范围之内 4米 List<Point> positionList = redisTemplate.opsForGeo().position("vehiclePosition:" + xpVehicle.getVehicleVin(), xpVehicle.getVehicleVin()); if (CollUtil.isNotEmpty(positionList)) { Point geoJsonPoint = positionList.get(0); Map<String, Double> distance = GeodesyUtil.getDistance(dto.getLongitude()+ "," + dto.getLatitude(), geoJsonPoint.getX()+","+geoJsonPoint.getY()); if (null != distance) { Double distance1 = distance.get("WGS84"); if (distance1 > 4) { throw new ServiceException("距离过远,无法打开", I18nKeyConstant.VEHICLE_DISTANCE_TOO_LONG); } }else { throw new ServiceException("距离过远,无法打开", I18nKeyConstant.VEHICLE_DISTANCE_TOO_LONG); } } // 车门解锁、后备箱解锁 VehiclesCommandVo vehiclesCommandVo = new VehiclesCommandVo(); vehiclesCommandVo.setVin(xpVehicle.getVehicleVin()); xp-robotaxi-vehicle-convoy-boot/src/main/resources/i18n/messages_en_US.properties
@@ -25,3 +25,4 @@ vehicle.not.p.gear=The trunk cannot be opened when the vehicle is not in P gear vehicle.temperature.up=The highest temperature is 28°C vehicle.temperature.down=The lowest temperature is 22°C vehicle.distance.too.long=Too far away, unable to open xp-robotaxi-vehicle-convoy-boot/src/main/resources/i18n/messages_zh_CN.properties
@@ -26,3 +26,4 @@ vehicle.not.p.gear=车辆非P档,无法开启后备箱 vehicle.temperature.up=温度最高28℃ vehicle.temperature.down=温度最低22℃ vehicle.distance.too.long=距离过远,无法打开