|
@@ -482,73 +482,55 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
}
|
|
}
|
|
|
|
|
|
public void missingFill(List<String> missingList){
|
|
public void missingFill(List<String> missingList){
|
|
- /*数据池里面没有任何元素匹配和当前依赖匹配*/
|
|
|
|
- if(Func.isNotEmpty(missingList)){
|
|
|
|
- StaticLog.info("需要挂载的元素{}", String.join(";", missingList));
|
|
|
|
- Map<String, Object> elementInfoMap=this.getElementInfoByCodes(String.join(",",missingList));
|
|
|
|
- /*1从当前节点其它表格中查找匹配的元素*/
|
|
|
|
- List<String> removeList=new ArrayList<>();
|
|
|
|
- /*if(false) {*//*全加载后,关闭当前节的搜索,假如后期改成依赖加载可以再次利用*//*
|
|
|
|
- for (String r : missingList) {
|
|
|
|
- String tn = r.substring(0, r.indexOf(StringPool.COLON));
|
|
|
|
- String key = r.substring(r.indexOf(StringPool.COLON) + 1);
|
|
|
|
- List<NodeTable> nodeList = this.tec.getTableAll().stream().filter(e -> e.getInitTableName().equals(tn)).collect(Collectors.toList());
|
|
|
|
- if (Func.isNotEmpty(nodeList)) {
|
|
|
|
- removeList.add(r);
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
|
|
- Map<String, Object> elementInfo = (Map<String, Object>) elementInfoMap.get(r);
|
|
|
|
- String tableName = nodeList.get(0).getInitTableName();
|
|
|
|
- if (!this.tec.getCoordinateMap().containsKey(tableName)) {
|
|
|
|
- this.tec.getCoordinateMap().put(tableName, FormulaUtils.getElementCell(nodeList.get(0).getHtmlUrl()));
|
|
|
|
- }
|
|
|
|
- List<Map<String, Object>> tableDatas = this.jdbcTemplate.queryForList("select * from " + tableName + " where p_key_id in(" + nodeList.stream().map(NodeTable::getPKeyId).map(StringUtils::handleNull).collect(Collectors.joining(",")) + ")");
|
|
|
|
- fill(tableDatas, removeList, tn, key, StringUtils.handleNull(elementInfo.get("ename")));
|
|
|
|
|
|
+ try {
|
|
|
|
+ /*数据池里面没有任何元素匹配和当前依赖匹配*/
|
|
|
|
+ if (Func.isNotEmpty(missingList)) {
|
|
|
|
+ StaticLog.info("需要挂载的元素{}", String.join(";", missingList));
|
|
|
|
+ Map<String, Object> elementInfoMap = this.getElementInfoByCodes(String.join(",", missingList));
|
|
|
|
+ /*1从当前节点其它表格中查找匹配的元素*/
|
|
|
|
+ List<String> removeList = new ArrayList<>();
|
|
|
|
+ if (Func.isNotEmpty(missingList)) {
|
|
|
|
+ /*2从当前节点的兄弟节点中查找匹配的元素*/
|
|
|
|
+ CurrentNode currentNode = this.tec.getCurrentNode();
|
|
|
|
+ /*List<Map<String,Object>> tableNamePkIdsMaps= this.jdbcTemplate.queryForList("select c.init_table_name tableName,c.p_key_id pkId,c.html_url url from (select b.id from m_wbs_tree_contract a join m_wbs_tree_contract b on (a.contract_id=b.contract_id and b.ancestors like CONCAT(a.ancestors,'%')) where a.p_key_id="+currentNode.getPkId()+" and b.is_deleted=0 and b.node_type=6 ORDER BY b.sort) k join m_wbs_tree_contract c on c.parent_id = k.id where c.contract_id="+tec.getContractId()+" and c.is_deleted=0 ");*/
|
|
|
|
+ WbsTreeContract parent = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, currentNode.getParentPkeyId()));
|
|
|
|
+ if (parent == null) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ List<Map<String, Object>> tableNamePkIdsMaps = this.jdbcTemplate.queryForList(
|
|
|
|
+ "select c.init_table_name tableName,c.p_key_id pkId,c.html_url url from" +
|
|
|
|
+ " (select id from m_wbs_tree_contract where contract_id=" + currentNode.getContractId() + " and is_deleted=0 and node_type=6 and tree_code like '" + parent.getTreeCode() + "%' ORDER BY sort) k" +
|
|
|
|
+ " join m_wbs_tree_contract c on c.parent_id = k.id " +
|
|
|
|
+ "where c.contract_id=" + currentNode.getContractId() + " and c.is_deleted=0 "
|
|
|
|
+ );
|
|
|
|
+ if (Func.isNotEmpty(tableNamePkIdsMaps)) {
|
|
|
|
+ // removeList.clear();
|
|
|
|
+ missingList.forEach(miss -> {
|
|
|
|
+ @SuppressWarnings("unckecked")
|
|
|
|
+ Map<String, Object> elementInfo = (Map<String, Object>) elementInfoMap.get(miss);
|
|
|
|
+ String tn = miss.substring(0, miss.indexOf(StringPool.COLON));
|
|
|
|
+ String key = miss.substring(miss.indexOf(StringPool.COLON) + 1);
|
|
|
|
+ String targetIds = tableNamePkIdsMaps.stream().filter(m -> StringUtils.isEquals(m.get("tableName"), tn)).map(m -> m.get("pkId")).map(StringUtils::handleNull).collect(Collectors.joining(","));
|
|
|
|
+ if (Func.isNotEmpty(targetIds)) {
|
|
|
|
+ if (!this.tec.getCoordinateMap().containsKey(tn)) {
|
|
|
|
+ tableNamePkIdsMaps.stream().filter(m -> StringUtils.isEquals(m.get("tableName"), tn)).findAny().ifPresent(m -> {
|
|
|
|
+ this.tec.getCoordinateMap().put(tn, FormulaUtils.getElementCell(StringUtils.handleNull(m.get("url"))));
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ List<Map<String, Object>> tableDatas = this.jdbcTemplate.queryForList("select * from " + tn + " where p_key_id in (" + targetIds + ")");
|
|
|
|
+ String tmp = elementInfo == null ? "" : StringUtils.handleNull(elementInfo.get("ename"));
|
|
|
|
+ fill(tableDatas, removeList, tn, key, tmp);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (Func.isNotEmpty(removeList)) {
|
|
if (Func.isNotEmpty(removeList)) {
|
|
- *//*移除已经找到的元素数据*//*
|
|
|
|
|
|
+ /*移除已经找到的元素数据*/
|
|
missingList.removeIf(removeList::contains);
|
|
missingList.removeIf(removeList::contains);
|
|
}
|
|
}
|
|
- }*/
|
|
|
|
- if(Func.isNotEmpty(missingList)){
|
|
|
|
- /*2从当前节点的兄弟节点中查找匹配的元素*/
|
|
|
|
- CurrentNode currentNode = this.tec.getCurrentNode();
|
|
|
|
- /*List<Map<String,Object>> tableNamePkIdsMaps= this.jdbcTemplate.queryForList("select c.init_table_name tableName,c.p_key_id pkId,c.html_url url from (select b.id from m_wbs_tree_contract a join m_wbs_tree_contract b on (a.contract_id=b.contract_id and b.ancestors like CONCAT(a.ancestors,'%')) where a.p_key_id="+currentNode.getPkId()+" and b.is_deleted=0 and b.node_type=6 ORDER BY b.sort) k join m_wbs_tree_contract c on c.parent_id = k.id where c.contract_id="+tec.getContractId()+" and c.is_deleted=0 ");*/
|
|
|
|
- WbsTreeContract parent = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId,currentNode.getParentPkeyId()));
|
|
|
|
- if(parent==null){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- List<Map<String,Object>> tableNamePkIdsMaps= this.jdbcTemplate.queryForList(
|
|
|
|
- "select c.init_table_name tableName,c.p_key_id pkId,c.html_url url from" +
|
|
|
|
- " (select id from m_wbs_tree_contract where contract_id="+currentNode.getContractId()+" and is_deleted=0 and node_type=6 and tree_code like '"+parent.getTreeCode()+"%' ORDER BY sort) k" +
|
|
|
|
- " join m_wbs_tree_contract c on c.parent_id = k.id " +
|
|
|
|
- "where c.contract_id="+currentNode.getContractId()+" and c.is_deleted=0 "
|
|
|
|
- );
|
|
|
|
- if(Func.isNotEmpty(tableNamePkIdsMaps)){
|
|
|
|
- // removeList.clear();
|
|
|
|
- missingList.forEach(miss->{
|
|
|
|
- @SuppressWarnings("unckecked")
|
|
|
|
- Map<String,Object> elementInfo= (Map<String, Object>) elementInfoMap.get(miss);
|
|
|
|
- String tn = miss.substring(0,miss.indexOf(StringPool.COLON));
|
|
|
|
- String key =miss.substring(miss.indexOf(StringPool.COLON)+1);
|
|
|
|
- String targetIds=tableNamePkIdsMaps.stream().filter(m->StringUtils.isEquals(m.get("tableName"),tn)).map(m->m.get("pkId")).map(StringUtils::handleNull).collect(Collectors.joining(","));
|
|
|
|
- if(Func.isNotEmpty(targetIds)){
|
|
|
|
- if(!this.tec.getCoordinateMap().containsKey(tn)){
|
|
|
|
- tableNamePkIdsMaps.stream().filter(m->StringUtils.isEquals(m.get("tableName"),tn)).findAny().ifPresent(m->{
|
|
|
|
- this.tec.getCoordinateMap().put(tn,FormulaUtils.getElementCell(StringUtils.handleNull(m.get("url"))));
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- List<Map<String,Object>> tableDatas= this.jdbcTemplate.queryForList("select * from "+tn+" where p_key_id in ("+targetIds+")");
|
|
|
|
- String tmp =elementInfo==null?"":StringUtils.handleNull(elementInfo.get("ename"));
|
|
|
|
- fill(tableDatas,removeList,tn,key,tmp);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(Func.isNotEmpty(removeList)){
|
|
|
|
- /*移除已经找到的元素数据*/
|
|
|
|
- missingList.removeIf(removeList::contains);
|
|
|
|
}
|
|
}
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public void missingFill2(List<String> missingList){
|
|
public void missingFill2(List<String> missingList){
|