|
@@ -19,10 +19,7 @@ import org.springblade.business.feign.MessageWarningClient;
|
|
|
import org.springblade.business.feign.OperationLogClient;
|
|
|
import org.springblade.business.feign.RecycleBinClient;
|
|
|
import org.springblade.business.feign.TaskClient;
|
|
|
-import org.springblade.business.feignClient.ClientTreePublicCodeClientImpl;
|
|
|
import org.springblade.business.service.IConstructionLedgerService;
|
|
|
-import org.springblade.business.service.IContractTreeDrawingsService;
|
|
|
-import org.springblade.business.service.ITreeContractFirstService;
|
|
|
import org.springblade.business.utils.FileUtils;
|
|
|
import org.springblade.business.vo.*;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
@@ -77,12 +74,6 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
private final IDictBizClient dictBizClient;
|
|
|
|
|
|
- private final IContractTreeDrawingsService contractTreeDrawingsService;
|
|
|
-
|
|
|
- private final ClientTreePublicCodeClientImpl clientTreePublicCodeClient;
|
|
|
-
|
|
|
- private final ITreeContractFirstService treeContractFirstService;
|
|
|
-
|
|
|
private final IConstructionLedgerService constructionLedgerService;
|
|
|
|
|
|
private final TaskClient taskClient;
|
|
@@ -1015,147 +1006,44 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
@ApiImplicitParam(name = "wbsType", value = "模板类型, 1质检,2试验", required = true),
|
|
|
@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
|
|
|
})
|
|
|
- public R<List<WbsTreeContractTreeVOS>> queryMappingStructureTree(@RequestParam String parentId, @RequestParam Integer wbsType, @RequestParam String contractId, @RequestParam String contractIdRelation){
|
|
|
- List<WbsTreeContractTreeVOS> result;
|
|
|
-
|
|
|
- //获取合同段,检查是否是监理合同段
|
|
|
- ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(contractId));
|
|
|
+ public R<List<WbsTreeContractTreeVOS>> queryMappingStructureTree(@RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation){
|
|
|
+ List<WbsTreeContractTreeVOS> result = this.queryContractTree(parentId, contractId, contractIdRelation);
|
|
|
+ if(result.size() == 1){
|
|
|
+ //只有一个子节点,继续向下
|
|
|
+ int size;
|
|
|
+ WbsTreeContractTreeVOS vos = result.get(0);
|
|
|
+ do {
|
|
|
+ try{
|
|
|
+ List<WbsTreeContractTreeVOS> childResult = this.queryContractTree(vos.getId().toString(), contractId, vos.getContractIdRelation());
|
|
|
|
|
|
- if(contractInfo.getContractType() != null && (new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").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, contractId, childList.get(0).getContractIdRelation());
|
|
|
- }
|
|
|
- if(StringUtils.isEmpty(contractIdRelation) && "0".equals(parentId)){
|
|
|
- //给个顶点
|
|
|
- WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
|
|
|
- vos.setTitle(contractInfo.getContractName());
|
|
|
- vos.setChildren(childList);
|
|
|
- result = new ArrayList<>();
|
|
|
- result.add(vos);
|
|
|
- } else {
|
|
|
- result = childList;
|
|
|
- }
|
|
|
+ vos.setChildren(childResult);
|
|
|
+ size = childResult.size();
|
|
|
+ if(size != 1){
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
- if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){
|
|
|
- //直接返回
|
|
|
- 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);
|
|
|
+ vos = childResult.get(0);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ break;
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- if(result != null){
|
|
|
- //获取当前父节点下所有工序节点及填报资料
|
|
|
- List<QueryProcessDataVO> queryDataResult;
|
|
|
- if(new Integer("2").equals(contractInfo.getContractType())){
|
|
|
- queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 2, contractIdRelation);
|
|
|
- } else {
|
|
|
- queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 1, contractId);
|
|
|
- }
|
|
|
-
|
|
|
- //删除掉首件工程
|
|
|
- result.removeIf(vos -> vos.getNodeType() != null && vos.getNodeType() == 111);
|
|
|
-
|
|
|
-
|
|
|
- result.forEach(vos -> {
|
|
|
- if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){
|
|
|
- vos.setTitle(contractInfo.getContractName());
|
|
|
- }
|
|
|
- if(queryDataResult != null && queryDataResult.size() > 0){
|
|
|
- //设置颜色
|
|
|
- this.setNodeColor(vos, queryDataResult, false);
|
|
|
- }
|
|
|
- //处理子节点
|
|
|
- if(vos.getChildren() != null && vos.getChildren().size() > 0){
|
|
|
- // 去掉首件
|
|
|
- List<WbsTreeContractTreeVOS> children = vos.getChildren();
|
|
|
- children = children.stream().filter(vo->vo.getNodeType()!=111).collect(Collectors.toList());
|
|
|
- vos.setChildren(children);
|
|
|
- //循环处理节点颜色
|
|
|
- this.foreachSetNodeColor(children, queryDataResult);
|
|
|
- }
|
|
|
- });
|
|
|
+ } while (true);
|
|
|
}
|
|
|
|
|
|
- return R.data(result);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 监理查询下级节点
|
|
|
- */
|
|
|
- private void foreachQueryChildNode(List<WbsTreeContractTreeVOS> result, String contractId, String contractIdRelation){
|
|
|
- result.forEach(vos -> {
|
|
|
- //查询子节点
|
|
|
- List<WbsTreeContractTreeVOS> childList = this.wbsTreeContractClient.lazyTree(Long.parseLong(vos.getPrimaryKeyId()), contractId, contractIdRelation, 2);
|
|
|
- if(childList != null && childList.size() == 1){
|
|
|
- this.foreachQueryChildNode(childList, contractId, contractIdRelation);
|
|
|
- }
|
|
|
- //判断当前节点是否被标记为首件
|
|
|
- TreeContractFirst first = this.treeContractFirstService.getOne(Wrappers.<TreeContractFirst>lambdaQuery().eq(TreeContractFirst::getIsDeleted, 0).eq(TreeContractFirst::getWbsNodeId, vos.getId()));
|
|
|
- vos.setIsFirst(first != null);
|
|
|
-
|
|
|
- vos.setChildren(childList);
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 循环处理节点颜色
|
|
|
- */
|
|
|
- private void foreachSetNodeColor(List<WbsTreeContractTreeVOS> children, List<QueryProcessDataVO> queryDataResult){
|
|
|
- children.forEach(vos -> {
|
|
|
- this.setNodeColor(vos, queryDataResult, false);
|
|
|
- if(vos.getChildren() != null && vos.getChildren().size() > 0){
|
|
|
- //进一步处理
|
|
|
- this.foreachSetNodeColor(vos.getChildren(), queryDataResult);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
+ //获取合同段,检查是否是监理/业主合同段
|
|
|
+ ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(contractId));
|
|
|
|
|
|
- /**
|
|
|
- * 监理合同段设置关联合同段的根节点名称
|
|
|
- */
|
|
|
- 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());
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ if((new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").equals(contractInfo.getContractType())) && StringUtils.isEmpty(contractIdRelation) && StringUtils.isEmpty(parentId)){
|
|
|
+ //给个顶点
|
|
|
+ WbsTreeContractTreeVOS vos = new WbsTreeContractTreeVOS();
|
|
|
+ vos.setTitle(contractInfo.getContractName());
|
|
|
+ vos.setChildren(result);
|
|
|
+ result = new ArrayList<>();
|
|
|
+ result.add(vos);
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- /**
|
|
|
- * 如果子节点只有一个,则进一步查询该子节点的下级节点
|
|
|
- * @param result 子节点集合
|
|
|
- */
|
|
|
- private void foreachQueryChildNode(List<WbsTreeContractTreeVOS> result, String contractId){
|
|
|
- result.forEach(vos -> {
|
|
|
- List<WbsTreeContractTreeVOS> child = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, vos.getId().toString());
|
|
|
- if(child != null && child.size() == 1){
|
|
|
- //如果子节点还是只有一个,则进一步向下查询
|
|
|
- this.foreachQueryChildNode(child, contractId);
|
|
|
- }
|
|
|
- //判断当前节点是否被标记为首件
|
|
|
- TreeContractFirst first = this.treeContractFirstService.getOne(Wrappers.<TreeContractFirst>lambdaQuery().eq(TreeContractFirst::getIsDeleted, 0).eq(TreeContractFirst::getWbsNodeId, vos.getPrimaryKeyId()));
|
|
|
- vos.setIsFirst(first != null);
|
|
|
-
|
|
|
- vos.setChildren(child);
|
|
|
- });
|
|
|
+ return R.data(result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1719,91 +1607,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if (StringUtils.isNotEmpty(primaryKeyId)){
|
|
|
parentId = primaryKeyId;
|
|
|
}
|
|
|
- List<WbsTreeContractTreeVOS> rootTreeNode = this.queryContractTree(parentId, contractId, contractIdRelation);
|
|
|
- rootTreeNode = rootTreeNode.stream().filter(vo -> vo.getNodeType() != null && vo.getNodeType() != 111).collect(Collectors.toList());
|
|
|
-
|
|
|
- return R.data(rootTreeNode);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 设置节点颜色
|
|
|
- * 填报节点:
|
|
|
- * 未填报1 < 已填报-未上报2 < 已填报-待审批3 < 已审批4
|
|
|
- *
|
|
|
- * 非填报节点
|
|
|
- * 未填报1(其下所有工序节点均未填报) < 已填报2(未上报和待审批) < 已审批4(其下所有工序节点均审批)
|
|
|
- *
|
|
|
- */
|
|
|
- private void setNodeColor(WbsTreeContractTreeVOS vos, List<QueryProcessDataVO> queryDataResult, boolean isRemove){
|
|
|
- if(queryDataResult != null && queryDataResult.size() > 0){
|
|
|
- Iterator<QueryProcessDataVO> iterator = queryDataResult.iterator();
|
|
|
- //默认均未填报
|
|
|
- StringBuilder colorStatusValue = new StringBuilder();
|
|
|
- while (iterator.hasNext()) {
|
|
|
- QueryProcessDataVO query = iterator.next();
|
|
|
- if(StringUtils.isNotEmpty(query.getAncestors()) && StringUtils.isNotEmpty(String.valueOf(vos.getId()))){
|
|
|
- if(query.getAncestors().contains(vos.getId().toString()) || query.getAncestors().contains(vos.getPrimaryKeyId()) || query.getAncestors().startsWith(vos.getParentId() + ",") || query.getTreeId().equals(vos.getId().toString()) || query.getTreeId().equals(vos.getPrimaryKeyId())){
|
|
|
- //如果为空,说明未填报
|
|
|
- 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;
|
|
|
- }
|
|
|
- if(isRemove){
|
|
|
- iterator.remove();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- colorStatusValue.append("1");
|
|
|
- }
|
|
|
- }
|
|
|
- //检查字符串
|
|
|
- if(StringUtils.isNotEmpty(colorStatusValue.toString())){
|
|
|
- if(new Integer("6").equals(vos.getNodeType())){
|
|
|
- //工序,则直接使用字符串的判断
|
|
|
- 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);
|
|
|
- }
|
|
|
- }
|
|
|
+ return R.data(this.queryContractTree(parentId, contractId, contractIdRelation));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1863,39 +1667,24 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//获取合同段,检查是否是监理合同段
|
|
|
ContractInfo contractInfo = this.contractClient.getContractById(Long.parseLong(contractId));
|
|
|
if(new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").equals(contractInfo.getContractType())){
|
|
|
- //监理合同段,需要获取关联的施工方合同段根节点数据
|
|
|
- rootTreeNode = this.wbsTreeContractClient.lazyTree(StringUtils.isNotEmpty(parentId) ? Long.parseLong(parentId) : 0, contractId, contractIdRelation, contractInfo.getContractType());
|
|
|
+ //监理/业主合同段,需要获取关联的施工方合同段根节点数据
|
|
|
+ List<String> contractIds = new ArrayList<>();
|
|
|
+ if(StringUtils.isEmpty(parentId)){
|
|
|
+ contractIds = this.contractClient.getProcessContractByJLContractId(contractId);
|
|
|
+ } else {
|
|
|
+ contractIds.add(contractIdRelation);
|
|
|
+ }
|
|
|
+ if(contractIds.size() > 0){
|
|
|
+ rootTreeNode = this.informationQueryService.queryContractTreeSupervision(contractIds, StringUtils.isNotEmpty(parentId) ? parentId : "0", 2);
|
|
|
+ } else {
|
|
|
+ rootTreeNode = new ArrayList<>();
|
|
|
+ }
|
|
|
+
|
|
|
} else {
|
|
|
//施工合同段
|
|
|
rootTreeNode = this.informationQueryService.queryContractTree(contractId, StringUtils.isNotEmpty(parentId) ? parentId : "0", 1);
|
|
|
}
|
|
|
|
|
|
- //其他参数
|
|
|
- if(rootTreeNode != null && rootTreeNode.size() > 0){
|
|
|
- //获取当前父节点下所有工序节点及填报资料
|
|
|
-// List<QueryProcessDataVO> queryDataResult;
|
|
|
-// if(new Integer("2").equals(contractInfo.getContractType())){
|
|
|
-// queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 2, contractIdRelation);
|
|
|
-// } else {
|
|
|
-// queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 1, contractId);
|
|
|
-// }
|
|
|
-
|
|
|
- if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){
|
|
|
- rootTreeNode.forEach(vo -> {
|
|
|
- if(new Integer("1").equals(contractInfo.getContractType())){
|
|
|
- if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){
|
|
|
- vo.setTitle(contractInfo.getContractName());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-// //处理颜色
|
|
|
-// if(queryDataResult != null && queryDataResult.size() > 0){
|
|
|
-// this.setNodeColor(vo, queryDataResult, true);
|
|
|
-// }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
return rootTreeNode;
|
|
|
}
|
|
|
|