|
@@ -223,7 +223,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
public R<Boolean> copyContractNodeSubmitBusinessData(@RequestBody CopyContractTreeNodeVO copyVO){
|
|
|
if(StringUtils.isNotEmpty(copyVO.getNeedCopyPrimaryKeyId()) && copyVO.getCopyBatchToPaths().size() > 0){
|
|
|
//获取被复制节点的表格
|
|
|
- List<WbsTreeContract> tableList = this.wbsTreeContractClient.queryChildByParentId(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyVO.getNeedCopyPrimaryKeyId()), "queryTable");
|
|
|
+ List<WbsTreeContract> tableList = this.wbsTreeContractClient.queryChildByParentId(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyVO.getNeedCopyPrimaryKeyId()), "queryTable", "");
|
|
|
if(tableList != null && tableList.size() > 0){
|
|
|
//获取表格的业务数据
|
|
|
Map<String, List<List<Map<String, Object>>>> tableBusinessDataMap = new HashMap<>();
|
|
@@ -248,7 +248,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
List<String> saveSqlList = new ArrayList<>();
|
|
|
for(CopyContractTreeNodeVO.CopyBatch copyBatch : batchPathList){
|
|
|
//获取表格信息
|
|
|
- List<WbsTreeContract> copyToTableList = this.wbsTreeContractClient.queryChildByParentId(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyBatch.getPrimaryKeyId()), "queryTable");
|
|
|
+ List<WbsTreeContract> copyToTableList = this.wbsTreeContractClient.queryChildByParentId(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(copyBatch.getPrimaryKeyId()), "queryTable", "");
|
|
|
if(copyToTableList != null && copyToTableList.size() > 0){
|
|
|
//检测是否表格是否存在差异(如果存在oldId则优先使用这个字段,不存在时才使用id)
|
|
|
List<WbsTreeContract> remainTableList = copyToTableList.stream().filter(toTable -> tableBusinessDataMap.containsKey(StringUtils.isNotEmpty(toTable.getOldId()) ? toTable.getOldId() : toTable.getId().toString())).collect(Collectors.toList());
|
|
@@ -352,7 +352,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//如果不匹配,默认为未填报
|
|
|
status = "1";
|
|
|
//查询表格
|
|
|
- List<WbsTreeContract> tableList = this.wbsTreeContractClient.queryChildByParentId(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId), "queryTable");
|
|
|
+ List<WbsTreeContract> tableList = this.wbsTreeContractClient.queryChildByParentId(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId), "queryTable", classify);
|
|
|
if(tableList != null && tableList.size() > 0){
|
|
|
for(WbsTreeContract table : tableList){
|
|
|
if(new Integer("2").equals(table.getIsTabPdf())){
|
|
@@ -366,7 +366,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
} else {
|
|
|
//查询表格
|
|
|
- List<WbsTreeContract> tableList = this.wbsTreeContractClient.queryChildByParentId(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId), "queryTable");
|
|
|
+ List<WbsTreeContract> tableList = this.wbsTreeContractClient.queryChildByParentId(this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(primaryKeyId), "queryTable", classify);
|
|
|
if(tableList != null && tableList.size() > 0){
|
|
|
for(WbsTreeContract table : tableList){
|
|
|
if(new Integer("2").equals(table.getIsTabPdf())){
|
|
@@ -591,6 +591,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if("1".equals(vo.getCopyType())){
|
|
|
if(StringUtils.isNotEmpty(vo.getNeedCopyPrimaryKeyId())){
|
|
|
WbsTreeContract parent = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getParentPrimaryKeyId());
|
|
|
+
|
|
|
//重塑关键信息
|
|
|
Map<Long,Long> oldToNewIdMap = new HashMap<>();
|
|
|
allList.forEach(node -> oldToNewIdMap.put(node.getId(), SnowFlakeUtil.getId()));
|
|
@@ -621,6 +622,14 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
newData.setCreateTime(new Date());
|
|
|
newData.setUpdateTime(new Date());
|
|
|
+ //初始化是否显示表格,默认显示
|
|
|
+ newData.setIsBussShow("1");
|
|
|
+ //初始化表格是否上传附件,默认未上传
|
|
|
+ newData.setTabFileType(1);
|
|
|
+ //初始化单表是否可以预览,默认不能
|
|
|
+ newData.setIsTabPdf(1);
|
|
|
+ //初始化PDF路径
|
|
|
+ newData.setPdfUrl(null);
|
|
|
newData.setCreateUser(AuthUtil.getUserId());
|
|
|
//保存到集合中
|
|
|
saveList.add(newData);
|
|
@@ -671,6 +680,14 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
newData.setCreateTime(new Date());
|
|
|
newData.setUpdateTime(new Date());
|
|
|
newData.setCreateUser(AuthUtil.getUserId());
|
|
|
+ //初始化是否显示表格,默认显示
|
|
|
+ newData.setIsBussShow("1");
|
|
|
+ //初始化表格是否上传附件,默认未上传
|
|
|
+ newData.setTabFileType(1);
|
|
|
+ //初始化单表是否可以预览,默认不能
|
|
|
+ newData.setIsTabPdf(1);
|
|
|
+ //初始化PDF路径
|
|
|
+ newData.setPdfUrl(null);
|
|
|
|
|
|
//重塑父节点关联关系
|
|
|
String ancestors = newData.getAncestors();
|
|
@@ -732,7 +749,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
parentList.forEach(parent -> {
|
|
|
if(!new Integer("6").equals(parent.getDeptCategory())){
|
|
|
//查询子节点
|
|
|
- List<WbsTreeContract> childs = this.wbsTreeContractClient.queryChildByParentId(parent, "notQueryTable");
|
|
|
+ List<WbsTreeContract> childs = this.wbsTreeContractClient.queryChildByParentId(parent, "notQueryTable", "");
|
|
|
if(childs != null && childs.size() > 0){
|
|
|
//添加入结果集
|
|
|
childList.addAll(childs);
|
|
@@ -741,7 +758,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
} else {
|
|
|
//工序,则查询对应的表格数据
|
|
|
- List<WbsTreeContract> childs = this.wbsTreeContractClient.queryChildByParentId(parent, "queryTable");
|
|
|
+ List<WbsTreeContract> childs = this.wbsTreeContractClient.queryChildByParentId(parent, "queryTable", "");
|
|
|
if(childs != null && childs.size() > 0){
|
|
|
//添加入结果集
|
|
|
childList.addAll(childs);
|
|
@@ -806,7 +823,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//获取当前父节点下所有工序节点及填报资料
|
|
|
List<QueryProcessDataVO> queryDataResult;
|
|
|
if(new Integer("2").equals(contractInfo.getContractType())){
|
|
|
- queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 1, contractIdRelation);
|
|
|
+ queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 2, contractIdRelation);
|
|
|
} else {
|
|
|
queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 1, contractId);
|
|
|
}
|
|
@@ -1010,12 +1027,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//todo 当前节点及其子节点
|
|
|
//当前节点及其子节点时,半选说明其下的子节点并不是全部选中的,所以这时候只需要根据全选的查询其全部子节点即可
|
|
|
if(allSelectedNodeList.size() > 0){
|
|
|
- //获取主键
|
|
|
- List<String> allSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).distinct().collect(Collectors.toList());
|
|
|
- //查询对应数据
|
|
|
- selectedNodeList = this.wbsTreePrivateClient.queryByPKeyIds(allSelectedList);
|
|
|
- //剔除与当前操作节点相同的ID
|
|
|
- selectedNodeList.removeIf(wbsTreePrivate -> treeContract.getId().equals(wbsTreePrivate.getId()));
|
|
|
+ //查询数据
|
|
|
+ selectedNodeList = this.unifiedCode(allSelectedNodeList, treeContract);
|
|
|
|
|
|
//全选的集合则进一步向下查询
|
|
|
List<WbsTreePrivate> childList = new ArrayList<>();
|
|
@@ -1042,16 +1055,22 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
} else {
|
|
|
//todo 仅当前节点操作
|
|
|
- if(halfSelectedNodeList.size() > 0){
|
|
|
- //获取主键
|
|
|
- List<String> halfSelectedList = halfSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).distinct().collect(Collectors.toList());
|
|
|
+ if(allSelectedNodeList.size() > 0){
|
|
|
//查询数据
|
|
|
- selectedNodeList = this.wbsTreePrivateClient.queryByPKeyIds(halfSelectedList);
|
|
|
- //剔除与当前操作节点相同的ID
|
|
|
- selectedNodeList.removeIf(wbsTreePrivate -> treeContract.getId().equals(wbsTreePrivate.getId()));
|
|
|
+ selectedNodeList = this.unifiedCode(allSelectedNodeList, treeContract);
|
|
|
+
|
|
|
+ //检查当前操作的节点是否是填报节点,如果是则需要查询相关联表格
|
|
|
+ List<WbsTreePrivate> submitNodeList = selectedNodeList.stream().filter(treePrivate -> Arrays.asList("1,2,3,4".split(",")).contains(treePrivate.getMajorDataType().toString())).distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<WbsTreePrivate> childList = new ArrayList<>();
|
|
|
+ if(submitNodeList.size() > 0){
|
|
|
+ this.foreachQueryChild(submitNodeList, childList);
|
|
|
+ //将表格数据设置
|
|
|
+ selectedNodeList.addAll(childList);
|
|
|
+ }
|
|
|
}
|
|
|
//处理半选
|
|
|
- this.disposeHalfSelectList(vo, allSelectedNodeList, selectedNodeList);
|
|
|
+ this.disposeHalfSelectList(vo, halfSelectedNodeList, selectedNodeList);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1071,8 +1090,10 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
//重塑pKeyId、id和parentId
|
|
|
newData.setPKeyId(SnowFlakeUtil.getId());
|
|
|
- newData.setId(OldIdToNewIdMap.containsKey(half.getId()) ? OldIdToNewIdMap.get(half.getId()) : SnowFlakeUtil.getId());
|
|
|
- newData.setParentId(OldIdToNewIdMap.containsKey(half.getParentId()) ? OldIdToNewIdMap.get(half.getParentId()) : treeContract.getId().equals(half.getParentId()) ? treeContract.getId() : SnowFlakeUtil.getId());
|
|
|
+ if(new Integer("1").equals(half.getType())){
|
|
|
+ newData.setId(OldIdToNewIdMap.containsKey(half.getId()) ? OldIdToNewIdMap.get(half.getId()) : SnowFlakeUtil.getId());
|
|
|
+ }
|
|
|
+ newData.setParentId(OldIdToNewIdMap.containsKey(half.getParentId()) ? OldIdToNewIdMap.get(half.getParentId()) : treeContract.getId().equals(half.getParentId()) || treeContract.getOldId().equals(half.getParentId().toString()) ? treeContract.getId() : SnowFlakeUtil.getId());
|
|
|
//记录旧ID
|
|
|
newData.setOldId(half.getId().toString());
|
|
|
//设置合同段等信息
|
|
@@ -1082,6 +1103,16 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
newData.setContractType(treeContract.getContractType());
|
|
|
newData.setCreateTime(new Date());
|
|
|
|
|
|
+ //设置节点名称
|
|
|
+ for(AddContractTreeNodeVO.Node addVO : selectList){
|
|
|
+ if(half.getPKeyId().toString().equals(addVO.getPrimaryKeyId())){
|
|
|
+ if(StringUtils.isNotEmpty(addVO.getNodeName())){
|
|
|
+ newData.setFullName(addVO.getNodeName());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//重塑父节点关联关系
|
|
|
String ancestors = newData.getAncestors();
|
|
|
if(StringUtils.isNotEmpty(ancestors)){
|
|
@@ -1126,6 +1157,17 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
return this.saveOrCopyNodeTree(saveList, saveLedger);
|
|
|
}
|
|
|
|
|
|
+ private List<WbsTreePrivate> unifiedCode(List<AddContractTreeNodeVO.Node> allSelectedNodeList, WbsTreeContract treeContract){
|
|
|
+ //获取主键
|
|
|
+ List<String> halfSelectedList = allSelectedNodeList.stream().map(AddContractTreeNodeVO.Node::getPrimaryKeyId).distinct().collect(Collectors.toList());
|
|
|
+ //查询数据
|
|
|
+ List<WbsTreePrivate> selectedNodeList = this.wbsTreePrivateClient.queryByPKeyIds(halfSelectedList);
|
|
|
+ //剔除与当前操作节点相同的ID
|
|
|
+ selectedNodeList.removeIf(wbsTreePrivate -> treeContract.getId().equals(wbsTreePrivate.getId()) || treeContract.getOldId().equals(wbsTreePrivate.getId().toString()));
|
|
|
+
|
|
|
+ return selectedNodeList;
|
|
|
+ }
|
|
|
+
|
|
|
@NotNull
|
|
|
private R<Boolean> saveOrCopyNodeTree(List<WbsTreeContract> saveList, List<ConstructionLedger> saveLedger) {
|
|
|
if(saveList.size() > 0){
|
|
@@ -1169,21 +1211,18 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
*/
|
|
|
private void foreachQueryChild(List<WbsTreePrivate> parentList, List<WbsTreePrivate> childList){
|
|
|
parentList.forEach(parent -> {
|
|
|
- if(!new Integer("6").equals(parent.getDeptCategory())){
|
|
|
- //查询子节点
|
|
|
- List<WbsTreePrivate> childs = this.wbsTreePrivateClient.queryChildByParentId(parent);
|
|
|
- if(childs != null && childs.size() > 0){
|
|
|
- //添加入结果集
|
|
|
- childList.addAll(childs);
|
|
|
- //还有子级,继续向下
|
|
|
- this.foreachQueryChild(childs, childList);
|
|
|
- }
|
|
|
- } else {
|
|
|
- //说明是工序,查询这个节点下是否存在表格数据
|
|
|
- List<WbsTreePrivate> exlTables = this.wbsTreePrivateClient.queryExcelTableByParentId(parent);
|
|
|
- if(exlTables != null && exlTables.size() > 0){
|
|
|
- childList.addAll(exlTables);
|
|
|
- }
|
|
|
+ //查询子节点
|
|
|
+ List<WbsTreePrivate> childs = this.wbsTreePrivateClient.queryChildByParentId(parent);
|
|
|
+ if(childs != null && childs.size() > 0){
|
|
|
+ //添加入结果集
|
|
|
+ childList.addAll(childs);
|
|
|
+ //还有子级,继续向下
|
|
|
+ this.foreachQueryChild(childs, childList);
|
|
|
+ }
|
|
|
+ //查询这个节点下是否存在表格数据
|
|
|
+ List<WbsTreePrivate> exlTables = this.wbsTreePrivateClient.queryExcelTableByParentId(parent);
|
|
|
+ if(exlTables != null && exlTables.size() > 0){
|
|
|
+ childList.addAll(exlTables);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -1372,7 +1411,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//获取当前父节点下所有工序节点及填报资料
|
|
|
List<QueryProcessDataVO> queryDataResult;
|
|
|
if(new Integer("2").equals(contractInfo.getContractType())){
|
|
|
- queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 1, contractIdRelation);
|
|
|
+ queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 2, contractIdRelation);
|
|
|
} else {
|
|
|
queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 1, contractId);
|
|
|
}
|