Przeglądaj źródła

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

LHB 1 miesiąc temu
rodzic
commit
8bb9835ba1

+ 3 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/TextdictInfoVO.java

@@ -38,4 +38,7 @@ public class TextdictInfoVO extends TextdictInfo {
 
     @ApiModelProperty("本表配置 绿色0,电签库 蓝色1,项目匹配 橙色2")
     private Integer isSystem = 0;
+
+    @ApiModelProperty("元素是否匹配, 1:匹配, 0:不匹配")
+    private Integer isMatch = 1;
 }

+ 3 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsTreeContractTreeAllVO.java

@@ -41,6 +41,9 @@ public class WbsTreeContractTreeAllVO implements INode<WbsTreeContractTreeAllVO>
     @ApiModelProperty(value = "是否为自定义新增节点 1=是")
     private Integer isCustom;
 
+    @ApiModelProperty(value = "是否完成日期填写 1是 2否")
+    private Integer dateIsComplete;
+
     @JsonInclude(JsonInclude.Include.NON_EMPTY)
     private List<WbsTreeContractTreeAllVO> children;
 

+ 6 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/TextdictInfoMapper.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.manager.mapper;
 
+import org.apache.ibatis.annotations.Select;
 import org.springblade.manager.entity.TextdictInfo;
 import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.injector.EasyBaseMapper;
@@ -61,4 +62,9 @@ public interface TextdictInfoMapper extends EasyBaseMapper<TextdictInfo> {
     //通过表单Id 获取电签信息
     List<TextdictInfoVO> getTextdictListInfoByPkeyId(@Param("tabId") String tabId,@Param("projectId") String projectId);
 
+    @Select("select * from m_textdict_info where project_id = #{treePrivate.projectId} and tab_id = #{treePrivate.pKeyId} and type = 2")
+    List<TextdictInfoVO> selectTextDictInfoByProjectIdAndTabId(IPage<TextdictInfoVO> page, @Param("treePrivate") WbsTreePrivate treePrivate);
+
+    @Select("SELECT * from m_textdict_info WHERE project_id = #{treePrivate.projectId} and excel_id = #{treePrivate.excelId} and type = 2 and (SELECT 1 from m_wbs_tree_private WHERE p_key_id = tab_id and html_url = #{treePrivate.htmlUrl}) = 1")
+    List<TextdictInfoVO> selectTextdictInfoByExcelIdAndProjectIdAndHtmlUrl(IPage<TextdictInfoVO> page,@Param("treePrivate") WbsTreePrivate treePrivate);
 }

+ 232 - 162
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
+import org.springblade.business.entity.WbsTreeContractStatistics;
 import org.springblade.business.feign.InformationQueryClient;
 import org.springblade.common.utils.BaiduApiUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
@@ -372,7 +373,11 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                 if (contractInfo.getContractType().equals(1)) {
                     LambdaQueryWrapper<WbsTreeContract> queryWrapper = new LambdaQueryWrapper<>();
                     queryWrapper.select(WbsTreeContract::getParentId, WbsTreeContract::getId, WbsTreeContract::getPKeyId);
-                    queryWrapper.like(WbsTreeContract::getFullName, queryValue);
+                    if (queryValue.startsWith(contractInfo.getContractName() + "\\") && queryValue.lastIndexOf("\\") + 1 < queryValue.length()) {
+                        queryWrapper.like(WbsTreeContract::getFullName, queryValue.substring(queryValue.lastIndexOf("\\") + 1));
+                    } else {
+                        queryWrapper.like(WbsTreeContract::getFullName, queryValue);
+                    }
                     queryWrapper.eq(WbsTreeContract::getContractId, contractId);
                     queryWrapper.eq(WbsTreeContract::getType, 1);
                     List<WbsTreeContract> nodes = wbsTreeContractMapper.selectList(queryWrapper);
@@ -401,15 +406,15 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                             }
                         }
 
-                        List<WbsTreeContractLazyVO> distinctNodesAll = nodesAllTemp.stream()
-                                .collect(Collectors.collectingAndThen(
-                                        Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WbsTreeContractLazyVO::getPKeyId))),
-                                        ArrayList::new
-                                ));
-                        List<WbsTreeContractLazyVO> distinctLowestNodesAll = distinctNodesAll.stream().filter(f -> f.getHasChildren().equals(0)).collect(Collectors.collectingAndThen(
-                                Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WbsTreeContractLazyVO::getPKeyId))),
-                                ArrayList::new
-                        ));
+//                        List<WbsTreeContractLazyVO> distinctNodesAll = nodesAllTemp.stream()
+//                                .collect(Collectors.collectingAndThen(
+//                                        Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WbsTreeContractLazyVO::getPKeyId))),
+//                                        ArrayList::new
+//                                ));
+//                        List<WbsTreeContractLazyVO> distinctLowestNodesAll = distinctNodesAll.stream().filter(f -> f.getHasChildren().equals(0)).collect(Collectors.collectingAndThen(
+//                                Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WbsTreeContractLazyVO::getPKeyId))),
+//                                ArrayList::new
+//                        ));
 
                         List<Long> parentIds = nodes.stream().map(WbsTreeContract::getParentId).collect(Collectors.toList());
                         List<Long> ids = nodes.stream().map(WbsTreeContract::getId).collect(Collectors.toList());
@@ -420,68 +425,72 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                         resultNodesPKeyIds.addAll(nodes.stream().map(WbsTreeContract::getPKeyId).collect(Collectors.toList()));
                         List<WbsTreeContract> wbsTreeContractList = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery().in(WbsTreeContract::getPKeyId, resultNodesPKeyIds));
 
-                        List<WbsTreeContractLazyQueryInfoVO> queryInfoList;
-                        Object dataInformationQuery;
-                        if (cn.hutool.core.util.ObjectUtil.isEmpty(tableOwner)) {
-                            dataInformationQuery = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_1");
-                        } else {
-                            dataInformationQuery = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_" + tableOwner);
-                        }
-                        if (dataInformationQuery != null) {
-                            queryInfoList = JSON.parseArray(dataInformationQuery.toString(), WbsTreeContractLazyQueryInfoVO.class);
-                        } else {
-                            if (cn.hutool.core.util.ObjectUtil.isEmpty(tableOwner)) {
-                                queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where id in (SELECT id from (SELECT max(id) as id FROM u_information_query WHERE is_deleted = 0 AND type = 1 AND contract_id = ? GROUP BY wbs_id ) as a)"
-                                        , new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class), contractId);
-                                if (queryInfoList.size() > 0) {
-                                    JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
-                                    redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_1", JSON.toJSON(array).toString());
-                                }
-                            } else {
-                                queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where id in (SELECT id from (SELECT max(id) as id FROM u_information_query WHERE is_deleted = 0 AND type = 1 AND contract_id = ? AND classify = ? GROUP BY wbs_id) as a)"
-                                        , new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class), contractId,tableOwner);
-                                if (queryInfoList.size() > 0) {
-                                    JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
-                                    redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_" + tableOwner, JSON.toJSON(array).toString());
-                                }
-                            }
-                        }
-                        Map<Long, Integer> queryInfoMaps = queryInfoList.stream().filter(f -> cn.hutool.core.util.ObjectUtil.isNotEmpty(f.getWbsId()))
-                                .collect(Collectors.toMap(WbsTreeContractLazyQueryInfoVO::getWbsId, WbsTreeContractLazyQueryInfoVO::getStatus, (existingValue, newValue) -> existingValue));
-                        List<Long> pKeyIdList = new ArrayList<>(queryInfoMaps.keySet());
-
-                        List<WbsTreeContractLazyVO> lowestNodesTB = distinctLowestNodesAll.parallelStream().filter(f -> pKeyIdList.contains(f.getPKeyId()) && resultNodesPKeyIds.contains(f.getPKeyId())).collect(Collectors.toList());
-                        List<Long> lowestNodeParentIdsTB = lowestNodesTB.parallelStream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toList());
-                        List<WbsTreeContractLazyVO> resultParentNodesTB = new ArrayList<>();
-                        wbsTreeContractServiceImpl.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAllTemp);
-
-                        Map<Long, WbsTreeContractLazyVO> lowestNodesMap = lowestNodesTB.stream()
-                                .peek(vo -> {
-                                    Integer colorStatus = queryInfoMaps.get(vo.getPKeyId());
-                                    if (colorStatus != null) {
-                                        vo.setColorStatus(colorStatus == 0 ? 2 : (colorStatus == 1 ? 3 : (colorStatus == 2 ? 4 : 2)));
-                                    } else {
-                                        vo.setColorStatus(1);
-                                    }
-                                }).collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity()));
-
-                        List<NodeVO> nodeVOList = distinctNodesAll.stream().map(wbsTreeContractServiceImpl::convertToNodeVO).collect(Collectors.toList());
-                        Map<Long, NodeVO> nodeVOMap = nodeVOList.stream().collect(Collectors.toMap(NodeVO::getId, vo -> vo, (existing, replacement) -> existing));
-                        List<NodeVO> treeNodeVOList = wbsTreeContractServiceImpl.buildNodeTreeByStream(distinctNodesAll, lowestNodesMap);
-                        NodeVO.calculateStatusToDFS(treeNodeVOList, nodeVOMap);
-                        List<NodeVO> nodeVOS = wbsTreeContractServiceImpl.flattenTree(treeNodeVOList);
-                        Map<Long, Integer> nodeColorStatusMap = nodeVOS.stream().collect(Collectors.toMap(NodeVO::getPKeyId, NodeVO::getStatus, (existing, replacement) -> existing));
+//                        List<WbsTreeContractLazyQueryInfoVO> queryInfoList;
+//                        Object dataInformationQuery;
+//                        if (cn.hutool.core.util.ObjectUtil.isEmpty(tableOwner)) {
+//                            dataInformationQuery = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_1");
+//                        } else {
+//                            dataInformationQuery = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_" + tableOwner);
+//                        }
+//                        if (dataInformationQuery != null) {
+//                            queryInfoList = JSON.parseArray(dataInformationQuery.toString(), WbsTreeContractLazyQueryInfoVO.class);
+//                        } else {
+//                            if (cn.hutool.core.util.ObjectUtil.isEmpty(tableOwner)) {
+//                                queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where id in (SELECT id from (SELECT max(id) as id FROM u_information_query WHERE is_deleted = 0 AND type = 1 AND contract_id = ? GROUP BY wbs_id ) as a)"
+//                                        , new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class), contractId);
+//                                if (queryInfoList.size() > 0) {
+//                                    JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
+//                                    redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_1", JSON.toJSON(array).toString());
+//                                }
+//                            } else {
+//                                queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where id in (SELECT id from (SELECT max(id) as id FROM u_information_query WHERE is_deleted = 0 AND type = 1 AND contract_id = ? AND classify = ? GROUP BY wbs_id) as a)"
+//                                        , new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class), contractId,tableOwner);
+//                                if (queryInfoList.size() > 0) {
+//                                    JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
+//                                    redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "_" + tableOwner, JSON.toJSON(array).toString());
+//                                }
+//                            }
+//                        }
+//                        Map<Long, Integer> queryInfoMaps = queryInfoList.stream().filter(f -> cn.hutool.core.util.ObjectUtil.isNotEmpty(f.getWbsId()))
+//                                .collect(Collectors.toMap(WbsTreeContractLazyQueryInfoVO::getWbsId, WbsTreeContractLazyQueryInfoVO::getStatus, (existingValue, newValue) -> existingValue));
+//                        List<Long> pKeyIdList = new ArrayList<>(queryInfoMaps.keySet());
+
+//                        List<WbsTreeContractLazyVO> lowestNodesTB = distinctLowestNodesAll.parallelStream().filter(f -> pKeyIdList.contains(f.getPKeyId()) && resultNodesPKeyIds.contains(f.getPKeyId())).collect(Collectors.toList());
+//                        List<Long> lowestNodeParentIdsTB = lowestNodesTB.parallelStream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toList());
+//                        List<WbsTreeContractLazyVO> resultParentNodesTB = new ArrayList<>();
+//                        wbsTreeContractServiceImpl.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAllTemp);
+//
+//                        Map<Long, WbsTreeContractLazyVO> lowestNodesMap = lowestNodesTB.stream()
+//                                .peek(vo -> {
+//                                    Integer colorStatus = queryInfoMaps.get(vo.getPKeyId());
+//                                    if (colorStatus != null) {
+//                                        vo.setColorStatus(colorStatus == 0 ? 2 : (colorStatus == 1 ? 3 : (colorStatus == 2 ? 4 : 2)));
+//                                    } else {
+//                                        vo.setColorStatus(1);
+//                                    }
+//                                }).collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity()));
+//
+//                        List<NodeVO> nodeVOList = distinctNodesAll.stream().map(wbsTreeContractServiceImpl::convertToNodeVO).collect(Collectors.toList());
+//                        Map<Long, NodeVO> nodeVOMap = nodeVOList.stream().collect(Collectors.toMap(NodeVO::getId, vo -> vo, (existing, replacement) -> existing));
+//                        List<NodeVO> treeNodeVOList = wbsTreeContractServiceImpl.buildNodeTreeByStream(distinctNodesAll, lowestNodesMap);
+//                        NodeVO.calculateStatusToDFS(treeNodeVOList, nodeVOMap);
+//                        List<NodeVO> nodeVOS = wbsTreeContractServiceImpl.flattenTree(treeNodeVOList);
+//                        Map<Long, Integer> nodeColorStatusMap = nodeVOS.stream().collect(Collectors.toMap(NodeVO::getPKeyId, NodeVO::getStatus, (existing, replacement) -> existing));
 
                         if (wbsTreeContractList.size() > 0) {
-                            Map<Long, Long> countMap = new HashMap<>();
-                            for (WbsTreeContractLazyVO node : resultParentNodesTB) {
-                                Long key = node.getPKeyId();
-                                if (countMap.containsKey(key)) {
-                                    countMap.put(key, countMap.get(key) + 1L);
-                                } else {
-                                    countMap.put(key, 1L);
-                                }
-                            }
+//                            Map<Long, Long> countMap = new HashMap<>();
+//                            for (WbsTreeContractLazyVO node : resultParentNodesTB) {
+//                                Long key = node.getPKeyId();
+//                                if (countMap.containsKey(key)) {
+//                                    countMap.put(key, countMap.get(key) + 1L);
+//                                } else {
+//                                    countMap.put(key, 1L);
+//                                }
+//                            }
+                            String pKeyIds = wbsTreeContractList.stream().map(item -> item.getPKeyId() + "").collect(Collectors.joining(","));
+                            List<WbsTreeContractStatistics> wbsTreeContractStatisticsList = jdbcTemplate.query("select id, leaf_num, fill_num, approve_num, complete_num,jl_fill_num, jl_approve_num, jl_complete_num from m_wbs_tree_contract_statistics where id in (" + pKeyIds + ")",
+                                    new BeanPropertyRowMapper<>(WbsTreeContractStatistics.class));
+                            Map<Long, WbsTreeContractStatistics> wbsTreeContractStatisticsMap = wbsTreeContractStatisticsList.stream().collect(Collectors.toMap(WbsTreeContractStatistics::getId, item -> item));
                             List<WbsTreeContractTreeAllVO> wbsTreeContractTreeAllVOS = wbsTreeContractList.stream()
                                     .map(node -> {
                                         WbsTreeContractTreeAllVO vo = BeanUtil.copyProperties(node, WbsTreeContractTreeAllVO.class);
@@ -490,22 +499,30 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                                             vo.setType(ObjectUtils.isNotEmpty(node.getNodeType()) ? node.getNodeType() : 0);
                                             vo.setTitle(ObjectUtil.isNotEmpty(node.getFullName()) ? node.getFullName() : node.getNodeName());
                                             vo.setPrimaryKeyId(node.getPKeyId());
-
-                                            vo.setSubmitCounts(ObjectUtil.isNotEmpty(countMap.get(vo.getPrimaryKeyId())) ? countMap.get(vo.getPrimaryKeyId()) : (ObjectUtil.isNotEmpty(queryInfoMaps.get(vo.getPrimaryKeyId())) ? 1L : 0L));
-
-                                            Integer parentColorStatus = nodeColorStatusMap.get(vo.getPrimaryKeyId());
-                                            if (parentColorStatus != null) {
-                                                vo.setColorStatus(parentColorStatus);
+                                            WbsTreeContractStatistics statistics = wbsTreeContractStatisticsMap.get(node.getPKeyId());
+                                            if (statistics != null) {
+                                                Integer nums = statistics.calculateSubmitNums(tableOwner);
+                                                vo.setSubmitCounts(nums == null ? 0 : nums.longValue());
+                                                vo.setColorStatus(statistics.calculateColorStatus(tableOwner));
                                             } else {
-                                                WbsTreeContractLazyVO lowestNode = lowestNodesMap.get(vo.getPrimaryKeyId());
-                                                if (lowestNode != null) {
-                                                    vo.setColorStatus(lowestNode.getColorStatus());
-                                                }
+                                                vo.setSubmitCounts(0L);
+                                                vo.setColorStatus(1);
                                             }
+//                                            vo.setSubmitCounts(ObjectUtil.isNotEmpty(countMap.get(vo.getPrimaryKeyId())) ? countMap.get(vo.getPrimaryKeyId()) : (ObjectUtil.isNotEmpty(queryInfoMaps.get(vo.getPrimaryKeyId())) ? 1L : 0L));
+//
+//                                            Integer parentColorStatus = nodeColorStatusMap.get(vo.getPrimaryKeyId());
+//                                            if (parentColorStatus != null) {
+//                                                vo.setColorStatus(parentColorStatus);
+//                                            } else {
+//                                                WbsTreeContractLazyVO lowestNode = lowestNodesMap.get(vo.getPrimaryKeyId());
+//                                                if (lowestNode != null) {
+//                                                    vo.setColorStatus(lowestNode.getColorStatus());
+//                                                }
+//                                            }
                                         }
                                         return vo;
                                     }).collect(Collectors.toList());
-                            return R.data(this.buildWbsTreeByStreamByTreeAll(wbsTreeContractTreeAllVOS));
+                            return R.data(this.buildWbsTreeByStreamByTreeAll(wbsTreeContractTreeAllVOS, queryValue));
                         }
                     }
 
@@ -517,9 +534,14 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                         return null;
                     }
                     for (ContractRelationJlyz contractRelationJlyz : relationJLYZList) {
+                        ContractInfo contractInfoJlYz = this.getBaseMapper().selectById(contractRelationJlyz.getContractIdSg());
                         LambdaQueryWrapper<WbsTreeContract> queryWrapper = new LambdaQueryWrapper<>();
                         queryWrapper.select(WbsTreeContract::getParentId, WbsTreeContract::getId, WbsTreeContract::getPKeyId);
-                        queryWrapper.like(WbsTreeContract::getFullName, queryValue);
+                        if (queryValue.startsWith(contractInfoJlYz.getContractName() + "\\") && queryValue.lastIndexOf("\\") + 1 < queryValue.length()) {
+                            queryWrapper.like(WbsTreeContract::getFullName, queryValue.substring(queryValue.lastIndexOf("\\") + 1));
+                        } else {
+                            queryWrapper.like(WbsTreeContract::getFullName, queryValue);
+                        }
                         queryWrapper.eq(WbsTreeContract::getContractId, contractRelationJlyz.getContractIdSg());
                         queryWrapper.eq(WbsTreeContract::getType, 1);
                         List<WbsTreeContract> nodes = wbsTreeContractMapper.selectList(queryWrapper);
@@ -549,15 +571,15 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                                 }
                             }
 
-                            List<WbsTreeContractLazyVO> distinctNodesAll = nodesAllTemp.stream()
-                                    .collect(Collectors.collectingAndThen(
-                                            Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WbsTreeContractLazyVO::getPKeyId))),
-                                            ArrayList::new
-                                    ));
-                            List<WbsTreeContractLazyVO> distinctLowestNodesAll = distinctNodesAll.stream().filter(f -> f.getHasChildren().equals(0)).collect(Collectors.collectingAndThen(
-                                    Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WbsTreeContractLazyVO::getPKeyId))),
-                                    ArrayList::new
-                            ));
+//                            List<WbsTreeContractLazyVO> distinctNodesAll = nodesAllTemp.stream()
+//                                    .collect(Collectors.collectingAndThen(
+//                                            Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WbsTreeContractLazyVO::getPKeyId))),
+//                                            ArrayList::new
+//                                    ));
+//                            List<WbsTreeContractLazyVO> distinctLowestNodesAll = distinctNodesAll.stream().filter(f -> f.getHasChildren().equals(0)).collect(Collectors.collectingAndThen(
+//                                    Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WbsTreeContractLazyVO::getPKeyId))),
+//                                    ArrayList::new
+//                            ));
 
                             List<Long> parentIds = nodes.stream().map(WbsTreeContract::getParentId).collect(Collectors.toList());
                             List<Long> ids = nodes.stream().map(WbsTreeContract::getId).collect(Collectors.toList());
@@ -567,69 +589,73 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                             resultNodesPKeyIds.addAll(nodes.stream().map(WbsTreeContract::getPKeyId).collect(Collectors.toList()));
                             List<WbsTreeContract> wbsTreeContractList = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery().in(WbsTreeContract::getPKeyId, resultNodesPKeyIds));
 
-                            List<WbsTreeContractLazyQueryInfoVO> queryInfoList;
-                            Object dataInformationQuery;
-                            if (cn.hutool.core.util.ObjectUtil.isEmpty(tableOwner)) {
-                                dataInformationQuery = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:byInformationQuery:" + contractRelationJlyz.getContractIdSg() + "_1");
-                            } else {
-                                dataInformationQuery = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:byInformationQuery:" + contractRelationJlyz.getContractIdSg() + "_" + tableOwner);
-                            }
-                            if (dataInformationQuery != null) {
-                                queryInfoList = JSON.parseArray(dataInformationQuery.toString(), WbsTreeContractLazyQueryInfoVO.class);
-                            } else {
-                                if (cn.hutool.core.util.ObjectUtil.isEmpty(tableOwner)) {
-                                    queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where id in (SELECT id from (SELECT max(id) as id FROM u_information_query WHERE is_deleted = 0 AND type = 1 AND contract_id = ? GROUP BY wbs_id) as a)"
-                                            , new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class), contractRelationJlyz.getContractIdSg());
-                                    if (queryInfoList.size() > 0) {
-                                        JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
-                                        redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractRelationJlyz.getContractIdSg() + "_1", JSON.toJSON(array).toString());
-                                    }
-                                } else {
-                                    queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where id in (SELECT id from (SELECT max(id) as id FROM u_information_query WHERE is_deleted = 0 AND type = 1 AND contract_id = ? AND classify = ? GROUP BY wbs_id) as a)"
-                                            , new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class), contractRelationJlyz.getContractIdSg(), tableOwner);
-                                    if (queryInfoList.size() > 0) {
-                                        JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
-                                        redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractRelationJlyz.getContractIdSg() + "_" + tableOwner, JSON.toJSON(array).toString());
-                                    }
-                                }
-                            }
-                            Map<Long, Integer> queryInfoMaps = queryInfoList.stream().filter(f -> cn.hutool.core.util.ObjectUtil.isNotEmpty(f.getWbsId()))
-                                    .collect(Collectors.toMap(WbsTreeContractLazyQueryInfoVO::getWbsId, WbsTreeContractLazyQueryInfoVO::getStatus, (existingValue, newValue) -> existingValue));
-                            List<Long> pKeyIdList = new ArrayList<>(queryInfoMaps.keySet());
-
-                            //数量
-                            List<WbsTreeContractLazyVO> lowestNodesTB = distinctLowestNodesAll.parallelStream().filter(f -> pKeyIdList.contains(f.getPKeyId()) && resultNodesPKeyIds.contains(f.getPKeyId())).collect(Collectors.toList());
-                            List<Long> lowestNodeParentIdsTB = lowestNodesTB.parallelStream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toList());
-                            List<WbsTreeContractLazyVO> resultParentNodesTB = new ArrayList<>();
-                            wbsTreeContractServiceImpl.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAllTemp);
-
-                            Map<Long, WbsTreeContractLazyVO> lowestNodesMap = lowestNodesTB.stream()
-                                    .peek(vo -> {
-                                        Integer colorStatus = queryInfoMaps.get(vo.getPKeyId());
-                                        if (colorStatus != null) {
-                                            vo.setColorStatus(colorStatus == 0 ? 2 : (colorStatus == 1 ? 3 : (colorStatus == 2 ? 4 : 2)));
-                                        } else {
-                                            vo.setColorStatus(1);
-                                        }
-                                    }).collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity()));
-
-                            List<NodeVO> nodeVOList = distinctNodesAll.stream().map(wbsTreeContractServiceImpl::convertToNodeVO).collect(Collectors.toList());
-                            Map<Long, NodeVO> nodeVOMap = nodeVOList.stream().collect(Collectors.toMap(NodeVO::getId, vo -> vo, (existing, replacement) -> existing));
-                            List<NodeVO> treeNodeVOList = wbsTreeContractServiceImpl.buildNodeTreeByStream(distinctNodesAll, lowestNodesMap);
-                            NodeVO.calculateStatusToDFS(treeNodeVOList, nodeVOMap);
-                            List<NodeVO> nodeVOS = wbsTreeContractServiceImpl.flattenTree(treeNodeVOList);
-                            Map<Long, Integer> nodeColorStatusMap = nodeVOS.stream().collect(Collectors.toMap(NodeVO::getPKeyId, NodeVO::getStatus, (existing, replacement) -> existing));
+//                            List<WbsTreeContractLazyQueryInfoVO> queryInfoList;
+//                            Object dataInformationQuery;
+//                            if (cn.hutool.core.util.ObjectUtil.isEmpty(tableOwner)) {
+//                                dataInformationQuery = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:byInformationQuery:" + contractRelationJlyz.getContractIdSg() + "_1");
+//                            } else {
+//                                dataInformationQuery = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:byInformationQuery:" + contractRelationJlyz.getContractIdSg() + "_" + tableOwner);
+//                            }
+//                            if (dataInformationQuery != null) {
+//                                queryInfoList = JSON.parseArray(dataInformationQuery.toString(), WbsTreeContractLazyQueryInfoVO.class);
+//                            } else {
+//                                if (cn.hutool.core.util.ObjectUtil.isEmpty(tableOwner)) {
+//                                    queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where id in (SELECT id from (SELECT max(id) as id FROM u_information_query WHERE is_deleted = 0 AND type = 1 AND contract_id = ? GROUP BY wbs_id) as a)"
+//                                            , new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class), contractRelationJlyz.getContractIdSg());
+//                                    if (queryInfoList.size() > 0) {
+//                                        JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
+//                                        redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractRelationJlyz.getContractIdSg() + "_1", JSON.toJSON(array).toString());
+//                                    }
+//                                } else {
+//                                    queryInfoList = jdbcTemplate.query("select wbs_id,status from u_information_query where id in (SELECT id from (SELECT max(id) as id FROM u_information_query WHERE is_deleted = 0 AND type = 1 AND contract_id = ? AND classify = ? GROUP BY wbs_id) as a)"
+//                                            , new BeanPropertyRowMapper<>(WbsTreeContractLazyQueryInfoVO.class), contractRelationJlyz.getContractIdSg(), tableOwner);
+//                                    if (queryInfoList.size() > 0) {
+//                                        JSONArray array = JSONArray.parseArray(JSON.toJSONString(queryInfoList));
+//                                        redisTemplate.opsForValue().set("blade-manager::contract:wbstree:byInformationQuery:" + contractRelationJlyz.getContractIdSg() + "_" + tableOwner, JSON.toJSON(array).toString());
+//                                    }
+//                                }
+//                            }
+//                            Map<Long, Integer> queryInfoMaps = queryInfoList.stream().filter(f -> cn.hutool.core.util.ObjectUtil.isNotEmpty(f.getWbsId()))
+//                                    .collect(Collectors.toMap(WbsTreeContractLazyQueryInfoVO::getWbsId, WbsTreeContractLazyQueryInfoVO::getStatus, (existingValue, newValue) -> existingValue));
+//                            List<Long> pKeyIdList = new ArrayList<>(queryInfoMaps.keySet());
+//
+//                            //数量
+//                            List<WbsTreeContractLazyVO> lowestNodesTB = distinctLowestNodesAll.parallelStream().filter(f -> pKeyIdList.contains(f.getPKeyId()) && resultNodesPKeyIds.contains(f.getPKeyId())).collect(Collectors.toList());
+//                            List<Long> lowestNodeParentIdsTB = lowestNodesTB.parallelStream().map(WbsTreeContractLazyVO::getParentId).collect(Collectors.toList());
+//                            List<WbsTreeContractLazyVO> resultParentNodesTB = new ArrayList<>();
+//                            wbsTreeContractServiceImpl.recursiveGetParentNodes(resultParentNodesTB, lowestNodeParentIdsTB, nodesAllTemp);
+//
+//                            Map<Long, WbsTreeContractLazyVO> lowestNodesMap = lowestNodesTB.stream()
+//                                    .peek(vo -> {
+//                                        Integer colorStatus = queryInfoMaps.get(vo.getPKeyId());
+//                                        if (colorStatus != null) {
+//                                            vo.setColorStatus(colorStatus == 0 ? 2 : (colorStatus == 1 ? 3 : (colorStatus == 2 ? 4 : 2)));
+//                                        } else {
+//                                            vo.setColorStatus(1);
+//                                        }
+//                                    }).collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity()));
+//
+//                            List<NodeVO> nodeVOList = distinctNodesAll.stream().map(wbsTreeContractServiceImpl::convertToNodeVO).collect(Collectors.toList());
+//                            Map<Long, NodeVO> nodeVOMap = nodeVOList.stream().collect(Collectors.toMap(NodeVO::getId, vo -> vo, (existing, replacement) -> existing));
+//                            List<NodeVO> treeNodeVOList = wbsTreeContractServiceImpl.buildNodeTreeByStream(distinctNodesAll, lowestNodesMap);
+//                            NodeVO.calculateStatusToDFS(treeNodeVOList, nodeVOMap);
+//                            List<NodeVO> nodeVOS = wbsTreeContractServiceImpl.flattenTree(treeNodeVOList);
+//                            Map<Long, Integer> nodeColorStatusMap = nodeVOS.stream().collect(Collectors.toMap(NodeVO::getPKeyId, NodeVO::getStatus, (existing, replacement) -> existing));
 
                             if (wbsTreeContractList.size() > 0) {
-                                Map<Long, Long> countMap = new HashMap<>();
-                                for (WbsTreeContractLazyVO node : resultParentNodesTB) {
-                                    Long key = node.getPKeyId();
-                                    if (countMap.containsKey(key)) {
-                                        countMap.put(key, countMap.get(key) + 1L);
-                                    } else {
-                                        countMap.put(key, 1L);
-                                    }
-                                }
+//                                Map<Long, Long> countMap = new HashMap<>();
+//                                for (WbsTreeContractLazyVO node : resultParentNodesTB) {
+//                                    Long key = node.getPKeyId();
+//                                    if (countMap.containsKey(key)) {
+//                                        countMap.put(key, countMap.get(key) + 1L);
+//                                    } else {
+//                                        countMap.put(key, 1L);
+//                                    }
+//                                }
+                                String pKeyIds = wbsTreeContractList.stream().map(item -> item.getPKeyId() + "").collect(Collectors.joining(","));
+                                List<WbsTreeContractStatistics> wbsTreeContractStatisticsList = jdbcTemplate.query("select id, leaf_num, fill_num, approve_num, complete_num,jl_fill_num, jl_approve_num, jl_complete_num from m_wbs_tree_contract_statistics where id in (" + pKeyIds + ")",
+                                        new BeanPropertyRowMapper<>(WbsTreeContractStatistics.class));
+                                Map<Long, WbsTreeContractStatistics> wbsTreeContractStatisticsMap = wbsTreeContractStatisticsList.stream().collect(Collectors.toMap(WbsTreeContractStatistics::getId, item -> item));
                                 List<WbsTreeContractTreeAllVO> wbsTreeContractTreeAllVOS = wbsTreeContractList.stream()
                                         .map(node -> {
                                             WbsTreeContractTreeAllVO vo = BeanUtil.copyProperties(node, WbsTreeContractTreeAllVO.class);
@@ -638,21 +664,30 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
                                                 vo.setType(ObjectUtils.isNotEmpty(node.getNodeType()) ? node.getNodeType() : 0);
                                                 vo.setTitle(ObjectUtil.isNotEmpty(node.getFullName()) ? node.getFullName() : node.getNodeName());
                                                 vo.setPrimaryKeyId(node.getPKeyId());
-                                                vo.setSubmitCounts(ObjectUtil.isNotEmpty(countMap.get(vo.getPrimaryKeyId())) ? countMap.get(vo.getPrimaryKeyId()) : (ObjectUtil.isNotEmpty(queryInfoMaps.get(vo.getPrimaryKeyId())) ? 1L : 0L));
-
-                                                Integer parentColorStatus = nodeColorStatusMap.get(vo.getPrimaryKeyId());
-                                                if (parentColorStatus != null) {
-                                                    vo.setColorStatus(parentColorStatus);
+                                                WbsTreeContractStatistics statistics = wbsTreeContractStatisticsMap.get(node.getPKeyId());
+                                                if (statistics != null) {
+                                                    Integer nums = statistics.calculateSubmitNums(tableOwner);
+                                                    vo.setSubmitCounts(nums == null ? 0 : nums.longValue());
+                                                    vo.setColorStatus(statistics.calculateColorStatus(tableOwner));
                                                 } else {
-                                                    WbsTreeContractLazyVO lowestNode = lowestNodesMap.get(vo.getPrimaryKeyId());
-                                                    if (lowestNode != null) {
-                                                        vo.setColorStatus(lowestNode.getColorStatus());
-                                                    }
+                                                    vo.setSubmitCounts(0L);
+                                                    vo.setColorStatus(1);
                                                 }
+//                                                vo.setSubmitCounts(ObjectUtil.isNotEmpty(countMap.get(vo.getPrimaryKeyId())) ? countMap.get(vo.getPrimaryKeyId()) : (ObjectUtil.isNotEmpty(queryInfoMaps.get(vo.getPrimaryKeyId())) ? 1L : 0L));
+//
+//                                                Integer parentColorStatus = nodeColorStatusMap.get(vo.getPrimaryKeyId());
+//                                                if (parentColorStatus != null) {
+//                                                    vo.setColorStatus(parentColorStatus);
+//                                                } else {
+//                                                    WbsTreeContractLazyVO lowestNode = lowestNodesMap.get(vo.getPrimaryKeyId());
+//                                                    if (lowestNode != null) {
+//                                                        vo.setColorStatus(lowestNode.getColorStatus());
+//                                                    }
+//                                                }
                                             }
                                             return vo;
                                         }).collect(Collectors.toList());
-                                resultMaps.put(contractRelationJlyz.getContractIdSg(), this.buildWbsTreeByStreamByTreeAll(wbsTreeContractTreeAllVOS));
+                                resultMaps.put(contractRelationJlyz.getContractIdSg(), this.buildWbsTreeByStreamByTreeAll(wbsTreeContractTreeAllVOS, queryValue));
                             }
                         }
                     }
@@ -759,6 +794,41 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
         this.recursionFnTreeAll(list, map);
         return list;
     }
+    public List<WbsTreeContractTreeAllVO> buildWbsTreeByStreamByTreeAll(List<WbsTreeContractTreeAllVO> wbsTreeVO2s, String position) {
+        String[] split = position.split("\\\\");
+        if (split.length > 1 && split[1] != null && !split[1].isEmpty()) {
+            List<WbsTreeContractTreeAllVO> list = wbsTreeVO2s.stream().filter(f -> f.getParentId() == 0L).collect(Collectors.toList());
+            Map<Long, List<WbsTreeContractTreeAllVO>> map = wbsTreeVO2s.stream().collect(Collectors.groupingBy(WbsTreeContractTreeAllVO::getParentId));
+            this.recursionFnTreeAll(list, map, split, 0);
+            return list;
+        }
+        return buildWbsTreeByStreamByTreeAll(wbsTreeVO2s);
+    }
+    public void recursionFnTreeAll(List<WbsTreeContractTreeAllVO> list, Map<Long, List<WbsTreeContractTreeAllVO>> map, String[] positions, int i) {
+        for (WbsTreeContractTreeAllVO wbsTreeContractVO : list) {
+            String position;
+            if (i == 0 || i >= positions.length) {
+                position = null;
+            } else {
+                position = positions[i];
+            }
+            i++;
+            if (wbsTreeContractVO.getTitle() != null && (position == null || wbsTreeContractVO.getTitle().contains(position))) {
+                List<WbsTreeContractTreeAllVO> childrenList = map.get(wbsTreeContractVO.getId());
+                if (childrenList != null && !childrenList.isEmpty()) {
+                    if (i < positions.length) {
+                        String temp = positions[i];
+                        childrenList = childrenList.stream().filter(item -> item.getTitle().contains(temp)).collect(Collectors.toList());
+                    }
+                    wbsTreeContractVO.setChildren(childrenList);
+                    if (!childrenList.isEmpty()) {
+                        wbsTreeContractVO.setHasChildren(true);
+                        recursionFnTreeAll(childrenList, map, positions, i);
+                    }
+                }
+            }
+        }
+    }
 
     public void recursionFnTree(List<WbsTreeContractVO> list, Map<Long, List<WbsTreeContractVO>> map) {
         for (WbsTreeContractVO wbsTreeContractVO : list) {

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

@@ -6473,7 +6473,17 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             Optional<String> Key = dataMap2.keySet().stream().findFirst();
             if(Key.isPresent()){
                 String sql="update "+wbsTreeContract.getInitTableName()+" set "+Key.get()+" = '"+dataMap2.get(Key.get())+"' where p_key_id = "+wbsTreeContract.getPKeyId();
-                jdbcTemplate.update(sql);
+                int update = jdbcTemplate.update(sql);
+                if(update<=0){
+                    String sql1 = "select count(id) from " + wbsTreeContract.getInitTableName() + " where p_key_id = ?";
+                    Integer count = jdbcTemplate.queryForObject(sql1, Integer.class, wbsTreeContract.getPKeyId());
+                    if(count==0){
+                       String insertSql="insert into "+wbsTreeContract.getInitTableName()+"(id,p_key_id,"+Key.get()+") values("+SnowFlakeUtil.getId()+","+wbsTreeContract.getPKeyId()+",'"+dataMap2.get(Key.get())+"')";
+                        System.out.println(insertSql);
+                        jdbcTemplate.execute(insertSql);
+                    }
+
+                }
             }
             //生成单张pdf
             getBussPdfInfo(wbsTreeContract.getPKeyId());

+ 24 - 244
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/TextdictInfoServiceImpl.java

@@ -84,82 +84,36 @@ public class TextdictInfoServiceImpl extends ServiceImpl<TextdictInfoMapper, Tex
             WbsTreePrivate privateInfo = wbsTreePrivateMapper.getByPKeyId(Func.toLong(textdictInfo.getTabId() + ""));
             String htmlUrl = privateInfo.getHtmlUrl();
             try {
-                InputStream fileInputStream = FileUtils.getInputStreamByUrl(htmlUrl);
-                String htmlString = IoUtil.readToString(fileInputStream);
-                Document doc = Jsoup.parse(htmlString);
-                Elements table = doc.getElementsByAttribute("dqid");
-                List<String> dqid = new ArrayList<>();
-                Map<String, String> dqIdMap = new HashMap<>();
-                Map<String, String> keys = new HashMap<>();
-                for(Element ek:table){
-                    List<String> list = Func.toStrList("\\|\\|", ek.attr("dqid"));
-                    dqid.addAll(list);
-                    Elements keyname = ek.getElementsByAttributeValueStarting("keyname", "key_");
-                    if (keyname != null && !keyname.isEmpty()) {
-                        String key = keyname.get(0).attr("keyname");
-                        for (String s : list) {
-                            dqIdMap.put(s, key);
-                        }
-                    }
-                }
-                Elements keyNames = doc.getElementsByAttribute("keyname");
-                if(Func.isNotEmpty(keyNames)){
-                    for(Element keyName:keyNames){
-                        keys.put(keyName.attr("keyname"), keyName.attr("placeholder"));
-                    }
-                }
                 if(Func.isNotEmpty(textdictInfo.getShowType()) && textdictInfo.getShowType() == 1){
-                    List<TextdictInfo> textdictInfos = new ArrayList<>();
-                    if(Func.isNotEmpty(dqid) && dqid.size() > 0){
-                        textdict = baseMapper.selectTextdictBYIds(dqid,privateInfo.getProjectId());
-                        // 系统推荐方案一:根据dqId、col_key和col_name查询
-                        textdict = getTextdictInfoByDqIdAndKeyName(textdict, dqIdMap, keys, textdictInfos);
-                    }else {
-                        // 系统推荐方法二:根据excel_id, col_key, col_name查询
-                        textdict = getTextDictInfoBySystem(textdictInfo, keys, textdict, doc, privateInfo, dqid);
+                    textdict = baseMapper.selectTextDictInfoByProjectIdAndTabId(page, privateInfo);
+                    if (textdict == null || textdict.isEmpty()) {
+                        textdict = baseMapper.selectTextdictInfoByExcelIdAndProjectIdAndHtmlUrl(page, privateInfo);
                     }
-                    if (!keys.isEmpty()) {
-                        TextdictInfoVO temp = null;
-                        if (textdict != null && !textdict.isEmpty()) {
-                            temp = textdict.get(0);
-                        }
-                        if (temp == null) {
-                            temp = new TextdictInfoVO();
-                            temp.setProjectId(privateInfo.getProjectId());
-                            temp.setExcelId(privateInfo.getExcelId() + "");
-                            temp.setTabId(privateInfo.getPKeyId() + "");
-                            temp.setType(2);
-                        }
-                        // 查询电签库配置
-                        List<TextdictInfoVO> textdictConfigList = iSignConfigService.hasSignConfig(privateInfo.getInitTableName(), keys.keySet(), temp);
-                        saveSignTextDictInfo(textdictInfos, textdictConfigList, keys);
-                        if (textdict == null || textdict.isEmpty()) {
-                            textdict = textdictConfigList;
-                        } else {
-                            Map<String, Map<String, TextdictInfoVO>> map = textdict.stream().filter(vo -> vo.getColKey() != null && vo.getColKey().contains("__")).collect(Collectors.groupingBy(vo -> vo.getColKey().split("__")[1], Collectors.toMap(TextdictInfoVO::getSigRoleId, v -> v, (v1, v2) -> v1)));
-                            List<TextdictInfoVO> collect = textdictConfigList.stream().filter(textdictInfoVO -> {
-                                if (textdictInfoVO.getColKey() == null || !textdictInfoVO.getColKey().contains("__")) {
-                                    return true;
-                                }
-                                Map<String, TextdictInfoVO> voMap = map.get(textdictInfoVO.getColKey().split("__")[1]);
-                                if (voMap != null && !voMap.isEmpty() ) {
-                                    return voMap.get(textdictInfoVO.getSigRoleId()) == null;
+                    if (textdict != null && !textdict.isEmpty()) {
+                        Map<String, TextdictInfoVO> map = textdict.stream().collect(Collectors.toMap(item -> item.getProjectId() + item.getTabId() + item.getColKey() + item.getColName(), item -> item, (v1, v2) -> v1));
+                        textdict = new ArrayList<>(map.values());
+                        InputStream fileInputStream = FileUtils.getInputStreamByUrl(htmlUrl);
+                        String htmlString = IoUtil.readToString(fileInputStream);
+                        Document doc = Jsoup.parse(htmlString);
+                        for (TextdictInfoVO vo : textdict) {
+                            Elements keyName = doc.getElementsByAttributeValue("keyname", vo.getColKey());
+                            if (keyName ==  null || keyName.isEmpty()) {
+                                vo.setIsMatch(0);
+                                continue;
+                            }
+                            for (Element element : keyName) {
+                                String placeholder = element.attr("placeholder");
+                                if (placeholder != null && !placeholder.equals(vo.getColName())) {
+                                    vo.setIsMatch(0);
+                                } else {
+                                    vo.setIsMatch(1);
+                                    break;
                                 }
-                                return true;
-                            }).collect(Collectors.toList());
-                            textdict.addAll(collect);
+                            }
                         }
                     }
                 }else{
-                    if (!keys.isEmpty()) {
-                        // 根据excel_id 和col_key 查询
-                        List<TextdictInfoVO> textdictList= baseMapper.selectTextdictInfoByExcelIdAndColKey(textdictInfo.getExcelId(),keys.keySet());
-                        if (textdictList != null) {
-                            Map<String, TextdictInfoVO> map = textdictList.stream().filter(vo -> vo.getColName() != null && vo.getColName().equals(keys.get(vo.getColKey())))
-                                    .collect(Collectors.toMap(vo -> vo.getColKey() + vo.getSigRoleId(), v -> v, (v1, v2) -> v1));
-                            textdict = new ArrayList<>(map.values());
-                        }
-                    }
+                    textdict = baseMapper.selectTextdictInfoByExcelId(page, textdictInfo);
                 }
             } catch (Exception e) {
                 throw new RuntimeException(e);
@@ -170,180 +124,6 @@ public class TextdictInfoServiceImpl extends ServiceImpl<TextdictInfoMapper, Tex
         return page.setRecords(textdict);
     }
 
-    private void saveSignTextDictInfo(List<TextdictInfo> textdictInfos, List<TextdictInfoVO> textdictRecommendedList, Map<String, String> keys) {
-        if (!textdictInfos.isEmpty()) {
-            // 保存到数据库,从系统推荐中获取roleId
-            if (textdictRecommendedList != null && !textdictRecommendedList.isEmpty()) {
-                Map<String, TextdictInfoVO> map = textdictRecommendedList.stream().filter(vo -> vo.getColName() != null && vo.getColName().equals(keys.get(vo.getColKey()))).collect(Collectors.toMap(vo -> vo.getColKey() + vo.getSigRoleId(), v -> v, (v1, v2) -> v1));
-                Collection<TextdictInfoVO> values = map.values();
-                Map<String, TextdictInfo> collect = textdictInfos.stream().collect(Collectors.toMap(info -> info.getColKey() + info.getColName(), v -> v, (v1, v2) -> v1));
-                for (TextdictInfoVO vo : values) {
-                    TextdictInfo info = collect.get(vo.getColKey() + vo.getColName());
-                    if (info != null) {
-                        vo.setId(info.getId());
-                        vo.setProjectId("0");
-                        BeanUtil.copyProperties(vo, info);
-                        vo.setIsSystem(2);
-                    }
-                }
-                List<TextdictInfo> list = textdictInfos.stream().filter(info -> StringUtil.hasText(info.getSigRoleId())).collect(Collectors.toList());
-                this.saveBatch( list);
-            }
-        }
-    }
-
-    /**
-     * 系统推荐
-     */
-    @Nullable
-    private List<TextdictInfoVO> getTextDictInfoBySystem(TextdictInfoVO textdictInfo, Map<String, String> keys,  List<TextdictInfoVO> textdict, Document doc, WbsTreePrivate privateInfo, List<String> dqid) {
-        // 根据excel_id 和col_key 查询
-        List<TextdictInfoVO> textdictList= baseMapper.selectTextdictInfoByExcelIdAndColKey(textdictInfo.getExcelId(), keys.keySet());
-        if (textdictList != null) {
-            Map<String, TextdictInfoVO> map = textdictList.stream().filter(vo -> vo.getColName() != null && vo.getColName().equals(keys.get(vo.getColKey()))).collect(Collectors.toMap(vo -> vo.getColKey() + vo.getSigRoleId(), v -> v, (v1, v2) -> v1));
-            textdictList = new ArrayList<>(map.values());
-        }
-        if (textdict.isEmpty()) {
-            textdict = textdictList;
-            if (textdict != null) {
-                textdict.forEach(textdictInfoVO -> textdictInfoVO.setIsSystem(2));
-            }
-            addSign(textdict, doc, privateInfo, dqid, textdict);
-        } else if (textdictList != null && !textdictList.isEmpty()) {
-            Map<String, Map<String, TextdictInfoVO>> map = textdict.stream().filter(vo -> vo.getColKey() != null && vo.getColKey().contains("__")).collect(Collectors.groupingBy(vo -> vo.getColKey().split("__")[1], Collectors.toMap(TextdictInfoVO::getSigRoleId, v -> v, (v1, v2) -> v1)));
-            List<TextdictInfoVO> collect = textdictList.stream().filter(textdictInfoVO -> {
-                if (textdictInfoVO.getColKey() == null || !textdictInfoVO.getColKey().contains("__")) {
-                    return true;
-                }
-                Map<String, TextdictInfoVO> voMap = map.get(textdictInfoVO.getColKey().split("__")[1]);
-                textdictInfoVO.setIsSystem(2);
-                if (voMap != null && !voMap.isEmpty() ) {
-                    return voMap.get(textdictInfoVO.getSigRoleId()) == null;
-                }
-                return true;
-            }).collect(Collectors.toList());
-            textdict.addAll(collect);
-            addSign(collect, doc, privateInfo, dqid, textdict);
-        }
-        return textdict;
-    }
-
-    @NotNull
-    private List<TextdictInfoVO> getTextdictInfoByDqIdAndKeyName(List<TextdictInfoVO> textdict, Map<String, String> dqIdMap, Map<String, String> keys, List<TextdictInfo> textdictInfos) {
-        if (textdict == null) {
-            textdict = new ArrayList<>();
-        }
-        Map<String, TextdictInfoVO> idsMap = textdict.stream().collect(Collectors.toMap(item -> item.getId() + "", v -> v, (v1, v2) -> v2));
-        Map<String, TextdictInfoVO> colKeyMap = textdict.stream().collect(Collectors.toMap(item -> item.getId() + "", v -> v, (v1, v2) -> v2));
-        dqIdMap.forEach((k, v) -> {
-            if (idsMap.containsKey(k) || colKeyMap.containsKey(v)) {
-                return;
-            }
-            Long id = null;
-            try {
-                id = Long.parseLong(k);
-            } catch (Exception e) {
-                log.warn(e.getMessage());
-            }
-            String colName = keys.get(v);
-            if (id == null || v == null || colName == null) {
-                return;
-            }
-            TextdictInfo info = new TextdictInfo();
-            info.setId(id);
-            info.setColKey(v);
-            textdictInfos.add(info);
-        });
-        if (!textdictInfos.isEmpty()) {
-            List<TextdictInfoVO> list = baseMapper.selectTextDictInfoByIdAndColKeyAndColName(textdictInfos);
-            Map<String, List<TextdictInfoVO>> voMap = list.stream().collect(Collectors.groupingBy(item -> item.getId() + item.getColKey()));
-            List<TextdictInfoVO> tempList = new ArrayList<>();
-            voMap.forEach((key, values) -> {
-                TextdictInfoVO temp = null;
-                if (values.size() == 1) {
-                    temp = values.get(0);
-                } else {
-                    for (TextdictInfoVO value : values) {
-                        String colName = keys.get(value.getColKey());
-                        if (colName == null || colName.equals(value.getColName())) {
-                            temp = value;
-                            break;
-                        }
-                    }
-                    if (temp == null) {
-                        // 出现次数最多
-                        Map<String, List<TextdictInfoVO>> collect = values.stream().collect(Collectors.groupingBy(TextdictInfoVO::getColName));
-                        temp = collect.entrySet().stream().max(Comparator.comparingInt(entry -> entry.getValue().size())).get().getValue().get(0);
-                    }
-                }
-                temp.setIsSystem(2);
-                tempList.add(temp);
-                colKeyMap.put(temp.getColKey(), temp);
-            });
-            textdict.addAll(tempList);
-            textdictInfos.removeIf(item -> voMap.containsKey(item.getId() + item.getColKey()) || colKeyMap.containsKey(item.getColKey()));
-        }
-        return textdict;
-    }
-
-    private void addSign(List<TextdictInfoVO> collect, Document doc, WbsTreePrivate privateInfo, List<String> dqid,List<TextdictInfoVO> allTextdict) {
-        if (collect == null || collect.isEmpty()) {
-            return;
-        }
-        if (dqid != null && !dqid.isEmpty()) {
-            collect = collect.stream().filter(textdictInfoVO -> !dqid.contains(textdictInfoVO.getId() + "")).collect(Collectors.toList());
-            if (collect.isEmpty()) {
-                return;
-            }
-        }
-        //解析
-        Element table = doc.select("table").first();
-        Elements trs = table.select("tr");
-        AtomicBoolean isUpdate = new AtomicBoolean(false);
-        Map<String, List<TextdictInfoVO>> colKeyMap = allTextdict.stream().collect(Collectors.groupingBy(TextdictInfoVO::getColKey));
-        colKeyMap.forEach((colKey, textdictInfoVOs) -> {
-            if (StringUtil.hasText(colKey)) {
-                try {
-                    String[] trtd = colKey.split("__")[1].split("_");
-                    Element element = trs.get(Integer.parseInt(trtd[0])).select("td").get(Integer.parseInt(trtd[1]));
-                    String dqIds = textdictInfoVOs.stream().map(vo -> vo.getId() + "").distinct().collect(Collectors.joining("||"));
-                    if (StringUtil.hasText(dqIds)) {
-                        element.removeAttr("dqId");
-                        element.attr("dqId", dqIds);
-                        if (textdictInfoVOs.get(0).getType() == 2) { //个人签字 不能用户输入
-                            if (element.html().contains("el-tooltip")) {
-                                element.children().get(0).children().get(0).attr(":readonly", "true");
-                            } else {
-                                element.children().get(0).attr(":readonly", "true");
-                            }
-                        }
-                        isUpdate.set(true);
-                    }
-                } catch (Exception e) {
-                    log.error("解析失败: ", e);
-                }
-            }
-        });
-        if (!isUpdate.get() || !SystemUtils.isLinux()) {
-            return;
-        }
-        try {
-            String thmlUrl = privateInfo.getHtmlUrl().replace("Desktop//privateUrl", "Desktop/privateUrl");
-            thmlUrl = thmlUrl.replace("\\", "\\\\");
-            File file_out = ResourceUtil.getFile(thmlUrl);
-            if(!file_out.exists()){
-                FileUtils.ensureFileExists(thmlUrl);
-            }
-            File writefile = new File(thmlUrl);
-            FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
-            wbsTreePrivateMapper.update(null,Wrappers.<WbsTreePrivate>lambdaUpdate().eq(WbsTreePrivate::getPKeyId, privateInfo.getPKeyId()).set(WbsTreePrivate::getHtmlUrl, thmlUrl));
-            privateInfo.setHtmlUrl(thmlUrl);
-            baseMapper.updateHtmlUrl(thmlUrl, privateInfo.getProjectId(), privateInfo.getPKeyId());
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
     @Override
     public TextdictInfoVO selectTextdictInfoById(TextdictInfo textdictInfo) {
         List<TextdictInfoVO>  dataInfo = baseMapper.selectTextdictInfoById(textdictInfo.getId()+"");