From 3224590fb5643a5022af9f8480f2de9136a415ed Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期日, 10 十一月 2024 00:02:02 +0800
Subject: [PATCH] 修改续航问题

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 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 b0d5ed6..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
@@ -956,13 +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));
-		}
-		if(null != data && null != one.getAppUserCarId()){
-			TAppUserCar appUserCar = appUserCarClient.getCarById(one.getAppUserCarId().toString()).getData();
-			//   续航 = 续航里程 * soc
-			BigDecimal multiply = new BigDecimal(data.getSoc() / 100).multiply(new BigDecimal(appUserCar.getEndurance()));
-			chargingDetails.setEndurance(multiply.setScale(2, RoundingMode.HALF_EVEN));
-			System.err.println("续航--" + 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;
 	}

--
Gitblit v1.7.1