From 66794a3e6b3feb01d4b6ae5710a0725b525a99dd Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 08 十月 2024 15:13:46 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java
index 38103ce..fd33db0 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java
@@ -140,8 +140,10 @@
     @ApiOperation(tags = {"后台-充电枪"},value = "结束充电")
     @PutMapping(value = "/stopCharging")
     public AjaxResult<String> stopCharging(@RequestParam("id") String id) {
+        // 根据充电枪id 查询最新的一笔订单
+        String data = chargingOrderClient.queryOrderByGunId(id).getData();
         // 硬件 结束充电
-        chargingOrderClient.stopCharging(id);
+        chargingOrderClient.stopCharging(data);
         return AjaxResult.success();
     }
     
@@ -153,7 +155,7 @@
     public void downloadQRCode(@PathVariable Integer id, HttpServletResponse response){
         try {
             TChargingGun chargingGun = chargingGunService.getById(id);
-            TChargingPile chargingPile = chargingPileService.getById(chargingGun.getId());
+            TChargingPile chargingPile = chargingPileService.getById(chargingGun.getChargingPileId());
             String code = chargingPile.getCode() + chargingGun.getCode();
             String fileName = URLEncoder.encode(code, "UTF-8") + ".jpg";
             response.setContentType("application/force-download");
@@ -173,15 +175,15 @@
             inputStream.close();
             
             //清楚服务器上的文件
-            Process process = null;
-            try {
-                process = Runtime.getRuntime().exec("sudo rm -rf " + filePath);
-            } catch (IOException e) {
-                throw new RuntimeException(e);
-            }
-            if (process != null) {
-                process.destroy();
-            }
+//            Process process = null;
+//            try {
+//                process = Runtime.getRuntime().exec("sudo rm -rf " + filePath);
+//            } catch (IOException e) {
+//                throw new RuntimeException(e);
+//            }
+//            if (process != null) {
+//                process.destroy();
+//            }
         }catch (Exception e){
             e.printStackTrace();
         }

--
Gitblit v1.7.1