From f4c9281d1b7f19fef0d8ee7cb03e166a218b33f2 Mon Sep 17 00:00:00 2001 From: zhibing.pu <393733352@qq.com> Date: 星期四, 05 九月 2024 17:50:33 +0800 Subject: [PATCH] 完善功能 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 40 ++++++++++++++++++++++++++++++++-------- 1 files changed, 32 insertions(+), 8 deletions(-) diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java index ea7bafb..b99ebf0 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java @@ -37,10 +37,7 @@ import com.ruoyi.order.api.model.*; import com.ruoyi.order.api.query.ChargingOrderQuery; import com.ruoyi.order.api.query.UploadRealTimeMonitoringDataQuery; -import com.ruoyi.order.api.vo.ChargingOrderListVO; -import com.ruoyi.order.api.vo.ChargingOrderTimeVO; -import com.ruoyi.order.api.vo.ChargingOrderVO; -import com.ruoyi.order.api.vo.TCharingOrderVO; +import com.ruoyi.order.api.vo.*; import com.ruoyi.order.dto.*; import com.ruoyi.order.mapper.TChargingOrderMapper; import com.ruoyi.order.service.*; @@ -592,7 +589,7 @@ preChargeCheck1.setFailureCause(failure_cause); //启动失败后取消订单,退款操作 refund(code); - order.setStatus(5); + order.setStatus(-1); order.setEndMode(0); }else{ preChargeCheck1.setStartupSuccess(2); @@ -877,7 +874,7 @@ chargingOrder.setOrderAmount(total); } - if(chargingOrder.getEndMode() != 1){ + if(chargingOrder.getEndMode() == 2){ chargingOrder.setEndMode(refundAmount.compareTo(BigDecimal.ZERO) > 0 ? 2 : 3); } chargingOrder.setStatus(5); @@ -1488,14 +1485,14 @@ */ @Override @GlobalTransactional(rollbackFor = Exception.class) - public void endCharge(String orderCode) { + public void endCharge(String orderCode, Integer endMode) { TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, orderCode)); Integer status = chargingOrder.getStatus(); if(status == 4 || status == 5){ return; } chargingOrder.setStatus(5); - chargingOrder.setEndMode(2); + chargingOrder.setEndMode(endMode); this.updateById(chargingOrder); //计算费用,处理退款 @@ -1540,4 +1537,31 @@ appUserClient.updateAppUser(appUser1); } } + + /** + * 异常结束充电处理逻辑 + * @param orderCode + */ + @Override + public void excelEndCharge(String orderCode) { + endCharge(orderCode, 0); + } + + + /** + * 根据车牌号和开始时间查询充电数据 + * @param query + * @return + */ + @Override + public TChargingOrder getChargingOrderByLicensePlate(GetChargingOrderByLicensePlate query) { + TAppUserCar appUserCar = appUserCarClient.getAppUserCarByLicensePlate(query.getLicensePlate()).getData(); + if(null == appUserCar){ + return null; + } + TChargingOrder one = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserCarId, appUserCar.getId()) + .eq(TChargingOrder::getDelFlag, 0).gt(TChargingOrder::getStartTime, query.getStartTime()) + .eq(TChargingOrder::getRechargePaymentStatus, 2).ne(TChargingOrder::getStatus, -1)); + return one; + } } -- Gitblit v1.7.1