From db10c806301733947f1ac86a248fa2146600be69 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期三, 23 十月 2024 20:03:55 +0800
Subject: [PATCH] marge

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java |   75 +++++++++++++++++++++++++++++++++----
 1 files changed, 67 insertions(+), 8 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 afa1ff4..429e443 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
@@ -181,7 +181,7 @@
                 payOrderInfoDto.setTradeNo(byId.getRechargeSerialNumber());
                 payOrderInfoDto.setPayType(byId.getRechargePaymentType());
                 payOrderInfoDto.setPayAmount(byId.getPaymentAmount());
-                payOrderInfoDto.setPayTime(byId.getPayTime());
+                payOrderInfoDto.setPayTime(byId.getCreateTime());
                 payOrderInfoDto.setRefundAmount(byId.getRefundAmount());
                 return R.ok(payOrderInfoDto);
             case 2:
@@ -192,7 +192,7 @@
                 payOrderInfoDto1.setTradeNo(byId1.getSerialNumber());
                 payOrderInfoDto1.setPayType(byId1.getPaymentType());
                 payOrderInfoDto1.setPayAmount(byId1.getPaymentAmount());
-                payOrderInfoDto1.setPayTime(byId1.getPayTime());
+                payOrderInfoDto1.setPayTime(byId1.getCreateTime());
                 payOrderInfoDto1.setRefundAmount(byId1.getRefundAmount());
                 return R.ok(payOrderInfoDto1);
             case 3:
@@ -203,7 +203,7 @@
                 payOrderInfoDto2.setTradeNo(byId2.getSerialNumber());
                 payOrderInfoDto2.setPayType(byId2.getPaymentType());
                 payOrderInfoDto2.setPayAmount(byId2.getPaymentAmount());
-                payOrderInfoDto2.setPayTime(byId2.getPayTime());
+                payOrderInfoDto2.setPayTime(byId2.getCreateTime());
                 payOrderInfoDto2.setRefundAmount(byId2.getRefundAmount());
                 return R.ok(payOrderInfoDto2);
             //todo luo 停车场订单
@@ -278,7 +278,11 @@
     @PostMapping(value = "/pay/order/refund/list")
     @ApiOperation(value = "列表", tags = {"管理后台-支付订单-退款订单"})
     public R<PageInfo<TChargingOrderRefund>> refundList(@RequestBody ChargingRefundDto chargingRefundDto) {
-        return chargingOrderService.getRefundList(chargingRefundDto);
+        R<PageInfo<TChargingOrderRefund>> refundList = chargingOrderService.getRefundList(chargingRefundDto);
+        for (TChargingOrderRefund record : refundList.getData().getRecords()) {
+            record.setUid(record.getId().toString());
+        }
+        return refundList;
 
     }
     @ResponseBody
@@ -614,10 +618,36 @@
         }
         LocalDate sixBefore = PreviousSixMonths.get();
         //通过siteIds进行sql查询统计
+        List<SixChargingDto> sixChargingDtos = generateLastSixMonths();
         List<SixChargingDto> chargingDtos = chargingOrderService.charge(sixBefore, siteIds);
+        for (SixChargingDto sixChargingDto : sixChargingDtos) {
+            for (SixChargingDto chargingDto : chargingDtos) {
+                if (sixChargingDto.getMonth().equals(chargingDto.getMonth())){
+                    BeanUtils.copyProperties(chargingDto,sixChargingDto);
+                }
+            }
 
-        return R.ok(chargingDtos);
+        }
 
+        return R.ok(sixChargingDtos);
+
+    }
+
+
+    public static List<SixChargingDto> generateLastSixMonths() {
+        LocalDate today = LocalDate.now();
+        List<SixChargingDto> months = new ArrayList<>();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM");
+
+        for (int i = 5; i >= 0; i--) {
+            LocalDate date = today.minusMonths(i);
+            String month = date.format(formatter);
+            SixChargingDto sixChargingDto = new SixChargingDto();
+            sixChargingDto.setMonth(month);
+            months.add(sixChargingDto);
+        }
+
+        return months;
     }
 
     @ResponseBody
@@ -651,7 +681,33 @@
         //count近6个月的数据
         LocalDate sixBefore = PreviousSixMonths.get();
         List<SixShopDto> sixShopDtos =  shoppingOrderService.sixBefore(sixBefore,status);
-        return R.ok(sixShopDtos);
+        List<SixShopDto> sixChargingDtos = generateLastSixMonths1();
+        for (SixShopDto sixChargingDto : sixChargingDtos) {
+            for (SixShopDto chargingDto : sixShopDtos) {
+                if (sixChargingDto.getMonth().equals(chargingDto.getMonth())){
+                    BeanUtils.copyProperties(chargingDto,sixChargingDto);
+                }
+            }
+
+        }
+
+        return R.ok(sixChargingDtos);
+    }
+
+    public static List<SixShopDto> generateLastSixMonths1() {
+        LocalDate today = LocalDate.now();
+        List<SixShopDto> months = new ArrayList<>();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM");
+
+        for (int i = 5; i >= 0; i--) {
+            LocalDate date = today.minusMonths(i);
+            String month = date.format(formatter);
+            SixShopDto sixChargingDto = new SixShopDto();
+            sixChargingDto.setMonth(month);
+            months.add(sixChargingDto);
+        }
+
+        return months;
     }
 
     @ResponseBody
@@ -781,19 +837,22 @@
         LocalDate end = null;
         if (statisticsQueryDto.getDayType()==1){
             start = LocalDate.now();
+            end = LocalDate.now().plusDays(1);
 
         }else if (statisticsQueryDto.getDayType()==2){
             LocalDate today = LocalDate.now();
 
             // 获取本周一的日期
             LocalDate mondayThisWeek = today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
-
+            start = statisticsQueryDto.getStartTime();
+            end = statisticsQueryDto.getEndTime();
             System.out.println("本周一是: " + mondayThisWeek);
         }
         else if (statisticsQueryDto.getDayType()==3){
             // 获取当前日期
             LocalDate today = LocalDate.now();
-
+            start = statisticsQueryDto.getStartTime();
+            end = statisticsQueryDto.getEndTime();
             // 获取本月1号的日期
             YearMonth yearMonth = YearMonth.from(today);
 //            start = yearMonth.atDay(1);

--
Gitblit v1.7.1