test: sync contract

This commit is contained in:
2025-10-31 16:15:47 +08:00
parent 1a615c9374
commit 7ea83200d2
3 changed files with 284 additions and 1 deletions

40
AGENTS.md Normal file
View File

@@ -0,0 +1,40 @@
# Repository Guidelines
## Project Structure & Module Organization
- Source code: `src/main/java/com/point/strategy/**` (controllers, services, mappers, beans)
- Resources: `src/main/resources/` (MyBatis `mapper/*.xml`, fonts, config, codegen `generatorConfig.xml`)
- Web assets: `src/main/webapp/**` (static pages, templates, pdf assets)
- Libraries: `src/main/lib/*.jar` (bundled into WAR via `maven-war-plugin`)
- SQL and logs: `sql/`, `logs/`
- Build output: `target/` (WAR: `point-strategy.war`)
## Build, Test, and Development Commands
- Verify environment: `mvn -v` (Java 8, Maven required)
- Build WAR: `mvn clean package -DskipTests`
- Run tests: `mvn test`
- Regenerate MyBatis artifacts (optional): `mvn mybatis-generator:generate` (uses `src/main/resources/generatorConfig.xml`)
- Deploy: copy WAR from `target/` to an external Servlet container (e.g., Tomcat 9+). This project packages as `war` with Tomcat set to `provided`.
## Coding Style & Naming Conventions
- Java 8, 4-space indentation, max line ~120 chars.
- Packages: `com.point.strategy.<module>`
- Classes `UpperCamelCase`; methods/fields `lowerCamelCase`; constants `UPPER_SNAKE_CASE`.
- Suffixes: controllers `*Controller`, services `*Service`, mappers `*Mapper`, entities/VOs `*Entity`/`*VO`.
- Prefer Lombok where present; avoid boilerplate duplication.
## Testing Guidelines
- Framework: Spring Boot Test + JUnit (vintage excluded).
- Naming: place tests under same package, file ends with `*Test.java`.
- Run all tests: `mvn test`; run a class: `mvn -Dtest=ClassNameTest test`.
- Aim for coverage of services and mappers; add lightweight controller tests for critical endpoints.
## Commit & Pull Request Guidelines
- Commit messages: short imperative subject; optionally follow Conventional Commits (e.g., `feat: ...`, `fix: ...`).
- PRs must include: concise description, rationale, screenshots for UI-impacting changes, and linked issue (e.g., `Closes #123`).
- Keep PRs focused; update tests/resources when touching mappers or SQL.
## Security & Configuration Tips
- Do not commit secrets; externalize DB credentials and keystores.
- Verify bundled JARs in `src/main/lib/` are necessary and licensed.
- Large file outputs and logs should be gitignored; use `logs/` for local runs.

213
IFLOW.md Normal file
View File

@@ -0,0 +1,213 @@
# 数字档案标准系统 (Digital Archive Standard System)
## 项目概述
这是一个基于 Spring Boot 2.3.7 的企业级数字档案管理系统专门用于档案的数字化管理、存储、检索和利用。系统支持多种数据库MySQL、人大金仓、达梦等集成了 OCR 识别、全文检索、报表生成、工作流等功能。
### 核心技术栈
- **后端框架**: Spring Boot 2.3.7.RELEASE
- **数据库**: MySQL 5.1.6 / 人大金仓 8.6.0 / 达梦数据库
- **ORM框架**: MyBatis 3.4.5 + MyBatis-Spring-Boot-Starter 1.2.0
- **分页插件**: PageHelper 4.1.0
- **连接池**: Druid 1.1.9
- **缓存**: Redis
- **搜索引擎**: Elasticsearch
- **报表工具**: UReport2 2.2.9
- **文档处理**:
- Aspose Words 15.8.0 (Word文档处理)
- Aspose Cells 8.5.2 (Excel文档处理)
- PDFBox 2.0.27 (PDF处理)
- Tess4j 4.5.3 (OCR识别)
- **API文档**: Swagger 2.9.2
- **工具类**: Hutool 5.5.2, Lombok 1.18.16
## 项目结构
```
src/main/java/com/point/strategy/
├── controller/ # 控制器层
├── service/ # 服务层
├── dao/ # 数据访问层
├── bean/ # 实体类
├── common/ # 公共工具类
├── workFlow/ # 工作流模块
├── elasticsearch/ # 搜索模块
├── ocr/ # OCR识别模块
├── pdf/ # PDF处理模块
├── webSocket/ # WebSocket模块
├── webService/ # WebService模块
└── PointStrategyApplication.java # 主启动类
```
## 核心功能模块
### 1. 档案管理
- **文件管理** (`FileManageController`): 文件上传、下载、批量操作
- **档案接收** (`ArchivesReceiveController`): 档案接收和登记
- **档案移交** (`ArchivesTransferController`): 档案移交流程
- **档案借阅** (`BorrowingFilesController`): 档案借阅管理
### 2. 库房管理
- **库房实体** (`StorehouseEntityController`): 库房实体管理
- **库房点位** (`StorehousePointController`): 库房点位管理
- **温湿度监控** (`TemperatureController`): 环境监控
- **档案装具** (`FileBoxController`, `FileFrameController`): 装具管理
### 3. 检索与统计
- **全文检索** (`FulltextSearchLogController`): 基于 Elasticsearch 的全文搜索
- **统计分析** (`StatisticsController`, `HomeStatisticsController`): 各类统计报表
- **四性检测** (`fourCheck`): 档案四性检测功能
### 4. 工作流与审批
- **工作流** (`workFlow`): 档案审批流程
- **审批设置** (`ApproveSettingController`): 审批流程配置
- **预约管理** (`ArchiveAppointmentController`): 档案预约
### 5. 元数据管理
- **元数据标准** (`metaData`): 元数据标准管理
- **实体结构** (`TentityStructDescriptionController`): 实体结构描述
- **数据字典** (`DictController`): 数据字典管理
## 构建和运行
### 环境要求
- JDK 1.8+
- Maven 3.6+
- MySQL 5.7+ / 人大金仓 8.6.0 / 达梦数据库
- Redis 3.0+
- Elasticsearch 7.x (可选)
### 构建命令
```bash
# 编译项目
mvn clean compile
# 打包项目
mvn clean package
# 跳过测试打包
mvn clean package -DskipTests
# 运行项目
mvn spring-boot:run
# 生成 MyBatis 代码
mvn mybatis-generator:generate
```
### 运行配置
#### 开发环境 (application-dev.yml)
- 服务端口: 9081
- 数据库: MySQL (100.64.11.2:3311)
- Redis: 100.64.11.2:6379
#### 生产环境配置
修改 `application.properties` 中的数据库连接和相关配置:
```properties
# 数据库配置
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://your-host:port/database
spring.datasource.username=your-username
spring.datasource.password=your-password
# 人大金仓配置 (取消注释使用)
#spring.datasource.driverClassName=com.kingbase8.Driver
#spring.datasource.url=jdbc:kingbase8://your-host:port/database
```
## 开发约定
### 代码规范
- 使用 Lombok 简化代码
- 遵循 RESTful API 设计规范
- 统一使用 `AjaxJson` 作为返回格式
- 接口文档使用 Swagger 注解
### 数据库规范
- 表名使用小写字母和下划线
- 字段名使用驼峰命名MyBatis 自动转换
- 主键统一使用 `id`
- 时间字段使用 `datetime` 类型
### 文件存储规范
- 上传文件路径: `${upload.path}`
- 临时文件路径: `${temp.path}`
- 解压文件路径: `${unzip.path}`
- 图片上传路径: `${img.upload}`
- 报表生成路径: `${report.path}`
## 部署说明
### 传统部署
1. 打包生成 WAR 文件
2. 部署到 Tomcat 8.5+
3. 配置数据库连接和 Redis 连接
4. 配置文件上传路径
### Docker 部署
```dockerfile
FROM openjdk:8-jre-alpine
COPY target/point-strategy.war app.war
EXPOSE 9081
CMD ["java", "-jar", "app.war"]
```
## 第三方集成
### OCR 集成
- 友虹 OCR: 通过 HTTP API 调用
- Tess4j: 本地 OCR 识别
### 报表集成
- UReport2: 可视化报表设计器
- 访问路径: `/ureport/*`
### 全文检索
- Elasticsearch: 基于 Spring Data Elasticsearch
- 支持多字段检索和高亮显示
## 监控和日志
### 日志配置
- 日志文件位置: `logs/`
- 日志级别: DEBUG/INFO/WARN/ERROR
- 日志轮转: 按大小和时间轮转
- 最大文件大小: 500MB
- 保留天数: 20 天
### 性能监控
- 数据库连接池监控
- Redis 连接池监控
- 接口响应时间监控
## 常见问题
### 数据库连接问题
1. 检查数据库服务是否启动
2. 验证连接字符串和凭据
3. 确认网络连通性
### 文件上传问题
1. 检查上传路径权限
2. 确认磁盘空间充足
3. 验证文件大小限制
### OCR 识别问题
1. 确认 OCR 服务配置正确
2. 检查图片格式和质量
3. 验证 Tess4j 本地环境
## 开发工具推荐
- IDE: IntelliJ IDEA
- 数据库工具: DBeaver, Navicat
- API 测试: Postman, Swagger UI
- 版本控制: Git
## 联系方式
如有问题请联系开发团队或提交 Issue。

View File

@@ -381,7 +381,18 @@ public class ArchivesUploadController {
}
//查询公文文件表
String sqlFile = " select * from fujian where fawen_index = " + indexComment;
// 打印fawen_index对应的记录数量
String sqlCount = " select count(*) as record_count from fujian where fawen_index = " + indexComment;
ResultSet countResult = YcjSystemIntegration.executeQuery(sqlCount);
if (countResult.next()) {
int recordCount = countResult.getInt("record_count");
if (log.isInfoEnabled()) {
log.info("[DOC] fawen_index={} 对应的记录数量: {}", indexComment, recordCount);
}
}
YcjSystemIntegration.closeResources(null, null, countResult);
resultSetFile = YcjSystemIntegration.executeQuery(sqlFile);
while (resultSetFile.next()) {
String fileName = resultSetFile.getString("file_path");
// String[] split = file_path.split("/");
@@ -406,8 +417,9 @@ public class ArchivesUploadController {
} else if (log.isDebugEnabled()) {
log.debug("[DOC] 跳过重复附件登记: rec_id={}, fileName={}", jhId, fileName);
}
if(type.equalsIgnoreCase("jpg")||type.equalsIgnoreCase("png") || type.equalsIgnoreCase("pdf") ){
if(type.equalsIgnoreCase("jpg")||type.equalsIgnoreCase("png") ){
//生成一份pdf文件用于归档章的操作
String newName_pdf=fileNameServer.replace("."+type,".pdf");
PdfFileHelper.image2Pdf(dirPath.resolve(fileNameServer).toString(),dirPath.resolve(newName_pdf).toString());
@@ -420,6 +432,10 @@ public class ArchivesUploadController {
} finally {
binaryStream.close(); // 关闭流很重要,避免资源泄露
}
} else {
if (log.isInfoEnabled()) {
log.info("[DOC] binaryStream为空跳过文件处理: fawen_index={}, fileName={}", indexComment, fileName);
}
}
}
//更新原文数量
@@ -757,6 +773,16 @@ public class ArchivesUploadController {
}
//查询公文文件表
String sqlFile = " select * from fujian where fawen_index = " + indexComment;
// 打印fawen_index对应的记录数量
String sqlCount = " select count(*) as record_count from fujian where fawen_index = " + indexComment;
ResultSet countResult = YcjSystemIntegration.executeQuery(sqlCount);
if (countResult.next()) {
int recordCount = countResult.getInt("record_count");
if (log.isInfoEnabled()) {
log.info("[CONTRACT] fawen_index={} 对应的记录数量: {}", indexComment, recordCount);
}
}
YcjSystemIntegration.closeResources(null, null, countResult);
resultSetFile = YcjSystemIntegration.executeQuery(sqlFile);
while (resultSetFile.next()) {
String fileName = resultSetFile.getString("file_path");
@@ -854,6 +880,10 @@ public class ArchivesUploadController {
} finally {
binaryStream.close(); // 关闭流很重要,避免资源泄露
}
} else {
if (log.isInfoEnabled()) {
log.info("[CONTRACT] binaryStream为空跳过文件处理: fawen_index={}, fileName={}", indexComment, fileName);
}
}
}
//更新原文数量