From fe2e226da5a7505b343517e828f0d8c3a496fb7a Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期三, 28 八月 2024 16:23:50 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java |   48 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 38 insertions(+), 10 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 090c134..d38e967 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
@@ -16,6 +16,7 @@
 import com.ruoyi.chargingPile.api.model.Site;
 import com.ruoyi.chargingPile.api.model.TChargingGun;
 import com.ruoyi.chargingPile.api.model.TChargingPile;
+import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.BasePage;
 import com.ruoyi.common.core.web.page.PageInfo;
@@ -27,6 +28,7 @@
 import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData;
 import com.ruoyi.order.api.model.TChargingOrder;
 import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy;
+import com.ruoyi.order.api.model.TChargingOrderRefund;
 import com.ruoyi.order.api.query.ChargingOrderQuery;
 import com.ruoyi.order.api.vo.ChargingOrderVO;
 import com.ruoyi.order.api.vo.TCharingOrderVO;
@@ -524,7 +526,9 @@
 		 BigDecimal electronicMoney = new BigDecimal("0");
 		 BigDecimal serviceMoney = new BigDecimal("0");
 		for (ChargingOrderVO chargingOrderVO : list) {
-			total = total.add(chargingOrderVO.getChargingCapacity());
+			if (chargingOrderVO.getChargingCapacity()!=null){
+				total = total.add(chargingOrderVO.getChargingCapacity());
+			}
 			// 充电订单 明细记录
 			List<TChargingOrderAccountingStrategy> chargingOrderId = chargingOrderAccountingStrategyService.list(new QueryWrapper<TChargingOrderAccountingStrategy>()
 					.eq("charging_order_id", chargingOrderVO.getId()));
@@ -535,14 +539,18 @@
 			LocalDateTime startTime = chargingOrderVO.getStartTime();
 			LocalDateTime endTime = chargingOrderVO.getEndTime();
 			// 计算时间差 秒 充电时长
-			long between = ChronoUnit.SECONDS.between(startTime, endTime);
-			chargingOrderVO.setChargingSecond(between);
-			time += between;
+			if (startTime!=null && endTime!=null){
+				long between = ChronoUnit.SECONDS.between(startTime, endTime);
+				chargingOrderVO.setChargingSecond(between);
+				time += between;
+			}
 			// 总收入
-			if (chargingOrderVO.getRefundStatus() == 2){
+			if (chargingOrderVO.getRefundStatus() !=null && chargingOrderVO.getRefundStatus() == 2){
 				income = income.add(chargingOrderVO.getPaymentAmount().subtract(chargingOrderVO.getRefundAmount()));
 			}else{
-				income = income.add(chargingOrderVO.getPaymentAmount());
+				if (chargingOrderVO.getPaymentAmount()!=null){
+					income = income.add(chargingOrderVO.getPaymentAmount());
+				}
 			}
 			for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : chargingOrderId) {
 				// 累计电费
@@ -564,11 +572,14 @@
 				// 车牌号
 				chargingOrderVO.setPhone(data.getPhone());
 				List<Long> longs = new ArrayList<>();
-				longs.add(chargingOrderVO.getAppUserCarId());
-				List<TAppUserCar> data1 = appUserCarClient.getCarByIds(longs).getData();
-				if (!data1.isEmpty()){
-					chargingOrderVO.setLicensePlate(data1.get(0).getLicensePlate());
+				if (chargingOrderVO.getAppUserCarId()!=null){
+					longs.add(chargingOrderVO.getAppUserCarId());
+					List<TAppUserCar> data1 = appUserCarClient.getCarByIds(longs).getData();
+					if (!data1.isEmpty()){
+						chargingOrderVO.setLicensePlate(data1.get(0).getLicensePlate());
+					}
 				}
+
 			}
 		}
 		tCharingOrderVO.setTotal(total);
@@ -580,4 +591,21 @@
 		tCharingOrderVO.setList(pageInfo);
         return tCharingOrderVO;
     }
+
+	@Override
+	public R<PageInfo<PayOrderDto>> payOrderQuery(PayOrderQueryDto payOrderQueryDto) {
+		PageInfo<PayOrderDto> pageInfo = new PageInfo<>(payOrderQueryDto.getPageCurr(),payOrderQueryDto.getPageSize());
+		List<PayOrderDto> list = this.baseMapper.payOrderQuery(pageInfo,payOrderQueryDto);
+		pageInfo.setRecords(list);
+		return R.ok(pageInfo);
+	}
+
+	@Override
+	public R<PageInfo<TChargingOrderRefund>> getRefundList(ChargingRefundDto chargingRefundDto) {
+		PageInfo<TChargingOrderRefund> pageInfo = new PageInfo<>(chargingRefundDto.getPageCurr(),chargingRefundDto.getPageSize());
+		List<TChargingOrderRefund> list = this.baseMapper.getRefundList(pageInfo,chargingRefundDto);
+		pageInfo.setRecords(list);
+
+		return R.ok(pageInfo);
+	}
 }

--
Gitblit v1.7.1