liuyc hace 2 años
padre
commit
bcfac561ac

+ 11 - 12
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeServiceImpl.java

@@ -897,14 +897,17 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
 
     @Async
     public boolean insertTextDictInfoAsync(List<WbsTreePrivate> wbsTreePrivateOldTables, List<WbsTreePrivate> wbsTreePrivateNewTables) {
+        //获取所有电签配置信息
+        List<TextdictInfo> textDictInfos = textdictInfoMapper.selectList(Wrappers.<TextdictInfo>query().lambda());
+
         //wbsTreePrivateOldTables=原始引用的元素表 wbsTreePrivateNewTables=现在项目树的元素表
         Map<Long, List<TextdictInfo>> textDictInfoData = new HashMap<>();
         if (wbsTreePrivateOldTables.size() > 0) {
             for (WbsTreePrivate wbsTreePrivate : wbsTreePrivateOldTables) {
                 //私有引用-电签匹配数据、默认信息数据,根据元素表pKeyId,获取电签位置匹配信息、编辑默认信息
-                List<TextdictInfo> textDictInfos = textdictInfoMapper.selectList(Wrappers.<TextdictInfo>query().lambda().eq(TextdictInfo::getTabId, wbsTreePrivate.getPKeyId()));
-                if (textDictInfos.size() > 0) {
-                    textDictInfoData.put(wbsTreePrivate.getId(), textDictInfos);
+                List<TextdictInfo> collect = textDictInfos.stream().filter(f -> f.getTabId().equals(String.valueOf(wbsTreePrivate.getPKeyId()))).collect(Collectors.toList());
+                if (collect.size() > 0) {
+                    textDictInfoData.put(wbsTreePrivate.getId(), collect);
                 }
             }
         }
@@ -928,16 +931,12 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
             Iterator<TextdictInfo> iterator = insertData.iterator();
             while (iterator.hasNext()) {
                 TextdictInfo textDictInfo = iterator.next();
-                TextdictInfo textDict = textdictInfoMapper.selectOne(Wrappers.<TextdictInfo>query().lambda()
-                        .eq(TextdictInfo::getColKey, textDictInfo.getColKey())
-                        .eq(TextdictInfo::getTabId, textDictInfo.getTabId())
-                        .eq(TextdictInfo::getType, textDictInfo.getType())
-                );
-                if (textDict != null) {
-                    iterator.remove();
-                }
+                textDictInfos.stream().filter(f ->
+                        f.getColKey().equals(textDictInfo.getColKey())
+                                && f.getTabId().equals(textDictInfo.getTabId())
+                                && f.getType().equals(textDictInfo.getType())
+                ).findAny().ifPresent(textDict -> iterator.remove());
             }
-
             textDictInfoService.saveBatch(insertData, 1000);
             return true;
         }