From df65f525e22b3c8c54083fb3c25c81c21c1b00f3 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 27 二月 2025 16:19:18 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java |   66 ++++++++++++++++++++++++++++-----
 1 files changed, 56 insertions(+), 10 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 2f25f87..05be148 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
@@ -210,16 +210,19 @@
         if (siteIds.isEmpty()){
             siteIds.add(-1);
         }
-
+        List<TChargingOrder> list = chargingOrderService.list();
+        List<TParkingRecord> parkingRecord = parkingLotClient.getSiteIdAll().getData();
         for (PayOrderDto record : data.getRecords()) {
             if (record.getType() == 1){
-                TChargingOrder byId = chargingOrderService.getById(record.getId());
-                record.setSiteId(byId.getSiteId());
+                TChargingOrder chargingOrder = list.stream().filter(e -> e.getId().equals(Long.valueOf(record.getId()))).findFirst().orElse(null);
+                if (chargingOrder!=null){
+                    record.setSiteId(chargingOrder.getSiteId());
+                }
             }
             if (record.getType()==4){
-                Integer siteId=parkingLotClient.getSiteIdByOrderId(Long.valueOf(record.getId())).getData();
-                if (siteId!=null){
-                    record.setSiteId(siteId);
+                TParkingRecord tParkingRecord = parkingRecord.stream().filter(e -> e.getId().equals(Long.valueOf(record.getId()))).findFirst().orElse(null);
+                if (tParkingRecord!=null){
+                    record.setSiteId(tParkingRecord.getSiteId());
                 }
             }
             if (roleType==1||(record.getType()!=1&&record.getType()!=4)){
@@ -513,8 +516,13 @@
         TCharingOrderVO res = chargingOrderService.chargingOrder(dto);
         return AjaxResult.success(res);
     }
-    
-    
+
+
+    public static void main(String[] args) {
+        String temp = "00";
+        Integer i = Integer.valueOf(temp);
+        System.err.println(i);
+    }
     @RequiresPermissions(value = {"/chargingPileOrder/monitoring_record"}, logical = Logical.OR)
     @ResponseBody
     @GetMapping(value = "/chargingOrderInfo")
@@ -541,9 +549,23 @@
         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 = tChargingOrderAccountingStrategy.getCreateTime().format(formatter);
+            String format = "";
+            String format1 = "";
+            String temp1=list.get(0).getStartTime().split(":")[0];
+            String[] split = tChargingOrderAccountingStrategy.getStartTime().split(":");
+            if (Integer.parseInt(split[0])>=Integer.valueOf(temp1)){
+                format = byId.getCreateTime().format(formatter);
+            }else {
+                format = byId.getEndTime().format(formatter);
+            }
+            String[] split1 = tChargingOrderAccountingStrategy.getEndTime().split(":");
+            if (Integer.parseInt(split1[0])<Integer.valueOf(temp1)){
+                format1 = byId.getCreateTime().format(formatter);
+            }else {
+                format1 = byId.getEndTime().format(formatter);
+            }
             tChargingOrderAccountingStrategy.setStartTime(format+" "+tChargingOrderAccountingStrategy.getStartTime());
-            tChargingOrderAccountingStrategy.setEndTime(format+" "+tChargingOrderAccountingStrategy.getEndTime());
+            tChargingOrderAccountingStrategy.setEndTime(format1+" "+tChargingOrderAccountingStrategy.getEndTime());
             if (byId.getVipDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){
                 BigDecimal multiply = byId.getVipDiscountAmount().divide(byId.getServiceCharge(), 2)
                         .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice());
@@ -757,6 +779,18 @@
                                          @RequestParam("transaction_id") String transaction_id,
                                          @RequestParam("attach") String attach) {
         chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach);
+    }
+    
+    
+    /**
+     *
+     * @param code
+     */
+    @ResponseBody
+    @PostMapping(value = "/refund")
+    public R refund(@RequestParam(value = "code") String code){
+        chargingOrderService.refund(code);
+        return R.ok();
     }
     
     
@@ -2186,4 +2220,16 @@
     public R tripartitePlatformStopCharge(@RequestParam("startChargeSeq") String startChargeSeq){
         return chargingOrderService.tripartitePlatformStopCharge(startChargeSeq);
     }
+    
+    
+    /**
+     * 临时接口
+     * 获取充电后没有扣除费用的数据
+     * @return
+     */
+    @GetMapping("/getNotPaymentChargingOrder")
+    public R getNotPaymentChargingOrder(){
+        return chargingOrderService.getNotPaymentChargingOrder();
+    }
+    
 }

--
Gitblit v1.7.1