From 0ff37036040dbb8a030333629f57879c6956773f Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期日, 03 十一月 2024 14:05:16 +0800 Subject: [PATCH] 合并代码 --- ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java | 6 ++++++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java | 27 +++++++++++++++++++++++++++ ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java | 11 +++++++++++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 16 ++++++++++++++++ 4 files changed, 60 insertions(+), 0 deletions(-) diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java index a6ff664..d838d05 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java @@ -163,6 +163,12 @@ public R<List<TChargingOrder>> getChargingOrder(TChargingOrderVo order) { return R.fail("获取充电订单数据失败:" + throwable.getMessage()); } + + + @Override + public R<List<TChargingOrder>> getCarChargingOrder(Long carId, String startTime, String endTime) { + return R.fail("根据车辆id获取指定时间范围内的数据失败:" + throwable.getMessage()); + } }; } } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java index f0a9528..33352e4 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java @@ -214,4 +214,15 @@ */ @PostMapping("/t-charging-order/getChargingOrder") R<List<TChargingOrder>> getChargingOrder(@RequestBody TChargingOrderVo order); + + + /** + * 根据车辆id获取指定时间范围内的数据 + * @param carId + * @param startTime + * @param endTime + * @return + */ + @PostMapping("/t-charging-order/getCarChargingOrder") + R<List<TChargingOrder>> getCarChargingOrder(@RequestParam("carId") Long carId, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime); } diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java index e5e32fb..6628553 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/barrierGate/server/ParkingOrderService.java @@ -1,6 +1,7 @@ package com.ruoyi.integration.barrierGate.server; import com.ruoyi.account.api.feignClient.AppUserCarClient; +import com.ruoyi.account.api.model.TAppUserCar; import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; import com.ruoyi.chargingPile.api.feignClient.ParkingRecordClient; import com.ruoyi.chargingPile.api.model.TParkingLot; @@ -10,6 +11,8 @@ import com.ruoyi.integration.barrierGate.model.CloudParkingSpace; import com.ruoyi.integration.barrierGate.model.OfflineParkingOrder; import com.ruoyi.integration.barrierGate.model.OfflineParkingSpace; +import com.ruoyi.order.api.feignClient.ChargingOrderClient; +import com.ruoyi.order.api.model.TChargingOrder; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -18,6 +21,7 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Date; +import java.util.List; /** * @author zhibing.pu @@ -34,6 +38,9 @@ @Resource private ParkingLotClient parkingLotClient; + + @Resource + private ChargingOrderClient chargingOrderClient; @@ -83,6 +90,16 @@ parkingRecord.setStatus(BigDecimal.ZERO.compareTo(payment) == 0 ? 2 : 3); parkingRecord.setOutParkingType(BigDecimal.ZERO.compareTo(payment) == 0 ? 2 : 1); parkingRecord.setTitle("【停车缴费】" + payment + "元"); + TAppUserCar appUserCar = appUserCarClient.getAppUserCarByLicensePlate(parkingRecord.getLicensePlate()).getData(); + if(null != appUserCar){ + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + List<TChargingOrder> data = chargingOrderClient.getCarChargingOrder(appUserCar.getId(), parkingRecord.getInParkingTime().format(formatter), LocalDateTime.now().format(formatter)).getData(); + if(null != data && data.size() > 0){ + TChargingOrder chargingOrder = data.get(0); + parkingRecord.setAppUserId(chargingOrder.getAppUserId()); + parkingRecord.setChargingOrderId(chargingOrder.getId()); + } + } parkingRecordClient.updateParkingRecord(parkingRecord); } @@ -139,6 +156,16 @@ parkingRecord.setStatus(BigDecimal.ZERO.compareTo(payment) == 0 ? 2 : 3); parkingRecord.setOutParkingType(BigDecimal.ZERO.compareTo(payment) == 0 ? 2 : 1); parkingRecord.setTitle("【停车缴费】" + payment + "元"); + TAppUserCar appUserCar = appUserCarClient.getAppUserCarByLicensePlate(parkingRecord.getLicensePlate()).getData(); + if(null != appUserCar){ + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + List<TChargingOrder> data = chargingOrderClient.getCarChargingOrder(appUserCar.getId(), parkingRecord.getInParkingTime().format(formatter), LocalDateTime.now().format(formatter)).getData(); + if(null != data && data.size() > 0){ + TChargingOrder chargingOrder = data.get(0); + parkingRecord.setAppUserId(chargingOrder.getAppUserId()); + parkingRecord.setChargingOrderId(chargingOrder.getId()); + } + } parkingRecordClient.updateParkingRecord(parkingRecord); } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java index 4a14d46..c722bcb 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java @@ -1864,4 +1864,20 @@ List<TChargingOrder> chargingOrder = chargingOrderService.getChargingOrder(order); return R.ok(chargingOrder); } + + + /** + * 根据车辆id获取指定时间范围内的数据 + * @param carId + * @param startTime + * @param endTime + * @return + */ + @PostMapping("/getCarChargingOrder") + public R<List<TChargingOrder>> getCarChargingOrder(@RequestParam("carId") Long carId, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime){ + List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserCarId, carId).eq(TChargingOrder::getDelFlag, 0) + .in(TChargingOrder::getStatus, Arrays.asList(4, 5)).between(TChargingOrder::getStartTime, startTime, endTime)); + return R.ok(list); + } + } -- Gitblit v1.7.1