From 7bf78505063d2331372a13088f610a99a1c3b664 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期五, 08 十一月 2024 14:02:42 +0800 Subject: [PATCH] 修改续航问题 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 23 +++++++++-------------- 1 files changed, 9 insertions(+), 14 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 c8218c0..f239bd8 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 @@ -528,9 +528,9 @@ req.setSubject("充电充值"); req.setBuyerOpenId(appUser.getAliOpenid()); req.setBody("充电充值"); + req.setNotifyUrl("/payment/ali/callBack"); AliPaymentResp data = aliPaymentClient.payment(req).getData(); if(null != data){ - data.setNotifyUrl(data.getNotifyUrl() + "/order/t-charging-order/chargingOrderALICallback"); return AjaxResult.success(data); } } @@ -882,8 +882,7 @@ dto.setRefundReason("充电失败,取消充电订单"); RefundResp resp = aliPaymentClient.refund(dto).getData(); if(null != resp){ - SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); - AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", sdf1.format(new Date())); + AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", null); if(success.isSuccess()){ chargingOrderRefundService.save(chargingOrderRefund); } @@ -957,15 +956,12 @@ Integer h = Integer.valueOf(data.getCumulative_charging_time() / 60); Integer m = Integer.valueOf(data.getCumulative_charging_time() % 60); chargingDetails.setChargedTime(String.format("%02d", h) + ":" + String.format("%02d", m)); - } - //转换成UTC时间 - ChargingHandshake chargingHandshake = chargingHandshakeClient.getDataByOrderCode(one.getCode()).getData(); - if(null != chargingHandshake && null != data && null != one.getAppUserCarId()){ - BigDecimal bms_battery_capacity = chargingHandshake.getBms_battery_capacity(); - TAppUserCar appUserCar = appUserCarClient.getCarByIds(Arrays.asList(one.getAppUserCarId())).getData().get(0); - // 续航 = 续航里程 * soc - BigDecimal multiply = new BigDecimal(data.getSoc() / 100).multiply(new BigDecimal(appUserCar.getEndurance())); - chargingDetails.setEndurance(multiply); + if(null != one.getAppUserCarId()){ + TAppUserCar appUserCar = appUserCarClient.getCarById(one.getAppUserCarId().toString()).getData(); + // 续航 = 续航里程 * soc + BigDecimal multiply = new BigDecimal(data.getSoc()).divide(new BigDecimal(100)).multiply(new BigDecimal(appUserCar.getEndurance())); + chargingDetails.setEndurance(multiply.setScale(2, RoundingMode.HALF_EVEN)); + } } return chargingDetails; } @@ -2183,8 +2179,7 @@ dto.setRefundReason("充电完成退款"); RefundResp resp = aliPaymentClient.refund(dto).getData(); if(null != resp){ - SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); - AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", sdf1.format(new Date())); + AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", null); if(success.isSuccess()){ chargingOrderRefundService.save(chargingOrderRefund); } -- Gitblit v1.7.1