|
@@ -73,6 +73,7 @@ import org.springblade.system.entity.DictBiz;
|
|
|
import org.springblade.system.feign.IDictBizClient;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -376,90 +377,6 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
} else {
|
|
|
vo.setPageNumber(0);
|
|
|
}
|
|
|
- String outUrl = vo.getOutUrl();
|
|
|
- if (StringUtils.isNotBlank(outUrl)) {
|
|
|
- // 根据 factorType 字符串生成档案号码字符串链表
|
|
|
- ArchiveProjectConfig config = archiveProjectConfigService.getByProjectIdOrNew(vo.getProjectId());
|
|
|
- String[] frontUrls = outUrl.split(",");
|
|
|
- ArchivesAutoVO.ApprovalFile front = new ArchivesAutoVO.ApprovalFile();
|
|
|
- ArchivesAutoVO.ApprovalFile cataLog = new ArchivesAutoVO.ApprovalFile();
|
|
|
- ArchivesAutoVO.ApprovalFile spare = new ArchivesAutoVO.ApprovalFile();
|
|
|
- ArchivesAutoVO.ApprovalFile back = new ArchivesAutoVO.ApprovalFile();
|
|
|
- for (String frontUrl : frontUrls) {
|
|
|
- // 封面(原r_Archives_front)增加中文"封面"匹配
|
|
|
- if ((frontUrl.contains(ArchiveAutoPdfServiceImpl.ARCHIVE_NUMBER[0])
|
|
|
- || frontUrl.contains("封面"))
|
|
|
- && config.getFactorType().contains("1")) {
|
|
|
- front.setFileName("封面");
|
|
|
- if(frontUrl.contains("@@@")){
|
|
|
- front.setFileUrl(frontUrl.substring(0,frontUrl.indexOf("@@@")));
|
|
|
- }else {
|
|
|
- front.setFileUrl(frontUrl);
|
|
|
- }
|
|
|
- }
|
|
|
- // 卷内目录(原r_Archives_catalog)增加中文匹配
|
|
|
- else if ((frontUrl.contains(ArchiveAutoPdfServiceImpl.ARCHIVE_NUMBER[1])
|
|
|
- || frontUrl.contains("卷内目录"))
|
|
|
- && config.getFactorType().contains("2")) {
|
|
|
- cataLog.setFileName("卷内目录");
|
|
|
- if(frontUrl.contains("@@@")){
|
|
|
- cataLog.setFileUrl(frontUrl.substring(0,frontUrl.indexOf("@@@")));
|
|
|
- }else {
|
|
|
- cataLog.setFileUrl(frontUrl);
|
|
|
- }
|
|
|
- }
|
|
|
- // 备考表(原r_Archives_spare)增加中文匹配
|
|
|
- else if ((frontUrl.contains(ArchiveAutoPdfServiceImpl.ARCHIVE_NUMBER[2])
|
|
|
- || frontUrl.contains("备考表"))
|
|
|
- && config.getFactorType().contains("3")) {
|
|
|
- spare.setFileName("备考表");
|
|
|
- if(frontUrl.contains("@@@")){
|
|
|
- spare.setFileUrl(frontUrl.substring(0,frontUrl.indexOf("@@@")));
|
|
|
- }else {
|
|
|
- spare.setFileUrl(frontUrl);
|
|
|
- }
|
|
|
- }
|
|
|
- // 背脊(原r_Archives_back)增加中文匹配
|
|
|
- else if ((frontUrl.contains(ArchiveAutoPdfServiceImpl.ARCHIVE_NUMBER[3])
|
|
|
- || frontUrl.contains("背脊"))
|
|
|
- && config.getFactorType().contains("4")) {
|
|
|
- back.setFileName("背脊");
|
|
|
- if(frontUrl.contains("@@@")){
|
|
|
- back.setFileUrl(frontUrl.substring(0,frontUrl.indexOf("@@@")));
|
|
|
- }else {
|
|
|
- back.setFileUrl(frontUrl);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- List<ArchivesAutoVO.ApprovalFile> files = vo.getApprovalFileList();
|
|
|
- if (files != null && !files.isEmpty()) {
|
|
|
- ArchivesAutoVO.ApprovalFile temp = files.get(0);
|
|
|
- if (front.getFileUrl() != null) {
|
|
|
- front.setId(temp.getId() + "_1");
|
|
|
- front.setPdfFileUrl(front.getFileUrl());
|
|
|
- files.add(0,front);
|
|
|
- }
|
|
|
- if (cataLog.getFileUrl() != null) {
|
|
|
- cataLog.setId(temp.getId() + "_2");
|
|
|
- cataLog.setPdfFileUrl(cataLog.getFileUrl());
|
|
|
- if (front.getFileUrl() != null) {
|
|
|
- files.add(1,cataLog);
|
|
|
- } else {
|
|
|
- files.add(0,cataLog);
|
|
|
- }
|
|
|
- }
|
|
|
- if (spare.getFileUrl() != null) {
|
|
|
- spare.setId(temp.getId() + "_3");
|
|
|
- spare.setPdfFileUrl(spare.getFileUrl());
|
|
|
- files.add(spare);
|
|
|
- }
|
|
|
- if (back.getFileUrl() != null) {
|
|
|
- back.setId(temp.getId() + "_4");
|
|
|
- back.setPdfFileUrl(back.getFileUrl());
|
|
|
- files.add(back);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
return vo;
|
|
|
}
|
|
|
|
|
@@ -1363,23 +1280,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
if (selectList== null || selectList.size() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- if (waitArchiveFiles==null || waitArchiveFiles.size()== 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- String strfirstNodeId = waitArchiveFiles.get(0).getNodeId();
|
|
|
-
|
|
|
ArchiveTreeContract node = selectList.get(0);
|
|
|
- if (StringUtils.isNotEmpty(strfirstNodeId)) {
|
|
|
- Long firstNodeId = Long.parseLong(strfirstNodeId);
|
|
|
- ArchiveTreeContract firstNode = archiveTreeContractClient.getArchiveTreeContractById(firstNodeId);
|
|
|
- if (firstNode!= null) {
|
|
|
- node = firstNode;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
//获取案卷文件起止时间
|
|
|
String archiveStartDateAndEndDate = getArchiveStartDateAndEndDate(waitArchiveFiles);
|
|
|
String[] split = archiveStartDateAndEndDate.split(",");
|
|
@@ -4104,6 +4005,71 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Async
|
|
|
+ public void fileNumberFlush(Long projectId, Long contractId, List<String> nodeIds,Integer isArchive) {
|
|
|
+ ArchiveProjectConfig config = archiveProjectConfigService.getByProjectIdOrNew(projectId);
|
|
|
+ List<ArchivesAutoVO4>list=baseMapper.selectAllArchiveAuto(projectId,contractId,nodeIds,isArchive);
|
|
|
+ if(list!=null && list.size()>0){
|
|
|
+ if(config.getDirType()==null||config.getDirType()==0){
|
|
|
+ List<ArchivesAuto> archivesAutos = setFileNumberByConfig(config, list);
|
|
|
+ this.updateBatchById(archivesAutos);
|
|
|
+ }else {
|
|
|
+ Map<Long, List<ArchivesAutoVO4>> map = list.stream().collect(Collectors.groupingBy(ArchivesAutoVO4::getParentId));
|
|
|
+ for (Map.Entry<Long, List<ArchivesAutoVO4>> entry : map.entrySet()) {
|
|
|
+ List<ArchivesAutoVO4> value = entry.getValue();
|
|
|
+ List<ArchivesAuto> archivesAutos = setFileNumberByConfig(config, value);
|
|
|
+ this.updateBatchById(archivesAutos);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean reBuildArchiveFrontPdfs(String archiveIds, Long projectId) {
|
|
|
+ if(StringUtils.isEmpty(archiveIds)){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ String[] ids = archiveIds.split(",");
|
|
|
+ for (String archiveId : ids) {
|
|
|
+ ArchivesAuto auto = baseMapper.selectById(archiveId);
|
|
|
+ List<ArchiveFile> archiveFiles = archiveFileClient.getArchiveFileByArchiveID(Long.valueOf(archiveId));
|
|
|
+ archiveAutoPdfService.buildArchiveFrontPdfs(projectId,auto,archiveFiles,true);
|
|
|
+ baseMapper.updateById(auto);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<ArchivesAuto> setFileNumberByConfig(ArchiveProjectConfig config,List<ArchivesAutoVO4> value){
|
|
|
+ int i=1;
|
|
|
+ List<ArchivesAuto>list=new ArrayList<>();
|
|
|
+ for (ArchivesAutoVO4 v:value) {
|
|
|
+ ArchivesAuto auto = new ArchivesAuto();
|
|
|
+ if(config.getIndexType()==null||config.getIndexType()==0){
|
|
|
+ v.setFileNumber(v.getFileNumberPrefix()+"_"+i);
|
|
|
+ }else {
|
|
|
+ String prefix = v.getFileNumberPrefix();
|
|
|
+ int index = i; // 编号从 1 开始
|
|
|
+ // 获取配置中的编号长度(最多多少位)
|
|
|
+ int numLength = config.getIndexNum();
|
|
|
+ // 默认最多4位,防止过长或无效值
|
|
|
+ if (numLength > 10) { // 限制最大为10位
|
|
|
+ numLength = 4;
|
|
|
+ }
|
|
|
+ // 使用 %0xd 格式化数字,x 表示总长度
|
|
|
+ String formattedIndex = String.format("%0" + numLength + "d", index);
|
|
|
+ // 设置最终档号
|
|
|
+ v.setFileNumber(prefix + "_" + formattedIndex);
|
|
|
+ }
|
|
|
+ auto.setId(v.getId());
|
|
|
+ auto.setFileNumber(v.getFileNumber());
|
|
|
+ list.add(auto);
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|