|
@@ -328,6 +328,26 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
newData.setCreateTime(new Date());
|
|
|
newData.setUpdateTime(new Date());
|
|
|
newData.setCreateUser(AuthUtil.getUserId());
|
|
|
+
|
|
|
+ //重塑父节点关联关系
|
|
|
+ String ancestors = newData.getAncestors();
|
|
|
+ if(StringUtils.isNotEmpty(ancestors)){
|
|
|
+ //重组后的链表
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ //拆分重组
|
|
|
+ String[] ancestorsArray = ancestors.split(",");
|
|
|
+ for(String oldParentId : ancestorsArray){
|
|
|
+ if(StringUtils.isNotEmpty(oldParentId)){
|
|
|
+ //获取新的
|
|
|
+ Long newParentId = oldToNewIdMap.get(Long.parseLong(oldParentId));
|
|
|
+ //如果新的id为空,说明不变
|
|
|
+ stringBuilder.append(",").append(newParentId == null ? oldParentId : newParentId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //将新链表设置进对象中
|
|
|
+ newData.setAncestors(stringBuilder.substring(1));
|
|
|
+ }
|
|
|
+
|
|
|
//保存到集合中
|
|
|
saveList.add(newData);
|
|
|
|
|
@@ -369,13 +389,20 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
parentList.forEach(parent -> {
|
|
|
if(!new Integer("6").equals(parent.getDeptCategory())){
|
|
|
//查询子节点
|
|
|
- List<WbsTreeContract> childs = this.wbsTreeContractClient.queryChildByParentId(parent);
|
|
|
+ List<WbsTreeContract> childs = this.wbsTreeContractClient.queryChildByParentId(parent, "notQueryTable");
|
|
|
if(childs != null && childs.size() > 0){
|
|
|
//添加入结果集
|
|
|
childList.addAll(childs);
|
|
|
//还有子级,继续向下
|
|
|
this.foreachQueryChildContract(childs, childList);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ //工序,则查询对应的表格数据
|
|
|
+ List<WbsTreeContract> childs = this.wbsTreeContractClient.queryChildByParentId(parent, "queryTable");
|
|
|
+ if(childs != null && childs.size() > 0){
|
|
|
+ //添加入结果集
|
|
|
+ childList.addAll(childs);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -401,6 +428,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if(contractInfo.getContractType() != null && new Integer("2").equals(contractInfo.getContractType())){
|
|
|
//监理合同段
|
|
|
List<WbsTreeContractTreeVOS> childList = this.wbsTreeContractClient.lazyTree(StringUtils.isNotEmpty(parentId) ? Long.parseLong(parentId) : 0, contractId, contractIdRelation, contractInfo.getContractType());
|
|
|
+ //设置合同段根节点的名称
|
|
|
+ this.setRootNodeName(parentId, childList);
|
|
|
if(childList != null && childList.size() == 1){
|
|
|
//需要向下展开
|
|
|
this.foreachQueryChildNode(childList, childList.get(0).getContractIdRelation(), contractInfo.getContractType());
|
|
@@ -419,19 +448,55 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
} else {
|
|
|
if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){
|
|
|
//直接返回
|
|
|
- return R.data(this.clientTreePublicCodeClient.queryContractWbsTreeByContractIdAndType(contractId, wbsType, "0"));
|
|
|
- }
|
|
|
- //不是根节点,则获取子节点
|
|
|
- result = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);
|
|
|
- //判断当前节点下是不是只有一个子节点
|
|
|
- if(result != null && result.size() == 1){
|
|
|
- this.foreachQueryChildNode(result, contractId, contractInfo.getContractType());
|
|
|
+ result = this.clientTreePublicCodeClient.queryContractWbsTreeByContractIdAndType(contractId, wbsType, "0");
|
|
|
+ } else {
|
|
|
+ //不是根节点,则获取子节点
|
|
|
+ result = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, parentId);
|
|
|
+ //判断当前节点下是不是只有一个子节点
|
|
|
+ if(result != null && result.size() == 1){
|
|
|
+ this.foreachQueryChildNode(result, contractId, contractInfo.getContractType());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if(result != null){
|
|
|
+ //获取当前父节点下所有工序节点及填报资料
|
|
|
+ List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, contractInfo.getContractType(), contractId);
|
|
|
+ result.forEach(vos -> {
|
|
|
+ if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){
|
|
|
+ vos.setTitle(contractInfo.getContractName());
|
|
|
+ }
|
|
|
+ if(queryDataResult != null && queryDataResult.size() > 0){
|
|
|
+ //设置颜色
|
|
|
+ this.setNodeColor(vos, queryDataResult);
|
|
|
+ }
|
|
|
+ //处理子节点
|
|
|
+ if(vos.getChildren() != null && vos.getChildren().size() > 0){
|
|
|
+ vos.getChildren().forEach(child -> this.setNodeColor(vos, queryDataResult));
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
return R.data(result);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 监理合同段设置关联合同段的根节点名称
|
|
|
+ */
|
|
|
+ private void setRootNodeName(@RequestParam String parentId, List<WbsTreeContractTreeVOS> childList) {
|
|
|
+ if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){
|
|
|
+ if(childList != null && childList.size() > 0){
|
|
|
+ childList.forEach(treeNode -> {
|
|
|
+ ContractInfo clientContract = this.contractClient.getContractById(Long.parseLong(treeNode.getContractIdRelation()));
|
|
|
+ if(clientContract != null){
|
|
|
+ treeNode.setTitle(clientContract.getContractName());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 如果子节点只有一个,则进一步查询该子节点的下级节点
|
|
|
* @param result 子节点集合
|
|
@@ -610,6 +675,25 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
newData.setContractType(treeContract.getContractType());
|
|
|
newData.setCreateTime(new Date());
|
|
|
|
|
|
+ //重塑父节点关联关系
|
|
|
+ String ancestors = newData.getAncestors();
|
|
|
+ if(StringUtils.isNotEmpty(ancestors)){
|
|
|
+ //重组后的链表
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ //拆分重组
|
|
|
+ String[] ancestorsArray = ancestors.split(",");
|
|
|
+ for(String oldParentId : ancestorsArray){
|
|
|
+ if(StringUtils.isNotEmpty(oldParentId)){
|
|
|
+ //获取新的
|
|
|
+ Long newParentId = OldIdToNewIdMap.get(Long.parseLong(oldParentId));
|
|
|
+ //如果新的id为空,说明不变
|
|
|
+ stringBuilder.append(",").append(newParentId == null ? oldParentId : newParentId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //将新链表设置进对象中
|
|
|
+ newData.setAncestors(stringBuilder.substring(1));
|
|
|
+ }
|
|
|
+
|
|
|
//设置名称
|
|
|
Iterator<AddContractTreeNodeVO.Node> iterator = selectList.iterator();
|
|
|
while (iterator.hasNext()){
|
|
@@ -826,16 +910,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if(new Integer("2").equals(contractInfo.getContractType())){
|
|
|
//监理合同段,需要获取关联的施工方合同段根节点数据
|
|
|
rootTreeNode = this.wbsTreeContractClient.lazyTree(StringUtils.isNotEmpty(parentId) ? Long.parseLong(parentId) : 0, contractId, contractIdRelation, contractInfo.getContractType());
|
|
|
- if(StringUtils.isEmpty(parentId)){
|
|
|
- if(rootTreeNode != null && rootTreeNode.size() > 0){
|
|
|
- rootTreeNode.forEach(treeNode -> {
|
|
|
- ContractInfo clientContract = this.contractClient.getContractById(Long.parseLong(treeNode.getContractIdRelation()));
|
|
|
- if(clientContract != null){
|
|
|
- treeNode.setTitle(clientContract.getContractName());
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ //设置合同段根节点的名称
|
|
|
+ this.setRootNodeName(parentId, rootTreeNode);
|
|
|
|
|
|
} else {
|
|
|
if(com.alibaba.nacos.common.utils.StringUtils.isEmpty(parentId)){
|
|
@@ -850,8 +926,16 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
//其他参数
|
|
|
if(rootTreeNode != null && rootTreeNode.size() > 0){
|
|
|
+ //获取当前父节点下所有工序节点及填报资料
|
|
|
+ List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, contractInfo.getContractType(), contractId);
|
|
|
+
|
|
|
rootTreeNode.forEach(vo -> {
|
|
|
String primaryKeyId = new Integer("2").equals(contractInfo.getContractType()) ? vo.getId() : vo.getPrimaryKeyId();
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){
|
|
|
+ vo.setTitle(contractInfo.getContractName());
|
|
|
+ }
|
|
|
+
|
|
|
//获取上传的图纸
|
|
|
ContractTreeDrawings drawings = this.contractTreeDrawingsService.queryCurrentNodeDrawings(primaryKeyId);
|
|
|
if(drawings != null){
|
|
@@ -861,6 +945,11 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
vo.setFileUrl(drawings.getFileUrl());
|
|
|
}
|
|
|
|
|
|
+ //处理颜色
|
|
|
+ if(queryDataResult != null && queryDataResult.size() > 0){
|
|
|
+ this.setNodeColor(vo, queryDataResult);
|
|
|
+ }
|
|
|
+
|
|
|
//判断当前节点是否被标记为首件
|
|
|
TreeContractFirst first = this.treeContractFirstService.getOne(Wrappers.<TreeContractFirst>lambdaQuery().eq(TreeContractFirst::getIsDeleted, 0).eq(TreeContractFirst::getWbsNodeId, primaryKeyId));
|
|
|
vo.setIsFirst(first != null);
|
|
@@ -870,6 +959,81 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
return R.data(rootTreeNode);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 设置节点颜色
|
|
|
+ * 填报节点:
|
|
|
+ * 未填报1 < 已填报-未上报2 < 已填报-待审批3 < 已审批4
|
|
|
+ *
|
|
|
+ * 非填报节点
|
|
|
+ * 未填报1(其下所有工序节点均未填报) < 已填报2(未上报和待审批) < 已审批4(其下所有工序节点均审批)
|
|
|
+ *
|
|
|
+ */
|
|
|
+ private void setNodeColor(WbsTreeContractTreeVOS vos, List<QueryProcessDataVO> queryDataResult){
|
|
|
+ if(queryDataResult != null && queryDataResult.size() > 0){
|
|
|
+ Iterator<QueryProcessDataVO> iterator = queryDataResult.iterator();
|
|
|
+ //默认均未填报
|
|
|
+ StringBuilder colorStatusValue = new StringBuilder();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ QueryProcessDataVO query = iterator.next();
|
|
|
+ if(query.getAncestors().contains(vos.getId()) || query.getAncestors().startsWith(vos.getParentId() + ",") || query.getTreeId().equals(vos.getId())){
|
|
|
+ //如果为空,说明未填报
|
|
|
+ if(query.getStatus() == null || query.getStatus() == -1){
|
|
|
+ colorStatusValue.append("1");
|
|
|
+ } else {
|
|
|
+ switch (query.getStatus()){
|
|
|
+ case 0:
|
|
|
+ case 3:
|
|
|
+ //未上报
|
|
|
+ colorStatusValue.append("2");
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ //待审批
|
|
|
+ colorStatusValue.append("3");
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ //已审批
|
|
|
+ colorStatusValue.append("4");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ colorStatusValue.append("1");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //检查字符串
|
|
|
+ if(StringUtils.isNotEmpty(colorStatusValue.toString())){
|
|
|
+ if(new Integer("6").equals(vos.getDeptCategory())){
|
|
|
+ //工序,则直接使用字符串的判断
|
|
|
+ vos.setColorStatus(new Integer(colorStatusValue.toString()));
|
|
|
+ } else {
|
|
|
+ if(colorStatusValue.toString().contains("1")){
|
|
|
+ //含有1
|
|
|
+ if(colorStatusValue.toString().contains("2") || colorStatusValue.toString().contains("3") || colorStatusValue.toString().contains("4")){
|
|
|
+ //同时含有2/3/4,取2
|
|
|
+ vos.setColorStatus(2);
|
|
|
+ } else {
|
|
|
+ //否则,取1
|
|
|
+ vos.setColorStatus(1);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //不含有1
|
|
|
+ if(colorStatusValue.toString().contains("4") && !colorStatusValue.toString().contains("2") && !colorStatusValue.toString().contains("3")){
|
|
|
+ //只含有4,取4
|
|
|
+ vos.setColorStatus(4);
|
|
|
+ } else {
|
|
|
+ //反之包含2/3,取2
|
|
|
+ vos.setColorStatus(2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ vos.setColorStatus(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改
|
|
|
*/
|