|
|
@@ -4874,7 +4874,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
for (ArchivesAutoVO4 v : value) {
|
|
|
ArchivesAuto auto = new ArchivesAuto();
|
|
|
if (config.getIndexType() == null || config.getIndexType() == 0) {
|
|
|
- v.setFileNumber(v.getFileNumberPrefix() + "—" + i);
|
|
|
+ v.setFileNumber(v.getFileNumberPrefix() + "-" + i);
|
|
|
|
|
|
} else {
|
|
|
String prefix = v.getFileNumberPrefix();
|
|
|
@@ -4888,7 +4888,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
// 使用 %0xd 格式化数字,x 表示总长度
|
|
|
String formattedIndex = String.format("%0" + numLength + "d", index);
|
|
|
// 设置最终档号
|
|
|
- v.setFileNumber(prefix + "—" + formattedIndex);
|
|
|
+ v.setFileNumber(prefix + "-" + formattedIndex);
|
|
|
}
|
|
|
auto.setId(v.getId());
|
|
|
auto.setFileNumber(v.getFileNumber());
|
|
|
@@ -5396,7 +5396,7 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
if(fileUrl==null){
|
|
|
continue;
|
|
|
}
|
|
|
- String filePath=url+auto.getName()+".pdf";
|
|
|
+ String filePath=url+SnowFlakeUtil.getId()+".pdf";
|
|
|
System.out.println("开始保存:"+fileUrl);
|
|
|
Boolean b = FileUtils.saveInputStreamByUrl(fileUrl, filePath);
|
|
|
System.out.println("保存完成:"+b);
|
|
|
@@ -5412,27 +5412,26 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
if(result.contains("档号")){
|
|
|
String fileNum=result.replace("档号","").replace(":","").replace(":","");
|
|
|
auto.setFileNumber(fileNum);
|
|
|
- }else if(result.contains("立卷单位")){
|
|
|
- String unit=result.replace("立卷单位","").replace(":","").replace(":","").replaceAll("_","").replace("密级","").replace("级密","");
|
|
|
+ }else if(result.contains("立卷单位")||result.contains("立港单位")){
|
|
|
+ String unit=result.replace("立卷单位","").replace("立港单位","").replace(":","").replace(":","").replaceAll("_","").replace("密级","").replace("级密","");
|
|
|
if(unit.startsWith(",")||unit.startsWith(".")||unit.startsWith("。")||unit.startsWith("——")||unit.startsWith("-")||unit.startsWith(",")){
|
|
|
unit=unit.substring(1);
|
|
|
+ if(unit.contains("高迷")){
|
|
|
+ unit=unit.replaceAll("高迷", "高速");
|
|
|
+ }
|
|
|
+ if(unit.contains("公资")){
|
|
|
+ unit=unit.replaceAll("公资", "公路");
|
|
|
+ }
|
|
|
}
|
|
|
auto.setUnit(unit);
|
|
|
}else if (result.contains("起止日期")) {
|
|
|
String time=result.replace("起止日期","").replace(":","").replace(":","").replaceAll("_","");
|
|
|
- if(result.contains("~")){
|
|
|
- String[] localDateTimes = time.split("~");
|
|
|
- auto.setStartDate(localDateTimes[0]);
|
|
|
- auto.setEndDate(localDateTimes[1]);
|
|
|
- } else if (result.contains("-")) {
|
|
|
- String[] localDateTimes = time.split("-");
|
|
|
- auto.setStartDate(localDateTimes[0]);
|
|
|
- auto.setEndDate(localDateTimes[1]);
|
|
|
- } else if (result.contains("~")) {
|
|
|
- String[] localDateTimes = time.split("~");
|
|
|
- auto.setStartDate(localDateTimes[0]);
|
|
|
- auto.setEndDate(localDateTimes[1]);
|
|
|
+ String[] strings = extractTimeNumbers(time);
|
|
|
+ if (strings[0].startsWith("7")) {
|
|
|
+ strings[0] = "2" + strings[0].substring(1);
|
|
|
}
|
|
|
+ auto.setStartDate(strings[0]);
|
|
|
+ auto.setEndDate(strings[1]);
|
|
|
} else if (result.contains("保管期限")||result.contains("保管限期")) {
|
|
|
String storageTime=result.replace("保管期限","").replace("保管限期","").replace(":","").replace(":","").replaceAll("_","");
|
|
|
if(StringUtils.isNotEmpty(storageTime)){
|
|
|
@@ -5471,6 +5470,29 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
this.updateBatchById(archivesAutoList);
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ public String[] extractTimeNumbers(String time) {
|
|
|
+ if (StringUtils.isEmpty(time)) {
|
|
|
+ return new String[]{"", ""};
|
|
|
+ }
|
|
|
+
|
|
|
+ // 使用正则表达式分割,匹配一个或多个非数字字符作为分隔符
|
|
|
+ String[] parts = time.split("[^0-9]+");
|
|
|
+
|
|
|
+ // 过滤掉空字符串,只保留数字部分
|
|
|
+ List<String> numbers = Arrays.stream(parts)
|
|
|
+ .filter(part -> !part.isEmpty())
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 确保返回数组始终包含两个元素
|
|
|
+ if (numbers.size() >= 2) {
|
|
|
+ return new String[]{numbers.get(0), numbers.get(1)};
|
|
|
+ } else if (numbers.size() == 1) {
|
|
|
+ return new String[]{numbers.get(0), ""};
|
|
|
+ } else {
|
|
|
+ return new String[]{"", ""};
|
|
|
+ }
|
|
|
+ }
|
|
|
public List<String> extractTextFromPDF(String pdfFilePath) throws IOException, InterruptedException {
|
|
|
//String PYTHON_SCRIPT_PATH = "C:\\Users\\hc01\\AppData\\Local\\Programs\\Python\\Python310\\Python\\pdfTextExtractorWindows.py";
|
|
|
//String PYTHON_INTERPRETER = "C:\\Users\\hc01\\AppData\\Local\\Programs\\Python\\Python310\\python.exe";
|