From 542c5a467fe54532d8332a4706e895fa27cf787b Mon Sep 17 00:00:00 2001 From: gitee-bot Date: Sat, 11 Oct 2025 06:31:59 +0000 Subject: [PATCH] Add README.md --- README.en.md | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 206 insertions(+) create mode 100644 README.en.md create mode 100644 README.md diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..e0b775a --- /dev/null +++ b/README.en.md @@ -0,0 +1,103 @@ +# novel-core + +`novel-core` is a core module based on Spring Boot and MongoDB, primarily used for novel content management and document import functionality. This project supports parsing Word documents into HTML and storing them in the database, suitable for content import needs of novel platforms. + +## Project Structure + +- **novel-core-biz**: Business logic layer, containing the core implementation of document import parsing. +- **novel-core-common**: Definitions of public constants and enumerations. +- **novel-core-dao**: Data access layer, using MongoDB to store novel data. +- **novel-core-provider**: Service provider module, containing controllers, configuration files, and test classes. + +## Features + +- Supports parsing Word documents (.docx and .doc) into HTML. +- Provides RESTful API interfaces for uploading and parsing documents. +- Uses MongoDB to store the parsed novel content. +- Supports service deployment via Docker. + +## Quick Start + +### Requirements + +- JDK 1.8 or higher +- Maven 3.x +- MongoDB 4.x +- Docker (optional) + +### Build and Run + +1. **Clone the project** + + ```bash + git clone https://gitee.com/oscloud-core/novel-core.git + cd novel-core + ``` + +2. **Build the project** + + ```bash + mvn clean package + ``` + +3. **Start the service** + + - **Run locally** + + ```bash + java -jar novel-core-provider/target/novel-core.jar + ``` + + - **Run with Docker** + + ```bash + docker build -t novel-core . + docker run -d -p 8180:8180 --name novel-core novel-core + ``` + +4. **Access the API** + + Upload a Word file using the `/api/v1/file/uploadByJarDeploy` interface; the service will automatically parse and store it in MongoDB. + +## Usage Example + +### Upload and Parse a Word Document + +```bash +curl -X POST http://localhost:8180/api/v1/file/uploadByJarDeploy \ + -H "Content-Type: multipart/form-data" \ + -F "file=@/path/to/your/document.docx" +``` + +## Module Description + +### LeadingHtmlService + +Document import and parsing service interface, defining methods for uploading files and parsing them into HTML. + +### LeadingHtmlServiceImpl + +Concrete implementation class for document import and parsing, supporting the following parsing methods: + +- `PoiWordDocxHtml`: Parses `.docx` files using Apache POI. +- `PoiWordDox`: Parses `.doc` files using Apache POI. +- `spireWord`: Parses Word files using the Spire library (suitable for complex formats). + +### NovelEntity + +MongoDB data entity class used to store basic novel information, including fields such as title, author, content, and status. + +## Test Classes + +- `NovelCoreProviderApplicationTests`: Spring Boot unit test class. +- `GetWord` and `WordToHtml`: Standalone test classes for testing Word parsing functionality. + +## Configuration Files + +- `application.yml`: Main configuration file, containing MongoDB connection information, file paths, etc. +- `logback.xml`: Logging configuration file. +- `docker-compose.yml`: Docker orchestration file (incomplete). + +## License + +This project uses the MIT License. For details, please see the [LICENSE](LICENSE) file. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..cd63ec0 --- /dev/null +++ b/README.md @@ -0,0 +1,103 @@ +# novel-core + +`novel-core` 是一个基于 Spring Boot 和 MongoDB 的核心模块,主要用于小说内容的管理与文档导入功能。该项目支持将 Word 文档解析为 HTML 并存储到数据库中,适用于小说平台的内容导入需求。 + +## 项目结构 + +- **novel-core-biz**:业务逻辑层,包含文档导入解析的核心实现。 +- **novel-core-common**:公共常量与枚举定义。 +- **novel-core-dao**:数据访问层,使用 MongoDB 存储小说数据。 +- **novel-core-provider**:服务提供者模块,包含控制器、配置文件和测试类。 + +## 功能特性 + +- 支持 Word 文档(.docx 和 .doc)解析为 HTML。 +- 提供 RESTful API 接口用于上传并解析文档。 +- 使用 MongoDB 存储解析后的小说内容。 +- 支持通过 Docker 部署服务。 + +## 快速开始 + +### 环境要求 + +- JDK 1.8 或以上版本 +- Maven 3.x +- MongoDB 4.x +- Docker(可选) + +### 构建与运行 + +1. **克隆项目** + + ```bash + git clone https://gitee.com/oscloud-core/novel-core.git + cd novel-core + ``` + +2. **构建项目** + + ```bash + mvn clean package + ``` + +3. **启动服务** + + - **本地运行** + + ```bash + java -jar novel-core-provider/target/novel-core.jar + ``` + + - **Docker 运行** + + ```bash + docker build -t novel-core . + docker run -d -p 8180:8180 --name novel-core novel-core + ``` + +4. **访问 API** + + 使用 `/api/v1/file/uploadByJarDeploy` 接口上传 Word 文件,服务将自动解析并存储到 MongoDB。 + +## 使用示例 + +### 上传并解析 Word 文档 + +```bash +curl -X POST http://localhost:8180/api/v1/file/uploadByJarDeploy \ + -H "Content-Type: multipart/form-data" \ + -F "file=@/path/to/your/document.docx" +``` + +## 模块说明 + +### LeadingHtmlService + +文档导入解析服务接口,定义了上传文件并解析为 HTML 的方法。 + +### LeadingHtmlServiceImpl + +文档导入解析的具体实现类,支持以下解析方式: + +- `PoiWordDocxHtml`:使用 Apache POI 解析 `.docx` 文件。 +- `PoiWordDox`:使用 Apache POI 解析 `.doc` 文件。 +- `spireWord`:使用 Spire 库解析 Word 文件(适用于复杂格式)。 + +### NovelEntity + +MongoDB 数据实体类,用于存储小说的基本信息,包括标题、作者、内容、状态等字段。 + +## 测试类 + +- `NovelCoreProviderApplicationTests`:Spring Boot 单元测试类。 +- `GetWord` 和 `WordToHtml`:用于测试 Word 解析功能的独立测试类。 + +## 配置文件 + +- `application.yml`:主配置文件,包含 MongoDB 连接信息、文件路径等。 +- `logback.xml`:日志配置文件。 +- `docker-compose.yml`:Docker 编排文件(未完成)。 + +## 许可证 + +本项目采用 MIT 许可证。详情请查看 [LICENSE](LICENSE) 文件。 \ No newline at end of file -- Gitee