|
@@ -1504,7 +1504,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//结果集
|
|
|
List<WbsTreeContract> addNodeList = new ArrayList<>();//新增节点
|
|
|
List<WbsTreeContract> addTabList = new ArrayList<>(); //新增表单
|
|
|
- List<WbsTreeContract> asyncWbsTreeNodes = new ArrayList<>(); //redis同步节点
|
|
|
+ //List<WbsTreeContract> asyncWbsTreeNodes = new ArrayList<>(); //redis同步节点
|
|
|
Set<WbsTreeContract> addChildNodesTablesOldAll = new HashSet<>(addChildNodesTables);//数据源表附件
|
|
|
Set<WbsTreeContract> addNewFileTabs = new HashSet<>(addChildNodesTables);//新增到目标表附件
|
|
|
List<String> resultTablesData = new ArrayList<>();//表单数据
|
|
@@ -1519,7 +1519,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//首先查询需要复制的节点的信息
|
|
|
WbsTreeContract toCopyNode = toCopyNodes.get(i);
|
|
|
CopyContractTreeNodeVO.CopyBatch toCopyVO = copyBatches.get(i);
|
|
|
- asyncWbsTreeNodes.add(toCopyNode);
|
|
|
+ //asyncWbsTreeNodes.add(toCopyNode);
|
|
|
String finalTabOwner = tabOwner;
|
|
|
executor.submit(() -> {
|
|
|
if (toCopyNode != null && toCopyVO != null && needCopyNodeAndTabMap.size() > 0) {
|
|
@@ -1631,13 +1631,14 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
jdbcTemplate.execute(StringUtils.join(strings, ""));
|
|
|
}
|
|
|
}
|
|
|
- if (row && asyncWbsTreeNodes.size() > 0) {
|
|
|
+ if (row) {
|
|
|
//更新redis缓存
|
|
|
- List<WbsTreeContract> collect = asyncWbsTreeNodes.stream().distinct().collect(Collectors.toList());
|
|
|
+ informationQueryService.delAsyncWbsTree(contractId);
|
|
|
+ /*List<WbsTreeContract> collect = asyncWbsTreeNodes.stream().distinct().collect(Collectors.toList());
|
|
|
for (WbsTreeContract asyncWbsTreeNode : collect) {
|
|
|
informationQueryService.AsyncWbsTree("", asyncWbsTreeNode.getId() + "", contractId, "", "1");
|
|
|
informationQueryService.AsyncWbsTree("", asyncWbsTreeNode.getParentId() + "", contractId, "", "1");
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
return R.success("操作成功");
|
|
|
} else {
|
|
@@ -1708,8 +1709,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
if (resultFileData.size() > 0) {
|
|
|
//入库
|
|
|
- tableFileClient.saveBatch(resultFileData);
|
|
|
- if (updatePKeyIds.size() > 0) {
|
|
|
+ if (tableFileClient.saveBatch(resultFileData) && updatePKeyIds.size() > 0) {
|
|
|
//修改表的文件按钮状态
|
|
|
wbsTreeContractClient.updateTabFileTypeByPkeyIds(updatePKeyIds);
|
|
|
}
|
|
@@ -2038,6 +2038,35 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取所有子级节点-资料查询
|
|
|
+ */
|
|
|
+ private List<WbsTreeContract> getChildNodesZL(WbsTreeContract obj) {
|
|
|
+ if (obj != null) {
|
|
|
+ List<WbsTreeContract> wbsTreeContracts = Collections.singletonList(obj);
|
|
|
+ List<WbsTreeContract> result = new ArrayList<>();
|
|
|
+ this.recursionGetChildNodesZL(wbsTreeContracts, result, obj.getContractId());
|
|
|
+ if (result.size() > 0) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 递归获取所有子级节点-资料查询
|
|
|
+ */
|
|
|
+ private void recursionGetChildNodesZL(List<WbsTreeContract> list, List<WbsTreeContract> result, String contractId) {
|
|
|
+ List<Long> ids = list.stream().map(WbsTreeContract::getId).collect(Collectors.toList());
|
|
|
+ if (ids.size() > 0) {
|
|
|
+ List<WbsTreeContract> query = jdbcTemplate.query("select full_name,id,p_key_id,parent_id,sort from m_wbs_tree_contract where type = 1 and parent_id in(" + StringUtils.join(ids, ",") + ") and status = 1 and is_deleted = 0 and contract_id = " + contractId, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
+ if (query.size() > 0) {
|
|
|
+ result.addAll(query);
|
|
|
+ recursionGetChildNodesZL(query, result, contractId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取所有子级下的表
|
|
|
*/
|
|
@@ -2640,6 +2669,10 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//保存集合
|
|
|
List<WbsTreeContract> saveList = new ArrayList<>();
|
|
|
List<ConstructionLedger> saveLedger = new ArrayList<>();
|
|
|
+ //原始表ids,电签位置信息使用
|
|
|
+ List<Long> oldTabIds = selectedNodeList.stream().filter(f -> new Integer(2).equals(f.getType())).map(WbsTreeContract::getId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //构造参数
|
|
|
if (selectedNodeList.size() > 0) {
|
|
|
//重塑关键信息
|
|
|
Map<Long, Long> OldIdToNewIdMap = new HashMap<>();
|
|
@@ -2745,14 +2778,43 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//更新redis
|
|
|
informationQueryService.AsyncWbsTree(treeContract.getId() + "", treeContract.getId() + "", treeContract.getContractId(), "", "1");
|
|
|
informationQueryService.AsyncWbsTree(treeContract.getParentId() + "", treeContract.getParentId() + "", treeContract.getContractId(), "", "1");
|
|
|
+
|
|
|
+ //获取电签信息、默认信息
|
|
|
+ List<WbsTreeContract> nowTabs = saveList.stream().filter(f -> new Integer(2).equals(f.getType())).collect(Collectors.toList());
|
|
|
+ this.updateTextDictInfos(nowTabs, oldTabIds, vo.getProjectId());
|
|
|
+
|
|
|
return booleanR;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Async
|
|
|
+ public void updateTextDictInfos(List<WbsTreeContract> nowTabs, List<Long> oldTabIds, String projectId) {
|
|
|
+ if (oldTabIds.size() > 0) {
|
|
|
+ List<WbsTreePrivate> tabs = jdbcTemplate.query("select p_key_id,id,html_url,excel_id,init_table_name from m_wbs_tree_private where type = 2 and status = 1 and is_deleted = 0 and id in(" + StringUtils.join(oldTabIds, ",") + ") and project_id =" + projectId, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
|
+ Map<Long, WbsTreeContract> nowTabMaps = nowTabs.stream().collect(Collectors.toMap(WbsTreeContract::getId, wbsTreeContract -> wbsTreeContract, (obj1, obj2) -> obj1));
|
|
|
+ List<String> resultSQL = new ArrayList<>();
|
|
|
+ for (WbsTreePrivate tab : tabs) {
|
|
|
+ WbsTreeContract nowTab = nowTabMaps.get(tab.getId());
|
|
|
+ if (nowTab != null) {
|
|
|
+ nowTab.setHtmlUrl(tab.getHtmlUrl());
|
|
|
+ nowTab.setExcelId(tab.getExcelId());
|
|
|
+ nowTab.setInitTableName(tab.getInitTableName());
|
|
|
+ String updateSql = "update m_wbs_tree_contract set html_url = '" + nowTab.getHtmlUrl() + "',excel_id = " + nowTab.getExcelId() + ",init_table_name = '" + nowTab.getInitTableName() + "' where p_key_id = " + nowTab.getPKeyId();
|
|
|
+ resultSQL.add(updateSql);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (resultSQL.size() > 0) {
|
|
|
+ jdbcTemplate.update(StringUtils.join(resultSQL, ";"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private List<WbsTreeContract> unifiedCode(List<AddContractTreeNodeVO.Node> allSelectedNodeList, WbsTreeContract treeContract, String saveType) {
|
|
|
//获取主键
|
|
|
List<Long> halfSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).map(Long::parseLong).distinct().collect(Collectors.toList());
|
|
|
//查询数据
|
|
|
- List<WbsTreeContract> selectedNodeList = this.wbsTreeContractClient.queryContractTreeNodeByPKIds(halfSelectedList);
|
|
|
+ List<WbsTreeContract> selectedNodeList = jdbcTemplate.query("select * from m_wbs_tree_contract where status = 1 and is_deleted = 0 and p_key_id in(" + StringUtils.join(halfSelectedList, ",") + ")", new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
+
|
|
|
//剔除与当前操作节点相同的ID,(如果saveType=1,表示当前及子级节点,那么就要剔除自己本身,否则视为仅当前节点操作,会存在自己本身)
|
|
|
if (("1").equals(saveType)) {
|
|
|
selectedNodeList.removeIf(wbsTreePrivate -> treeContract.getId().equals(wbsTreePrivate.getId()) || treeContract.getOldId().equals(wbsTreePrivate.getId().toString()));
|
|
@@ -2838,10 +2900,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
*/
|
|
|
private void foreachQueryChild(List<WbsTreeContract> parentList, List<WbsTreeContract> childList) {
|
|
|
parentList.forEach(parent -> {
|
|
|
- //List<WbsTreeContract> childS = this.wbsTreeContractClient.queryChildByParentId(parent, "", "");
|
|
|
-
|
|
|
//只获取原始表,不获取复制的表(业务说是从项目wbs处取表,目前直接从当前合同段取原始表,也是一样的)
|
|
|
- List<WbsTreeContract> childS = jdbcTemplate.query("select * from m_wbs_tree_contract where is_cope_tab is null and is_deleted = 0 and parent_id = " + parent.getId() + " and contract_id = " + parent.getContractId(), new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
+ List<WbsTreeContract> childS = jdbcTemplate.query("select * from m_wbs_tree_contract where parent_id = " + parent.getId() + " and contract_id = " + parent.getContractId() + " and is_deleted = 0 and is_cope_tab is null", new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
if (childS.size() > 0) {
|
|
|
//添加入结果集
|
|
|
childList.addAll(childS);
|
|
@@ -3064,7 +3124,65 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
vo.setContractId(Long.valueOf(vo.getContractIdRelation()));
|
|
|
}
|
|
|
|
|
|
- return R.data(this.informationQueryService.selectInformationQueryPage(Condition.getPage(query), vo));
|
|
|
+ IPage<InformationQueryVO> resultPageData = this.informationQueryService.selectInformationQueryPage(Condition.getPage(query), vo);
|
|
|
+
|
|
|
+ //TODO 处理资料查询,page数据与节点顺序同步问题
|
|
|
+ //获取选择的节点下的所有子节点信息
|
|
|
+ /*WbsTreeContract oldSelectedNode = BeanUtil.copyProperties(node, WbsTreeContract.class);
|
|
|
+ List<WbsTreeContract> treeAll = this.getChildNodesZL(oldSelectedNode);
|
|
|
+ if (treeAll == null) {
|
|
|
+ treeAll = new ArrayList<>();
|
|
|
+ }
|
|
|
+ treeAll.add(oldSelectedNode);
|
|
|
+
|
|
|
+ if (treeAll.size() == 1) { //最底层节点,直接返回
|
|
|
+ return R.data(resultPageData);
|
|
|
+ } else {
|
|
|
+ List<InformationQueryVO> resultData = new ArrayList<>();
|
|
|
+ if (oldSelectedNode != null) {
|
|
|
+ List<WbsTreeContract> resultNodes = this.reOrderNode(treeAll, oldSelectedNode);
|
|
|
+ Map<Long, InformationQueryVO> dataMaps = resultPageData.getRecords().stream().collect(Collectors.toMap(InformationQueryVO::getWbsId, Function.identity()));
|
|
|
+ for (WbsTreeContract resultNode : resultNodes) {
|
|
|
+ InformationQueryVO queryVO = dataMaps.get(resultNode.getPKeyId());
|
|
|
+ if (queryVO != null) {
|
|
|
+ resultData.add(queryVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (resultData.size() > 0) {
|
|
|
+ return R.data(resultPageData.setRecords(resultData));
|
|
|
+ } else {*/
|
|
|
+ return R.data(resultPageData);
|
|
|
+ //}
|
|
|
+ //}
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 节点重新排序
|
|
|
+ */
|
|
|
+ private List<WbsTreeContract> reOrderNode(List<WbsTreeContract> inList, WbsTreeContract oldSelectedNode) {
|
|
|
+ Map<Long, List<WbsTreeContract>> parentGroup = inList.stream().collect(Collectors.groupingBy(WbsTreeContract::getParentId));
|
|
|
+ Long parentId = oldSelectedNode.getId();
|
|
|
+ return getSubNodes(parentId, parentGroup);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<WbsTreeContract> getSubNodes(Long parentId, Map<Long, List<WbsTreeContract>> parentGroup) {
|
|
|
+ List<WbsTreeContract> subNodes = new ArrayList<>();
|
|
|
+ if (parentGroup.containsKey(parentId)) {
|
|
|
+ List<WbsTreeContract> children = parentGroup.get(parentId);
|
|
|
+ for (WbsTreeContract child : children) {
|
|
|
+ List<WbsTreeContract> grandChildren = this.getSubNodes(child.getId(), parentGroup);
|
|
|
+ subNodes.addAll(grandChildren);
|
|
|
+ }
|
|
|
+ subNodes.addAll(children);
|
|
|
+ }
|
|
|
+ subNodes.sort(
|
|
|
+ Comparator.comparingInt((WbsTreeContract node) -> node.getSort() == null ? Integer.MAX_VALUE : node.getSort())
|
|
|
+ .thenComparing(Comparator.nullsLast(Comparator.comparing(WbsTreeContract::getFullName)))
|
|
|
+ .thenComparingLong(node -> node.getPKeyId() == null ? Long.MAX_VALUE : node.getPKeyId())
|
|
|
+ .thenComparing(Comparator.nullsLast(Comparator.comparing(WbsTreeContract::getUpdateTime)))
|
|
|
+ );
|
|
|
+ return subNodes;
|
|
|
}
|
|
|
|
|
|
/**
|