This commit is contained in:
2025-11-22 14:22:36 +08:00
parent a0933afc97
commit 248d91729f
12 changed files with 899 additions and 83 deletions

View File

@@ -60,12 +60,52 @@ public class ImportService {
@Value("${img.upload}")
private String uploadPath;
@Value("${temp.path}")
private String tempPath;
@Value("${youhong.baseUrl}")
private String youhongBaseUrl;
@Value("${youhong.integrate}")
private Boolean youhongIntegrate;
// 网络上传文件路径配置
@Value("${net.upload.win.filePath}")
private String netUploadWinFilePath;
@Value("${net.upload.win.targetPath}")
private String netUploadWinTargetPath;
@Value("${net.upload.linux.filePath}")
private String netUploadLinuxFilePath;
@Value("${net.upload.linux.targetPath}")
private String netUploadLinuxTargetPath;
@Value("${net.upload-two.win.filePath}")
private String netUploadTwoWinFilePath;
@Value("${net.upload-two.win.targetPath}")
private String netUploadTwoWinTargetPath;
@Value("${net.upload-two.linux.filePath}")
private String netUploadTwoLinuxFilePath;
@Value("${net.upload-two.linux.targetPath}")
private String netUploadTwoLinuxTargetPath;
@Value("${net.jzt.win.filePath}")
private String netJztWinFilePath;
@Value("${net.jzt.win.targetPath}")
private String netJztWinTargetPath;
@Value("${net.jzt.linux.filePath}")
private String netJztLinuxFilePath;
@Value("${net.jzt.linux.targetPath}")
private String netJztLinuxTargetPath;
@Autowired
private OcrLogMapper ocrLogMapper;
@@ -75,6 +115,43 @@ public class ImportService {
//创建线程池工具类
ThreadPoolUtils threadPoolUtils = new ThreadPoolUtils(20);
/**
* 根据操作系统类型获取网络上传文件路径配置
* @param type 路径类型: upload, upload-two, jzt
* @return 包含filePath和targetPath的Map
*/
private Map<String, String> getNetUploadPathConfig(String type) {
Map<String, String> pathConfig = new HashMap<>();
if ("upload".equals(type)) {
if (system.equals("win")) {
pathConfig.put("filePath", netUploadWinFilePath);
pathConfig.put("targetPath", netUploadWinTargetPath);
} else {
pathConfig.put("filePath", netUploadLinuxFilePath);
pathConfig.put("targetPath", netUploadLinuxTargetPath);
}
} else if ("upload-two".equals(type)) {
if (system.equals("win")) {
pathConfig.put("filePath", netUploadTwoWinFilePath);
pathConfig.put("targetPath", netUploadTwoWinTargetPath);
} else {
pathConfig.put("filePath", netUploadTwoLinuxFilePath);
pathConfig.put("targetPath", netUploadTwoLinuxTargetPath);
}
} else if ("jzt".equals(type)) {
if (system.equals("win")) {
pathConfig.put("filePath", netJztWinFilePath);
pathConfig.put("targetPath", netJztWinTargetPath);
} else {
pathConfig.put("filePath", netJztLinuxFilePath);
pathConfig.put("targetPath", netJztLinuxTargetPath);
}
}
return pathConfig;
}
public Map<String, Object> insert(Map<String, Object> params) throws IOException {
Integer entityId = (Integer)params.get("entityId");
@@ -85,13 +162,7 @@ public class ImportService {
String fileName = (String)params.get("fileName");
String userName = (String)params.get("userName");
Map<String, Object> map = new HashMap<>();
String path = "";
if(system.equals("win")){
path = "d:/" + "temp" + File.separator + userName + File.separator + fileName;
}else {
path = "/opt/" + "temp" + File.separator + userName + File.separator + fileName;
}
String path = tempPath + File.separator + userName + File.separator + fileName;
String format = path.substring(path.lastIndexOf(".") + 1);
if (format.equalsIgnoreCase("xls")) {
@@ -306,13 +377,7 @@ public class ImportService {
String fileName = (String)params.get("fileName");
String userName = (String)params.get("userName");
Map<String, Object> map = new HashMap<>();
String path = "";
if(system.equals("win")){
path = "d:/" + "temp" + File.separator + userName + File.separator + fileName;
}else {
path = "/opt/" + "temp" + File.separator + userName + File.separator + fileName;
}
String path = tempPath + File.separator + userName + File.separator + fileName;
String format = path.substring(path.lastIndexOf(".") + 1);
if (format.equalsIgnoreCase("xls")) {
@@ -528,13 +593,7 @@ public class ImportService {
String fileName = (String)params.get("fileName");
String userName = (String)params.get("userName");
Map<String, Object> map = new HashMap<>();
String path = "";
if(system.equals("win")){
path = "d:/" + "temp" + File.separator + userName + File.separator + fileName;
}else {
path = "/opt/" + "temp" + File.separator + userName + File.separator + fileName;
}
String path = tempPath + File.separator + userName + File.separator + fileName;
String format = path.substring(path.lastIndexOf(".") + 1);
if (format.equalsIgnoreCase("xls")) {
@@ -851,13 +910,7 @@ public class ImportService {
String fileName = multipartFile.getOriginalFilename();
fileName = fileName.substring(fileName.lastIndexOf("\\") + 1);
fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
String path = "";
if(system.equals("win")){
path = "d:/" + "temp" + File.separator + userName + File.separator ;
}else {
path = "/opt/" + "temp" + File.separator + userName + File.separator ;
}
String path = tempPath + File.separator + userName + File.separator;
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
Map<String, Object> excelMap = new HashMap<>();
if ("xls".equals(suffix)) {
@@ -1631,17 +1684,10 @@ public class ImportService {
public AjaxJson hookUpNet(MultipartFile file,Integer type,Integer entityId,Integer mode,String AbSurface, HttpServletRequest request)throws Exception{
AjaxJson json = null;
String filePath;
String targetPath;
if(system.equals("win")){
filePath = "D:\\fileAll\\";
targetPath = "D:\\testFile";
FileUtil2.makedir(filePath);
}else {
filePath = "/home/fileAll/";
targetPath = "/home/testFile";
FileUtil2.makedir(filePath);
}
Map<String, String> pathConfig = getNetUploadPathConfig("upload");
String filePath = pathConfig.get("filePath");
String targetPath = pathConfig.get("targetPath");
FileUtil2.makedir(filePath);
//创建目录 存在则直接返回该目录
// FileUtil.mkdir(filePath);
filePath = filePath+ StringUtil.generaterUUID() +".zip";
@@ -1670,17 +1716,10 @@ public class ImportService {
public AjaxJson hookUpTwoNet(MultipartFile file,Integer type,Integer entityId,Integer mode,String AbSurface, HttpServletRequest request)throws Exception{
AjaxJson json = null;
String filePath;
String targetPath;
if(system.equals("win")){
filePath = "D:\\fileAllTwo\\";
targetPath = "D:\\testFileTwo";
FileUtil2.makedir(filePath);
}else {
filePath = "/home/fileAllTwo/";
targetPath = "/home/testFileTwo";
FileUtil2.makedir(filePath);
}
Map<String, String> pathConfig = getNetUploadPathConfig("upload-two");
String filePath = pathConfig.get("filePath");
String targetPath = pathConfig.get("targetPath");
FileUtil2.makedir(filePath);
//创建目录 存在则直接返回该目录
// FileUtil.mkdir(filePath);
filePath = filePath+ StringUtil.generaterUUID() +".zip";
@@ -2763,17 +2802,10 @@ public class ImportService {
public AjaxJson hookUpJztNet(MultipartFile file,Integer entityId, HttpServletRequest request)throws Exception{
AjaxJson json = null;
String filePath;
String targetPath;
if(system.equals("win")){
filePath = "D:\\fileAll\\";
targetPath = "D:\\testFile";
FileUtil2.makedir(filePath);
}else {
filePath = "/opt/fileAll/";
targetPath = "/opt/testFile";
FileUtil2.makedir(filePath);
}
Map<String, String> pathConfig = getNetUploadPathConfig("jzt");
String filePath = pathConfig.get("filePath");
String targetPath = pathConfig.get("targetPath");
FileUtil2.makedir(filePath);
//创建目录 存在则直接返回该目录
// FileUtil.mkdir(filePath);
filePath = filePath+ StringUtil.generaterUUID() +".zip";

View File

@@ -1227,9 +1227,7 @@ public class ArchivesUploadController {
for (String sourceTable : tableNames) {
String sql = " select * from " + sourceTable;
if ("scm_rpt_bizstordayreport_ez".equals(sourceTable)) {
sql += " where biz_date >= '2025-01-01' order by biz_date LIMIT 10";
} else {
sql += " LIMIT 10";
sql += " where biz_date >= '2025-01-01' order by biz_date";
}
if (log.isDebugEnabled()) {

View File

@@ -76,6 +76,36 @@ img:
report:
path: /Users/ab/Desktop/tmp/data/report/path/
# 网络上传文件临时路径配置
net:
upload:
# Windows环境路径
win:
filePath: "D:\\fileAll\\"
targetPath: "D:\\testFile"
# Linux环境路径
linux:
filePath: "/home/fileAll/"
targetPath: "/home/testFile"
upload-two:
# Windows环境路径
win:
filePath: "D:\\fileAllTwo\\"
targetPath: "D:\\testFileTwo"
# Linux环境路径
linux:
filePath: "/home/fileAllTwo/"
targetPath: "/home/testFileTwo"
jzt:
# Windows环境路径
win:
filePath: "D:\\fileAll\\"
targetPath: "D:\\testFile"
# Linux环境路径
linux:
filePath: "/opt/fileAll/"
targetPath: "/opt/testFile"
# 友虹OCR配置
youhong:
integrate: true

View File

@@ -76,6 +76,36 @@ img:
report:
path: ${REPORT_PATH:/app/data/reports}
# 网络上传文件临时路径配置Docker环境安全路径
net:
upload:
# Windows环境路径
win:
filePath: ${NET_UPLOAD_WIN_FILEPATH:"D:\\fileAll\\"}
targetPath: ${NET_UPLOAD_WIN_TARGETPATH:"D:\\testFile"}
# Linux环境路径
linux:
filePath: ${NET_UPLOAD_LINUX_FILEPATH:"/app/data/fileAll/"}
targetPath: ${NET_UPLOAD_LINUX_TARGETPATH:"/app/data/testFile"}
upload-two:
# Windows环境路径
win:
filePath: ${NET_UPLOAD_TWO_WIN_FILEPATH:"D:\\fileAllTwo\\"}
targetPath: ${NET_UPLOAD_TWO_WIN_TARGETPATH:"D:\\testFileTwo"}
# Linux环境路径
linux:
filePath: ${NET_UPLOAD_TWO_LINUX_FILEPATH:"/app/data/fileAllTwo/"}
targetPath: ${NET_UPLOAD_TWO_LINUX_TARGETPATH:"/app/data/testFileTwo"}
jzt:
# Windows环境路径
win:
filePath: ${NET_JZT_WIN_FILEPATH:"D:\\fileAll\\"}
targetPath: ${NET_JZT_WIN_TARGETPATH:"D:\\testFile"}
# Linux环境路径
linux:
filePath: ${NET_JZT_LINUX_FILEPATH:"/app/data/fileAll/"}
targetPath: ${NET_JZT_LINUX_TARGETPATH:"/app/data/testFile"}
# 友虹OCR配置
youhong:
integrate: ${YOUHONG_INTEGRATE:true}