From d35d562b6e743f4eff9480f7a1ecbee890deb438 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Wed, 15 May 2024 14:34:33 +0800
Subject: [PATCH] 测试环境

---
 src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java       |   42 +++++++++++++++++++-----------------------
 src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java |    8 +++++++-
 2 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java
index 7973074..8d98aea 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java
@@ -38,6 +38,7 @@
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -541,6 +542,11 @@
         return null;
     }
 
+
+    // 文件保存目录URL
+    @Value("${static.resource.path}")
+    private String resourcePath;
+
     @PostMapping(value = "/importDeliver")
     @ControllerEndpoint(operation = "导入发货", exceptionMessage = "导入失败")
     public FebsResponse importDeliver(@RequestBody MultipartFile file) throws IOException {
@@ -549,7 +555,7 @@
         }
 
         String fileName = file.getOriginalFilename();
-        String dirPath = "/home/javaweb/webresource/blnka/";
+        String dirPath = resourcePath;
 
         File saveFile = new File(new File(dirPath).getAbsolutePath() + File.separator + fileName);
         if (!saveFile.exists()) {
diff --git a/src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java b/src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java
index 0751acb..52cc8fa 100644
--- a/src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java
@@ -33,6 +33,7 @@
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
@@ -51,21 +52,17 @@
 @RequiredArgsConstructor
 public class XcxPayServiceImpl implements IXcxPayService {
 
-    @Autowired
-    private MallOrderInfoMapper mallOrderInfoMapper;
-    @Autowired
-    private MallMemberMapper mallMemberMapper;
-    @Autowired
-    WeixinServiceUtil weixinServiceUtil;
-    @Autowired
-    private DataDictionaryCustomMapper dataDictionaryCustomMapper;
-    @Autowired
-    private MallMoneyFlowMapper mallMoneyFlowMapper;
-    @Autowired
-    private MallMemberWithdrawMapper mallMemberWithdrawMapper;
+    private final MallOrderInfoMapper mallOrderInfoMapper;
+    private final MallMemberMapper mallMemberMapper;
+    private final WeixinServiceUtil weixinServiceUtil;
+    private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
+    private final MallMoneyFlowMapper mallMoneyFlowMapper;
+    private final MallMemberWithdrawMapper mallMemberWithdrawMapper;
     private final IMallMoneyFlowService mallMoneyFlowService;
-    @Autowired
-    RedisUtils redisUtils;
+
+    private final MallGoodsMapper mallGoodsMapper;
+    private final MallTeamLeaderMapper mallTeamLeaderMapper;
+    private final RedisUtils redisUtils;
 
     private final SpringContextHolder springContextHolder;
 
@@ -290,11 +287,6 @@
         return wxTemplates;
     }
 
-    @Autowired
-    private MallGoodsMapper mallGoodsMapper;
-    @Autowired
-    private MallTeamLeaderMapper mallTeamLeaderMapper;
-
     @Override
     public FebsResponse generateQrCode(WxGenerateQrCodeDto wxGenerateQrCodeDto) {
         Integer type = wxGenerateQrCodeDto.getType();
@@ -411,11 +403,15 @@
      * @param imgName  图片唯一名称
      * @return
      */
-    //图片上传路径
-    public  static  final String IMG_UPLOAD_PATH="/mnt/sdc/webresource/blnka/wxcode";
+    // 文件保存目录路径
+    @Value("${static.resource.url}")
+    private String resourceUrl;
+    // 文件保存目录URL
+    @Value("${static.resource.path}")
+    private String resourcePath;
     public  String generateAcode(String scene,String path,String imgName,String width, Integer type){
-        String urlPrefix="https://file.blnka.cn/blnka/wxcode";
-        String imgPath=IMG_UPLOAD_PATH+imgName;
+        String urlPrefix = resourceUrl + "/wxcode";
+        String imgPath=resourcePath +"/wxcode"+imgName;
         if(!FileUtil.exist(imgPath)){
 
             cn.hutool.json.JSONObject obj = JSONUtil.createObj();

--
Gitblit v1.9.1