Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/test-merge' into test-merge

LHB 2 dní pred
rodič
commit
9c1c10ff38

+ 10 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/GetNameRuleListDTO.java

@@ -0,0 +1,10 @@
+package org.springblade.business.dto;
+
+import lombok.Data;
+
+import java.util.List;
+@Data
+public class GetNameRuleListDTO {
+      private  List<PreviewNodeNameDTO> dtos;
+      private Integer templateType;
+}

+ 146 - 129
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -31,6 +31,8 @@ import org.springblade.business.dto.WbsTreeContractStatisticsDTO;
 import org.springblade.business.dto.FlushQueryNameDTO;
 import org.springblade.business.dto.PreviewNodeNameDTO;
 import org.springblade.business.dto.PreviewNodeNameDTO1;
+import org.springblade.business.dto.*;
+import org.springblade.business.dto.FlushQueryNameDTO;
 import org.springblade.business.entity.*;
 import org.springblade.business.feign.MessageWarningClient;
 import org.springblade.business.feign.OperationLogClient;
@@ -233,41 +235,56 @@ public class InformationWriteQueryController extends BladeController {
                 sgSuffix=projectInfos.get(0).getSgSuffix()==null?"":projectInfos.get(0).getSgSuffix();
                 jlSuffix=projectInfos.get(0).getJlSuffix()==null?"":projectInfos.get(0).getJlSuffix();
             }
-            for (InformationQuery query : queryList) {
-                String result="";
-                String sql="select * from m_wbs_tree_contract where p_key_id="+query.getWbsId()+" and is_deleted=0";
-                WbsTreeContract contract = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
-                if(dto.getType()==1){
-                    result=wbsParamClient.createFileTitle(contract);
-                }else {
-                    result=nodeNameMap.get(query.getId());
-                    //同时修改工程划分节点命名规则
-                    if(contract!=null){
-                        wbsTreeContractClient.saveNameRuleByPkeyId(contract.getPKeyId(),paramMap.get(query.getId()),Long.parseLong(contract.getProjectId()));
-                    }
-                }
-                if(contract!=null&&contract.getMajorDataType()!=null&&contract.getMajorDataType()==4){
-                    if(result==null){
-                        result="";
-                    }
-                    if(query.getClassify()!=null&&query.getClassify()==1&&StringUtils.isNotEmpty(sgSuffix)){
-                        if(!result.contains(sgSuffix)){
-                            result=result+sgSuffix;
+                for (InformationQuery query : queryList) {
+                    String result="";
+                    String sql="select * from m_wbs_tree_contract where p_key_id="+query.getWbsId()+" and is_deleted=0";
+                    WbsTreeContract contract = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+                    //底层节点
+                    if(projectInfos.get(0).getTemplateType()==2){
+                        if(dto.getType()==1){
+                            result=wbsParamClient.createFileTitle(contract);
+                        }else {
+                            result=nodeNameMap.get(query.getId());
+                            //同时修改工程划分节点命名规则
+                            if(contract!=null){
+                                wbsTreeContractClient.saveNameRuleByPkeyId(contract.getPKeyId(),paramMap.get(query.getId()),Long.parseLong(contract.getProjectId()));
+                            }
                         }
-                        if(!query.getName().equals(result)){
-                            query.setName(result);
+                    }else {
+                        String mbnameRule = paramMap.get(query.getId());
+                        //模板节点 先保存文件题名规则,在重刷
+                        if(StringUtils.isNotEmpty(mbnameRule)){
+                            //先删在保存
+                            String delNameRule="delete from mb_name_rule where wbs_id="+query.getWbsId()+" and classify="+query.getClassify();
+                            jdbcTemplate.execute(delNameRule);
+                            String insertNameRule = "INSERT INTO mb_name_rule(id, wbs_id, name_rule, classify) VALUES(?, ?, ?, ?)";
+                            jdbcTemplate.update(insertNameRule, SnowFlakeUtil.getId(), query.getWbsId(), mbnameRule, query.getClassify());
+                            result=nodeNameMap.get(query.getId());
                         }
-                    }else if(query.getClassify()!=null&&query.getClassify()==2&&StringUtils.isNotEmpty(jlSuffix)){
-                        if(!result.contains(jlSuffix)){
-                            result=result+jlSuffix;
+                    }
+                    if(contract!=null&&contract.getMajorDataType()!=null&&contract.getMajorDataType()==4){
+                        if(result==null){
+                            result="";
                         }
-                        if(!query.getName().equals(result)){
-                            query.setName(result);
+                        if(query.getClassify()!=null&&query.getClassify()==1&&StringUtils.isNotEmpty(sgSuffix)){
+                            if(!result.contains(sgSuffix)){
+                                result=result+sgSuffix;
+                            }
+                            if(!query.getName().equals(result)){
+                                query.setName(result);
+                            }
+                        }else if(query.getClassify()!=null&&query.getClassify()==2&&StringUtils.isNotEmpty(jlSuffix)){
+                            if(!result.contains(jlSuffix)){
+                                result=result+jlSuffix;
+                            }
+                            if(!query.getName().equals(result)){
+                                query.setName(result);
+                            }
                         }
                     }
+                    query.setName(result);
                 }
-                query.setName(result);
-            }
+
         }
         List<InformationQuery> taskList = queryList.stream().filter(o -> o.getStatus() == 1 || o.getStatus() == 2).collect(Collectors.toList());
         if(taskList.size()>0){
@@ -280,81 +297,93 @@ public class InformationWriteQueryController extends BladeController {
     }
 
 
-    public List<String> getNameRuleByPkeyId(Long pKeyId, Long projectId) {
+    public List<String> getNameRuleByPkeyId(Long pKeyId, Long projectId,Integer templateType) {
         NameRuleVo vo = new NameRuleVo();
-        String sql2="select * from m_wbs_param where node_id="+pKeyId+" and type=200"+" and is_deleted=0 and k='FILE_TITLE'";
-        List<WbsParam> wbsParams = jdbcTemplate.query(sql2, new BeanPropertyRowMapper<>(WbsParam.class));
-        WbsParam wbsParam = null;
-        if (!wbsParams.isEmpty()) {
-            wbsParam = wbsParams.get(0);
-        }
-        if(wbsParam!=null){
-            vo.setNameId(wbsParam.getNameId());
-            vo.setNameVaule(wbsParam.getV());
-        }
-        if(vo!=null&&StringUtils.isNotEmpty(vo.getNameVaule())){
-            List<String> list = Arrays.asList(vo.getNameVaule().split("-"));
-            return list;
-        }else {
-            //合同段没有 在查项目级的
-            //如果是导入划分树 就不会引用项目级的
-            String sql="select * from m_wbs_tree_contract where p_key_id="+pKeyId;
-            WbsTreeContract contract = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
-            if(contract.getIsTypePrivatePid()==null){
-                return null;
-            }
-            String sql1="select * from m_wbs_tree_private where p_key_id="+contract.getIsTypePrivatePid();
-            WbsTreePrivate wbsTreePrivate = jdbcTemplate.queryForObject(sql1,new BeanPropertyRowMapper<>(WbsTreePrivate.class));
-            if(wbsTreePrivate==null){
-                return null;
-            }
-            //拿到引用项目级节点的祖级节点
-            String ancestor=wbsTreePrivate.getAncestorsPId()+","+wbsTreePrivate.getPKeyId();
-            String[] ancestors = ancestor.split(",");
-            List<Long> list2 = Arrays.stream(ancestors)
-                    .map(Long::parseLong)
-                    .collect(Collectors.toList());
-            String join = String.join(",", list2.stream().map(String::valueOf).collect(Collectors.toList()));
-            String sql11 = "SELECT * FROM m_wbs_tree_private WHERE node_type=1  AND project_id="+projectId+"  AND parent_id!=0 AND p_key_id IN (" + join + ")";
-            List<WbsTreePrivate> nodeList = jdbcTemplate.query(sql11, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
-            //List<WbsTreePrivate> nodeList = wbsTreePrivateService.getBaseMapper().selectList(new LambdaQueryWrapper<>(WbsTreePrivate.class).select(WbsTreePrivate::getId).eq(WbsTreePrivate::getNodeType, 1).ne(WbsTreePrivate::getParentId, 0).in(WbsTreePrivate::getPKeyId, list2));
-            //那点祖级节点的Id
-            List<Long> list3 = nodeList.stream().map(o -> o.getId()).collect(Collectors.toList());
-            if(list3.size()<0){
-                return null;
-            }
-            //查出这个项目所有的文件题名配置
-            String wbsParamsql="select * from m_wbs_param where project_id="+projectId+" and k='FILE_TITLE' and is_deleted=0";
-            List<WbsParam> wbsParamList=jdbcTemplate.query(wbsParamsql, new BeanPropertyRowMapper<>(WbsParam.class));
-            List<WbsParam> result=new ArrayList<>();
-            if(wbsParamList.size()>0){
-                //筛选出包含当前单位工程节点的
-                for (WbsParam param : wbsParamList) {
-                    //祖级节点里有文件题名配置就加进去
-                    if(list3.contains(param.getNodeId())){
-                        result.add(param);
-                    }
-                    //如果是全局的也加进去
-                    if(param.getNameType()==1){
-                        result.add(param);
-                    }
+        if (templateType == 2) {
+            String sql2 = "select * from m_wbs_param where node_id=" + pKeyId + " and type=200" + " and is_deleted=0 and k='FILE_TITLE'";
+            List<WbsParam> wbsParams = jdbcTemplate.query(sql2, new BeanPropertyRowMapper<>(WbsParam.class));
+            WbsParam wbsParam = null;
+            if (!wbsParams.isEmpty()) {
+                wbsParam = wbsParams.get(0);
+            }
+            if (wbsParam != null) {
+                vo.setNameId(wbsParam.getNameId());
+                vo.setNameVaule(wbsParam.getV());
+            }
+            if (vo != null && StringUtils.isNotEmpty(vo.getNameVaule())) {
+                List<String> list = Arrays.asList(vo.getNameVaule().split("-"));
+                return list;
+            } else {
+                //合同段没有 在查项目级的
+                //如果是导入划分树 就不会引用项目级的
+                String sql = "select * from m_wbs_tree_contract where p_key_id=" + pKeyId;
+                WbsTreeContract contract = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+                if (contract.getIsTypePrivatePid() == null) {
+                    return null;
                 }
-                if(result.size()>0){
-                    //如果有部分节点优先部分
-                    List<WbsParam> collect1 = result.stream().filter(o -> o.getNameType() == 2).collect(Collectors.toList());
-                    if(collect1.size()>0){
-                        WbsParam param = collect1.get(0);
-                        return Arrays.asList(param.getV().split("-"));
+                String sql1 = "select * from m_wbs_tree_private where p_key_id=" + contract.getIsTypePrivatePid();
+                WbsTreePrivate wbsTreePrivate = jdbcTemplate.queryForObject(sql1, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
+                if (wbsTreePrivate == null) {
+                    return null;
+                }
+                //拿到引用项目级节点的祖级节点
+                String ancestor = wbsTreePrivate.getAncestorsPId() + "," + wbsTreePrivate.getPKeyId();
+                String[] ancestors = ancestor.split(",");
+                List<Long> list2 = Arrays.stream(ancestors)
+                        .map(Long::parseLong)
+                        .collect(Collectors.toList());
+                String join = String.join(",", list2.stream().map(String::valueOf).collect(Collectors.toList()));
+                String sql11 = "SELECT * FROM m_wbs_tree_private WHERE node_type=1  AND project_id=" + projectId + "  AND parent_id!=0 AND p_key_id IN (" + join + ")";
+                List<WbsTreePrivate> nodeList = jdbcTemplate.query(sql11, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
+                //List<WbsTreePrivate> nodeList = wbsTreePrivateService.getBaseMapper().selectList(new LambdaQueryWrapper<>(WbsTreePrivate.class).select(WbsTreePrivate::getId).eq(WbsTreePrivate::getNodeType, 1).ne(WbsTreePrivate::getParentId, 0).in(WbsTreePrivate::getPKeyId, list2));
+                //那点祖级节点的Id
+                List<Long> list3 = nodeList.stream().map(o -> o.getId()).collect(Collectors.toList());
+                if (list3.size() < 0) {
+                    return null;
+                }
+                //查出这个项目所有的文件题名配置
+                String wbsParamsql = "select * from m_wbs_param where project_id=" + projectId + " and k='FILE_TITLE' and is_deleted=0";
+                List<WbsParam> wbsParamList = jdbcTemplate.query(wbsParamsql, new BeanPropertyRowMapper<>(WbsParam.class));
+                List<WbsParam> result = new ArrayList<>();
+                if (wbsParamList.size() > 0) {
+                    //筛选出包含当前单位工程节点的
+                    for (WbsParam param : wbsParamList) {
+                        //祖级节点里有文件题名配置就加进去
+                        if (list3.contains(param.getNodeId())) {
+                            result.add(param);
+                        }
+                        //如果是全局的也加进去
+                        if (param.getNameType() == 1) {
+                            result.add(param);
+                        }
                     }
-                    //没有部分节点用所有节点
-                    List<WbsParam> collect2 = result.stream().filter(o -> o.getNameType() == 1).collect(Collectors.toList());
-                    if(collect2.size()>0){
-                        WbsParam param = collect2.get(0);
-                        return Arrays.asList(param.getV().split("-"));
+                    if (result.size() > 0) {
+                        //如果有部分节点优先部分
+                        List<WbsParam> collect1 = result.stream().filter(o -> o.getNameType() == 2).collect(Collectors.toList());
+                        if (collect1.size() > 0) {
+                            WbsParam param = collect1.get(0);
+                            return Arrays.asList(param.getV().split("-"));
+                        }
+                        //没有部分节点用所有节点
+                        List<WbsParam> collect2 = result.stream().filter(o -> o.getNameType() == 1).collect(Collectors.toList());
+                        if (collect2.size() > 0) {
+                            WbsParam param = collect2.get(0);
+                            return Arrays.asList(param.getV().split("-"));
+                        }
                     }
                 }
-            }
 
+            }
+        }else {
+            String wbsContractSql="select * from m_wbs_tree_contract where p_key_id="+pKeyId;
+            WbsTreeContract contract = jdbcTemplate.queryForObject(wbsContractSql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+            //优先使用自己配置的文件题名规则
+            Integer classify=contract.getTableOwner()==null?1:"123".contains(contract.getTableOwner())?1:2;
+            String sqlmbNameRule="select name_rule from mb_name_rule where wbs_id=? and classify=?";
+            List<String> nameRuleVos = jdbcTemplate.query(sqlmbNameRule, new SingleColumnRowMapper<>(String.class), contract.getPKeyId(),classify);
+            if(!nameRuleVos.isEmpty()){
+                return Arrays.asList(nameRuleVos.get(0).split("-"));
+            }
         }
         return null;
     }
@@ -379,24 +408,15 @@ public class InformationWriteQueryController extends BladeController {
                         WbsTreeContract::getNodeName,
                         (existing, replacement) -> replacement // 如果键重复,保留后者
                 ));
-        StringBuilder result = new StringBuilder("");
+        List<String> result = new ArrayList<>();
         for (Integer i : index) {
-            if(i==0){
-                if(map.containsKey(1)){
-                    result.append(map.get(1));
-                }
-            }
-            else if(i==1){
-                if(map.containsKey(18)){
-                    result.append(map.get(18));
-                }
-            }else {
-                if(map.containsKey(i)){
-                    result.append(map.get(i));
-                }
+            String title = map.get(i == 0 ? 1 : i == 1 && map.containsKey(18) ? 18 : i);
+            if(title == null || result.stream().anyMatch(f -> f.contains(title))){
+                continue;
             }
+            result.add(title);
         }
-        return result.toString();
+        return String.join("", result);
     }
 
     @PostMapping("/previewNodeName")
@@ -443,12 +463,21 @@ public class InformationWriteQueryController extends BladeController {
         return R.data(list);
     }
 
+
     @PostMapping("/getNameRuleList")
     @ApiOperation(value = "获取题名规则列表")
-    public R<List<PreviewNodeNameVO>> getNameRuleList(@RequestBody List<PreviewNodeNameDTO>dtos){
+    public R<List<PreviewNodeNameVO>> getNameRuleList(@RequestBody GetNameRuleListDTO param){
         List<PreviewNodeNameVO>list=new ArrayList<>();
-        for (PreviewNodeNameDTO dto : dtos) {
-            List<String> nameRules = getNameRuleByPkeyId(dto.getWbsId(), dto.getProjectId());
+        String sql1="Select sg_suffix,jl_suffix,template_type from m_project_info where id="+param.getDtos().get(0).getProjectId()+" and is_deleted=0";
+        List<ProjectInfo> projectInfos = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(ProjectInfo.class));
+        String sgSuffix="";
+        String jlSuffix="";
+        if(projectInfos.size()>0){
+            sgSuffix=projectInfos.get(0).getSgSuffix()==null?"":projectInfos.get(0).getSgSuffix();
+            jlSuffix=projectInfos.get(0).getJlSuffix()==null?"":projectInfos.get(0).getJlSuffix();
+        }
+        for (PreviewNodeNameDTO dto : param.getDtos()) {
+            List<String> nameRules = getNameRuleByPkeyId(dto.getWbsId(), dto.getProjectId(),param.getTemplateType());
             String sql="select p_key_id,ancestors_p_id,major_data_type from m_wbs_tree_contract where p_key_id="+dto.getWbsId()+" and is_deleted=0";
             WbsTreeContract contract = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
             String sql2="select IFNULL(classify,0) from u_information_query where id="+dto.getId();
@@ -456,20 +485,8 @@ public class InformationWriteQueryController extends BladeController {
             String result="";
             if(nameRules!=null){
                 result= createFileTitle(contract, String.join("-", nameRules));
-                //result = nodeBaseInfoServiceClient.getNameRuleByRule(String.join("-", nameRules), contract.getPKeyId() + "");
                 if(contract!=null){
-                    String sql1="Select sg_suffix,jl_suffix,template_type from m_project_info where id="+dtos.get(0).getProjectId()+" and is_deleted=0";
-                    List<ProjectInfo> projectInfos = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(ProjectInfo.class));
-                    String sgSuffix="";
-                    String jlSuffix="";
-                    if(projectInfos.size()>0){
-                        sgSuffix=projectInfos.get(0).getSgSuffix()==null?"":projectInfos.get(0).getSgSuffix();
-                        jlSuffix=projectInfos.get(0).getJlSuffix()==null?"":projectInfos.get(0).getJlSuffix();
-                    }
-                    if(contract!=null&&contract.getMajorDataType()!=null&&contract.getMajorDataType()==4){
-                        if(result==null){
-                            result="";
-                        }
+                    if(contract.getMajorDataType()!=null&&contract.getMajorDataType()==4){
                         if(classify==1&&StringUtils.isNotEmpty(sgSuffix)){
                             result=result+sgSuffix;
                         }else if(classify==2&&StringUtils.isNotEmpty(jlSuffix)){

+ 13 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -4557,8 +4557,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         String context = "";
         boolean isAddContext = false;
         // 处理重庆乌江白马航电枢纽工程第三方试验检测项目部 受控号
-        String tableType = dto.getTableType();
-        if ((contractId.equals("1815659357889708033") || contractId.equals("1612335077269143554")) && (tableType != null && tableType.contains("2")) ) {
+        if ((contractId.equals("1815659357889708033") || contractId.equals("1612335077269143554")) && (wbsTreePrivate.getTableType() != null && (wbsTreePrivate.getTableType() == 2 || wbsTreePrivate.getTableType() == 10)) ) {
             if (contractId.equals("1815659357889708033")) {
                 context = "受控号:ZNJC/QR34-07-2024";
             } else  {
@@ -4566,7 +4565,11 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             }
             isAddContext = !tableContextReplace(workbook, "受控号:", context);
             if (isAddContext) {
-                excelTitle = PdfAddContextUtils.getExcelFullTitle(workbook, excelTab.getName());
+                try {
+                    excelTitle = PdfAddContextUtils.getExcelFullTitle(workbook, excelTab.getName());
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
             }
         } else {
             tableContextReplace(workbook, "受控号:", "");
@@ -4618,6 +4621,13 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 }
             }
         }
+        if (isAddContext && excelTitle.trim().isEmpty()) {
+            try {
+                excelTitle = PdfAddContextUtils.getExcelFullTitleByProjectName(workbook, projectInfo.getProjectName());
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
 
         //数据不为空,构造数据
         String fileUrl = wbsTreePrivate.getHtmlUrl();

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

@@ -59,7 +59,9 @@ public class FormulaOptionServiceImpl extends ServiceImpl<FormulaOptionMapper, F
                 if (jo.containsKey(wbc.getInitTableName())) {
                     JSONObject tableJson = jo.getJSONObject(wbc.getInitTableName());
                     if (key.contains("__")) {
-                        String cellKey = pkeyId + "@" + key;
+                        //(pkeyId + "@" + key)匹配不上,不知道什么含义,先注释掉
+//                        String cellKey = pkeyId + "@" + key;
+                          String cellKey=key.split("__")[0];
                         if (tableJson.containsKey(cellKey)) {
                             JSONObject excel = tableJson.getJSONObject(cellKey);
                             if (excel.containsKey("TF")) {

+ 19 - 8
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsParamServiceImpl.java

@@ -25,6 +25,7 @@ import org.springblade.manager.vo.WbsParamVo2;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.SingleColumnRowMapper;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -79,15 +80,25 @@ public class WbsParamServiceImpl extends BaseServiceImpl<WbsParamMapper, WbsPara
                     RandomNumberHolder.setRandomTemplateType(1);
                     WbsTreePrivate wtp = this.wtpId(wtc.getPKeyId());
                     if(wtp!=null){
-                        //优先使用文件题名全局配置里面的规则
-                        WbsParam wp=this.getPrivateNameRuleByPkeyId(wtc);
-                        if (wp == null) {
-                            wp = this.getOne(Wrappers.<WbsParam>lambdaQuery().eq(WbsParam::getNodeId, wtp.getPKeyId()).eq(WbsParam::getK, FILE_TITLE).last(" limit 1"));
-                            if(wp==null){
-                                WbsTreePrivate publicWtp = this.getOriginWtp(wtp.getPKeyId());
-                                wp = this.getOne(Wrappers.<WbsParam>lambdaQuery().eq(WbsParam::getNodeId, publicWtp.getId()).eq(WbsParam::getK, FILE_TITLE).last(" limit 1 "));
+                        WbsParam wp=new WbsParam();
+                        //优先使用自己配置的文件题名规则
+                        Integer classify=wtc.getTableOwner()==null?1:"123".contains(wtc.getTableOwner())?1:2;
+                        String sqlmbNameRule="select name_rule from mb_name_rule where wbs_id=? and classify=?";
+                        List<String> nameRuleVos = jdbcTemplate.query(sqlmbNameRule, new SingleColumnRowMapper<>(String.class), wtp.getPKeyId(),classify);
+                        if(!nameRuleVos.isEmpty()){
+                            wp.setV(nameRuleVos.get(0));
+                        }
+                        if(wp.getV()==null){
+                            //使用文件题名全局配置里面的规则
+                            wp=this.getPrivateNameRuleByPkeyId(wtc);
+                            if (wp == null) {
+                                wp = this.getOne(Wrappers.<WbsParam>lambdaQuery().eq(WbsParam::getNodeId, wtp.getPKeyId()).eq(WbsParam::getK, FILE_TITLE).last(" limit 1"));
                                 if(wp==null){
-                                    wp = this.getOne(Wrappers.<WbsParam>lambdaQuery().eq(WbsParam::getNodeId, publicWtp.getTreePId()).eq(WbsParam::getK, FILE_TITLE).last(" limit 1 "));
+                                    WbsTreePrivate publicWtp = this.getOriginWtp(wtp.getPKeyId());
+                                    wp = this.getOne(Wrappers.<WbsParam>lambdaQuery().eq(WbsParam::getNodeId, publicWtp.getId()).eq(WbsParam::getK, FILE_TITLE).last(" limit 1 "));
+                                    if(wp==null){
+                                        wp = this.getOne(Wrappers.<WbsParam>lambdaQuery().eq(WbsParam::getNodeId, publicWtp.getTreePId()).eq(WbsParam::getK, FILE_TITLE).last(" limit 1 "));
+                                    }
                                 }
                             }
                         }

+ 39 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/utils/PdfAddContextUtils.java

@@ -22,6 +22,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 public class PdfAddContextUtils {
 
@@ -68,6 +69,44 @@ public class PdfAddContextUtils {
         }
         return "";
     }
+    public static String getExcelFullTitleByProjectName(org.apache.poi.ss.usermodel.Workbook workbook, String projectName) {
+        Sheet sheet = workbook.getSheetAt(0);
+        sheet.setForceFormulaRecalculation(true);
+        for (int i = 0; i < 6; i++) {
+            Row row = sheet.getRow(i);
+            if (row == null) {
+                continue;
+            }
+            short cellNum = row.getLastCellNum();
+            for (int j = 0; j < cellNum; j++) {
+                Cell cell = row.getCell(j);
+                if (cell == null || cell.getCellTypeEnum() != CellType.STRING) {
+                    continue;
+                }
+                String cellValue = cell.getStringCellValue();
+                if (cellValue == null || cellValue.isEmpty()) {
+                    continue;
+                }
+                if (Objects.equals(cellValue, projectName) && i + 1 < sheet.getLastRowNum()) {
+                    Row row1 = sheet.getRow(i + 1);
+                    if (row1 == null) {
+                        continue;
+                    }
+                    for (int k = 0; k < row1.getLastCellNum(); k++) {
+                        Cell cell1 = row1.getCell(k);
+                        if (cell1 == null || cell1.getCellTypeEnum() != CellType.STRING) {
+                            continue;
+                        }
+                        cellValue = cell1.getStringCellValue();
+                        if (cellValue != null && cellValue.trim().length() > 2) {
+                            return cellValue;
+                        }
+                    }
+                }
+            }
+        }
+        return "";
+    }
 
 
     public static boolean containsAllCharactersInOrder(String str, String str1) {