liuyc 1 年間 前
コミット
a25c526edd

+ 0 - 3
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/ImageClassificationFile.java

@@ -127,7 +127,4 @@ public class ImageClassificationFile extends BaseEntity {
     @ApiModelProperty("合并后的PDF")
     private String margePdfUrl;
 
-    @ApiModelProperty("视频封面图Url地址")
-    private String videoCoverUrl;
-
 }

+ 0 - 8
blade-service/blade-business/src/main/java/org/springblade/business/controller/ImageClassificationFileController.java

@@ -557,14 +557,6 @@ public class ImageClassificationFileController extends BladeController {
                 List<ImageClassificationFileVO> value = stringObjectEntry.getValue();
                 Map<String, Object> stringObjectMap = new HashMap<>();
                 stringObjectMap.put("name", date);
-
-                for (ImageClassificationFileVO vo : value) {
-                    if (StringUtils.isNotEmpty(vo.getImageUrl()) && isVideoUrl(vo.getImageUrl()) && StringUtils.isEmpty(vo.getVideoCoverUrl())) {
-                        //设置默认视频封面logo
-                        vo.setVideoCoverUrl("https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com//upload/20230904/b86888a3fcd280d56053639dbfddb35d.jpg");
-                    }
-                }
-
                 stringObjectMap.put("child", value);
                 list.add(stringObjectMap);
             }

+ 7 - 2
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/ImageClassificationFileServiceImpl.java

@@ -83,7 +83,7 @@ public class ImageClassificationFileServiceImpl extends BaseServiceImpl<ImageCla
         long current = (page.getCurrent() - 1L) * page.getSize();
         if (StringUtils.isNotEmpty(imageClassificationFile.getWbsIdsStr())) {
             //查询下级节点信息
-//			imageClassificationFile.setWbsIds(JSONArray.parseArray(JSONObject.toJSONString(imageClassificationFile.getWbsIdsStr().split(",")), String.class));
+            //imageClassificationFile.setWbsIds(JSONArray.parseArray(JSONObject.toJSONString(imageClassificationFile.getWbsIdsStr().split(",")), String.class));
             WbsTreeContract node = wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.valueOf(imageClassificationFile.getWbsIdsStr()));
             List<WbsTreeContract> wbsTreeContracts = new ArrayList<>();
             if (node.getParentId() == 0) {
@@ -94,9 +94,14 @@ public class ImageClassificationFileServiceImpl extends BaseServiceImpl<ImageCla
             wbsTreeContracts.add(node);
             imageClassificationFile.setWbsIds(wbsTreeContracts.stream().map(wtc -> wtc.getPKeyId() + "").collect(Collectors.toList()));
         }
+
         //获取数据
         List<ImageClassificationFile> fileVOS = this.baseMapper.selectImageClassificationFilePage(current, page.getSize(), imageClassificationFile);
-        if (fileVOS != null && fileVOS.size() > 0) {
+        //获取总数据条数和总页数
+        int totalRecords = fileVOS.size();
+        int totalPages = (int) Math.ceil((double) totalRecords / page.getSize());
+        //判断请求页数必须小于等于总页数
+        if (page.getCurrent() <= totalPages && fileVOS.size() > 0) {
             //分组
             List<List<ImageClassificationFile>> group = CommonUtil.getBatchSize(fileVOS, new Integer(String.valueOf(page.getSize())));
 

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ContractInfoController.java

@@ -533,7 +533,7 @@ public class ContractInfoController extends BladeController {
             @ApiImplicitParam(name = "项目id", value = "projectId", required = true),
             @ApiImplicitParam(name = "合同段id", value = "contractId", required = true)
     })
-    public R tree(String wbsId, String projectId, String contractId) {
+    public R<Object> tree(String wbsId, String projectId, String contractId) {
         List<WbsTreeContractVO> tree = contractInfoService.tree(wbsId, projectId, contractId);
         if (tree != null && tree.size() > 0) {
             return R.data(tree);

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.java

@@ -40,7 +40,7 @@ public interface ContractInfoMapper extends BaseMapper<ContractInfo> {
 
     List<WbsTreeContractTreeVO> tree(@Param("wbsId") String wbsId, @Param("projectId") String projectId, @Param("contractId") String contractId, @Param("wbsType") Integer wbsType, @Param("parentId") String parentId);
 
-    List<WbsTreeContractVO> tree2(@Param("wbsId") Long wbsId, @Param("projectId") Long projectId, @Param("contractId") Long contractId, @Param("wbsType") Integer wbsType, @Param("parentId") String parentId, @Param("queryValue") String queryValue);
+    List<WbsTreeContractVO> tree2(@Param("wbsId") Long wbsId, @Param("projectId") Long projectId, @Param("contractId") Long contractId);
 
     List<WbsTreeContractVO> tree3(@Param("wbsId") String wbsId, @Param("projectId") String projectId, @Param("contractId") String contractId, @Param("wbsType") Integer wbsType, @Param("parentId") String parentId);
 

+ 0 - 11
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.xml

@@ -276,7 +276,6 @@
         d.wbs_type AS "wbsType",
         d.id,
         d.parent_id AS "parentId",
-        -- IFNULL(if(length(trim(full_name)) > 0, full_name, node_name),node_name) AS title,
         d.node_name AS title,
         d.node_name AS "nodeName",
         d.full_name AS "fullName",
@@ -293,7 +292,6 @@
         d.is_deleted = 0
         AND d.status = 1
         AND d.type = 1
-        AND wbs_type = 1
         <if test="wbsId!=null and wbsId!=''">
             and wbs_id = #{wbsId}
         </if>
@@ -303,15 +301,6 @@
         <if test="contractId!=null and contractId!=''">
             and contract_id = #{contractId}
         </if>
-        <if test="wbsType != null and wbsType != ''">
-            and wbs_type = #{wbsType}
-        </if>
-        <if test="parentId != null and parentId != ''">
-            and parent_id = #{parentId}
-        </if>
-        <if test="queryValue != null and queryValue != ''">
-            and (node_name like concat('%', #{queryValue}, '%') or full_name like concat('%', #{queryValue}, '%'))
-        </if>
         /*不查询客户端新增或者复制的节点 old_id = null*/
         AND old_id is null
         ORDER BY d.sort

+ 34 - 19
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -200,11 +200,14 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
     public List<WbsTreePrivateVO> addNodeTree(String pKeyId) {
         WbsTreeContract parentNodeRoot = wbsTreeContractMapper.selectOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, pKeyId).eq(WbsTreeContract::getStatus, 1));
         if (ObjectUtil.isNotEmpty(parentNodeRoot)) {
+            //oldId不等于空,说明是复制或新增的节点,通过oldId,获取原始节点
             String oldId = "";
-            //oldId不等于空,说明是复制节点,通过oldId,获取原始节点
             if (ObjectUtil.isNotEmpty(parentNodeRoot.getOldId())) {
-                oldId = parentNodeRoot.getOldId();
-                parentNodeRoot = this.recursionFindResourceRootNode(parentNodeRoot);
+                //在调用递归方法时,创建IdWrapper对象并传递
+                IdWrapper idWrapper = new IdWrapper();
+                this.recursionFindResourceRootNode(idWrapper, parentNodeRoot);
+                //在外部获取更新后的id值
+                oldId = idWrapper.getId();
             }
 
             //获取对应的项目树的节点
@@ -239,25 +242,37 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
     }
 
     /**
-     * 获取树结构
-     *
-     * @param obj
-     * @return
+     * 修改递归方法,接受IdWrapper对象
      */
-    private WbsTreeContract recursionFindResourceRootNode(WbsTreeContract obj) {
-        if (obj.getOldId() != null) {
-            WbsTreeContract obj1 = wbsTreeContractMapper.selectOne(Wrappers.<WbsTreeContract>lambdaQuery()
+    private void recursionFindResourceRootNode(IdWrapper idWrapper, WbsTreeContract obj) {
+        if (ObjectUtils.isEmpty(idWrapper.getId())) {
+            List<WbsTreeContract> wbsTreeContractList = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
                     .eq(WbsTreeContract::getId, obj.getOldId())
-                    .eq(WbsTreeContract::getContractId, obj.getContractId()));
-            if (obj1 != null && obj1.getOldId() != null) {
-                obj1 = this.recursionFindResourceRootNode(obj1);
-            } else {
-                // 已经到达原始节点,返回当前节点的id
-                return obj1 != null ? obj1 : obj;
+                    .eq(WbsTreeContract::getWbsId, obj.getWbsId())
+                    .eq(WbsTreeContract::getProjectId, obj.getProjectId()));
+            if (wbsTreeContractList.size() > 0) {
+                WbsTreeContract wbsTreeContract = wbsTreeContractList.get(0);
+                if (ObjectUtils.isNotEmpty(wbsTreeContract.getOldId())) {
+                    this.recursionFindResourceRootNode(idWrapper, wbsTreeContract);
+                } else {
+                    //已经到达原始节点,更新IdWrapper对象的id属性
+                    idWrapper.setId(wbsTreeContract.getId().toString());
+                }
             }
-            obj = obj1;
         }
-        return obj;
+    }
+
+    //定义一个包装类,用于包装id值
+    static class IdWrapper {
+        private String id;
+
+        public String getId() {
+            return id;
+        }
+
+        public void setId(String id) {
+            this.id = id;
+        }
     }
 
     private List<WbsTreePrivate> getChildNodes(WbsTreePrivate obj) {
@@ -703,7 +718,7 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
 
     @Override
     public List<WbsTreeContractVO> tree(String wbsId, String projectId, String contractId) {
-        List<WbsTreeContractVO> wbsTreeContractVOS = baseMapper.tree2(Long.parseLong(wbsId), Long.parseLong(projectId), Long.parseLong(contractId), null, null, null);
+        List<WbsTreeContractVO> wbsTreeContractVOS = baseMapper.tree2(Long.parseLong(wbsId), Long.parseLong(projectId), Long.parseLong(contractId));
         return buildWbsTreeByStream(wbsTreeContractVOS);
     }
 

+ 33 - 72
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -458,40 +458,49 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
             tableOwnerList = Func.toStrList(tableOwners);
         }
         List<AppWbsTreeContractVO> resultTabs = baseMapper.selectWbsTreeContractList(tableOwnerNumbers, wbsTreeContract.getProjectId(), wbsTreeContract.getWbsId(), wbsTreeContract.getContractId(), wbsTreeContract.getId(), wbsTreeContract.getContractIdRelation(), tableOwnerList);
-        return this.sortTabs(resultTabs);
+        /*List<AppWbsTreeContractVO> sortTabsCopyResult = this.sortTabsCopy(resultTabs);
+        return this.sortTabsPL(sortTabsCopyResult);*/
+        List<AppWbsTreeContractVO> r = sortTabs(resultTabs, "__");
+        return this.sortTabs(resultTabs, "_PL_");
     }
 
-    private List<AppWbsTreeContractVO> sortTabs(List<AppWbsTreeContractVO> tabs) {
-        List<AppWbsTreeContractVO> tabsWithPL = new ArrayList<>();
-        List<AppWbsTreeContractVO> tabsWithoutPL = new ArrayList<>();
-        //分离带有_PL_关键字和不带关键字的数据
+    /**
+     * 元素表排序
+     *
+     * @param tabs
+     * @param keyword
+     * @return
+     */
+    private List<AppWbsTreeContractVO> sortTabs(List<AppWbsTreeContractVO> tabs, String keyword) {
+        List<AppWbsTreeContractVO> tabsWithKeyword = new ArrayList<>();
+        List<AppWbsTreeContractVO> tabsWithoutKeyword = new ArrayList<>();
+        //分离带有关键字和不带关键字的数据
         for (AppWbsTreeContractVO tab : tabs) {
-            if (tab.getNodeName().contains("_PL_")) {
-                tabsWithPL.add(tab);
+            if (tab.getNodeName().contains(keyword)) {
+                tabsWithKeyword.add(tab);
             } else {
-                tabsWithoutPL.add(tab);
+                tabsWithoutKeyword.add(tab);
             }
         }
-        //如果没有带有_PL_关键字的数据,直接返回原列表
-        if (tabsWithPL.isEmpty()) {
-            return tabsWithoutPL;
+        //如果没有带有关键字的数据,直接返回原列表
+        if (tabsWithKeyword.isEmpty()) {
+            return tabsWithoutKeyword;
         }
-        //将带有_PL_关键字的数据插入到对应表名后面
+        //将带有关键字的数据插入到对应表名后面
         List<AppWbsTreeContractVO> sortedTabs = new ArrayList<>();
-        for (AppWbsTreeContractVO tabWithoutPL : tabsWithoutPL) {
-            sortedTabs.add(tabWithoutPL);
-            String tabName = tabWithoutPL.getNodeName();
-            String tabNameWithPLPrefix = tabName + "_PL_";
-            for (AppWbsTreeContractVO tabWithPL : tabsWithPL) {
-                if (tabWithPL.getNodeName().startsWith(tabNameWithPLPrefix)) {
-                    sortedTabs.add(tabWithPL);
+        for (AppWbsTreeContractVO tabWithoutKeyword : tabsWithoutKeyword) {
+            sortedTabs.add(tabWithoutKeyword);
+            String tabName = tabWithoutKeyword.getNodeName();
+            String tabNameWithKeywordPrefix = tabName + keyword;
+            for (AppWbsTreeContractVO tabWithKeyword : tabsWithKeyword) {
+                if (tabWithKeyword.getNodeName().startsWith(tabNameWithKeywordPrefix)) {
+                    sortedTabs.add(tabWithKeyword);
                 }
             }
         }
         return sortedTabs;
     }
 
-
     @Override
     public List<WbsTreeContract> searchParentAllNode(long primaryKeyId, Long contractId) {
         return baseMapper.searchParentAllNode(primaryKeyId, contractId);
@@ -689,7 +698,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                         } else {
                             queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where type = 1 and contract_id = " + contractId + " and classify = " + tableOwner, new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class));
                         }
-                        Map<Long, Integer> queryInfoMaps = queryInfoList.stream()
+                        Map<Long, Integer> queryInfoMaps = queryInfoList.stream().filter(f -> ObjectUtil.isNotEmpty(f.getWbsId()))
                                 .collect(Collectors.toMap(WbsTreeContractLazyQueryInfoVO::getWbsId, WbsTreeContractLazyQueryInfoVO::getStatus, (existingValue, newValue) -> existingValue));
                         List<Long> pKeyIdList = new ArrayList<>(queryInfoMaps.keySet());
 
@@ -820,7 +829,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                                 } else {
                                     queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where type = 1 and contract_id = " + sgContractId + " and classify = " + tableOwner, new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class));
                                 }
-                                Map<Long, Integer> queryInfoMaps = queryInfoList.stream()
+                                Map<Long, Integer> queryInfoMaps = queryInfoList.stream().filter(f -> ObjectUtil.isNotEmpty(f.getWbsId()))
                                         .collect(Collectors.toMap(WbsTreeContractLazyQueryInfoVO::getWbsId, WbsTreeContractLazyQueryInfoVO::getStatus, (existingValue, newValue) -> existingValue));
                                 List<Long> pKeyIdList = new ArrayList<>(queryInfoMaps.keySet());
 
@@ -943,6 +952,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                         List<WbsTreeContractLazyFileVO> queryFileList = jdbcTemplate.query("select wbs_id,id from u_image_classification_file where status = 1 and is_deleted = 0 and contract_id = " + contractId + " and classify_id = " + classId, new BeanPropertyRowMapper<>(WbsTreeContractLazyFileVO.class));
                         //最底层节点与存储文件数量map
                         Map<Long, Integer> queryFileMaps = queryFileList.stream()
+                                .filter(f -> ObjectUtil.isNotEmpty(f.getWbsId()))
                                 .collect(Collectors.groupingBy(
                                         WbsTreeContractLazyFileVO::getWbsId,
                                         Collectors.collectingAndThen(Collectors.toList(), List::size)
@@ -1048,6 +1058,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                                 List<WbsTreeContractLazyFileVO> queryFileList = jdbcTemplate.query("select wbs_id,id from u_image_classification_file where status = 1 and contract_id = " + contractId + " and classify_id = " + classId, new BeanPropertyRowMapper<>(WbsTreeContractLazyFileVO.class));
                                 //最底层节点与存储文件数量map
                                 Map<Long, Integer> queryFileMaps = queryFileList.stream()
+                                        .filter(f -> ObjectUtil.isNotEmpty(f.getWbsId()))
                                         .collect(Collectors.groupingBy(
                                                 WbsTreeContractLazyFileVO::getWbsId,
                                                 Collectors.collectingAndThen(Collectors.toList(), List::size)
@@ -1322,56 +1333,6 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         }
     }
 
-    public void recursiveGetParentNodes2(List<WbsTreeContractLazyVO> result, List<Long> lowestNodeParentIds, List<WbsTreeContractLazyVO> nodesAll) {
-        if (lowestNodeParentIds.isEmpty()) {
-            return;
-        }
-
-        //父级Id与出现的次数Map
-        Map<Long, Long> parentIdGroup = lowestNodeParentIds.stream()
-                .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
-
-        List<String> keysWithValueOne = new ArrayList<>();
-        Map<Long, Long> keysWithValueSome = new HashMap<>();
-
-        for (Map.Entry<Long, Long> entry : parentIdGroup.entrySet()) {
-            if (entry.getValue() == 1L) {
-                keysWithValueOne.add(entry.getKey().toString());
-            } else {
-                keysWithValueSome.put(entry.getKey(), entry.getValue());
-            }
-        }
-
-        //批量查询单次节点
-        List<WbsTreeContractLazyVO> parentNodes = new ArrayList<>();
-        if (keysWithValueOne.size() > 0) {
-            parentNodes = nodesAll.stream().filter(f -> keysWithValueOne.contains(f.getId().toString())).collect(Collectors.toList());
-        }
-
-        //批量查询多次节点
-        List<WbsTreeContractLazyVO> multipleParentNodes = new ArrayList<>();
-        for (Map.Entry<Long, Long> entry : keysWithValueSome.entrySet()) {
-            Long key = entry.getKey();
-            Long count = entry.getValue();
-
-            List<WbsTreeContractLazyVO> nodes = nodesAll.stream().filter(f -> key.equals(f.getId())).collect(Collectors.toList());
-            if (!nodes.isEmpty()) {
-                multipleParentNodes.addAll(Collections.nCopies(count.intValue(), nodes.get(0)));
-            }
-        }
-
-        //结果集
-        List<Long> collect = Stream.concat(parentNodes.stream(), multipleParentNodes.stream())
-                .map(WbsTreeContractLazyVO::getParentId)
-                .collect(Collectors.toList());
-
-        if (!collect.isEmpty()) {
-            result.addAll(parentNodes);
-            result.addAll(multipleParentNodes);
-            this.recursiveGetParentNodes(result, collect, nodesAll);
-        }
-    }
-
     /**
      * 反向递归处理父节点颜色
      */