From 1f1cf6f0288863f59051bd506243eb99a985bee9 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期二, 08 十月 2024 10:50:11 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java        |    5 ++
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/ali/tools/AliAppletTools.java                    |    2 
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java               |    4 +
 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java             |    5 ++
 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java |   22 ++++++++---
 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AlipayOpenAppQrcodeCreate.java        |    4 +-
 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java             |   24 +++++++++++-
 7 files changed, 53 insertions(+), 13 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java
index 011684c..7eb2fdc 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/factory/ChargingOrderFallbackFactory.java
@@ -35,6 +35,11 @@
         return new ChargingOrderClient() {
 
             @Override
+            public R<String> queryOrderByGunId(String id) {
+                return R.fail("远程调用根据枪id 查询最新的订单id 用户后台结束充电" + throwable.getMessage());
+            }
+
+            @Override
             public R<Long> useOrderCount(Long userId) {
                 return R.fail("订单计数:" + throwable.getMessage());
 
diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java
index 1d33c9a..1d3aac3 100644
--- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java
+++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/api/feignClient/ChargingOrderClient.java
@@ -28,6 +28,9 @@
  */
 @FeignClient(contextId = "ChargingOrderClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = ChargingOrderFallbackFactory.class)
 public interface ChargingOrderClient {
+
+    @PostMapping(value = "/t-charging-order/queryOrderByGunId/{id}")
+    R<String> queryOrderByGunId(@PathVariable("id") String id);
     @PostMapping(value = "/t-charging-order/useOrderCount")
     R<Long> useOrderCount(@RequestParam("userId") Long userId);
     @PostMapping(value = "/t-charging-order/chargingBillListR")
@@ -137,7 +140,7 @@
      */
     @PutMapping(value = "/t-charging-order/stopCharging/{id}")
     R<String> stopCharging(@PathVariable("id") String id);
-    
+
     
     /**
      * 充电支付成功回调通知
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/ali/tools/AliAppletTools.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/ali/tools/AliAppletTools.java
index 0678b48..d86465b 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/ali/tools/AliAppletTools.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/ali/tools/AliAppletTools.java
@@ -113,7 +113,7 @@
         String plainData = null;
         if (isDataEncrypted) {
             try {
-                plainData = AlipayEncrypt.decryptContent(content, encryptType, "XABBSOeWDakvuG9TDez4Qg====", charset);
+                plainData = AlipayEncrypt.decryptContent(content, encryptType, "84iAz9sTR7siFxTmAD6sfw==", charset);
             } catch (AlipayApiException e) {
                 //解密异常, 记录日志
                 throw new ServiceException("解密异常");
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AlipayOpenAppQrcodeCreate.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AlipayOpenAppQrcodeCreate.java
index ee97430..ba26098 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AlipayOpenAppQrcodeCreate.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AlipayOpenAppQrcodeCreate.java
@@ -44,8 +44,8 @@
     }
 
     private static AlipayConfig getAlipayConfig() {
-        String privateKey  = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCxWgLykkSXsj6zz5kVohKb6yAaOK8d4wnbWLrabBQSHZg+UZj9HknzQvgrSdfiMd6Dlv70OYQBRynWb2OSGaIKpWLbDKQDT+hDBcbZQ3nVTKExC7w8t/5mUc0CH4DkMsMMDcDW2synh9Lv4fmw7eNnRgd6g6csGIZyOUgt34eMcmCUBP58bEkYhuPm9rLBMw7fCRl9zZbKNAiE5j9FNL1/oAWhET6BCHRqKpiDHvKLQDZdXUwI+sA/JSolNlU+x052YBPGxjH9zqD8mpRLZRTPCb5pV5wCG+EqQkiCauyhAJSCVo2Dx3uXe4nP/6UDlQmgxyiZ+uuMtPsDFjKd7EIXAgMBAAECggEBAKXBfufAFSPCkB/2cxlo9QOM6eAYAnNocxnzABCM2uVji5sTIG3SFUOq3891oLPj8BgE1BzmdJ3NKSklymYOVwikMpSQZ+pAkM+zYnpFOmVEzZLNaQ1G2ho/cd/+GbUuTGXDpOwqawRZSaiyB3B5pgQry2mSCniII4A2UWOuez2jR7R6kXh2UL4DGDPYjDj2Gx3WfYEeuarjdbaeKU6ngdArkYqNtsbpmaR9aOUhNyo6ltOWh7pKjdjApAEtoEqqYjr1uQ4E0wfF4noiU1hR7gTG8FjvWHy1/piPWM4CihUbhJemC5xKuVKltI0zMtR+uAx609sz6gOYlZkrYAXL0uECgYEA8Gqq/Jc1w6I5FTGImnoadKr1VWXBFKdU00p6EMX6Fa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fJIUJx1GnjpfT6/traxEoyOcI6diJa4b2hZpR3WvxTQIDAQAB";
         AlipayConfig alipayConfig = new AlipayConfig();
         alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do");
         alipayConfig.setAppId("2021004173610331");
diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
index cf76b85..71175d4 100644
--- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
+++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java
@@ -563,7 +563,9 @@
         TAppUser byId = appUserService.getById(userId);
         AppUserInfoDto appUserInfoDto = new AppUserInfoDto();
         TVip data = vipClient.getVipInfoByType(2).getData();
-        appUserInfoDto.setMinPrice(data.getMonthlyCard());
+        if(null != data){
+            appUserInfoDto.setMinPrice(data.getMonthlyCard());
+        }
 
         //判断会员
         if (byId.getVipEndTime()==null||byId.getVipEndTime().isBefore(LocalDateTime.now())){
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 76886af..6855288 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
@@ -39,10 +39,7 @@
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
 import java.awt.image.BufferedImage;
-import java.io.BufferedReader;
-import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.PrintWriter;
+import java.io.*;
 import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -143,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();
     }
     
@@ -162,7 +161,7 @@
             response.setContentType("application/force-download");
             response.addHeader("Content-Disposition", "attachment;fileName=" + fileName);
             String url = "https://mxcd.zhinenganguan.com?No=" + code;
-            String filePath = fileUploadConfig.getLocation();
+            String filePath = fileUploadConfig.getLocation() + fileName;
             QRCodeUtils.encode(url, filePath);
             FileInputStream inputStream = new FileInputStream(filePath);
             ServletOutputStream out = response.getOutputStream();
@@ -174,6 +173,17 @@
             out.flush();
             out.close();
             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();
+            }
         }catch (Exception e){
             e.printStackTrace();
         }
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 28b28a6..e021a0f 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
@@ -61,6 +61,7 @@
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.models.auth.In;
 import jdk.nashorn.internal.runtime.ListAdapter;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -139,8 +140,27 @@
     private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService;
 
 
-
-
+    /**
+     * 远程调用根据枪id 查询最新的订单id 用户后台结束充电
+     * @param id
+     * @return
+     */
+    @ResponseBody
+    @PostMapping(value = "/queryOrderByGunId/{id}")
+    public R<String> queryOrderByGunId(@PathVariable("id") String id) {
+        List<Integer> integers = new ArrayList<>();
+        integers.add(2);
+        integers.add(3);
+        integers.add(4);
+        TChargingOrder one = chargingOrderService.lambdaQuery()
+                .eq(TChargingOrder::getChargingGunId, id)
+                .in(TChargingOrder::getStatus, integers)
+                .one();
+        if (one!=null){
+            return R.ok(one.getId().toString());
+        }
+        return R.ok();
+    }
     @ResponseBody
     @PostMapping(value = "/pay/order/list")
     @ApiOperation(value = "列表", tags = {"管理后台-支付订单-订单信息"})

--
Gitblit v1.7.1