Browse Source

Merge branch 'lk20230510'

luok 1 year ago
parent
commit
bd16adb600

+ 2 - 2
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ArchiveTreeContractClient.java

@@ -30,8 +30,8 @@ public interface ArchiveTreeContractClient {
     @PostMapping(API_PREFIX + "/getListByProjectId")
     List<ArchiveTreeContract> getListByProjectId(@RequestParam Long projectId);
 
-    @PostMapping(API_PREFIX + "/getSelectNodeByGroupId")
-    List<ArchiveTreeContract> getSelectNodeByGroupId(@RequestParam Long projectId,@RequestParam Long archiveAutoGroupId);
+    @PostMapping(API_PREFIX + "/getStorageNodeByGroupId")
+    List<ArchiveTreeContract> getStorageNodeByGroupId(@RequestParam Long projectId,@RequestParam Long archiveAutoGroupId);
 
     @PostMapping(API_PREFIX + "/getArchiveTreeContractById")
     ArchiveTreeContract getArchiveTreeContractById(@RequestParam Long id);

+ 24 - 17
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchivesAutoController.java

@@ -326,25 +326,32 @@ public class ArchivesAutoController extends BladeController {
 	 */
 	@PostMapping("/archiveAutoMethod")
 	public R archiveAutoMethod(Long projectId,Long contractId,Long nodeId) {
-		//先验证当前项目是否在自动组卷中,组卷中直接返回
-		ProjectInfo projectInfo = projectClient.getById(String.valueOf(projectId));
-		Integer isArchivesAuto = projectInfo.getIsArchivesAuto();
-		if(isArchivesAuto!=null && isArchivesAuto==1){
-			return R.fail("当前项目已经在自动组卷中");
+		try{
+			//先验证当前项目是否在自动组卷中,组卷中直接返回
+			ProjectInfo projectInfo = projectClient.getById(String.valueOf(projectId));
+			Integer isArchivesAuto = projectInfo.getIsArchivesAuto();
+			if(isArchivesAuto!=null && isArchivesAuto==1){
+				return R.fail("当前项目已经在自动组卷中");
+			}
+			//设置自动组卷中
+			projectClient.updateIsArchivesAutoById(projectId,1);
+
+			//将项目未锁定案卷拆卷
+			archivesAutoService.splitArchvies(projectId);
+			//项目自动组卷入口
+			archivesAutoService.archiveAutoMethod(projectId);
+			//刷新项目档号
+			archivesAutoService.refreshFileNumberNoSlipt(projectId,contractId,nodeId);
+
+			return R.data("自动组卷结束");
+		}catch (Exception e){
+			e.printStackTrace();
+			return R.fail(e.getMessage());
+		}finally {
+			//设置自动组卷结束
+			projectClient.updateIsArchivesAutoById(projectId,0);
 		}
-		//设置自动组卷中
-		projectClient.updateIsArchivesAutoById(projectId,1);
-
-		//将项目未锁定案卷拆卷
-		archivesAutoService.splitArchvies(projectId);
-		//项目自动组卷入口
-		archivesAutoService.archiveAutoMethod(projectId);
-		//刷新项目档号
-		archivesAutoService.refreshFileNumberNoSlipt(projectId,contractId,nodeId);
 
-		//设置自动组卷结束
-		projectClient.updateIsArchivesAutoById(projectId,0);
-		return R.data("自动组卷结束");
 	}
 
 	/**

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

@@ -532,8 +532,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 
 		String archiveStartDateAndEndDate = getArchiveStartDateAndEndDate(waitArchiveFiles);
 		String[] split = archiveStartDateAndEndDate.split(",");
-		String startDate=split[0];
-		String endDate=split[1];
+		String startDate= split.length>=1 ?split[0]:"";
+		String endDate=split.length>=2 ?split[1]:"";
 		int fileN =waitArchiveFiles.size();
 
 		String archiveName=builtArchiveName(waitArchiveFiles,node,false);//获取案卷题名
@@ -565,14 +565,14 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 	private void createArchive2(List<ArchiveFile> waitArchiveFiles, Long archiveAutoGroupId,Long projectId){
 
 		//获取同一分类archiveAutoGroupId下设置的(设置规则时选中的)节点,排好序
-		List<ArchiveTreeContract> selectList=archiveTreeContractClient.getSelectNodeByGroupId(projectId,archiveAutoGroupId);
-		//分类并卷节点默认采用设置节点的第一个节点为案卷归属节点。
+		List<ArchiveTreeContract> selectList=archiveTreeContractClient.getStorageNodeByGroupId(projectId,archiveAutoGroupId);
+		//分类并卷节点默认采用同类型下第一个存储节点为归属节点
 		ArchiveTreeContract node = selectList.get(0);
 		//获取案卷文件起止时间
 		String archiveStartDateAndEndDate = getArchiveStartDateAndEndDate(waitArchiveFiles);
 		String[] split = archiveStartDateAndEndDate.split(",");
-		String startDate=split[0];
-		String endDate=split[1];
+		String startDate= split.length>=1 ?split[0]:"";
+		String endDate=split.length>=2 ?split[1]:"";
 		int fileN =waitArchiveFiles.size();
 		//获取案卷内文件总页数
 		int pageN=0;
@@ -610,8 +610,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		//获取案卷文件起止时间
 		String archiveStartDateAndEndDate = getArchiveStartDateAndEndDate(waitArchiveFiles);
 		String[] split = archiveStartDateAndEndDate.split(",");
-		String startDate=split[0];
-		String endDate=split[1];
+		String startDate= split.length>=1 ?split[0]:"";
+		String endDate=split.length>=2 ?split[1]:"";
 		int fileN =waitArchiveFiles.size();
 
 
@@ -654,8 +654,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
 		//获取案卷文件起止时间
 		String archiveStartDateAndEndDate = getArchiveStartDateAndEndDate(waitArchiveFiles);
 		String[] split = archiveStartDateAndEndDate.split(",");
-		String startDate=split[0];
-		String endDate=split[1];
+		String startDate= split.length>=1 ?split[0]:"";
+		String endDate=split.length>=2 ?split[1]:"";
 		int fileN =waitArchiveFiles.size();
 		//获取案卷内文件总页数
 		int pageN=0;

+ 2 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ArchiveTreeContractImpl.java

@@ -55,8 +55,8 @@ public class ArchiveTreeContractImpl implements ArchiveTreeContractClient {
     }
 
     @Override
-    public List<ArchiveTreeContract> getSelectNodeByGroupId(Long projectId,Long archiveAutoGroupId) {
-        List<ArchiveTreeContract> list = archiveTreeContractMapper.getSelectNodeByGroupId(projectId,archiveAutoGroupId);
+    public List<ArchiveTreeContract> getStorageNodeByGroupId(Long projectId,Long archiveAutoGroupId) {
+        List<ArchiveTreeContract> list = archiveTreeContractMapper.getStorageNodeByGroupId(projectId,archiveAutoGroupId);
         archiveTreeContractService.fillDefaultArchiveAutoInfo(list);
         return list;
     }

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

@@ -74,7 +74,7 @@ public interface ArchiveTreeContractMapper extends BaseMapper<ArchiveTreeContrac
 
 	List<ArchiveTreeContract> getListByProjectId(@Param("projectId")Long projectId);
 
-	List<ArchiveTreeContract> getSelectNodeByGroupId(@Param("projectId") Long projectId,@Param("archiveAutoGroupId") Long archiveAutoGroupId);
+	List<ArchiveTreeContract> getStorageNodeByGroupId(@Param("projectId") Long projectId,@Param("archiveAutoGroupId") Long archiveAutoGroupId);
 
 	@MapKey("id")
 	List<Map<String, Object>> getArchiveTreeAndArchiveCount(@Param("projectId") Long projectId,@Param("nodeId") Long nodeId);

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

@@ -338,7 +338,7 @@
     </select>
 
 
-    <select id="getSelectNodeByGroupId" resultMap="archiveTreeContractResultMap">
+    <select id="getStorageNodeByGroupId" resultMap="archiveTreeContractResultMap">
         SELECT
             *
         FROM
@@ -348,7 +348,7 @@
           AND project_id = #{projectId}
           AND is_deleted = 0
           AND archive_auto_type =2
-          AND archive_auto_group_select =1
+          AND is_storage_node =1
           AND archive_auto_group_id =#{archiveAutoGroupId}
         order by tree_sort asc
     </select>