Quellcode durchsuchen

公式相关:节点参数公式

yangyj vor 1 Jahr
Ursprung
Commit
ab7ff9ee42

+ 35 - 24
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -1836,31 +1836,42 @@ public class InformationWriteQueryController extends BladeController {
         if (wtc != null) {
             try {
                 String tableName = wtc.getInitTableName();
-                if (parent == null) {
-                    parent = this.wbsTreeContractClient.getContractWbsTreeByContractIdAndId(wtc.getParentId(), Long.parseLong(wtc.getContractId()));
-                }
-                if (checkG8(tableName) && !ekvMap.containsKey(tableName)) {
-                    List<Map<String, Object>> listMaps = this.jdbcTemplate.queryForList("select rely from m_formula where number ='TURN_POINT' limit 1");
-                    if (listMaps.size() > 0) {
-                        String rely = listMaps.get(0).get("rely").toString();
-                        ekvMap.put(tableName, Arrays.stream(rely.split("[,]")).skip(1).map(e -> e.split(":")[1]).collect(Collectors.toMap(e -> e, e -> "null")));
-                    }
-                } else {
-                    FormulaOption formulaOption = this.formulaClient.option(parent.getPKeyId());
-                    if (formulaOption != null) {
-                        JSONObject root = JSON.parseObject(formulaOption.getVal());
-                        JSONObject table = (JSONObject) root.computeIfAbsent(wtc.getInitTableName(), (k) -> new JSONObject());
-                        Map<String, String> map = ekvMap.computeIfAbsent(wtc.getInitTableName(), K -> new HashMap<>());
-                        table.forEach((k, v) -> {
-                            if (!k.contains("@")) {
-                                /*元素级别*/
-                                JSONObject elementJson = (JSONObject) v;
-                                JSONArray rgJson = elementJson.getJSONArray(RangeInfo.RG);
-                                if (rgJson != null) {
-                                    map.put(k, rgJson.toJSONString());
+                if(!ekvMap.containsKey(tableName)) {
+                    Map<String, String> map = ekvMap.computeIfAbsent(wtc.getInitTableName(), K -> new HashMap<>());
+                    if (parent == null) {
+                        parent = this.wbsTreeContractClient.getContractWbsTreeByContractIdAndId(wtc.getParentId(), Long.parseLong(wtc.getContractId()));
+                    }
+                    /*节点公式*/
+                    List<Map<String, Object>> paramKey = this.jdbcTemplate.queryForList("select DISTINCT b.e_key ek from m_table_info a  join m_wbs_form_element b on a.id=b.f_id  join m_element_formula_mapping c on b.id = c.element_id where a.tab_en_name='" + tableName + "' and b.is_deleted=0 and c.scope=35 ");
+                    if (paramKey.size() > 0) {
+                        map.putAll(paramKey.stream().map(m -> m.get("ek").toString()).collect(Collectors.toMap(s -> s, s -> StringPool.NULL)));
+                    }
+                    /*G8肯定不会用右键生成数据*/
+                    if (checkG8(tableName)) {
+                        List<Map<String, Object>> listMaps = this.jdbcTemplate.queryForList("select rely from m_formula where number ='TURN_POINT' limit 1");
+                        if (listMaps.size() > 0) {
+                            String rely = listMaps.get(0).get("rely").toString();
+                            /* Map<String, String> map = ekvMap.computeIfAbsent(wtc.getInitTableName(), K -> new HashMap<>());*/
+                            map.putAll(Arrays.stream(rely.split("[,]")).skip(1).map(e -> e.split(":")[1]).collect(Collectors.toMap(e -> e, e -> StringPool.NULL)));
+                            /*ekvMap.put(tableName, Arrays.stream(rely.split("[,]")).skip(1).map(e -> e.split(":")[1]).collect(Collectors.toMap(e -> e, e -> "null")));*/
+                        }
+                    } else {
+                        FormulaOption formulaOption = this.formulaClient.option(parent.getPKeyId());
+                        if (formulaOption != null) {
+                            JSONObject root = JSON.parseObject(formulaOption.getVal());
+                            JSONObject table = (JSONObject) root.computeIfAbsent(wtc.getInitTableName(), (k) -> new JSONObject());
+                            /*Map<String, String> map = ekvMap.computeIfAbsent(wtc.getInitTableName(), K -> new HashMap<>());*/
+                            table.forEach((k, v) -> {
+                                if (!k.contains("@")) {
+                                    /*元素级别*/
+                                    JSONObject elementJson = (JSONObject) v;
+                                    JSONArray rgJson = elementJson.getJSONArray(RangeInfo.RG);
+                                    if (rgJson != null) {
+                                        map.put(k, rgJson.toJSONString());
+                                    }
                                 }
-                            }
-                        });
+                            });
+                        }
                     }
                 }
                 return ekvMap.getOrDefault(tableName, new HashMap<>());

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

@@ -2261,7 +2261,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             WbsTreeContract node = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getId, wtc.getParentId()).eq(WbsTreeContract::getContractId,wtc.getContractId()));
             Long privatePkeyId=node.getIsTypePrivatePid();
             /*项目节点*/
-            if(privatePkeyId==null) {
+            if(!(privatePkeyId!=null&&privatePkeyId>0)) {
                 WbsTreePrivate wtp = this.wtpId(node.getPKeyId());
                 privatePkeyId=wtp.getPKeyId();
             }

+ 0 - 9
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsParamServiceImpl.java

@@ -140,15 +140,6 @@ public class WbsParamServiceImpl extends BaseServiceImpl<WbsParamMapper, WbsPara
                 result.put("待删除参数", removeWpIds.size());
                 result.put("待删除中间关联", removeMapingIds.size());
                 result.put("待删除公式", removeFormulaIds.size());
-//                if(removeWpIds.size()>0) {
-//                    this.deleteLogic(removeWpIds);
-//                }
-//                if(removeMapingIds.size()>0){
-//                    this.elementFormulaMappingService.deleteLogic(removeMapingIds);
-//                }
-//                if(removeFormulaIds.size()>0){
-//                    this.formulaService.deleteLogic(removeFormulaIds);
-//                }
                 if(removeWpIds.size()>0) {
                     batchDel(this,removeWpIds);
                 }