|
|
1 year ago | |
|---|---|---|
| .. | ||
| README.md | 1 year ago | |
| 助学金模块产品需求设计.md | 1 year ago | |
| 助学金管理原始需求.md | 1 year ago | |
| 勤工俭学产品需求分析书.md | 1 year ago | |
| 勤工俭学用户原始需求.md | 1 year ago | |
| 奖学金申请管理v2.0重构总结.md | 1 year ago | |
| 奖学金申请管理模块需求设计v2.0.md | 1 year ago | |
| 奖学金管理数据模型设计.md | 1 year ago | |
| 奖学金管理模块产品需求设计.md | 1 year ago | |
| 用户原始需求.md | 1 year ago | |
模块名称: 奖惩补贴系统 - 奖学金管理模块
设计时间: 2025-01-27
设计人员: AI Assistant
奖学金管理模块是校园管理系统的核心业务模块之一,负责处理奖学金的全生命周期管理,包括奖项设立、规则配置、评定批次、名额分配、学生申请、审核管理、获奖记录等核心业务场景。
| 文档名称 | 文件路径 | 说明 |
|---|---|---|
| 产品需求设计 | 奖学金管理模块产品需求设计.md |
完整的业务需求和功能设计 |
| 数据模型设计 | 奖学金管理数据模型设计.md |
详细的数据库设计和规则引擎 |
| 建表脚本 | 奖学金管理建表脚本.sql |
MySQL数据库建表SQL |
| 基础数据 | 奖学金管理基础数据.sql |
字典数据和示例配置 |
| 模块说明 | README.md |
本文档,总览和使用指南 |
graph TB
A[产品需求设计] --> B[数据模型设计]
B --> C[建表脚本]
B --> D[基础数据]
C --> E[后端开发]
D --> E
E --> F[前端开发]
A --> G[测试用例]
jcbt_scholarship_type - 奖学金类型表jcbt_scholarship_compatibility - 兼得关系表jcbt_scholarship_batch - 评定批次表jcbt_scholarship_rule - 评定规则主表jcbt_scholarship_rule_condition - 规则条件表 ⭐jcbt_scholarship_rule_action - 规则动作表jcbt_scholarship_quota - 名额分配表jcbt_scholarship_application - 申请记录表jcbt_scholarship_attachment - 申请材料表jcbt_scholarship_review - 审核记录表jcbt_scholarship_award - 获奖记录表{
"field_name": "gpa", // 字段名
"field_type": "NUMBER", // 字段类型
"operator_type": "GTE", // 操作符
"condition_value": "3.5", // 条件值
"weight": 0.4, // 权重
"condition_group": "MAIN" // 条件组
}
condition_group内为AND关系condition_group为OR关系bigint(20)create_by, create_time, update_by, update_timedeleted字段,禁止物理删除tenant_id字段隔离# 连接数据库
mysql -u root -p
# 选择数据库
use hzdyjs_xg;
# 执行建表脚本
source docs/需求文档/奖惩补贴需求/奖学金管理建表脚本.sql;
# 执行基础数据脚本
source docs/需求文档/奖惩补贴需求/奖学金管理基础数据.sql;
-- 检查表结构
SHOW TABLES LIKE 'jcbt_%';
-- 检查字典数据
SELECT * FROM sys_dict_data WHERE dict_type LIKE 'jcbt_%';
-- 检查示例奖学金类型
SELECT * FROM jcbt_scholarship_type;
backend/ruoyi-modules/ruoyi-jcbt/
├── src/main/java/org/dromara/jcbt/
│ ├── controller/ # 控制器层
│ ├── service/ # 服务层
│ ├── mapper/ # 数据访问层
│ ├── domain/
│ │ ├── entity/ # 实体类
│ │ ├── vo/ # 视图对象
│ │ └── bo/ # 业务对象
│ ├── event/ # 事件定义
│ └── listener/ # 事件监听器
└── src/main/resources/
└── mapper/ # MyBatis映射文件
web/src/views/jcbt/
├── type/ # 奖项管理
├── rule/ # 规则配置
├── batch/ # 批次管理
├── quota/ # 名额分配
├── application/ # 申请管理
├── review/ # 审核管理
├── award/ # 获奖记录
└── statistics/ # 统计报表
public boolean evaluateConditions(List<RuleCondition> conditions, StudentData student) {
Map<String, List<RuleCondition>> groupedConditions =
conditions.stream().collect(Collectors.groupingBy(RuleCondition::getConditionGroup));
// 组间OR关系,组内AND关系
return groupedConditions.entrySet().stream()
.anyMatch(entry -> entry.getValue().stream()
.allMatch(condition -> evaluateSingleCondition(condition, student))
);
}
public BigDecimal calculateScore(List<RuleCondition> conditions, StudentData student) {
return conditions.stream()
.filter(condition -> evaluateSingleCondition(condition, student))
.map(condition -> getFieldValue(student, condition.getFieldName())
.multiply(condition.getWeight()))
.reduce(BigDecimal.ZERO, BigDecimal::add);
}
public boolean checkCompatibility(Long studentId, Long scholarshipTypeId) {
List<Long> existingTypes = getStudentScholarships(studentId);
return existingTypes.stream()
.noneMatch(typeId -> isExclusive(typeId, scholarshipTypeId));
}
public QuotaUsageVo calculateQuotaUsage(Long batchId, Long deptId) {
List<ScholarshipQuota> quotas = quotaMapper.selectByBatchAndDept(batchId, deptId);
return quotas.stream()
.collect(Collectors.groupingBy(
ScholarshipQuota::getScholarshipTypeId,
Collectors.summingInt(q -> q.getTotalQuota() - q.getUsedQuota())
));
}
-- 申请查询优化
CREATE INDEX idx_app_batch_status_score ON jcbt_scholarship_application
(batch_id, current_status, final_score DESC);
-- 规则条件查询优化
CREATE INDEX idx_rule_condition_field ON jcbt_scholarship_rule_condition
(rule_id, field_name, operator_type);
// 避免深度分页,使用游标分页
public PageResult<ApplicationVo> getApplications(String lastId, int pageSize) {
return applicationMapper.selectByLastId(lastId, pageSize);
}
-- 外键关系检查
SELECT COUNT(*) FROM jcbt_scholarship_rule_condition
WHERE rule_id NOT IN (SELECT id FROM jcbt_scholarship_rule);
-- 数据一致性检查
SELECT * FROM jcbt_scholarship_quota
WHERE used_quota > total_quota;
@Test
public void testRuleEngine() {
// 测试GPA条件
RuleCondition gpaCondition = new RuleCondition();
gpaCondition.setFieldName("gpa");
gpaCondition.setOperatorType("GTE");
gpaCondition.setConditionValue("3.5");
StudentData student = new StudentData();
student.setGpa(new BigDecimal("3.7"));
assertTrue(ruleEngine.evaluateCondition(gpaCondition, student));
}
@Test
public void testPerformance() {
// 模拟1000个学生同时申请
List<Long> studentIds = IntStream.range(1, 1001)
.mapToObj(i -> (long) i)
.collect(Collectors.toList());
long startTime = System.currentTimeMillis();
studentIds.parallelStream()
.forEach(id -> scholarshipService.autoEvaluate(id, 1L));
long endTime = System.currentTimeMillis();
assertTrue("性能测试失败", (endTime - startTime) < 10000); // 10秒内完成
}
createBy, createTime, updateBy, updateTime)@SaCheckPermission注解🎯 总结: 奖学金管理模块的数据模型设计充分考虑了业务的复杂性和灵活性需求,通过规则引擎设计实现了高度可配置的评定逻辑,同时遵循项目的技术规范,为后续的功能开发奠定了坚实的基础。
📝 下一步: 基于此数据模型,开始后端API开发和前端页面实现。