| | |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | log.error("推送消息失败:{}", stringR.getMsg()); |
| | | } |
| | | xpOrderClient.updateOrderStatus(orderId, OrderStatusEnum.PICK_UP.getCode()); |
| | | |
| | | // PushOrderRouteDTO dto3 = new PushOrderRouteDTO(); |
| | | // dto3.setOrderId(orderId); |
| | | // dto3.setRouteType(1); |
| | | // dto3.setLongitude(startLon); |
| | | // dto3.setLatitude(startLat); |
| | | // dto3.setDuration(10); |
| | | // dto3.setDistance(2); |
| | | // dto3.setDirection(60); |
| | | // xpPushMessageClient.pushOrderRoute(dto3); |
| | | |
| | | return r; |
| | | } |
| | | |
| | |
| | | log.error("推送消息失败:{}", stringR.getMsg()); |
| | | } |
| | | xpOrderClient.updateOrderStatus(orderId, status); |
| | | if(5 == status){ |
| | | //主动推一次全程轨迹 |
| | | Object cacheObject = redisService.getCacheObject("ORDER_NAVIGATION_END_DATA:" + xpOrder.getAppUserId()); |
| | | RouteVo routeVo = JSON.parseObject(cacheObject.toString(), RouteVo.class); |
| | | com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject(); |
| | | jsonObject.put("type", "ORDER_ROUTE"); |
| | | jsonObject.put("timestamp", System.currentTimeMillis()); |
| | | com.alibaba.fastjson2.JSONObject content1 = new com.alibaba.fastjson2.JSONObject(); |
| | | content1.put("orderId", orderId.toString()); |
| | | content1.put("routeType", 1); |
| | | com.alibaba.fastjson2.JSONObject route = new com.alibaba.fastjson2.JSONObject(); |
| | | route.put("distance", routeVo.getDistance()); |
| | | route.put("duration", routeVo.getDuration()); |
| | | route.put("routeID", routeVo.getRouteID()); |
| | | |
| | | List<com.alibaba.fastjson2.JSONObject> collect = routeVo.getPolyline().stream().map(item -> { |
| | | com.alibaba.fastjson2.JSONObject point = new com.alibaba.fastjson2.JSONObject(); |
| | | point.put("latitude", item.getLatitude()); |
| | | point.put("longitude", item.getLongitude()); |
| | | return point; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | route.put("polyline", JSON.toJSONString(collect)); |
| | | content1.put("route", route.toJSONString()); |
| | | jsonObject.put("content", content1.toJSONString()); |
| | | SendMessageDTO messageDTO = new SendMessageDTO(); |
| | | messageDTO.setAppUserId(xpOrder.getAppUserId().toString()); |
| | | messageDTO.setMessage(jsonObject.toJSONString()); |
| | | xpPushMessageClient.sendRoute(messageDTO); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | |
| | | //5秒钟循环一次 |
| | | try { |
| | | Thread.sleep(2000); |
| | | Thread.sleep(500); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |