Procházet zdrojové kódy

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

lvy před 1 měsícem
rodič
revize
6d761c4161

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

@@ -2284,6 +2284,28 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
                 if (StringUtils.isEmpty(contractId)) {
                     contractId = toCopyNode.getContractId();
                 }
+                if (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());

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ExcelTabMapper.xml

@@ -240,7 +240,7 @@
         ) as t on a.id = t.project_id where project_id is not null
     </select>
     <select id="getByIds" resultType="org.springblade.manager.vo.ExcelTabVO">
-        select *, (select name from blade_user where id = a.create_user) as createUserName, (SELECT bdb.dict_value from blade_dict_biz bdb WHERE code = 'table_template_type' AND dict_key = x.table_template_type) as tableTemplateTypeName
+        select *, (select name from blade_user where id = a.create_user) as createUserName, (SELECT bdb.dict_value from blade_dict_biz bdb WHERE code = 'table_template_type' AND dict_key = a.table_template_type) as tableTemplateTypeName
         from m_excel_tab a where is_deleted = 0
         <if test="ids !=null">
             and id in