# Weather Data Management System A full-stack meteorological data management and analysis platform built with Spring Boot 3.5 and Vue 3. > 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/ 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-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. `system-admin` is the main runnable application. It contains all business logic organized under `modules/`: | 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 | 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 | **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. Configure Datasource 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?... username: root password: your_password data: redis: host: 127.0.0.1 port: 6379 password: ``` ### 3. Start Backend ```bash # Full build mvn clean install -DskipTests # Run from IDE: AdminApplication.java # Or from CLI: cd system-admin && mvn spring-boot:run -Dspring-boot.run.profiles=dev ``` Admin backend: http://localhost:8080/system-admin API docs: http://localhost:8080/system-admin/doc.html Default account: `admin` / `admin` ### 4. Start Frontend ```bash cd weather-data-ui npm install npm run dev ``` Frontend dev server: http://localhost:8001 Edit `weather-data-ui/.env.development` and set `VITE_APP_API` to your backend URL if needed. ## Deployment ### Docker Compose ```bash # Build backend JARs and frontend dist mvn clean install -DskipTests cd weather-data-ui && npm run build && cd .. # Configure environment cp .env .env.local # Edit passwords in .env.local # Start all services docker compose up -d # 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). ### 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 - **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 ## License Apache License 2.0