| | |
| | | package com.xiaopeng.map.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.xiaopeng.api.dto.map.HistoryPointDto; |
| | | import com.xiaopeng.api.dto.map.OrderRouteAndFareDto; |
| | | import com.xiaopeng.api.dto.map.RouteAndFareDto; |
| | | import com.xiaopeng.api.dto.operation.LonLatDto; |
| | |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/base/v1/mini-program") |
| | | @RequestMapping("") |
| | | @Api(tags = "地图调用服务") |
| | | public class XpMapController { |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @PostMapping("/map/getDistanceAndDuration") |
| | | @PostMapping("/base/v1/map/getDistanceAndDuration") |
| | | public R<RouteVo> getDistanceAndDuration(@RequestBody RouteAndFareDto dto){ |
| | | // 获取电子围栏的禁行区域点位 |
| | | GeoPoint startPoint = new GeoPoint(dto.getOrigin().getLongitude(),dto.getOrigin().getLatitude()); |
| | |
| | | } |
| | | } |
| | | } |
| | | RouteVo routeVo = gdMapGeocodingUtil.getDistanceAndTime(dto.getOrigin(), dto.getDestination(), String.join("|", pointStrParam), fenceId,dto.getRoutePlanRule()); |
| | | |
| | | List<Object> cacheList = redisService.getCacheList("VEHICLE_HISTORY_POINT_LIST:" + dto.getVin()); |
| | | List<HistoryPointDto> history = new ArrayList<>(); |
| | | if(cacheList!=null && !cacheList.isEmpty()){ |
| | | for (Object cache : cacheList) { |
| | | HistoryPointDto historyPointDto = JSON.parseObject(cache.toString(), HistoryPointDto.class); |
| | | history.add(historyPointDto); |
| | | } |
| | | } |
| | | RouteVo routeVo = gdMapGeocodingUtil.getDistanceAndTime(dto.getOrigin(), dto.getDestination(), String.join("|", pointStrParam), fenceId,dto.getRoutePlanRule(), history); |
| | | if(routeVo==null){ |
| | | return R.fail("没有找到路线"); |
| | | } |
| | |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @PostMapping("/map/getOrderDistanceAndDuration") |
| | | @PostMapping("/base/v1/map/getOrderDistanceAndDuration") |
| | | public R<RouteVo> getOrderDistanceAndDuration(@Validated @RequestBody OrderRouteAndFareDto dto){ |
| | | // 获取电子围栏的禁行区域点位 |
| | | GeoPoint startPoint = new GeoPoint(dto.getOrigin().getLongitude(),dto.getOrigin().getLatitude()); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | RouteVo routeVo = gdMapGeocodingUtil.getDistanceAndTime(dto.getOrigin(), dto.getDestination(), String.join("|", pointStrParam), fenceId,dto.getRoutePlanRule()); |
| | | List<Object> cacheList = redisService.getCacheList("VEHICLE_HISTORY_POINT_LIST:" + dto.getVin()); |
| | | List<HistoryPointDto> history = new ArrayList<>(); |
| | | if(cacheList!=null && !cacheList.isEmpty()){ |
| | | for (Object cache : cacheList) { |
| | | HistoryPointDto historyPointDto = JSON.parseObject(cache.toString(), HistoryPointDto.class); |
| | | history.add(historyPointDto); |
| | | } |
| | | } |
| | | RouteVo routeVo = gdMapGeocodingUtil.getDistanceAndTime(dto.getOrigin(), dto.getDestination(), String.join("|", pointStrParam), fenceId,dto.getRoutePlanRule(), history); |
| | | if(routeVo==null){ |
| | | return R.fail("没有找到路线"); |
| | | } |
| | | |
| | | // 存储redis |
| | | redisService.setCacheObject(CacheConstants.ORDER_ROUTE + "_" + dto.getOrderId() + "_" +dto.getRouteType(), routeVo); |
| | | // 存储路线偏离缓存,后续进行轨迹截取 |
| | | // redisService.setCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +dto.getRouteType(), routeVo); |
| | | |
| | | return R.ok(routeVo); |
| | | } |
| | | |
| | |
| | | * @param routedID |
| | | * @return |
| | | */ |
| | | @PostMapping("/map/queryRouted") |
| | | @PostMapping("/base/v1/map/queryRouted") |
| | | public R<String> getOrderDistanceAndDuration(@RequestParam("routedID") String routedID){ |
| | | return R.ok(gdMapGeocodingUtil.routed(routedID)); |
| | | } |
| | |
| | | * 根据ip获取点位 |
| | | */ |
| | | @ApiOperation(value = "根据ip获取点位", tags = {"小程序-站点导航"}) |
| | | @GetMapping("/point/getPointByIp") |
| | | @GetMapping("/base/v1/mini-program/point/getPointByIp") |
| | | public R<PointByIpVo> getPointByIp(HttpServletRequest request) throws IOException { |
| | | String ip = request.getRemoteAddr(); |
| | | PointByIpVo pointByIpVo = AmapWalkingRouteUtil.ipLocation(ip); |