Browse Source

评定表公式数据获取优化

lvy 1 tháng trước cách đây
mục cha
commit
b1c0dc3ddd

+ 10 - 6
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -404,12 +404,18 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                         itemsMap.values().stream().filter(Measurement::isMatching).forEach(t -> {
                             ElementBlock g = null;
                             FormData vfd = t.getValue();
+                            List<CurrentNode> nodeType46 = getNodeType46(tec);
+                            List<Long> ids = nodeType46.stream().map(CurrentNode::getPkId).collect(Collectors.toList());
                             if (vfd.executable() && vfd.getFormula().getRelyList() != null) {
                                 List<String> relyList = vfd.getFormula().getRelyList();
                                 /*先从公式去匹配*/
-                                Optional<ElementBlock> op = elementBlockList.stream().filter(e -> relyList.contains(e.getCode())).findAny();
-                                if (op.isPresent()) {
-                                    g = op.get();
+                                List<ElementBlock> list = elementBlockList.stream().filter(e -> relyList.contains(e.getCode())).collect(Collectors.toList());
+                                for (ElementBlock e : list) {
+                                    e.getList().removeIf(ik -> !ids.contains(ik.getPkeyId()));
+                                    if (!e.getList().isEmpty()) {
+                                        g = e;
+                                        break;
+                                    }
                                 }
                             } else {
                                 /*只有不存在配置的前提下才能尝试自动匹配*/
@@ -422,7 +428,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                             if (g != null) {
                                 /*手写部分的数据加载*/
                                 if (t.getPoint().contains("混凝土强度") && false) {
-                                    List<Long> ids = getNodeType46(tec).stream().map(CurrentNode::getPkId).collect(Collectors.toList());
+//                                    List<Long> ids = getNodeType46(tec).stream().map(CurrentNode::getPkId).collect(Collectors.toList());
                                     /*质检附表m_20230316104657_1636197331206406144*/
                                     List<Map<String, Object>> listMaps = this.jdbcTemplate.queryForList("select a.p_key_id,b.key_10 name,b.key_6 design,b.key_5 data from m_wbs_tree_contract a join m_20230316104657_1636197331206406144 b on a.p_key_id=b.p_key_id where  a.is_deleted=0 and a.parent_id =" + tec.getCurrentNode().getId());
                                     if (listMaps.size() > 0) {
@@ -462,8 +468,6 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
 
                                 List<ItemBlock> itemBlockList = g.getList();
                                 int originSize = itemBlockList.size();
-                                List<CurrentNode> nodeType46 = getNodeType46(tec);
-                                List<Long> ids = nodeType46.stream().map(CurrentNode::getPkId).collect(Collectors.toList());
 
                                 Map<Long, CurrentNode> sortInfoMap  = nodeType46.stream().collect(Collectors.toMap(CurrentNode::getPkId, info -> info,
                                         (oldInfo, newInfo) -> newInfo));