This commit is contained in:
2025-11-22 23:17:17 +08:00
parent 21cd636205
commit 1027622380
8 changed files with 57 additions and 31 deletions

19
pom.xml
View File

@@ -174,7 +174,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.16</version>
<version>1.18.30</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>dm</groupId>-->
@@ -190,6 +190,23 @@
</dependency>
<!-- CXF webservice -->
<!-- Java 11+ JAX-WS API dependencies -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>jsr181-api</artifactId>
<version>1.0-MR1</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>

View File

@@ -48,6 +48,9 @@ import static com.point.strategy.common.WatermarkImgUtils.*;
@Api(tags = "原文管理", value = "ArchiveFileController")
public class ArchiveFileController {
// 手动添加logger变量作为Lombok @Slf4j的临时替代方案
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(ArchiveFileController.class);
@Autowired
ArchiveFileService archiveFileService;

View File

@@ -1,9 +1,8 @@
package com.point.strategy.common;
import sun.misc.BASE64Encoder;
import java.io.*;
import java.util.Base64;
/**
* caiwenhong Base64编码工具类
@@ -75,9 +74,8 @@ public class Base64Utils {
e.printStackTrace();
}
// 对字节数组Base64编码
BASE64Encoder encoder = new BASE64Encoder();
// 返回Base64编码过的字节数组字符串
return encoder.encode(data);
// 使用Java 8+的Base64编码器
return Base64.getEncoder().encodeToString(data);
}
public static void main(String[] args) throws Exception {

View File

@@ -49,6 +49,15 @@ public class StringUtil {
return t.toString().trim();
}
/**
* 判断字符串是否为空
* @param str
* @return
*/
public static boolean isEmpty(String str){
return str == null || str.trim().length() == 0;
}
public static String formatMap(Map<String,Object> map, String key){
String result="";
if (map!=null){

View File

@@ -68,9 +68,13 @@ import static com.point.strategy.oaDocking.util.FileUtils.unzip;
@Slf4j
public class ArchivesUploadController {
// 手动添加logger变量作为Lombok @Slf4j的临时替代方案
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(ArchivesUploadController.class);
//本地路径
public static final String BASEPATH_LOCAL = "E:\\arc\\archives\\";
@Autowired
private DocSimpleOaService docSimpleService ;

View File

@@ -1,6 +1,5 @@
package com.point.strategy.oaDocking.util;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.io.FileTypeUtil;
import cn.hutool.core.io.FileUtil;
import com.point.strategy.common.StringUtil;
@@ -10,10 +9,8 @@ import org.apache.tools.zip.ZipFile;
import org.springframework.web.multipart.MultipartFile;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import java.io.*;
import java.util.Base64;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
@@ -179,7 +176,7 @@ public class FileUtils {
if(base64==null||"".equals(base64)) {
return null;
}
byte[] buff= Base64.decode(base64);
byte[] buff= java.util.Base64.getDecoder().decode(base64);
File file=null;
FileOutputStream fout=null;
try {
@@ -216,10 +213,8 @@ public class FileUtils {
} catch (IOException e) {
e.printStackTrace();
}
// 对字节数组Base64编码
BASE64Encoder encoder = new BASE64Encoder();
// 返回Base64编码过的字节数组字符串
return encoder.encode(data);
// 使用Java 8+的Base64编码
return Base64.getEncoder().encodeToString(data);
}
/**
@@ -232,16 +227,9 @@ public class FileUtils {
// 文件字节数组字符串数据为空
if (imgStr == null)
return false;
BASE64Decoder decoder = new BASE64Decoder();
try {
// Base64解码
byte[] b = decoder.decodeBuffer(imgStr);
for (int i = 0; i < b.length; ++i) {
{// 调整异常数据
if (b[i] < 0)
b[i] += 256;
}
}
// 使用Java 8+的Base64解码
byte[] b = Base64.getDecoder().decode(imgStr);
// 生成文件
// String sangImageStr = "D:/My Documents/ip.jpg" ; // 要生成文件的路径.
OutputStream out = new FileOutputStream(savedImagePath);

View File

@@ -366,12 +366,13 @@ public class AnjuanAndJuanneiController {
boolean pdfCreated = PdfFileHelper.image2Pdf(sourcePath, targetPath);
if (!pdfCreated) {
logger.warn("PDF文件生成失败: {} -> {}", sourcePath, targetPath);
}
} else {
// 只有PDF生成成功才复制原始文件
String newName_pdf_original=newName_pdf.replace(".pdf","_original.pdf");
String originalPath = dir + File.separator + newName_pdf_original;
FileTool.copyFile(targetPath, originalPath);
}
}
//mxf格式的文件需要转换一份mp4给前端展示
if (fileType.equalsIgnoreCase("mxf")) {

View File

@@ -2,7 +2,7 @@ package com.point.strategy.originBatchUpload;
import com.point.strategy.bean.OcrLog;
import com.point.strategy.common.AjaxJson;
import com.point.strategy.common.OCRUtil;
import com.point.strategy.ocr.OCRUtil;
import com.point.strategy.dao.OcrLogMapper;
import com.point.strategy.docTraditionArrange.docVolume.service.DanganguanliService;
import lombok.extern.slf4j.Slf4j;
@@ -17,6 +17,9 @@ import java.util.Map;
@Slf4j
public class OCRProcessingTask implements Runnable {
// 手动添加logger变量作为Lombok @Slf4j的临时替代方案
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(OCRProcessingTask.class);
private final AjaxJson json2;
private final String tableName;
private final boolean youhongIntegrate;
@@ -42,9 +45,12 @@ public class OCRProcessingTask implements Runnable {
OcrLog ocrLog = new OcrLog();
ocrLog.setTableName(tableName + "_temp_file");
File file1 = null;
String fileNameServer = null;
try {
File file1 = (File) json2.getBody().get("file");
String fileNameServer = json2.getBody().get("file_name_server").toString();
file1 = (File) json2.getBody().get("file");
fileNameServer = json2.getBody().get("file_name_server").toString();
if (file1 == null || !file1.exists()) {
throw new RuntimeException("文件不存在: " + fileNameServer);