浏览代码

Revert "重置文件题名"

This reverts commit 559fa1bfa028653c0a250594143c5a0b05d12ec9.
cr 2 月之前
父节点
当前提交
9190947496

+ 0 - 18
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/FlushQueryNameDTO.java

@@ -1,18 +0,0 @@
-package org.springblade.business.dto;
-
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.util.List;
-import java.util.Map;
-
-@Data
-public class FlushQueryNameDTO {
-
-    @ApiModelProperty(value = "1直接重置题名 2规则更改重置题名")
-    private Integer type;
-
-    @ApiModelProperty(value = "题名内容 type=2{资料查询ID:修改后文件题名},type=1{资料查询ID:空字符串}")
-    private Map<Long,String> map;
-}

+ 6 - 65
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -26,7 +26,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springblade.business.dto.CustomAddContractNodeDTO;
 import org.springblade.business.dto.ImportTreeDto;
-import org.springblade.business.dto.FlushQueryNameDTO;
 import org.springblade.business.entity.*;
 import org.springblade.business.feign.MessageWarningClient;
 import org.springblade.business.feign.OperationLogClient;
@@ -194,11 +193,13 @@ public class InformationWriteQueryController extends BladeController {
     @PostMapping("/flushQueryName")
     @ApiModelProperty(value = "刷新文件题名")
     @ApiOperationSupport(order = 28)
-    public R<Boolean> flushQueryName(@RequestBody FlushQueryNameDTO dto){
-        if(dto.getMap().size()<=0){
+    public R<Boolean> flushQueryName(@RequestParam String ids){
+        if(ids==null){
             throw new ServiceException("请选择要刷新的文件");
         }
-        List<Long> idList=new ArrayList<>(dto.getMap().keySet());
+        List<Long> idList = Arrays.stream(ids.split(","))
+            .map(Long::valueOf)
+            .collect(Collectors.toList());
         List<InformationQuery> queryList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery()
             .select(InformationQuery::getId, InformationQuery::getName,InformationQuery::getProjectId,InformationQuery::getClassify,InformationQuery::getStatus,InformationQuery::getWbsId).in(InformationQuery::getId, idList));
         String sgSuffix="";
@@ -211,14 +212,9 @@ public class InformationWriteQueryController extends BladeController {
                 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=dto.getMap().get(query.getId());
-                }
+                  String result=wbsParamClient.createFileTitle(contract);
                 if(contract!=null&&contract.getMajorDataType()!=null&&contract.getMajorDataType()==4){
                     if(query.getClassify()!=null&&query.getClassify()==1&&StringUtils.isNotEmpty(sgSuffix)){
                         result=result+sgSuffix;
@@ -245,61 +241,6 @@ public class InformationWriteQueryController extends BladeController {
         return R.status(this.informationQueryService.updateBatchById(queryList));
     }
 
-    private String createFileTitle(WbsTreeContract contract, String param) {
-        if(contract==null){
-            return "";
-        }
-        String ancestorsPId = contract.getAncestorsPId();
-        if (ancestorsPId.startsWith("0,")) {
-            ancestorsPId = ancestorsPId.substring(2);
-        }
-        ancestorsPId=ancestorsPId+","+contract.getPKeyId();
-        String sql="select node_name,node_type from m_wbs_tree_contract where p_key_id in ("+ancestorsPId+") and is_deleted=0";
-        List<WbsTreeContract> nodeNames = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
-        param = param.trim().replaceAll("(?i:c)", "");
-        List<String> list = Arrays.asList(param.split("[^.\\d]"));
-        List<Integer> index = list.stream().map(Integer::parseInt).collect(Collectors.toList());
-        Map<Integer, String> map = nodeNames.stream()
-                .collect(Collectors.toMap(
-                        WbsTreeContract::getNodeType,
-                        WbsTreeContract::getNodeName,
-                        (existing, replacement) -> replacement // 如果键重复,保留后者
-                ));
-        StringBuilder result = new StringBuilder("");
-        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));
-                }
-            }
-        }
-        return result.toString();
-    }
-
-    @GetMapping("/previewNodeName")
-    @ApiOperation(value = "预览节点名称")
-    @ApiImplicitParams(value = {
-            @ApiImplicitParam(name = "wbsId", value = "资料查询wbsId", required = true),
-            @ApiImplicitParam(name = "param", value = "题名规则", required = true)
-    })
-    public R<String> previewNodeName(@RequestParam String wbsId,@RequestParam String param){
-        String sql="select p_key_id,ancestors_p_id from m_wbs_tree_contract where p_key_id="+wbsId+" and is_deleted=0";
-        WbsTreeContract contract = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
-        if(contract!=null){
-            return R.data(createFileTitle(contract,param));
-        }
-        return R.success("暂无数据");
-    }
-
     /**
      * 初始化合同段导图树
      */