From d4d0c3614930df9a7877ba353cca97db6c99cdc4 Mon Sep 17 00:00:00 2001
From: whycxzp <perryhsu@163.com>
Date: 星期三, 27 七月 2022 11:20:34 +0800
Subject: [PATCH] 更新工作流

---
 src/main/java/com/whyc/service/WorksheetLinkService.java |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/whyc/service/WorksheetLinkService.java b/src/main/java/com/whyc/service/WorksheetLinkService.java
index 23040b1..5be7048 100644
--- a/src/main/java/com/whyc/service/WorksheetLinkService.java
+++ b/src/main/java/com/whyc/service/WorksheetLinkService.java
@@ -107,7 +107,7 @@
                 currentVersion = 0;
             }
             Integer nextVersion = currentVersion+1;
-            //鏇存柊鍒皃roduct_bom_history,闇�瑕乻Version鍜宔Version
+            //鏇存柊鍒皃roduct_bom_history,澧炲姞杩涘幓鐨勯渶瑕乻Version鍜宔Version涓�鑷�
             //澧炲姞鎵�鏈夐儴浠�,鎺掓煡鍑虹浉鍏崇殑鍘熼儴浠�,闈炰篃鏄洿鏂�
             List<ProductBomHistory> currentHistoryList = historyService.getListByParentModel(approvingList.get(0).getParentModel(),currentVersion);
             List<String> currentSubNameList = currentHistoryList.stream().map(ProductBomHistory::getSubName).collect(Collectors.toList());
@@ -124,7 +124,7 @@
                 his.setCategory(approvingBom.getCategory());
                 his.setCreateDate(approvingBom.getCreateDate());
                 his.setDwgUrl(approvingBom.getDwgUrl());
-                his.seteVersion(nextVersion);
+                his.setEVersion(nextVersion);
                 his.setFileUrl(approvingBom.getFileUrl());
                 his.setMaterial(approvingBom.getMaterial());
                 his.setNotes(approvingBom.getNotes());
@@ -139,7 +139,7 @@
                 his.setSubModel(approvingBom.getSubModel());
                 his.setSubName(approvingBom.getSubName());
                 his.setSurfaceDetail(approvingBom.getSurfaceDetail());
-                his.setsVersion(nextVersion);
+                his.setSVersion(nextVersion);
                 his.setThickness(approvingBom.getThickness());
                 his.setType(approvingBom.getType());
                 his.setUnit(approvingBom.getUnit());
@@ -151,12 +151,19 @@
             //鏈瀹℃牳涓瓙浠惰淇敼鐨勫瓙浠堕泦鍚�
             List<String> approvingUpdateSubNameList = approvingList.stream().filter(approvingBom -> approvingBom.getVersion() == 1).map(ProductBomApproving::getSubName).collect(Collectors.toList());
 
-            //鏇存柊鍒皃roduct_bom
             historyService.addBatch(newHistoryList);
             /*鏇存柊浜у搧鐨勫綋鍓嶇増鏈�,鏇存柊鍒版渶鏂扮殑鐗堟湰*/
-            //褰撳墠鐗堟湰鐨勬墍鏈塨om,鎺掗櫎
-            //currentHistoryList.stream().filter(currentHistory->currentHistory.getSubName());
+            //褰撳墠鐗堟湰鐨勬墍鏈塨om鐨別Version鏇存柊,鎺掗櫎琚慨鏀圭殑瀛愪欢
+            List<ProductBomHistory> newVersionCurrentHistoryList = currentHistoryList.stream()
+                    .filter(currentHistory -> !approvingUpdateSubNameList.contains(currentHistory.getSubName()))
+                    .collect(Collectors.toList());
+            newVersionCurrentHistoryList.forEach(history->{history.setEVersion(nextVersion);});
+            historyService.updateVersionBatch(newVersionCurrentHistoryList);
 
+            /*鏇存柊鍒皃roduct_bom*/
+            //鏌ヨ鏂扮殑鐗堟湰
+            List<ProductBomHistory> newBomList = historyService.getListByParentModel(approvingList.get(0).getParentModel(), nextVersion);
+            bomService.updateNewBom(newBomList);
 
             /*String projectDir = CommonUtil.getProjectDir();
             FileUtil.copyDir()*/

--
Gitblit v1.9.1