From 54bd44a8c4d5052d86410e552c41d94370868c40 Mon Sep 17 00:00:00 2001
From: whycxzp <perryhsu@163.com>
Date: 星期五, 26 八月 2022 10:40:35 +0800
Subject: [PATCH] 问题修复

---
 src/main/java/com/whyc/service/WorksheetLinkService.java |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/whyc/service/WorksheetLinkService.java b/src/main/java/com/whyc/service/WorksheetLinkService.java
index bbfc99e..dc08c90 100644
--- a/src/main/java/com/whyc/service/WorksheetLinkService.java
+++ b/src/main/java/com/whyc/service/WorksheetLinkService.java
@@ -144,10 +144,10 @@
                 String parentModel = productApproving.getParentModel();
                 String parentCode = productApproving.getParentCode();
                 String customCode = productApproving.getCustomCode();
-                Product product = productService.getVersion(parentCode, customCode);
+                ProductHistory latestProduct = phService.getLatestVersion(parentCode, customCode);
                 int currentVersion = 0;
-                if (product != null) {
-                    currentVersion = product.getVersion();
+                if (latestProduct != null) {
+                    currentVersion = latestProduct.getVersion();
                 }
                 Integer nextVersion = currentVersion + 1;
                 //灏嗕骇鍝佹枃浠跺鍒惰嚦姝e紡璺緞
@@ -211,10 +211,10 @@
                 //doc_file/product/{浜у搧鍨嬪彿}/standard鎴栬�厈customCode}}/{version}/
                 //璺熷瓙浠舵寕閽╃殑杞Щ鍒板瓙浠跺浘绾镐笅:doc_file/material/
                 String customCodeString = null;
-                if(customCode==null) {
-                    customCodeString = "standard";
-                }else{
+                if(customCode!=null && !customCode.equals("")) {
                     customCodeString = customCode;
+                }else{
+                    customCodeString = "standard";
                 }
                 String productDir = projectDir + File.separator + "doc_file" + File.separator + "product" + File.separator + parentModel
                         + File.separator + customCodeString + File.separator +nextVersion;
@@ -351,8 +351,9 @@
                         materialList.add(temp);
                     }
                 });
-                mService.insertBatch(materialList);
-
+                if(materialList.size()!=0) {
+                    mService.insertBatch(materialList);
+                }
                 //灏哾wg鍥剧焊,鍏ㄩ儴鏇存柊鍒板搴旂殑璁板綍url涓�
                 mService.updateDwgUrl(materialDwgUrlNameList);
                 /*List<ProductBomApproving> fileBomApprovingList = approvingList.stream()

--
Gitblit v1.9.1