From be1ab2eb2032a747a409fb765ec90f76c3116c51 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期五, 01 十一月 2024 09:15:25 +0800
Subject: [PATCH] merge

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

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 e1a49c2..25718a7 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
@@ -196,6 +196,7 @@
                 payOrderInfoDto.setPayAmount(byId.getPaymentAmount());
                 payOrderInfoDto.setPayTime(byId.getCreateTime());
                 payOrderInfoDto.setRefundAmount(byId.getRefundAmount());
+                payOrderInfoDto.setRechargeAmount(byId.getRechargeAmount());
                 return R.ok(payOrderInfoDto);
             case 2:
                 TShoppingOrder byId1 = shoppingOrderService.getById(orderId);
@@ -207,6 +208,7 @@
                 payOrderInfoDto1.setPayAmount(byId1.getPaymentAmount());
                 payOrderInfoDto1.setPayTime(byId1.getCreateTime());
                 payOrderInfoDto1.setRefundAmount(byId1.getRefundAmount());
+                payOrderInfoDto1.setRechargeAmount(byId1.getPaymentAmount());
                 return R.ok(payOrderInfoDto1);
             case 3:
                 TVipOrder byId2 = vipOrderService.getById(orderId);
@@ -218,6 +220,7 @@
                 payOrderInfoDto2.setPayAmount(byId2.getPaymentAmount());
                 payOrderInfoDto2.setPayTime(byId2.getCreateTime());
                 payOrderInfoDto2.setRefundAmount(byId2.getRefundAmount());
+                payOrderInfoDto2.setRechargeAmount(byId2.getPaymentAmount());
                 return R.ok(payOrderInfoDto2);
             //todo luo 停车场订单
 //                case 4:
@@ -366,14 +369,14 @@
         List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, strategyId).orderByDesc(TChargingOrderAccountingStrategy::getStartTime).list();
 
         for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : list) {
-            if (byId.getVipDiscountAmount()!=null){
+            if (byId.getVipDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){
                 BigDecimal multiply = byId.getVipDiscountAmount().divide(byId.getServiceCharge(), 2)
                         .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice());
                 tChargingOrderAccountingStrategy.setVipDiscount(multiply);
             }
             bigDecimal = bigDecimal.add(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice());
 
-            if (byId.getCouponDiscountAmount()!=null){
+            if (byId.getCouponDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){
                 BigDecimal multiply = byId.getCouponDiscountAmount().divide(byId.getServiceCharge(), 2)
                         .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice());
                 tChargingOrderAccountingStrategy.setCouponDiscount(multiply);
@@ -912,16 +915,13 @@
             // 获取当前日期
             LocalDate today = LocalDate.now();
             start = statisticsQueryDto.getStartTime();
-            end = statisticsQueryDto.getEndTime();
+            end = statisticsQueryDto.getEndTime().plusDays(1);
             // 获取本月1号的日期
-            YearMonth yearMonth = YearMonth.from(today);
 //            start = yearMonth.atDay(1);
 //
 //            System.out.println("本月1号是: " + start);
         }else if (statisticsQueryDto.getDayType()==4){
-            LocalDate today = LocalDate.now();
-            // 获取当前年份
-            int currentYear = today.getYear();
+
             // 获取今年1月1日的日期
             start = statisticsQueryDto.getStartTime();
             end = statisticsQueryDto.getEndTime();
@@ -930,7 +930,11 @@
             // 获取今年1月1日的日期
             start = statisticsQueryDto.getStartTime();
             end = statisticsQueryDto.getEndTime();
+            if (start.equals(end)){
+                end =  end.plusDays(1);
+            }
         }
+
         List<TChargingOrder> list = chargingOrderService.lambdaQuery().ge(TChargingOrder::getCreateTime, start).le(TChargingOrder::getCreateTime, end).in(TChargingOrder::getSiteId, siteIds).list();
         List<Long> chargingOrderIds = list.stream().map(TChargingOrder::getId).collect(Collectors.toList());
         chargingOrderIds.add(-1L);
@@ -1030,6 +1034,7 @@
             LocalDate startDate = statisticsQueryDto.getStartTime();
             LocalDate endDate = statisticsQueryDto.getEndTime();
 
+
             List<Map<String, Object>> dateRangeStatistics = new ArrayList<>();
 
             // 遍历日期范围
@@ -1059,6 +1064,8 @@
 
             LocalDate startDate = statisticsQueryDto.getStartTime();
             LocalDate endDate = statisticsQueryDto.getEndTime();
+
+
 
             List<Map<String, Object>> dateRangeStatistics = new ArrayList<>();
 
@@ -1179,6 +1186,8 @@
         tCharingUserMapVO.setMap(charMap);
         tCharingUserMapVO.setMap1(charMap1);
         }else {
+
+
             List<Map<String,Object>> map =  chargingOrderService.usersByQuery(statisticsQueryDto);
 
 
@@ -1259,8 +1268,19 @@
 
         //车辆用途
         List<Map<String, Object>> carMap = chargingOrderService.carUserMethod();
+
         //车辆品牌
         List<Map<String, Object>> carBrandMap = chargingOrderService.carUserBrand();
+        List<String> brands = new ArrayList<>();
+        for (Map<String, Object> objectMap : carBrandMap) {
+            brands.add(objectMap.get("vehicle_brand").toString());
+        }
+
+        Long count = chargingOrderService.countCar(brands);
+        Map<String, Object> others = new HashMap<>();
+        others.put("vehicle_brand","其他");
+        others.put("counts",count);
+        carBrandMap.add(others);
         //本地车数量
         Map<String,Object> localCarMap = chargingOrderService.countLocalCar();
 

--
Gitblit v1.7.1