huangjn 2 years ago
parent
commit
61457d5e16

+ 2 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/InformationQueryVO.java

@@ -65,6 +65,8 @@ public class InformationQueryVO extends InformationQuery {
 
 	private String firstTitle;
 
+	private String classifyType;
+
 	@ApiModelProperty("上报批次")
 	private String reportNumber;
 

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/ImageClassificationFileController.java

@@ -200,7 +200,7 @@ public class ImageClassificationFileController extends BladeController {
 										}
 									}
 
-									String locationFile = "/Users/doc/print/" + SnowFlakeUtil.getId() + ".xlsx";
+									String locationFile = "/Users/hongchuangyanfa/Desktop/print/" + SnowFlakeUtil.getId() + ".xlsx";//
 									outputStream = new FileOutputStream(locationFile);
 									//记录文件删除
 									removeList.add(locationFile);

+ 4 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -27,6 +27,7 @@ import org.springblade.core.mp.support.Query;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.jackson.JsonUtil;
 import org.springblade.core.tool.node.ForestNodeMerger;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.evisa.feign.EVisaClient;
@@ -1306,6 +1307,7 @@ public class InformationWriteQueryController extends BladeController {
 							if(treePrivate.getPKeyId().equals(next.getPKeyId())){
 								//删掉重复数据
 								iterator.remove();
+								break;
 							}
 						}
 					}
@@ -1313,6 +1315,7 @@ public class InformationWriteQueryController extends BladeController {
 				//处理完重复数据后,设置进集合中
 				selectedNodeList.addAll(childList);
 			}
+
 			//处理半选
 			this.disposeHalfSelectList(treeContract, halfSelectedNodeList, selectedNodeList);
 
@@ -1639,7 +1642,7 @@ public class InformationWriteQueryController extends BladeController {
 		query.setCurrent(vo.getCurrent());
 		//获取合同段信息
 		ContractInfo contract = this.contractClient.getContractById(vo.getContractId());
-		vo.setClassify(contract.getContractType() == null ? 1 : contract.getContractType());
+		vo.setClassify(StringUtils.isNotEmpty(vo.getClassifyType()) ? new Integer(vo.getClassifyType()) : contract.getContractType() == null ? 1 : new Integer("1").equals(contract.getContractType()) ? 1 : 2);
 
 		//获取所有
 		List<String> submitNodeKeyIds = new ArrayList<>();

+ 31 - 24
blade-service/blade-business/src/main/java/org/springblade/business/controller/MaterialProgressController.java

@@ -67,13 +67,15 @@ public class MaterialProgressController extends BladeController {
     @PostMapping("/queryContractTreeMaterialProgress")
     @ApiOperationSupport(order = 4)
     @ApiOperation(value = "资料进度")
-    public R<MaterialProgressVO> queryContractTreeMaterialProgress(@RequestParam String contractId, @RequestParam String parentId){
+    public R<MaterialProgressVO> queryContractTreeMaterialProgress(@RequestParam String contractId, @RequestParam String parentId, String classifyType){
+        classifyType = StringUtils.isEmpty(classifyType) ? "1" : classifyType;
+
         //设置返回对象
         MaterialProgressVO reVO = new MaterialProgressVO();
 
         //获取合同段信息
         ContractInfo contract = this.contractClient.getContractById(Long.parseLong(contractId));
-        if(new Integer("2").equals(contract.getContractType())){
+        if("2".equals(classifyType) && contract != null && (new Integer("2").equals(contract.getContractType()) || new Integer("3").equals(contract.getContractType()))){
             //监理合同段,获取其关联的施工合同段ID
             List<String> sgContractIds = this.contractClient.getProcessContractByJLContractId(contractId);
             for(String sgContractId : sgContractIds){
@@ -81,7 +83,7 @@ public class MaterialProgressController extends BladeController {
                 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().toString(), 1, sgContractId);
+                    List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(nodeResult.get(0).getId().toString(), new Integer(classifyType), sgContractId);
 
                     //统计
                     this.countAmount(nodeResult, queryDataResult, sgContractId, reVO);
@@ -94,7 +96,7 @@ public class MaterialProgressController extends BladeController {
             if(nodeResult != null && nodeResult.size() > 0){
 
                 //找到当前节点下的所有填报节点
-                List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, 1, contractId);
+                List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(parentId, new Integer(classifyType), contractId);
                 //统计
                 this.countAmount(nodeResult, queryDataResult, contractId, reVO);
 
@@ -192,13 +194,15 @@ public class MaterialProgressController extends BladeController {
     @PostMapping("/queryImageClassification")
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "声像媒体资料统计")
-    public R<MaterialProgressVO> queryImageClassification(@RequestParam String contractId){
+    public R<MaterialProgressVO> queryImageClassification(@RequestParam String contractId, String classifyType){
+        classifyType = StringUtils.isEmpty(classifyType) ? "1" : classifyType;
+
         //设置返回参数
         MaterialProgressVO reVO = new MaterialProgressVO();
 
         //获取合同段信息
         ContractInfo contract = this.contractClient.getContractById(Long.parseLong(contractId));
-        if(contract != null && new Integer("2").equals(contract.getContractType())){
+        if("2".equals(classifyType) && contract != null && (new Integer("2").equals(contract.getContractType()) || new Integer("3").equals(contract.getContractType()))){
             //监理合同段
             List<String> sgContractIds = this.contractClient.getProcessContractByJLContractId(contractId);
             if(sgContractIds != null && sgContractIds.size() > 0){
@@ -251,13 +255,13 @@ public class MaterialProgressController extends BladeController {
     @PostMapping("/queryMaterialProgressStatus")
     @ApiOperationSupport(order = 2)
     @ApiOperation(value = "报表资料审批统计")
-    public R<MaterialProgressVO> queryMaterialProgressStatus(@RequestParam String contractId){
+    public R<MaterialProgressVO> queryMaterialProgressStatus(@RequestParam String contractId, String classifyType){
         //设置参数返回
         MaterialProgressVO reVO = new MaterialProgressVO();
 
         //获取合同段信息
         ContractInfo contract = this.contractClient.getContractById(Long.parseLong(contractId));
-        if(contract != null && new Integer("2").equals(contract.getContractType())){
+        if(contract != null && (new Integer("2").equals(contract.getContractType()) || new Integer("3").equals(contract.getContractType()))){
             //监理合同段
             List<String> sgContractIds = this.contractClient.getProcessContractByJLContractId(contractId);
             if(sgContractIds != null && sgContractIds.size() > 0){
@@ -272,7 +276,7 @@ public class MaterialProgressController extends BladeController {
                 }
                 if(countList.size() > 0){
                     //设置参数
-                    this.setTaskParameter(reVO, countList);
+                    this.setTaskParameter(reVO, countList, classifyType);
                     return R.data(reVO);
                 }
             }
@@ -280,7 +284,7 @@ public class MaterialProgressController extends BladeController {
             //找到可填写的
             List<WbsTreeContract> submitNodeList = this.wbsTreeContractClient.queryContractSubmitWbsTreeByContractId(contractId);
             if(submitNodeList != null && submitNodeList.size() > 0){
-                this.setTaskParameter(reVO, submitNodeList);
+                this.setTaskParameter(reVO, submitNodeList, classifyType);
                 return R.data(reVO);
             }
         }
@@ -288,7 +292,9 @@ public class MaterialProgressController extends BladeController {
         return R.data(200, null, "未找到数据");
     }
 
-    private void setTaskParameter(MaterialProgressVO reVO, List<WbsTreeContract> submitNodeList){
+    private void setTaskParameter(MaterialProgressVO reVO, List<WbsTreeContract> submitNodeList, String classifyType){
+        classifyType = StringUtils.isEmpty(classifyType) ? "1" : classifyType;
+
         //汇总四个填报类型的总数
         List<String> process = new ArrayList<>(), workStartReports = new ArrayList<>(), evaluation = new ArrayList<>(), completion = new ArrayList<>();
         //类型分组
@@ -297,22 +303,22 @@ public class MaterialProgressController extends BladeController {
         //工序资料
         List<InformationQuery> processSubmitList = null;
         if(process.size() > 0){
-            processSubmitList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, process));
+            processSubmitList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, process).eq(InformationQuery::getClassify, classifyType));
         }
         //开工报告
         List<InformationQuery> workStartReportsSubmitList = null;
         if(workStartReports.size() > 0){
-            workStartReportsSubmitList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, workStartReports));
+            workStartReportsSubmitList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, workStartReports).eq(InformationQuery::getClassify, classifyType));
         }
         //质量评定
         List<InformationQuery> evaluationSubmitList = null;
         if(evaluation.size() > 0){
-            evaluationSubmitList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, evaluation));
+            evaluationSubmitList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, evaluation).eq(InformationQuery::getClassify, classifyType));
         }
         //中间交工
         List<InformationQuery> completionSubmitList = null;
         if(completion.size() > 0){
-            completionSubmitList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, completion));
+            completionSubmitList = this.informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, completion).eq(InformationQuery::getClassify, classifyType));
         }
 
         //处理工序资料
@@ -350,13 +356,13 @@ public class MaterialProgressController extends BladeController {
     @PostMapping("/queryMaterialProgress")
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "查询内业资料进度")
-    public R<MaterialProgressVO> queryMaterialProgress(@RequestParam String contractId){
+    public R<MaterialProgressVO> queryMaterialProgress(@RequestParam String contractId, String classifyType){
         //设置返回
         MaterialProgressVO reVO = new MaterialProgressVO();
 
         //获取合同段信息
         ContractInfo contract = this.contractClient.getContractById(Long.parseLong(contractId));
-        if(contract != null && new Integer("2").equals(contract.getContractType())){
+        if(contract != null && (new Integer("2").equals(contract.getContractType()) || new Integer("3").equals(contract.getContractType()))){
             //监理合同段
             List<String> sgContractIds = this.contractClient.getProcessContractByJLContractId(contractId);
             if(sgContractIds != null && sgContractIds.size() > 0){
@@ -371,7 +377,7 @@ public class MaterialProgressController extends BladeController {
                 }
                 if(countList.size() > 0){
                     //设置参数
-                    this.setParameter(countList, reVO);
+                    this.setParameter(countList, reVO, classifyType);
                 }
                 return R.data(reVO);
             }
@@ -381,7 +387,7 @@ public class MaterialProgressController extends BladeController {
             List<WbsTreeContract> submitNodeList = this.wbsTreeContractClient.queryContractSubmitWbsTreeByContractId(contractId);
             if(submitNodeList != null && submitNodeList.size() > 0){
                 //设置参数
-                this.setParameter(submitNodeList, reVO);
+                this.setParameter(submitNodeList, reVO, classifyType);
                 return R.data(reVO);
             }
         }
@@ -392,7 +398,8 @@ public class MaterialProgressController extends BladeController {
     /**
      * 设置参数
      */
-    private void setParameter(List<WbsTreeContract> submitNodeList, MaterialProgressVO reVO){
+    private void setParameter(List<WbsTreeContract> submitNodeList, MaterialProgressVO reVO, String classifyType){
+        classifyType = StringUtils.isEmpty(classifyType) ? "1" : classifyType;
         //汇总四个填报类型的总数
         List<String> process = new ArrayList<>(), workStartReports = new ArrayList<>(), evaluation = new ArrayList<>(), completion = new ArrayList<>();
         //类型分组
@@ -402,22 +409,22 @@ public class MaterialProgressController extends BladeController {
         //工序资料
         long processAmount = 0L;
         if(process.size() > 0){
-            processAmount = this.informationQueryService.count(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, process));
+            processAmount = this.informationQueryService.count(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, process).eq(InformationQuery::getClassify, classifyType));
         }
         //开工报告
         long workStartReportsAmount = 0L;
         if(workStartReports.size() > 0){
-            workStartReportsAmount = this.informationQueryService.count(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, workStartReports));
+            workStartReportsAmount = this.informationQueryService.count(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, workStartReports).eq(InformationQuery::getClassify, classifyType));
         }
         //质量评定
         long evaluationAmount = 0L;
         if(evaluation.size() > 0){
-            evaluationAmount = this.informationQueryService.count(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, evaluation));
+            evaluationAmount = this.informationQueryService.count(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, evaluation).eq(InformationQuery::getClassify, classifyType));
         }
         //中间交工
         long completionAmount = 0L;
         if(completion.size() > 0){
-            completionAmount = this.informationQueryService.count(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, completion));
+            completionAmount = this.informationQueryService.count(Wrappers.<InformationQuery>lambdaQuery().in(InformationQuery::getWbsId, completion).eq(InformationQuery::getClassify, classifyType));
         }
 
         reVO.setProcessMaterialList("开工报告", workStartReports.size(), workStartReportsAmount);

+ 3 - 1
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml

@@ -299,7 +299,9 @@
     </select>
 
     <select id="getReportNumberByContractId" resultMap="intResultMap">
-        select report_number from u_information_query where is_deleted = 0 and contract_id = #{contractId} and classify = #{classify} and report_number is not null group by report_number order by report_number ASC
+        select report_number from u_information_query where
+        is_deleted = 0 and contract_id = #{contractId}
+        and classify = #{classify} and report_number is not null group by report_number order by report_number ASC
     </select>
 
     <select id="queryFileUserByContractId" resultMap="informationQueryResultMap">

+ 55 - 18
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreePrivateController.java

@@ -71,19 +71,29 @@ public class WbsTreePrivateController extends BladeController {
             //记录需要修改的对象
             List<WbsTreePrivate> updateList = new ArrayList<>();
 
+            //记录需要删除的对象
+            List<WbsTreePrivate> removeList = new ArrayList<>();
+
             //模板节点
             List<String> wbsTreeIds = new ArrayList<>(Arrays.asList(vo.getWbsTreeIds().split(",")));
 
             if (wbsTreeIds.size() > 0) {
                 //获取模板节点
                 List<WbsTree> wbsTreeList = this.wbsTreeService.list(Wrappers.<WbsTree>lambdaQuery().in(WbsTree::getId, wbsTreeIds));
-                //获取这些模板下的表格元素
-                List<WbsTree> wbsTreeTableList = this.wbsTreeService.list(Wrappers.<WbsTree>lambdaQuery().in(WbsTree::getParentId, wbsTreeIds).eq(WbsTree::getType, 2));
-                if (wbsTreeTableList != null && wbsTreeTableList.size() > 0) {
-                    wbsTreeList.addAll(wbsTreeTableList);
-                }
 
                 if (oldDataList != null && oldDataList.size() > 0) {
+                    //判断哪些节点是本次删除的
+                    Iterator<WbsTreePrivate> oldIterator = oldDataList.iterator();
+
+                    while (oldIterator.hasNext()){
+                        WbsTreePrivate next = oldIterator.next();
+                        if(!wbsTreeIds.contains(next.getId().toString())){
+                            //不包含,删除
+                            removeList.add(next);
+                            oldIterator.remove();
+                        }
+                    }
+
                     //检查哪些节点是重复的或修改的,删除
                     Iterator<WbsTree> iterator = wbsTreeList.iterator();
                     while (iterator.hasNext()) {
@@ -91,16 +101,20 @@ public class WbsTreePrivateController extends BladeController {
                         for (WbsTreePrivate oldPrivate : oldDataList) {
                             if (oldPrivate.getId().equals(next.getId())) {
                                 if (
-                                        (StringUtils.isNotEmpty(next.getFullName(), oldPrivate.getFullName()) && !next.getFullName().equals(oldPrivate.getFullName()))
-                                                || (StringUtils.isNotEmpty(next.getNodeName(), oldPrivate.getNodeName()) && !next.getNodeName().equals(oldPrivate.getNodeName()))
-                                                || (StringUtils.isNotEmpty(next.getMajorDataType(), oldPrivate.getMajorDataType()) && !next.getMajorDataType().equals(oldPrivate.getMajorDataType()))
-                                                || (StringUtils.isNotEmpty(next.getNodeType(), oldPrivate.getNodeType()) && !next.getNodeType().equals(oldPrivate.getNodeType()))
+                                        (StringUtils.isNotEmpty(next.getFullName()) && !next.getFullName().equals(oldPrivate.getFullName()))
+                                                || (StringUtils.isNotEmpty(next.getNodeName()) && !next.getNodeName().equals(oldPrivate.getNodeName()))
+                                                || (StringUtils.isNotEmpty(next.getMajorDataType()) && !next.getMajorDataType().equals(oldPrivate.getMajorDataType()))
+                                                || (StringUtils.isNotEmpty(next.getNodeType()) && !next.getNodeType().equals(oldPrivate.getNodeType()))
+                                        || (StringUtils.isNotEmpty(next.getUniqueCode()) && !next.getUniqueCode().equals(oldPrivate.getUniqueCode()))
+                                        || (StringUtils.isNotEmpty(next.getPartitionCode()) && !next.getUniqueCode().equals(oldPrivate.getPartitionCode()))
                                 ) {
                                     //需要修改
                                     oldPrivate.setFullName(next.getFullName());
                                     oldPrivate.setNodeName(next.getNodeName());
                                     oldPrivate.setNodeType(next.getNodeType());
                                     oldPrivate.setMajorDataType(next.getMajorDataType());
+                                    oldPrivate.setUniqueCode(next.getUniqueCode());
+                                    oldPrivate.setPartitionCode(next.getPartitionCode());
 
                                     updateList.add(oldPrivate);
                                 }
@@ -112,16 +126,25 @@ public class WbsTreePrivateController extends BladeController {
                     }
                 }
 
-                //复制数据
-                for (WbsTree tree : wbsTreeList) {
-                    WbsTreePrivate treePrivate = new WbsTreePrivate();
-                    BeanUtils.copyProperties(tree, treePrivate);
-                    treePrivate.setWbsType("4");
-                    treePrivate.setProjectId(vo.getProjectId());
-                    treePrivate.setPKeyId(SnowFlakeUtil.getId());
-                    treePrivate.setCreateTime(now);
+                if(wbsTreeList.size() > 0){
+                    //获取这些模板下的表格元素
+                    List<Long> addNodeIds = wbsTreeList.stream().map(WbsTree::getId).distinct().collect(Collectors.toList());
+                    List<WbsTree> wbsTreeTableList = this.wbsTreeService.list(Wrappers.<WbsTree>lambdaQuery().in(WbsTree::getParentId, addNodeIds).eq(WbsTree::getType, 2));
+                    if (wbsTreeTableList != null && wbsTreeTableList.size() > 0) {
+                        wbsTreeList.addAll(wbsTreeTableList);
+                    }
+
+                    //复制数据
+                    for (WbsTree tree : wbsTreeList) {
+                        WbsTreePrivate treePrivate = new WbsTreePrivate();
+                        BeanUtils.copyProperties(tree, treePrivate);
+                        treePrivate.setWbsType("4");
+                        treePrivate.setProjectId(vo.getProjectId());
+                        treePrivate.setPKeyId(SnowFlakeUtil.getId());
+                        treePrivate.setCreateTime(now);
 
-                    saveTreePrivateList.add(treePrivate);
+                        saveTreePrivateList.add(treePrivate);
+                    }
                 }
             }
 
@@ -193,9 +216,23 @@ public class WbsTreePrivateController extends BladeController {
                             .set(WbsTreePrivate::getFullName, treePrivate.getFullName())
                             .set(WbsTreePrivate::getNodeType, treePrivate.getNodeType())
                             .set(WbsTreePrivate::getMajorDataType, treePrivate.getMajorDataType())
+                            .set(WbsTreePrivate::getUniqueCode, treePrivate.getUniqueCode())
+                            .set(WbsTreePrivate::getPartitionCode, treePrivate.getPartitionCode())
                             .eq(WbsTreePrivate::getPKeyId, treePrivate.getPKeyId()));
                 }
             }
+            if(removeList.size() > 0){
+                List<Long> removePKeyIds = removeList.stream().map(WbsTreePrivate::getPKeyId).distinct().collect(Collectors.toList());
+                //同时删除其下的表格
+                List<Long> removeIds = removeList.stream().map(WbsTreePrivate::getId).distinct().collect(Collectors.toList());
+                this.wbsTreePrivateService.update(Wrappers.<WbsTreePrivate>lambdaUpdate()
+                        .set(WbsTreePrivate::getIsDeleted, 1)
+                        .in(WbsTreePrivate::getParentId, removeIds).eq(WbsTreePrivate::getProjectId, removeList.get(0).getProjectId()));
+                //最后删除节点
+                this.wbsTreePrivateService.update(Wrappers.<WbsTreePrivate>lambdaUpdate()
+                        .set(WbsTreePrivate::getIsDeleted, 1)
+                        .in(WbsTreePrivate::getPKeyId, removePKeyIds));
+            }
 
             return R.data(200, true, "保存成功");
         } else {