Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/Robotaxi
| New file |
| | |
| | | package com.xiaopeng.api.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel(value = "查询订单实时轨迹信息入参QueryOrderRouteDTO") |
| | | public class QueryOrderRouteDTO implements Serializable { |
| | | |
| | | @NotNull(message = "订单id不能为空") |
| | | @ApiModelProperty(value = "订单id") |
| | | private Long orderId; |
| | | |
| | | @NotNull(message = "轨迹类型不能为空") |
| | | @ApiModelProperty(value = "轨迹类型 1=接驾轨迹 2=行程轨迹") |
| | | private Integer routeType; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "消息内容") |
| | | private String body; |
| | | |
| | | @ApiModelProperty(value = "推送类型 NOTICE:表示通知。 MESSAGE:表示消息。") |
| | | private String pushType; |
| | | |
| | | } |
| | |
| | | import com.xiaopeng.api.dto.map.OrderRouteAndFareDto; |
| | | import com.xiaopeng.api.dto.map.RouteAndFareDto; |
| | | import com.xiaopeng.api.dto.operation.LonLatDto; |
| | | import com.xiaopeng.api.feignClient.order.XpOrderClient; |
| | | import com.xiaopeng.api.model.order.XpOrder; |
| | | import com.xiaopeng.api.vo.map.PointByIpVo; |
| | | import com.xiaopeng.api.vo.map.XpDistanceAndDurationVo; |
| | | import com.xiaopeng.api.vo.operation.RouteVo; |
| | |
| | | private final GDMapGeocodingUtil gdMapGeocodingUtil; |
| | | private final XpGeoFencingPolygonService xpGeoFencingPolygonService; |
| | | private final RedisService redisService; |
| | | private final XpOrderClient xpOrderClient; |
| | | |
| | | public XpMapController(GDMapGeocodingUtil gdMapGeocodingUtil, XpGeoFencingPolygonService xpGeoFencingPolygonService, RedisService redisService) { |
| | | public XpMapController(GDMapGeocodingUtil gdMapGeocodingUtil, XpGeoFencingPolygonService xpGeoFencingPolygonService, RedisService redisService, XpOrderClient xpOrderClient) { |
| | | this.gdMapGeocodingUtil = gdMapGeocodingUtil; |
| | | this.xpGeoFencingPolygonService = xpGeoFencingPolygonService; |
| | | this.redisService = redisService; |
| | | this.xpOrderClient = xpOrderClient; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | // 避让区域 |
| | | ArrayList<String> pointStrParam = new ArrayList<>(); |
| | | try { |
| | | for (Document document : pointsInFence) { |
| | | List<GeoPoint> points = document.getList("points", GeoPoint.class); |
| | | // 一个区域的点位 |
| | |
| | | } |
| | | |
| | | return R.ok(routeVo); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return R.fail("没有找到路线"); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | // 存储redis |
| | | redisService.setCacheObject(CacheConstants.ORDER_ROUTE + "_" + dto.getOrderId() + "_" +dto.getRouteType(), routeVo); |
| | | |
| | | // 查询订单信息 |
| | | XpOrder xpOrder = xpOrderClient.queryOrderById(dto.getOrderId()).getData(); |
| | | // 封装消息内容 |
| | | Integer routeType = dto.getRouteType(); |
| | | if(routeType == 2){ |
| | | routeType = 3; |
| | | }else { |
| | | routeType = xpOrder.getStatus() == 4 ? 1 : 2; |
| | | } |
| | | // 存储路线偏离缓存,后续进行轨迹截取 |
| | | redisService.setCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +dto.getRouteType(), routeVo); |
| | | redisService.setCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +routeType, routeVo); |
| | | |
| | | return R.ok(routeVo); |
| | | } |
| | |
| | | package com.xiaopeng.operation.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.xiaopeng.api.dto.map.XpPointExportExcelQuery; |
| | | import com.xiaopeng.api.dto.operation.PointAddDto; |
| | |
| | | import com.xiaopeng.operation.service.IXpElectronicFenceAreaService; |
| | | import com.xiaopeng.operation.service.IXpElectronicFenceService; |
| | | import com.xiaopeng.operation.service.XpPointService; |
| | | import com.xiaopeng.operation.vo.SpecialPointListVo; |
| | | import com.xiaopeng.operation.vo.SpecialPointVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | xpPointService.update(new LambdaUpdateWrapper<XpPoint>().in(XpPoint::getId,dto.getParkingPoints()).set(XpPoint::getParkingPoint,2)); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/listSpecialPoint") |
| | | @ApiOperation(value = "获取特殊点位",tags = "后台管理-特殊点位") |
| | | public R<SpecialPointVo> getSpecialPoint() { |
| | | List<XpPoint> chargePoints = xpPointService.list(new LambdaQueryWrapper<XpPoint>().eq(XpPoint::getChargePoint, 1)); |
| | | List<XpPoint> parkingPoints = xpPointService.list(new LambdaQueryWrapper<XpPoint>().eq(XpPoint::getParkingPoint, 1)); |
| | | |
| | | SpecialPointVo specialPointVo = new SpecialPointVo(); |
| | | ArrayList<SpecialPointListVo> chargePointsList = new ArrayList<>(); |
| | | for (XpPoint chargePoint : chargePoints) { |
| | | SpecialPointListVo specialPointListVo = new SpecialPointListVo(); |
| | | specialPointListVo.setPointName(chargePoint.getPointName()); |
| | | specialPointListVo.setPointAddress(chargePoint.getPointAddress()); |
| | | specialPointListVo.setPointId(chargePoint.getId()); |
| | | chargePointsList.add(specialPointListVo); |
| | | } |
| | | specialPointVo.setChargePoints(chargePointsList); |
| | | |
| | | |
| | | ArrayList<SpecialPointListVo> parkingPointsList = new ArrayList<>(); |
| | | for (XpPoint parkingPoint : parkingPoints) { |
| | | SpecialPointListVo specialPointListVo = new SpecialPointListVo(); |
| | | specialPointListVo.setPointName(parkingPoint.getPointName()); |
| | | specialPointListVo.setPointAddress(parkingPoint.getPointAddress()); |
| | | specialPointListVo.setPointId(parkingPoint.getId()); |
| | | parkingPointsList.add(specialPointListVo); |
| | | } |
| | | specialPointVo.setParkingPoints(parkingPointsList); |
| | | |
| | | return R.ok(specialPointVo); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.operation.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class SpecialPointListVo { |
| | | |
| | | private String pointName; |
| | | |
| | | private String pointAddress; |
| | | |
| | | private Long pointId; |
| | | } |
| New file |
| | |
| | | package com.xiaopeng.operation.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel("特殊点位Vo") |
| | | public class SpecialPointVo { |
| | | private List<SpecialPointListVo> chargePoints; |
| | | private List<SpecialPointListVo> parkingPoints; |
| | | } |
| | |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.xiaopeng.api.dto.QueryOrderRouteDTO; |
| | | import com.xiaopeng.api.dto.order.GetOrderNumDto; |
| | | import com.xiaopeng.api.dto.order.PopOrderDto; |
| | | import com.xiaopeng.api.dto.statistics.OrderStatisticsDTO; |
| | | import com.xiaopeng.api.dto.statistics.StatisticsQueryDTO; |
| | | import com.xiaopeng.api.model.order.XpOrder; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; |
| | | import com.xiaopeng.api.vo.operation.RouteVo; |
| | | import com.xiaopeng.api.vo.order.FareBreakdownVo; |
| | | import com.xiaopeng.api.vo.order.XpHistoryEndPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpHistoryStartPointsVo; |
| | | import com.xiaopeng.api.vo.order.XpPointInfoVo; |
| | | import com.xiaopeng.common.core.constant.CacheConstants; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.utils.WebUtils; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.redis.service.RedisService; |
| | | import com.xiaopeng.order.mangodb.model.OrderTrajectory; |
| | | import com.xiaopeng.order.model.dto.XpOrderCommentDto; |
| | | import com.xiaopeng.order.model.dto.XpOrderPayDto; |
| | |
| | | public class XpOrderController { |
| | | |
| | | private final IXpOrderService xpOrderService; |
| | | private final RedisService redisService; |
| | | |
| | | /** |
| | | * 获取订单统计数据(内部接口) |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 订单查询实时轨迹路线 |
| | | */ |
| | | @ApiOperation(value = "订单查询实时轨迹路线") |
| | | @PostMapping("/api/v1/order/queryOrderRoute") |
| | | public R<RouteVo> queryOrderRoute(@Validated @RequestBody QueryOrderRouteDTO dto) { |
| | | // 查询订单信息 |
| | | XpOrder xpOrder = xpOrderService.getById(dto.getOrderId()); |
| | | // 封装消息内容 |
| | | Integer routeType = dto.getRouteType(); |
| | | if(routeType == 2){ |
| | | routeType = 3; |
| | | }else { |
| | | routeType = xpOrder.getStatus() == 4 ? 1 : 2; |
| | | } |
| | | // 获取路线规划 |
| | | RouteVo routeVo = redisService.getCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +routeType); |
| | | return R.ok(routeVo); |
| | | } |
| | | |
| | | } |
| | |
| | | @ApiModelProperty("订单金额") |
| | | private Double amount; |
| | | |
| | | private String timeStr; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private LocalDateTime time; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | xpOrderHistoryVO.setTotal((int) page.getTotal()); |
| | | |
| | | // 根据time分组 |
| | | Map<String, List<XpOrderHistoryListVO>> map = list.stream().collect(Collectors.groupingBy(XpOrderHistoryListVO::getOrderTime)); |
| | | Map<String, List<XpOrderHistoryListVO>> map = list.stream().collect(Collectors.groupingBy(XpOrderHistoryListVO::getTimeStr)); |
| | | List<XpOrderHistoryDateVO> dateVOS = map.entrySet().stream().map(entry -> { |
| | | XpOrderHistoryDateVO xpOrderHistoryDateVO = new XpOrderHistoryDateVO(); |
| | | xpOrderHistoryDateVO.setDateLabel(entry.getKey()); |
| | |
| | | JSONArray startingFareJsonArray = JSONArray.parseArray(pricing.getStartingFareJson()); |
| | | if(pricing.getPricingType()==1){ |
| | | JSONObject basicPricingJson = JSONObject.parseObject(pricing.getBasicPricingJson()); |
| | | config.peaks.add(new TaxiPricingDemoService.PricingRule("高峰期", basicPricingJson.getString("num21").split("-")[0], basicPricingJson.getString("num21").split("-")[1], Double.parseDouble(basicPricingJson.getString("num24")), Double.parseDouble(basicPricingJson.getString("num25")), Double.parseDouble(basicPricingJson.getString("num26")), Double.parseDouble(basicPricingJson.getString("num27")), Double.parseDouble(basicPricingJson.getString("num28")))); |
| | | config.peaks.add(new TaxiPricingDemoService.PricingRule("高峰期", basicPricingJson.getString("num22").split("-")[0], basicPricingJson.getString("num22").split("-")[1], Double.parseDouble(basicPricingJson.getString("num24")), Double.parseDouble(basicPricingJson.getString("num25")), Double.parseDouble(basicPricingJson.getString("num26")), Double.parseDouble(basicPricingJson.getString("num27")), Double.parseDouble(basicPricingJson.getString("num28")))); |
| | | config.peaks.add(new TaxiPricingDemoService.PricingRule("高峰期", basicPricingJson.getString("num21"), basicPricingJson.getString("num21").split("-")[1], Double.parseDouble(basicPricingJson.getString("num24")), Double.parseDouble(basicPricingJson.getString("num25")), Double.parseDouble(basicPricingJson.getString("num26")), Double.parseDouble(basicPricingJson.getString("num27")), Double.parseDouble(basicPricingJson.getString("num28")))); |
| | | config.peaks.add(new TaxiPricingDemoService.PricingRule("高峰期", basicPricingJson.getString("num22"), basicPricingJson.getString("num22").split("-")[1], Double.parseDouble(basicPricingJson.getString("num24")), Double.parseDouble(basicPricingJson.getString("num25")), Double.parseDouble(basicPricingJson.getString("num26")), Double.parseDouble(basicPricingJson.getString("num27")), Double.parseDouble(basicPricingJson.getString("num28")))); |
| | | config.night = new TaxiPricingDemoService.PricingRule("夜间行驶", basicPricingJson.getString("num14").split("-")[0], basicPricingJson.getString("num14").split("-")[1], Double.parseDouble(basicPricingJson.getString("num16")), Double.parseDouble(basicPricingJson.getString("num17")), Double.parseDouble(basicPricingJson.getString("num18")), Double.parseDouble(basicPricingJson.getString("num19")), Double.parseDouble(basicPricingJson.getString("num20"))); |
| | | config.holiday = new TaxiPricingDemoService.PricingRule("节假日", "00:00", "23:59", Double.parseDouble(basicPricingJson.getString("num30")), Double.parseDouble(basicPricingJson.getString("num31")), Double.parseDouble(basicPricingJson.getString("num32")), Double.parseDouble(basicPricingJson.getString("num33")), Double.parseDouble(basicPricingJson.getString("num234"))); |
| | | // --- 远途加价区间配置 (关键修改) --- |
| | |
| | | </select> |
| | | <select id="getHistoryOrderList" resultType="com.xiaopeng.order.model.vo.XpOrderHistoryListVO"> |
| | | select start_point_name as originAddress, end_point_name as destinationAddress, |
| | | DATE_FORMAT(create_time, '%H:%i') AS orderTime, pay_money as amount,create_time as time, |
| | | DATE_FORMAT(create_time, '%H:%i') AS orderTime, pay_money as amount,create_time as time,DATE_FORMAT(create_time,'%Y-%m-%d') AS timeStr, |
| | | id as orderId from xp_order where app_user_id = #{uid} and is_deleted = 0 and status in (9,10) |
| | | <if test="query.status != null"> |
| | | and status = #{query.status} |
| | |
| | | public class AliPushController { |
| | | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | @Autowired |
| | | private AliPushUtil aliPushUtil; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/base/v1/aliPush/test") |
| | | public R<String> test() throws Exception { |
| | | String s = aliPushUtil.pushMessage(1, "13540694412", "测试", "{\"content\":\"测试消息\",\"strategy\":1\"type\":1,\"id\":1}"); |
| | | public R<String> test(){ |
| | | String s = aliPushUtil.pushMessage(1, "13540694412", "测试", "{\"content\":\"测试消息\",\"strategy\":1\"type\":1,\"id\":1}","NOTICE"); |
| | | return R.ok(s); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/inner/v1/aliPush/pushMessage") |
| | | public R<String> pushMessage(@RequestBody AliPushMessageDTO dto) { |
| | | String result = aliPushUtil.pushMessage(dto.getDeviceType(), dto.getAccount(), dto.getTitle(), dto.getBody()); |
| | | String result = aliPushUtil.pushMessage(dto.getDeviceType(), dto.getAccount(), dto.getTitle(), dto.getBody(),dto.getPushType()); |
| | | return R.ok(result); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/inner/v1/order/pushOrderRoute") |
| | | public R<String> pushOrderRoute(@Validated @RequestBody PushOrderRouteDTO dto) { |
| | | |
| | | // 获取路线规划 |
| | | RouteVo routeVo = redisService.getCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +dto.getRouteType()); |
| | | |
| | | if(Objects.nonNull(routeVo)){ |
| | | |
| | | // 查询订单信息 |
| | | XpOrder xpOrder = xpOrderClient.queryOrderById(dto.getOrderId()).getData(); |
| | | // 封装消息内容 |
| | | Integer routeType = dto.getRouteType(); |
| | | if(routeType == 2){ |
| | | routeType = 3; |
| | | }else { |
| | | routeType = xpOrder.getStatus() == 4 ? 1 : 2; |
| | | } |
| | | // 获取路线规划 |
| | | RouteVo routeVo = redisService.getCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +routeType); |
| | | |
| | | if(Objects.nonNull(routeVo)){ |
| | | |
| | | // 计算实时点位到线段的最优截取 |
| | | List<LonLatDto> lonLatDtos = MapMatchingUtil.clipBySegmentDistance(routeVo.getPolyline(), new LonLatDto(dto.getLongitude(), dto.getLatitude())); |
| | |
| | | routeVo.setPolyline(lonLatDtos); |
| | | |
| | | // 存储最新路线偏离缓存,后续进行轨迹截取 |
| | | redisService.setCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +dto.getRouteType(), routeVo); |
| | | redisService.setCacheObject(CacheConstants.ORDER_ROUTE_CAPTURE + "_" + dto.getOrderId() + "_" +routeType, routeVo); |
| | | |
| | | // 封装轨迹点位集合 |
| | | Map<String, Object> polyline = new HashMap<>(); |
| | |
| | | route.put("duration",dto.getDuration()); |
| | | route.put("polyline",JSONObject.toJSONString(polyline)); |
| | | |
| | | // 封装消息内容 |
| | | Integer routeType = dto.getRouteType(); |
| | | if(routeType == 2){ |
| | | routeType = 3; |
| | | }else { |
| | | routeType = xpOrder.getStatus() == 4 ? 1 : 2; |
| | | } |
| | | Map<String, Object> content = new HashMap<>(); |
| | | content.put("orderId",dto.getOrderId()); |
| | | content.put("routeType",routeType); |
| | |
| | | @Value("${ali.push.iosChannelId}") |
| | | private String iosChannelId; |
| | | /** |
| | | * 消息类型 MESSAGE 消息 NOTICE 通知 |
| | | */ |
| | | private final String PUSH_TYPE = "MESSAGE"; |
| | | /** |
| | | * 设备类型 ALL 全部 HARMONY 鸿蒙 IOS ios设备 ANDROID 安卓设备 |
| | | */ |
| | | private final String DEVICE_TYPE_ALL = "ALL"; |
| | |
| | | * @param account 运维手机号 |
| | | * @param title 标题 |
| | | * @param body 消息内容 |
| | | * @param pushType NOTICE:表示通知。 MESSAGE:表示消息。 |
| | | * @throws Exception |
| | | */ |
| | | public String pushMessage(Integer deviceType,String account, String title, String body){ |
| | | public String pushMessage(Integer deviceType,String account, String title, String body,String pushType){ |
| | | |
| | | try { |
| | | StaticCredentialProvider credentialProvider = StaticCredentialProvider.create( |
| | |
| | | |
| | | PushRequest pushRequest = PushRequest.builder() |
| | | .appKey(appKeys) |
| | | .pushType(PUSH_TYPE) |
| | | .pushType(pushType) |
| | | .deviceType(DEVICE_TYPE_ALL) |
| | | .target(TARGET) |
| | | .targetValue(account) |
| | | .title(title) |
| | | .body(body) |
| | | .androidExtParameters(body) |
| | | .androidNotificationChannel(channelIds) |
| | | .build(); |
| | | if(deviceType == 2){ |
| | | pushRequest = PushRequest.builder() |
| | | .appKey(appKeys) |
| | | .pushType(pushType) |
| | | .deviceType(DEVICE_TYPE_ALL) |
| | | .target(TARGET) |
| | | .targetValue(account) |
| | | .title(title) |
| | | .body(body) |
| | | .iOSExtParameters(body) |
| | | .androidNotificationChannel(channelIds) |
| | | .build(); |
| | | } |
| | | CompletableFuture<PushResponse> response = client.push(pushRequest); |
| | | PushResponse resp = response.get(); |
| | | String json = new Gson().toJson(resp); |
| | |
| | | |
| | | // ========== 车辆开关车门 ========== |
| | | String VEHICLE_NOT_P_GEAR = "vehicle.not.p.gear"; |
| | | |
| | | |
| | | // ========== 车辆温度控制 ========== |
| | | String VEHICLE_TEMPERATURE_UP = "vehicle.temperature.up"; |
| | | |
| | | String VEHICLE_TEMPERATURE_DOWN = "vehicle.temperature.down"; |
| | | |
| | | } |
| | |
| | | if(Objects.isNull(xpVehicle)){ |
| | | throw new ServiceException("未查询到有效车辆信息", I18nKeyConstant.VEHICLE_NOT_EXISTS); |
| | | } |
| | | if(dto.getTargetTemperature() > 28){ |
| | | throw new ServiceException("温度最高28℃", I18nKeyConstant.VEHICLE_TEMPERATURE_UP); |
| | | } |
| | | if(dto.getTargetTemperature() < 22){ |
| | | throw new ServiceException("温度最低22℃", I18nKeyConstant.VEHICLE_TEMPERATURE_DOWN); |
| | | } |
| | | // 设定温度 |
| | | VehiclesCommandVo vehiclesCommandVo = new VehiclesCommandVo(); |
| | | vehiclesCommandVo.setUid(xpOrder.getAppUserId()); |
| | |
| | | vehicle.batch.operation.condition.not.met=The following vehicles do not meet operating conditions: {0} |
| | | vehicle.time.expired=The following dates have expired, please enter valid dates: {0} |
| | | vehicle.not.p.gear=The trunk cannot be opened when the vehicle is not in P gear |
| | | vehicle.temperature.up=The highest temperature is 28°C |
| | | vehicle.temperature.down=The lowest temperature is 22°C |
| | |
| | | vehicle.batch.operation.condition.not.met=以下车辆不满足运营条件:{0} |
| | | vehicle.time.expired=以下时间已过期,请填写有效日期:{0} |
| | | vehicle.not.p.gear=车辆非P档,无法开启后备箱 |
| | | vehicle.temperature.up=温度最高28℃ |
| | | vehicle.temperature.down=温度最低22℃ |