From 774e1e7283ce4bc5d4e8166806cc7a6f117adf39 Mon Sep 17 00:00:00 2001 From: he wei <858544502@qq.com> Date: 星期四, 11 八月 2022 10:46:02 +0800 Subject: [PATCH] '仲培调试' --- src/main/java/com/whyc/service/WorksheetLinkService.java | 40 ++++++++++++++++++++++------------------ 1 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/whyc/service/WorksheetLinkService.java b/src/main/java/com/whyc/service/WorksheetLinkService.java index 68ff759..10de558 100644 --- a/src/main/java/com/whyc/service/WorksheetLinkService.java +++ b/src/main/java/com/whyc/service/WorksheetLinkService.java @@ -309,14 +309,16 @@ nowHistoryList.remove(nowHistory); } });*/ - Iterator<ComponentProductHistory> iterator = nowHistoryList.iterator(); - while (iterator.hasNext()){ - ComponentProductHistory next = iterator.next(); - if(replace.getComponentId().intValue() == next.getComponentId() - && replace.getSubName().equals(next.getSubName()) - ){ - iterator.remove(); - break; + if(nowHistoryList.size()!=0) { + Iterator<ComponentProductHistory> iterator = nowHistoryList.iterator(); + while (iterator.hasNext()) { + ComponentProductHistory next = iterator.next(); + if (replace.getComponentId().intValue() == next.getComponentId() + && replace.getSubName().equals(next.getSubName()) + ) { + iterator.remove(); + break; + } } } //涓嬩釜鐗堟湰鏂板鏇挎崲鐨勬暎瑁呬欢-浜у搧鍒楄〃 @@ -352,14 +354,16 @@ nowHistoryList.remove(nowHistory); } });*/ - Iterator<ComponentProductHistory> iterator = nowHistoryList.iterator(); - while (iterator.hasNext()){ - ComponentProductHistory next = iterator.next(); - if(add.getComponentId().intValue() == next.getComponentId() - && add.getSubName().equals(next.getSubName()) - ){ - iterator.remove(); - break; + if(nowHistoryList.size()!=0) { + Iterator<ComponentProductHistory> iterator = nowHistoryList.iterator(); + while (iterator.hasNext()) { + ComponentProductHistory next = iterator.next(); + if (add.getComponentId().intValue() == next.getComponentId() + && add.getSubName().equals(next.getSubName()) + ) { + iterator.remove(); + break; + } } } @@ -377,8 +381,8 @@ //澶勭悊瀹屾垚,杩涜琛ㄥ崟鏁版嵁鏇存柊,鍒嗕负nowHistoryList,newHistoryList,nowBomHistoryList //nowHistoryList.forEach(nowHis->nowHis.setEVersion(nextVersion)); - newHistoryList.forEach(newHis->{newHis.setEVersion(nextVersion);newHis.setSVersion(nextVersion);}); - nowBomHistoryList.forEach(nowBomHis->nowBomHis.setEVersion(nextVersion)); + if(newHistoryList.size()!=0){newHistoryList.forEach(newHis->{newHis.setEVersion(nextVersion);newHis.setSVersion(nextVersion);});} + if(nowBomHistoryList.size()!=0){nowBomHistoryList.forEach(nowBomHis->nowBomHis.setEVersion(nextVersion));} if(nowHistoryList.size()!=0){cphService.updateVersionBatch(nowHistoryList);} if(newHistoryList.size()!=0){cphService.insertBatch(newHistoryList);} -- Gitblit v1.9.1