JMI-OPENATOMJMI-OPENATOM
首页
快速开始
  • 架构概览
  • 项目结构
  • 认证与权限
  • 数据库迁移
  • 配置说明
  • 开发规范
  • 架构概览
  • 项目结构
  • 路由与权限
  • API 请求
  • 组件库
  • UniApp 小程序
  • Docker 部署
  • CI/CD
  • Nginx 反向代理
  • 环境变量
  • QQ 机器人
  • 实验室管理系统
  • API 权限清单
  • 数据库表结构
  • 常见问题
首页
快速开始
  • 架构概览
  • 项目结构
  • 认证与权限
  • 数据库迁移
  • 配置说明
  • 开发规范
  • 架构概览
  • 项目结构
  • 路由与权限
  • API 请求
  • 组件库
  • UniApp 小程序
  • Docker 部署
  • CI/CD
  • Nginx 反向代理
  • 环境变量
  • QQ 机器人
  • 实验室管理系统
  • API 权限清单
  • 数据库表结构
  • 常见问题
  • 后端开发

    • 后端架构概览
    • 后端项目结构
    • 认证与权限
    • 数据库迁移(Flyway)
    • 配置说明
    • 后端开发规范

后端项目结构

包结构总览

后端代码位于 backend/src/main/java/edu/jmi/openatom/server/openatomsystem/ 下,采用标准的分层包结构:

openatomsystem/
├── OpenatomSystemApplication.java   # 主启动类
├── bootstrap/                       # 启动初始化器
├── cache/                           # 缓存
├── common/                          # 公共工具与常量
│   └── web/                         #   Web 拦截器
├── config/                          # 配置类
├── controller/                      # 控制器层
├── dto/                             # 请求 DTO
├── entity/                          # 数据库实体
├── enums/                           # 枚举
├── exception/                       # 异常处理
├── mapper/                          # MyBatis Mapper
├── security/                        # 安全服务
├── service/                         # 服务接口
│   └── impl/                        #   服务实现
├── aspect/                          # AOP 切面
└── vo/                              # 响应 VO

各包详解

bootstrap(启动初始化)

负责应用启动时的数据种子初始化:

类职责
SystemUserInitializer初始化默认超级管理员账号
SystemPermissionInitializer从 SystemPermission 枚举同步权限点到数据库
PermissionSeedCatalog权限种子目录定义
RoleSeedTemplate角色种子模板
UserSeedTemplate用户种子模板
DefaultClubInitializer创建默认社团
DefaultDepartmentInitializer创建默认部门
DefaultPositionInitializer创建默认岗位
DefaultMembershipInitializer创建默认成员关系
SchemaCompatibilityInitializer数据库 Schema 兼容性兜底
AvatarMaintenanceInitializer头像存储路径维护

config(配置类)

类职责
SaTokenConfigureSa-Token 配置(拦截器注册、CORS、JWT)
SaPermissionInterfaceImplSa-Token 权限接口实现(从数据库读取用户权限)
MybatisPlusConfigMyBatis Plus 配置(分页插件、自动填充)
RedisConfigRedis 序列化配置
FlywayRepairStrategyConfigFlyway 修复策略

common(公共工具)

类职责
Result<T>统一 API 响应封装
JsonsJSON 序列化/反序列化工具
Times时间处理工具
FormSchemaFields动态表单字段定义
PageRequests分页请求工具

common/web(Web 拦截器)

类职责
OperationLogInterceptor操作日志记录拦截器
ApplicationSubmitRateLimitInterceptor报名提交限流拦截器
ClientIpResolver客户端 IP 解析(支持 X-Forwarded-For)

controller(控制器层)

共有 44 个 Controller,按业务模块分组:

认证与用户

Controller路由前缀说明
AuthController/auth登录、登出、Token 刷新、当前用户信息
UserController/users用户 CRUD、角色分配、密码重置、导入
OidcController/oidcOIDC 认证端点
OauthClientController/oauthOAuth 客户端管理

社团管理

Controller路由前缀说明
ClubController/clubs社团 CRUD、状态管理
DepartmentController/clubs/{clubId}/departments部门管理
PositionController/clubs/{clubId}/positions岗位管理
MembershipController/memberships成员管理
ClubRegulationController/regulations社团规章制度

招新系统

Controller路由前缀说明
RecruitmentCampaignController/recruitment-campaigns招新计划
ApplicationController/applications入会申请
ApprovalController/applications/{id}/approvals审批流程
InterviewController/interviews面试管理

活动与签到

Controller路由前缀说明
ActivityController/activities活动 CRUD、报名
CheckInController/check-ins内部签到
AwardController/awards获奖记录
SchoolCalendarController/school-calendar校历管理

办公自动化

Controller路由前缀说明
LeaveApplicationController/leave-applications请假申请
LeaveAttachmentController/leave-attachments请假附件
OfficeDocumentController/office-documents文书管理
DocumentTemplateController/document-templates文书模板
NotificationController/notifications通知管理

互动功能

Controller路由前缀说明
BlogController/blog博客文章、评论、互动
VoteController/votes投票活动
LotteryController/lotteries抽奖活动
PointController/points积分系统

站点功能

Controller路由前缀说明
SiteController/site公开信息、注册开关
PublicController/public公开数据接口
SiteFormController/site-forms信息收集表单
FormSubmissionController/form-submissions表单提交
FileController/files文件上传
ImageHostingController/image-hosting图床服务

系统管理

Controller路由前缀说明
RoleController/roles角色管理
PermissionController/permissions权限点管理
LogController/operation-logs, /login-logs日志查询
DataOpenController/data-open数据开放平台
ShowcaseAppController/showcase-apps应用展示
AlumniGroupController/alumni-groups校友分组

AI 与机器人

Controller路由前缀说明
AiActivityAutomationController/ai-activityAI 活动自动化
AiSettingsController/ai/settingsAI 设置
BotManagementController/bot-managementQQ 群管理
BotUserLookupController/bot机器人用户查询

entity(实体类)

60+ 个实体类,与数据库表一一对应。主要实体包括:

  • 用户体系:User, UserRole, Role, RolePermission, Permission
  • 社团体系:Club, ClubDepartment, ClubPosition, ClubMembership, ClubPositionRole
  • 招新体系:MembershipApplication, ApprovalRecord, Interview, InterviewFeedback, InterviewInterviewer, RecruitmentCampaign
  • 活动体系:ClubActivity, ActivityRegistration, ClubAward
  • 签到体系:CheckInSession, CheckInGroup, CheckInGroupMember, CheckInRecord, CheckInTarget, CheckInExclusion
  • 办公体系:LeaveApplication, OfficeDocument, DocumentTemplate, GeneratedDocument, Notification, NotificationReceiver
  • 互动体系:BlogArticle, BlogComment, BlogArticleInteraction, VoteCampaign, VoteOption, VoteRecord, LotteryCampaign, LotteryPrize, LotteryWinner
  • 积分体系:PointAccount, PointTransaction, PointRedeemItem, PointRedemption
  • 系统体系:SystemSetting, OperationLog, LoginLog, SchoolCalendarSetting, SchoolCalendarAdjustment
  • OAuth 体系:OauthClient, OauthAuthorizationCode
  • 其他:SiteForm, FormSubmission, ImageHostingAsset, ShowcaseApp, DataOpenApplication, ClubRegulation, ClubAlumniGroup, ExitApplication, EveningStudySchedule, AiActivitySession, AiActivityPlan, AiActivityMessage, AiCallLog

enums(枚举)

枚举说明
SystemPermission系统权限点定义(100+ 权限点)
UserStatus用户状态(ACTIVE / DISABLED / DELETED)
VoteResultVisibility投票结果可见性

exception(异常处理)

类职责
GlobalExceptionHandlerAdvice全局异常处理器,统一异常 → Result 转换
RateLimitExceededException限流超限异常

aspect(AOP 切面)

类职责
ControllerLogAspectController 方法日志切面

Maven 依赖

核心依赖详见 backend/pom.xml:

<!-- Spring Boot -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-validation</artifactId>
</dependency>

<!-- Sa-Token 认证 -->
<dependency>
    <groupId>cn.dev33</groupId>
    <artifactId>sa-token-spring-boot3-starter</artifactId>
    <version>1.37.0</version>
</dependency>
<dependency>
    <groupId>cn.dev33</groupId>
    <artifactId>sa-token-jwt</artifactId>
    <version>1.37.0</version>
</dependency>

<!-- MyBatis Plus -->
<dependency>
    <groupId>com.baomidou</groupId>
    <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
    <version>3.5.5</version>
</dependency>

<!-- Flyway -->
<dependency>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-core</artifactId>
</dependency>
<dependency>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-mysql</artifactId>
</dependency>

<!-- Redis -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>

<!-- Excel -->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>5.3.0</version>
</dependency>
Prev
后端架构概览
Next
认证与权限