Files
weather-data/README.md
T

6.2 KiB

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 | Module docs: system-admin | system-common | system-dynamic-datasource | weather-data-ui

Chinese version: 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

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:

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

# 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

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

  1. Build backend: mvn clean package -DskipTests -f system-admin
  2. Build frontend: cd weather-data-ui && npm run build
  3. Deploy system-admin/target/system-admin.jar and weather-data-ui/dist/ to server
  4. Configure application-prod.yml with production DB/Redis settings
  5. Start backend: java -jar system-admin.jar --spring.profiles.active=prod

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