|
@@ -58,11 +58,16 @@ import org.springblade.manager.feign.ProjectClient;
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
import org.springblade.system.entity.DictBiz;
|
|
import org.springblade.system.entity.DictBiz;
|
|
import org.springblade.system.feign.IDictBizClient;
|
|
import org.springblade.system.feign.IDictBizClient;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
|
+import org.springframework.scheduling.annotation.EnableAsync;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
|
+import java.util.concurrent.Executors;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -81,6 +86,9 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
private ContractClient contractClient;
|
|
private ContractClient contractClient;
|
|
private ProjectClient projectClient;
|
|
private ProjectClient projectClient;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExecutorService executorService;
|
|
|
|
+
|
|
private Map<String,Integer> indexMap = new HashMap<>(); //按立卷位区分和生成流水号
|
|
private Map<String,Integer> indexMap = new HashMap<>(); //按立卷位区分和生成流水号
|
|
private IArchiveAutoPdfService archiveAutoPdfService;
|
|
private IArchiveAutoPdfService archiveAutoPdfService;
|
|
private final NewIOSSClient iossClient;
|
|
private final NewIOSSClient iossClient;
|
|
@@ -233,6 +241,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
List<Map<String,String>> list = baseMapper.getAllArchiveAgeByContractType(projectId);
|
|
List<Map<String,String>> list = baseMapper.getAllArchiveAgeByContractType(projectId);
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void splitArchvies(Long projectId){
|
|
public void splitArchvies(Long projectId){
|
|
List<String> removeFiles = new ArrayList<>();
|
|
List<String> removeFiles = new ArrayList<>();
|
|
@@ -242,7 +251,9 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
for(String outUrl:archivesOutUrlList){
|
|
for(String outUrl:archivesOutUrlList){
|
|
String[] splits = outUrl.split(",");
|
|
String[] splits = outUrl.split(",");
|
|
for(String url:splits){
|
|
for(String url:splits){
|
|
- removeFiles.add(FileUtils.getAliYunSubUrl(url));
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(url.trim())){
|
|
|
|
+ removeFiles.add(FileUtils.getAliYunSubUrl(url));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -250,13 +261,15 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
List<String> filePageUrlList = baseMapper.getFilePageUrlList(projectId);
|
|
List<String> filePageUrlList = baseMapper.getFilePageUrlList(projectId);
|
|
if(filePageUrlList!=null && filePageUrlList.size()>0){
|
|
if(filePageUrlList!=null && filePageUrlList.size()>0){
|
|
for(String url:filePageUrlList){
|
|
for(String url:filePageUrlList){
|
|
- removeFiles.add(FileUtils.getAliYunSubUrl(url));
|
|
|
|
|
|
+ if(StringUtils.isNotEmpty(url.trim())){
|
|
|
|
+ removeFiles.add(FileUtils.getAliYunSubUrl(url));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- iossClient.removeFiles(removeFiles);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ executorService.execute(()->{
|
|
|
|
+ iossClient.removeFiles(removeFiles);
|
|
|
|
+ log.debug("文件删完了");
|
|
|
|
+ });
|
|
//取消未锁定案卷文件关联
|
|
//取消未锁定案卷文件关联
|
|
baseMapper.splitArchvies(projectId);
|
|
baseMapper.splitArchvies(projectId);
|
|
|
|
|
|
@@ -289,7 +302,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
//步骤四:按照单独,分类,默认,分盒的顺序执行组卷流程。
|
|
//步骤四:按照单独,分类,默认,分盒的顺序执行组卷流程。
|
|
|
|
|
|
//分盒文件集合
|
|
//分盒文件集合
|
|
- Map<Integer,List<ArchiveFile>> boxMap = new LinkedHashMap<>();
|
|
|
|
|
|
+ Map<String,List<ArchiveFile>> boxMap = new LinkedHashMap<>();
|
|
|
|
|
|
archiveAutoMethod3(list3,boxMap);//单独组卷
|
|
archiveAutoMethod3(list3,boxMap);//单独组卷
|
|
archiveAutoMethod2(list2,projectId,boxMap);//分类组卷
|
|
archiveAutoMethod2(list2,projectId,boxMap);//分类组卷
|
|
@@ -297,16 +310,16 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
archiveAutoMethodBox(boxMap);//分盒组卷
|
|
archiveAutoMethodBox(boxMap);//分盒组卷
|
|
}
|
|
}
|
|
|
|
|
|
- private void addBoxMap(ArchiveFile file,Map<Integer,List<ArchiveFile>> boxMap){
|
|
|
|
- Integer boxNumber = file.getBoxNumber();
|
|
|
|
- if(boxMap.containsKey(boxNumber)){
|
|
|
|
- List<ArchiveFile> boxFiles = boxMap.get(boxNumber);
|
|
|
|
|
|
+ private void addBoxMap(ArchiveFile file,Map<String,List<ArchiveFile>> boxMap){
|
|
|
|
+ String boxName = file.getBoxName();
|
|
|
|
+ if(boxMap.containsKey(boxName)){
|
|
|
|
+ List<ArchiveFile> boxFiles = boxMap.get(boxName);
|
|
boxFiles.add(file);
|
|
boxFiles.add(file);
|
|
- boxMap.put(boxNumber,boxFiles);
|
|
|
|
|
|
+ boxMap.put(boxName,boxFiles);
|
|
}else{
|
|
}else{
|
|
List<ArchiveFile> boxFiles = new ArrayList<>();
|
|
List<ArchiveFile> boxFiles = new ArrayList<>();
|
|
boxFiles.add(file);
|
|
boxFiles.add(file);
|
|
- boxMap.put(boxNumber,boxFiles);
|
|
|
|
|
|
+ boxMap.put(boxName,boxFiles);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -399,6 +412,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
indexMap=new HashMap<>(); //监理,施工的按合同段分类从0开始依次设置档号,建设单位的没有合同段 就先按一类依次设置
|
|
indexMap=new HashMap<>(); //监理,施工的按合同段分类从0开始依次设置档号,建设单位的没有合同段 就先按一类依次设置
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ ContractInfo nodeContract=null;
|
|
|
|
+ List<ContractInfo> contracts =null;
|
|
//获取立卷单位
|
|
//获取立卷单位
|
|
String unit="";
|
|
String unit="";
|
|
String treeCode = node.getTreeCode();
|
|
String treeCode = node.getTreeCode();
|
|
@@ -439,8 +454,65 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
archivesAuto.setSpecification(node.getSpecification());//案卷规格 从节点规格获取
|
|
archivesAuto.setSpecification(node.getSpecification());//案卷规格 从节点规格获取
|
|
//archivesAuto.setStartDate(LocalDateTime.parse(startDate));//文件开始时间
|
|
//archivesAuto.setStartDate(LocalDateTime.parse(startDate));//文件开始时间
|
|
//archivesAuto.setEndDate(LocalDateTime.parse(endDate));//文件结束时间
|
|
//archivesAuto.setEndDate(LocalDateTime.parse(endDate));//文件结束时间
|
|
- archivesAuto.setStorageTime(node.getStorageTime());//保管期限 从节点规格获取
|
|
|
|
- archivesAuto.setSecretLevel("");//保密级别 没地方设置 暂留
|
|
|
|
|
|
+
|
|
|
|
+ //TODO 保管期限
|
|
|
|
+ String storageTime = node.getStorageTime();
|
|
|
|
+ if(StringUtils.isEmpty(storageTime)){
|
|
|
|
+ //节点没有值,就从合同段获取,没有合同段id的 用业主的合同段
|
|
|
|
+ Long nodeContractId = archivesAuto.getContractId();
|
|
|
|
+ if(nodeContractId!=null){
|
|
|
|
+ if(nodeContract==null){
|
|
|
|
+ nodeContract = contractClient.getContractById(nodeContractId);
|
|
|
|
+ }
|
|
|
|
+ storageTime = nodeContract.getStoragePeriod().toString();
|
|
|
|
+ }else{
|
|
|
|
+ List<Long> pids= new ArrayList<>();
|
|
|
|
+ pids.add(archivesAuto.getProjectId());
|
|
|
|
+ if(contracts==null){
|
|
|
|
+ contracts = contractClient.queryContractListByIds(pids);
|
|
|
|
+ }
|
|
|
|
+ for(ContractInfo c:contracts){
|
|
|
|
+ if(c.getContractType()==3){
|
|
|
|
+ storageTime = c.getStoragePeriod().toString();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ archivesAuto.setStorageTime(storageTime);//保管期限 从节点规格获取
|
|
|
|
+
|
|
|
|
+ //保密级别 没地方设置 暂留
|
|
|
|
+ String secretLevel="";
|
|
|
|
+ if(StringUtils.isEmpty(secretLevel)){
|
|
|
|
+ //节点没有值,就从合同段获取,没有合同段id的 用业主的合同段
|
|
|
|
+ Long nodeContractId = archivesAuto.getContractId();
|
|
|
|
+ if(nodeContractId!=null){
|
|
|
|
+ if(nodeContract==null){
|
|
|
|
+ nodeContract = contractClient.getContractById(nodeContractId);
|
|
|
|
+ }
|
|
|
|
+ secretLevel = nodeContract.getSecurityLevel().toString();
|
|
|
|
+ }else{
|
|
|
|
+ List<Long> pids= new ArrayList<>();
|
|
|
|
+ pids.add(archivesAuto.getProjectId());
|
|
|
|
+ if(contracts==null){
|
|
|
|
+ contracts = contractClient.queryContractListByIds(pids);
|
|
|
|
+ }
|
|
|
|
+ for(ContractInfo c:contracts){
|
|
|
|
+ if(c.getContractType()==3){
|
|
|
|
+ secretLevel = c.getSecurityLevel().toString();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ archivesAuto.setSecretLevel(secretLevel);
|
|
|
|
+
|
|
|
|
+ //立卷人 从节点规格获取
|
|
|
|
+ String rollor = node.getRollor();
|
|
|
|
+ archivesAuto.setRollor(node.getRollor());
|
|
|
|
+
|
|
|
|
+ //审核人 从节点规格获取
|
|
|
|
+ String reviewer = node.getReviewer();
|
|
|
|
+ archivesAuto.setReviewer(node.getReviewer());
|
|
|
|
+
|
|
//载体类型
|
|
//载体类型
|
|
if (node.getStorageType()!= null){
|
|
if (node.getStorageType()!= null){
|
|
archivesAuto.setCarrierType(node.getStorageType().toString());
|
|
archivesAuto.setCarrierType(node.getStorageType().toString());
|
|
@@ -450,8 +522,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
archivesAuto.setIsArchive(1);//已归档
|
|
archivesAuto.setIsArchive(1);//已归档
|
|
//archivesAuto.setRemark();//备注
|
|
//archivesAuto.setRemark();//备注
|
|
archivesAuto.setRollDate(LocalDateTime.now());//立卷日期
|
|
archivesAuto.setRollDate(LocalDateTime.now());//立卷日期
|
|
- archivesAuto.setRollor(node.getRollor());//立卷人 从节点规格获取
|
|
|
|
- archivesAuto.setReviewer(node.getReviewer());//审核人 从节点规格获取
|
|
|
|
|
|
+
|
|
archivesAuto.setNodeId(node.getId());//归档树节点
|
|
archivesAuto.setNodeId(node.getId());//归档树节点
|
|
archivesAuto.setOutUrl("");//TODO 生成案卷的封面 目录 备考表,背级
|
|
archivesAuto.setOutUrl("");//TODO 生成案卷的封面 目录 备考表,背级
|
|
archivesAuto.setFileN(fileN);//文件数量
|
|
archivesAuto.setFileN(fileN);//文件数量
|
|
@@ -466,6 +537,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
archivesAuto.setIsLock(0);//案卷锁定状态
|
|
archivesAuto.setIsLock(0);//案卷锁定状态
|
|
archivesAuto.setIsDeleted(0);
|
|
archivesAuto.setIsDeleted(0);
|
|
baseMapper.insert(archivesAuto);
|
|
baseMapper.insert(archivesAuto);
|
|
|
|
+ log.debug("组好"+archivesAuto.getName());
|
|
return archivesAuto;
|
|
return archivesAuto;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -641,7 +713,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
archiveFileClient.updateArchiveFileForCreateArchive(waitArchiveFiles);
|
|
archiveFileClient.updateArchiveFileForCreateArchive(waitArchiveFiles);
|
|
}
|
|
}
|
|
|
|
|
|
- private void createArchiveBox(List<ArchiveFile> waitArchiveFiles){
|
|
|
|
|
|
+ private void createArchiveBox(String boxName,List<ArchiveFile> waitArchiveFiles){
|
|
|
|
|
|
if(waitArchiveFiles.size()==0){
|
|
if(waitArchiveFiles.size()==0){
|
|
return;
|
|
return;
|
|
@@ -666,10 +738,10 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
|
|
|
//默认组卷存在跨节点组卷 注意案卷归属节点,案卷命名方式
|
|
//默认组卷存在跨节点组卷 注意案卷归属节点,案卷命名方式
|
|
//获取案卷题名
|
|
//获取案卷题名
|
|
- String archiveName=builtArchiveName(waitArchiveFiles,node,false);//获取案卷题名
|
|
|
|
|
|
+ //String archiveName=builtArchiveName(waitArchiveFiles,node,false);//获取案卷题名
|
|
|
|
|
|
//1.创建新案卷
|
|
//1.创建新案卷
|
|
- ArchivesAuto archivesAuto = builtArchives(node,pageN,fileN,startDate,endDate,archiveName);
|
|
|
|
|
|
+ ArchivesAuto archivesAuto = builtArchives(node,pageN,fileN,startDate,endDate,boxName);
|
|
|
|
|
|
//2.封面和生成文件页码
|
|
//2.封面和生成文件页码
|
|
archiveAutoPdfService.buildArchiveFrontPdfs(archivesAuto.getProjectId(),archivesAuto,waitArchiveFiles);
|
|
archiveAutoPdfService.buildArchiveFrontPdfs(archivesAuto.getProjectId(),archivesAuto,waitArchiveFiles);
|
|
@@ -689,7 +761,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
/**
|
|
/**
|
|
* 单租组卷流程 节点下的文件只在当前节点下组卷
|
|
* 单租组卷流程 节点下的文件只在当前节点下组卷
|
|
*/
|
|
*/
|
|
- private void archiveAutoMethod3(List<ArchiveTreeContract> list,Map<Integer,List<ArchiveFile>> boxMap){
|
|
|
|
|
|
+ private void archiveAutoMethod3(List<ArchiveTreeContract> list,Map<String,List<ArchiveFile>> boxMap){
|
|
//步骤1:遍历节点集合
|
|
//步骤1:遍历节点集合
|
|
for(ArchiveTreeContract node:list){
|
|
for(ArchiveTreeContract node:list){
|
|
//步骤2:获取当前节点的案卷规格
|
|
//步骤2:获取当前节点的案卷规格
|
|
@@ -783,7 +855,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
/**
|
|
/**
|
|
* 分类并卷组卷 设置分类的节点下只有一个案卷,节点下的所有文件都组成这个案卷。如果设置分类节点(select=1的)多个,案卷归属排序第一个节点。
|
|
* 分类并卷组卷 设置分类的节点下只有一个案卷,节点下的所有文件都组成这个案卷。如果设置分类节点(select=1的)多个,案卷归属排序第一个节点。
|
|
*/
|
|
*/
|
|
- private void archiveAutoMethod2(List<ArchiveTreeContract> list,Long projectId,Map<Integer,List<ArchiveFile>> boxMap){
|
|
|
|
|
|
+ private void archiveAutoMethod2(List<ArchiveTreeContract> list,Long projectId,Map<String,List<ArchiveFile>> boxMap){
|
|
|
|
|
|
//分类并卷集合<groupId,List<文件>>
|
|
//分类并卷集合<groupId,List<文件>>
|
|
Map<Long,List<ArchiveFile>> archiveMap = new HashMap<>();
|
|
Map<Long,List<ArchiveFile>> archiveMap = new HashMap<>();
|
|
@@ -834,7 +906,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
/**
|
|
/**
|
|
* 默认组卷流程 文件可以跨节点组卷,受最高并卷节点限制范围,跨节点文件组卷时,案卷规格按照第一个文件所在的节点规格 组卷。
|
|
* 默认组卷流程 文件可以跨节点组卷,受最高并卷节点限制范围,跨节点文件组卷时,案卷规格按照第一个文件所在的节点规格 组卷。
|
|
*/
|
|
*/
|
|
- private void archiveAutoMethod1(List<ArchiveTreeContract> list,Map<Integer,List<ArchiveFile>> boxMap){
|
|
|
|
|
|
+ private void archiveAutoMethod1(List<ArchiveTreeContract> list,Map<String,List<ArchiveFile>> boxMap){
|
|
//最高并卷节点
|
|
//最高并卷节点
|
|
Long archiveAutoNodeId=null;
|
|
Long archiveAutoNodeId=null;
|
|
|
|
|
|
@@ -974,11 +1046,11 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
* 分盒组卷流程
|
|
* 分盒组卷流程
|
|
* @param boxMap
|
|
* @param boxMap
|
|
*/
|
|
*/
|
|
- private void archiveAutoMethodBox(Map<Integer,List<ArchiveFile>> boxMap){
|
|
|
|
- Set<Map.Entry<Integer, List<ArchiveFile>>> entries = boxMap.entrySet();
|
|
|
|
- for (Map.Entry<Integer, List<ArchiveFile>> entry:entries){
|
|
|
|
|
|
+ private void archiveAutoMethodBox(Map<String,List<ArchiveFile>> boxMap){
|
|
|
|
+ Set<Map.Entry<String, List<ArchiveFile>>> entries = boxMap.entrySet();
|
|
|
|
+ for (Map.Entry<String, List<ArchiveFile>> entry:entries){
|
|
//一个分盒一个案卷 归属第一个文件所在节点
|
|
//一个分盒一个案卷 归属第一个文件所在节点
|
|
- createArchiveBox(entry.getValue());
|
|
|
|
|
|
+ createArchiveBox(entry.getKey(),entry.getValue());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1058,6 +1130,23 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
String fileNumberPrefix ="";
|
|
String fileNumberPrefix ="";
|
|
if(node_fileNumberPrefixMap.containsKey(nodeId1)){
|
|
if(node_fileNumberPrefixMap.containsKey(nodeId1)){
|
|
fileNumberPrefix=node_fileNumberPrefixMap.get(nodeId1);
|
|
fileNumberPrefix=node_fileNumberPrefixMap.get(nodeId1);
|
|
|
|
+ if(StringUtils.isEmpty(fileNumberPrefix)){
|
|
|
|
+ //节点没有值,就从合同段获取,没有合同段id的 用业主的合同段
|
|
|
|
+ Long nodeContractId = archivesAuto.getContractId();
|
|
|
|
+ if(nodeContractId!=null){
|
|
|
|
+ ContractInfo nodeContract = contractClient.getContractById(nodeContractId);
|
|
|
|
+ fileNumberPrefix = nodeContract.getPrefix();
|
|
|
|
+ }else{
|
|
|
|
+ List<Long> pids= new ArrayList<>();
|
|
|
|
+ pids.add(archivesAuto.getProjectId());
|
|
|
|
+ List<ContractInfo> contracts = contractClient.queryContractListByIds(pids);
|
|
|
|
+ for(ContractInfo c:contracts){
|
|
|
|
+ if(c.getContractType()==3){
|
|
|
|
+ fileNumberPrefix = c.getPrefix();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
String fileNumber = fileNumberPrefix + index;
|
|
String fileNumber = fileNumberPrefix + index;
|