|
@@ -28,7 +28,9 @@ import org.springblade.business.service.IInformationQueryService;
|
|
|
import org.springblade.business.vo.MaterialProgressVO;
|
|
|
import org.springblade.business.vo.QueryProcessDataVO;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
+import org.springblade.manager.entity.ContractInfo;
|
|
|
import org.springblade.manager.entity.WbsTreeContract;
|
|
|
+import org.springblade.manager.feign.ContractClient;
|
|
|
import org.springblade.manager.feign.WbsTreeContractClient;
|
|
|
import org.springblade.manager.vo.WbsTreeContractTreeVOS;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -57,6 +59,8 @@ public class MaterialProgressController extends BladeController {
|
|
|
|
|
|
private final IImageClassificationFileService imageClassificationFileService;
|
|
|
|
|
|
+ private final ContractClient contractClient;
|
|
|
+
|
|
|
/**
|
|
|
* 资料进度
|
|
|
*/
|
|
@@ -64,77 +68,99 @@ public class MaterialProgressController extends BladeController {
|
|
|
@ApiOperationSupport(order = 4)
|
|
|
@ApiOperation(value = "资料进度")
|
|
|
public R<MaterialProgressVO> queryContractTreeMaterialProgress(@RequestParam String contractId, @RequestParam String parentId){
|
|
|
- //找到根节点
|
|
|
- List<WbsTreeContractTreeVOS> nodeResult = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, StringUtils.isNotEmpty(parentId) ? parentId : "0");
|
|
|
- if(nodeResult != null && nodeResult.size() > 0){
|
|
|
- //设置返回参数
|
|
|
- MaterialProgressVO reVO = new MaterialProgressVO();
|
|
|
-
|
|
|
- //找到当前节点下的所有填报节点
|
|
|
- List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 1, contractId);
|
|
|
-
|
|
|
- nodeResult.forEach(node -> {
|
|
|
- //施工台账
|
|
|
- int standingBookNotAmount = 0, standingBookEndAmount = 0;
|
|
|
- //工序资料
|
|
|
- AtomicInteger processNotSubmitAmount = new AtomicInteger(), processNotTaskAmount = new AtomicInteger(), processAwaitAmount = new AtomicInteger(), processApprovalAmount = new AtomicInteger();
|
|
|
- //开工报告
|
|
|
- AtomicInteger workStartNotSubmitAmount = new AtomicInteger(), workStartNotTaskAmount = new AtomicInteger(), workStartAwaitAmount = new AtomicInteger(), workStartApprovalAmount = new AtomicInteger();
|
|
|
- //质量评定
|
|
|
- AtomicInteger evaluationNotSubmitAmount = new AtomicInteger(), evaluationNotTaskAmount = new AtomicInteger(), evaluationAwaitAmount = new AtomicInteger(), evaluationApprovalAmount = new AtomicInteger();
|
|
|
- //中间交工
|
|
|
- AtomicInteger completionNotSubmitAmount = new AtomicInteger(), completionNotTaskAmount = new AtomicInteger(), completionAwaitAmount = new AtomicInteger(), completionApprovalAmount = new AtomicInteger();
|
|
|
-
|
|
|
- //使用迭代器,减少之后的循环次数
|
|
|
- Iterator<QueryProcessDataVO> iterator = queryDataResult.iterator();
|
|
|
- while (iterator.hasNext()){
|
|
|
- QueryProcessDataVO query = iterator.next();
|
|
|
- if(query.getAncestors().contains(node.getId()) || query.getAncestors().startsWith(node.getParentId() + ",") || query.getTreeId().equals(node.getId())){
|
|
|
- switch (query.getMajorDataType()){
|
|
|
- case 1:
|
|
|
- //开工报告
|
|
|
- this.addInteger(query, workStartNotSubmitAmount, workStartNotTaskAmount, workStartAwaitAmount, workStartApprovalAmount);
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- //质量评定
|
|
|
- this.addInteger(query, evaluationNotSubmitAmount, evaluationNotTaskAmount, evaluationAwaitAmount, evaluationApprovalAmount);
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- //中间交工
|
|
|
- this.addInteger(query, completionNotSubmitAmount, completionNotTaskAmount, completionAwaitAmount, completionApprovalAmount);
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- //工序资料
|
|
|
- this.addInteger(query, processNotSubmitAmount, processNotTaskAmount, processAwaitAmount, processApprovalAmount);
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- iterator.remove();
|
|
|
- }
|
|
|
+ //设置返回对象
|
|
|
+ MaterialProgressVO reVO = new MaterialProgressVO();
|
|
|
+
|
|
|
+ //获取合同段信息
|
|
|
+ ContractInfo contract = this.contractClient.getContractById(Long.parseLong(contractId));
|
|
|
+ if(new Integer("2").equals(contract.getContractType())){
|
|
|
+ //监理合同段,获取其关联的施工合同段ID
|
|
|
+ List<String> sgContractIds = this.contractClient.getProcessContractByJLContractId(contractId);
|
|
|
+ for(String sgContractId : sgContractIds){
|
|
|
+ //找到根节点
|
|
|
+ List<WbsTreeContractTreeVOS> nodeResult = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(sgContractId, 1, StringUtils.isNotEmpty(parentId) ? parentId : "0");
|
|
|
+ if(nodeResult != null && nodeResult.size() > 0){
|
|
|
+ //找到当前节点下的所有填报节点
|
|
|
+ List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(nodeResult.get(0).getId(), 1, sgContractId);
|
|
|
+ //统计
|
|
|
+ this.countAmount(nodeResult, queryDataResult, sgContractId, reVO);
|
|
|
}
|
|
|
+ }
|
|
|
+ return R.data(reVO);
|
|
|
+ } else {
|
|
|
+ //找到根节点
|
|
|
+ List<WbsTreeContractTreeVOS> nodeResult = this.wbsTreeContractClient.queryContractWbsTreeByContractIdAndType(contractId, 1, StringUtils.isNotEmpty(parentId) ? parentId : "0");
|
|
|
+ if(nodeResult != null && nodeResult.size() > 0){
|
|
|
|
|
|
- WbsTreeContract nodes = new WbsTreeContract();
|
|
|
- nodes.setId(Long.parseLong(node.getId()));
|
|
|
- nodes.setContractId(contractId);
|
|
|
- nodes.setWbsType(node.getWbsType());
|
|
|
+ //找到当前节点下的所有填报节点
|
|
|
+ List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 1, contractId);
|
|
|
+ //统计
|
|
|
+ this.countAmount(nodeResult, queryDataResult, contractId, reVO);
|
|
|
|
|
|
- //检查是否还有下级
|
|
|
- List<WbsTreeContract> childList = this.wbsTreeContractClient.queryChildByParentId(nodes, "");
|
|
|
+ return R.data(reVO);
|
|
|
|
|
|
- //设置参数
|
|
|
- reVO.setTreeMaterialProgressList(node.getTitle(), node.getId(), standingBookNotAmount, standingBookEndAmount,
|
|
|
- processNotSubmitAmount.get(), processNotTaskAmount.get(), processAwaitAmount.get(), processApprovalAmount.get(),
|
|
|
- workStartNotSubmitAmount.get(), workStartNotTaskAmount.get(), workStartAwaitAmount.get(), workStartApprovalAmount.get(),
|
|
|
- evaluationNotSubmitAmount.get(), evaluationNotTaskAmount.get(), evaluationAwaitAmount.get(), evaluationApprovalAmount.get(),
|
|
|
- completionNotSubmitAmount.get(), completionNotTaskAmount.get(), completionAwaitAmount.get(), completionApprovalAmount.get(), childList != null && childList.size() > 0);
|
|
|
- });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.data(300, null, "未找到数据");
|
|
|
+ }
|
|
|
|
|
|
- return R.data(reVO);
|
|
|
+ private void countAmount(List<WbsTreeContractTreeVOS> nodeResult, List<QueryProcessDataVO> queryDataResult, String contractId, MaterialProgressVO reVO){
|
|
|
+ nodeResult.forEach(node -> {
|
|
|
+ //施工台账
|
|
|
+ int standingBookNotAmount = 0, standingBookEndAmount = 0;
|
|
|
+ //工序资料
|
|
|
+ AtomicInteger processNotSubmitAmount = new AtomicInteger(), processNotTaskAmount = new AtomicInteger(), processAwaitAmount = new AtomicInteger(), processApprovalAmount = new AtomicInteger();
|
|
|
+ //开工报告
|
|
|
+ AtomicInteger workStartNotSubmitAmount = new AtomicInteger(), workStartNotTaskAmount = new AtomicInteger(), workStartAwaitAmount = new AtomicInteger(), workStartApprovalAmount = new AtomicInteger();
|
|
|
+ //质量评定
|
|
|
+ AtomicInteger evaluationNotSubmitAmount = new AtomicInteger(), evaluationNotTaskAmount = new AtomicInteger(), evaluationAwaitAmount = new AtomicInteger(), evaluationApprovalAmount = new AtomicInteger();
|
|
|
+ //中间交工
|
|
|
+ AtomicInteger completionNotSubmitAmount = new AtomicInteger(), completionNotTaskAmount = new AtomicInteger(), completionAwaitAmount = new AtomicInteger(), completionApprovalAmount = new AtomicInteger();
|
|
|
+
|
|
|
+ //使用迭代器,减少之后的循环次数
|
|
|
+ Iterator<QueryProcessDataVO> iterator = queryDataResult.iterator();
|
|
|
+ while (iterator.hasNext()){
|
|
|
+ QueryProcessDataVO query = iterator.next();
|
|
|
+ if(query.getAncestors().contains(node.getId()) || query.getAncestors().startsWith(node.getParentId() + ",") || query.getTreeId().equals(node.getId())){
|
|
|
+ switch (query.getMajorDataType()){
|
|
|
+ case 1:
|
|
|
+ //开工报告
|
|
|
+ this.addInteger(query, workStartNotSubmitAmount, workStartNotTaskAmount, workStartAwaitAmount, workStartApprovalAmount);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ //质量评定
|
|
|
+ this.addInteger(query, evaluationNotSubmitAmount, evaluationNotTaskAmount, evaluationAwaitAmount, evaluationApprovalAmount);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ //中间交工
|
|
|
+ this.addInteger(query, completionNotSubmitAmount, completionNotTaskAmount, completionAwaitAmount, completionApprovalAmount);
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ //工序资料
|
|
|
+ this.addInteger(query, processNotSubmitAmount, processNotTaskAmount, processAwaitAmount, processApprovalAmount);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ WbsTreeContract nodes = new WbsTreeContract();
|
|
|
+ nodes.setId(Long.parseLong(node.getId()));
|
|
|
+ nodes.setContractId(contractId);
|
|
|
+ nodes.setWbsType(node.getWbsType());
|
|
|
|
|
|
- return R.data(300, null, "未找到数据");
|
|
|
+ //检查是否还有下级
|
|
|
+ List<WbsTreeContract> childList = this.wbsTreeContractClient.queryChildByParentId(nodes, "");
|
|
|
+
|
|
|
+ //设置参数
|
|
|
+ reVO.setTreeMaterialProgressList(node.getTitle(), node.getId(), node.getPrimaryKeyId(), contractId, standingBookNotAmount, standingBookEndAmount,
|
|
|
+ processNotSubmitAmount.get(), processNotTaskAmount.get(), processAwaitAmount.get(), processApprovalAmount.get(),
|
|
|
+ workStartNotSubmitAmount.get(), workStartNotTaskAmount.get(), workStartAwaitAmount.get(), workStartApprovalAmount.get(),
|
|
|
+ evaluationNotSubmitAmount.get(), evaluationNotTaskAmount.get(), evaluationAwaitAmount.get(), evaluationApprovalAmount.get(),
|
|
|
+ completionNotSubmitAmount.get(), completionNotTaskAmount.get(), completionAwaitAmount.get(), completionApprovalAmount.get(), childList != null && childList.size() > 0);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|