|
@@ -92,6 +92,7 @@ import java.net.URL;
|
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Path;
|
|
|
import java.nio.file.Paths;
|
|
|
+import java.rmi.ServerException;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
import java.util.List;
|
|
@@ -1566,6 +1567,9 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
aiName.setStatus(1);
|
|
|
aiNames.add(aiName);
|
|
|
}
|
|
|
+ if(aiNames.size()<=0){
|
|
|
+ throw new ServerException("所选节点正在生成中,请勿重复提交");
|
|
|
+ }
|
|
|
//异步调用AI接口
|
|
|
aiNameService.syncCreatAiName(aiNames);
|
|
|
return aiNameService.saveBatch(aiNames);
|
|
@@ -4500,18 +4504,18 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
|
|
|
@Override
|
|
|
@Async
|
|
|
- public void fileNumberFlush(Long projectId, Long contractId, List<String> nodeIds,Integer isArchive) {
|
|
|
+ public void fileNumberFlush(Long projectId, Long contractId, List<String> nodeIds,Integer isArchive,Integer startNumber) {
|
|
|
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);
|
|
|
+ List<ArchivesAuto> archivesAutos = setFileNumberByConfig(config, list,startNumber);
|
|
|
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);
|
|
|
+ List<ArchivesAuto> archivesAutos = setFileNumberByConfig(config, value,startNumber);
|
|
|
this.updateBatchById(archivesAutos);
|
|
|
}
|
|
|
}
|
|
@@ -4616,8 +4620,11 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- public List<ArchivesAuto> setFileNumberByConfig(ArchiveProjectConfig config,List<ArchivesAutoVO4> value){
|
|
|
- int i=1;
|
|
|
+ public List<ArchivesAuto> setFileNumberByConfig(ArchiveProjectConfig config,List<ArchivesAutoVO4> value,Integer startNumber){
|
|
|
+ int i=startNumber;
|
|
|
+ if(config.getIndexType()==1&&startNumber.toString().length()>config.getIndexNum()+1){
|
|
|
+ throw new ServiceException("起始流水号位数不能超过设置的虚数位数");
|
|
|
+ }
|
|
|
List<ArchivesAuto>list=new ArrayList<>();
|
|
|
for (ArchivesAutoVO4 v:value) {
|
|
|
ArchivesAuto auto = new ArchivesAuto();
|
|
@@ -4625,7 +4632,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
v.setFileNumber(v.getFileNumberPrefix()+"_"+i);
|
|
|
}else {
|
|
|
String prefix = v.getFileNumberPrefix();
|
|
|
- int index = i; // 编号从 1 开始
|
|
|
+ int index = i; // 编号从 startNumber 开始
|
|
|
// 获取配置中的编号长度(最多多少位)
|
|
|
int numLength = config.getIndexNum();
|
|
|
// 默认最多4位,防止过长或无效值
|