| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.xiaopeng.api.dto.QueryOrderRouteDTO; |
| | |
| | | import com.xiaopeng.api.dto.statistics.OrderStatisticsDTO; |
| | | import com.xiaopeng.api.dto.statistics.StatisticsQueryDTO; |
| | | import com.xiaopeng.api.dto.vehicleConvoy.BaseVehicleUserDto; |
| | | import com.xiaopeng.api.dto.vehicleConvoy.BleInfoResponseDto; |
| | | import com.xiaopeng.api.feignClient.account.SysGroupMenuClient; |
| | | import com.xiaopeng.api.feignClient.operation.XpSystemSettingClient; |
| | | import com.xiaopeng.api.feignClient.operation.XpWhiteListClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.BluetoothUnlockClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.VehicleMacClient; |
| | | import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; |
| | | import com.xiaopeng.api.model.operation.XpOfficialPartner; |
| | |
| | | import com.xiaopeng.api.model.order.XpOrder; |
| | | import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.api.vo.automaticPilot.VehiclePosition; |
| | | import com.xiaopeng.api.vo.operation.NavigationVo; |
| | | import com.xiaopeng.api.vo.operation.NearestNextVo; |
| | | import com.xiaopeng.api.vo.operation.RouteVo; |
| | |
| | | import com.xiaopeng.order.config.BluetoothDebugConfig; |
| | | import com.xiaopeng.order.dto.OrderNavigationDto; |
| | | import com.xiaopeng.api.model.order.OrderTrajectory; |
| | | import com.xiaopeng.order.mangodb.service.OrderTrajectoryService; |
| | | import com.xiaopeng.order.model.dto.XpOrderCommentDto; |
| | | import com.xiaopeng.order.model.dto.XpOrderOperateDTO; |
| | | import com.xiaopeng.order.model.dto.XpOrderPayDto; |
| | |
| | | */ |
| | | @RestController |
| | | @Api(tags = "订单") |
| | | @RequiredArgsConstructor |
| | | @RequiredArgsConstructor(onConstructor_ = @Lazy) |
| | | public class XpOrderController { |
| | | |
| | | private final IXpOrderService xpOrderService; |
| | |
| | | @Resource |
| | | @Lazy |
| | | private BootCommonService bootCommonService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | routeVo.setPolyline(polyline); |
| | | XpOrder xpOrder = xpOrderService.getById(orderId); |
| | | XpVehicle xpVehicle = xpVehicleClient.queryById(xpOrder.getVehicleId()).getData(); |
| | | VehiclePosition vehiclePosition = mongoTemplate.findOne(new Query(Criteria.where("vin").is(xpVehicle.getVehicleVin())), VehiclePosition.class); |
| | | routeVo.setDirection(null != vehiclePosition ? vehiclePosition.getCourse() : 0); |
| | | return R.ok(routeVo); |
| | | } |
| | | |
| | |
| | | * @param |
| | | * @return 订单数量 |
| | | */ |
| | | @PostMapping("/inner/order/todayCancellationCount") |
| | | public R<Integer> todayCancellationCount(@RequestParam Long userId) { |
| | | @PostMapping("/logan/inner/order/todayCancellationCount") |
| | | public R<Integer> todayCancellationCount(@RequestParam Long userId){ |
| | | long count = xpOrderService.count(new QueryWrapper<XpOrder>().eq("app_user_id", userId).eq("status", 0) |
| | | .eq("is_deleted", 0).last(" and DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')")); |
| | | return R.ok((int) count); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建巡游单和推送车端报文 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @PostMapping("/logan/inner/order/addNewCruiseMission") |
| | | public R<?> addNewCruiseMission(@RequestParam("orderId") String orderId){ |
| | | XpOrder xpOrder = xpOrderService.getById(orderId); |
| | | xpOrderService.addCruiseMission(xpOrder.getVehicleId(), xpOrder); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "通过订单id获取蓝牙开锁秘钥", tags = {"小程序-业务流程"}) |
| | | @GetMapping("/api/v1/mini-program/bluetooth/getUnlocktToken/{orderId}") |
| | |
| | | XpVehicle xpVehicle = xpVehicleClient.queryById(xpOrder.getVehicleId()).getData(); |
| | | GetBleInfoVo getBleInfoVo = new GetBleInfoVo(); |
| | | getBleInfoVo.setVin(xpVehicle.getVehicleVin()); |
| | | BaseVehicleUserDto baseVehicleUserDto = vehicleMacClient.getBleInfo(uid, getBleInfoVo); |
| | | if(null == baseVehicleUserDto || 200 != baseVehicleUserDto.getCode()){ |
| | | BleInfoResponseDto bleInfoResponseDto = vehicleMacClient.getBleInfo(uid, getBleInfoVo); |
| | | if (null == bleInfoResponseDto || 200 != bleInfoResponseDto.getCode()) { |
| | | throw new ServiceException("获取蓝牙信息失败"); |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(baseVehicleUserDto.getData().toString()); |
| | | BluetoothTokenVo vo = new BluetoothTokenVo(); |
| | | vo.setToken(token); |
| | | vo.setMacAddress(jsonObject.getString("macAddress")); |
| | | vo.setSlaveMacList(jsonObject.getList("slaveMacList", String.class)); |
| | | vo.setMacAddress(bleInfoResponseDto.getData().getMacAddress()); |
| | | vo.setSlaveMacList(bleInfoResponseDto.getData().getSlaveMacList().stream() |
| | | .map(s -> s.getMac()).collect(java.util.stream.Collectors.toList())); |
| | | return R.ok(vo); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @GetMapping("/test/bluetooth/getBleInfo") |
| | | @ApiOperation(value = "[测试] 直接调用蓝牙信息接口验证DTO解析", notes = "仅用于本地联调验证,生产环境请勿使用") |
| | | public R<BleInfoResponseDto> testGetBleInfo(@RequestParam String uid, @RequestParam String vin) { |
| | | GetBleInfoVo vo = new GetBleInfoVo(); |
| | | vo.setVin(vin); |
| | | BleInfoResponseDto result = vehicleMacClient.getBleInfo(uid, vo); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private BluetoothUnlockClient bluetoothUnlockClient; |
| | | |
| | | @PostMapping("/test/bluetooth/deliver") |
| | | @ApiOperation(value = "[测试] 直接调用蓝牙token下发接口验证响应", notes = "仅用于本地联调验证,生产环境请勿使用") |
| | | public R<BaseVehicleUserDto> testDeliver(@RequestBody com.xiaopeng.api.vo.vehicleConvoy.BluetoothDeliverVo vo) { |
| | | BaseVehicleUserDto result = bluetoothUnlockClient.deliver(vo); |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @PostMapping("/drainage/v1/order/getOrderInfo") |
| | | @ApiOperation(value = "获取订单详情", notes = "流量接入-订单信息") |
| | | @ApiImplicitParams({ |