فهرست منبع

质检多份节点复制时检查目标节点下有没有上报的数据

lvy 1 ماه پیش
والد
کامیت
d0e5d277ac

+ 24 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -68,6 +68,7 @@ import org.springblade.manager.vo.WbsTreeContractVO8;
 import org.springblade.manager.vo.WbsTreePrivateAddVO;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.system.cache.ParamCache;
+import org.springblade.system.entity.Dept;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
 import org.springblade.system.user.feign.IUserClient;
@@ -2285,6 +2286,29 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
                 if (StringUtils.isEmpty(contractId)) {
                     contractId = toCopyNode.getContractId();
                 }
+                String userRole = AuthUtil.getUserRole();
+                if(!"administrator".equals(userRole) && vo.getIsCopyData() == 1){
+                    // 查询当前节点有没有数据,有数据则不能复制
+                    if(vo.getClassifyType() != null && !vo.getClassifyType().isEmpty()) {
+                        List<InformationQuery> queries = informationQueryService.list(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getContractId, contractId)
+                                .in(InformationQuery::getClassify, vo.getClassifyType()).eq(InformationQuery::getWbsId, toCopyNode.getPKeyId()).in(InformationQuery::getStatus, 1, 2));
+                        if (!queries.isEmpty()) {
+                            Map<Integer, List<InformationQuery>> map = queries.stream().collect(Collectors.groupingBy(InformationQuery::getClassify));
+                            if (vo.getClassifyType().contains("1")) {
+                                List<InformationQuery> queryList = map.get(1);
+                                if (queryList != null && !queryList.isEmpty()) {
+                                    throw new ServiceException(toCopyNode.getFullName() + "节点有施工上报数据,不允许复制");
+                                }
+                            }
+                            if (vo.getClassifyType().contains("2")) {
+                                List<InformationQuery> queryList = map.get(2);
+                                if (queryList != null && !queryList.isEmpty()) {
+                                    throw new ServiceException(toCopyNode.getFullName() + "节点有监理上报数据,不允许复制");
+                                }
+                            }
+                        }
+                    }
+                }
             }
 
             WbsTreeContract needCopyNodeRoot = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());