| | |
| | | import com.xiaopeng.common.core.enums.PushMessageTypeEnum; |
| | | import com.xiaopeng.common.redis.service.RedisService; |
| | | import com.xiaopeng.pushMessage.utils.MapMatchingUtil; |
| | | import com.xiaopeng.pushMessage.utils.TrackPoint; |
| | | import com.xiaopeng.pushMessage.utils.TrajectoryDensifier; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.Instant; |
| | | import java.util.*; |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | |
| | | Integer routeType = dto.getRouteType(); |
| | | //正常订单 |
| | | if(routeType == 1){ |
| | | //非导航偏离才需要限频 |
| | | if(PushMessageTypeEnum.ORDER_ROUTE.getDesc().equals(dto.getMessageType())){ |
| | | Long pushTime = redisService.getCacheObject("PUSH_TIME:" + dto.getOrderId()); |
| | | if(null != pushTime && System.currentTimeMillis() - pushTime < 1500){ |
| | | return R.ok(); |
| | | } |
| | | redisService.setCacheObject("PUSH_TIME:" + dto.getOrderId(), System.currentTimeMillis()); |
| | | } |
| | | XpOrder xpOrder = xpOrderClient.queryOrderById(dto.getOrderId()).getData(); |
| | | if(xpOrder.getStatus() <= 1 || xpOrder.getStatus() >= 8){ |
| | | return R.ok(); |
| | |
| | | // 获取路线规划 |
| | | String key = ""; |
| | | //接驾情况,获取车辆位置到起点的导航 |
| | | if(xpOrder.getStatus() == 2 || xpOrder.getStatus() == 3){ |
| | | if(xpOrder.getStatus() >= 2 && xpOrder.getStatus() <= 4){ |
| | | key = "ORDER_NAVIGATION_START_DATA:" + xpOrder.getAppUserId(); |
| | | }else{ |
| | | key = "ORDER_NAVIGATION_END_DATA:" + xpOrder.getAppUserId(); |
| | |
| | | |
| | | // 封装轨迹信息 |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("type", PushMessageTypeEnum.ORDER_ROUTE.getDesc()); |
| | | params.put("type", dto.getMessageType()); |
| | | params.put("content", JSONObject.toJSONString(content)); |
| | | params.put("timestamp", new Date().getTime()+""); |
| | | |