Browse Source

Merge remote-tracking branch 'origin/master' into master

yangyj 1 year ago
parent
commit
602f6882b4
19 changed files with 257 additions and 99 deletions
  1. 9 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ArchiveFileClient.java
  2. 5 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/InformationQueryClient.java
  3. 0 6
      blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.xml
  4. 7 5
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveAutoPdfServiceImpl.java
  5. 55 13
      blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java
  6. 18 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/utils/FileUtils.java
  7. 19 3
      blade-service/blade-business/src/main/java/org/springblade/business/controller/EVisaTaskCheckController.java
  8. 2 2
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  9. 7 0
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ArchiveFileClientImpl.java
  10. 5 0
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/InformationQueryClientImpl.java
  11. 3 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.java
  12. 10 0
      blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.xml
  13. 6 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/IInformationQueryService.java
  14. 12 0
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java
  15. 2 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ArchiveTreeContractMapper.xml
  16. 19 17
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveAutoRuleSyncImpl.java
  17. 19 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java
  18. 7 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java
  19. 52 50
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

+ 9 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ArchiveFileClient.java

@@ -89,6 +89,15 @@ public interface ArchiveFileClient {
     @PostMapping(API_PREFIX + "/getListByNodeID")
     List<ArchiveFile> getListByNodeID(@RequestParam String nodeId);
 
+
+    /**
+     * 获取案卷下的文件
+     * @param archiveId
+     * @return
+     */
+    @PostMapping(API_PREFIX + "/getArchiveFileByArchiveID")
+    List<ArchiveFile> getArchiveFileByArchiveID(@RequestParam Long archiveId);
+
     /**
      * 项目下所有工序资料PDF
      * @param projectId

+ 5 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/InformationQueryClient.java

@@ -1,6 +1,7 @@
 package org.springblade.business.feign;
 
 import com.alibaba.fastjson.JSONObject;
+import org.springblade.business.entity.InformationQuery;
 import org.springblade.common.constant.BusinessConstant;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -71,4 +72,8 @@ public interface InformationQueryClient {
     @PostMapping(API_PREFIX + "/delAsyncWbsTree")
     void delAsyncWbsTree(@RequestParam String contractId);
 
+    // 根据wbsId获取首件填报信息
+    @PostMapping(API_PREFIX + "/getFirstInfoByWbsId")
+    InformationQuery getFirstInfoByWbsId(@RequestParam String WbsId);
+
 }

+ 0 - 6
blade-service/blade-archive/src/main/java/org/springblade/archive/mapper/ArchivesAutoMapper.xml

@@ -71,9 +71,6 @@
         <if test="vo.projectId != null and vo.projectId != ''">
             and project_id = #{vo.projectId}
         </if>
-        <if test="vo.contractId != null and vo.contractId != ''">
-            and contract_id = #{vo.contractId}
-        </if>
         <if test="vo.isAutoFile != null and vo.isAutoFile != ''">
             and is_auto_file = #{vo.isAutoFile}
         </if>
@@ -101,9 +98,6 @@
         <if test="vo.projectId != null and vo.projectId != ''">
             and project_id = #{vo.projectId}
         </if>
-        <if test="vo.contractId != null and vo.contractId != ''">
-            and contract_id = #{vo.contractId}
-        </if>
         <choose>
             <when test="vo.isArchive != null and vo.isArchive != ''">
                 and  is_auto_file = #{vo.isArchive}

+ 7 - 5
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveAutoPdfServiceImpl.java

@@ -227,6 +227,9 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
             numberBacks.add(ARCHIVE_NUMBER[3]);
         }
 
+        String secretLevel = archivesAuto.getSecretLevel();
+        String storageTime = archivesAuto.getStorageTime();
+
         Map<String,Object> variables = dataSourceBuilder(archivesAuto,archiveFileList);
 
         // 使用生成的档案号码字符串链表生成档案 PDF 文件
@@ -250,6 +253,8 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
 
         String joinedUrls = String.join(", ", frontUrls);
         archivesAuto.setOutUrl(joinedUrls);
+        archivesAuto.setSecretLevel(secretLevel);
+        archivesAuto.setStorageTime(storageTime);
     }
 
     /**
@@ -744,13 +749,10 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
         Long projectId = archive.getProjectId();
         archive.setFileNumber(fileNumber);
 
-        List<ArchiveFile> archiveFiles = archiveFileClient.listWrappers(Wrappers.<ArchiveFile>lambdaQuery()
-                .eq(ArchiveFile::getArchiveId, archive.getId())
-                .eq(ArchiveFile::getIsArchive, 0)
-                .eq(ArchiveFile::getIsDeleted,0)
-                .orderByAsc(ArchiveFile::getSort));
+        List<ArchiveFile> archiveFiles = archiveFileClient.getArchiveFileByArchiveID(archive.getId());
 
         buildArchiveFrontPdfs(projectId,archive,archiveFiles);
+
         return true;
     }
 

+ 55 - 13
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchivesAutoServiceImpl.java

@@ -304,11 +304,17 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 			List<String> removeFiles = new ArrayList<>();
 			for (ArchiveFile file : files) {
 				if (StringUtils.isNotBlank(file.getFileUrl())){
-					removeFiles.add(file.getFileUrl().substring(file.getFileUrl().lastIndexOf("upload")));
+					removeFiles.add(FileUtils.getAliYunSubUrl(file.getFileUrl()));
 				}
 				if (StringUtils.isNotBlank(file.getPdfFileUrl())){
-					removeFiles.add(file.getPdfFileUrl().substring(file.getPdfFileUrl().lastIndexOf("upload")));
+					removeFiles.add(FileUtils.getAliYunSubUrl(file.getFileUrl()));
 				}
+
+				//打码的也要删除
+				if (StringUtils.isNotBlank(file.getPdfPageUrl())){
+					removeFiles.add(FileUtils.getAliYunSubUrl(file.getPdfPageUrl()));
+				}
+
 			}
 			iossClient.removeFiles(removeFiles);
 			//删除文件
@@ -467,12 +473,11 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 			for(String nodeId:nodeIdSet){
 				ArchiveTreeContract treeNode = archiveTreeContractClient.getArchiveTreeContractById(Long.parseLong(nodeId));
 				String nodeName = treeNode.getNodeName();
-				archiveName=archiveName+nodeName;
+				archiveName=archiveName+" "+nodeName;
 			}
-
 		}else{
 			//不存在跨节点  项目名称+节点名称
-			archiveName=projectName+node.getNodeName();
+			archiveName=projectName+" "+node.getNodeName();
 		}
 
 		//TODO wbs节点
@@ -514,6 +519,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 
 		builtFilePageNo(archivesAuto,waitArchiveFiles);//生成文件页码
 
+
+
 		for(ArchiveFile file:waitArchiveFiles){
 			file.setArchiveId(archivesAutoId);//设置文件所属案卷
 			file.setIsArchive(1);
@@ -1012,13 +1019,20 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 			if (archivesAutos == null || archivesAutos.size() == 0) {
 				continue;
 			}
-			String fileNumberPrefix=subList.get(0).getFileNumberPrefix();
-			String archiveNameSuffix=subList.get(0).getArchiveNameSuffix();
-			if (StringUtils.isEmpty(archiveNameSuffix)) {
-				archiveNameSuffix = "";
+			//准备节点id-节点档号前缀Map
+			Map<String,String> node_fileNumberPrefixMap= new HashMap<>();
+			for(ArchiveTreeContract node:subList){
+				node_fileNumberPrefixMap.put(node.getId().toString(),node.getFileNumberPrefix());
 			}
+
 			for (ArchivesAuto archivesAuto: archivesAutos) {
-				String fileNumber = fileNumberPrefix + index + archiveNameSuffix;
+				String nodeId1 = archivesAuto.getNodeId().toString();
+				String fileNumberPrefix ="";
+				if(node_fileNumberPrefixMap.containsKey(nodeId1)){
+					fileNumberPrefix=node_fileNumberPrefixMap.get(nodeId1);
+				}
+
+				String fileNumber = fileNumberPrefix + index;
 				if (archiveAutoPdfService.refreshFileNumber(archivesAuto,fileNumber)){
 					changeList.add(archivesAuto);
 				}
@@ -1114,12 +1128,22 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 
 		//更新
 		List<ArchiveFile> files = archiveFileClient.getAllArchiveFileByArchiveIds(strIds);
+		List<String> removeFiles = new ArrayList<>();
 		if (files != null && files.size() > 0) {
 
 			List<Long> fids = files.stream()
 					.map(ArchiveFile::getId)
 					.collect(Collectors.toList());
 			baseMapper.splitFiles(fids);
+
+			//删除打码文件
+			for (ArchiveFile file : files) {
+				//打码的也要删除
+				if (StringUtils.isNotBlank(file.getPdfPageUrl())){
+					removeFiles.add(FileUtils.getAliYunSubUrl(file.getPdfPageUrl()));
+				}
+			}
+			iossClient.removeFiles(removeFiles);
 		}
 
 		//删除案卷
@@ -1134,6 +1158,24 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 	public  boolean removeFiles(String ids) {
 		List<Long> fids = Func.toLongList(ids);
 		baseMapper.splitFiles(fids);
+
+		LambdaQueryWrapper<ArchiveFile> wrapper = Wrappers.lambdaQuery();
+		wrapper.in(ArchiveFile::getId, fids);
+
+		// 调用 listWrappers() 方法来获取符合条件的 ArchiveFile 对象列表
+		List<ArchiveFile> files = archiveFileClient.listWrappers(wrapper);
+		if (files != null && files.size() > 0) {
+			List<String> removeFiles = new ArrayList<>();
+			//删除打码文件
+			for (ArchiveFile file : files) {
+				//打码的也要删除
+				if (StringUtils.isNotBlank(file.getPdfPageUrl())){
+					removeFiles.add(FileUtils.getAliYunSubUrl(file.getPdfPageUrl()));
+				}
+			}
+			iossClient.removeFiles(removeFiles);
+		}
+
 		return true;
 	}
 
@@ -1188,7 +1230,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 			strNodeId  = nodeId.toString();
 		}
 
-		return archiveTreeContractFilter(archiveTreeContracts, treeCode, strNodeId);
+		return archiveTreeContractFilter(archiveTreeContracts, treeCode, strNodeId,contractId);
 	}
 
 	/**
@@ -1198,7 +1240,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 	 * @param nodeId 筛选条件:节点编号
 	 * @return 符合条件的档案列表
 	 */
-	public List<ArchiveTreeContract> archiveTreeContractFilter(List<ArchiveTreeContract> archiveTreeContracts, String treeCode, String nodeId) {
+	public List<ArchiveTreeContract> archiveTreeContractFilter(List<ArchiveTreeContract> archiveTreeContracts, String treeCode, String nodeId,Long contractId) {
 		List<ArchiveTreeContract> result = new ArrayList<>();
 
 		if (StringUtils.isEmpty(treeCode) && StringUtils.isEmpty(nodeId)) {
@@ -1211,7 +1253,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 					result.add(contract);
 				}
 			} else {
-				if (treeCode.equals(contract.getTreeCode())) {
+				if (treeCode.equals(contract.getTreeCode()) || contractId.toString().equals(contract.getTreeCode())) {
 					result.add(contract);
 				}
 			}

+ 18 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/utils/FileUtils.java

@@ -621,4 +621,22 @@ public class FileUtils {
         }
         return 99;
     }
+
+    public static String getSubUrl(String url, String separator) {
+        int startIndex = url.indexOf(separator) + separator.length();
+        return url.substring(startIndex);
+    }
+
+
+    public static String getAliYunSubUrl(String url) {
+        return getSubUrl(url,"aliyuncs.com/");
+    }
+
+    public static void main(String[] args) {
+        String url = "https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com/1578599210897772545/archive/ed4305eb971b062046c1ffd4e2da3c32-page1-1.pdf";
+        String url1 = "https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com/upload/ed4305eb971b062046c1ffd4e2da3c32-page1-1.pdf";
+
+        System.out.println(getAliYunSubUrl(url));
+        System.out.println(getAliYunSubUrl(url1));
+    }
 }

+ 19 - 3
blade-service/blade-business/src/main/java/org/springblade/business/controller/EVisaTaskCheckController.java

@@ -139,11 +139,14 @@ public class EVisaTaskCheckController {
 
             //获取电签配置
             List<String> list = json.getJSONArray("privatePKeyId").toJavaList(String.class);
-            Set<String> userNameFail = new HashSet<>();
+            Map<String, Set<String>> userNameFail = new HashMap<>();
             for (String nodeId : list) {
+                //获取节点信息
                 WbsTreeContract contract = wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(Long.valueOf(nodeId));
+                //获取节点下每个填报表
                 List<WbsTreeContract> node = wbsTreeContractClient.queryChildByParentId(contract,"", "");
                 List<Long> ids = new ArrayList<>();
+                //获取每个填报表对应的wbs_tree_private的id
                 for (WbsTreeContract treeContract : node) {
 //                    WbsTreePrivate wbsTreePrivate = wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(treeContract.getProjectId(), treeContract.getId());
 //                    ids.add(wbsTreePrivate.getPKeyId());
@@ -166,14 +169,27 @@ public class EVisaTaskCheckController {
                 for (JSONObject userRole : userRoleList) {
                     if (!eVisaRoleList.contains(userRole.getString("roleId"))) {
                         User user = this.userClient.userInfoById(userRole.getLong("userId")).getData();
-                        userNameFail.add(user.getRealName());
+                        InformationQuery info = informationQueryService.getInfoByWbsId(nodeId);
+                        if (userNameFail.containsKey(user.getRealName())){
+                            Set<String> set = userNameFail.get(user.getRealName());
+                            set.add(info.getName());
+                            userNameFail.put(user.getRealName(),set);
+                        }else {
+                            Set<String> set = new HashSet<>();
+                            set.add(info.getName());
+                            userNameFail.put(user.getRealName(),set);
+                        }
                     }
                 }
 
             }
             //批量提示
             if (userNameFail.size() > 0) {
-                return R.data(300, false, "所选中的用户【" + StringUtils.join(userNameFail, ",") + "】不具备当前表格所需要的签字岗位,请联系维护人员处理或更换审批人员");
+                StringBuilder stringBuilder = new StringBuilder();
+                for (String key : userNameFail.keySet()) {
+                    stringBuilder.append("所选中的用户【" +key+ "】不具备【"+ StringUtils.join(userNameFail.get(key),",")+"】表格所需要的签字岗位,请联系维护人员处理或更换审批人员");
+                }
+                return R.data(300, false, stringBuilder.toString());
             }
 
             //均满足

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

@@ -575,7 +575,7 @@ public class InformationWriteQueryController extends BladeController {
     @ApiOperation(value = "单个废除")
     public R<Boolean> abolishOne(@RequestParam String primaryKeyId, @RequestParam String classify) {
         //查询填报状态
-        InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify));
+        InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).eq(InformationQuery::getType,1));
         if (businessData != null) {
             //使用批量废除接口
             return this.batchAbolish(businessData.getId().toString(), primaryKeyId);
@@ -859,7 +859,7 @@ public class InformationWriteQueryController extends BladeController {
     @ApiOperation(value = "填报页单个上报")
     public R<Boolean> taskOne(@RequestBody StartTaskVO startTaskVO) throws IOException {
         //此时的ids是当前节点的primaryKeyId但并不是业务数据ID,需要根据ids和classify去查询具体的业务ID
-        InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, startTaskVO.getIds().replaceAll(",", "")).eq(InformationQuery::getClassify, startTaskVO.getClassify().toString()));
+        InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, startTaskVO.getIds().replaceAll(",", "")).eq(InformationQuery::getClassify, startTaskVO.getClassify().toString()).eq(InformationQuery::getType,1));
 
         //处理上报信息
         if (businessData != null) {

+ 7 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ArchiveFileClientImpl.java

@@ -208,6 +208,13 @@ public class ArchiveFileClientImpl implements ArchiveFileClient {
         return files;
     }
 
+    @Override
+    public List<ArchiveFile> getArchiveFileByArchiveID(Long archiveId) {
+        List<ArchiveFile> files = fileMapper.getArchiveFileByArchiveID(archiveId);
+        return files;
+    }
+
+
     @Override
     public List<ArchiveFile> getAllPdfFileUrlByProjectIdAndFileType(Long projectId) {
         return fileMapper.getAllPdfFileUrlByProjectIdAndFileType(projectId);

+ 5 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/InformationQueryClientImpl.java

@@ -85,4 +85,9 @@ public class InformationQueryClientImpl implements InformationQueryClient {
         iInformationQueryService.delAsyncWbsTree(contractId);
     }
 
+    @Override
+    public InformationQuery getFirstInfoByWbsId(String WbsId) {
+        return iInformationQueryService.getFirstInfoByWbsId(WbsId);
+    }
+
 }

+ 3 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.java

@@ -77,6 +77,9 @@ public interface ArchiveFileMapper extends BaseMapper<ArchiveFile> {
 
 	public List<ArchiveFile> getListByNodeID(@Param("nodeId") String nodeId);
 
+	public List<ArchiveFile> getArchiveFileByArchiveID(@Param("archiveId") Long archiveId);
+
+
 	//后续应该加入文件类型
     List<ArchiveFile> getAllPdfFileUrlByProjectIdAndFileType(@Param("projectId")Long projectId);
 }

+ 10 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.xml

@@ -328,6 +328,16 @@
           is_deleted = 0
           order by sort
     </select>
+
+    <select id="getArchiveFileByArchiveID" resultMap="archiveFileResultMap">
+        select * from u_archive_file
+        where
+            archive_id = #{archiveId}   and
+            is_deleted = 0
+        order by sort
+    </select>
+
+
     <select id="getAllPdfFileUrlByProjectIdAndFileType" resultType="org.springblade.business.entity.ArchiveFile">
         SELECT file_name,pdf_file_url
         FROM u_archive_file WHERE project_id = #{projectId}

+ 6 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/IInformationQueryService.java

@@ -138,4 +138,10 @@ public interface IInformationQueryService extends BaseService<InformationQuery>
     //删除变更节点
     void  delAsyncWbsTree(String contractId);
 
+    //根据节点获取数据
+    InformationQuery getInfoByWbsId(String wbsId);
+
+    //根据节点获取首件数据
+    InformationQuery getFirstInfoByWbsId(String wbsId);
+
 }

+ 12 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java

@@ -3,6 +3,7 @@ package org.springblade.business.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
@@ -285,6 +286,7 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
             }
 
             //修改数据
+            oldData.setPdfUrl(null);
             this.baseMapper.updateById(oldData);
 
         } else {
@@ -738,4 +740,14 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
         }
     }
 
+    @Override
+    public InformationQuery getInfoByWbsId(String wbsId) {
+        return this.getOne(new LambdaQueryWrapper<InformationQuery>().eq(InformationQuery::getWbsId,wbsId).eq(InformationQuery::getStatus,0).eq(InformationQuery::getType,1).last("limit 1"));
+    }
+
+    @Override
+    public InformationQuery getFirstInfoByWbsId(String wbsId) {
+        return this.getOne(new LambdaQueryWrapper<InformationQuery>().eq(InformationQuery::getWbsId,wbsId).eq(InformationQuery::getStatus,0).eq(InformationQuery::getType,3).last("limit 1"));
+    }
+
 }

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

@@ -331,7 +331,8 @@
         order by tree_sort asc
     </select>
     <select id="getListByProjectId" resultType="org.springblade.manager.entity.ArchiveTreeContract">
-        select id,project_id as projectId,parent_id as parentId,ancestors,node_name as nodeName,status,tree_code as treeCode, ext_type as extType, is_deleted as isDeleted,create_time as createTime
+        select id,project_id as projectId,parent_id as parentId,ancestors,node_name as nodeName,status,tree_code as treeCode, ext_type as extType,
+               is_deleted as isDeleted,create_time as createTime, file_number_prefix as fileNumberPrefix
         from m_archive_tree_contract
         where project_id=#{projectId} and is_deleted = 0 order by tree_sort asc;
     </select>

+ 19 - 17
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveAutoRuleSyncImpl.java

@@ -288,23 +288,25 @@ public class ArchiveAutoRuleSyncImpl {
                             //这个节点是刚从项目级同步过来,规则值还是项目级的。而这个archiveAutoNodeId是项目级设置的最高并卷节点的ID
                             //用archiveAutoNodeId通过proIdToContact_Map找出对应的客户级节点
                             List<ArchiveTreeContractVO2> contract_select_vo2s = proIdToContact_Map.get(archiveAutoNodeId);
-                            if(contract_select_vo2s.size()==1){
-                                //一个系统级节点对应了一个项目级节点
-                                Long pro_archiveAutoNodeId = contract_select_vo2s.get(0).getId();
-                                contractVO2.setArchiveAutoNodeId(pro_archiveAutoNodeId);//设置项目级的archiveAutoNodeId
-                                contractVO2.setFlag(1);
-                            }else{
-                                //一个系统级节点对应了多个项目级节点(项目级添加加节点的情况)
-                                for(ArchiveTreeContractVO2 contract_select_vo2:contract_select_vo2s){
-                                    //系统级对应多个节点时,用当前节点的ancestors去对比pro_select_vo2中的id,当前节点的ancestors必有上级节点的id。或当前节点id=pro_select_vo2中的id
-                                    Long contract_select_id = contract_select_vo2.getId();//客户级的最高并卷节点id
-                                    String ancestors = contractVO2.getAncestors();//当前节点ancestors
-                                    Long contractVO2_id = contractVO2.getId();//当前节点id
-
-                                    if(ancestors.contains(contract_select_id.toString()) ||  contractVO2_id.equals(contract_select_id)){
-                                        contractVO2.setArchiveAutoNodeId(contract_select_vo2.getId());//设置客户级的archiveAutoNodeId
-                                        contractVO2.setFlag(1);
-                                        break;
+                            if(contract_select_vo2s!=null){
+                                if(contract_select_vo2s.size()==1){
+                                    //一个系统级节点对应了一个项目级节点
+                                    Long pro_archiveAutoNodeId = contract_select_vo2s.get(0).getId();
+                                    contractVO2.setArchiveAutoNodeId(pro_archiveAutoNodeId);//设置项目级的archiveAutoNodeId
+                                    contractVO2.setFlag(1);
+                                }else{
+                                    //一个系统级节点对应了多个项目级节点(项目级添加加节点的情况)
+                                    for(ArchiveTreeContractVO2 contract_select_vo2:contract_select_vo2s){
+                                        //系统级对应多个节点时,用当前节点的ancestors去对比pro_select_vo2中的id,当前节点的ancestors必有上级节点的id。或当前节点id=pro_select_vo2中的id
+                                        Long contract_select_id = contract_select_vo2.getId();//客户级的最高并卷节点id
+                                        String ancestors = contractVO2.getAncestors();//当前节点ancestors
+                                        Long contractVO2_id = contractVO2.getId();//当前节点id
+
+                                        if(ancestors.contains(contract_select_id.toString()) ||  contractVO2_id.equals(contract_select_id)){
+                                            contractVO2.setArchiveAutoNodeId(contract_select_vo2.getId());//设置客户级的archiveAutoNodeId
+                                            contractVO2.setFlag(1);
+                                            break;
+                                        }
                                     }
                                 }
                             }

+ 19 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -281,6 +281,25 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
     @Override
     public List<WbsTreeContractVO6> tree8(String wbsId, String projectId, String contractId) {
         List<WbsTreeContractVO6> wbsTreeContractVOS = baseMapper.tree6(Long.parseLong(wbsId), Long.parseLong(projectId), Long.parseLong(contractId));
+
+        //进行id去重复操作,删掉id相同且oldid不为空的,用于规避哪些错误配置的数据
+        Map<Long, WbsTreeContractVO6> map = new LinkedHashMap<>(); // 创建一个Map用于存储已出现过的元素
+
+        for (WbsTreeContractVO6 vo : wbsTreeContractVOS) {
+            if (vo.getOldId() != null && map.containsKey(vo.getId())) {
+                // 当oldId不为空且id已经存在于map中时,替换原有的元素
+                map.replace(vo.getId(), vo);
+            } else {
+                // 否则将该元素加入到map中
+                map.put(vo.getId(), vo);
+            }
+        }
+
+        // 将去重后的元素重新放入原有的链表中
+        wbsTreeContractVOS.clear();
+        wbsTreeContractVOS.addAll(map.values());
+
+
         List<WbsTreeContractVO6> wbsTreeVO2s = ForestNodeMerger.merge(wbsTreeContractVOS);
         List<WbsTreeContractVO6> list = wbsTreeVO2s.stream().filter(f -> f.getParentId() == 0L).collect(Collectors.toList());
         return list;

+ 7 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -673,7 +673,12 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     org.springblade.manager.entity.TableInfo table = tableInfoService.getBaseMapper().selectById(wbsTreePrivate.getInitTableId());
                     if (ObjectUtil.isNotEmpty(table)) {
                         //获取首件记录ID
-                        String firstId = tableInfoList.get(0).getFirstId();
+//                        String firstId = tableInfoList.get(0).getFirstId();
+                        String firstId = "";
+                        InformationQuery firstInfoByWbsId = informationQueryClient.getFirstInfoByWbsId(firstNodeId);
+                        if (firstInfoByWbsId != null){
+                            firstId = firstInfoByWbsId.getId() + "";
+                        }
                         if (StringUtils.isNotEmpty(firstId)) {
                             //删除掉旧数据
                             this.jdbcTemplate.execute("DELETE FROM " + table.getTabEnName() + " WHERE group_id = " + firstId);
@@ -682,7 +687,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                         }
 
                         //获取上传的文件相关
-                        String sourceUrl = tableInfoList.get(0).getSourceUrl(),
+                            String sourceUrl = tableInfoList.get(0).getSourceUrl(),
                                 pdfUrl = tableInfoList.get(0).getPdfUrl(),
                                 firstFileName = tableInfoList.get(0).getFirstFileName();
 

+ 52 - 50
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -1542,63 +1542,65 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
         }
 
         List<Long> longs = Func.toLongList(primaryKeyIds);
-        for (Long id : longs) {
-            //获取添加的表信息
-            TableInfo tableInfo = tableInfoService.getById(id);
-            WbsTreePrivate wbsPrivate = new WbsTreePrivate();
-            Long pKeyId1 = SnowFlakeUtil.getId();
-            wbsPrivate.setPKeyId(pKeyId1);
-            //查询wbs_tree_contract当前项目下是否已存在相同表
-            WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(new LambdaQueryWrapper<WbsTreePrivate>()
-                    .eq(WbsTreePrivate::getProjectId, projectId)
-                    .eq(WbsTreePrivate::getInitTableName, tableInfo.getTabEnName())
-                    .orderByDesc(WbsTreePrivate::getUpdateTime)
-                    .last("limit 1"));
-            //如果存在则复制最新表的配置,调整表单的值
-            if (wbsTreePrivate != null) {
-
-                if (wbsTreePrivate.getExcelId() != null) {
-                    if (StringUtils.isNotEmpty(wbsTreePrivate.getExcelId() + "")) {
-                        wbsPrivate.setExcelId(wbsTreePrivate.getExcelId());
-                    }
-                    if (StringUtils.isNotEmpty(wbsTreePrivate.getHtmlUrl())) {
-                        //复制生成html
-                        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-                        File file_in = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
+        if (longs != null && longs.size() > 0) {
+            for (Long id : longs) {
+                //获取添加的表信息
+                TableInfo tableInfo = tableInfoService.getById(id);
+                WbsTreePrivate wbsPrivate = new WbsTreePrivate();
+                Long pKeyId1 = SnowFlakeUtil.getId();
+                wbsPrivate.setPKeyId(pKeyId1);
+                //查询wbs_tree_contract当前项目下是否已存在相同表
+                WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(new LambdaQueryWrapper<WbsTreePrivate>()
+                        .eq(WbsTreePrivate::getProjectId, projectId)
+                        .eq(WbsTreePrivate::getInitTableName, tableInfo.getTabEnName())
+                        .orderByDesc(WbsTreePrivate::getUpdateTime)
+                        .last("limit 1"));
+                //如果存在则复制最新表的配置,调整表单的值
+                if (wbsTreePrivate != null) {
+
+                    if (wbsTreePrivate.getExcelId() != null) {
+                        if (StringUtils.isNotEmpty(wbsTreePrivate.getExcelId() + "")) {
+                            wbsPrivate.setExcelId(wbsTreePrivate.getExcelId());
+                        }
+                        if (StringUtils.isNotEmpty(wbsTreePrivate.getHtmlUrl())) {
+                            //复制生成html
+                            String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+                            File file_in = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
 //                    File file_in = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1636553444422582272.html");
-                        String filecode = SnowFlakeUtil.getId() + "";
-                        String thmlUrl = file_path + "/privateUrl/" + filecode + ".html";
+                            String filecode = SnowFlakeUtil.getId() + "";
+                            String thmlUrl = file_path + "/privateUrl/" + filecode + ".html";
 //                    String thmlUrl =  "C:\\Users\\泓创研发01\\Desktop\\privateUrl\\9527.html";
-                        File file_out = ResourceUtil.getFile(thmlUrl);
-                        FileUtil.copy(file_in, file_out);
-                        wbsPrivate.setHtmlUrl(thmlUrl);
-                    }
-                    List<TextdictInfo> list = textDictInfoService.list(new LambdaQueryWrapper<TextdictInfo>()
-                            .eq(TextdictInfo::getTabId, wbsTreePrivate.getPKeyId()));
-                    if (list.size() >= 0) {
-                        list.stream().forEach(l -> {
-                            l.setId(SnowFlakeUtil.getId());
-                            l.setTabId(wbsPrivate.getPKeyId().toString());
-                        });
-                        textDictInfoService.saveBatch(list);
+                            File file_out = ResourceUtil.getFile(thmlUrl);
+                            FileUtil.copy(file_in, file_out);
+                            wbsPrivate.setHtmlUrl(thmlUrl);
+                        }
+                        List<TextdictInfo> list = textDictInfoService.list(new LambdaQueryWrapper<TextdictInfo>()
+                                .eq(TextdictInfo::getTabId, wbsTreePrivate.getPKeyId()));
+                        if (list.size() >= 0) {
+                            list.stream().forEach(l -> {
+                                l.setId(SnowFlakeUtil.getId());
+                                l.setTabId(wbsPrivate.getPKeyId().toString());
+                            });
+                            textDictInfoService.saveBatch(list);
+                        }
                     }
-                }
 
-                wbsPrivate.setTableOwner(tableInfo.getTableOwner());
-                wbsPrivate.setInitTableId(tableInfo.getId() + "");
-                wbsPrivate.setTableType(tableInfo.getTabType());
-                wbsPrivate.setInitTableName(tableInfo.getTabEnName());
-                wbsPrivate.setNodeName(tableInfo.getTabChName());
-                wbsPrivate.setFullName(tableInfo.getTabChName());
-                wbsPrivate.setFillRate(tableInfo.getFillRate());
-                wbsPrivate.setProjectId(projectId);
-                wbsPrivate.setType(10);//带过来的元素信息
-                wbsPrivate.setParentId(-10L);
-                wbsPrivate.setStatus(1);
-                wbsTreePrivateMapper.insert(wbsPrivate);
+                    wbsPrivate.setTableOwner(tableInfo.getTableOwner());
+                    wbsPrivate.setInitTableId(tableInfo.getId() + "");
+                    wbsPrivate.setTableType(tableInfo.getTabType());
+                    wbsPrivate.setInitTableName(tableInfo.getTabEnName());
+                    wbsPrivate.setNodeName(tableInfo.getTabChName());
+                    wbsPrivate.setFullName(tableInfo.getTabChName());
+                    wbsPrivate.setFillRate(tableInfo.getFillRate());
+                    wbsPrivate.setProjectId(projectId);
+                    wbsPrivate.setType(10);//带过来的元素信息
+                    wbsPrivate.setParentId(-10L);
+                    wbsPrivate.setStatus(1);
+                    wbsTreePrivateMapper.insert(wbsPrivate);
            /* }else{
                 return R.success("没有查到主库信息");
             }*/
+                }
             }
             return R.success("添加成功");
         }