|
@@ -0,0 +1,360 @@
|
|
|
+/*
|
|
|
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
|
|
+ *
|
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
|
+ * modification, are permitted provided that the following conditions are met:
|
|
|
+ *
|
|
|
+ * Redistributions of source code must retain the above copyright notice,
|
|
|
+ * this list of conditions and the following disclaimer.
|
|
|
+ * Redistributions in binary form must reproduce the above copyright
|
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
|
+ * Neither the name of the dreamlu.net developer nor the names of its
|
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
|
+ * this software without specific prior written permission.
|
|
|
+ * Author: Chill 庄骞 (smallchill@163.com)
|
|
|
+ */
|
|
|
+package org.springblade.business.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springblade.business.entity.InformationQuery;
|
|
|
+import org.springblade.business.service.IImageClassificationFileService;
|
|
|
+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.WbsTreeContract;
|
|
|
+import org.springblade.manager.feign.WbsTreeContractClient;
|
|
|
+import org.springblade.manager.vo.WbsTreeContractTreeVOS;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springblade.core.boot.ctrl.BladeController;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Iterator;
|
|
|
+import java.util.List;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 点赞记录表 控制器
|
|
|
+ *
|
|
|
+ * @author BladeX
|
|
|
+ * @since 2022-06-21
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/materialProgress")
|
|
|
+@Api(value = "资料进度", tags = "资料进度接口")
|
|
|
+public class MaterialProgressController extends BladeController {
|
|
|
+
|
|
|
+ private final WbsTreeContractClient wbsTreeContractClient;
|
|
|
+
|
|
|
+ private final IInformationQueryService informationQueryService;
|
|
|
+
|
|
|
+ private final IImageClassificationFileService imageClassificationFileService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 资料进度
|
|
|
+ */
|
|
|
+ @PostMapping("/queryContractTreeMaterialProgress")
|
|
|
+ @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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ WbsTreeContract nodes = new WbsTreeContract();
|
|
|
+ nodes.setId(Long.parseLong(node.getId()));
|
|
|
+ nodes.setContractId(contractId);
|
|
|
+ nodes.setWbsType(node.getWbsType());
|
|
|
+
|
|
|
+ //检查是否还有下级
|
|
|
+ List<WbsTreeContract> childList = this.wbsTreeContractClient.queryChildByParentId(nodes, "");
|
|
|
+
|
|
|
+ //设置参数
|
|
|
+ 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(reVO);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.data(300, null, "未找到数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 参数 + 1
|
|
|
+ */
|
|
|
+ private void addInteger(QueryProcessDataVO vo, AtomicInteger notSubmit, AtomicInteger notTask, AtomicInteger await, AtomicInteger approval){
|
|
|
+ if(vo.getStatus() != null){
|
|
|
+ switch (vo.getStatus()){
|
|
|
+ case 1:
|
|
|
+ await.getAndIncrement();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ approval.getAndIncrement();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ notTask.getAndIncrement();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ notSubmit.getAndIncrement();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 声像媒体资料统计
|
|
|
+ */
|
|
|
+ @PostMapping("/queryImageClassification")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "声像媒体资料统计")
|
|
|
+ public R<MaterialProgressVO> queryImageClassification(@RequestParam String contractId){
|
|
|
+ List<Integer> fileTypes = this.imageClassificationFileService.queryCurrentContractImageFileType(contractId);
|
|
|
+ if(fileTypes != null && fileTypes.size() > 0){
|
|
|
+ //判断数量
|
|
|
+ AtomicInteger imageAmount = new AtomicInteger();
|
|
|
+ AtomicInteger videoAmount = new AtomicInteger();
|
|
|
+ fileTypes.forEach(type -> {
|
|
|
+ switch (type) {
|
|
|
+ case 1:
|
|
|
+ videoAmount.getAndIncrement();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ imageAmount.getAndIncrement();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //设置返回参数
|
|
|
+ MaterialProgressVO reVO = new MaterialProgressVO();
|
|
|
+ reVO.setContractImageClassificationList(fileTypes.size(), imageAmount.get(), videoAmount.get());
|
|
|
+
|
|
|
+ return R.data(reVO);
|
|
|
+ }
|
|
|
+ return R.data(300, null, "未找到数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 报表资料审批统计
|
|
|
+ */
|
|
|
+ @PostMapping("/queryMaterialProgressStatus")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "报表资料审批统计")
|
|
|
+ public R<MaterialProgressVO> queryMaterialProgressStatus(@RequestParam String contractId){
|
|
|
+ //找到可填写的
|
|
|
+ List<WbsTreeContract> submitNodeList = this.wbsTreeContractClient.queryContractSubmitWbsTreeByContractId(contractId);
|
|
|
+ if(submitNodeList != null && submitNodeList.size() > 0){
|
|
|
+ //汇总四个填报类型的总数
|
|
|
+ List<String> process = new ArrayList<>(), workStartReports = new ArrayList<>(), evaluation = new ArrayList<>(), completion = new ArrayList<>();
|
|
|
+ //类型分组
|
|
|
+ this.checkType(submitNodeList, process, workStartReports, evaluation, completion);
|
|
|
+
|
|
|
+ //工序资料
|
|
|
+ List<InformationQuery> processSubmitList = null;
|
|
|
+ if(process.size() > 0){
|
|
|
+ processSubmitList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, process));
|
|
|
+ }
|
|
|
+ //开工报告
|
|
|
+ List<InformationQuery> workStartReportsSubmitList = null;
|
|
|
+ if(workStartReports.size() > 0){
|
|
|
+ workStartReportsSubmitList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, workStartReports));
|
|
|
+ }
|
|
|
+ //质量评定
|
|
|
+ List<InformationQuery> evaluationSubmitList = null;
|
|
|
+ if(evaluation.size() > 0){
|
|
|
+ evaluationSubmitList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, evaluation));
|
|
|
+ }
|
|
|
+ //中间交工
|
|
|
+ List<InformationQuery> completionSubmitList = null;
|
|
|
+ if(completion.size() > 0){
|
|
|
+ completionSubmitList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, completion));
|
|
|
+ }
|
|
|
+
|
|
|
+ //设置参数返回
|
|
|
+ MaterialProgressVO reVO = new MaterialProgressVO();
|
|
|
+
|
|
|
+ //处理工序资料
|
|
|
+ if(processSubmitList != null && processSubmitList.size() > 0){
|
|
|
+ this.setParameter(reVO, processSubmitList);
|
|
|
+ } else {
|
|
|
+ reVO.setProcessMaterialStatusList("工序资料", 0, 0 ,0);
|
|
|
+ }
|
|
|
+ //处理开工报告
|
|
|
+ if(workStartReportsSubmitList != null && workStartReportsSubmitList.size() > 0){
|
|
|
+ this.setParameter(reVO, workStartReportsSubmitList);
|
|
|
+ } else {
|
|
|
+ reVO.setProcessMaterialStatusList("开工报告", 0, 0 ,0);
|
|
|
+ }
|
|
|
+ //处理评定资料
|
|
|
+ if(evaluationSubmitList != null && evaluationSubmitList.size() > 0){
|
|
|
+ this.setParameter(reVO, evaluationSubmitList);
|
|
|
+ } else {
|
|
|
+ reVO.setProcessMaterialStatusList("评定资料", 0, 0 ,0);
|
|
|
+ }
|
|
|
+ //处理中间交工
|
|
|
+ if(completionSubmitList != null && completionSubmitList.size() > 0){
|
|
|
+ this.setParameter(reVO, completionSubmitList);
|
|
|
+ } else {
|
|
|
+ reVO.setProcessMaterialStatusList("中间交工", 0, 0 ,0);
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.data(reVO);
|
|
|
+ }
|
|
|
+ return R.data(300, null, "未找到数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询内业资料进度
|
|
|
+ */
|
|
|
+ @PostMapping("/queryMaterialProgress")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+ @ApiOperation(value = "查询内业资料进度")
|
|
|
+ public R<MaterialProgressVO> queryMaterialProgress(@RequestParam String contractId){
|
|
|
+ //找到可填写的
|
|
|
+ List<WbsTreeContract> submitNodeList = this.wbsTreeContractClient.queryContractSubmitWbsTreeByContractId(contractId);
|
|
|
+ if(submitNodeList != null && submitNodeList.size() > 0){
|
|
|
+ //汇总四个填报类型的总数
|
|
|
+ List<String> process = new ArrayList<>(), workStartReports = new ArrayList<>(), evaluation = new ArrayList<>(), completion = new ArrayList<>();
|
|
|
+ //类型分组
|
|
|
+ this.checkType(submitNodeList, process, workStartReports, evaluation, completion);
|
|
|
+
|
|
|
+ //根据四个集合获取对应的资料
|
|
|
+ //工序资料
|
|
|
+ long processAmount = 0L;
|
|
|
+ if(process.size() > 0){
|
|
|
+ processAmount = this.informationQueryService.count(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, process));
|
|
|
+ }
|
|
|
+ //开工报告
|
|
|
+ long workStartReportsAmount = 0L;
|
|
|
+ if(workStartReports.size() > 0){
|
|
|
+ workStartReportsAmount = this.informationQueryService.count(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, workStartReports));
|
|
|
+ }
|
|
|
+ //质量评定
|
|
|
+ long evaluationAmount = 0L;
|
|
|
+ if(evaluation.size() > 0){
|
|
|
+ evaluationAmount = this.informationQueryService.count(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, evaluation));
|
|
|
+ }
|
|
|
+ //中间交工
|
|
|
+ long completionAmount = 0L;
|
|
|
+ if(completion.size() > 0){
|
|
|
+ completionAmount = this.informationQueryService.count(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, completion));
|
|
|
+ }
|
|
|
+
|
|
|
+ //设置返回
|
|
|
+ MaterialProgressVO reVO = new MaterialProgressVO();
|
|
|
+ reVO.setProcessMaterialList("开工报告", workStartReports.size(), workStartReportsAmount);
|
|
|
+ reVO.setProcessMaterialList("工序资料", process.size(), processAmount);
|
|
|
+ reVO.setProcessMaterialList("评定资料", evaluation.size(), evaluationAmount);
|
|
|
+ reVO.setProcessMaterialList("中间交工", completion.size(), completionAmount);
|
|
|
+
|
|
|
+ return R.data(reVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.data(300, null, "未找到数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置参数
|
|
|
+ */
|
|
|
+ private void setParameter(MaterialProgressVO reVO, List<InformationQuery> list){
|
|
|
+ //待审批
|
|
|
+ AtomicInteger await = new AtomicInteger();
|
|
|
+ //已审批
|
|
|
+ AtomicInteger approval = new AtomicInteger();
|
|
|
+ list.forEach(vo -> {
|
|
|
+ switch (vo.getStatus()){
|
|
|
+ case 1:
|
|
|
+ await.getAndIncrement();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ approval.getAndIncrement();
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ reVO.setProcessMaterialStatusList("工序资料", list.size(), await.get(), approval.get());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 类型分组
|
|
|
+ */
|
|
|
+ private void checkType(List<WbsTreeContract> submitNodeList, List<String> process, List<String> workStartReports, List<String> evaluation, List<String> completion){
|
|
|
+ submitNodeList.forEach(contract -> {
|
|
|
+ switch (contract.getMajorDataType()){
|
|
|
+ case 1:
|
|
|
+ //开工报告
|
|
|
+ workStartReports.add(contract.getPKeyId().toString());
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ //质量评定
|
|
|
+ evaluation.add(contract.getPKeyId().toString());
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ //中间交工
|
|
|
+ completion.add(contract.getPKeyId().toString());
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ //工序资料
|
|
|
+ process.add(contract.getPKeyId().toString());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+}
|