From 91df8c9b3dac121493b03c9ce1890953c1879603 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期日, 16 三月 2025 13:00:37 +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/controller/TChargingOrderController.java |   86 ++++++++++++++++++++++++++++---------------
 1 files changed, 56 insertions(+), 30 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 0f67e72..cad5ef5 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
@@ -400,15 +400,38 @@
     @GetMapping(value = "/pay/order/charging/details")
     @ApiOperation(value = "充电明细", tags = {"管理后台-支付订单-订单信息"})
     public R<List<TChargingOrderAccountingStrategy>> chargingDetail(Long orderId) {
-        List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, orderId).orderByDesc(TChargingOrderAccountingStrategy::getStartTime).list();
+        TChargingOrder chargingOrder = chargingOrderService.getById(orderId);
+        List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, orderId)
+                .orderByDesc(TChargingOrderAccountingStrategy::getStartTime).list();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : list) {
-            String format = tChargingOrderAccountingStrategy.getCreateTime().format(formatter);
+            LocalDateTime createTime = chargingOrder.getStartTime();
+            String format = createTime.format(formatter);
+            String startTime = tChargingOrderAccountingStrategy.getStartTime();
+            if("00:00".equals(startTime)){
+                createTime = createTime.plusDays(1);
+                format = createTime.format(formatter);
+            }
             tChargingOrderAccountingStrategy.setStartTime(format+" "+tChargingOrderAccountingStrategy.getStartTime());
             tChargingOrderAccountingStrategy.setEndTime(format+" "+tChargingOrderAccountingStrategy.getEndTime());
         }
-
-
+        //从新排序
+        list.sort(new Comparator<TChargingOrderAccountingStrategy>() {
+            @Override
+            public int compare(TChargingOrderAccountingStrategy o1, TChargingOrderAccountingStrategy o2) {
+                String startTime = o1.getStartTime();
+                String startTime1 = o2.getStartTime();
+                LocalDateTime localDateTime = LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
+                LocalDateTime localDateTime1 = LocalDateTime.parse(startTime1, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
+                if(localDateTime.isBefore(localDateTime1)){
+                    return -1;
+                }
+                if(localDateTime.isAfter(localDateTime1)){
+                    return 1;
+                }
+                return 0;
+            }
+        });
         return R.ok(list);
     }
     
@@ -522,12 +545,6 @@
     }
 
 
-    public static void main(String[] args) {
-        ;
-        System.err.println(Integer.parseInt("01"));
-        System.err.println(Integer.valueOf("01"));
-        ;
-    }
     @RequiresPermissions(value = {"/chargingPileOrder/monitoring_record"}, logical = Logical.OR)
     @ResponseBody
     @GetMapping(value = "/chargingOrderInfo")
@@ -554,27 +571,15 @@
         List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, strategyId).orderByDesc(TChargingOrderAccountingStrategy::getStartTime).list();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : list) {
-            String format = "";
-            String format1 = "";
-//            String temp1=list.get(0).getStartTime().split(":")[0];
-            System.err.println("订单详情时间第一条"+list.get(0).getStartTime());
-            System.err.println("订单详情时间开始"+tChargingOrderAccountingStrategy.getStartTime());
-            System.err.println("订单详情时间结束"+tChargingOrderAccountingStrategy.getEndTime());
-            String temp1=list.get(0).getStartTime().split(" ")[1].split(":")[0];
-            String[] split = tChargingOrderAccountingStrategy.getStartTime().split(" ")[1].split(":");
-            if (Integer.parseInt(split[0])>=Integer.parseInt(temp1)){
-                format = byId.getCreateTime().format(formatter);
-            }else {
-                format = byId.getEndTime().format(formatter);
-            }
-            String[] split1 = tChargingOrderAccountingStrategy.getEndTime().split(" ")[1].split(":");
-            if (Integer.parseInt(split1[0])<Integer.parseInt(temp1)){
-                format1 = byId.getCreateTime().format(formatter);
-            }else {
-                format1 = byId.getEndTime().format(formatter);
+            LocalDateTime createTime = byId.getStartTime();
+            String format = createTime.format(formatter);
+            String startTime = tChargingOrderAccountingStrategy.getStartTime();
+            if("00:00".equals(startTime)){
+                createTime = createTime.plusDays(1);
+                format = createTime.format(formatter);
             }
             tChargingOrderAccountingStrategy.setStartTime(format+" "+tChargingOrderAccountingStrategy.getStartTime());
-            tChargingOrderAccountingStrategy.setEndTime(format1+" "+tChargingOrderAccountingStrategy.getEndTime());
+            tChargingOrderAccountingStrategy.setEndTime(format+" "+tChargingOrderAccountingStrategy.getEndTime());
             if (byId.getVipDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){
                 BigDecimal multiply = byId.getVipDiscountAmount().divide(byId.getServiceCharge(), 2)
                         .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice());
@@ -586,6 +591,23 @@
                 tChargingOrderAccountingStrategy.setCouponDiscount(multiply);
             }
         }
+        //从新排序
+        list.sort(new Comparator<TChargingOrderAccountingStrategy>() {
+            @Override
+            public int compare(TChargingOrderAccountingStrategy o1, TChargingOrderAccountingStrategy o2) {
+                String startTime = o1.getStartTime();
+                String startTime1 = o2.getStartTime();
+                LocalDateTime localDateTime = LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
+                LocalDateTime localDateTime1 = LocalDateTime.parse(startTime1, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"));
+                if(localDateTime.isBefore(localDateTime1)){
+                    return -1;
+                }
+                if(localDateTime.isAfter(localDateTime1)){
+                    return 1;
+                }
+                return 0;
+            }
+        });
         chargingOrderInfoVO.setList(list);
         return AjaxResult.success(chargingOrderInfoVO);
     }
@@ -1031,6 +1053,10 @@
     }
     
     
+    
+    
+    
+    
     @RequiresPermissions(value = {"/platformRevenueAnalysis"}, logical = Logical.OR)
     @ResponseBody
     @GetMapping(value = "/six/total")
@@ -1050,7 +1076,7 @@
             siteIds.add(-1);
         }
         Map<String,Object>  map = chargingOrderService.countAll(sixBefore,siteIds);
-        BigDecimal data = parkingLotClient.getRecordAmount(sixBefore).getData();
+        BigDecimal data = parkingLotClient.getRecordAmount(sixBefore.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))).getData();
         if (map ==null){
             map = new HashMap<String,Object>();
         }

--
Gitblit v1.7.1