From caf6eebe5758fa4e6d74811e128187531f4d9c46 Mon Sep 17 00:00:00 2001
From: 刘小明 <liuxm_a@163.com>
Date: 星期四, 15 八月 2024 17:05:34 +0800
Subject: [PATCH] 修改webDownloadPath及下载文件路径拼接

---
 pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java         |   54 +++++++++---------
 pms-parent/pms-global/src/main/resources/application-global.yml                             |   28 ++++----
 pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java |   42 +++++++-------
 3 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/pms-parent/pms-global/src/main/resources/application-global.yml b/pms-parent/pms-global/src/main/resources/application-global.yml
index f9f3ba4..690b37c 100644
--- a/pms-parent/pms-global/src/main/resources/application-global.yml
+++ b/pms-parent/pms-global/src/main/resources/application-global.yml
@@ -118,9 +118,9 @@
             relativePath: webFile1
             hashStart: 0
             hashEnd: 5461
-            restUrl: http://127.0.0.1:${pms.file1.webPort}/file #file鏄笂涓嬫枃
-            webUrl: http://127.0.0.1:${pms.nginx.webPort}/webfiles/ #nginx鏈嶅姟璺緞
-            webDownloadPath: /download/down?id=  #瀹為檯涓嬭浇webUrl= restUrl + webDownloadPath
+            restUrl: http://127.0.0.1:${pms.file1.webPort}/file #file鏄笂涓嬫枃,ip涓哄眬鍩熺綉ip鎴栨湰鍦癐P
+            webUrl: http://127.0.0.1:${pms.nginx.webPort}/webfiles/ #nginx鏈嶅姟璺緞,瀹夎閮ㄧ讲鏃禝P鏀规垚澶栫綉IP鎴栧煙鍚�
+            webDownloadPath: http://127.0.0.1:${pms.file1.webPort}/file/download/down?id=  #瀹夎閮ㄧ讲鏃禝P鏀规垚澶栫綉IP鎴栧煙鍚�
         sv2:
             id: dyFile2
             absolutePath: E:/java/nginx-1.24.0/html/webfiles/
@@ -129,7 +129,7 @@
             hashEnd: 10923
             restUrl: http://127.0.0.1:${pms.file2.webPort}/file
             webUrl: http://127.0.0.1:${pms.nginx.webPort}/webfiles/
-            webDownloadPath: /download/down?id=
+            webDownloadPath: http://127.0.0.1:${pms.file2.webPort}/file/download/down?id=
         sv3:
             id: dyFile3
             absolutePath: E:/java/nginx-1.24.0/html/webfiles/
@@ -138,7 +138,7 @@
             hashEnd: 16385
             restUrl: http://127.0.0.1:${pms.file3.webPort}/file
             webUrl: http://127.0.0.1:${pms.nginx.webPort}/webfiles/
-            webDownloadPath: /download/down?id=
+            webDownloadPath: http://127.0.0.1:${pms.file3.webPort}/file/download/down?id=
         sv4:
             id: dyFile4
             absolutePath: E:/java/nginx-1.24.0/html/webfiles/
@@ -147,7 +147,7 @@
             hashEnd: 21847
             restUrl: http://127.0.0.1:${pms.file4.webPort}/file
             webUrl: http://127.0.0.1:${pms.nginx.webPort}/webfiles/
-            webDownloadPath: /download/down?id=
+            webDownloadPath: http://127.0.0.1:${pms.file4.webPort}/file/download/down?id=
         sv5:
             id: dyFile5
             absolutePath: E:/java/nginx-1.24.0/html/webfiles/
@@ -156,7 +156,7 @@
             hashEnd: 27309
             restUrl: http://127.0.0.1:${pms.file5.webPort}/file
             webUrl: http://127.0.0.1:${pms.nginx.webPort}/webfiles/
-            webDownloadPath: /download/down?id=
+            webDownloadPath: http://127.0.0.1:${pms.file5.webPort}/file/download/down?id=
         sv6:
             id: dyFile6
             absolutePath: E:/java/nginx-1.24.0/html/webfiles/
@@ -165,7 +165,7 @@
             hashEnd: 32767
             restUrl: http://127.0.0.1:${pms.file6.webPort}/file
             webUrl: http://127.0.0.1:${pms.nginx.webPort}/webfiles/
-            webDownloadPath: /download/down?id=
+            webDownloadPath: http://127.0.0.1:${pms.file6.webPort}/file/download/down?id=
         sv7:
             id: dyFile7
             absolutePath: E:/java/nginx-1.24.0/html/webfiles/
@@ -174,7 +174,7 @@
             hashEnd: 38229
             restUrl: http://127.0.0.1:${pms.file7.webPort}/file
             webUrl: http://127.0.0.1:${pms.nginx.webPort}/webfiles/
-            webDownloadPath: /download/down?id=
+            webDownloadPath: http://127.0.0.1:${pms.file7.webPort}/file/download/down?id=
         sv8:
             id: dyFile8
             absolutePath: E:/java/nginx-1.24.0/html/webfiles/
@@ -183,7 +183,7 @@
             hashEnd: 43691
             restUrl: http://127.0.0.1:${pms.file8.webPort}/file
             webUrl: http://127.0.0.1:${pms.nginx.webPort}/webfiles/
-            webDownloadPath: /download/down?id=
+            webDownloadPath: http://127.0.0.1:${pms.file8.webPort}/file/download/down?id=
         sv9:
             id: dyFile9
             absolutePath: E:/java/nginx-1.24.0/html/webfiles/
@@ -192,7 +192,7 @@
             hashEnd: 49153
             restUrl: http://127.0.0.1:${pms.file9.webPort}/file
             webUrl: http://127.0.0.1:${pms.nginx.webPort}/webfiles/
-            webDownloadPath: /download/down?id=
+            webDownloadPath: http://127.0.0.1:${pms.file9.webPort}/file/download/down?id=
         sv10:
             id: dyFile10
             absolutePath: E:/java/nginx-1.24.0/html/webfiles/
@@ -201,7 +201,7 @@
             hashEnd: 54615
             restUrl: http://127.0.0.1:${pms.file10.webPort}/file
             webUrl: http://127.0.0.1:${pms.nginx.webPort}/webfiles/
-            webDownloadPath: /download/down?id=
+            webDownloadPath: http://127.0.0.1:${pms.file10.webPort}/file/download/down?id=
         sv11:
             id: dyFile11
             absolutePath: E:/java/nginx-1.24.0/html/webfiles/
@@ -210,7 +210,7 @@
             hashEnd: 60077
             restUrl: http://127.0.0.1:${pms.file11.webPort}/file
             webUrl: http://127.0.0.1:${pms.nginx.webPort}/webfiles/
-            webDownloadPath: /download/down?id=
+            webDownloadPath: http://127.0.0.1:${pms.file11.webPort}/file/download/down?id=
         sv12:
             id: dyFile12
             absolutePath: E:/java/nginx-1.24.0/html/webfiles/
@@ -219,4 +219,4 @@
             hashEnd: 65535
             restUrl: http://127.0.0.1:${pms.file12.webPort}/file
             webUrl: http://127.0.0.1:${pms.nginx.webPort}/webfiles/
-            webDownloadPath: /download/down?id=
+            webDownloadPath: http://127.0.0.1:${pms.file12.webPort}/file/download/down?id=
diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
index 84f5689..35e7675 100644
--- a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
+++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java
@@ -177,7 +177,7 @@
                      return;
                  }
                  FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash);
-                 doc.webUrl = fileRestVo.fileSysRestUrl + fileRestVo.fileWebDownloadPath + doc.fileId;
+                 doc.webUrl = fileRestVo.fileWebDownloadPath + doc.fileId;
                  doc.orgName = file.orgName;
                  doc.extName = file.extName;
              });
@@ -211,37 +211,37 @@
                     item.qrCode = "data:image/jpeg;base64," + Base64.encode(codes);
                     item = addWebUrl(item);
                 } catch (IOException e) {
-                    e.printStackTrace();
+                    log.error("IOException:",e);
                 } catch (WriterException e) {
-                    e.printStackTrace();
+                    log.error("WriterException:",e);
                 }
             });
         }
         return rsVo ;
     }
 
-    /**
-     * 娣诲姞浜у搧鏂囨。鍏宠仈
-     * @param proId 浜у搧id
-     * @param fileId 鏂囨。id
-     * @return 鏇存柊鏁伴噺
-     */
-    public int addDoc(long proId,long fileId,String fileType){
-        PltProductFile pf=new PltProductFile();
-        pf.fileId = fileId;
-        pf.proId = proId;
-        pf.fileType = fileType;
-        return pfDao.insertSelective(pf);
-    }
+//    /**
+//     * 娣诲姞浜у搧鏂囨。鍏宠仈
+//     * @param proId 浜у搧id
+//     * @param fileId 鏂囨。id
+//     * @return 鏇存柊鏁伴噺
+//     */
+//    public int addDoc(long proId,long fileId,String fileType){
+//        PltProductFile pf=new PltProductFile();
+//        pf.fileId = fileId;
+//        pf.proId = proId;
+//        pf.fileType = fileType;
+//        return pfDao.insertSelective(pf);
+//    }
 
-    /**
-     * 鏌ヨ浜у搧鍏宠仈鏂囨。
-     * @param proId 浜у搧id
-     * @return 杩斿洖鍏宠仈鏂囨。闆嗗悎
-     */
-    public List<OthFile> selectDoc(long proId){
-        return othFileMapper.selectByProId(proId);
-    }
+//    /**
+//     * 鏌ヨ浜у搧鍏宠仈鏂囨。
+//     * @param proId 浜у搧id
+//     * @return 杩斿洖鍏宠仈鏂囨。闆嗗悎
+//     */
+//    public List<OthFile> selectDoc(long proId){
+//        return othFileMapper.selectByProId(proId);
+//    }
 
 
     public List<PltProduct> selectAll(QueryVo queryVo) {
@@ -250,7 +250,7 @@
     }
 
 
-    public void downloadDoc(HttpServletResponse response) {
-        PltProduct pro=dao.selectByPrimaryKey(Long.valueOf(1));
-    }
+//    public void downloadDoc(HttpServletResponse response) {
+//        PltProduct pro=dao.selectByPrimaryKey(Long.valueOf(1));
+//    }
 }
diff --git a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java
index f825f4a..56e24e4 100644
--- a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java
+++ b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/assemblyStep/AssemblyStepSv.java
@@ -524,27 +524,27 @@
         ins.extName = file.extName;
     }
 
-    private PltProduct addWebUrl(PltProduct pro) {
-        if (pro != null) {
-            if (pro.image != null) {
-                String filePathWithWebUrl = getFilePathWithWebUrl(pro.image);
-                pro.imageWebPath = filePathWithWebUrl;
-                pro.imageWebPathZip = fileOperate.getImgFileZipPath(filePathWithWebUrl);
-            }
-
-            pro.proFiles.stream().forEach(doc -> {
-                OthFile file = othFileMapper.selectByPrimaryKey(doc.fileId);
-                if (file == null) {
-                    return;
-                }
-                FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash);
-                doc.webUrl = fileRestVo.fileSysRestUrl + fileRestVo.fileWebDownloadPath + doc.fileId;
-                doc.orgName = file.orgName;
-                doc.extName = file.extName;
-            });
-        }
-        return pro;
-    }
+//    private PltProduct addWebUrl(PltProduct pro) {
+//        if (pro != null) {
+//            if (pro.image != null) {
+//                String filePathWithWebUrl = getFilePathWithWebUrl(pro.image);
+//                pro.imageWebPath = filePathWithWebUrl;
+//                pro.imageWebPathZip = fileOperate.getImgFileZipPath(filePathWithWebUrl);
+//            }
+//
+//            pro.proFiles.stream().forEach(doc -> {
+//                OthFile file = othFileMapper.selectByPrimaryKey(doc.fileId);
+//                if (file == null) {
+//                    return;
+//                }
+//                FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash);
+//                doc.webUrl = fileRestVo.fileWebDownloadPath + doc.fileId;
+//                doc.orgName = file.orgName;
+//                doc.extName = file.extName;
+//            });
+//        }
+//        return pro;
+//    }
 
     private String getFilePathWithWebUrl(Long fileId) {
         OthFile file = othFileMapper.selectByPrimaryKey(fileId);

--
Gitblit v1.8.0