| | |
| | | import com.xiaopeng.api.feignClient.automaticPilot.VehicleBuriedPointClient; |
| | | import com.xiaopeng.api.feignClient.maintenance.XpTaskRuleClient; |
| | | import com.xiaopeng.api.feignClient.map.XpMapClient; |
| | | import com.xiaopeng.api.feignClient.map.XpStationClient; |
| | | import com.xiaopeng.api.feignClient.operation.*; |
| | | import com.xiaopeng.api.feignClient.order.XpCruiseOrderClient; |
| | | import com.xiaopeng.api.feignClient.payFront.XpPayFrontClient; |
| | |
| | | |
| | | @Resource |
| | | private XpPayFrontClient xpPayFrontClient; |
| | | @Resource |
| | | private XpStationClient xpStationClient; |
| | | |
| | | @Value("${robotaxi.appId:xp_robotaxi_api}") |
| | | private String appid; |
| | |
| | | if(order.getOfficialPartnerId() == null){ |
| | | //创建定时任务执行延迟驶离终点和下发巡游单 |
| | | XpPoint point = xpPointClient.queryById(order.getEndPointId()).getData(); |
| | | Integer parkingTimeLimit = point.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != point.getStationId()){ |
| | | XpStation xpStation = xpStationClient.getXpStationById(point.getStationId()).getData(); |
| | | parkingTimeLimit = xpStation.getParkingTimeLimit(); |
| | | } |
| | | Map<String, ? extends Object> jobMaps = |
| | | new ImmutableMap.Builder<String, String>() |
| | | .put("id", order.getId().toString()) |
| | |
| | | AddCruiseMissionJob.class, |
| | | (AddCruiseMissionJob.name + order.getId()).toUpperCase(), |
| | | TimeJobType.ADD_CRUISE_MISSION, |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(point.getParkingTimeLimit())), |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(parkingTimeLimit)), |
| | | jobMaps |
| | | ); |
| | | }else{ |
| | |
| | | .orElse(new ArrayList<>()); |
| | | for (Long pointId : endPointId) { |
| | | XpPoint endPoint = getPointById(pointId); |
| | | Integer parkingTimeLimit = endPoint.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != endPoint.getStationId()){ |
| | | XpStation xpStation = xpStationClient.getXpStationById(endPoint.getStationId()).getData(); |
| | | parkingTimeLimit = xpStation.getParkingTimeLimit(); |
| | | } |
| | | // 计算直线距离,如果endPoint到startPoint的距离大于minOrderDistance,则返回该点 |
| | | GlobalCoordinates endCoordinates = new GlobalCoordinates(endPoint.getPointLon(), endPoint.getPointLat()); |
| | | double distanceMeter = GeodesyUtil.getDistanceMeter(startCoordinates, endCoordinates, Ellipsoid.WGS84); |
| | |
| | | ret.setLongitude(endPoint.getPointLon()); |
| | | ret.setDistance(new BigDecimal(distanceMeter).setScale(2, RoundingMode.HALF_UP).doubleValue()); |
| | | ret.setAddress(endPoint.getPointAddress()); |
| | | ret.setTime(endPoint.getParkingTimeLimit()); |
| | | ret.setTime(parkingTimeLimit); |
| | | ret.setElectronicAreaId(endPoint.getElectronicAreaId()); |
| | | // 判断是否收藏 |
| | | if (pointIdsByUserId.contains(endPoint.getId())) { |
| | |
| | | for (XpOrderHistoryListVO xpOrderHistoryListVO : value) { |
| | | XpPoint xpPoint = pointList.stream().filter(e -> e.getId().equals(xpOrderHistoryListVO.getStartPointId())).findFirst().orElse(null); |
| | | if (xpPoint != null) { |
| | | Integer parkingTimeLimit = xpPoint.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != xpPoint.getStationId()){ |
| | | XpStation xpStation = xpStationClient.getXpStationById(xpPoint.getStationId()).getData(); |
| | | parkingTimeLimit = xpStation.getParkingTimeLimit(); |
| | | } |
| | | xpOrderHistoryListVO.setStartPointName(xpPoint.getPointName()); |
| | | xpOrderHistoryListVO.setStartLat(xpPoint.getPointLat()); |
| | | xpOrderHistoryListVO.setStartLon(xpPoint.getPointLon()); |
| | | xpOrderHistoryListVO.setXpElectronicFenceAreaId(xpPoint.getElectronicAreaId()); |
| | | xpOrderHistoryListVO.setStartParkingTimeLimit(xpPoint.getParkingTimeLimit()); |
| | | xpOrderHistoryListVO.setStartParkingTimeLimit(parkingTimeLimit); |
| | | } |
| | | |
| | | xpPoint = pointList.stream().filter(e -> e.getId().equals(xpOrderHistoryListVO.getEndPointId())).findFirst().orElse(null); |
| | | if (xpPoint != null) { |
| | | Integer parkingTimeLimit = xpPoint.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != xpPoint.getStationId()){ |
| | | XpStation xpStation = xpStationClient.getXpStationById(xpPoint.getStationId()).getData(); |
| | | parkingTimeLimit = xpStation.getParkingTimeLimit(); |
| | | } |
| | | xpOrderHistoryListVO.setEndPointName(xpPoint.getPointName()); |
| | | xpOrderHistoryListVO.setEndLat(xpPoint.getPointLat()); |
| | | xpOrderHistoryListVO.setEndLon(xpPoint.getPointLon()); |
| | | xpOrderHistoryListVO.setXpElectronicFenceAreaId(xpPoint.getElectronicAreaId()); |
| | | xpOrderHistoryListVO.setEndParkingTimeLimit(xpPoint.getParkingTimeLimit()); |
| | | xpOrderHistoryListVO.setEndParkingTimeLimit(parkingTimeLimit); |
| | | } |
| | | } |
| | | |
| | |
| | | // 查询起点点位 |
| | | Long startPointId = xpOrder.getStartPointId(); |
| | | XpPoint xpPoint = xpPointClient.queryById(startPointId).getData(); |
| | | Integer parkingTimeLimit = xpPoint.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != xpPoint.getStationId()){ |
| | | XpStation xpStation = xpStationClient.getXpStationById(xpPoint.getStationId()).getData(); |
| | | parkingTimeLimit = xpStation.getParkingTimeLimit(); |
| | | } |
| | | // 添加取消订单定时任务job 时间为点位限停时长 |
| | | Map<String, ? extends Object> cancelJobMaps = |
| | | new ImmutableMap.Builder<String, Long>(). |
| | |
| | | OrderCancelJob.class, |
| | | (OrderCancelJob.name + xpOrder.getId()).toUpperCase(), |
| | | TimeJobType.ORDER_CANCEL, |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(xpPoint.getParkingTimeLimit())), |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(parkingTimeLimit)), |
| | | cancelJobMaps |
| | | ); |
| | | // 车辆到达上车点时间 |
| | |
| | | // 添加车辆到达终点后限停时间到后驶离的定时任务 |
| | | //时间到后将车辆状态回滚到空闲、添加巡游订单,解绑用户和车辆关系,车辆驶离点位 |
| | | XpPoint point = xpPointClient.queryById(xpOrder.getEndPointId()).getData(); |
| | | Integer parkingTimeLimit2 = point.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != point.getStationId()){ |
| | | XpStation xpStation = xpStationClient.getXpStationById(point.getStationId()).getData(); |
| | | parkingTimeLimit2 = xpStation.getParkingTimeLimit(); |
| | | } |
| | | Map<String, ? extends Object> jobMaps = |
| | | new ImmutableMap.Builder<String, String>() |
| | | .put("id", xpOrder.getId().toString()) |
| | |
| | | PushChainReactionOrderJob.class, |
| | | (PushChainReactionOrderJob.name + id).toUpperCase(), |
| | | TimeJobType.ADD_CHAIN_REACTION_ORDER_MISSION, |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(point.getParkingTimeLimit())), |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(parkingTimeLimit2)), |
| | | jobMaps |
| | | ); |
| | | } |
| | |
| | | AddCruiseMissionJob.class, |
| | | (AddCruiseMissionJob.name + xpOrder.getId()).toUpperCase(), |
| | | TimeJobType.ADD_CRUISE_MISSION, |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(point.getParkingTimeLimit())), |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(parkingTimeLimit2)), |
| | | jobMaps |
| | | ); |
| | | } |
| | |
| | | AddCruiseMissionJob.class, |
| | | (AddCruiseMissionJob.name + xpOrder.getId()).toUpperCase(), |
| | | TimeJobType.ADD_CRUISE_MISSION, |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(point.getParkingTimeLimit())), |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(parkingTimeLimit2)), |
| | | jobMaps |
| | | ); |
| | | } |
| | |
| | | R<XpCruisePlanVehicle> xpCruisePlanR = xpCruisePlanClient.getCruisePlan(vehicle.getId()); |
| | | if (xpCruisePlanR == null || xpCruisePlanR.getData() == null) { |
| | | log.info("未找到匹配的巡游计划,无法执行巡游订单 {}", vehicle.getPlateNumber()); |
| | | log.info("给车端发送取消行程报文 {}", vehicle.getPlateNumber()); |
| | | |
| | | PushOrderDto cancelDto = new PushOrderDto(); |
| | | cancelDto.setStartTaskId(order.getXpuStartTaskId()); |
| | | cancelDto.setEndTaskId(order.getXpuEndTaskId()); |
| | | cancelDto.setOrderId(order.getId().toString()); |
| | | String vin1 = SensitiveDataCryptoUtil.decryptIfPossible(vehicle.getVehicleVin()); |
| | | cancelDto.setVin(vin1); |
| | | cancelDto.setOperation_type(OrderOperationType.CLOUD_CANCEL_ORDER); |
| | | cancelDto.setCancelScene(CancelOrderSceneEnum.REASSIGN_OLD_VEHICLE.getCode()); |
| | | orderMissionClient.cancelOrder(cancelDto); |
| | | return; |
| | | } |
| | | String vin = SensitiveDataCryptoUtil.decryptIfPossible(vehicle.getVehicleVin()); |
| | |
| | | public R payment(XpOrderPayDto dto, String uid) { |
| | | |
| | | |
| | | XpOrder order = this.getById(dto.getOrderId()); |
| | | |
| | | HashMap<String, Object> resultMap = new HashMap<>(); |
| | | |
| | | // 1.0 免密 //查询是否开通免密 |
| | | // 1先查用户是否申请 申请了拿到通过的businessOrderId |
| | | boolean signed = false; |
| | | CreditPaySignQueryDto creditPaySignQueryDto = new CreditPaySignQueryDto(); |
| | | creditPaySignQueryDto.setUid(Long.valueOf(uid)); |
| | | creditPaySignQueryDto.setBusinessId("xp-robotaxi"); |
| | | creditPaySignQueryDto.setCategory("009001"); |
| | | creditPaySignQueryDto.setBusinessOrderId(OrderCodeUtil.getOrderCode("MMZF")); |
| | | R<CreditPaySignQueryVo> creditPaySignQueryVoR = xpPayFrontClient.queryCreditPaySign(creditPaySignQueryDto); |
| | | if (creditPaySignQueryVoR.getCode()==200) { |
| | | CreditPaySignQueryVo data = creditPaySignQueryVoR.getData(); |
| | | // 查看是否有签约的 |
| | | long count = data.getSignList().stream().filter(e -> e.getStatus().equals("VALID")).count(); |
| | | if (count > 0){ |
| | | signed = true; |
| | | } |
| | | } |
| | | |
| | | |
| | | if(signed){ |
| | | // y已签约 1.信用下单 |
| | | CreditOrderCreateDto creditOrderCreateDto = new CreditOrderCreateDto(); |
| | | creditOrderCreateDto.setUid(Long.valueOf(uid)); |
| | | creditOrderCreateDto.setBusinessId("xp-robotaxi"); |
| | | creditOrderCreateDto.setCategory("009001"); |
| | | creditOrderCreateDto.setBusinessOrderId(""); |
| | | creditOrderCreateDto.setSubject("小鹏集团|robotaxi"); |
| | | creditOrderCreateDto.setPayType("13"); |
| | | |
| | | |
| | | // 信用下单 |
| | | ArrayList<CreditOrderCreateDto.PostPayment> postPayments = new ArrayList<>(1); |
| | | CreditOrderCreateDto.PostPayment postPayment = new CreditOrderCreateDto.PostPayment(); |
| | | postPayment.setName("收费标准"); |
| | | postPayment.setDescription("行程价格动态浮动,具体详情可在费用详情或计价规则查看"); |
| | | postPayments.add(postPayment); |
| | | creditOrderCreateDto.setPostPayments(postPayments); |
| | | R<CreditOrderCreateVo> creditOrderCreateVoR = xpPayFrontClient.createCreditOrder(creditOrderCreateDto); |
| | | if(creditOrderCreateVoR.getCode()==200){ |
| | | CreditOrderCreateVo data = creditOrderCreateVoR.getData(); |
| | | resultMap.put("status", 1); |
| | | resultMap.put("value", data); |
| | | |
| | | order.setPayType(3); |
| | | order.setAuthOrderId(data.getAuthOrderId()); |
| | | |
| | | return R.ok(resultMap); |
| | | } |
| | | |
| | | }else { |
| | | |
| | | // 未签约 |
| | | // 调用预下单接口 |
| | | CreditPrecreateDto creditPrecreateDto = new CreditPrecreateDto(); |
| | | creditPrecreateDto.setUid(uid); |
| | | creditPrecreateDto.setBizId("xp-robotaxi"); |
| | | creditPrecreateDto.setBizOrderId(""); |
| | | creditPrecreateDto.setPayScene(99); |
| | | creditPrecreateDto.setAmount(order.getOrderMoney().multiply(new BigDecimal(100)).intValue()); |
| | | creditPrecreateDto.setCategory("009001"); |
| | | creditPrecreateDto.setTitle("信用下单"); |
| | | creditPrecreateDto.setDetail("信用下单"); |
| | | |
| | | HashMap<String, String> businessExtend = new HashMap<>(); |
| | | businessExtend.put("returnUrl", ""); |
| | | businessExtend.put("notifyUrl", ""); |
| | | creditPrecreateDto.setBusinessExtend(businessExtend); |
| | | |
| | | R<CreditPrecreateVo> creditPrecreateVoR = xpPayFrontClient.precreate(creditPrecreateDto); |
| | | if (creditPrecreateVoR.getCode()==200) { |
| | | CreditPrecreateVo data = creditPrecreateVoR.getData(); |
| | | resultMap.put("status", 2); |
| | | resultMap.put("value", data); |
| | | return R.ok(resultMap); |
| | | } |
| | | } |
| | | // XpOrder order = this.getById(dto.getOrderId()); |
| | | // |
| | | // HashMap<String, Object> resultMap = new HashMap<>(); |
| | | // |
| | | // // 1.0 免密 //查询是否开通免密 |
| | | // // 1先查用户是否申请 申请了拿到通过的businessOrderId |
| | | // boolean signed = false; |
| | | // CreditPaySignQueryDto creditPaySignQueryDto = new CreditPaySignQueryDto(); |
| | | // creditPaySignQueryDto.setUid(Long.valueOf(uid)); |
| | | // creditPaySignQueryDto.setBusinessId("xp-robotaxi"); |
| | | // creditPaySignQueryDto.setCategory("009001"); |
| | | // creditPaySignQueryDto.setBusinessOrderId(OrderCodeUtil.getOrderCode("MMZF")); |
| | | // R<CreditPaySignQueryVo> creditPaySignQueryVoR = xpPayFrontClient.queryCreditPaySign(creditPaySignQueryDto); |
| | | // if (creditPaySignQueryVoR.getCode()==200) { |
| | | // CreditPaySignQueryVo data = creditPaySignQueryVoR.getData(); |
| | | // // 查看是否有签约的 |
| | | // long count = data.getSignList().stream().filter(e -> e.getStatus().equals("VALID")).count(); |
| | | // if (count > 0){ |
| | | // signed = true; |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // if(signed){ |
| | | // // y已签约 1.信用下单 |
| | | // CreditOrderCreateDto creditOrderCreateDto = new CreditOrderCreateDto(); |
| | | // creditOrderCreateDto.setUid(Long.valueOf(uid)); |
| | | // creditOrderCreateDto.setBusinessId("xp-robotaxi"); |
| | | // creditOrderCreateDto.setCategory("009001"); |
| | | // creditOrderCreateDto.setBusinessOrderId(""); |
| | | // creditOrderCreateDto.setSubject("小鹏集团|robotaxi"); |
| | | // creditOrderCreateDto.setPayType("13"); |
| | | // |
| | | // |
| | | // // 信用下单 |
| | | // ArrayList<CreditOrderCreateDto.PostPayment> postPayments = new ArrayList<>(1); |
| | | // CreditOrderCreateDto.PostPayment postPayment = new CreditOrderCreateDto.PostPayment(); |
| | | // postPayment.setName("收费标准"); |
| | | // postPayment.setDescription("行程价格动态浮动,具体详情可在费用详情或计价规则查看"); |
| | | // postPayments.add(postPayment); |
| | | // creditOrderCreateDto.setPostPayments(postPayments); |
| | | // R<CreditOrderCreateVo> creditOrderCreateVoR = xpPayFrontClient.createCreditOrder(creditOrderCreateDto); |
| | | // if(creditOrderCreateVoR.getCode()==200){ |
| | | // CreditOrderCreateVo data = creditOrderCreateVoR.getData(); |
| | | // resultMap.put("status", 1); |
| | | // resultMap.put("value", data); |
| | | // |
| | | // order.setPayType(3); |
| | | // order.setAuthOrderId(data.getAuthOrderId()); |
| | | // |
| | | // return R.ok(resultMap); |
| | | // } |
| | | // |
| | | // }else { |
| | | // |
| | | // // 未签约 |
| | | // // 调用预下单接口 |
| | | // CreditPrecreateDto creditPrecreateDto = new CreditPrecreateDto(); |
| | | // creditPrecreateDto.setUid(uid); |
| | | // creditPrecreateDto.setBizId("xp-robotaxi"); |
| | | // creditPrecreateDto.setBizOrderId(""); |
| | | // creditPrecreateDto.setPayScene(99); |
| | | // creditPrecreateDto.setAmount(order.getOrderMoney().multiply(new BigDecimal(100)).intValue()); |
| | | // creditPrecreateDto.setCategory("009001"); |
| | | // creditPrecreateDto.setTitle("信用下单"); |
| | | // creditPrecreateDto.setDetail("信用下单"); |
| | | // |
| | | // HashMap<String, String> businessExtend = new HashMap<>(); |
| | | // businessExtend.put("returnUrl", ""); |
| | | // businessExtend.put("notifyUrl", ""); |
| | | // creditPrecreateDto.setBusinessExtend(businessExtend); |
| | | // |
| | | // R<CreditPrecreateVo> creditPrecreateVoR = xpPayFrontClient.precreate(creditPrecreateDto); |
| | | // if (creditPrecreateVoR.getCode()==200) { |
| | | // CreditPrecreateVo data = creditPrecreateVoR.getData(); |
| | | // resultMap.put("status", 2); |
| | | // resultMap.put("value", data); |
| | | // return R.ok(resultMap); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | | // mvp版本不做支付 使用优惠券抵扣为0元订单处理 处理订单状态即可 |
| | | // XpOrder order = this.getById(dto.getOrderId()); |
| | | // order.setStatus(9); |
| | | // order.setAppUserId(null); |
| | | // if (order.getCouponId() != null) { |
| | | // UseUserCouponDto useUserCouponDto = new UseUserCouponDto(); |
| | | // useUserCouponDto.setUserCouponId(order.getCouponId()); |
| | | // R<BigDecimal> decimalR = xpAppUserCouponClient.useUserCoupon(useUserCouponDto); |
| | | // if (decimalR.getCode() == 200) { |
| | | // order.setCouponMoney(decimalR.getData()); |
| | | // if (order.getCouponMoney().compareTo(order.getOrderMoney()) > 0) { |
| | | // order.setPayMoney(BigDecimal.ZERO); |
| | | // order.setCouponMoney(order.getOrderMoney()); |
| | | // } else { |
| | | // order.setPayMoney(order.getOrderMoney().subtract(decimalR.getData())); |
| | | // } |
| | | // } |
| | | // } |
| | | // baseMapper.updateById(order); |
| | | // bootCommonService.setCache_orderStatus(order.getId(), order, null); |
| | | XpOrder order = this.getById(dto.getOrderId()); |
| | | order.setStatus(9); |
| | | order.setAppUserId(null); |
| | | if (order.getCouponId() != null) { |
| | | UseUserCouponDto useUserCouponDto = new UseUserCouponDto(); |
| | | useUserCouponDto.setUserCouponId(order.getCouponId()); |
| | | R<BigDecimal> decimalR = xpAppUserCouponClient.useUserCoupon(useUserCouponDto); |
| | | if (decimalR.getCode() == 200) { |
| | | order.setCouponMoney(decimalR.getData()); |
| | | if (order.getCouponMoney().compareTo(order.getOrderMoney()) > 0) { |
| | | order.setPayMoney(BigDecimal.ZERO); |
| | | order.setCouponMoney(order.getOrderMoney()); |
| | | } else { |
| | | order.setPayMoney(order.getOrderMoney().subtract(decimalR.getData())); |
| | | } |
| | | } |
| | | } |
| | | baseMapper.updateById(order); |
| | | bootCommonService.setCache_orderStatus(order.getId(), order, null); |
| | | return R.fail(); |
| | | } |
| | | |
| | |
| | | Object cacheObject = redisService.getCacheObject("ORDER_NAVIGATION_END_DATA:" + appUserId); |
| | | RouteVo routeVo1 = JSON.parseObject(cacheObject.toString(), RouteVo.class); |
| | | XpPoint endPoint = xpPointClient.queryById(order.getEndPointId()).getData(); |
| | | LocalDateTime localDateTime = order.getAcceptanceTime().plusMinutes(routeVo.getDuration()).plusMinutes(startPoint.getParkingTimeLimit()) |
| | | .plusMinutes(routeVo1.getDuration()).plusMinutes(endPoint.getParkingTimeLimit()).plusMinutes(30); |
| | | long expirationTime = localDateTime.toEpochSecond(ZoneOffset.of("+8")); |
| | | Integer parkingTimeLimit = startPoint.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != startPoint.getStationId()){ |
| | | XpStation xpStation = xpStationClient.getXpStationById(startPoint.getStationId()).getData(); |
| | | parkingTimeLimit = xpStation.getParkingTimeLimit(); |
| | | } |
| | | |
| | | Integer parkingTimeLimit1 = endPoint.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != endPoint.getStationId()){ |
| | | XpStation xpStation = xpStationClient.getXpStationById(endPoint.getStationId()).getData(); |
| | | parkingTimeLimit1 = xpStation.getParkingTimeLimit(); |
| | | } |
| | | LocalDateTime localDateTime = order.getAcceptanceTime().plusSeconds(routeVo.getDuration()).plusMinutes(parkingTimeLimit) |
| | | .plusSeconds(routeVo1.getDuration()).plusMinutes(parkingTimeLimit1).plusMinutes(30); |
| | | long expirationTime = localDateTime.toEpochSecond(ZoneOffset.of("+8")) * 1000; |
| | | //生成token |
| | | String token = bluetoothUnlockTokenUtil.generateBluetoothUnlockToken(order.getAppUserId(), |
| | | order.getId(), order.getVehicleId(), expirationTime); |
| | |
| | | vo.setVin(vin); |
| | | vo.setPassengerUid(order.getAppUserId()); |
| | | BaseVehicleUserDto deliver = bluetoothUnlockClient.deliver(vo); |
| | | log.info("下发蓝牙token结果:{}", JSON.toJSONString(deliver)); |
| | | if(null == deliver){ |
| | | throw new ServiceException("下发蓝牙token失败"); |
| | | } |
| | | if(deliver.getCode() != 0){ |
| | | if(200 != deliver.getCode()){ |
| | | log.error("下发蓝牙token失败:{} {}", deliver.getMsg(), order.getOrderNumber()); |
| | | throw new ServiceException(deliver.getMsg()); |
| | | } |
| | |
| | | R<XpPoint> xpPointR = xpPointClient.queryById(xpOrder.getStartPointId()); |
| | | if (xpPointR.getCode() == R.SUCCESS) { |
| | | XpPoint startPoint = xpPointR.getData(); |
| | | xpOrderDetailVO.setStartParkingTimeLimit(startPoint.getParkingTimeLimit()); |
| | | Integer parkingTimeLimit = startPoint.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != startPoint.getStationId()){ |
| | | XpStation xpStation = xpStationClient.getXpStationById(startPoint.getStationId()).getData(); |
| | | parkingTimeLimit = xpStation.getParkingTimeLimit(); |
| | | } |
| | | xpOrderDetailVO.setStartParkingTimeLimit(parkingTimeLimit); |
| | | } |
| | | |
| | | R<XpPoint> xpPointR1 = xpPointClient.queryById(xpOrder.getEndPointId()); |
| | | if (xpPointR1.getCode() == R.SUCCESS) { |
| | | XpPoint endPoint = xpPointR1.getData(); |
| | | xpOrderDetailVO.setEndParkingTimeLimit(endPoint.getParkingTimeLimit()); |
| | | Integer parkingTimeLimit = endPoint.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != endPoint.getStationId()){ |
| | | XpStation xpStation = xpStationClient.getXpStationById(endPoint.getStationId()).getData(); |
| | | parkingTimeLimit = xpStation.getParkingTimeLimit(); |
| | | } |
| | | xpOrderDetailVO.setEndParkingTimeLimit(parkingTimeLimit); |
| | | } |
| | | // // 算时间 |
| | | // if (xpOrder.getStatus() == 1) { |
| | |
| | | // 查询起点点位 |
| | | Long startPointId = xpOrder.getStartPointId(); |
| | | XpPoint xpPoint = xpPointClient.queryById(startPointId).getData(); |
| | | Integer parkingTimeLimit = xpPoint.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != xpPoint.getStationId()){ |
| | | XpStation xpStation = xpStationClient.getXpStationById(xpPoint.getStationId()).getData(); |
| | | parkingTimeLimit = xpStation.getParkingTimeLimit(); |
| | | } |
| | | // 添加取消订单定时任务job 时间为点位限停时长 |
| | | Map<String, ? extends Object> cancelJobMaps = |
| | | new ImmutableMap.Builder<String, Long>(). |
| | |
| | | OrderCancelJob.class, |
| | | (OrderCancelJob.name + xpOrder.getId()).toUpperCase(), |
| | | TimeJobType.ORDER_CANCEL, |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(xpPoint.getParkingTimeLimit())), |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(parkingTimeLimit)), |
| | | cancelJobMaps |
| | | ); |
| | | |
| | |
| | | // 添加车辆到达终点后限停时间到后驶离的定时任务 |
| | | //时间到后将车辆状态回滚到空闲、添加巡游订单,解绑用户和车辆关系,车辆驶离点位 |
| | | XpPoint point = xpPointClient.queryById(xpOrder.getEndPointId()).getData(); |
| | | Integer parkingTimeLimit1 = point.getParkingTimeLimit(); |
| | | //如果点位位于场站内,则使用场站的限停时间 |
| | | if(null != point.getStationId()){ |
| | | XpStation xpStation = xpStationClient.getXpStationById(point.getStationId()).getData(); |
| | | parkingTimeLimit1 = xpStation.getParkingTimeLimit(); |
| | | } |
| | | Map<String, ? extends Object> jobMaps = |
| | | new ImmutableMap.Builder<String, String>() |
| | | .put("id", xpOrder.getId().toString()) |
| | |
| | | PushChainReactionOrderJob.class, |
| | | (PushChainReactionOrderJob.name + id).toUpperCase(), |
| | | TimeJobType.ADD_CHAIN_REACTION_ORDER_MISSION, |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(point.getParkingTimeLimit())), |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(parkingTimeLimit1)), |
| | | jobMaps |
| | | ); |
| | | } else { |
| | |
| | | AddCruiseMissionJob.class, |
| | | (AddCruiseMissionJob.name + xpOrder.getId()).toUpperCase(), |
| | | TimeJobType.ADD_CRUISE_MISSION, |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(point.getParkingTimeLimit())), |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(parkingTimeLimit1)), |
| | | jobMaps |
| | | ); |
| | | } |