Explorar o código

公式相关:复制项目节点参数异常

yangyj %!s(int64=2) %!d(string=hai) anos
pai
achega
3f0a0bb7e0

+ 7 - 6
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsParamController.java

@@ -126,7 +126,7 @@ public class WbsParamController {
                                 keyMap.put("name",e.getName());
                                 keyMap.put("id",e.getId().toString());
                                 tmpMap.put(e.getK(),keyMap);
-                                if(RegexUtil.match(ParamElements.LEVEL_REG,e.getV())){
+                                if(RegexUtil.match(ParamElements.LEVEL_REG,e.getV().trim())){
                                     /*取层级*/
                                     formula.setFormula("FC.tree(trees,WP["+e.getK()+"])");
                                 }else{
@@ -259,7 +259,8 @@ public class WbsParamController {
                             "where c.is_deleted=0 and a.is_deleted=0 and a.parent_id="+ps.getNodeId()+" and c.param_id ="+ps.getParamId()+")as BB " +
                             "on AA.id=BB.id"));
         }else if(ParamSearch.PRI.equals(ps.getScopeType())){
-            WbsTree wtp = this.wbsTreeService.getById(ps.getNodeId());
+           List<Map<String,Object>> listMaps=  this.jdbcTemplate.queryForList("select b.wbs_id wbsId from m_wbs_param a join m_wbs_tree_private b on a.node_id=b.p_key_id where a.id= "+ps.getParamId());
+            String wbsId = StringUtils.handleNull(listMaps.get(0).get("wbsId"));
             return R.data(this.jdbcTemplate.queryForList(
                     "select AA.id,AA.tableName,BB.elementName,BB.mappingId from (" +
                     "        select id ,node_name AS tableName,init_table_id" +
@@ -268,9 +269,9 @@ public class WbsParamController {
                     "          AND is_deleted = 0" +
                     "          AND parent_id = " +ps.getNodeId()+
                     "          AND project_id = " +ps.getProjectId()+
-                    "          AND wbs_id= "+wtp.getWbsId()+
+                    "          AND wbs_id= "+wbsId+
                     "        ORDER BY wt.sort, wt.node_name, wt.create_time) as AA left join (select a.id as id, b.e_name as elementName ,c.id as mappingId,c.is_deleted from m_wbs_tree_private a inner join m_wbs_form_element b on b.f_id=a.init_table_id inner join  m_element_formula_mapping  c on c.element_id=b.id " +
-                            "where  a.project_id="+ps.getProjectId()+" and c.is_deleted=0 and a.is_deleted=0 and a.parent_id="+ps.getNodeId()+" and c.scope=35 and c.param_id ="+ps.getParamId()+" and a.wbs_id="+wtp.getWbsId()+" )as BB on AA.id=BB.id"));
+                            "where  a.project_id="+ps.getProjectId()+" and c.is_deleted=0 and a.is_deleted=0 and a.parent_id="+ps.getNodeId()+" and c.scope=35 and c.param_id ="+ps.getParamId()+" and a.wbs_id="+wbsId+" )as BB on AA.id=BB.id"));
         }
         return R.fail("暂无数据");
     }
@@ -298,7 +299,7 @@ public class WbsParamController {
             keyMap.put("name",param.getName());
             keyMap.put("id",param.getId().toString());
             tmpMap.put(param.getK(),keyMap);
-            if(RegexUtil.match(ParamElements.LEVEL_REG,param.getV())){
+            if(RegexUtil.match(ParamElements.LEVEL_REG,param.getV().trim())){
                 /*取层级*/
                 formula.setFormula("FC.tree(trees,WP["+param.getK()+"])");
             }else{
@@ -358,7 +359,7 @@ public class WbsParamController {
                             keyMap.put("name",e.getName());
                             keyMap.put("id",e.getId().toString());
                             tmpMap.put(e.getK(),keyMap);
-                            if(RegexUtil.match(ParamElements.LEVEL_REG,e.getV())){
+                            if(RegexUtil.match(ParamElements.LEVEL_REG,e.getV().trim())){
                                 /*取层级*/
                                 formula.setFormula("FC.tree(trees,WP["+e.getK()+"])");
                             }else{