| | |
| | | @RequiredArgsConstructor(onConstructor_ = @Lazy) |
| | | public class XpOrderServiceImpl extends ServiceImpl<XpOrderMapper, XpOrder> implements IXpOrderService { |
| | | |
| | | private static final String REASSIGN_CANCEL_CONTEXT_PREFIX = "REASSIGN_CANCEL_CONTEXT:"; |
| | | private static final long REASSIGN_CANCEL_CONTEXT_TTL_MINUTES = 5L; |
| | | |
| | | private final UserResourcesClient userResourcesClient; |
| | | private final XpPointClient xpPointClient; |
| | | private final XpVehicleClient xpVehicleClient; |
| | |
| | | vo.setEndAddress(order.getEndAddress()); |
| | | vo.setOrderMoney(order.getOrderMoney()); |
| | | vo.setStatus(order.getStatus()); |
| | | vo.setStartPointName(order.getStartPointName()); |
| | | vo.setEndPointName(order.getEndPointName()); |
| | | |
| | | // 用户信息 |
| | | if (Objects.nonNull(order.getAppUserId()) && userInfoMap != null && userInfoMap.containsKey(order.getAppUserId().toString())) { |
| | |
| | | cancelDto.setOperation_type(OrderOperationType.CLOUD_CANCEL_ORDER); |
| | | cancelDto.setCancelScene(CancelOrderSceneEnum.REASSIGN_OLD_VEHICLE.getCode()); |
| | | orderMissionClient.cancelOrder(cancelDto); |
| | | cacheReassignCancelContext(orderId, oldVehicleId, newVehicleId, |
| | | oldVehicle.getVehicleVin(), currentStatus); |
| | | log.info("已取消原车辆订单指令,订单ID: {}, VIN: {}, taskId: {}, cancelScene: {}", |
| | | orderId, oldVehicle.getVehicleVin(), cancelDto.getTaskId(), cancelDto.getCancelScene()); |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | private void cacheReassignCancelContext(Long orderId, Long oldVehicleId, Long newVehicleId, |
| | | String oldVehicleVin, Integer preReassignStatus) { |
| | | JSONObject context = new JSONObject(); |
| | | context.put("orderId", orderId); |
| | | context.put("oldVehicleId", oldVehicleId); |
| | | context.put("newVehicleId", newVehicleId); |
| | | context.put("oldVehicleVin", oldVehicleVin); |
| | | context.put("cancelScene", CancelOrderSceneEnum.REASSIGN_OLD_VEHICLE.getCode()); |
| | | context.put("operationTime", System.currentTimeMillis()); |
| | | context.put("preReassignStatus", preReassignStatus); |
| | | redisService.setCacheObject(REASSIGN_CANCEL_CONTEXT_PREFIX + orderId, context.toJSONString(), |
| | | REASSIGN_CANCEL_CONTEXT_TTL_MINUTES, TimeUnit.MINUTES); |
| | | log.info("记录改派取消上下文成功,orderId: {}, oldVehicleId: {}, newVehicleId: {}, preReassignStatus: {}", |
| | | orderId, oldVehicleId, newVehicleId, preReassignStatus); |
| | | } |
| | | |
| | | /** |
| | | * 为原车辆创建返程巡游订单 |
| | | * <p> |