| | |
| | | try { |
| | | redisService.removeByPattern(order.getQueueName(), order.getOrderNumber()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | //判断还原车辆状态 |
| | | if (null == order.getVehicleId()) { |
| | | Object cacheObject1 = redisService.getCacheObject("CREATE_ORDER:" + order.getId().toString()); |
| | | if (null != cacheObject1) { |
| | | com.alibaba.fastjson2.JSONObject jsonObject = com.alibaba.fastjson2.JSON.parseObject(cacheObject1.toString()); |
| | | JSONObject jsonObject = JSON.parseObject(cacheObject1.toString()); |
| | | String vin = jsonObject.getString("vin"); |
| | | XpVehicle vehicle = xpVehicleClient.findByVehicleVin(vin).getData(); |
| | | if (null != vehicle && 0 != vehicle.getState()) { |
| | |
| | | public void saveVehicleLocation(OrderTrajectory orderTrajectory) { |
| | | // 查询订单信息 |
| | | Integer status = redisService.getCacheObject("ORDER_STATUS:" + orderTrajectory.getOrderId()); |
| | | if(status != 6){ |
| | | if(status < 6){ |
| | | return; |
| | | } |
| | | |
| | |
| | | // 存储mongo数据 |
| | | mongoTemplate.save(orderTrajectory); |
| | | // 存储首次定位 |
| | | redisService.setCacheObject(CacheConstants.ORDER_OLD_LOCATION + orderTrajectory.getOrderId(), orderTrajectory.getLocation()); |
| | | redisService.setCacheObject(CacheConstants.ORDER_OLD_LOCATION + orderTrajectory.getOrderId(), orderTrajectory.getLocation(), 1L, TimeUnit.HOURS); |
| | | } else { |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(orderTrajectory.getLocation(), oldLocation); |
| | | if (null != distance) { |
| | |
| | | // 存储mongo数据 |
| | | mongoTemplate.save(orderTrajectory); |
| | | // 更新定位 |
| | | redisService.setCacheObject(CacheConstants.ORDER_OLD_LOCATION + orderTrajectory.getOrderId(), orderTrajectory.getLocation()); |
| | | redisService.setCacheObject(CacheConstants.ORDER_OLD_LOCATION + orderTrajectory.getOrderId(), orderTrajectory.getLocation(), 1L, TimeUnit.HOURS); |
| | | } else { |
| | | log.error("调用高德计算距离出错"); |
| | | } |