项目优化,构建文件Lombok异常问题修复
This commit is contained in:
@@ -1,92 +1,109 @@
|
||||
# 气象数据分析平台
|
||||
# Weather Data Management System
|
||||
|
||||
基于 Spring Boot 3.5 / Vue 3 的全栈气象数据管理与分析系统,支持气象站点管理、逐日观测数据批量导入、数据统计分析与可视化展示。
|
||||
A full-stack meteorological data management and analysis platform built with Spring Boot 3.5 and Vue 3.
|
||||
|
||||
> **开发者文档** → [CLAUDE.md](CLAUDE.md)
|
||||
> Developer documentation: [CLAUDE.md](CLAUDE.md) | Module docs: [system-admin](system-admin/CLAUDE.md) | [system-common](system-common/CLAUDE.md) | [system-dynamic-datasource](system-dynamic-datasource/CLAUDE.md) | [weather-data-ui](weather-data-ui/CLAUDE.md)
|
||||
>
|
||||
> Chinese version: [README.zh-CN.md](README.zh-CN.md)
|
||||
|
||||
---
|
||||
|
||||
## 项目结构
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
weather-data/
|
||||
├── system-common/ → 公共模块:基础实体、工具类、Redis、校验
|
||||
├── system-admin/ → 管理后台 (port 8080, /system-admin)
|
||||
│ └── modules/weather/
|
||||
│ ├── dailydata/ → 逐日观测数据(Excel 批量导入、统计汇总)
|
||||
│ ├── station/ → 气象站点管理
|
||||
│ └── filescan/ → 气象资料文件监控与查阅
|
||||
├── system-api/ → 外部 API 服务 (port 8081, /renren-api)
|
||||
├── system-dynamic-datasource/ → 多数据源支持(预留)
|
||||
├── renren-generator/ → 代码生成器
|
||||
└── weather-data-ui/ → Vue 3 前端
|
||||
├── system-common/ Shared library (base classes, Redis, validation, utilities)
|
||||
├── system-dynamic-datasource/ Multi-datasource support (AbstractRoutingDataSource)
|
||||
├── system-admin/ Main application (REST API, security, jobs, file scanning)
|
||||
└── weather-data-ui/ Vue 3 frontend (Element Plus, ECharts, Pinia)
|
||||
```
|
||||
|
||||
### 模块说明
|
||||
### Module Relationships
|
||||
|
||||
| 模块 | 说明 |
|
||||
|---|---|
|
||||
| **system-admin** | 管理后台,包含气象数据管理、站点管理、文件查阅、系统管理(用户/角色/菜单/部门)、定时任务、日志管理 |
|
||||
| **system-api** | 对外开放的 REST API 服务,提供用户注册/登录等接口 |
|
||||
| **system-common** | 共享库,被所有子模块依赖 |
|
||||
| **weather-data-ui** | 前端 SPA,气象数据仪表盘、CRUD 页面、图表可视化 |
|
||||
```
|
||||
system-common <-- depended on by all backend modules
|
||||
system-dynamic-datasource <-- depended on by system-admin
|
||||
system-admin <-- runnable Spring Boot app, depends on both above
|
||||
weather-data-ui <-- independent frontend, communicates with system-admin via REST API
|
||||
```
|
||||
|
||||
---
|
||||
`system-common` provides the base class hierarchy (`BaseEntity`, `CrudService`, `CrudServiceImpl`), Redis utilities, validation framework, XSS protection, and shared utilities. All backend modules consume it.
|
||||
|
||||
## 技术栈
|
||||
`system-dynamic-datasource` provides the `@DataSource` annotation and `DynamicDataSource` (extends `AbstractRoutingDataSource`) for switching between multiple databases at runtime. Used by `system-admin` when queries need to target different data sources.
|
||||
|
||||
| 层级 | 技术 |
|
||||
|---|---|
|
||||
| 后端框架 | Spring Boot 3.5, MyBatis-Plus 3.5, Apache Shiro 1.12 |
|
||||
| 数据库 | MySQL 8.0(也支持达梦、Oracle、SQL Server、PostgreSQL) |
|
||||
| 缓存 | Redis 7(可选) |
|
||||
| 定时任务 | Quartz |
|
||||
| 接口文档 | Knife4j (Swagger) |
|
||||
| 前端框架 | Vue 3, TypeScript, Vite 5, Element Plus, Pinia, ECharts |
|
||||
`system-admin` is the main runnable application. It contains all business logic organized under `modules/`:
|
||||
|
||||
**环境要求**:JDK 17+, Maven 3.6+, Node.js 18+, MySQL 8.0+
|
||||
| Domain | Package | Description |
|
||||
|--------|---------|-------------|
|
||||
| Weather daily data | `modules/weather/dailydata/` | Excel batch import, CRUD, statistical summaries with Redis caching |
|
||||
| Weather stations | `modules/weather/station/` | Station registry, dept association for data scoping |
|
||||
| File scanning | `modules/weather/filescan/` | WatchService-based directory monitoring, auto-import of meteorological files |
|
||||
| Region management | `modules/region/` | Geographic region tree (province/city/county) |
|
||||
| System management | `modules/sys/` | Users, roles, menus, departments, dictionaries, parameters |
|
||||
| Alerts / notifications | `modules/sys/alert/` | SSE real-time push, Spring event-driven broadcast |
|
||||
| Security | `modules/security/` | Shiro + token-based auth, OAuth2 filter, password hashing |
|
||||
| Job scheduling | `modules/job/` | Quartz dynamic job management, online start/stop |
|
||||
| Audit logs | `modules/log/` | Operation log, login log, error log |
|
||||
| Cloud storage | `modules/oss/` | Alibaba Cloud / Qiniu / Tencent Cloud file storage |
|
||||
|
||||
---
|
||||
`weather-data-ui` is a Vue 3 SPA that communicates with `system-admin` via REST API. It features dynamic routing (routes loaded from server menus on login), tab-based navigation, ECharts visualization, and real-time SSE alert streaming.
|
||||
|
||||
## 快速启动(本地开发)
|
||||
## Tech Stack
|
||||
|
||||
### 1. 初始化数据库
|
||||
| Layer | Technology |
|
||||
|-------|-----------|
|
||||
| Backend framework | Spring Boot 3.5.11, MyBatis-Plus 3.5.8, Apache Shiro 1.12 |
|
||||
| Database | MySQL 8.0 (also supports Oracle, SQL Server, PostgreSQL, Dameng) |
|
||||
| Connection pool | Druid 1.2 |
|
||||
| Cache | Redis 7 (Lettuce client, optional via `project-options.redis.open`) |
|
||||
| Job scheduling | Quartz 2.3 |
|
||||
| API documentation | Knife4j 4.5 (Swagger) |
|
||||
| Excel processing | EasyExcel 3.2 |
|
||||
| Frontend | Vue 3.5, TypeScript 5.7, Vite 5.4, Element Plus 2.10, Pinia 2.3, ECharts 5 |
|
||||
|
||||
创建数据库 `weather_data_system`(UTF-8mb4),执行初始化脚本:
|
||||
**Requirements**: JDK 17+, Maven 3.6+, Node.js 18+, MySQL 8.0+
|
||||
|
||||
## Quick Start (Local Development)
|
||||
|
||||
### 1. Initialize Database
|
||||
|
||||
```bash
|
||||
mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS weather_data_system DEFAULT CHARSET utf8mb4"
|
||||
mysql -u root -p weather_data_system < system-admin/db/weather_data_system.sql
|
||||
```
|
||||
|
||||
### 2. 配置数据源
|
||||
### 2. Configure Datasource
|
||||
|
||||
编辑 `system-admin/src/main/resources/application-dev.yml`,修改 MySQL 连接信息:
|
||||
Edit `system-admin/src/main/resources/application-dev.yml`, update MySQL and Redis connection settings:
|
||||
|
||||
```yaml
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
url: jdbc:mysql://localhost:3306/weather_data_system?...
|
||||
url: jdbc:mysql://localhost:3306/weather_data_system?...
|
||||
username: root
|
||||
password: 你的密码
|
||||
password: your_password
|
||||
data:
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password:
|
||||
```
|
||||
|
||||
### 3. 启动后端
|
||||
### 3. Start Backend
|
||||
|
||||
```bash
|
||||
# 完整构建(跳过测试)
|
||||
# Full build
|
||||
mvn clean install -DskipTests
|
||||
|
||||
# IDEA 中直接运行 AdminApplication.java
|
||||
# Run from IDE: AdminApplication.java
|
||||
# Or from CLI:
|
||||
cd system-admin && mvn spring-boot:run -Dspring-boot.run.profiles=dev
|
||||
```
|
||||
|
||||
管理后台:http://localhost:8080/system-admin
|
||||
接口文档:http://localhost:8080/system-admin/doc.html(默认关闭,需在 `application.yml` 中启用 `knife4j.enable: true`)
|
||||
Admin backend: http://localhost:8080/system-admin
|
||||
API docs: http://localhost:8080/system-admin/doc.html
|
||||
Default account: `admin` / `admin`
|
||||
|
||||
默认账号:`admin` / `admin`
|
||||
|
||||
### 4. 启动前端
|
||||
### 4. Start Frontend
|
||||
|
||||
```bash
|
||||
cd weather-data-ui
|
||||
@@ -94,121 +111,47 @@ npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
前端开发服务器:http://localhost:8001
|
||||
Frontend dev server: http://localhost:8001
|
||||
|
||||
> **注意**:前端开发环境 `.env.development` 中 `VITE_APP_API` 默认指向 `http://192.168.2.186:8080/system-admin`,请按需修改为你的后端地址。
|
||||
Edit `weather-data-ui/.env.development` and set `VITE_APP_API` to your backend URL if needed.
|
||||
|
||||
---
|
||||
## Deployment
|
||||
|
||||
## 生产部署
|
||||
|
||||
项目提供两种部署方式,根据目标环境选用。
|
||||
|
||||
### Windows 一键部署
|
||||
|
||||
适用于 Windows Server 生产环境,自动安装 MySQL / Redis / Nginx 并部署前后端。
|
||||
|
||||
**部署包结构**(`deploy/` 目录,可独立拷贝到目标服务器):
|
||||
|
||||
```
|
||||
deploy/
|
||||
├── deploy.bat ← 一键部署(推荐,双击运行)
|
||||
├── deploy.ps1 ← PowerShell 版本
|
||||
├── templates/ ← 配置模板(deploy.bat 使用)
|
||||
├── project/
|
||||
│ ├── client-side/dist/ ← 前端构建产物
|
||||
│ └── server-side/
|
||||
│ ├── system-admin.jar ← 管理后台
|
||||
│ └── system-api.jar ← API 服务(可选)
|
||||
├── mysql/init/
|
||||
│ └── weather_data_system.sql ← 数据库初始化脚本
|
||||
├── nginx/nginx.conf ← Docker 网关配置
|
||||
└── software/ ← 第三方安装包
|
||||
├── mysql-installer-community-8.0.46.0.msi
|
||||
├── nginx-1.28.3.zip
|
||||
└── Redis-8.8.0-Windows-x64-Service.zip
|
||||
```
|
||||
|
||||
```cmd
|
||||
REM 以管理员身份运行命令提示符
|
||||
|
||||
deploy\deploy.bat :: 默认安装到 C:\weather-data
|
||||
|
||||
REM 部署完成后:
|
||||
C:\weather-data\start.bat :: 启动平台
|
||||
C:\weather-data\stop.bat :: 停止平台
|
||||
```
|
||||
|
||||
> **前置条件**:Windows 10 1803+ 或 Windows Server 2019+,需预装 JDK 17+。将 `deploy/` 目录完整拷贝至目标服务器后以管理员身份运行 `deploy.bat`。
|
||||
|
||||
### Docker 部署
|
||||
|
||||
适用于 Linux 服务器或支持 Docker 的 Windows 环境。编排包含 6 个服务:MySQL、Redis、Admin、API、UI、Gateway。
|
||||
|
||||
### 前置条件
|
||||
|
||||
1. 安装 Docker Engine 20.10+ 和 Docker Compose v2
|
||||
2. JAR 已构建到各模块的 `target/` 目录
|
||||
3. 前端已构建到 `weather-data-ui/dist/`
|
||||
|
||||
### 部署步骤
|
||||
### Docker Compose
|
||||
|
||||
```bash
|
||||
# 1. 构建所有模块
|
||||
# Build backend JARs and frontend dist
|
||||
mvn clean install -DskipTests
|
||||
cd weather-data-ui && npm run build && cd ..
|
||||
|
||||
# 2. 修改环境变量(密码等敏感信息)
|
||||
cp .env .env.local # 修改 .env.local 中的密码
|
||||
# Configure environment
|
||||
cp .env .env.local # Edit passwords in .env.local
|
||||
|
||||
# 3. 创建部署所需的 nginx 配置目录
|
||||
mkdir -p deploy/nginx deploy/mysql/init
|
||||
|
||||
# 4. 复制初始化 SQL
|
||||
cp system-admin/db/weather_data_system.sql deploy/mysql/init/
|
||||
|
||||
# 5. 启动
|
||||
# Start all services
|
||||
docker compose up -d
|
||||
|
||||
# 6. 访问
|
||||
# http://localhost → 前端页面
|
||||
# http://localhost:8080/system-admin → 管理后台
|
||||
# http://localhost:8081/renren-api → API 服务
|
||||
# Access
|
||||
# http://localhost -> Frontend (via nginx gateway)
|
||||
# http://localhost:8080 -> Admin backend
|
||||
```
|
||||
|
||||
### 常用命令
|
||||
Services: MySQL 8.0, Redis 7, Admin (Spring Boot), API (optional, port 8081), UI (nginx), Gateway (nginx reverse proxy, port 80).
|
||||
|
||||
```bash
|
||||
docker compose up -d # 启动所有服务
|
||||
docker compose down # 停止所有服务
|
||||
docker compose logs -f admin # 查看管理后台日志
|
||||
docker compose restart admin # 重启管理后台
|
||||
```
|
||||
### Windows Server
|
||||
|
||||
---
|
||||
See `deploy/` directory for one-click deployment scripts (`deploy.bat` / `deploy.ps1`). Requires Windows 10 1803+ or Windows Server 2019+, JDK 17+ pre-installed. Run as Administrator.
|
||||
|
||||
## 主要功能
|
||||
## Key Features
|
||||
|
||||
### 气象数据管理
|
||||
- **逐日观测数据**:支持 Excel 批量导入(异步双遍扫描,进度可查)、按站点/日期查询、统计分析、导出
|
||||
- **气象站点管理**:站点 CRUD,关联部门实现数据权限隔离
|
||||
- **气象资料查阅**:自动监控资料文件目录,支持在线查阅
|
||||
- **Weather data import**: Excel batch import with async two-pass processing, progress tracking, multi-row INSERT optimization
|
||||
- **Statistical analysis**: Same-date-across-years summarization with Redis caching, multi-dimensional queries
|
||||
- **File monitoring**: Automatic directory watching (WatchService), MD5 deduplication, file lifecycle management (receive -> display -> archive)
|
||||
- **Real-time notifications**: SSE-based alert streaming, Spring event-driven broadcast
|
||||
- **Data scoping**: Dept-level row-level security via MyBatis-Plus interceptor with `@DataFilter` annotation
|
||||
- **Dynamic datasource**: Runtime datasource switching via `@DataSource` annotation with ThreadLocal context
|
||||
- **Job scheduling**: Quartz-based dynamic job management with online start/stop/configure
|
||||
- **Cloud storage**: Alibaba Cloud OSS, Qiniu, Tencent Cloud COS integration
|
||||
|
||||
### 系统管理
|
||||
- 用户 / 角色 / 菜单 / 部门管理
|
||||
- 数据权限:`@DataFilter` 注解实现部门级数据隔离
|
||||
- 定时任务:Quartz 动态管理,支持在线启停
|
||||
- 操作日志 / 登录日志 / 异常日志
|
||||
- 文件存储(支持本地及云存储)
|
||||
## License
|
||||
|
||||
### 前端仪表盘
|
||||
- 气象数据多维度统计与图表可视化(ECharts)
|
||||
- 筛选、排序、导出(PNG/PDF)
|
||||
- 导入进度实时展示
|
||||
|
||||
---
|
||||
|
||||
## 参考链接
|
||||
|
||||
- [CLAUDE.md](CLAUDE.md) — 开发者文档(架构、规范、注意事项)
|
||||
- 基于 [renren-security](https://gitee.com/renrenio/renren-security) 二次开发
|
||||
Apache License 2.0
|
||||
|
||||
Reference in New Issue
Block a user