feat: 项目整体提交
- 更新项目配置文件 - 更新API文档 - 更新数据库文档 - 优化Redis配置 - 优化课程任务服务
This commit is contained in:
parent
8c56c9563a
commit
3db4fb2f98
12
pom.xml
12
pom.xml
@ -45,12 +45,12 @@
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<version>8.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-devtools</artifactId>-->
|
||||
<!-- <scope>runtime</scope>-->
|
||||
<!-- <optional>true</optional>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
@ -53,18 +53,20 @@ public class RedisConfig {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
|
||||
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
||||
template.setConnectionFactory(factory);
|
||||
template.setConnectionFactory(connectionFactory);
|
||||
|
||||
// 使用 GenericJackson2JsonRedisSerializer 进行序列化
|
||||
GenericJackson2JsonRedisSerializer jackson2JsonRedisSerializer = new GenericJackson2JsonRedisSerializer();
|
||||
|
||||
// 设置key的序列化方式
|
||||
// 设置 key 的序列化方式
|
||||
template.setKeySerializer(new StringRedisSerializer());
|
||||
// 设置value的序列化方式
|
||||
template.setValueSerializer(new GenericJackson2JsonRedisSerializer());
|
||||
// 设置hash key的序列化方式
|
||||
template.setHashKeySerializer(new StringRedisSerializer());
|
||||
// 设置hash value的序列化方式
|
||||
template.setHashValueSerializer(new GenericJackson2JsonRedisSerializer());
|
||||
|
||||
// 设置 value 的序列化方式
|
||||
template.setValueSerializer(jackson2JsonRedisSerializer);
|
||||
template.setHashValueSerializer(jackson2JsonRedisSerializer);
|
||||
|
||||
template.afterPropertiesSet();
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class LessonTaskService {
|
||||
validateRequest(request);
|
||||
LessonTask task = new LessonTask();
|
||||
BeanUtils.copyProperties(request, task);
|
||||
task.setProgressStatus(1); // 初始状态
|
||||
task.setProgressStatus(0); // 初始状态
|
||||
LessonTask savedTask = lessonTaskRepository.save(task);
|
||||
logger.info("创建课程任务成功 - 任务ID: {}", savedTask.getId());
|
||||
return savedTask;
|
||||
|
@ -18,4 +18,6 @@ jwt.expiration=604800000
|
||||
|
||||
# 日志配置
|
||||
logging.level.org.springframework.security=DEBUG
|
||||
logging.level.com.huertian.jinduguanli=DEBUG
|
||||
logging.level.com.huertian.jinduguanli=DEBUG
|
||||
|
||||
spring.devtools.restart.enabled=false
|
313
设计需求.md
313
设计需求.md
@ -1,313 +0,0 @@
|
||||
```
|
||||
CREATE TABLE departments
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(100) NOT NULL COMMENT '部门名称',
|
||||
description TEXT DEFAULT NULL COMMENT '部门描述',
|
||||
created_at BIGINT NOT NULL COMMENT '创建时间(时间戳)',
|
||||
updated_at BIGINT NOT NULL COMMENT '更新时间(时间戳)'
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='部门表';
|
||||
CREATE TABLE users
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
username VARCHAR(50) NOT NULL UNIQUE COMMENT '用户名',
|
||||
email VARCHAR(100) NOT NULL UNIQUE COMMENT '邮箱',
|
||||
password VARCHAR(100) NOT NULL COMMENT '密码',
|
||||
department_id BIGINT NOT NULL COMMENT '所属部门',
|
||||
roles INT NOT NULL COMMENT '角色: 1-教师, 2-普通管理员, 3-沟通联络人, 4-系统管理员',
|
||||
jobs INT NOT NULL COMMENT '岗位: 1-课程制作教师, 2-课程购买方项目负责人, 3-课程制作方沟通联络人, 4-系统制作方项目负责人',
|
||||
avatar VARCHAR(255) DEFAULT NULL COMMENT '头像',
|
||||
creator_id BIGINT NOT NULL DEFAULT 1 COMMENT '创建用户的管理员ID',
|
||||
status INT NOT NULL DEFAULT 1 COMMENT '用户状态: 1-正常, 2-禁用',
|
||||
created_at BIGINT NOT NULL COMMENT '创建时间(时间戳)',
|
||||
updated_at BIGINT NOT NULL COMMENT '更新时间(时间戳)',
|
||||
FOREIGN KEY (department_id) REFERENCES departments (id) ON DELETE RESTRICT,
|
||||
INDEX idx_users_department_id (department_id)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='用户表';
|
||||
CREATE TABLE lesson_tasks
|
||||
(
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
course_name VARCHAR(100) NOT NULL COMMENT '课程名称',
|
||||
micro_lesson_name VARCHAR(100) NOT NULL COMMENT '微课名称',
|
||||
user_id BIGINT NOT NULL COMMENT '负责人ID',
|
||||
progress_status INT NOT NULL DEFAULT 0 COMMENT '当前任务进度状态: 0-脚本上传, 1-脚本确认, 2-视频拍摄, 3-后期制作, 4-任务完成',
|
||||
script_upload_time BIGINT DEFAULT NULL COMMENT '脚本上传时间(时间戳)',
|
||||
script_confirm_time BIGINT DEFAULT NULL COMMENT '脚本确认时间(时间戳)',
|
||||
video_capture_time BIGINT DEFAULT NULL COMMENT '视频拍摄时间(时间戳)',
|
||||
video_confirm_time BIGINT DEFAULT NULL COMMENT '视频确认时间(时间戳)',
|
||||
finish_time BIGINT DEFAULT NULL COMMENT '任务完成时间(时间戳)',
|
||||
advise TEXT DEFAULT NULL COMMENT '任务建议或备注',
|
||||
created_at BIGINT NOT NULL COMMENT '创建时间(时间戳)',
|
||||
updated_at BIGINT NOT NULL COMMENT '更新时间(时间戳)',
|
||||
FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE,
|
||||
INDEX idx_lesson_tasks_user_id (user_id),
|
||||
INDEX idx_lesson_tasks_progress_status (progress_status)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='课程任务表';
|
||||
|
||||
INSERT INTO departments (name, description, created_at, updated_at)
|
||||
VALUES ('重庆眨生花科技有限公司', '重庆眨生花科技有限公司', NOW(), NOW()),
|
||||
('重庆电子科技职业大学', '重庆电子科技职业大学', NOW(), NOW());
|
||||
```
|
||||
|
||||
我修改了 我的表结构
|
||||
|
||||
接下来我将给你描述我的接口需求
|
||||
|
||||
**请求失败:**
|
||||
|
||||
返回错误状态码以:`10XX`开头。
|
||||
|
||||
错误代码`code`返回为 100XX。`message`为错误描述。
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 10005,
|
||||
"message": "邮箱已存在"
|
||||
}
|
||||
```
|
||||
|
||||
**请求成功:**
|
||||
|
||||
比失败请求会增加`data`字段。或直接返回最终结果。
|
||||
|
||||
1、登陆接口
|
||||
|
||||
## 用户管理
|
||||
|
||||
### 1.登录
|
||||
|
||||
接口描述: 使用密码登录
|
||||
|
||||
接口地址:http://127.0.0.1:8000/api/login
|
||||
|
||||
请求方式:POST
|
||||
|
||||
接口参数:
|
||||
|
||||
| 参数名字 | 类型 | 是否必须 | 默认值 | 其他 | 说明 |
|
||||
| :------- | :----- | :------- | :----- | :--- | :---------------------------- |
|
||||
| email | 整型 | 是 | | | 用户邮箱 |
|
||||
| password | 字符串 | 是 | | | 密码 |
|
||||
| remember | 布尔型 | 是 | false | | 会话 token 有效期,记住则更长 |
|
||||
|
||||
**返回结果**
|
||||
|
||||
成功示例:
|
||||
|
||||
| 参数名字 | 类型 | 说明 |
|
||||
| -------- | ------ | ---- |
|
||||
| token | 字符串 | |
|
||||
|
||||
```json
|
||||
{
|
||||
"token": ""
|
||||
}
|
||||
```
|
||||
|
||||
失败示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 10005,
|
||||
"message": "登录失败!请检查邮箱或者密码"
|
||||
}
|
||||
```
|
||||
|
||||
### 2.添加用户
|
||||
|
||||
接口描述: 手动添加用户
|
||||
|
||||
接口地址:http://127.0.0.1:8000/api/users
|
||||
|
||||
请求方式:POST
|
||||
|
||||
**接口参数**
|
||||
|
||||
| 参数名字 | 类型 | 是否必须 | 默认值 | 其他 | 说明 |
|
||||
| ------------- | ------ | -------- | ------ | ---- | ------ |
|
||||
| username | 字符串 | 是 | | | 用户名 |
|
||||
| email | 字符串 | 是 | | | 邮箱 |
|
||||
| password | 字符串 | 是 | | | 密码 |
|
||||
| roles | 整型 | 是 | | | 角色 |
|
||||
| department_id | 整型 | 是 | | | 部门 |
|
||||
| jobs | 整型 | 是 | | | 岗位 |
|
||||
|
||||
```json
|
||||
{
|
||||
"username": "test2",
|
||||
"email": "root2@cyqsd.cn",
|
||||
"password": "Abc123456",
|
||||
"roles": 4,
|
||||
"jobs": 4,
|
||||
"department_id": 1
|
||||
}
|
||||
```
|
||||
|
||||
**返回结果**
|
||||
|
||||
| 参数名字 | 类型 | 说明 |
|
||||
| -------- | ------ | ------------------ |
|
||||
| code | 整型 | 提示码 |
|
||||
| message | 字符串 | 是否成功的提示信息 |
|
||||
| data | 字符串 | 数据 ID |
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 10000,
|
||||
"message": "操作成功",
|
||||
"data": "3"
|
||||
}
|
||||
```
|
||||
|
||||
### 3.查看用户列表
|
||||
|
||||
接口描述: 查看用户列表
|
||||
|
||||
接口地址:http://127.0.0.1:8000/api/users?page=1&limit=10
|
||||
|
||||
请求方式:GET
|
||||
|
||||
**接口参数**
|
||||
|
||||
| 参数名字 | 类型 | 是否必须 | 默认值 | 其他 | 说明 |
|
||||
| -------- | ---- | -------- | ------ | ---- | ---- |
|
||||
| page | 整型 | 是 | 1 | | |
|
||||
| limit | 整型 | 是 | 10 | | |
|
||||
|
||||
### 4、查看单个用户
|
||||
|
||||
接口描述: 查看用户列表
|
||||
|
||||
接口地址:http://127.0.0.1:8000/api/users
|
||||
|
||||
请求方式:GET
|
||||
|
||||
| 参数名字 | 类型 | 是否必须 | 默认值 | 其他 | 说明 |
|
||||
| -------- | ---- | -------- | ------ | ---- | ------- |
|
||||
| id | 整型 | 是 | | | 用户 id |
|
||||
|
||||
### 5、删除用户
|
||||
|
||||
通过改变用户状态的方式 来将这个账户停止使用
|
||||
|
||||
将用户表的用户状态改变
|
||||
|
||||
### 6、更新账户
|
||||
|
||||
填了什么字段 就修改什么字段 没填写的字段 还是保留之前的数据
|
||||
|
||||
## 课程管理
|
||||
|
||||
### 1.查询列表
|
||||
|
||||
接口地址:http://127.0.0.1:8000/api/lesson/task?page=1&limit=1
|
||||
|
||||
接口描述: 查询课程管理列表。
|
||||
|
||||
请求方式:GET
|
||||
|
||||
**接口参数**
|
||||
|
||||
| 参数名字 | 类型 | 是否必须 | 默认值 | 其他 | 说明 |
|
||||
| -------- | ---- | -------- | ------ | ----------------- | -------- |
|
||||
| page | 整型 | 可选 | 1 | 最小:1 | 第几页 |
|
||||
| perpage | 整型 | 可选 | 10 | 最小:1;最大:20 | 分页数量 |
|
||||
| user_id | 整型 | 可选 | | | 用户 ID |
|
||||
|
||||
**返回结果**
|
||||
|
||||
| 参数名字 | 类型 | 说明 |
|
||||
| ------------------- | ------ | -------- |
|
||||
| course_name | 字符串 | 见下表 |
|
||||
| m_lesson_name | 字符串 | |
|
||||
| user_id | 整型 | |
|
||||
| schedule_status | 整型 | |
|
||||
| script_confirm_time | 整型 | |
|
||||
| video_confirm_time | 整型 | |
|
||||
| finish_time | 整型 | |
|
||||
| script_upload_time | 整型 | |
|
||||
| video_capture_time | 整型 | |
|
||||
| script_file | 字符串 | |
|
||||
| material_file | 字符串 | |
|
||||
| capture_file | 字符串 | |
|
||||
| advise | 字符串 | |
|
||||
| created_at | 整型 | 创建时间 |
|
||||
|
||||
### 2.新增数据
|
||||
|
||||
接口地址:http://127.0.0.1:8000/api/lesson/task
|
||||
|
||||
接口描述: 新增一条课程记录
|
||||
|
||||
请求方式:POST
|
||||
|
||||
Content-Type:application/json
|
||||
|
||||
**接口参数**
|
||||
|
||||
| 参数名字 | 类型 | 是否必须 | 默认值 | 其他 | 说明 |
|
||||
| ------------------- | ------ | -------- | --------- | ---- | ------------------------------ |
|
||||
| course_name | 字符串 | 是 | 最大:25 | | 课程名 |
|
||||
| m_lesson_name | 字符串 | 是 | 最大:25 | | 微课名 |
|
||||
| user_id | 整型 | 是 | 最大:10 | | 用户 ID |
|
||||
| schedule_status | 整型 | 否 | 最大:10 | | 当前进度 ID |
|
||||
| script_confirm_time | 整型 | 否 | 最大:10 | | 脚本确认时间 |
|
||||
| video_confirm_time | 整型 | 否 | 最大:10 | | 视频确认时间 |
|
||||
| finish_time | 整型 | 否 | 最大:10 | | 任务完成时间 |
|
||||
| script_upload_time | 整型 | 否 | 最大:10 | | 脚本上传时间 |
|
||||
| video_capture_time | 整型 | 否 | 最大:10 | | 视频拍摄时间 |
|
||||
| script_file | 字符串 | 否 | 最大:255 | | 脚本文件地址 |
|
||||
| material_file | 字符串 | 否 | 最大:255 | | 素材文件地址 |
|
||||
| capture_file | 字符串 | 否 | 最大:255 | | 拍摄结果文件地址 |
|
||||
| advise | 字符串 | 否 | 最大:255 | | 沟通建议列表,自行构建保存格式 |
|
||||
|
||||
**返回结果**
|
||||
|
||||
| 参数名字 | 类型 | 说明 |
|
||||
| -------- | ---- | ---- |
|
||||
| | 整型 | ID |
|
||||
|
||||
### [#](https://aigc-doc.cqrthny.com/pages/ppmp/#_3-修改数据)3.修改数据
|
||||
|
||||
接口地址:http://127.0.0.1:8000/api/lesson/task/2
|
||||
|
||||
接口描述: 修改一条课程记录
|
||||
|
||||
请求方式:PUT
|
||||
|
||||
Content-Type:application/json
|
||||
|
||||
**接口参数**
|
||||
|
||||
其他需要修改的字段,按`新增数据`小节中的内容修改。
|
||||
|
||||
### [#](https://aigc-doc.cqrthny.com/pages/ppmp/#_4-删除数据)4.删除数据
|
||||
|
||||
接口地址:http://127.0.0.1:8000/api/lesson/task/1
|
||||
|
||||
接口描述: 删除一条课程记录
|
||||
|
||||
请求方式:DELETE
|
||||
|
||||
**接口参数**
|
||||
|
||||
| 参数名字 | 类型 | 是否必须 | 默认值 | 其他 | 说明 |
|
||||
| -------- | ---- | -------- | ------ | ---- | ------------------- |
|
||||
| 无 | 整型 | 是 | 否 | | 待删除的课程记录 ID |
|
||||
|
||||
### 5.查询单条数据
|
||||
|
||||
接口地址:http://127.0.0.1:8000/api/lesson/task/1
|
||||
|
||||
接口描述: 查询单条课程记录
|
||||
|
||||
请求方式:GET
|
||||
|
||||
**接口参数**
|
||||
|
||||
| 参数名字 | 类型 | 是否必须 | 默认值 | 其他 | 说明 |
|
||||
| -------- | ---- | -------- | ------ | ---- | ---- |
|
||||
| 无 | | | | | |
|
Loading…
Reference in New Issue
Block a user