| | |
| | | }); |
| | | } |
| | | |
| | | //给XPU推送订单取消的报文 |
| | | // PushOrderDto pushOrderDto = new PushOrderDto(); |
| | | // pushOrderDto.setOrderId(order.getId().toString()); |
| | | // pushOrderDto.setVin(xpVehicle.getVehicleVin()); |
| | | // pushOrderDto.setOperation_type(OrderOperationType.CLOUD_CANCEL_ORDER); |
| | | // orderMissionClient.cancelOrder(pushOrderDto); |
| | | |
| | | //结束行程,修改状态和计算费用 |
| | | endTrip(order.getId(), appUserId.toString()); |
| | | |
| | |
| | | Long userId = Long.valueOf(uid); |
| | | // - 新用户处理: 历史订单数 < 3单或无匹配数据时,隐藏该胶囊。 |
| | | Long validHistoryCount = this.baseMapper.countUserValidHistoryOrders(userId); |
| | | if (validHistoryCount == null || validHistoryCount < 3) return null; |
| | | if (validHistoryCount == null || validHistoryCount < 3) { |
| | | return null; |
| | | } |
| | | |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalTime startMoment = now.minusHours(1).toLocalTime(); |
| | |
| | | endPointId.addAll(this.baseMapper.frequencyOrders(startDate, endDate, startMoment, endMoment, userId)); |
| | | |
| | | Integer minOrderDistance = getMinOrderDistanceSafely(uid, startPointId); |
| | | if (minOrderDistance == null) return null;//获取用户最短可发单距离失败 |
| | | //获取用户最短可发单距离失败 |
| | | if (minOrderDistance == null) { |
| | | return null; |
| | | } |
| | | XpPoint start = getPointById(startPointId); |
| | | GlobalCoordinates startCoordinates = new GlobalCoordinates(start.getPointLon(), start.getPointLat()); |
| | | List<Long> pointIdsByUserId = Optional.ofNullable(xpAppUserCollectAddrClient.getPointIdsByUserId(Long.valueOf(uid)).getData()) |
| | |
| | | if (order.getStatus() == 0) { |
| | | return; |
| | | } |
| | | if (!order.getAppUserId().toString().equals(uid)) { |
| | | if (!order.getAppUserId().equals(Long.valueOf(uid))) { |
| | | throw new ServiceException("订单不存在", I18nKeyConstant.ORDER_NOT_EXISTS); |
| | | } |
| | | if (order.getStatus() > 5 || order.getStatus() < 1) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<String> updateOrderStatus(Long orderId, Integer status, Boolean orderException) { |
| | | public R<String> updateOrderStatus(Long orderId, Integer status) { |
| | | XpOrder xpOrder = this.getById(orderId); |
| | | if (Objects.isNull(xpOrder)) { |
| | | return R.fail("订单不存在"); |
| | |
| | | if (StringUtils.isNotEmpty(json)) { |
| | | JSONObject jsonObject = JSON.parseObject(json); |
| | | Long id = jsonObject.getLong("orderId"); |
| | | jobMaps = new ImmutableMap.Builder<String, String>() |
| | | .put("id", id.toString()) |
| | | .put("oldOrderId", xpOrder.getId().toString()) |
| | | .put("appid", appid) |
| | | .put("orderType", OrderType.USER_ORDER) |
| | | .build(); |
| | | //判断订单状态 |
| | | XpOrder xpOrder1 = this.getById(id); |
| | | if(2 == xpOrder1.getStatus()){ |
| | | jobMaps = new ImmutableMap.Builder<String, String>() |
| | | .put("id", id.toString()) |
| | | .put("oldOrderId", xpOrder.getId().toString()) |
| | | .put("appid", appid) |
| | | .put("orderType", OrderType.USER_ORDER) |
| | | .build(); |
| | | |
| | | QuartzManager.addJob( |
| | | PushChainReactionOrderJob.class, |
| | | (PushChainReactionOrderJob.name + id).toUpperCase(), |
| | | TimeJobType.ADD_CHAIN_REACTION_ORDER_MISSION, |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(point.getParkingTimeLimit())), |
| | | jobMaps |
| | | ); |
| | | QuartzManager.addJob( |
| | | PushChainReactionOrderJob.class, |
| | | (PushChainReactionOrderJob.name + id).toUpperCase(), |
| | | TimeJobType.ADD_CHAIN_REACTION_ORDER_MISSION, |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(point.getParkingTimeLimit())), |
| | | jobMaps |
| | | ); |
| | | } |
| | | //连环派订单取消的情况,继续走巡游 |
| | | if(0 == xpOrder1.getStatus()){ |
| | | QuartzManager.addJob( |
| | | AddCruiseMissionJob.class, |
| | | (AddCruiseMissionJob.name + xpOrder.getId()).toUpperCase(), |
| | | TimeJobType.ADD_CRUISE_MISSION, |
| | | DateUtils.localDateTimeToDate(LocalDateTime.now().plusMinutes(point.getParkingTimeLimit())), |
| | | jobMaps |
| | | ); |
| | | } |
| | | } else { |
| | | QuartzManager.addJob( |
| | | AddCruiseMissionJob.class, |
| | |
| | | baseMapper.updateById(order); |
| | | |
| | | } |
| | | |
| | | |
| | | if (order.getCouponId() != null) { |
| | | // UseUserCouponDto useUserCouponDto = new UseUserCouponDto(); |
| | | // useUserCouponDto.setUserId(Long.valueOf(uid)); |
| | |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | log.info("推送订单状态消息失败:{} {} {}", stringR1.getMsg(), JSON.toJSONString(dto), order.getOrderNumber()); |
| | | log.info("推送订单状态消息失败:{} {} {}", stringR1.getMsg(), JSON.toJSONString(dto1), order.getOrderNumber()); |
| | | } |
| | | }); |
| | | } |
| | | // redisService.setCacheObject("ORDER_STATUS:" + order.getId(), 2, 24L, TimeUnit.HOURS);//没看懂为啥重复 缓存 |
| | | redisService.setCacheObject("ORDER_STATUS:" + order.getId(), 2, 24L, TimeUnit.HOURS); |
| | | addTaxiPassengerVo.setOrderNo(order.getOrderNumber()); |
| | | addTaxiPassengerVo.setAppId(appid); |
| | | userVehicleClient.addTaxiPassenger(addTaxiPassengerVo); |