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

@@ -0,0 +1,94 @@
# 🚨 项目硬编码路径分析报告
## ✅ **已正确配置化的路径**
以下路径已正确使用配置文件,不再硬编码:
### 1. **基础文件路径** ✅
- `@Value("${img.upload}")` - 图片上传路径
- `@Value("${temp.path}")` - 临时文件路径
- `@Value("${upload.path}")` - 上传根路径
- `@Value("${report.path}")` - 报表路径
- `@Value("${unzip.path}")` - 解压路径
### 2. **使用配置的主要文件** ✅
- `ImportService.java` - tempPath已配置
- `CompactShelvingController.java` - tempPath已配置
- `ReportTemplateService.java` - reportPath已配置
- `OADockingIml.java` - unzipPath已配置
## ❌ **发现的问题路径**
### 1. **UReport文件下载路径硬编码** 🚨
#### **文件**: `src/main/java/com/point/strategy/docSimpleArrange/controller/DocSimpleController.java`
```java
String fileName = "创建文书简化pdf文件.pdf";
String downLoadPath = "D:\\\\ureportfiles\\\\"+fileName; // ❌ 硬编码
```
#### **文件**: `src/main/java/com/point/strategy/oaDocking/controller/DocTraditionVolumeOaController.java`
```java
String downLoadPath = "C:\\\\ureportfiles\\\\"+fileName; // ❌ 硬编码
outputStream = new FileOutputStream(new File("C:\\ureportfiles\\"+fileName)); // ❌ 硬编码
```
### 2. **测试代码中的硬编码** ⚠️
#### **文件**: `src/main/java/com/point/strategy/oaDocking/service/YcjSystemIntegration.java`
```java
// main方法中的测试代码
new FileInputStream(new File("D:\\2\\222.pdf")); // ⚠️ 测试代码硬编码
new File("D:\\2\\222.pdf").length(); // ⚠️ 测试代码硬编码
```
### 3. **注释中的示例路径** 💡
```java
// 这些是注释和示例,通常不影响运行
// DbOperate.dbBackUp("root", "123456", "zaizhi", "d:/3", backName);
// if (exportDatabaseTool("192.168.1.112", "3306","root", "123456", "d:/3", "zaizhi.sql", "zaizhi")) {
```
## 🔧 **修复建议**
### 1. **立即修复: UReport下载路径**
#### **方案A: 添加配置项**
```yaml
# application-prod.yml 中添加
ureport:
download:
path: ${UREPORT_DOWNLOAD_PATH:/app/data/ureport}
```
#### **方案B: 使用report.path**
```java
// 建议修改为
@Value("${report.path}")
private String reportPath;
String downLoadPath = reportPath + File.separator + fileName;
```
### 2. **清理测试代码**
```java
// 移除main方法中的硬编码路径或改为配置化
```
## 📊 **风险评估**
| 问题类型 | 影响程度 | 修复难度 | 优先级 |
|----------|----------|----------|--------|
| UReport下载路径 | 🔴 高 | 🟢 低 | **P0** |
| 测试代码硬编码 | 🟡 中 | 🟢 低 | P2 |
| 注释示例路径 | 🟢 低 | 🟢 低 | P3 |
## 🎯 **推荐修复顺序**
1. **第一步**: 修复UReport下载路径硬编码 (P0)
2. **第二步**: 清理YcjSystemIntegration测试代码 (P2)
3. **第三步**: 统一路径处理工具类 (P1)
---
**总结**: 主要问题是UReport文件下载使用了Windows硬编码路径需要立即修复以支持Linux/Mac环境部署。

View File

@@ -0,0 +1,156 @@
# ImportService.java 硬编码路径深度分析报告
## 概述
`src/main/java/com/point/strategy/datas/service/ImportService.java` 中的 `hookUp` 系列方法进行深度分析,发现多处硬编码路径问题。
## 发现的硬编码路径问题
### 1. hookUpNet 方法 (行1611)
**问题位置**: `ImportService.java:1611-1640`
**硬编码路径**:
```java
if(system.equals("win")){
filePath = "D:\\fileAll\\"; // 硬编码Windows路径
targetPath = "D:\\testFile"; // 硬编码Windows路径
FileUtil2.makedir(filePath);
}else {
filePath = "/home/fileAll/"; // 硬编码Linux路径
targetPath = "/home/testFile"; // 硬编码Linux路径
FileUtil2.makedir(filePath);
}
```
**影响**: 该方法用于处理网络文件上传,如果部署在不同环境会导致路径不存在错误。
### 2. hookUpTwoNet 方法 (行1650)
**问题位置**: `ImportService.java:1650-1679`
**硬编码路径**:
```java
if(system.equals("win")){
filePath = "D:\\fileAllTwo\\"; // 硬编码Windows路径
targetPath = "D:\\testFileTwo"; // 硬编码Windows路径
FileUtil2.makedir(filePath);
}else {
filePath = "/home/fileAllTwo/"; // 硬编码Linux路径
targetPath = "/home/testFileTwo"; // 硬编码Linux路径
FileUtil2.makedir(filePath);
}
```
**影响**: 这是用户特别关注的方法,用于双网络文件上传,存在相同的路径硬编码问题。
### 3. hookUpJztNet 方法 (行2742)
**问题位置**: `ImportService.java:2742-2770`
**硬编码路径**:
```java
if(system.equals("win")){
filePath = "D:\\fileAll\\"; // 硬编码Windows路径
targetPath = "D:\\testFile"; // 硬编码Windows路径
FileUtil2.makedir(filePath);
}else {
filePath = "/opt/fileAll/"; // 硬编码Linux路径 (注意这里是/opt而不是/home)
targetPath = "/opt/testFile"; // 硬编码Linux路径
FileUtil2.makedir(filePath);
}
```
**影响**: 该方法用于极态通文件上传Linux路径使用了 `/opt` 而其他方法使用 `/home`,存在不一致性。
### 4. hookUpXiaoGan 方法 (行2780)
**问题位置**: `ImportService.java:2780+`
**硬编码表名**:
```java
String tableName = "wsdajh_table_20220402164528"; // 硬编码表名
```
**影响**: 该方法用于孝感特定业务逻辑,表名硬编码导致无法适应不同环境的数据库配置。
## 其他相关方法分析
### 5. hookUp 方法 (行891)
**问题位置**: `ImportService.java:891-990`
**路径使用**: 该方法使用配置化路径,相对较好:
```java
String saveUrl = uploadPath + File.separator + "uploadFile" + File.separator ;
```
### 6. hookUpTwoZip 方法 (行2003)
**问题位置**: `ImportService.java:2003-2100`
**路径使用**: 该方法也使用配置化路径:
```java
String saveUrl = uploadPath + File.separator + "uploadFile" + File.separator ;
```
## 硬编码路径的问题分析
### 1. 环境依赖性问题
- **Windows路径**: `D:\fileAll\``D:\testFile` 等路径在Linux环境下不存在
- **Linux路径**: `/home/fileAll/` 在某些Linux发行版可能没有相应权限
- **路径不一致**: 不同方法使用不同的Linux路径前缀 (`/home/` vs `/opt/`)
### 2. 部署风险
- 在Docker容器中运行时这些路径可能不存在
- 在云服务器环境中,权限配置可能不同
- 跨平台部署时会失败
### 3. 维护性问题
- 路径变更需要修改代码
- 不同环境需要不同的代码版本
- 不符合12-Factor App原则
## 建议的解决方案
### 1. 配置化路径
`application.yml` 中添加配置:
```yaml
file:
upload:
temp:
win: "D:\\fileAll\\"
linux: "/home/fileAll/"
processing:
win: "D:\\testFile"
linux: "/home/testFile"
```
### 2. 环境变量支持
使用系统环境变量:
```java
String filePath = System.getenv("ARCHIVE_FILE_PATH") != null ?
System.getenv("ARCHIVE_FILE_PATH") : "/default/path";
```
### 3. 动态路径生成
基于应用根目录动态生成:
```java
String basePath = System.getProperty("user.home") + File.separator + "archive";
String filePath = basePath + File.separator + "fileAll" + File.separator;
```
### 4. 统一路径管理
创建一个专门的路径管理类:
```java
@Component
public class PathManager {
@Value("${archive.temp.path:./temp}")
private String tempPath;
@Value("${archive.upload.path:./uploads}")
private String uploadPath;
public String getTempFilePath() {
return tempPath + File.separator + "fileAll" + File.separator;
}
}
```
## 修复优先级
1. **高优先级**: `hookUpTwoNet` 方法 - 用户特别关注的功能
2. **高优先级**: `hookUpJztNet` 方法 - 存在路径不一致问题
3. **中优先级**: `hookUpNet` 方法 - 常规网络上传功能
4. **低优先级**: `hookUpXiaoGan` 方法 - 特定业务功能
## 总结
`ImportService.java` 中的 `hookUp` 系列方法存在多处硬编码路径问题,主要集中在网络文件上传相关的方法中。这些硬编码路径会导致跨平台部署失败、环境依赖性强、维护困难等问题。建议尽快进行配置化改造,使用环境变量或配置文件来管理路径,提高系统的可移植性和可维护性。

View File

@@ -0,0 +1,258 @@
# ImportService 硬编码路径修复总结
## 修复概述
成功修复了 `ImportService.java` 中除表名外的所有文件路径硬编码问题,提升了系统的可移植性和可维护性。
## 修复内容
### 1. 配置文件修改
#### application-dev.yml (开发环境)
```yaml
# 新增网络上传文件路径配置
net:
upload:
win:
filePath: "D:\\fileAll\\"
targetPath: "D:\\testFile"
linux:
filePath: "/home/fileAll/"
targetPath: "/home/testFile"
upload-two:
win:
filePath: "D:\\fileAllTwo\\"
targetPath: "D:\\testFileTwo"
linux:
filePath: "/home/fileAllTwo/"
targetPath: "/home/testFileTwo"
jzt:
win:
filePath: "D:\\fileAll\\"
targetPath: "D:\\testFile"
linux:
filePath: "/opt/fileAll/"
targetPath: "/opt/testFile"
```
#### application-prod.yml (生产环境)
```yaml
# 新增网络上传文件路径配置(Docker环境安全路径)
net:
upload:
win:
filePath: ${NET_UPLOAD_WIN_FILEPATH:"D:\\fileAll\\"}
targetPath: ${NET_UPLOAD_WIN_TARGETPATH:"D:\\testFile"}
linux:
filePath: ${NET_UPLOAD_LINUX_FILEPATH:"/app/data/fileAll/"}
targetPath: ${NET_UPLOAD_LINUX_TARGETPATH:"/app/data/testFile"}
upload-two:
win:
filePath: ${NET_UPLOAD_TWO_WIN_FILEPATH:"D:\\fileAllTwo\\"}
targetPath: ${NET_UPLOAD_TWO_WIN_TARGETPATH:"D:\\testFileTwo"}
linux:
filePath: ${NET_UPLOAD_TWO_LINUX_FILEPATH:"/app/data/fileAllTwo/"}
targetPath: ${NET_UPLOAD_TWO_LINUX_TARGETPATH:"/app/data/testFileTwo"}
jzt:
win:
filePath: ${NET_JZT_WIN_FILEPATH:"D:\\fileAll\\"}
targetPath: ${NET_JZT_WIN_TARGETPATH:"D:\\testFile"}
linux:
filePath: ${NET_JZT_LINUX_FILEPATH:"/app/data/fileAll/"}
targetPath: ${NET_JZT_LINUX_TARGETPATH:"/app/data/testFile"}
```
### 2. Java代码修改
#### 2.1 新增配置属性
`ImportService.java` 中添加了12个配置属性
```java
// 网络上传文件路径配置
@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;
```
#### 2.2 新增路径配置辅助方法
```java
/**
* 根据操作系统类型获取网络上传文件路径配置
* @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;
}
```
#### 2.3 修改的方法
**hookUpNet 方法** (行1611):
```java
// 修改前
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);
```
**hookUpTwoNet 方法** (行1650) - 用户特别关注:
```java
// 修改前
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);
```
**hookUpJztNet 方法** (行2742):
```java
// 修改前
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);
```
### 3. 保留的硬编码
按照用户要求,保留了以下硬编码:
- `hookUpXiaoGan` 方法中的硬编码表名: `String tableName = "wsdajh_table_20220402164528";`
## 修复效果
### 1. 环境兼容性
- ✅ 支持跨平台部署 (Windows/Linux)
- ✅ 支持Docker容器环境
- ✅ 支持不同环境的配置差异
### 2. 可维护性
- ✅ 路径配置统一管理
- ✅ 易于修改和扩展
- ✅ 遵循12-Factor App原则
### 3. 安全性
- ✅ 生产环境使用安全的Docker路径 `/app/data/`
- ✅ 支持环境变量覆盖
- ✅ 避免硬编码敏感路径
### 4. 向后兼容
- ✅ 开发环境保持原有路径
- ✅ 不影响现有业务逻辑
- ✅ API接口保持不变
## 使用说明
### 开发环境
直接使用默认配置路径,或在 `application-dev.yml` 中修改。
### 生产环境
可以通过环境变量覆盖配置:
```bash
export NET_UPLOAD_LINUX_FILEPATH="/custom/path/fileAll/"
export NET_UPLOAD_LINUX_TARGETPATH="/custom/path/testFile"
```
### Docker环境
在Docker Compose或Kubernetes配置中设置环境变量。
## 验证结果
- ✅ 编译通过:`mvn compile -q`
- ✅ 无语法错误
- ✅ 无硬编码路径残留
- ✅ 保持原有功能完整性
## 总结
成功将 `ImportService.java` 中的3个网络文件上传方法的硬编码路径全部配置化提升了系统的可移植性、可维护性和部署灵活性。同时保持了原有的业务逻辑不变确保了系统的稳定性。

99
JAR_OPTIMIZATION.md Normal file
View File

@@ -0,0 +1,99 @@
# Jar包优化方案 - 800MB问题解决
## 问题分析
当前项目的800MB jar包主要来源于以下几类依赖
### 1. 系统作用域依赖 (System Scope) - 直接打包
- aspose-words-15.8.0-jdk16.jar (9.8MB)
- aspose-cells-8.5.2.jar (5.8MB)
- twain4java-0.3.3-all.jar (2.5MB)
- jai_core.jar (1.5MB)
- agent-1.0.0.jar (224KB)
### 2. 视频处理依赖 (最大体积来源)
- javacv + ffmpeg-platform (通常几十MB到上百MB)
### 3. 重复依赖
- jxl依赖重复声明
### 4. 多余的PDF处理库
- pdfbox, itextpdf, ofdrw-full可能存在功能重叠
## 优化策略
### 方案一:功能模块化 (推荐)
```xml
<!-- 创建独立的处理模块,不在主应用中使用 -->
<dependency>
<groupId>com.point.strategy</groupId>
<artifactId>document-processor</artifactId>
<version>1.0.0</version>
<scope>runtime</scope> <!-- 只在运行时使用 -->
</dependency>
```
### 方案二:分离部署
- 主应用 (约50-100MB)
- 文档处理服务 (独立部署)
- OCR服务 (独立部署)
### 方案三减少scope=system依赖
```xml
<!-- 改为provided或exclude -->
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>15.8.0</version>
<scope>provided</scope> <!-- 只在编译时使用 -->
</dependency>
```
## 立即可执行的优化
### 1. 移除重复依赖
```xml
<!-- 删除重复的jxl依赖 -->
```
### 2. 调整视频处理依赖scope
```xml
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv</artifactId>
<version>1.4.1</version>
<scope>provided</scope> <!-- 改为provided -->
</dependency>
```
### 3. 使用Spring Boot分层打包
```xml
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<requiresUnpack>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
</dependency>
</requiresUnpack>
</configuration>
</plugin>
</plugins>
</build>
```
## 预期效果
优化后可将800MB减少到
- **保守估计**: 200-300MB (70%减少)
- **激进优化**: 50-100MB (90%减少)
## 实施建议
1. **第一阶段**: 移除重复依赖调整scope
2. **第二阶段**: 模块化文档处理功能
3. **第三阶段**: 考虑微服务拆分

75
SOLUTION_REPORT.md Normal file
View File

@@ -0,0 +1,75 @@
# 🎯 800MB Jar包优化解决方案
## 当前状态分析
**已完成优化**:
- 移除重复依赖 (jxl, metadata-extractor, commons-imaging)
- 预期减少约2-5MB
**主要问题**:
- JavaCV + FFmpeg平台库占用400-500MB
- 系统jar包占用约20MB
- 代码中直接依赖JavaCV类
## 🏆 推荐解决方案
### 方案一:微服务拆分 (最佳实践)
```yaml
# 主应用 (目标大小: 80-120MB)
point-strategy-main/
├── 档案管理核心功能
├── 文件上传下载
├── 数据库操作
└── 基础OCR功能
# 视频处理服务 (独立部署)
video-processing-service/
├── 视频转码功能
├── JavaCV + FFmpeg
└── 与主应用通过API通信
```
### 方案二:外部依赖部署 (快速方案)
```bash
# 1. 将JavaCV相关jar移至外部lib目录
cp ffmpeg-platform*.jar /app/lib/
cp javacv*.jar /app/lib/
# 2. 修改启动脚本
java -cp "point-strategy.jar:/app/lib/*" com.point.strategy.PointStrategyApplication
# 3. 主jar包预期大小: 120-150MB
```
### 方案三Docker分层优化
```dockerfile
# 使用分层Dockerfile
FROM openjdk:8-jre-alpine
COPY point-strategy.jar app.jar
COPY video-libs/ /app/lib/
CMD ["java", "-Djava.library.path=/app/lib", "-jar", "app.jar"]
```
## 🚀 立即可执行的临时方案
如果需要快速解决问题,建议使用**方案二**
1. **恢复JavaCV依赖** (编译需要)
2. **外部化部署** (启动时分离)
3. **预计主jar包**: 150-200MB (减少75%)
## 📈 优化效果预期
| 方案 | 主jar包大小 | 部署复杂度 | 推荐度 |
|------|-------------|------------|--------|
| 微服务拆分 | 80-120MB | 高 | ⭐⭐⭐⭐⭐ |
| 外部依赖 | 150-200MB | 中 | ⭐⭐⭐⭐ |
| 保持现状 | 598MB | 低 | ⭐ |
## 🎯 建议实施步骤
1. **短期**: 实施外部依赖方案快速减小jar包
2. **中期**: 逐步拆分视频处理模块
3. **长期**: 完全微服务化重构
需要我实施哪个方案?

0
dep_tree.txt Normal file
View File

View File

@@ -39,3 +39,65 @@
- 目的:保证建表 DDL 能使用当前激活配置的数据库连接,解决 dev/prod yml 下无法建表的问题。 - 目的:保证建表 DDL 能使用当前激活配置的数据库连接,解决 dev/prod yml 下无法建表的问题。
- 工具apply_patch补丁写入 - 工具apply_patch补丁写入
- 结果:已更新,可在激活对应 profile 后尝试新增门类触发表创建。 - 结果:已更新,可在激活对应 profile 后尝试新增门类触发表创建。
- 时间2025-11-20 09:45UTC+8
- 动作:定位 productSalesDocking 方法
- 工具shellrg -n "productSalesDocking" src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java
- 输出:找到方法起始行 1136确认分析范围
- 时间2025-11-20 09:45UTC+8
- 动作:查看方法周边 1100-1400 行
- 工具shellsed -n '1100,1400p' src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java
- 输出:截取方法上半段,记录日志与统计逻辑
- 时间2025-11-20 09:46UTC+8
- 动作:扩展读取 1170-1900 行
- 工具shellsed -n '1170,1900p' src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java
- 输出:获取循环处理逻辑但输出较大被截断
- 时间2025-11-20 09:46UTC+8
- 动作:聚焦 1500-1700 行
- 工具shellsed -n '1500,1700p' src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java
- 输出:查看 100 列组装逻辑
- 时间2025-11-20 09:47UTC+8
- 动作:尝试用 python 截取完整方法
- 工具shellpython - <<'PY' ...
- 输出:命令失败,提示 python: command not found
- 时间2025-11-20 09:47UTC+8
- 动作:使用 python3 重试提取方法
- 工具shellpython3 - <<'PY' ...
- 输出:成功导出方法文本,但因输出限制被截断
- 时间2025-11-20 09:48UTC+8
- 动作:定位 LIMIT 10 语句行号
- 工具shellrg -n "LIMIT 10" src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java
- 输出:确认 1230/1232 行存在 LIMIT 10
- 时间2025-11-20 09:49UTC+8
- 动作:查看 LIMIT 相关代码行号
- 工具shellnl -ba src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java | sed -n '1205,1245p'
- 输出:确认 totalPending 统计与 LIMIT 10 取数位于 1206-1233 行
- 时间2025-11-20 09:52UTC+8
- 动作:移除 productSalesDocking 中的 LIMIT 10 限制
- 工具apply_patch编辑 src/main/java/com/point/strategy/oaDocking/controller/ArchivesUploadController.java
- 输出:删掉取数 SQL 的 LIMIT 10保留 biz_date 过滤与排序,确保一次性读取全部数据
- 时间2025-11-20 09:42UTC+8
- 动作:检查 .claude 目录
- 工具shellls .claude
- 输出:目录不存在,返回 "ls: .claude: No such file or directory"
- 时间2025-11-20 09:43UTC+8
- 动作:列出仓库根目录文件
- 工具shellls
- 输出:记录仓库根目录下的主要文件和目录
- 时间2025-11-20 09:44UTC+8
- 动作:查看 operations-log.md 内容
- 工具shellcat operations-log.md
- 输出:阅读历史留痕,确认记录格式
- 时间2025-11-20 09:44UTC+8
- 动作:查询当前系统时间
- 工具shelldate '+%Y-%m-%d %H:%M:%S %Z'
- 输出2025-11-20 09:44:48 CST

20
pom.xml
View File

@@ -244,12 +244,6 @@
<artifactId>spring-boot-starter-data-elasticsearch</artifactId> <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency> </dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
<dependency> <dependency>
<groupId>net.sourceforge.tess4j</groupId> <groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId> <artifactId>tess4j</artifactId>
@@ -307,7 +301,7 @@
<artifactId>spring-boot-starter-thymeleaf</artifactId> <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency> </dependency>
<!--视频转码依赖--> <!--视频转码依赖 - 占体积最大400-500MB -->
<dependency> <dependency>
<groupId>org.bytedeco</groupId> <groupId>org.bytedeco</groupId>
<artifactId>javacv</artifactId> <artifactId>javacv</artifactId>
@@ -358,12 +352,6 @@
<!-- </dependency>--> <!-- </dependency>-->
<!-- 图片转pdf 判断方向 --> <!-- 图片转pdf 判断方向 -->
<dependency>
<groupId>com.drewnoakes</groupId>
<artifactId>metadata-extractor</artifactId>
<version>2.16.0</version> <!-- 请确保使用最新版本 -->
</dependency>
<!-- 获取mp3元数据 --> <!-- 获取mp3元数据 -->
<dependency> <dependency>
<groupId>org</groupId> <groupId>org</groupId>
@@ -504,12 +492,6 @@
<version>2.16.0</version> <version>2.16.0</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-imaging</artifactId>
<version>1.0-alpha2</version>
</dependency>
<dependency> <dependency>
<groupId>com.itextpdf</groupId> <groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId> <artifactId>itextpdf</artifactId>

View File

@@ -60,12 +60,52 @@ public class ImportService {
@Value("${img.upload}") @Value("${img.upload}")
private String uploadPath; private String uploadPath;
@Value("${temp.path}")
private String tempPath;
@Value("${youhong.baseUrl}") @Value("${youhong.baseUrl}")
private String youhongBaseUrl; private String youhongBaseUrl;
@Value("${youhong.integrate}") @Value("${youhong.integrate}")
private Boolean youhongIntegrate; 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 @Autowired
private OcrLogMapper ocrLogMapper; private OcrLogMapper ocrLogMapper;
@@ -75,6 +115,43 @@ public class ImportService {
//创建线程池工具类 //创建线程池工具类
ThreadPoolUtils threadPoolUtils = new ThreadPoolUtils(20); 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 { public Map<String, Object> insert(Map<String, Object> params) throws IOException {
Integer entityId = (Integer)params.get("entityId"); Integer entityId = (Integer)params.get("entityId");
@@ -85,13 +162,7 @@ public class ImportService {
String fileName = (String)params.get("fileName"); String fileName = (String)params.get("fileName");
String userName = (String)params.get("userName"); String userName = (String)params.get("userName");
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
String path = ""; String path = tempPath + File.separator + userName + File.separator + fileName;
if(system.equals("win")){
path = "d:/" + "temp" + File.separator + userName + File.separator + fileName;
}else {
path = "/opt/" + "temp" + File.separator + userName + File.separator + fileName;
}
String format = path.substring(path.lastIndexOf(".") + 1); String format = path.substring(path.lastIndexOf(".") + 1);
if (format.equalsIgnoreCase("xls")) { if (format.equalsIgnoreCase("xls")) {
@@ -306,13 +377,7 @@ public class ImportService {
String fileName = (String)params.get("fileName"); String fileName = (String)params.get("fileName");
String userName = (String)params.get("userName"); String userName = (String)params.get("userName");
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
String path = ""; String path = tempPath + File.separator + userName + File.separator + fileName;
if(system.equals("win")){
path = "d:/" + "temp" + File.separator + userName + File.separator + fileName;
}else {
path = "/opt/" + "temp" + File.separator + userName + File.separator + fileName;
}
String format = path.substring(path.lastIndexOf(".") + 1); String format = path.substring(path.lastIndexOf(".") + 1);
if (format.equalsIgnoreCase("xls")) { if (format.equalsIgnoreCase("xls")) {
@@ -528,13 +593,7 @@ public class ImportService {
String fileName = (String)params.get("fileName"); String fileName = (String)params.get("fileName");
String userName = (String)params.get("userName"); String userName = (String)params.get("userName");
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
String path = ""; String path = tempPath + File.separator + userName + File.separator + fileName;
if(system.equals("win")){
path = "d:/" + "temp" + File.separator + userName + File.separator + fileName;
}else {
path = "/opt/" + "temp" + File.separator + userName + File.separator + fileName;
}
String format = path.substring(path.lastIndexOf(".") + 1); String format = path.substring(path.lastIndexOf(".") + 1);
if (format.equalsIgnoreCase("xls")) { if (format.equalsIgnoreCase("xls")) {
@@ -851,13 +910,7 @@ public class ImportService {
String fileName = multipartFile.getOriginalFilename(); String fileName = multipartFile.getOriginalFilename();
fileName = fileName.substring(fileName.lastIndexOf("\\") + 1); fileName = fileName.substring(fileName.lastIndexOf("\\") + 1);
fileName = fileName.substring(fileName.lastIndexOf("/") + 1); fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
String path = ""; String path = tempPath + File.separator + userName + File.separator;
if(system.equals("win")){
path = "d:/" + "temp" + File.separator + userName + File.separator ;
}else {
path = "/opt/" + "temp" + File.separator + userName + File.separator ;
}
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1); String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
Map<String, Object> excelMap = new HashMap<>(); Map<String, Object> excelMap = new HashMap<>();
if ("xls".equals(suffix)) { 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{ public AjaxJson hookUpNet(MultipartFile file,Integer type,Integer entityId,Integer mode,String AbSurface, HttpServletRequest request)throws Exception{
AjaxJson json = null; AjaxJson json = null;
String filePath; Map<String, String> pathConfig = getNetUploadPathConfig("upload");
String targetPath; String filePath = pathConfig.get("filePath");
if(system.equals("win")){ String targetPath = pathConfig.get("targetPath");
filePath = "D:\\fileAll\\";
targetPath = "D:\\testFile";
FileUtil2.makedir(filePath); FileUtil2.makedir(filePath);
}else {
filePath = "/home/fileAll/";
targetPath = "/home/testFile";
FileUtil2.makedir(filePath);
}
//创建目录 存在则直接返回该目录 //创建目录 存在则直接返回该目录
// FileUtil.mkdir(filePath); // FileUtil.mkdir(filePath);
filePath = filePath+ StringUtil.generaterUUID() +".zip"; 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{ public AjaxJson hookUpTwoNet(MultipartFile file,Integer type,Integer entityId,Integer mode,String AbSurface, HttpServletRequest request)throws Exception{
AjaxJson json = null; AjaxJson json = null;
String filePath; Map<String, String> pathConfig = getNetUploadPathConfig("upload-two");
String targetPath; String filePath = pathConfig.get("filePath");
if(system.equals("win")){ String targetPath = pathConfig.get("targetPath");
filePath = "D:\\fileAllTwo\\";
targetPath = "D:\\testFileTwo";
FileUtil2.makedir(filePath); FileUtil2.makedir(filePath);
}else {
filePath = "/home/fileAllTwo/";
targetPath = "/home/testFileTwo";
FileUtil2.makedir(filePath);
}
//创建目录 存在则直接返回该目录 //创建目录 存在则直接返回该目录
// FileUtil.mkdir(filePath); // FileUtil.mkdir(filePath);
filePath = filePath+ StringUtil.generaterUUID() +".zip"; filePath = filePath+ StringUtil.generaterUUID() +".zip";
@@ -2763,17 +2802,10 @@ public class ImportService {
public AjaxJson hookUpJztNet(MultipartFile file,Integer entityId, HttpServletRequest request)throws Exception{ public AjaxJson hookUpJztNet(MultipartFile file,Integer entityId, HttpServletRequest request)throws Exception{
AjaxJson json = null; AjaxJson json = null;
String filePath; Map<String, String> pathConfig = getNetUploadPathConfig("jzt");
String targetPath; String filePath = pathConfig.get("filePath");
if(system.equals("win")){ String targetPath = pathConfig.get("targetPath");
filePath = "D:\\fileAll\\";
targetPath = "D:\\testFile";
FileUtil2.makedir(filePath); FileUtil2.makedir(filePath);
}else {
filePath = "/opt/fileAll/";
targetPath = "/opt/testFile";
FileUtil2.makedir(filePath);
}
//创建目录 存在则直接返回该目录 //创建目录 存在则直接返回该目录
// FileUtil.mkdir(filePath); // FileUtil.mkdir(filePath);
filePath = filePath+ StringUtil.generaterUUID() +".zip"; filePath = filePath+ StringUtil.generaterUUID() +".zip";

View File

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

View File

@@ -76,6 +76,36 @@ img:
report: report:
path: /Users/ab/Desktop/tmp/data/report/path/ 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配置 # 友虹OCR配置
youhong: youhong:
integrate: true integrate: true

View File

@@ -76,6 +76,36 @@ img:
report: report:
path: ${REPORT_PATH:/app/data/reports} 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配置 # 友虹OCR配置
youhong: youhong:
integrate: ${YOUHONG_INTEGRATE:true} integrate: ${YOUHONG_INTEGRATE:true}