|
@@ -144,6 +144,10 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
private final ArchiveConclusionMapper conclusionMapper;
|
|
|
|
|
|
private final NewIOSSClient newIOSSClient;
|
|
|
+
|
|
|
+
|
|
|
+ private final ITraceLogService iTraceLogService;
|
|
|
+
|
|
|
//表格高度
|
|
|
private static int high = 20;
|
|
|
//表格宽度
|
|
@@ -701,7 +705,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void archiveAutoMethod(Long projectId, Long contractId, Long nodeId) {
|
|
|
+ public void archiveAutoMethod(Long projectId, Long contractId, Long nodeId, Long traceId) {
|
|
|
//步骤一:把档号集合初始化
|
|
|
indexMap = new HashMap<>();
|
|
|
//步list = {ArrayList@18238} size = 19骤二:查询归档树节点。存在未归档文件的节点。
|
|
@@ -747,19 +751,19 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
Map<String,List<ArchiveFile>> boxMap = new LinkedHashMap<>();
|
|
|
Map<Long,String> boxFileMap = new LinkedHashMap<>();
|
|
|
|
|
|
- archiveAutoMethod3(list3,boxMap,boxFileMap);//单独组卷
|
|
|
+ archiveAutoMethod3(list3,boxMap,boxFileMap,traceId);//单独组卷
|
|
|
//设置完成度30%
|
|
|
projectClient.updateIsArchivesAutoById(projectId,30);
|
|
|
- archiveAutoMethod2(list2,projectId,boxMap,boxFileMap);//分类组卷
|
|
|
+ archiveAutoMethod2(list2,projectId,boxMap,boxFileMap,traceId);//分类组卷
|
|
|
//设置完成度50%
|
|
|
projectClient.updateIsArchivesAutoById(projectId,50);
|
|
|
- archiveAutoMethod1(list1,boxMap,boxFileMap);//默认组卷
|
|
|
+ archiveAutoMethod1(list1,boxMap,boxFileMap,traceId);//默认组卷
|
|
|
|
|
|
//分盒组卷的且节点没配置组卷类型的
|
|
|
archiveAutoMethod0(list0,boxMap,boxFileMap);//默认组卷
|
|
|
//设置完成度70%
|
|
|
projectClient.updateIsArchivesAutoById(projectId,70);
|
|
|
- archiveAutoMethodBox(boxMap);//分盒组卷
|
|
|
+ archiveAutoMethodBox(boxMap,traceId);//分盒组卷
|
|
|
}
|
|
|
|
|
|
private void addBoxMap(ArchiveFile file,Map<String,List<ArchiveFile>> boxMap,Map<Long,String> boxFileMap){
|
|
@@ -1477,17 +1481,25 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
* @param list
|
|
|
* @param boxMap
|
|
|
*/
|
|
|
- private void archiveAutoMethod3(List<ArchiveTreeContract> list,Map<String,List<ArchiveFile>> boxMap,Map<Long,String> boxFileMap){
|
|
|
+ private void archiveAutoMethod3(List<ArchiveTreeContract> list,Map<String,List<ArchiveFile>> boxMap,Map<Long,String> boxFileMap, Long traceId){
|
|
|
//步骤1:遍历节点集合
|
|
|
for(ArchiveTreeContract node:list){
|
|
|
//步骤2:查询节点下的未组卷文件
|
|
|
List<ArchiveFile> archiveFiles = archiveFileClient.getListByNodeID(node.getId().toString());
|
|
|
+
|
|
|
//步骤3:遍历未归档文件
|
|
|
//待组卷文件集合
|
|
|
List<ArchiveFile> waitArchiveFiles = new ArrayList<>();
|
|
|
//待组卷文件总页数
|
|
|
int archivesSize=0;
|
|
|
if(archiveFiles!=null){
|
|
|
+
|
|
|
+ if (archiveFiles.size() > 0) {
|
|
|
+ String completeMsg = "[自动组卷] 单独组卷:"+"-traceId:"+traceId + "节点:" + node.getNodeName() + " 文件数量:" + archiveFiles.size();
|
|
|
+ iTraceLogService.saveLog(traceId, completeMsg);
|
|
|
+ //log.info("[自动组卷]{}","单独组卷:"+"-traceId:"+traceId + "节点:" + node.getNodeName() + " 文件数量:" + archiveFiles.size());
|
|
|
+ }
|
|
|
+
|
|
|
for(ArchiveFile file:archiveFiles){
|
|
|
//步骤4:断文件是否存在分盒设置
|
|
|
if(file.getBoxNumber()!=null && file.getBoxNumber()!=-1){
|
|
@@ -1515,7 +1527,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
* 分类并卷组卷 设置分类的节点下只有一个案卷,节点下的所有文件都组成这个案卷。如果设置分类节点(select=1的)多个,案卷归属排序第一个节点。
|
|
|
*/
|
|
|
private void archiveAutoMethod2(List<ArchiveTreeContract> list,Long projectId,
|
|
|
- Map<String,List<ArchiveFile>> boxMap,Map<Long,String> boxFileMap){
|
|
|
+ Map<String,List<ArchiveFile>> boxMap,Map<Long,String> boxFileMap, Long traceId){
|
|
|
|
|
|
//分类并卷集合<groupId,List<文件>>
|
|
|
Map<Long,List<ArchiveFile>> archiveMap = new HashMap<>();
|
|
@@ -1531,6 +1543,11 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
//步骤3:遍历未归档文件
|
|
|
if(archiveFiles!=null){
|
|
|
for(ArchiveFile file:archiveFiles){
|
|
|
+
|
|
|
+ if (archiveFiles.size() > 0) {
|
|
|
+ String completeMsg = "[自动组卷] 分类组卷:"+"-traceId:"+traceId + "节点:" + node.getNodeName() + " 文件数量:" + archiveFiles.size();
|
|
|
+ iTraceLogService.saveLog(traceId, completeMsg);
|
|
|
+ }
|
|
|
//步骤4:判断文件是否存在分盒设置
|
|
|
if(file.getBoxNumber()!=null && file.getBoxNumber()!=-1){
|
|
|
//添加到分盒文件集合
|
|
@@ -1567,7 +1584,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
* 默认组卷流程 文件可以跨节点组卷,受最高并卷节点限制范围,跨节点文件组卷时,案卷规格按照第一个文件所在的节点规格 组卷。
|
|
|
*/
|
|
|
private void archiveAutoMethod1(List<ArchiveTreeContract> list,Map<String,List<ArchiveFile>> boxMap,
|
|
|
- Map<Long,String> boxFileMap){
|
|
|
+ Map<Long,String> boxFileMap, Long traceId){
|
|
|
//最高并卷节点
|
|
|
Long archiveAutoNodeId=null;
|
|
|
|
|
@@ -1617,6 +1634,11 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
//步骤3.3:遍历未组卷文件
|
|
|
int archiveFilesSize=0;
|
|
|
for(ArchiveFile file:archiveFiles){
|
|
|
+
|
|
|
+ if (archiveFiles.size() > 0) {
|
|
|
+ String completeMsg = "[自动组卷] 最高组卷:"+"-traceId:"+traceId + "节点:" + node.getNodeName() + " 文件数量:" + archiveFiles.size();
|
|
|
+ iTraceLogService.saveLog(traceId, completeMsg);
|
|
|
+ }
|
|
|
archiveFilesSize++;
|
|
|
//步骤3.4:判断文件是否存在分盒设置
|
|
|
if(file.getBoxNumber()!=null && file.getBoxNumber()!=-1) {
|
|
@@ -1730,10 +1752,12 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
* 分盒组卷流程
|
|
|
* @param boxMap
|
|
|
*/
|
|
|
- private void archiveAutoMethodBox(Map<String,List<ArchiveFile>> boxMap){
|
|
|
+ private void archiveAutoMethodBox(Map<String,List<ArchiveFile>> boxMap, Long traceId){
|
|
|
Set<Map.Entry<String, List<ArchiveFile>>> entries = boxMap.entrySet();
|
|
|
for (Map.Entry<String, List<ArchiveFile>> entry:entries){
|
|
|
//一个分盒一个案卷 归属第一个文件所在节点
|
|
|
+ String completeMsg = "[自动组卷] 分盒组卷:"+"-traceId:"+traceId + "box:" + entry.getKey() + " 文件数量:" + entry.getValue().size();
|
|
|
+ iTraceLogService.saveLog(traceId, completeMsg);
|
|
|
createArchiveBox(entry.getKey(),entry.getValue());
|
|
|
}
|
|
|
}
|
|
@@ -1743,7 +1767,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
* @param ids
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<ArchivesAuto> findArchivesAutosByIds(List<Long> ids) {
|
|
|
+ public List<ArchivesAuto> findArchivesAutosByIds(List<Long> ids,Long traceId) {
|
|
|
QueryWrapper<ArchivesAuto> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.in("node_id", ids)
|
|
|
.eq("is_deleted",0)
|
|
@@ -1769,11 +1793,11 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
* @param contractId
|
|
|
* @param nodeId
|
|
|
*/
|
|
|
- public void refreshFileNumberNoSlipt(Long projectId,Long contractId,Long nodeId,boolean bforce) {
|
|
|
+ public void refreshFileNumberNoSlipt(Long projectId,Long contractId,Long nodeId,boolean bforce, Long traceId) {
|
|
|
List<ArchiveTreeContract> list = archiveTreeContractClient.getListByProjectId(projectId);
|
|
|
if (nodeId!= null) {
|
|
|
ArchiveTreeContract node = archiveTreeContractClient.getArchiveTreeContractById(nodeId);
|
|
|
- if (node!= null && node.getContractId() != null) {
|
|
|
+ if (node!= null && node.getContractId() != null && node.getContractId() != -1) {
|
|
|
contractId = node.getContractId();
|
|
|
}
|
|
|
}
|
|
@@ -1781,7 +1805,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
Integer indexType = 0;
|
|
|
ArchiveProjectConfig config = archiveProjectConfigService.getByProjectIdOrNew(projectId);
|
|
|
|
|
|
- this.refreshFileNumberNoSlipt(list,contractId,nodeId,bforce,config.getIndexType(),config.getDirType(),config.getIndexNum());
|
|
|
+ this.refreshFileNumberNoSlipt(list,contractId,nodeId,bforce,config.getIndexType(),config.getDirType(),config.getIndexNum(),traceId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1791,7 +1815,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
* @param nodeId
|
|
|
*/
|
|
|
public void refreshFileNumberNoSlipt(List<ArchiveTreeContract> archiveTreeContracts,Long contractId,Long nodeId,
|
|
|
- boolean bforce,Integer indexType, Integer dirType,Integer indexNum) {
|
|
|
+ boolean bforce,Integer indexType, Integer dirType,Integer indexNum,Long traceId) {
|
|
|
|
|
|
List<ArchiveTreeContractVO2> subTreeList = new ArrayList<>();
|
|
|
List<List<ArchiveTreeContract>> subGroupedList = new ArrayList<>();
|
|
@@ -1820,7 +1844,13 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
if(ids.size()==0){
|
|
|
continue;
|
|
|
}
|
|
|
- List<ArchivesAuto> archivesAutos = findArchivesAutosByIds(ids);
|
|
|
+
|
|
|
+ for(ArchiveTreeContract node:subList){
|
|
|
+ String fileMessage = "[自动组卷] 刷新档号:节点名0 "+ subList.get(0).getNodeName()+ "-节点列表:"+node.getNodeName()+ "-traceId:"+traceId;
|
|
|
+ log.info(fileMessage);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ArchivesAuto> archivesAutos = findArchivesAutosByIds(ids,traceId);
|
|
|
if (archivesAutos == null || archivesAutos.size() == 0) {
|
|
|
continue;
|
|
|
}
|
|
@@ -1830,6 +1860,13 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
node_fileNumberPrefixMap.put(node.getId().toString(),node.getFileNumberPrefix());
|
|
|
}
|
|
|
|
|
|
+ if (archivesAutos.size() > 0) {
|
|
|
+ String startLogMessage = "[自动组卷] 刷新档号:节点名0 "+ subList.get(0).getNodeName()+"-案卷0 :"+archivesAutos.get(0).getName()
|
|
|
+ +"-案卷数量:"+archivesAutos.size()+"-traceId:"+traceId;
|
|
|
+ iTraceLogService.saveLog(traceId, startLogMessage);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
for (ArchivesAuto archivesAuto: archivesAutos) {
|
|
|
String nodeId1 = archivesAuto.getNodeId().toString();
|
|
|
String fileNumberPrefix ="";
|
|
@@ -1869,6 +1906,8 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ String fileMessage = "[自动组卷] 刷新档号:"+archivesAuto.getName()+"-fileNumber:"+fileNumber+"-index:"+index+"-traceId:"+traceId;
|
|
|
+ log.info(fileMessage);
|
|
|
index++;
|
|
|
}
|
|
|
}
|
|
@@ -2329,74 +2368,99 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
return autoMapper.getCarrierTypeByDict();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public void archiveAutoMethodThread(Long projectId, Long contractId, Long nodeId, Long traceId) {
|
|
|
- executorService.execute(()->{
|
|
|
- try{
|
|
|
- //将项目未锁定案卷拆卷
|
|
|
- log.info("[自动组卷]{}","开始对未锁定案卷拆卷。projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId+"-traceId:"+traceId);
|
|
|
+ executorService.execute(() -> {
|
|
|
+ try {
|
|
|
+ // 将项目未锁定案卷拆卷
|
|
|
+ String startSplitMsg = "[自动组卷] 开始对未锁定案卷拆卷。projectId:" + projectId + "-contractId:" + contractId + "-nodeId:" + nodeId + "-traceId:" + traceId;
|
|
|
+ //log.info(startSplitMsg);
|
|
|
+ iTraceLogService.saveLog(traceId, startSplitMsg);
|
|
|
|
|
|
- //todo 有项目上传几百G文件,点组卷会产生大量费用,等改完文件下载走内网再打开此开关。
|
|
|
-// if (true) {
|
|
|
-// return;
|
|
|
-// }
|
|
|
+ // TODO: 有项目上传几百G文件,点组卷会产生大量费用,等改完文件下载走内网再打开此开关。
|
|
|
+ // if (true) {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
|
|
|
- splitArchvies(projectId,contractId,nodeId);
|
|
|
- //设置完成度10%
|
|
|
- contractClient.updateIsArchivesAutoById(contractId,10);
|
|
|
+ splitArchvies(projectId, contractId, nodeId);
|
|
|
+ // 设置完成度10%
|
|
|
+ contractClient.updateIsArchivesAutoById(contractId, 10);
|
|
|
|
|
|
- //项目自动组卷入口
|
|
|
- log.info("[自动组卷]{}","开始自动组卷。projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId+"-traceId:"+traceId);
|
|
|
- archiveAutoMethod(projectId,contractId,nodeId);
|
|
|
- //设置完成度80%
|
|
|
- contractClient.updateIsArchivesAutoById(contractId,80);
|
|
|
+ // 项目自动组卷入口
|
|
|
+ String startAutoArchiveMsg = "[自动组卷] 开始自动组卷。projectId:" + projectId + "-contractId:" + contractId + "-nodeId:" + nodeId + "-traceId:" + traceId;
|
|
|
+ //log.info(startAutoArchiveMsg);
|
|
|
+ iTraceLogService.saveLog(traceId, startAutoArchiveMsg);
|
|
|
|
|
|
- //刷新项目档号
|
|
|
- log.info("[自动组卷]{}","开始刷新组卷档号。projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId+"-traceId:"+traceId);
|
|
|
- refreshFileNumberNoSlipt(projectId,contractId,nodeId,true);
|
|
|
+ archiveAutoMethod(projectId, contractId, nodeId, traceId);
|
|
|
+ // 设置完成度80%
|
|
|
+ contractClient.updateIsArchivesAutoById(contractId, 80);
|
|
|
|
|
|
+ // 刷新项目档号
|
|
|
+ String startRefreshMsg = "[自动组卷] 开始刷新组卷档号。projectId:" + projectId + "-contractId:" + contractId + "-nodeId:" + nodeId + "-traceId:" + traceId;
|
|
|
+ //log.info(startRefreshMsg);
|
|
|
+ iTraceLogService.saveLog(traceId, startRefreshMsg);
|
|
|
|
|
|
- //设置自动组卷结束
|
|
|
- contractClient.updateIsArchivesAutoById(contractId,0);
|
|
|
- log.info("[自动组卷]{}","自动组卷完成。projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId+"-traceId:"+traceId);
|
|
|
- }catch (Exception e){
|
|
|
+ refreshFileNumberNoSlipt(projectId, contractId, nodeId, true,traceId);
|
|
|
+
|
|
|
+ // 设置自动组卷结束
|
|
|
+ contractClient.updateIsArchivesAutoById(contractId, 0);
|
|
|
+ String completeMsg = "[自动组卷] 自动组卷完成。projectId:" + projectId + "-contractId:" + contractId + "-nodeId:" + nodeId + "-traceId:" + traceId;
|
|
|
+ //log.info(completeMsg);
|
|
|
+ iTraceLogService.saveLog(traceId, completeMsg);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- log.error("[自动组卷] 报错。"+e.getMessage()+"--projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId+"-traceId:"+traceId);
|
|
|
- //设置自动组卷结束
|
|
|
+ String errorMsg = "[自动组卷] 报错。" + e.getMessage() + "--projectId:" + projectId + "-contractId:" + contractId + "-nodeId:" + nodeId + "-traceId:" + traceId;
|
|
|
+ //log.error(errorMsg);
|
|
|
+ iTraceLogService.saveLog(traceId, errorMsg);
|
|
|
+
|
|
|
+ // 设置自动组卷结束
|
|
|
contractClient.updateIsArchivesAutoById(contractId, 0);
|
|
|
- }finally {
|
|
|
+
|
|
|
+ } finally {
|
|
|
contractClient.updateIsArchivesAutoById(contractId, 0);
|
|
|
- log.error("[自动组卷] 流程结束--projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId+"-traceId:"+traceId);
|
|
|
+ String endMsg = "[自动组卷] 流程结束--projectId:" + projectId + "-contractId:" + contractId + "-nodeId:" + nodeId + "-traceId:" + traceId;
|
|
|
+ //log.error(endMsg);
|
|
|
+ iTraceLogService.saveLog(traceId, endMsg);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public void refreshFileNumberThread(Long projectId, Long contractId, Long nodeId) {
|
|
|
+ public void refreshFileNumberThread(Long projectId, Long contractId, Long nodeId, Long traceId) {
|
|
|
executorService.execute(()->{
|
|
|
- try{
|
|
|
- //将项目未锁定案卷拆卷
|
|
|
- log.info("[自动组卷]{}","开始对未锁定案卷拆卷。projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId);
|
|
|
+ try {
|
|
|
+ // 将项目未锁定案卷拆卷
|
|
|
+ String startLogMessage = "[刷新档号] 开始对未锁定案卷拆卷。projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId+"-traceId:"+traceId;
|
|
|
+ iTraceLogService.saveLog(traceId, startLogMessage);
|
|
|
|
|
|
- //设置完成度10%
|
|
|
+ // 设置完成度10%
|
|
|
contractClient.updateIsArchivesAutoById(contractId,10);
|
|
|
|
|
|
- //项目自动组卷入口
|
|
|
- this.refreshFileNumberNoSlipt(projectId,contractId,null,false);
|
|
|
+ // 项目自动组卷入口
|
|
|
+ this.refreshFileNumberNoSlipt(projectId, contractId, null, false,traceId);
|
|
|
|
|
|
- //设置自动组卷结束
|
|
|
+ // 设置自动组卷结束
|
|
|
contractClient.updateIsArchivesAutoById(contractId,0);
|
|
|
- log.info("[自动组卷]{}","自动组卷完成。projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId);
|
|
|
- }catch (Exception e){
|
|
|
+
|
|
|
+ String endLogMessage = "[刷新档号] 自动组卷完成。projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId+"-traceId:"+traceId;
|
|
|
+ iTraceLogService.saveLog(traceId, endLogMessage);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- log.error("自动组卷报错。"+e.getMessage()+"--projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId);
|
|
|
- //设置自动组卷结束
|
|
|
+ String errorLogMessage = "刷新档号报错。" + e.getMessage() + "--projectId:"+projectId+"-contractId:"+contractId+"-nodeId:"+nodeId+"-traceId:"+traceId;
|
|
|
+ iTraceLogService.saveLog(traceId, errorLogMessage);
|
|
|
+
|
|
|
+ // 设置自动组卷结束
|
|
|
contractClient.updateIsArchivesAutoById(contractId, 0);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public List<User> getArchiveDestroyUser(Long projectId) {
|
|
|
return autoMapper.getArchiveDestroyUser(projectId);
|