From fd3819392c0c3fafc4f1d7d254b952207ddca3b5 Mon Sep 17 00:00:00 2001
From: liuxm <liuxm_a@163.com>
Date: 星期四, 23 五月 2024 10:56:39 +0800
Subject: [PATCH] 产品文件相关修改

---
 pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/product/ProductSv.java |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

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 0ee58f1..86a72d0 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
@@ -12,6 +12,7 @@
 import com.dy.pmsGlobal.pojoOth.OthFile;
 import com.dy.pmsGlobal.pojoPlt.PltProduct;
 import com.dy.pmsGlobal.pojoPlt.PltProductFile;
+import jakarta.servlet.http.HttpServletResponse;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.common.utils.PojoUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -118,19 +119,19 @@
             if(param.id !=null){
                 paramDao.updateByPrimaryKeySelective(param);
             }else{
+                param.deleted=false;
                 paramDao.insert(param);
             }
         });
-        saveRel(p, p.processDocuments, "01");
-        saveRel(p, p.userManual, "02");
-        saveRel(p, p.materials, "03");
+        saveRel(p, p.proFiles);
     }
 
-    private void saveRel(PltProduct p, List<PltProductFile> docs, String fileType) {
+    private void saveRel(PltProduct p, List<PltProductFile> docs) {
         docs.forEach(doc -> {
-            doc.proId = p.id;
-            doc.fileType = fileType;
-            pfDao.insert(doc);
+            if(doc.id == null){
+                doc.proId = p.id;
+                pfDao.insertSelective(doc);
+            }
         });
     }
 
@@ -160,13 +161,13 @@
                 pro.imageWebPathZip = fileOperate.getImgFileZipPath(filePathWithWebUrl);
             }
 
-            Stream.concat(
-                     pro.userManual.stream(),
-                     Stream.concat(pro.processDocuments.stream(), pro.materials.stream())
-             )
-             .forEach(doc -> {
-                 String webUrl = getFilePathWithWebUrl(doc.fileId);
-                 doc.webUrl = webUrl;
+            pro.proFiles.stream().forEach(doc -> {
+                 OthFile file = othFileMapper.selectByPrimaryKey(doc.fileId);
+                 FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash);
+
+                 doc.webUrl = fileRestVo.fileWebUrl + file.filePath;
+                 doc.orgName = file.orgName;
+                 doc.extName = file.extName;
              });
         }
         return pro;
@@ -224,4 +225,7 @@
     }
 
 
+    public void downloadDoc(HttpServletResponse response) {
+        PltProduct pro=dao.selectByPrimaryKey(Long.valueOf(1));
+    }
 }

--
Gitblit v1.8.0