diff --git a/.trae/documents/development_plan.md b/.trae/documents/development_plan.md new file mode 100644 index 0000000..02070a2 --- /dev/null +++ b/.trae/documents/development_plan.md @@ -0,0 +1,558 @@ +# 实训平台客户端后端开发计划 + +## 一、需求分析 + +根据《实训平台客户端完整需求文档(V2.0)》,需要实现以下核心模块: + +| 模块 | 功能点 | 状态 | +| :--- | :--- | :--- | +| **注册登录** | 手机号验证码注册、账号密码注册、微信扫码登录、自动注册 | 部分实现 | +| **通知中心** | 通知列表、详情查看、单条/全部已读 | 未实现 | +| **充值中心** | 充值套餐、套餐支付、自定义充值 | 已实现(沿用account/accountTransaction/paymentOrder表) | +| **教学管理** | 课程管理、作业管理、考试管理、考勤管理 | 未实现 | +| **优秀作品** | 作品展示、点赞互动 | 未实现 | +| **个人中心** | 个人信息、消费记录、订单记录、密码修改、手机号修改 | 部分实现 | + +## 二、技术架构 + +### 2.1 技术栈 +- **语言**: Java 17 +- **框架**: Spring Boot 3.2.2 +- **数据库**: MySQL +- **ORM**: MyBatis +- **缓存**: Redis + Redisson +- **认证**: Sa-Token +- **支付**: 微信支付 SDK、支付宝 SDK +- **文档**: SpringDoc OpenAPI + +### 2.2 代码结构 +``` +src/main/java/com/kexue/skills/ +├── annotation/ # 自定义注解 +├── aspect/ # AOP切面 +├── common/ # 通用工具类 +├── config/ # 配置类 +├── controller/ # 控制器 +├── entity/ # 实体类 +│ ├── base/ # 基础实体 +│ ├── dto/ # 数据传输对象 +│ ├── request/ # 请求对象 +│ └── response/ # 响应对象 +├── exception/ # 异常处理 +├── interceptor/ # 拦截器 +├── mapper/ # MyBatis映射器 +├── service/ # 业务服务 +│ └── impl/ # 服务实现 +└── SkillsApp.java # 启动类 +``` + +## 三、开发计划 + +### 阶段一:数据库表设计与初始化(预计1天) + +**任务1.1:设计并创建教学管理相关表** +- `edu_course` - 课程表 +- `edu_course_student` - 课程学生关联表 +- `edu_homework` - 作业表 +- `edu_homework_submit` - 作业提交表 +- `edu_exam` - 考试表 +- `edu_exam_paper` - 考试答卷表 +- `edu_attendance` - 考勤表 +- `edu_attendance_record` - 考勤记录表 + +**任务1.2:设计并创建通知表** +- `sys_notification` - 通知表 +- `sys_notification_read` - 通知已读记录表 + +**任务1.3:设计并创建优秀作品表** +- `edu_excellent_work` - 优秀作品表 +- `edu_work_like` - 作品点赞表 + +**任务1.4:扩展用户表字段** +- 添加院校相关字段:school_id, college_id, major_id, grade, class_name +- 添加角色字段:role_type (1-学生, 2-老师) +- 添加账户状态字段:account_status (1-可学用户, 2-试用用户, 3-学校用户, 4-冻结用户) +- 添加激活码相关字段:activation_code, binding_status + +### 阶段二:用户体系模块开发(预计2天) + +**任务2.1:完善注册功能** +- 添加学校/学院/专业/年级/班级选择接口 +- 实现手机号验证码注册 +- 实现账号密码注册 +- 支持默认角色为学生 + +**任务2.2:完善登录功能** +- 实现微信扫码登录(绑定wxid) +- 实现手机号密码登录 +- 完善自动注册逻辑 + +**任务2.3:院校绑定功能** +- 实现身份信息填写接口 +- 实现院校预校验接口 +- 实现激活码绑定接口 + +**任务2.4:个人中心功能** +- 个人信息查看与修改 +- 密码修改(含找回密码) +- 绑定手机号修改 + +### 阶段三:通知模块开发(预计1天) + +**任务3.1:通知管理接口** +- 获取通知列表(按时间倒序) +- 查看通知详情(自动标记已读) +- 单条通知已读 +- 全部通知已读 + +### 阶段四:教学管理模块开发(预计4天) + +**任务4.1:课程管理** +- 老师端:创建课程、管理课程、课程学生管理、导出成绩 +- 学生端:查看课程、查看课程内容 + +**任务4.2:作业管理** +- 老师端:作业草稿管理、发布作业、作业批改、优秀标记、删除作业 +- 学生端:查看作业、提交作业、修改作业、重做退回作业 + +**任务4.3:考试管理** +- 老师端:考试草稿管理、发布考试、阅卷管理、补考管理、删除考试 +- 学生端:查看考试、参加考试、参加补考 + +**任务4.4:考勤管理** +- 老师端:发起签到(二维码/手动点名)、管理签到记录、修改考勤状态 +- 学生端:扫码签到、查看考勤记录 + +### 阶段五:优秀作品模块开发(预计1天) + +**任务5.1:优秀作品展示** +- 获取优秀作品列表 +- 作品点赞(每个作品仅可点赞1次) + +### 阶段六:统一异常处理与安全加固(预计1天) + +**任务6.1:统一异常处理** +- 实现统一错误提示语 +- 完善全局异常处理器 + +**任务6.2:安全加固** +- 权限双重校验 +- 数据隔离机制 +- 操作日志留存 + +## 四、接口清单 + +### 4.1 用户体系接口 + +| API路径 | 方法 | 功能描述 | +| :--- | :--- | :--- | +| `/api/register/phone` | POST | 手机号验证码注册 | +| `/api/register/password` | POST | 账号密码注册 | +| `/api/login/wechat` | POST | 微信扫码登录 | +| `/api/login/phone` | POST | 手机号验证码登录 | +| `/api/login/password` | POST | 账号密码登录 | +| `/api/binding/school/check` | POST | 院校预校验 | +| `/api/binding/activation` | POST | 激活码绑定 | +| `/api/user/info` | GET | 获取个人信息 | +| `/api/user/info` | PUT | 修改个人信息 | +| `/api/user/password` | PUT | 修改密码 | +| `/api/user/phone` | PUT | 修改绑定手机号 | + +### 4.2 通知接口 + +| API路径 | 方法 | 功能描述 | +| :--- | :--- | :--- | +| `/api/notification/list` | GET | 获取通知列表 | +| `/api/notification/detail/{id}` | GET | 查看通知详情 | +| `/api/notification/read/{id}` | PUT | 标记单条已读 | +| `/api/notification/read/all` | PUT | 标记全部已读 | + +### 4.3 课程管理接口 + +| API路径 | 方法 | 功能描述 | +| :--- | :--- | :--- | +| `/api/course/list` | GET | 获取课程列表 | +| `/api/course/create` | POST | 创建课程 | +| `/api/course/update` | PUT | 修改课程信息 | +| `/api/course/delete/{id}` | DELETE | 删除课程 | +| `/api/course/students/{courseId}` | GET | 获取课程学生列表 | +| `/api/course/addStudents` | POST | 批量添加学生 | +| `/api/course/removeStudent` | DELETE | 踢出学生 | +| `/api/course/exportScore/{courseId}` | GET | 导出成绩 | + +### 4.5 作业管理接口 + +| API路径 | 方法 | 功能描述 | +| :--- | :--- | :--- | +| `/api/homework/list/{courseId}` | GET | 获取作业列表 | +| `/api/homework/create` | POST | 创建作业草稿 | +| `/api/homework/update` | PUT | 修改作业草稿 | +| `/api/homework/delete/{id}` | DELETE | 删除作业 | +| `/api/homework/publish` | PUT | 发布作业 | +| `/api/homework/submit` | POST | 提交作业 | +| `/api/homework/correct` | PUT | 批改作业 | +| `/api/homework/excellent/{id}` | PUT | 标记优秀 | +| `/api/homework/return` | PUT | 退回作业 | + +### 4.6 考试管理接口 + +| API路径 | 方法 | 功能描述 | +| :--- | :--- | :--- | +| `/api/exam/list/{courseId}` | GET | 获取考试列表 | +| `/api/exam/create` | POST | 创建考试草稿 | +| `/api/exam/update` | PUT | 修改考试草稿 | +| `/api/exam/delete/{id}` | DELETE | 删除考试 | +| `/api/exam/publish` | PUT | 发布考试 | +| `/api/exam/take/{examId}` | POST | 参加考试 | +| `/api/exam/correct` | PUT | 阅卷打分 | +| `/api/exam/makeup` | POST | 创建补考 | + +### 4.7 考勤管理接口 + +| API路径 | 方法 | 功能描述 | +| :--- | :--- | :--- | +| `/api/attendance/start` | POST | 发起签到 | +| `/api/attendance/list/{courseId}` | GET | 获取签到记录列表 | +| `/api/attendance/detail/{id}` | GET | 查看签到详情 | +| `/api/attendance/sign` | POST | 扫码签到 | +| `/api/attendance/status` | PUT | 修改考勤状态 | +| `/api/attendance/myList` | GET | 个人考勤记录 | + +### 4.8 优秀作品接口 + +| API路径 | 方法 | 功能描述 | +| :--- | :--- | :--- | +| `/api/excellent/list` | GET | 获取优秀作品列表 | +| `/api/excellent/like/{workId}` | POST | 点赞作品 | + +## 五、数据库表设计 + +### 5.1 用户表扩展字段 + +```sql +-- sys_user 表新增字段(仅添加通用字段,角色专属字段移至扩展表) +ALTER TABLE `sys_user` +ADD COLUMN `account_status` TINYINT(1) DEFAULT '1' COMMENT '账户状态:1-可学用户,2-试用用户,3-学校用户,4-冻结用户', +ADD COLUMN `wxid` VARCHAR(100) DEFAULT NULL COMMENT '微信ID'; +``` + +### 5.2 用户角色关联表 + +```sql +CREATE TABLE `sys_user_role` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `user_id` BIGINT(20) NOT NULL COMMENT '用户ID', + `role_code` VARCHAR(50) NOT NULL COMMENT '角色编码:student-学生,teacher-老师,admin-管理员', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_user_role` (`user_id`, `role_code`), + KEY `idx_user_id` (`user_id`), + KEY `idx_role_code` (`role_code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户角色关联表'; +``` + +### 5.3 学生扩展表 + +```sql +CREATE TABLE `edu_student` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `user_id` BIGINT(20) NOT NULL COMMENT '用户ID(关联sys_user)', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID', + `college_id` BIGINT(20) DEFAULT NULL COMMENT '学院ID', + `major_id` BIGINT(20) DEFAULT NULL COMMENT '专业ID', + `grade` VARCHAR(20) DEFAULT NULL COMMENT '年级', + `class_name` VARCHAR(50) DEFAULT NULL COMMENT '班级', + `student_no` VARCHAR(50) DEFAULT NULL COMMENT '学号', + `real_name` VARCHAR(50) DEFAULT NULL COMMENT '真实姓名', + `activation_code` VARCHAR(50) DEFAULT NULL COMMENT '激活码', + `binding_status` TINYINT(1) DEFAULT '0' COMMENT '绑定状态:0-未绑定,1-已绑定', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_user_id` (`user_id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_college_id` (`college_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生扩展表'; +``` + +### 5.4 教师扩展表 + +```sql +CREATE TABLE `edu_teacher` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `user_id` BIGINT(20) NOT NULL COMMENT '用户ID(关联sys_user)', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID', + `college_id` BIGINT(20) DEFAULT NULL COMMENT '学院ID', + `real_name` VARCHAR(50) DEFAULT NULL COMMENT '真实姓名', + `teacher_no` VARCHAR(50) DEFAULT NULL COMMENT '教师编号', + `title` VARCHAR(50) DEFAULT NULL COMMENT '职称', + `activation_code` VARCHAR(50) DEFAULT NULL COMMENT '激活码', + `binding_status` TINYINT(1) DEFAULT '0' COMMENT '绑定状态:0-未绑定,1-已绑定', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_user_id` (`user_id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_college_id` (`college_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='教师扩展表'; +``` + +### 5.5 通知表 + +```sql +CREATE TABLE `sys_notification` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `user_id` BIGINT(20) NOT NULL COMMENT '用户ID', + `title` VARCHAR(100) NOT NULL COMMENT '通知标题', + `content` TEXT NOT NULL COMMENT '通知内容', + `type` TINYINT(1) DEFAULT '1' COMMENT '通知类型:1-系统通知,2-作业通知,3-考试通知,4-考勤通知', + `is_read` TINYINT(1) DEFAULT '0' COMMENT '是否已读:0-未读,1-已读', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_user_id` (`user_id`), + KEY `idx_is_read` (`is_read`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='通知表'; +``` + +### 5.6 课程表 + +```sql +CREATE TABLE `edu_course` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `name` VARCHAR(100) NOT NULL COMMENT '课程名称', + `cover` VARCHAR(255) DEFAULT NULL COMMENT '课程封面', + `description` TEXT DEFAULT NULL COMMENT '课程简介', + `class_time` VARCHAR(100) DEFAULT NULL COMMENT '上课时间', + `teaching_method` TINYINT(1) DEFAULT '1' COMMENT '授课方式:1-线上,2-线下,3-混合', + `teacher_id` BIGINT(20) NOT NULL COMMENT '创建老师ID', + `status` TINYINT(1) DEFAULT '1' COMMENT '课程状态:1-进行中,2-已结课', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_teacher_id` (`teacher_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='课程表'; +``` + +### 5.7 课程学生关联表 + +```sql +CREATE TABLE `edu_course_student` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `course_id` BIGINT(20) NOT NULL COMMENT '课程ID', + `student_id` BIGINT(20) NOT NULL COMMENT '学生ID', + `join_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '加入时间', + `is_kicked` TINYINT(1) DEFAULT '0' COMMENT '是否被踢出:0-正常,1-已踢出', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_course_student` (`course_id`, `student_id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_course_id` (`course_id`), + KEY `idx_student_id` (`student_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='课程学生关联表'; +``` + +### 5.8 作业表 + +```sql +CREATE TABLE `edu_homework` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `course_id` BIGINT(20) NOT NULL COMMENT '课程ID', + `name` VARCHAR(100) NOT NULL COMMENT '作业名称', + `requirement` TEXT DEFAULT NULL COMMENT '作业要求', + `questions` TEXT NOT NULL COMMENT '题目JSON', + `allow_late` TINYINT(1) DEFAULT '0' COMMENT '是否允许迟交', + `start_time` DATETIME NOT NULL COMMENT '开始时间', + `end_time` DATETIME NOT NULL COMMENT '截止时间', + `status` TINYINT(1) DEFAULT '1' COMMENT '状态:1-草稿,2-已发布', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_course_id` (`course_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='作业表'; +``` + +### 5.9 作业提交表 + +```sql +CREATE TABLE `edu_homework_submit` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `homework_id` BIGINT(20) NOT NULL COMMENT '作业ID', + `student_id` BIGINT(20) NOT NULL COMMENT '学生ID', + `answers` TEXT NOT NULL COMMENT '答案JSON', + `submit_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '提交时间', + `is_late` TINYINT(1) DEFAULT '0' COMMENT '是否迟交', + `status` TINYINT(1) DEFAULT '1' COMMENT '状态:1-待批改,2-已批改,3-已退回', + `score` DECIMAL(5,2) DEFAULT NULL COMMENT '分数', + `comment` TEXT DEFAULT NULL COMMENT '评语', + `is_excellent` TINYINT(1) DEFAULT '0' COMMENT '是否优秀', + `redo_end_time` DATETIME DEFAULT NULL COMMENT '重做截止时间', + `redo_count` INT(11) DEFAULT '0' COMMENT '重做次数', + PRIMARY KEY (`id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_homework_id` (`homework_id`), + KEY `idx_student_id` (`student_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='作业提交表'; +``` + +### 5.10 考试表 + +```sql +CREATE TABLE `edu_exam` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `course_id` BIGINT(20) NOT NULL COMMENT '课程ID', + `name` VARCHAR(100) NOT NULL COMMENT '考试名称', + `requirement` TEXT DEFAULT NULL COMMENT '考试要求', + `questions` TEXT NOT NULL COMMENT '考卷JSON', + `duration` INT(11) NOT NULL COMMENT '考试时长(分钟)', + `start_time` DATETIME NOT NULL COMMENT '开始时间', + `end_time` DATETIME NOT NULL COMMENT '截止时间', + `status` TINYINT(1) DEFAULT '1' COMMENT '状态:1-草稿,2-已发布,3-已结束', + `is_makeup` TINYINT(1) DEFAULT '0' COMMENT '是否补考', + `parent_exam_id` BIGINT(20) DEFAULT NULL COMMENT '关联主考ID', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_course_id` (`course_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='考试表'; +``` + +### 5.11 考试答卷表 + +```sql +CREATE TABLE `edu_exam_paper` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `exam_id` BIGINT(20) NOT NULL COMMENT '考试ID', + `student_id` BIGINT(20) NOT NULL COMMENT '学生ID', + `answers` TEXT NOT NULL COMMENT '答案JSON', + `submit_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '提交时间', + `status` TINYINT(1) DEFAULT '1' COMMENT '状态:1-待阅卷,2-已阅卷', + `score` DECIMAL(5,2) DEFAULT NULL COMMENT '分数', + `comment` TEXT DEFAULT NULL COMMENT '评语', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_exam_student` (`exam_id`, `student_id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_exam_id` (`exam_id`), + KEY `idx_student_id` (`student_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='考试答卷表'; +``` + +### 5.12 考勤表 + +```sql +CREATE TABLE `edu_attendance` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `course_id` BIGINT(20) NOT NULL COMMENT '课程ID', + `name` VARCHAR(100) DEFAULT NULL COMMENT '签到名称(按时间自动生成)', + `start_time` DATETIME NOT NULL COMMENT '开始时间', + `duration` INT(11) DEFAULT '15' COMMENT '签到时长(分钟)', + `type` TINYINT(1) DEFAULT '1' COMMENT '签到类型:1-二维码签到,2-手动点名', + `status` TINYINT(1) DEFAULT '1' COMMENT '状态:1-进行中,2-已结束', + `qr_code` VARCHAR(255) DEFAULT NULL COMMENT '二维码内容', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_course_id` (`course_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='考勤表'; +``` + +### 5.13 考勤记录表 + +```sql +CREATE TABLE `edu_attendance_record` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `attendance_id` BIGINT(20) NOT NULL COMMENT '考勤ID', + `student_id` BIGINT(20) NOT NULL COMMENT '学生ID', + `status` TINYINT(1) DEFAULT '1' COMMENT '考勤状态:1-出勤,2-迟到,3-缺勤,4-请假', + `sign_time` DATETIME DEFAULT NULL COMMENT '签到时间', + `remark` VARCHAR(255) DEFAULT NULL COMMENT '备注(手动点名时填写)', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_attendance_student` (`attendance_id`, `student_id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_attendance_id` (`attendance_id`), + KEY `idx_student_id` (`student_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='考勤记录表'; +``` + +### 5.14 优秀作品表 + +```sql +CREATE TABLE `edu_excellent_work` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `work_type` TINYINT(1) NOT NULL COMMENT '作品类型:1-作业,2-考试', + `work_id` BIGINT(20) NOT NULL COMMENT '关联作业/考试ID', + `submit_id` BIGINT(20) NOT NULL COMMENT '关联提交ID', + `student_id` BIGINT(20) NOT NULL COMMENT '学生ID', + `score` DECIMAL(5,2) DEFAULT NULL COMMENT '分数', + `comment` TEXT DEFAULT NULL COMMENT '评语', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '标记时间', + PRIMARY KEY (`id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_work_type_work_id` (`work_type`, `work_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='优秀作品表'; +``` + +### 5.15 作品点赞表 + +```sql +CREATE TABLE `edu_work_like` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `work_id` BIGINT(20) NOT NULL COMMENT '优秀作品ID', + `user_id` BIGINT(20) NOT NULL COMMENT '点赞用户ID', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '点赞时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_work_user` (`work_id`, `user_id`), + KEY `idx_school_id` (`school_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='作品点赞表'; +``` + +## 六、开发进度安排 + +| 阶段 | 任务 | 预计天数 | 负责人 | +| :--- | :--- | :--- | :--- | +| 第一阶段 | 数据库表设计与初始化 | 1 | 开发人员 | +| 第二阶段 | 用户体系模块开发 | 2 | 开发人员 | +| 第三阶段 | 通知模块开发 | 1 | 开发人员 | +| 第四阶段 | 教学管理模块开发 | 4 | 开发人员 | +| 第五阶段 | 优秀作品模块开发 | 1 | 开发人员 | +| 第六阶段 | 统一异常处理与安全加固 | 1 | 开发人员 | +| **总计** | | **10天** | | + +## 七、风险与注意事项 + +### 7.1 风险识别 + +| 风险 | 描述 | 应对措施 | +| :--- | :--- | :--- | +| 数据权限安全 | 用户可能越权访问其他用户数据 | 前端展示+后端接口双重校验,token验证 | +| 并发问题 | 高并发场景下的数据一致性问题 | 使用Redis分布式锁,数据库事务 | +| 支付安全 | 支付回调可能被篡改 | 验证签名,使用安全的回调地址 | +| 接口幂等性 | 重复提交导致数据重复 | 使用防重复提交注解,唯一业务ID | + +### 7.2 注意事项 + +1. **权限校验**:所有API查询严格校验token与对应用户ID +2. **数据排序**:所有数据获取接口默认按日期最新排序 +3. **操作留痕**:课程/作业/考试/考勤/充值操作全量日志留存≥1年 +4. **流程不可逆**:院校绑定、注册登录、作业考试发布流程严格按文档执行 +5. **异常处理**:统一错误提示语,返回标准化错误信息 + +--- + +**文档版本**: V1.0 +**创建时间**: 2026-04-30 +**创建人**: 系统生成 \ No newline at end of file diff --git a/.trae/documents/notification_plan.md b/.trae/documents/notification_plan.md new file mode 100644 index 0000000..4788256 --- /dev/null +++ b/.trae/documents/notification_plan.md @@ -0,0 +1,206 @@ +# 通知功能实现方案 + +## 1. 需求分析 + +根据业务描述,通知系统需要支持以下功能: + +### 1.1 系统通知 +- 次级管理员增加/删除学校管理员 → 主要管理员可见 +- 次级管理员增加/修改/删除套餐 → 主要管理员可见 +- 老师的系统通知 → 主要管理员可见 + +### 1.2 管理员对用户通知(层级发送) + +| 角色 | 可通知对象 | 说明 | +|------|-----------|------| +| 主要管理员(SUPER) | 次级管理员、学校管理员、学院管理员、老师、学生 | 可多选 | +| 次级管理员(SUPER1) | 学校管理员、学院管理员、老师、学生 | 可多选 | +| 学校管理员(SCOOL_ADMIN) | 学院管理员、老师、学生 | 可多选 | +| 学院管理员(COLLEGE_ADMIN) | 老师、学生 | 可多选 | +| 老师(TEACHER) | 指定课程的学生 | 课程可多选 | +| 学生(STUDENT) | 仅收件箱 | 无发送权限 | + +### 1.3 核心需求(用户明确) +1. **通知创建人** - 需要记录发送者信息 +2. **发送目标** - 需要记录接收人信息 +3. **通知类型** - 需要支持多种类型 + +--- + +## 2. 当前代码分析 + +### 2.1 现有通知实体 (`SysNotification`) + +| 字段 | 类型 | 说明 | 当前状态 | +|------|------|------|----------| +| id | Long | 主键ID | ✅ 存在 | +| schoolId | Long | 学校ID(数据隔离) | ✅ 存在 | +| userId | Long | 用户ID | ✅ 存在(作为接收者ID) | +| title | String | 通知标题 | ✅ 存在 | +| content | String | 通知内容 | ✅ 存在 | +| type | Integer | 通知类型 | ✅ 存在(仅4种) | +| isRead | Integer | 是否已读 | ✅ 存在(用户表示可保留) | +| createTime | Date | 创建时间 | ✅ 存在 | + +### 2.2 现有问题 + +| 问题 | 说明 | +|------|------| +| 缺少发送者信息 | 当前只有接收者ID(userId),缺少发送者ID和姓名 | +| 通知类型不足 | 只有4种类型,缺少用户通知和课程通知 | +| 缺少批量发送功能 | 当前只能单条发送给单个用户 | +| 缺少角色层级控制 | 没有实现角色层级的发送权限控制 | + +--- + +## 3. 实现方案(最小化修改) + +### 3.1 数据库表结构调整 + +**新增字段到 `sys_notification` 表:** + +| 字段名 | 类型 | 约束 | 说明 | +|--------|------|------|------| +| sender_id | BIGINT | NULL | 发送者用户ID | +| sender_name | VARCHAR(100) | NULL | 发送者姓名 | +| target_type | TINYINT(1) | DEFAULT 1 | 目标类型:1-单个用户,2-角色,3-课程 | + +**更新通知类型定义:** + +| 类型值 | 类型名称 | 说明 | +|--------|----------|------| +| 1 | 系统通知 | 系统自动生成的通知 | +| 2 | 作业通知 | 作业相关通知 | +| 3 | 考试通知 | 考试相关通知 | +| 4 | 考勤通知 | 考勤相关通知 | +| 5 | 用户通知 | 管理员发送给用户的通知 | +| 6 | 课程通知 | 老师发送给课程学生的通知 | + +### 3.2 实体类修改 (`SysNotification.java`) + +```java +// 新增字段 +@Schema(description = "发送者用户ID") +private Long senderId; + +@Schema(description = "发送者姓名") +private String senderName; + +@Schema(description = "目标类型:1-单个用户,2-角色,3-课程") +private Integer targetType; +``` + +### 3.3 新增请求DTO + +**`SendNotificationRequest.java`** - 发送通知请求 + +| 字段 | 类型 | 必填 | 说明 | +|------|------|------|------| +| schoolId | Long | 是 | 学校ID | +| title | String | 是 | 通知标题 | +| content | String | 是 | 通知内容 | +| type | Integer | 是 | 通知类型(5-用户通知, 6-课程通知) | +| targetUserIds | List | 否 | 目标用户ID列表 | +| targetRoleTypes | List | 否 | 目标角色类型列表 | +| courseIds | List | 否 | 课程ID列表(老师群发) | + +### 3.4 Service层增强 + +**新增接口方法 (`SysNotificationService.java`):** + +```java +/** + * 发送用户通知(批量发送给指定角色或用户) + */ +void sendUserNotification(Long schoolId, Long senderId, String senderName, + String title, String content, + List targetUserIds, List targetRoleTypes); + +/** + * 发送课程通知(老师群发课程消息) + */ +void sendCourseNotification(Long schoolId, Long teacherId, String teacherName, + String title, String content, List courseIds); + +/** + * 发送系统通知给指定用户 + */ +void sendSystemNotification(Long schoolId, List targetUserIds, + String title, String content); + +/** + * 获取当前用户可通知的下级角色类型 + */ +List getAvailableTargetRoles(Long currentUserId); + +/** + * 获取指定角色类型下的用户列表 + */ +List getUsersByRoleTypes(Long schoolId, List roleTypes); +``` + +### 3.5 Controller层增强 + +**新增接口 (`SysNotificationController.java`):** + +| 接口 | 方法 | 权限 | 说明 | +|------|------|------|------| +| `/api/notification/send-to-users` | POST | 管理员/老师 | 发送通知给指定用户 | +| `/api/notification/send-to-roles` | POST | 管理员/老师 | 发送通知给指定角色 | +| `/api/notification/send-to-course` | POST | TEACHER | 发送课程通知 | +| `/api/notification/available-targets` | GET | 登录用户 | 获取当前用户可通知的目标角色 | + +### 3.6 角色层级权限控制 + +**角色层级关系与可通知范围:** + +| 当前角色 | roleType | 可通知角色类型 | +|----------|----------|---------------| +| SUPER | 1 | [1, 2, 3, 4, 5] | +| SUPER1 | 1 | [2, 3, 4, 5] | +| SCOOL_ADMIN | 2 | [3, 4, 5] | +| COLLEGE_ADMIN | 3 | [4, 5] | +| TEACHER | 4 | [5] (仅限自己课程的学生) | +| STUDENT | 5 | [] (无发送权限) | + +--- + +## 4. 文件修改清单 + +| 文件路径 | 修改类型 | 说明 | +|----------|----------|------| +| `entity/SysNotification.java` | 修改 | 新增 senderId, senderName, targetType 字段 | +| `entity/request/SendNotificationRequest.java` | 新增 | 发送通知请求DTO | +| `service/SysNotificationService.java` | 修改 | 新增接口方法 | +| `service/impl/SysNotificationServiceImpl.java` | 修改 | 实现新增方法 | +| `controller/SysNotificationController.java` | 修改 | 新增接口 | +| `mapper/SysNotificationMapper.java` | 修改 | 新增批量插入方法 | +| `mapper/SysNotificationMapper.xml` | 修改 | 新增批量插入SQL | +| `db/create_edu_tables.sql` | 修改 | 添加新字段 | +| `db/sys_role_permission_data_init_merged.sql` | 修改 | 添加发送通知权限 | + +--- + +## 5. 权限配置 + +**新增权限码:** + +| 权限码 | 权限名称 | 适用角色 | +|--------|----------|----------| +| `notification:send:users` | 发送通知给用户 | SUPER, SUPER1, SCOOL_ADMIN, COLLEGE_ADMIN | +| `notification:send:course` | 发送课程通知 | TEACHER | + +--- + +## 6. 总结 + +**当前代码是否满足需求:** + +| 需求 | 当前状态 | 需要修改 | +|------|----------|----------| +| 通知创建人 | ❌ 缺少发送者信息 | 新增 senderId, senderName | +| 发送目标 | ✅ userId作为接收者 | 支持批量发送 | +| 通知类型 | ❌ 只有4种 | 新增类型5和6 | +| 角色层级控制 | ❌ 未实现 | 新增权限验证逻辑 | + +**结论:当前代码不满足需求,需要进行上述修改。** \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 4ccb133..0000000 --- a/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM openjdk:8-jdk-alpine -MAINTAINER kexue -VOLUME /tmp -ADD target/hyxp-portal.jar app.jar -ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] \ No newline at end of file diff --git a/PAYMENT_GUIDE.md b/PAYMENT_GUIDE.md deleted file mode 100644 index c004fcb..0000000 --- a/PAYMENT_GUIDE.md +++ /dev/null @@ -1,603 +0,0 @@ -# 支付功能使用指南 - -## 📋 概述 - -本项目已完整接入**微信支付**和**支付宝支付**,支持内容购买、账户充值等支付场景。 - ---- - -## 一、配置信息 - -### 1.1 微信支付配置 - -位置:`src/main/resources/application-dev.yml` 和 `src/main/resources/application-prod.yml` - -```yaml -payment: - wechat: - appId: wx7d13d99de5be3bfa # 微信应用 ID - mchId: 1673321732 # 商户号 - mchKey: UDuZXDcmy5Eb6o0nTNZhu6ek4DDh4K8B # 商户密钥 - mchSerialNo: 5EFC47D3AA59BFD1AAE548F96B5E19E1C60F067D # 商户证书序列号 - privateKeyPath: apiclient_key.pem # 商户私钥文件路径 - domain: https://api.mch.weixin.qq.com # 微信服务器地址 - notifyUrl: http://127.0.0.1:19001/api/pay/wx/notify # 支付回调地址 - returnUrl: http://127.0.0.1:19001/api/pay/success # 支付成功跳转地址 -``` - -### 1.2 支付宝支付配置 - -```yaml -payment: - alipay: - appId: 2021004138642603 # 支付宝应用 ID - publicKey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnakP04nUmsoFoveIvOhbLqkA1xQuYtvkrqq2AVvTsbtqpsEOTm9G095e2rBYLp89oDcf6L6BhtJPwdrhnA+qifUyVmACI9sprrsGeRYQgndK7y4c6spQcSnsnakSxlIp22j7pvBXNAZuqud2hQV+TOLKEUh1W3izTgMj/Ejoh3ZsCjgDRtTVgaytzSdHYrhNku+pIrl15/xVGJED99RYXkR8GHawxuK+vWVmxU0tiTCwTsqLz43v6TtCZ+/UfLL/luwp9B4ZvB+0qon82LILYr6oxs10kE2IAvryuDToAc1s/v/36jgt+7DXwqzfUDksHhVLHdJHChyc4ax5HmMsBwIDAQAB" # 支付宝公钥 - privateKey: "" # 商户私钥(需配置) - notifyUrl: http://127.0.0.1:19001/api/pay/alipay/trade/notify # 支付回调地址 - returnUrl: https://shuziren.xueai.art/alipay-success # 支付成功跳转地址 - signType: RSA2 # 签名类型 - charset: UTF-8 # 字符编码 - gatewayUrl: https://openapi.alipay.com/gateway.do # 支付宝网关 -``` - ---- - -## 二、API 接口说明 - -### 2.1 创建微信支付订单 - -**接口地址:** `POST /api/pay/wx/create` - -**请求参数:** - -| 参数 | 类型 | 必填 | 说明 | -|------|------|------|------| -| orderNo | String | 否 | 订单号(不传则自动生成) | -| userId | Long | 是 | 用户 ID | -| userName | String | 是 | 用户名 | -| amount | BigDecimal | 是 | 支付金额(单位:元) | -| productName | String | 是 | 商品名称 | -| productDesc | String | 否 | 商品描述 | -| businessId | Long | 是 | 关联业务 ID | -| businessType | String | 是 | 业务类型:recharge(充值)/purchase_content(购买内容) | - -**请求示例:** - -```bash -curl -X POST http://localhost:19001/api/pay/wx/create \ - -H "Content-Type: application/json" \ - -d '{ - "userId": 123, - "userName": "张三", - "amount": 0.01, - "productName": "测试商品", - "productDesc": "商品描述", - "businessId": 456, - "businessType": "purchase_content" - }' -``` - -**响应示例:** - -```json -{ - "code": 200, - "message": "success", - "data": { - "code_url": "weixin://wxpay/bizpayurl?pr=xxx", - "order_no": "ORDER_20260331_001" - } -} -``` - -**字段说明:** -- `code_url`: 微信支付二维码链接,前端可使用此链接生成二维码 -- `order_no`: 支付订单号,用于后续查询订单状态 - ---- - -### 2.2 创建支付宝支付订单 - -**接口地址:** `POST /api/pay/alipay/create` - -**请求参数:** 与微信支付相同 - -**请求示例:** - -```bash -curl -X POST http://localhost:19001/api/pay/alipay/create \ - -H "Content-Type: application/json" \ - -d '{ - "userId": 123, - "userName": "张三", - "amount": 0.01, - "productName": "测试商品", - "businessId": 456, - "businessType": "purchase_content" - }' -``` - -**响应示例:** - -```json -{ - "code": 200, - "message": "success", - "data": "
...
" -} -``` - -**使用说明:** -- 返回的是 HTML 表单字符串 -- 前端将此外壳写入页面后会自动提交跳转到支付宝支付页面 - ---- - -### 2.3 支付回调接口(系统自动处理) - -#### 微信支付回调 - -**接口地址:** `POST /api/pay/wx/notify` - -**说明:** -- 由微信支付服务器自动调用 -- 处理支付结果并更新订单状态 -- 返回 XML 格式响应给微信服务器 - -#### 支付宝支付回调 - -**异步回调:** `POST /api/pay/alipay/trade/notify` - -**同步回调:** `GET /api/pay/alipay/trade/return` - -**说明:** -- 异步回调由支付宝服务器自动调用 -- 同步回调用于用户支付完成后跳转回指定页面 - ---- - -## 三、使用场景示例 - -### 3.1 场景 1:购买付费内容 - -**业务流程:** - -1. 用户点击购买按钮 -2. 创建购买记录(待支付状态) -3. 创建支付订单 -4. 用户扫码或跳转支付 -5. 支付成功后更新订单和购买记录状态 - -**前端调用示例:** - -```javascript -// 步骤 1:创建购买记录 -const purchaseResponse = await fetch('/api/content/purchase', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ - userId: 123, - contentId: 456, - payType: 3 // 3=微信支付,4=支付宝支付 - }) -}); - -const purchaseResult = await purchaseResponse.json(); - -// 步骤 2:创建支付订单 -const payResponse = await fetch('/api/pay/wx/create', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ - userId: 123, - amount: 9.99, - productName: 'AI 技能教程', - productDesc: '高级 AI 技能培训内容', - businessId: 456, - businessType: 'purchase_content' - }) -}); - -const payResult = await payResponse.json(); - -if (payResult.code === 200) { - // 步骤 3:显示支付二维码 - const codeUrl = payResult.data.code_url; - // 使用 QRCode 库生成二维码 - new QRCode(document.getElementById('qrcode'), { - text: codeUrl, - width: 200, - height: 200 - }); - - // 步骤 4:轮询查询订单状态 - const checkOrderStatus = setInterval(async () => { - const statusResponse = await fetch(`/api/pay/order/query?orderNo=${payResult.data.order_no}`); - const statusResult = await statusResponse.json(); - - if (statusResult.data.status === 2) { // 2=已支付 - clearInterval(checkOrderStatus); - alert('支付成功!'); - window.location.reload(); - } - }, 3000); // 每 3 秒查询一次 - - // 设置超时(15 分钟后停止查询) - setTimeout(() => { - clearInterval(checkOrderStatus); - alert('支付超时,请重新下单'); - }, 900000); -} -``` - ---- - -### 3.2 场景 2:账户充值 - -**业务流程:** - -```javascript -// 创建充值订单 -const rechargeResponse = await fetch('/api/pay/wx/create', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ - userId: 123, - amount: 100.00, // 充值 100 元 - productName: '账户充值', - businessId: 123, - businessType: 'recharge' // 充值业务类型 - }) -}); - -const result = await rechargeResponse.json(); -if (result.code === 200) { - // 显示支付二维码 - showQRCode(result.data.code_url); -} -``` - -**说明:** -- 支付成功后,系统会自动通过回调将充值金额添加到用户账户余额 - ---- - -### 3.3 场景 3:支付宝网页支付 - -```javascript -// 创建支付宝订单 -const aliPayResponse = await fetch('/api/pay/alipay/create', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ - userId: 123, - amount: 0.01, - productName: '测试商品', - businessId: 456, - businessType: 'purchase_content' - }) -}); - -const result = await aliPayResponse.json(); -if (result.code === 200) { - // 将返回的 HTML 表单写入页面 - document.body.innerHTML = result.data; - // 表单会自动提交,跳转到支付宝支付页面 -} -``` - ---- - -## 四、前端集成完整示例 - -### 4.1 微信支付页面 - -```html - - - - - 微信支付 - - - - -
-

微信支付

-
-
-
-

请使用微信扫码支付

-

等待支付...

-
- - - - -``` - -### 4.2 支付宝支付页面 - -```html - - - - - 支付宝支付 - - -
-

正在跳转到支付宝支付页面...

-

请稍候

-
- - - - -``` - ---- - -## 五、核心代码文件 - -| 文件路径 | 说明 | -|---------|------| -| `src/main/java/com/kexue/skills/controller/PayController.java` | 支付接口控制器 | -| `src/main/java/com/kexue/skills/service/PayService.java` | 支付服务接口 | -| `src/main/java/com/kexue/skills/service/impl/PayServiceImpl.java` | 支付服务实现类 | -| `src/main/java/com/kexue/skills/config/PaymentConfig.java` | 支付配置类 | -| `src/main/java/com/kexue/skills/entity/PaymentOrder.java` | 支付订单实体类 | -| `src/main/java/com/kexue/skills/service/PaymentOrderService.java` | 支付订单服务接口 | -| `src/main/java/com/kexue/skills/service/impl/PaymentOrderServiceImpl.java` | 支付订单服务实现类 | - ---- - -## 六、注意事项 - -### 6.1 开发环境测试 - -⚠️ **重要提示:** 本地开发环境下,微信和支付宝无法直接访问到你的 localhost 回调地址。 - -**解决方案:** - -1. **使用内网穿透工具**(推荐) - ```bash - # 使用 ngrok - ngrok http 19001 - - # 将生成的域名配置到回调地址 - # 例如:https://abc123.ngrok.io/api/pay/wx/notify - ``` - -2. **部署到测试服务器** - - 直接部署到具有公网 IP 的服务器进行测试 - -3. **修改配置文件** - ```yaml - payment: - wechat: - notifyUrl: https://your-domain.ngrok.io/api/pay/wx/notify - alipay: - notifyUrl: https://your-domain.ngrok.io/api/pay/alipay/trade/notify - ``` - -### 6.2 金额单位 - -- 前端传入金额单位:**元** -- 微信支付内部转换:**分**(代码自动处理) -- 建议最小金额:0.01 元 - -### 6.3 业务类型说明 - -| 业务类型 | 说明 | 支付成功后操作 | -|---------|------|--------------| -| `recharge` | 账户充值 | 增加用户账户余额 | -| `purchase_content` | 购买内容 | 更新内容购买记录状态 | - -### 6.4 支付状态码 - -| 状态码 | 说明 | -|-------|------| -| 1 | 待支付 | -| 2 | 已支付 | -| 3 | 支付失败 | -| 4 | 已取消 | -| 5 | 已退款 | - -### 6.5 安全建议 - -1. **权限验证**:所有支付接口都应添加权限验证(已部分实现) -2. **签名验证**:确保支付回调的签名验证正确 -3. **幂等性处理**:支付回调应支持重复通知(已实现) -4. **日志记录**:完整的支付日志便于问题排查 - ---- - -## 七、常见问题 - -### Q1: 如何查询订单状态? - -```java -// 通过订单号查询 -PaymentOrder order = paymentOrderService.queryByOrderNo(orderNo); - -// 或通过主键查询 -PaymentOrder order = paymentOrderService.queryById(orderId); -``` - -### Q2: 如何处理支付回调失败? - -系统已实现幂等性处理,同一订单多次回调不会重复处理。如果回调失败,微信/支付宝会按一定频率重试。 - -### Q3: 如何申请退款? - -当前版本暂未实现退款功能,如需退款,需要: -1. 调用微信/支付宝退款 API -2. 更新支付订单状态为已退款(5) -3. 恢复用户余额或购买权限 - -### Q4: 测试时使用真实资金吗? - -是的,对接的是正式环境。如需测试环境,需要: -- 微信:申请沙箱环境 -- 支付宝:使用测试账号 - ---- - -## 八、技术支持 - -如遇问题,请检查以下内容: - -1. ✅ 配置文件中的商户号、密钥是否正确 -2. ✅ 回调地址是否可被外网访问 -3. ✅ 商户私钥文件是否存在且路径正确 -4. ✅ 查看日志文件中的详细错误信息 -5. ✅ 确认微信/支付宝商户号状态正常 - ---- - -**文档版本:** v1.0 -**更新时间:** 2026-03-31 -**维护人员:** 系统开发团队 diff --git a/db/alter_account_add_createby_updateby.sql b/db/alter_account_add_createby_updateby.sql deleted file mode 100644 index 66facc5..0000000 --- a/db/alter_account_add_createby_updateby.sql +++ /dev/null @@ -1,7 +0,0 @@ --- 给account表添加create_by和update_by字段 --- 作者: 王志维 --- 创建时间: 2026-01-26 - -ALTER TABLE `account` -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `update_time`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; diff --git a/db/alter_account_frozen_add_question.sql b/db/alter_account_frozen_add_question.sql deleted file mode 100644 index 0d031b3..0000000 --- a/db/alter_account_frozen_add_question.sql +++ /dev/null @@ -1,5 +0,0 @@ --- 为 account_frozen 表添加 question 字段 --- 用于记录用户的问题或需求 - -ALTER TABLE `account_frozen` -ADD COLUMN `question` text DEFAULT NULL COMMENT '对应回答的问题或需求' AFTER `model_name`; diff --git a/db/alter_account_transaction_add_call_id.sql b/db/alter_account_transaction_add_call_id.sql deleted file mode 100644 index 0517128..0000000 --- a/db/alter_account_transaction_add_call_id.sql +++ /dev/null @@ -1,9 +0,0 @@ --- 为 account_transaction 表添加 call_id 字段 --- 用于关联冻结单释放时的调用ID - -ALTER TABLE `account_transaction` -ADD COLUMN `call_id` varchar(100) DEFAULT NULL COMMENT '调用ID,关联冻结单' AFTER `business_type`; - --- 添加索引以提高查询性能 -ALTER TABLE `account_transaction` -ADD INDEX `idx_call_id` (`call_id`); diff --git a/db/alter_all_tables_add_createby_updateby.sql b/db/alter_all_tables_add_createby_updateby.sql deleted file mode 100644 index 832ca88..0000000 --- a/db/alter_all_tables_add_createby_updateby.sql +++ /dev/null @@ -1,90 +0,0 @@ --- 为所有表添加create_by和update_by字段 --- 作者: 王志维 --- 创建时间: 2026-01-26 - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- 1. 账户表 -ALTER TABLE `account` -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `update_time`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; - --- 2. 积分账户表 -ALTER TABLE `points_account` -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `update_time`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; - --- 3. 客户表 -ALTER TABLE `customer` -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `update_time`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; - --- 4. 内容购买记录表 -ALTER TABLE `content_purchase` -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `update_time`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; - --- 5. 用户角色关联表 -ALTER TABLE `sys_user_role` -ADD COLUMN `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间' AFTER `user_id`, -ADD COLUMN `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' AFTER `create_time`, -ADD COLUMN `delete_flag` tinyint(1) DEFAULT '0' COMMENT '是否删除 :0 未删除,1已删除' AFTER `update_time`, -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `delete_flag`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; - --- 6. 系统菜单表 -ALTER TABLE `sys_menu` -ADD COLUMN `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间' AFTER `delete_flag`, -ADD COLUMN `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' AFTER `create_time`, -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `update_time`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; - --- 7. 系统角色表 -ALTER TABLE `sys_role` -ADD COLUMN `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' AFTER `create_time`, -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `delete_flag`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; - --- 8. 支付订单表 -ALTER TABLE `payment_order` -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `delete_flag`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; - --- 9. 系统日志表 -ALTER TABLE `sys_log` -ADD COLUMN `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间' AFTER `note`, -ADD COLUMN `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' AFTER `create_time`, -ADD COLUMN `delete_flag` tinyint(1) DEFAULT '0' COMMENT '是否删除 :0 未删除,1已删除' AFTER `update_time`, -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `delete_flag`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; - --- 10. 系统用户表 -ALTER TABLE `sys_user` -ADD COLUMN `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' AFTER `create_time`, -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `delete_flag`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; - --- 11. 供应商表 -ALTER TABLE `supplier` -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `update_time`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; - --- 12. 系统字典表 -ALTER TABLE `sys_dict` -ADD COLUMN `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' AFTER `create_time`, -ADD COLUMN `delete_flag` tinyint(1) DEFAULT '0' COMMENT '是否删除 :0 未删除,1已删除' AFTER `update_time`, -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `delete_flag`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; - --- 13. 内容点赞记录表 -ALTER TABLE `cms_content_like` -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `delete_flag`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; - --- 14. 内容查看记录表 -ALTER TABLE `cms_content_view` -ADD COLUMN `create_by` varchar(50) DEFAULT NULL COMMENT '创建人' AFTER `delete_flag`, -ADD COLUMN `update_by` varchar(50) DEFAULT NULL COMMENT '更新人' AFTER `create_by`; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/db/alter_payment_order_pay_type.sql b/db/alter_payment_order_pay_type.sql deleted file mode 100644 index 1008035..0000000 --- a/db/alter_payment_order_pay_type.sql +++ /dev/null @@ -1,5 +0,0 @@ --- 修改payment_order表,为pay_type字段添加默认值 -ALTER TABLE `payment_order` MODIFY COLUMN `pay_type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '支付方式:1.微信 2.支付宝'; - --- 输出修改结果 -SELECT '修改payment_order表pay_type字段默认值完成' AS result; \ No newline at end of file diff --git a/db/alter_sys_log_table.sql b/db/alter_sys_log_table.sql deleted file mode 100644 index 20d2cbd..0000000 --- a/db/alter_sys_log_table.sql +++ /dev/null @@ -1,46 +0,0 @@ --- 更新 sys_log 表结构以支持新的日志功能 --- 作者: 王志维 --- 创建时间: 2026-04-14 - --- 备份旧数据(可选) --- CREATE TABLE sys_log_backup AS SELECT * FROM sys_log; - --- 删除旧表(如果存在) -DROP TABLE IF EXISTS `sys_log`; - --- 创建新表 -CREATE TABLE `sys_log` ( - `log_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `trace_id` varchar(255) DEFAULT NULL COMMENT '链路ID', - `description` varchar(255) DEFAULT NULL COMMENT '日志描述', - `module` varchar(50) DEFAULT NULL COMMENT '所属模块', - `request_url` varchar(512) DEFAULT NULL COMMENT '请求URL', - `request_method` varchar(10) DEFAULT NULL COMMENT '请求方式', - `request_headers` text COMMENT '请求头', - `request_body` text COMMENT '请求体', - `status_code` int(11) DEFAULT NULL COMMENT '状态码', - `response_headers` text COMMENT '响应头', - `response_body` mediumtext COMMENT '响应体', - `time_taken` bigint(20) DEFAULT NULL COMMENT '耗时(ms)', - `ip` varchar(100) DEFAULT NULL COMMENT 'IP', - `address` varchar(255) DEFAULT NULL COMMENT 'IP归属地', - `browser` varchar(100) DEFAULT NULL COMMENT '浏览器', - `os` varchar(100) DEFAULT NULL COMMENT '操作系统', - `status` tinyint(1) DEFAULT '1' COMMENT '状态(1:成功;2:失败)', - `error_msg` text COMMENT '错误信息', - `create_user` bigint(20) DEFAULT NULL COMMENT '创建人', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `delete_flag` tinyint(1) DEFAULT '0' COMMENT '是否删除 :0 未删除,1已删除', - `create_by` varchar(50) DEFAULT NULL COMMENT '创建人', - `update_by` varchar(50) DEFAULT NULL COMMENT '更新人', - PRIMARY KEY (`log_id`) USING BTREE, - KEY `idx_module` (`module`) USING BTREE COMMENT '模块查询优化', - KEY `idx_ip` (`ip`) USING BTREE COMMENT 'IP查询优化', - KEY `idx_create_time` (`create_time`) USING BTREE COMMENT '时间范围查询优化', - KEY `idx_status` (`status`) USING BTREE COMMENT '状态查询优化' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统操作日志表'; - --- 插入测试数据(可选) --- INSERT INTO `sys_log` (`description`, `module`, `request_url`, `request_method`, `status_code`, `time_taken`, `ip`, `status`, `create_time`) --- VALUES ('用户登录', '登录认证', '/api/login/accountLogin', 'POST', 200, 150, '127.0.0.1', 1, NOW()); diff --git a/db/alter_sys_role_permission_add_permission_name.sql b/db/alter_sys_role_permission_add_permission_name.sql new file mode 100644 index 0000000..e4b1917 --- /dev/null +++ b/db/alter_sys_role_permission_add_permission_name.sql @@ -0,0 +1,8 @@ +-- 给 sys_role_permission 表添加 permission_name 字段 +-- 创建时间:2026-05-07 + +SET NAMES utf8mb4; + +-- 检查字段是否存在,如果不存在则添加 +ALTER TABLE `sys_role_permission` +ADD COLUMN IF NOT EXISTS `permission_name` VARCHAR(255) DEFAULT NULL COMMENT '权限名称' AFTER `permission_code`; \ No newline at end of file diff --git a/db/alter_sys_user_add_wxid_roleType.sql b/db/alter_sys_user_add_wxid_roleType.sql new file mode 100644 index 0000000..923042e --- /dev/null +++ b/db/alter_sys_user_add_wxid_roleType.sql @@ -0,0 +1,13 @@ +-- 给 sys_user 表添加 wxid 和 roleType 字段 +-- 创建时间:2026-04-30 + +SET NAMES utf8mb4; + +-- 检查字段是否存在,如果不存在则添加 +ALTER TABLE `sys_user` +ADD COLUMN IF NOT EXISTS `wxid` VARCHAR(100) DEFAULT NULL COMMENT '微信ID' AFTER `user_icon`, +ADD COLUMN IF NOT EXISTS `role_type` TINYINT(1) DEFAULT NULL COMMENT '角色类型:1-超级管理员,2-学校管理员,3-学院管理员,4-教师,5-学生' AFTER `wxid`; + +-- 为新增字段添加索引 +ALTER TABLE `sys_user` ADD INDEX IF NOT EXISTS `idx_wxid` (`wxid`); +ALTER TABLE `sys_user` ADD INDEX IF NOT EXISTS `idx_role_type` (`role_type`); diff --git a/db/cms_content_like.sql b/db/cms_content_like.sql deleted file mode 100644 index 8919c8e..0000000 --- a/db/cms_content_like.sql +++ /dev/null @@ -1,14 +0,0 @@ --- 创建cms_content_like表(用户点赞记录) -CREATE TABLE `cms_content_like` ( - `like_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '点赞记录ID', - `user_id` bigint(20) NOT NULL COMMENT '用户ID', - `user_name` varchar(50) NOT NULL COMMENT '用户名', - `content_id` bigint(20) NOT NULL COMMENT '内容ID', - `content_title` varchar(200) NOT NULL COMMENT '内容标题', - `like_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '点赞时间', - `delete_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标志:0未删除,1已删除', - PRIMARY KEY (`like_id`), - KEY `idx_user_id` (`user_id`), - KEY `idx_content_id` (`content_id`), - KEY `idx_like_time` (`like_time`) -) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='CMS内容点赞记录表'; \ No newline at end of file diff --git a/db/cms_content_view.sql b/db/cms_content_view.sql deleted file mode 100644 index f2f3cd6..0000000 --- a/db/cms_content_view.sql +++ /dev/null @@ -1,14 +0,0 @@ --- 创建cms_content_view表(用户查看记录) -CREATE TABLE `cms_content_view` ( - `view_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '查看记录ID', - `user_id` bigint(20) NOT NULL COMMENT '用户ID', - `user_name` varchar(50) NOT NULL COMMENT '用户名', - `content_id` bigint(20) NOT NULL COMMENT '内容ID', - `content_title` varchar(200) NOT NULL COMMENT '内容标题', - `view_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '查看时间', - `delete_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT '删除标志:0未删除,1已删除', - PRIMARY KEY (`view_id`), - KEY `idx_user_id` (`user_id`), - KEY `idx_content_id` (`content_id`), - KEY `idx_view_time` (`view_time`) -) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='CMS内容查看记录表'; \ No newline at end of file diff --git a/db/create_edu_tables.sql b/db/create_edu_tables.sql new file mode 100644 index 0000000..6c3f142 --- /dev/null +++ b/db/create_edu_tables.sql @@ -0,0 +1,267 @@ +-- 创建实训平台教学管理相关表 +-- 作者: 王志维 +-- 创建时间: 2026-04-30 + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- 1. 用户角色关联表 +DROP TABLE IF EXISTS `sys_user_role`; +CREATE TABLE `sys_user_role` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `user_id` BIGINT(20) NOT NULL COMMENT '用户ID', + `role_code` VARCHAR(50) NOT NULL COMMENT '角色编码:student-学生,teacher-老师,admin-管理员', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_user_role` (`user_id`, `role_code`), + KEY `idx_user_id` (`user_id`), + KEY `idx_role_code` (`role_code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户角色关联表'; + +-- 2. 学生扩展表 +DROP TABLE IF EXISTS `edu_student`; +CREATE TABLE `edu_student` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `user_id` BIGINT(20) NOT NULL COMMENT '用户ID(关联sys_user)', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID', + `college_id` BIGINT(20) DEFAULT NULL COMMENT '学院ID', + `major_id` BIGINT(20) DEFAULT NULL COMMENT '专业ID', + `grade` VARCHAR(20) DEFAULT NULL COMMENT '年级', + `class_name` VARCHAR(50) DEFAULT NULL COMMENT '班级', + `student_no` VARCHAR(50) DEFAULT NULL COMMENT '学号', + `real_name` VARCHAR(50) DEFAULT NULL COMMENT '真实姓名', + `activation_code` VARCHAR(50) DEFAULT NULL COMMENT '激活码', + `binding_status` TINYINT(1) DEFAULT '0' COMMENT '绑定状态:0-未绑定,1-已绑定', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_user_id` (`user_id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_college_id` (`college_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='学生扩展表'; + +-- 3. 教师扩展表 +DROP TABLE IF EXISTS `edu_teacher`; +CREATE TABLE `edu_teacher` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `user_id` BIGINT(20) NOT NULL COMMENT '用户ID(关联sys_user)', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID', + `college_id` BIGINT(20) DEFAULT NULL COMMENT '学院ID', + `real_name` VARCHAR(50) DEFAULT NULL COMMENT '真实姓名', + `teacher_no` VARCHAR(50) DEFAULT NULL COMMENT '教师编号', + `title` VARCHAR(50) DEFAULT NULL COMMENT '职称', + `activation_code` VARCHAR(50) DEFAULT NULL COMMENT '激活码', + `binding_status` TINYINT(1) DEFAULT '0' COMMENT '绑定状态:0-未绑定,1-已绑定', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_user_id` (`user_id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_college_id` (`college_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='教师扩展表'; + +-- 4. 通知表 +DROP TABLE IF EXISTS `sys_notification`; +CREATE TABLE `sys_notification` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `user_id` BIGINT(20) NOT NULL COMMENT '用户ID', + `title` VARCHAR(100) NOT NULL COMMENT '通知标题', + `content` TEXT NOT NULL COMMENT '通知内容', + `type` TINYINT(1) DEFAULT '1' COMMENT '通知类型:1-系统通知,2-作业通知,3-考试通知,4-考勤通知,5-用户通知,6-课程通知', + `is_read` TINYINT(1) DEFAULT '0' COMMENT '是否已读:0-未读,1-已读', + `sender_id` BIGINT(20) DEFAULT NULL COMMENT '发送者用户ID', + `sender_name` VARCHAR(100) DEFAULT NULL COMMENT '发送者姓名', + `target_type` TINYINT(1) DEFAULT '1' COMMENT '目标类型:1-单个用户,2-角色,3-课程', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_user_id` (`user_id`), + KEY `idx_is_read` (`is_read`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='通知表'; + +-- 5. 课程表 +DROP TABLE IF EXISTS `edu_course`; +CREATE TABLE `edu_course` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `name` VARCHAR(100) NOT NULL COMMENT '课程名称', + `cover` VARCHAR(255) DEFAULT NULL COMMENT '课程封面', + `description` TEXT DEFAULT NULL COMMENT '课程简介', + `class_time` VARCHAR(100) DEFAULT NULL COMMENT '上课时间', + `teaching_method` TINYINT(1) DEFAULT '1' COMMENT '授课方式:1-线上,2-线下,3-混合', + `teacher_id` BIGINT(20) NOT NULL COMMENT '创建老师ID', + `status` TINYINT(1) DEFAULT '1' COMMENT '课程状态:1-进行中,2-已结课', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_teacher_id` (`teacher_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='课程表'; + +-- 6. 课程学生关联表 +DROP TABLE IF EXISTS `edu_course_student`; +CREATE TABLE `edu_course_student` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `course_id` BIGINT(20) NOT NULL COMMENT '课程ID', + `student_id` BIGINT(20) NOT NULL COMMENT '学生ID', + `join_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '加入时间', + `is_kicked` TINYINT(1) DEFAULT '0' COMMENT '是否被踢出:0-正常,1-已踢出', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_course_student` (`course_id`, `student_id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_course_id` (`course_id`), + KEY `idx_student_id` (`student_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='课程学生关联表'; + +-- 7. 作业表 +DROP TABLE IF EXISTS `edu_homework`; +CREATE TABLE `edu_homework` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `course_id` BIGINT(20) NOT NULL COMMENT '课程ID', + `name` VARCHAR(100) NOT NULL COMMENT '作业名称', + `requirement` TEXT DEFAULT NULL COMMENT '作业要求', + `questions` TEXT NOT NULL COMMENT '题目JSON', + `allow_late` TINYINT(1) DEFAULT '0' COMMENT '是否允许迟交', + `start_time` DATETIME NOT NULL COMMENT '开始时间', + `end_time` DATETIME NOT NULL COMMENT '截止时间', + `status` TINYINT(1) DEFAULT '1' COMMENT '状态:1-草稿,2-已发布', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_course_id` (`course_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='作业表'; + +-- 8. 作业提交表 +DROP TABLE IF EXISTS `edu_homework_submit`; +CREATE TABLE `edu_homework_submit` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `homework_id` BIGINT(20) NOT NULL COMMENT '作业ID', + `student_id` BIGINT(20) NOT NULL COMMENT '学生ID', + `answers` TEXT NOT NULL COMMENT '答案JSON', + `submit_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '提交时间', + `is_late` TINYINT(1) DEFAULT '0' COMMENT '是否迟交', + `status` TINYINT(1) DEFAULT '1' COMMENT '状态:1-待批改,2-已批改,3-已退回', + `score` DECIMAL(5,2) DEFAULT NULL COMMENT '分数', + `comment` TEXT DEFAULT NULL COMMENT '评语', + `is_excellent` TINYINT(1) DEFAULT '0' COMMENT '是否优秀', + `redo_end_time` DATETIME DEFAULT NULL COMMENT '重做截止时间', + `redo_count` INT(11) DEFAULT '0' COMMENT '重做次数', + PRIMARY KEY (`id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_homework_id` (`homework_id`), + KEY `idx_student_id` (`student_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='作业提交表'; + +-- 9. 考试表 +DROP TABLE IF EXISTS `edu_exam`; +CREATE TABLE `edu_exam` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `course_id` BIGINT(20) NOT NULL COMMENT '课程ID', + `name` VARCHAR(100) NOT NULL COMMENT '考试名称', + `requirement` TEXT DEFAULT NULL COMMENT '考试要求', + `questions` TEXT NOT NULL COMMENT '考卷JSON', + `duration` INT(11) NOT NULL COMMENT '考试时长(分钟)', + `start_time` DATETIME NOT NULL COMMENT '开始时间', + `end_time` DATETIME NOT NULL COMMENT '截止时间', + `status` TINYINT(1) DEFAULT '1' COMMENT '状态:1-草稿,2-已发布,3-已结束', + `is_makeup` TINYINT(1) DEFAULT '0' COMMENT '是否补考', + `parent_exam_id` BIGINT(20) DEFAULT NULL COMMENT '关联主考ID', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_course_id` (`course_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='考试表'; + +-- 10. 考试答卷表 +DROP TABLE IF EXISTS `edu_exam_paper`; +CREATE TABLE `edu_exam_paper` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `exam_id` BIGINT(20) NOT NULL COMMENT '考试ID', + `student_id` BIGINT(20) NOT NULL COMMENT '学生ID', + `answers` TEXT NOT NULL COMMENT '答案JSON', + `submit_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '提交时间', + `status` TINYINT(1) DEFAULT '1' COMMENT '状态:1-待阅卷,2-已阅卷', + `score` DECIMAL(5,2) DEFAULT NULL COMMENT '分数', + `comment` TEXT DEFAULT NULL COMMENT '评语', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_exam_student` (`exam_id`, `student_id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_exam_id` (`exam_id`), + KEY `idx_student_id` (`student_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='考试答卷表'; + +-- 11. 考勤表 +DROP TABLE IF EXISTS `edu_attendance`; +CREATE TABLE `edu_attendance` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `course_id` BIGINT(20) NOT NULL COMMENT '课程ID', + `name` VARCHAR(100) DEFAULT NULL COMMENT '签到名称(按时间自动生成)', + `start_time` DATETIME NOT NULL COMMENT '开始时间', + `duration` INT(11) DEFAULT '15' COMMENT '签到时长(分钟)', + `type` TINYINT(1) DEFAULT '1' COMMENT '签到类型:1-二维码签到,2-手动点名', + `status` TINYINT(1) DEFAULT '1' COMMENT '状态:1-进行中,2-已结束', + `qr_code` VARCHAR(255) DEFAULT NULL COMMENT '二维码内容', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_course_id` (`course_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='考勤表'; + +-- 12. 考勤记录表 +DROP TABLE IF EXISTS `edu_attendance_record`; +CREATE TABLE `edu_attendance_record` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `attendance_id` BIGINT(20) NOT NULL COMMENT '考勤ID', + `student_id` BIGINT(20) NOT NULL COMMENT '学生ID', + `status` TINYINT(1) DEFAULT '1' COMMENT '考勤状态:1-出勤,2-迟到,3-缺勤,4-请假', + `sign_time` DATETIME DEFAULT NULL COMMENT '签到时间', + `remark` VARCHAR(255) DEFAULT NULL COMMENT '备注(手动点名时填写)', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_attendance_student` (`attendance_id`, `student_id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_attendance_id` (`attendance_id`), + KEY `idx_student_id` (`student_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='考勤记录表'; + +-- 13. 优秀作品表 +DROP TABLE IF EXISTS `edu_excellent_work`; +CREATE TABLE `edu_excellent_work` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `work_type` TINYINT(1) NOT NULL COMMENT '作品类型:1-作业,2-考试', + `work_id` BIGINT(20) NOT NULL COMMENT '关联作业/考试ID', + `submit_id` BIGINT(20) NOT NULL COMMENT '关联提交ID', + `student_id` BIGINT(20) NOT NULL COMMENT '学生ID', + `score` DECIMAL(5,2) DEFAULT NULL COMMENT '分数', + `comment` TEXT DEFAULT NULL COMMENT '评语', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '标记时间', + PRIMARY KEY (`id`), + KEY `idx_school_id` (`school_id`), + KEY `idx_work_type_work_id` (`work_type`, `work_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='优秀作品表'; + +-- 14. 作品点赞表 +DROP TABLE IF EXISTS `edu_work_like`; +CREATE TABLE `edu_work_like` ( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `school_id` BIGINT(20) NOT NULL COMMENT '学校ID(数据隔离)', + `work_id` BIGINT(20) NOT NULL COMMENT '优秀作品ID', + `user_id` BIGINT(20) NOT NULL COMMENT '点赞用户ID', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '点赞时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_work_user` (`work_id`, `user_id`), + KEY `idx_school_id` (`school_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='作品点赞表'; + +SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/db/create_role_permission_table.sql b/db/create_role_permission_table.sql new file mode 100644 index 0000000..f5f1beb --- /dev/null +++ b/db/create_role_permission_table.sql @@ -0,0 +1,23 @@ +-- 创建角色权限关联表 +-- 作者: 王志维 +-- 创建时间: 2026-04-30 + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- 角色权限关联表 +DROP TABLE IF EXISTS `sys_role_permission`; +CREATE TABLE `sys_role_permission` ( + `permission_id` BIGINT(20) NOT NULL COMMENT '权限主键ID,关联权限主表主键', + `role_id` BIGINT(20) NOT NULL COMMENT '角色主键ID,关联角色主表主键', + `role_code` VARCHAR(64) NOT NULL COMMENT '角色标识码,如student、teacher、school_admin', + `permission_code` VARCHAR(128) NOT NULL COMMENT '接口/按钮权限码,如system:user:add', + `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '权限绑定关系创建时间', + `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '权限绑定关系最后更新时间', + PRIMARY KEY (`permission_id`, `role_id`), + KEY `idx_role_id` (`role_id`), + KEY `idx_role_code` (`role_code`), + KEY `idx_permission_code` (`permission_code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色权限关联表'; + +SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/db/init_data.sql b/db/init_data.sql index 6181c3f..3427d10 100644 --- a/db/init_data.sql +++ b/db/init_data.sql @@ -79,3 +79,12 @@ SELECT '用户表初始化行数:', ROW_COUNT() AS count FROM `sys_user`; SELECT '用户角色关联表初始化行数:', ROW_COUNT() AS count FROM `sys_user_role`; SELECT '账户表初始化行数:', ROW_COUNT() AS count FROM `account`; SELECT '积分账户表初始化行数:', ROW_COUNT() AS count FROM `points_account`; + +INSERT INTO `kexue_server`.`sys_user` (`user_name`, `pwd`, `real_name`, `tel`, `email`, `salt`, `remark`, `create_time`, `update_time`, `enable`, `delete_flag`, `create_by`, `update_by`, `session_id`, `invite_code`, `invited_code`, `invited_by`, `user_icon`, `wxid`, `role_type`) VALUES ('super', '5f1d7a84db00d2fce00b31a7fc73224f', '超级管理员', '13800138000', 'admin@example.com', '123456', '超级管理员', '2026-01-20 18:10:20', '2026-04-15 14:28:09', 1, 0, NULL, NULL, 'bf281237-88e6-4b18-b51e-98f047693fa4', 'b8b6dbb3', NULL, NULL, 'defaultUserIcon.png', NULL, 1); +INSERT INTO `kexue_server`.`sys_user` (`user_name`, `pwd`, `real_name`, `tel`, `email`, `salt`, `remark`, `create_time`, `update_time`, `enable`, `delete_flag`, `create_by`, `update_by`, `session_id`, `invite_code`, `invited_code`, `invited_by`, `user_icon`, `wxid`, `role_type`) VALUES ('super2', '5f1d7a84db00d2fce00b31a7fc73224f', '次要管理员', '13800138000', 'admin@example.com', '123456', '次要管理员', '2026-01-20 18:10:20', '2026-04-15 14:28:09', 1, 0, NULL, NULL, 'bf281237-88e6-4b18-b51e-98f047693fa4', 'b8b6dbb3', NULL, NULL, 'defaultUserIcon.png', NULL, 2); +INSERT INTO `kexue_server`.`sys_user` (`user_name`, `pwd`, `real_name`, `tel`, `email`, `salt`, `remark`, `create_time`, `update_time`, `enable`, `delete_flag`, `create_by`, `update_by`, `session_id`, `invite_code`, `invited_code`, `invited_by`, `user_icon`, `wxid`, `role_type`) VALUES ('school_admin', '5f1d7a84db00d2fce00b31a7fc73224f', '学校管理员管理员', '13800138000', 'admin@example.com', '123456', '学校管理员管理员', '2026-01-20 18:10:20', '2026-04-15 14:28:09', 1, 0, NULL, NULL, 'bf281237-88e6-4b18-b51e-98f047693fa4', 'b8b6dbb3', NULL, NULL, 'defaultUserIcon.png', NULL, 3); +INSERT INTO `kexue_server`.`sys_user` (`user_name`, `pwd`, `real_name`, `tel`, `email`, `salt`, `remark`, `create_time`, `update_time`, `enable`, `delete_flag`, `create_by`, `update_by`, `session_id`, `invite_code`, `invited_code`, `invited_by`, `user_icon`, `wxid`, `role_type`) VALUES ('college_admin', '5f1d7a84db00d2fce00b31a7fc73224f', '次要管理员', '13800138000', 'admin@example.com', '123456', '次要管理员', '2026-01-20 18:10:20', '2026-04-15 14:28:09', 1, 0, NULL, NULL, 'bf281237-88e6-4b18-b51e-98f047693fa4', 'b8b6dbb3', NULL, NULL, 'defaultUserIcon.png', NULL, 4); +INSERT INTO `kexue_server`.`sys_user` (`user_name`, `pwd`, `real_name`, `tel`, `email`, `salt`, `remark`, `create_time`, `update_time`, `enable`, `delete_flag`, `create_by`, `update_by`, `session_id`, `invite_code`, `invited_code`, `invited_by`, `user_icon`, `wxid`, `role_type`) VALUES ('teacher', '5f1d7a84db00d2fce00b31a7fc73224f', '老师', '13800138000', 'admin@example.com', '123456', '老师', '2026-01-20 18:10:20', '2026-04-15 14:28:09', 1, 0, NULL, NULL, 'bf281237-88e6-4b18-b51e-98f047693fa4', 'b8b6dbb3', NULL, NULL, 'defaultUserIcon.png', NULL, 5); +INSERT INTO `kexue_server`.`sys_user` (`user_name`, `pwd`, `real_name`, `tel`, `email`, `salt`, `remark`, `create_time`, `update_time`, `enable`, `delete_flag`, `create_by`, `update_by`, `session_id`, `invite_code`, `invited_code`, `invited_by`, `user_icon`, `wxid`, `role_type`) VALUES ('student', '5f1d7a84db00d2fce00b31a7fc73224f', '学生', '13800138000', 'admin@example.com', '123456', '学生', '2026-01-20 18:10:20', '2026-04-15 14:28:09', 1, 0, NULL, NULL, 'bf281237-88e6-4b18-b51e-98f047693fa4', 'b8b6dbb3', NULL, NULL, 'defaultUserIcon.png', NULL, 6); + + diff --git a/db/init_role_permission_data.sql b/db/init_role_permission_data.sql new file mode 100644 index 0000000..a46e1a2 --- /dev/null +++ b/db/init_role_permission_data.sql @@ -0,0 +1,281 @@ +-- 角色权限初始化数据 +-- 作者: 王志维 +-- 创建时间: 2026-04-30 + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ======================================== +-- 系统管理权限 (system) +-- ======================================== + +-- 超级管理员 - 系统管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(1, 1, 'SUPER', 'system:user:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(2, 1, 'SUPER', 'system:user:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(3, 1, 'SUPER', 'system:user:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(4, 1, 'SUPER', 'system:user:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(5, 1, 'SUPER', 'system:role:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(6, 1, 'SUPER', 'system:role:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(7, 1, 'SUPER', 'system:role:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(8, 1, 'SUPER', 'system:role:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(9, 1, 'SUPER', 'system:menu:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(10, 1, 'SUPER', 'system:menu:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(11, 1, 'SUPER', 'system:menu:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(12, 1, 'SUPER', 'system:dict:manage', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(13, 1, 'SUPER', 'system:log:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 学校管理员 - 系统管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(14, 2, 'SCOOL_ADMIN', 'system:user:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(15, 2, 'SCOOL_ADMIN', 'system:role:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- ======================================== +-- 用户管理权限 (user) +-- ======================================== + +-- 超级管理员 - 用户管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(16, 1, 'SUPER', 'user:student:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(17, 1, 'SUPER', 'user:student:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(18, 1, 'SUPER', 'user:student:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(19, 1, 'SUPER', 'user:student:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(20, 1, 'SUPER', 'user:teacher:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(21, 1, 'SUPER', 'user:teacher:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(22, 1, 'SUPER', 'user:teacher:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(23, 1, 'SUPER', 'user:teacher:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(24, 1, 'SUPER', 'user:teacher:bind', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(25, 1, 'SUPER', 'user:student:bind', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 学校管理员 - 用户管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(26, 2, 'SCOOL_ADMIN', 'user:student:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(27, 2, 'SCOOL_ADMIN', 'user:student:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(28, 2, 'SCOOL_ADMIN', 'user:student:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(29, 2, 'SCOOL_ADMIN', 'user:student:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(30, 2, 'SCOOL_ADMIN', 'user:teacher:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(31, 2, 'SCOOL_ADMIN', 'user:teacher:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(32, 2, 'SCOOL_ADMIN', 'user:teacher:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(33, 2, 'SCOOL_ADMIN', 'user:teacher:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(34, 2, 'SCOOL_ADMIN', 'user:teacher:bind', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(35, 2, 'SCOOL_ADMIN', 'user:student:bind', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 学院管理员 - 用户管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(36, 3, 'COLLEGE_ADMIN', 'user:student:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(37, 3, 'COLLEGE_ADMIN', 'user:teacher:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- ======================================== +-- 课程管理权限 (course) +-- ======================================== + +-- 超级管理员 - 课程管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(38, 1, 'SUPER', 'course:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(39, 1, 'SUPER', 'course:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(40, 1, 'SUPER', 'course:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(41, 1, 'SUPER', 'course:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(42, 1, 'SUPER', 'course:student:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(43, 1, 'SUPER', 'course:student:remove', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(44, 1, 'SUPER', 'course:student:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(45, 1, 'SUPER', 'course:score:export', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 学校管理员 - 课程管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(46, 2, 'SCOOL_ADMIN', 'course:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(47, 2, 'SCOOL_ADMIN', 'course:student:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 学院管理员 - 课程管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(48, 3, 'COLLEGE_ADMIN', 'course:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(49, 3, 'COLLEGE_ADMIN', 'course:student:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 老师 - 课程管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(50, 4, 'TEACHER', 'course:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(51, 4, 'TEACHER', 'course:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(52, 4, 'TEACHER', 'course:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(53, 4, 'TEACHER', 'course:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(54, 4, 'TEACHER', 'course:student:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(55, 4, 'TEACHER', 'course:student:remove', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(56, 4, 'TEACHER', 'course:student:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(57, 4, 'TEACHER', 'course:score:export', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 学生 - 课程管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(58, 5, 'STUDENT', 'course:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(59, 5, 'STUDENT', 'course:join', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(60, 5, 'STUDENT', 'course:quit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- ======================================== +-- 作业管理权限 (homework) +-- ======================================== + +-- 超级管理员 - 作业管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(61, 1, 'SUPER', 'homework:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(62, 1, 'SUPER', 'homework:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(63, 1, 'SUPER', 'homework:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(64, 1, 'SUPER', 'homework:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(65, 1, 'SUPER', 'homework:publish', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(66, 1, 'SUPER', 'homework:grade', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(67, 1, 'SUPER', 'homework:excellent', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(68, 1, 'SUPER', 'homework:redo', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 老师 - 作业管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(69, 4, 'TEACHER', 'homework:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(70, 4, 'TEACHER', 'homework:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(71, 4, 'TEACHER', 'homework:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(72, 4, 'TEACHER', 'homework:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(73, 4, 'TEACHER', 'homework:publish', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(74, 4, 'TEACHER', 'homework:grade', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(75, 4, 'TEACHER', 'homework:excellent', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(76, 4, 'TEACHER', 'homework:redo', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 学生 - 作业管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(77, 5, 'STUDENT', 'homework:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(78, 5, 'STUDENT', 'homework:submit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(79, 5, 'STUDENT', 'homework:update', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(80, 5, 'STUDENT', 'homework:redo', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- ======================================== +-- 考试管理权限 (exam) +-- ======================================== + +-- 超级管理员 - 考试管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(81, 1, 'SUPER', 'exam:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(82, 1, 'SUPER', 'exam:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(83, 1, 'SUPER', 'exam:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(84, 1, 'SUPER', 'exam:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(85, 1, 'SUPER', 'exam:publish', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(86, 1, 'SUPER', 'exam:grade', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(87, 1, 'SUPER', 'exam:makeup', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 老师 - 考试管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(88, 4, 'TEACHER', 'exam:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(89, 4, 'TEACHER', 'exam:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(90, 4, 'TEACHER', 'exam:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(91, 4, 'TEACHER', 'exam:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(92, 4, 'TEACHER', 'exam:publish', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(93, 4, 'TEACHER', 'exam:grade', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(94, 4, 'TEACHER', 'exam:makeup', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 学生 - 考试管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(95, 5, 'STUDENT', 'exam:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(96, 5, 'STUDENT', 'exam:take', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(97, 5, 'STUDENT', 'exam:makeup', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- ======================================== +-- 考勤管理权限 (attendance) +-- ======================================== + +-- 超级管理员 - 考勤管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(98, 1, 'SUPER', 'attendance:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(99, 1, 'SUPER', 'attendance:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(100, 1, 'SUPER', 'attendance:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(101, 1, 'SUPER', 'attendance:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(102, 1, 'SUPER', 'attendance:start', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(103, 1, 'SUPER', 'attendance:record', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(104, 1, 'SUPER', 'attendance:status:modify', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 老师 - 考勤管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(105, 4, 'TEACHER', 'attendance:add', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(106, 4, 'TEACHER', 'attendance:edit', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(107, 4, 'TEACHER', 'attendance:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(108, 4, 'TEACHER', 'attendance:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(109, 4, 'TEACHER', 'attendance:start', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(110, 4, 'TEACHER', 'attendance:record', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(111, 4, 'TEACHER', 'attendance:status:modify', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 学生 - 考勤管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(112, 5, 'STUDENT', 'attendance:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(113, 5, 'STUDENT', 'attendance:sign', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- ======================================== +-- 优秀作品权限 (excellent) +-- ======================================== + +-- 超级管理员 - 优秀作品权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(114, 1, 'SUPER', 'excellent:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(115, 1, 'SUPER', 'excellent:mark', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(116, 1, 'SUPER', 'excellent:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(117, 1, 'SUPER', 'excellent:like', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 老师 - 优秀作品权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(118, 4, 'TEACHER', 'excellent:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(119, 4, 'TEACHER', 'excellent:mark', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(120, 4, 'TEACHER', 'excellent:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(121, 4, 'TEACHER', 'excellent:like', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 学生 - 优秀作品权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(122, 5, 'STUDENT', 'excellent:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(123, 5, 'STUDENT', 'excellent:like', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- ======================================== +-- 通知管理权限 (notification) +-- ======================================== + +-- 超级管理员 - 通知管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(124, 1, 'SUPER', 'notification:send', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(125, 1, 'SUPER', 'notification:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(126, 1, 'SUPER', 'notification:delete', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(127, 1, 'SUPER', 'notification:read', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 老师 - 通知管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(128, 4, 'TEACHER', 'notification:send', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(129, 4, 'TEACHER', 'notification:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(130, 4, 'TEACHER', 'notification:read', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 学生 - 通知管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(131, 5, 'STUDENT', 'notification:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(132, 5, 'STUDENT', 'notification:read', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- ======================================== +-- 充值管理权限 (payment) +-- ======================================== + +-- 超级管理员 - 充值管理权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(133, 1, 'SUPER', 'payment:package:manage', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(134, 1, 'SUPER', 'payment:order:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(135, 1, 'SUPER', 'payment:recharge', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- 用户通用 - 充值权限(学生、老师) +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(136, 4, 'TEACHER', 'payment:recharge', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(137, 4, 'TEACHER', 'payment:order:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(138, 5, 'STUDENT', 'payment:recharge', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(139, 5, 'STUDENT', 'payment:order:query', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +-- ======================================== +-- 个人中心权限 (profile) +-- ======================================== + +-- 用户通用 - 个人中心权限 +INSERT INTO `sys_role_permission` (`permission_id`, `role_id`, `role_code`, `permission_code`, `create_time`, `update_time`) VALUES +(140, 4, 'TEACHER', 'profile:info', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(141, 4, 'TEACHER', 'profile:update', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(142, 4, 'TEACHER', 'profile:password', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(143, 4, 'TEACHER', 'profile:phone', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(144, 4, 'TEACHER', 'profile:consumption', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(145, 5, 'STUDENT', 'profile:info', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(146, 5, 'STUDENT', 'profile:update', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(147, 5, 'STUDENT', 'profile:password', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(148, 5, 'STUDENT', 'profile:phone', '2026-04-30 18:00:00', '2026-04-30 18:00:00'), +(149, 5, 'STUDENT', 'profile:consumption', '2026-04-30 18:00:00', '2026-04-30 18:00:00'); + +SET FOREIGN_KEY_CHECKS = 1; \ No newline at end of file diff --git a/db/sys_role_permission_data_init.sql b/db/sys_role_permission_data_init.sql new file mode 100644 index 0000000..a98a7a8 --- /dev/null +++ b/db/sys_role_permission_data_init.sql @@ -0,0 +1,149 @@ +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (1, 1, 'SUPER', '系统管理', 'system:user:add', '用户新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (2, 1, 'SUPER', '系统管理', 'system:user:edit', '用户修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (3, 1, 'SUPER', '系统管理', 'system:user:delete', '用户删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (4, 1, 'SUPER', '系统管理', 'system:user:query', '用户查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (5, 1, 'SUPER', '系统管理', 'system:role:add', '角色新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (6, 1, 'SUPER', '系统管理', 'system:role:edit', '角色修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (7, 1, 'SUPER', '系统管理', 'system:role:delete', '角色删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (8, 1, 'SUPER', '系统管理', 'system:role:query', '角色查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (9, 1, 'SUPER', '系统管理', 'system:menu:add', '菜单新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (10, 1, 'SUPER', '系统管理', 'system:menu:edit', '菜单修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (11, 1, 'SUPER', '系统管理', 'system:menu:delete', '菜单删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (12, 1, 'SUPER', '系统管理', 'system:dict:manage', '字典管理', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (13, 1, 'SUPER', '系统管理', 'system:log:query', '日志查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (14, 2, 'SCOOL_ADMIN', '系统管理', 'system:user:query', '用户查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (15, 2, 'SCOOL_ADMIN', '系统管理', 'system:role:query', '角色查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (16, 1, 'SUPER', '用户管理', 'user:student:add', '学生新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (17, 1, 'SUPER', '用户管理', 'user:student:edit', '学生修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (18, 1, 'SUPER', '用户管理', 'user:student:delete', '学生删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (19, 1, 'SUPER', '用户管理', 'user:student:query', '学生查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (20, 1, 'SUPER', '用户管理', 'user:teacher:add', '教师新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (21, 1, 'SUPER', '用户管理', 'user:teacher:edit', '教师修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (22, 1, 'SUPER', '用户管理', 'user:teacher:delete', '教师删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (23, 1, 'SUPER', '用户管理', 'user:teacher:query', '教师查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (24, 1, 'SUPER', '用户管理', 'user:teacher:bind', '教师绑定', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (25, 1, 'SUPER', '用户管理', 'user:student:bind', '学生绑定', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (26, 2, 'SCOOL_ADMIN', '用户管理', 'user:student:add', '学生新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (27, 2, 'SCOOL_ADMIN', '用户管理', 'user:student:edit', '学生修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (28, 2, 'SCOOL_ADMIN', '用户管理', 'user:student:delete', '学生删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (29, 2, 'SCOOL_ADMIN', '用户管理', 'user:student:query', '学生查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (30, 2, 'SCOOL_ADMIN', '用户管理', 'user:teacher:add', '教师新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (31, 2, 'SCOOL_ADMIN', '用户管理', 'user:teacher:edit', '教师修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (32, 2, 'SCOOL_ADMIN', '用户管理', 'user:teacher:delete', '教师删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (33, 2, 'SCOOL_ADMIN', '用户管理', 'user:teacher:query', '教师查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (34, 2, 'SCOOL_ADMIN', '用户管理', 'user:teacher:bind', '教师绑定', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (35, 2, 'SCOOL_ADMIN', '用户管理', 'user:student:bind', '学生绑定', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (36, 3, 'COLLEGE_ADMIN', '用户管理', 'user:student:query', '学生查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (37, 3, 'COLLEGE_ADMIN', '用户管理', 'user:teacher:query', '教师查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (38, 1, 'SUPER', '课程管理', 'course:add', '课程新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (39, 1, 'SUPER', '课程管理', 'course:edit', '课程修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (40, 1, 'SUPER', '课程管理', 'course:delete', '课程删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (41, 1, 'SUPER', '课程管理', 'course:query', '课程查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (42, 1, 'SUPER', '课程管理', 'course:student:add', '学生选课', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (43, 1, 'SUPER', '课程管理', 'course:student:remove', '移除学生', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (44, 1, 'SUPER', '课程管理', 'course:student:query', '选课查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (45, 1, 'SUPER', '课程管理', 'course:score:export', '成绩导出', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (46, 2, 'SCOOL_ADMIN', '课程管理', 'course:query', '课程查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (47, 2, 'SCOOL_ADMIN', '课程管理', 'course:student:query', '选课查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (48, 3, 'COLLEGE_ADMIN', '课程管理', 'course:query', '课程查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (49, 3, 'COLLEGE_ADMIN', '课程管理', 'course:student:query', '选课查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (50, 4, 'TEACHER', '课程管理', 'course:add', '课程新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (51, 4, 'TEACHER', '课程管理', 'course:edit', '课程修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (52, 4, 'TEACHER', '课程管理', 'course:delete', '课程删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (53, 4, 'TEACHER', '课程管理', 'course:query', '课程查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (54, 4, 'TEACHER', '课程管理', 'course:student:add', '学生选课', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (55, 4, 'TEACHER', '课程管理', 'course:student:remove', '移除学生', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (56, 4, 'TEACHER', '课程管理', 'course:student:query', '选课查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (57, 4, 'TEACHER', '课程管理', 'course:score:export', '成绩导出', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (58, 5, 'STUDENT', '课程管理', 'course:query', '课程查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (59, 5, 'STUDENT', '课程管理', 'course:join', '加入课程', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (60, 5, 'STUDENT', '课程管理', 'course:quit', '退出课程', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (61, 1, 'SUPER', '作业管理', 'homework:add', '作业新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (62, 1, 'SUPER', '作业管理', 'homework:edit', '作业修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (63, 1, 'SUPER', '作业管理', 'homework:delete', '作业删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (64, 1, 'SUPER', '作业管理', 'homework:query', '作业查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (65, 1, 'SUPER', '作业管理', 'homework:publish', '作业发布', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (66, 1, 'SUPER', '作业管理', 'homework:grade', '作业批改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (67, 1, 'SUPER', '作业管理', 'homework:excellent', '设为优秀', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (68, 1, 'SUPER', '作业管理', 'homework:redo', '重做作业', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (69, 4, 'TEACHER', '作业管理', 'homework:add', '作业新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (70, 4, 'TEACHER', '作业管理', 'homework:edit', '作业修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (71, 4, 'TEACHER', '作业管理', 'homework:delete', '作业删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (72, 4, 'TEACHER', '作业管理', 'homework:query', '作业查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (73, 4, 'TEACHER', '作业管理', 'homework:publish', '作业发布', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (74, 4, 'TEACHER', '作业管理', 'homework:grade', '作业批改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (75, 4, 'TEACHER', '作业管理', 'homework:excellent', '设为优秀', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (76, 4, 'TEACHER', '作业管理', 'homework:redo', '重做作业', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (77, 5, 'STUDENT', '作业管理', 'homework:query', '作业查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (78, 5, 'STUDENT', '作业管理', 'homework:submit', '提交作业', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (79, 5, 'STUDENT', '作业管理', 'homework:update', '更新作业', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (80, 5, 'STUDENT', '作业管理', 'homework:redo', '重做作业', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (81, 1, 'SUPER', '考试管理', 'exam:add', '考试新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (82, 1, 'SUPER', '考试管理', 'exam:edit', '考试修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (83, 1, 'SUPER', '考试管理', 'exam:delete', '考试删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (84, 1, 'SUPER', '考试管理', 'exam:query', '考试查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (85, 1, 'SUPER', '考试管理', 'exam:publish', '考试发布', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (86, 1, 'SUPER', '考试管理', 'exam:grade', '阅卷评分', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (87, 1, 'SUPER', '考试管理', 'exam:makeup', '参加补考', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (88, 4, 'TEACHER', '考试管理', 'exam:add', '考试新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (89, 4, 'TEACHER', '考试管理', 'exam:edit', '考试修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (90, 4, 'TEACHER', '考试管理', 'exam:delete', '考试删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (91, 4, 'TEACHER', '考试管理', 'exam:query', '考试查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (92, 4, 'TEACHER', '考试管理', 'exam:publish', '考试发布', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (93, 4, 'TEACHER', '考试管理', 'exam:grade', '阅卷评分', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (94, 4, 'TEACHER', '考试管理', 'exam:makeup', '参加补考', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (95, 5, 'STUDENT', '考试管理', 'exam:query', '考试查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (96, 5, 'STUDENT', '考试管理', 'exam:take', '参加考试', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (97, 5, 'STUDENT', '考试管理', 'exam:makeup', '参加补考', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (98, 1, 'SUPER', '考勤管理', 'attendance:add', '考勤新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (99, 1, 'SUPER', '考勤管理', 'attendance:edit', '考勤修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (100, 1, 'SUPER', '考勤管理', 'attendance:delete', '考勤删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (101, 1, 'SUPER', '考勤管理', 'attendance:query', '考勤查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (102, 1, 'SUPER', '考勤管理', 'attendance:start', '开始考勤', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (103, 1, 'SUPER', '考勤管理', 'attendance:record', '记录考勤', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (104, 1, 'SUPER', '考勤管理', 'attendance:status:modify', '状态修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (105, 4, 'TEACHER', '考勤管理', 'attendance:add', '考勤新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (106, 4, 'TEACHER', '考勤管理', 'attendance:edit', '考勤修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (107, 4, 'TEACHER', '考勤管理', 'attendance:delete', '考勤删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (108, 4, 'TEACHER', '考勤管理', 'attendance:query', '考勤查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (109, 4, 'TEACHER', '考勤管理', 'attendance:start', '开始考勤', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (110, 4, 'TEACHER', '考勤管理', 'attendance:record', '记录考勤', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (111, 4, 'TEACHER', '考勤管理', 'attendance:status:modify', '状态修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (112, 5, 'STUDENT', '考勤管理', 'attendance:query', '考勤查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (113, 5, 'STUDENT', '考勤管理', 'attendance:sign', '签到', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (114, 1, 'SUPER', '优秀作品', 'excellent:query', '作品查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (115, 1, 'SUPER', '优秀作品', 'excellent:mark', '作品标记', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (116, 1, 'SUPER', '优秀作品', 'excellent:delete', '作品删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (117, 1, 'SUPER', '优秀作品', 'excellent:like', '作品点赞', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (118, 4, 'TEACHER', '优秀作品', 'excellent:query', '作品查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (119, 4, 'TEACHER', '优秀作品', 'excellent:mark', '作品标记', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (120, 4, 'TEACHER', '优秀作品', 'excellent:delete', '作品删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (121, 4, 'TEACHER', '优秀作品', 'excellent:like', '作品点赞', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (122, 5, 'STUDENT', '优秀作品', 'excellent:query', '作品查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (123, 5, 'STUDENT', '优秀作品', 'excellent:like', '作品点赞', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (124, 1, 'SUPER', '通知管理', 'notification:send', '发送通知', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (125, 1, 'SUPER', '通知管理', 'notification:query', '通知查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (126, 1, 'SUPER', '通知管理', 'notification:delete', '通知删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (127, 1, 'SUPER', '通知管理', 'notification:read', '标记已读', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (128, 4, 'TEACHER', '通知管理', 'notification:send', '发送通知', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (129, 4, 'TEACHER', '通知管理', 'notification:query', '通知查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (130, 4, 'TEACHER', '通知管理', 'notification:read', '标记已读', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (131, 5, 'STUDENT', '通知管理', 'notification:query', '通知查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (132, 5, 'STUDENT', '通知管理', 'notification:read', '标记已读', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (133, 1, 'SUPER', '支付管理', 'payment:package:manage', '套餐管理', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (134, 1, 'SUPER', '支付管理', 'payment:order:query', '订单查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (135, 1, 'SUPER', '支付管理', 'payment:recharge', '充值功能', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (136, 4, 'TEACHER', '支付管理', 'payment:recharge', '充值功能', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (137, 4, 'TEACHER', '支付管理', 'payment:order:query', '订单查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (138, 5, 'STUDENT', '支付管理', 'payment:recharge', '充值功能', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (139, 5, 'STUDENT', '支付管理', 'payment:order:query', '订单查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (140, 4, 'TEACHER', '个人中心', 'profile:info', '查看资料', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (141, 4, 'TEACHER', '个人中心', 'profile:update', '更新资料', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (142, 4, 'TEACHER', '个人中心', 'profile:password', '修改密码', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (143, 4, 'TEACHER', '个人中心', 'profile:phone', '修改手机', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (144, 4, 'TEACHER', '个人中心', 'profile:consumption', '消费记录', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (145, 5, 'STUDENT', '个人中心', 'profile:info', '查看资料', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (146, 5, 'STUDENT', '个人中心', 'profile:update', '更新资料', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (147, 5, 'STUDENT', '个人中心', 'profile:password', '修改密码', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (148, 5, 'STUDENT', '个人中心', 'profile:phone', '修改手机', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); +INSERT INTO `kexue_server`.`sys_role_permission` (`permission_id`, `role_id`, `role_code`, `model_name`, `permission_code`, `permission_name`, `create_time`, `update_time`) VALUES (149, 5, 'STUDENT', '个人中心', 'profile:consumption', '消费记录', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); diff --git a/db/sys_role_permission_data_init2.sql b/db/sys_role_permission_data_init2.sql new file mode 100644 index 0000000..b51b487 --- /dev/null +++ b/db/sys_role_permission_data_init2.sql @@ -0,0 +1,103 @@ +INSERT INTO sys_role_permission (role_id, role_code, model_name, permission_code, permission_name, create_time, update_time) VALUES +-- 系统管理模块 +(1, 'SUPER', '系统管理', 'sysUser:add', '用户新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysUser:edit', '用户修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysUser:delete', '用户删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysUser:query', '用户查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysUser:resetPwd', '重置密码', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysRole:add', '角色新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysRole:edit', '角色修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysRole:delete', '角色删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysRole:query', '角色查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysMenu:add', '菜单新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysMenu:edit', '菜单修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysMenu:delete', '菜单删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysDict:manage', '字典管理', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysLog:query', '日志查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysDept:add', '部门新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysDept:edit', '部门修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysDept:delete', '部门删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysDept:query', '部门查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 通知管理模块 +(1, 'SUPER', '通知管理', 'notification:add', '发送通知', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '通知管理', 'notification:delete', '删除通知', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '通知管理', 'notification:query', '查询通知', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '通知管理', 'notification:edit', '编辑通知', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 课程管理模块 +(1, 'SUPER', '课程管理', 'course:add', '课程新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '课程管理', 'course:edit', '课程修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '课程管理', 'course:delete', '课程删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '课程管理', 'course:query', '课程查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 考勤管理模块 +(1, 'SUPER', '考勤管理', 'attendance:add', '考勤新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考勤管理', 'attendance:edit', '考勤修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考勤管理', 'attendance:delete', '考勤删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考勤管理', 'attendance:query', '考勤查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考勤管理', 'attendance:scan', '扫码签到', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 教师管理模块 +(1, 'SUPER', '教师管理', 'teacher:add', '教师新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '教师管理', 'teacher:edit', '教师修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '教师管理', 'teacher:delete', '教师删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '教师管理', 'teacher:query', '教师查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 学生管理模块 +(1, 'SUPER', '学生管理', 'student:add', '学生新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '学生管理', 'student:edit', '学生修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '学生管理', 'student:delete', '学生删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '学生管理', 'student:query', '学生查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 作业管理模块 +(1, 'SUPER', '作业管理', 'homework:add', '作业新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '作业管理', 'homework:edit', '作业修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '作业管理', 'homework:delete', '作业删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '作业管理', 'homework:query', '作业查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '作业管理', 'homework:submit', '作业提交', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '作业管理', 'homework:grade', '作业批改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 考试管理模块 +(1, 'SUPER', '考试管理', 'exam:add', '考试新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考试管理', 'exam:edit', '考试修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考试管理', 'exam:delete', '考试删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考试管理', 'exam:query', '考试查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考试管理', 'exam:submit', '考试提交', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考试管理', 'exam:grade', '考试批改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考试管理', 'exam:makeup', '创建补考', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 优秀作品模块 +(1, 'SUPER', '优秀作品', 'excellentWork:add', '作品新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '优秀作品', 'excellentWork:delete', '作品删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '优秀作品', 'excellentWork:query', '作品查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '优秀作品', 'excellentWork:like', '作品点赞', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '优秀作品', 'excellentWork:mark', '标记优秀', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 账户管理模块 +(1, 'SUPER', '账户管理', 'account:query', '账户查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '账户管理', 'account:recharge', '账户充值', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '账户管理', 'account:gift', '赠送金额', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '账户管理', 'account:transaction', '交易记录', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- SCHOOL_ADMIN 角色权限 +(2, 'SCHOOL_ADMIN', '系统管理', 'sysUser:query', '用户查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '系统管理', 'sysRole:query', '角色查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '教师管理', 'teacher:add', '教师新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '教师管理', 'teacher:edit', '教师修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '教师管理', 'teacher:delete', '教师删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '教师管理', 'teacher:query', '教师查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '学生管理', 'student:add', '学生新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '学生管理', 'student:edit', '学生修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '学生管理', 'student:delete', '学生删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '学生管理', 'student:query', '学生查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '课程管理', 'course:add', '课程新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '课程管理', 'course:edit', '课程修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '课程管理', 'course:delete', '课程删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '课程管理', 'course:query', '课程查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '考勤管理', 'attendance:add', '考勤新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '考勤管理', 'attendance:edit', '考勤修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '考勤管理', 'attendance:query', '考勤查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '作业管理', 'homework:query', '作业查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '考试管理', 'exam:query', '考试查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCHOOL_ADMIN', '优秀作品', 'excellentWork:query', '作品查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); \ No newline at end of file diff --git a/db/sys_role_permission_data_init_merged.sql b/db/sys_role_permission_data_init_merged.sql new file mode 100644 index 0000000..ad28d2b --- /dev/null +++ b/db/sys_role_permission_data_init_merged.sql @@ -0,0 +1,203 @@ +INSERT INTO sys_role_permission (role_id, role_code, model_name, permission_code, permission_name, create_time, update_time) VALUES +-- 系统管理模块 +(1, 'SUPER', '系统管理', 'system:user:add', '用户新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'system:user:edit', '用户修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'system:user:delete', '用户删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'system:user:query', '用户查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysUser:resetPwd', '重置密码', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'system:role:add', '角色新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'system:role:edit', '角色修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'system:role:delete', '角色删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'system:role:query', '角色查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'system:menu:add', '菜单新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'system:menu:edit', '菜单修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'system:menu:delete', '菜单删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'system:dict:manage', '字典管理', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'system:log:query', '日志查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysDept:add', '部门新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysDept:edit', '部门修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysDept:delete', '部门删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '系统管理', 'sysDept:query', '部门查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 用户管理模块 +(1, 'SUPER', '用户管理', 'user:student:add', '学生新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '用户管理', 'user:student:edit', '学生修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '用户管理', 'user:student:delete', '学生删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '用户管理', 'user:student:query', '学生查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '用户管理', 'user:teacher:add', '教师新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '用户管理', 'user:teacher:edit', '教师修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '用户管理', 'user:teacher:delete', '教师删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '用户管理', 'user:teacher:query', '教师查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '用户管理', 'user:teacher:bind', '教师绑定', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '用户管理', 'user:student:bind', '学生绑定', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 课程管理模块 +(1, 'SUPER', '课程管理', 'course:add', '课程新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '课程管理', 'course:edit', '课程修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '课程管理', 'course:delete', '课程删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '课程管理', 'course:query', '课程查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '课程管理', 'course:student:add', '学生选课', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '课程管理', 'course:student:remove', '移除学生', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '课程管理', 'course:student:query', '选课查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '课程管理', 'course:score:export', '成绩导出', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 作业管理模块 +(1, 'SUPER', '作业管理', 'homework:add', '作业新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '作业管理', 'homework:edit', '作业修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '作业管理', 'homework:delete', '作业删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '作业管理', 'homework:query', '作业查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '作业管理', 'homework:publish', '作业发布', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '作业管理', 'homework:grade', '作业批改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '作业管理', 'homework:excellent', '设为优秀', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '作业管理', 'homework:redo', '重做作业', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 考试管理模块 +(1, 'SUPER', '考试管理', 'exam:add', '考试新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考试管理', 'exam:edit', '考试修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考试管理', 'exam:delete', '考试删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考试管理', 'exam:query', '考试查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考试管理', 'exam:publish', '考试发布', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考试管理', 'exam:grade', '阅卷评分', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考试管理', 'exam:makeup', '创建补考', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 考勤管理模块 +(1, 'SUPER', '考勤管理', 'attendance:add', '考勤新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考勤管理', 'attendance:edit', '考勤修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考勤管理', 'attendance:delete', '考勤删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考勤管理', 'attendance:query', '考勤查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考勤管理', 'attendance:start', '开始考勤', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考勤管理', 'attendance:record', '记录考勤', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考勤管理', 'attendance:status:modify', '状态修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '考勤管理', 'attendance:scan', '扫码签到', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 优秀作品模块 +(1, 'SUPER', '优秀作品', 'excellent:query', '作品查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '优秀作品', 'excellent:mark', '作品标记', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '优秀作品', 'excellent:delete', '作品删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '优秀作品', 'excellent:like', '作品点赞', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 通知管理模块 +(1, 'SUPER', '通知管理', 'notification:send', '发送通知', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '通知管理', 'notification:query', '通知查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '通知管理', 'notification:delete', '通知删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '通知管理', 'notification:read', '标记已读', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '通知管理', 'notification:edit', '编辑通知', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 账户管理模块 +(1, 'SUPER', '账户管理', 'account:query', '账户查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '账户管理', 'account:recharge', '账户充值', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '账户管理', 'account:gift', '赠送金额', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '账户管理', 'account:transaction', '交易记录', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- 支付管理模块 +(1, 'SUPER', '支付管理', 'payment:package:manage', '套餐管理', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '支付管理', 'payment:order:query', '订单查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(1, 'SUPER', '支付管理', 'payment:recharge', '充值功能', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- SCHOOL_ADMIN 角色权限 +(2, 'SCOOL_ADMIN', '系统管理', 'system:user:query', '用户查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '系统管理', 'system:role:query', '角色查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '用户管理', 'user:student:add', '学生新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '用户管理', 'user:student:edit', '学生修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '用户管理', 'user:student:delete', '学生删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '用户管理', 'user:student:query', '学生查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '用户管理', 'user:teacher:add', '教师新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '用户管理', 'user:teacher:edit', '教师修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '用户管理', 'user:teacher:delete', '教师删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '用户管理', 'user:teacher:query', '教师查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '用户管理', 'user:teacher:bind', '教师绑定', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '用户管理', 'user:student:bind', '学生绑定', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '课程管理', 'course:query', '课程查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '课程管理', 'course:student:query', '选课查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '课程管理', 'course:add', '课程新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '课程管理', 'course:edit', '课程修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '课程管理', 'course:delete', '课程删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '考勤管理', 'attendance:add', '考勤新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '考勤管理', 'attendance:edit', '考勤修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '考勤管理', 'attendance:query', '考勤查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '作业管理', 'homework:query', '作业查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '考试管理', 'exam:query', '考试查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '优秀作品', 'excellent:query', '作品查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '通知管理', 'notification:send', '发送通知', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '通知管理', 'notification:query', '通知查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(2, 'SCOOL_ADMIN', '通知管理', 'notification:read', '标记已读', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- COLLEGE_ADMIN 角色权限 +(3, 'COLLEGE_ADMIN', '用户管理', 'user:student:query', '学生查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(3, 'COLLEGE_ADMIN', '用户管理', 'user:teacher:query', '教师查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(3, 'COLLEGE_ADMIN', '课程管理', 'course:query', '课程查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(3, 'COLLEGE_ADMIN', '课程管理', 'course:student:query', '选课查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(3, 'COLLEGE_ADMIN', '通知管理', 'notification:send', '发送通知', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(3, 'COLLEGE_ADMIN', '通知管理', 'notification:query', '通知查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(3, 'COLLEGE_ADMIN', '通知管理', 'notification:read', '标记已读', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- TEACHER 角色权限 +(4, 'TEACHER', '课程管理', 'course:add', '课程新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '课程管理', 'course:edit', '课程修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '课程管理', 'course:delete', '课程删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '课程管理', 'course:query', '课程查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '课程管理', 'course:student:add', '学生选课', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '课程管理', 'course:student:remove', '移除学生', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '课程管理', 'course:student:query', '选课查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '课程管理', 'course:score:export', '成绩导出', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '作业管理', 'homework:add', '作业新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '作业管理', 'homework:edit', '作业修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '作业管理', 'homework:delete', '作业删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '作业管理', 'homework:query', '作业查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '作业管理', 'homework:publish', '作业发布', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '作业管理', 'homework:grade', '作业批改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '作业管理', 'homework:excellent', '设为优秀', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '作业管理', 'homework:redo', '重做作业', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '考试管理', 'exam:add', '考试新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '考试管理', 'exam:edit', '考试修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '考试管理', 'exam:delete', '考试删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '考试管理', 'exam:query', '考试查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '考试管理', 'exam:publish', '考试发布', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '考试管理', 'exam:grade', '阅卷评分', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '考试管理', 'exam:makeup', '参加补考', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '考勤管理', 'attendance:add', '考勤新增', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '考勤管理', 'attendance:edit', '考勤修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '考勤管理', 'attendance:delete', '考勤删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '考勤管理', 'attendance:query', '考勤查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '考勤管理', 'attendance:start', '开始考勤', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '考勤管理', 'attendance:record', '记录考勤', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '考勤管理', 'attendance:status:modify', '状态修改', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '优秀作品', 'excellent:query', '作品查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '优秀作品', 'excellent:mark', '作品标记', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '优秀作品', 'excellent:delete', '作品删除', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '优秀作品', 'excellent:like', '作品点赞', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '通知管理', 'notification:send', '发送通知', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '通知管理', 'notification:query', '通知查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '通知管理', 'notification:read', '标记已读', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '支付管理', 'payment:recharge', '充值功能', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '支付管理', 'payment:order:query', '订单查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '个人中心', 'profile:info', '查看资料', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '个人中心', 'profile:update', '更新资料', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '个人中心', 'profile:password', '修改密码', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '个人中心', 'profile:phone', '修改手机', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(4, 'TEACHER', '个人中心', 'profile:consumption', '消费记录', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), + +-- STUDENT 角色权限 +(5, 'STUDENT', '课程管理', 'course:query', '课程查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '课程管理', 'course:join', '加入课程', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '课程管理', 'course:quit', '退出课程', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '作业管理', 'homework:query', '作业查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '作业管理', 'homework:submit', '提交作业', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '作业管理', 'homework:update', '更新作业', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '作业管理', 'homework:redo', '重做作业', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '考试管理', 'exam:query', '考试查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '考试管理', 'exam:take', '参加考试', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '考试管理', 'exam:makeup', '参加补考', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '考勤管理', 'attendance:query', '考勤查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '考勤管理', 'attendance:sign', '签到', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '优秀作品', 'excellent:query', '作品查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '优秀作品', 'excellent:like', '作品点赞', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '通知管理', 'notification:query', '通知查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '通知管理', 'notification:read', '标记已读', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '支付管理', 'payment:recharge', '充值功能', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '支付管理', 'payment:order:query', '订单查询', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '个人中心', 'profile:info', '查看资料', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '个人中心', 'profile:update', '更新资料', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '个人中心', 'profile:password', '修改密码', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '个人中心', 'profile:phone', '修改手机', '2026-04-30 18:00:00', '2026-05-08 16:33:19'), +(5, 'STUDENT', '个人中心', 'profile:consumption', '消费记录', '2026-04-30 18:00:00', '2026-05-08 16:33:19'); \ No newline at end of file diff --git a/mvnw.cmd b/mvnw.cmd deleted file mode 100644 index 34d929b..0000000 --- a/mvnw.cmd +++ /dev/null @@ -1,159 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "on" ("%HOME%\mavenrc_pre.bat" %*) - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -if not "%MAVEN_PROJECTBASEDIR%" == "" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -if exist "%WDIR%\.mvn" goto baseDirFound -cd .. -if "%WDIR%" == "%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - -FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) -) else ( - if not "%MVNW_REPOURL%" == "" ( - SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - ) - if "%MVNW_VERBOSE%" == "true" ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - ) - - powershell -Command "&{$client = new-object System.Net.WebClient; $client.DownloadFile(%DOWNLOAD_URL%, %WRAPPER_JAR%);}" - if "%MVNW_VERBOSE%" == "true" ( - echo Finished downloading %WRAPPER_JAR% - ) -) -@REM End of extension - -@REM Provide a "standardized" way to retrieve the CLI args that will -@REM work with both Windows and non-Windows executions. -set MAVEN_CMD_LINE_ARGS=%* - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* || set ERROR_CODE=1 - -:end -@REM setlocal - -goto mainEnd - -:error -set ERROR_CODE=1 - -:mainEnd -@REM setlocal - -@REM Execute a user defined script after this one -if not "%MAVEN_SKIP_RC%" == "on" ("%HOME%\mavenrc_post.bat") - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% \ No newline at end of file diff --git a/pom.xml b/pom.xml index ba83ffa..c410ab8 100644 --- a/pom.xml +++ b/pom.xml @@ -2,11 +2,11 @@ 4.0.0 - com.kexue - skills - agentSkills + art.kexue + kexueServer + kexueServer 0.0.1-SNAPSHOT - 可学AI-skills平台 + 可学AI-实训网站 17 UTF-8 @@ -264,7 +264,7 @@ com.github.binarywang weixin-java-pay - 4.4.0 + 4.7.0 @@ -292,6 +292,23 @@ 16.02-2.01 + + com.google.zxing + core + 3.4.1 + + + com.google.zxing + javase + 3.4.1 + + + + com.github.binarywang + weixin-java-mp + 4.7.0 + + @@ -306,7 +323,7 @@ - agentSkills + kexueServer org.apache.maven.plugins @@ -337,7 +354,7 @@ spring-boot-maven-plugin ${spring-boot.version} - com.kexue.skills.SkillsApp + art.kexue.sxwz.KexueServerApp false diff --git a/src/main/java/com/kexue/skills/SkillsApp.java b/src/main/java/art/kexue/sxwz/KexueServerApp.java similarity index 51% rename from src/main/java/com/kexue/skills/SkillsApp.java rename to src/main/java/art/kexue/sxwz/KexueServerApp.java index 9dd987a..d734d2e 100644 --- a/src/main/java/com/kexue/skills/SkillsApp.java +++ b/src/main/java/art/kexue/sxwz/KexueServerApp.java @@ -1,27 +1,22 @@ -package com.kexue.skills; +package art.kexue.sxwz; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.context.event.EventListener; import org.springframework.scheduling.annotation.EnableScheduling; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.InetAddress; -import java.net.UnknownHostException; - @SpringBootApplication -@MapperScan(basePackages = "com.kexue.skills.mapper") +@MapperScan(basePackages = "art.kexue.sxwz.mapper") +@ComponentScan(basePackages = "art.kexue.sxwz") @EnableAspectJAutoProxy @EnableScheduling -public class SkillsApp { +public class KexueServerApp { public static void main(String[] args) { - SpringApplication.run(SkillsApp.class, args); + SpringApplication.run(KexueServerApp.class, args); } } + diff --git a/src/main/java/com/kexue/skills/annotation/Excel.java b/src/main/java/art/kexue/sxwz/annotation/Excel.java similarity index 92% rename from src/main/java/com/kexue/skills/annotation/Excel.java rename to src/main/java/art/kexue/sxwz/annotation/Excel.java index 6834407..14cc32b 100644 --- a/src/main/java/com/kexue/skills/annotation/Excel.java +++ b/src/main/java/art/kexue/sxwz/annotation/Excel.java @@ -1,4 +1,4 @@ -package com.kexue.skills.annotation; +package art.kexue.sxwz.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -22,4 +22,4 @@ public @interface Excel { * 列排序(值越小越靠前) */ int sort() default 100; -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/annotation/Log.java b/src/main/java/art/kexue/sxwz/annotation/Log.java similarity index 95% rename from src/main/java/com/kexue/skills/annotation/Log.java rename to src/main/java/art/kexue/sxwz/annotation/Log.java index c1792cd..18f64c4 100644 --- a/src/main/java/com/kexue/skills/annotation/Log.java +++ b/src/main/java/art/kexue/sxwz/annotation/Log.java @@ -1,4 +1,4 @@ -package com.kexue.skills.annotation; +package art.kexue.sxwz.annotation; import java.lang.annotation.*; @@ -32,3 +32,4 @@ public @interface Log { */ boolean ignore() default false; } + diff --git a/src/main/java/com/kexue/skills/annotation/PreventDuplicateSubmission.java b/src/main/java/art/kexue/sxwz/annotation/PreventDuplicateSubmission.java similarity index 91% rename from src/main/java/com/kexue/skills/annotation/PreventDuplicateSubmission.java rename to src/main/java/art/kexue/sxwz/annotation/PreventDuplicateSubmission.java index 2c2fa32..8afb5b4 100644 --- a/src/main/java/com/kexue/skills/annotation/PreventDuplicateSubmission.java +++ b/src/main/java/art/kexue/sxwz/annotation/PreventDuplicateSubmission.java @@ -1,4 +1,4 @@ -package com.kexue.skills.annotation; +package art.kexue.sxwz.annotation; /** * @author 维哥 @@ -14,4 +14,4 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) public @interface PreventDuplicateSubmission { long timeout() default 1000; // 默认超时时间为1秒 -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/annotation/RequireAuth.java b/src/main/java/art/kexue/sxwz/annotation/RequireAuth.java similarity index 90% rename from src/main/java/com/kexue/skills/annotation/RequireAuth.java rename to src/main/java/art/kexue/sxwz/annotation/RequireAuth.java index 520df1f..8b39cee 100644 --- a/src/main/java/com/kexue/skills/annotation/RequireAuth.java +++ b/src/main/java/art/kexue/sxwz/annotation/RequireAuth.java @@ -1,4 +1,4 @@ -package com.kexue.skills.annotation; +package art.kexue.sxwz.annotation; /** * @author 维哥 @@ -13,4 +13,4 @@ import java.lang.annotation.Target; @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface RequireAuth { -} \ No newline at end of file +} diff --git a/src/main/java/art/kexue/sxwz/annotation/RequirePermission.java b/src/main/java/art/kexue/sxwz/annotation/RequirePermission.java new file mode 100644 index 0000000..0661823 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/annotation/RequirePermission.java @@ -0,0 +1,12 @@ +package art.kexue.sxwz.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface RequirePermission { + String[] value() default {}; +} diff --git a/src/main/java/com/kexue/skills/annotation/RequireRole.java b/src/main/java/art/kexue/sxwz/annotation/RequireRole.java similarity index 92% rename from src/main/java/com/kexue/skills/annotation/RequireRole.java rename to src/main/java/art/kexue/sxwz/annotation/RequireRole.java index a9462ff..a903acf 100644 --- a/src/main/java/com/kexue/skills/annotation/RequireRole.java +++ b/src/main/java/art/kexue/sxwz/annotation/RequireRole.java @@ -1,4 +1,4 @@ -package com.kexue.skills.annotation; +package art.kexue.sxwz.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -18,4 +18,4 @@ public @interface RequireRole { * @return 角色编码列表 */ String[] value() default {}; -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/aspect/AuthAspect.java b/src/main/java/art/kexue/sxwz/aspect/AuthAspect.java similarity index 86% rename from src/main/java/com/kexue/skills/aspect/AuthAspect.java rename to src/main/java/art/kexue/sxwz/aspect/AuthAspect.java index 9c024ad..42cc8a3 100644 --- a/src/main/java/com/kexue/skills/aspect/AuthAspect.java +++ b/src/main/java/art/kexue/sxwz/aspect/AuthAspect.java @@ -1,10 +1,9 @@ -package com.kexue.skills.aspect; +package art.kexue.sxwz.aspect; -import com.kexue.skills.annotation.RequireAuth; -import com.kexue.skills.common.ResultCode; -import com.kexue.skills.exception.BizException; -import com.kexue.skills.interceptor.UserContextHolder; -import com.kexue.skills.service.SysUserService; +import art.kexue.sxwz.common.ResultCode; +import art.kexue.sxwz.exception.BizException; +import art.kexue.sxwz.interceptor.UserContextHolder; +import art.kexue.sxwz.service.SysUserService; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; @@ -30,13 +29,13 @@ public class AuthAspect { private SysUserService sysUserService; // 处理方法级别注解 - @Around("@annotation(com.kexue.skills.annotation.RequireAuth)") + @Around("@annotation(art.kexue.sxwz.annotation.RequireAuth)") public Object requireAuthMethod(ProceedingJoinPoint joinPoint) throws Throwable { return requireAuthImpl(joinPoint); } // 处理类级别注解 - @Around("@within(com.kexue.skills.annotation.RequireAuth)") + @Around("@within(art.kexue.sxwz.annotation.RequireAuth)") public Object requireAuthClass(ProceedingJoinPoint joinPoint) throws Throwable { return requireAuthImpl(joinPoint); } @@ -73,4 +72,4 @@ public class AuthAspect { } return joinPoint.proceed(); } -} \ No newline at end of file +} diff --git a/src/main/java/art/kexue/sxwz/aspect/EduPermissionAspect.java b/src/main/java/art/kexue/sxwz/aspect/EduPermissionAspect.java new file mode 100644 index 0000000..cfbab5d --- /dev/null +++ b/src/main/java/art/kexue/sxwz/aspect/EduPermissionAspect.java @@ -0,0 +1,169 @@ +package art.kexue.sxwz.aspect; + +import art.kexue.sxwz.exception.BizException; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.reflect.MethodSignature; +import org.redisson.api.RedissonClient; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.Collections; +import java.util.List; + +@Aspect +@Component +@Slf4j +public class EduPermissionAspect { + + @Resource + private RedissonClient redissonClient; + + @Around("execution(* art.kexue.sxwz.service.impl.Edu*ServiceImpl.*(..))") + public Object checkEduPermission(ProceedingJoinPoint joinPoint) throws Throwable { + try { + cn.dev33.satoken.stp.StpUtil.checkLogin(); + + Long userId = cn.dev33.satoken.stp.StpUtil.getLoginIdAsLong(); + String token = cn.dev33.satoken.stp.StpUtil.getTokenValue(); + + // SUPER角色拥有所有权限,直接放行 + if (cn.dev33.satoken.stp.StpUtil.hasRole("SUPER")) { + log.info("用户ID: {} 拥有SUPER角色,直接放行,访问方法: {}", userId, joinPoint.getSignature().getName()); + return joinPoint.proceed(); + } + + List permissions = getUserPermissions(token); + + String requiredPermission = generatePermissionCode(joinPoint); + + log.info("用户ID: {}, 访问方法: {}, 需要权限: {}", + userId, + joinPoint.getSignature().getName(), + requiredPermission); + + if (permissions == null || permissions.isEmpty()) { + log.warn("用户未配置任何权限"); + throw new BizException(403, "没有相应操作权限"); + } + + if (!permissions.contains(requiredPermission)) { + log.warn("用户缺少权限: {}", requiredPermission); + throw new BizException(403, "没有相应操作权限"); + } + + log.info("权限验证通过: {}", requiredPermission); + + } catch (cn.dev33.satoken.exception.NotLoginException e) { + log.error("未登录:{}", e.getMessage()); + throw new BizException(401, "请先登录认证后操作"); + } catch (BizException e) { + throw e; + } catch (Exception e) { + log.error("权限验证失败:{}", e.getMessage()); + throw new BizException(403, "权限验证失败"); + } + + return joinPoint.proceed(); + } + + private List getUserPermissions(String token) { + try { + String loginUserJson = (String) redissonClient.getBucket("loginUser:" + token).get(); + if (loginUserJson != null && !loginUserJson.isEmpty()) { + cn.hutool.json.JSONObject jsonObject = cn.hutool.json.JSONUtil.parseObj(loginUserJson); + cn.hutool.json.JSONArray permissionsArray = jsonObject.getJSONArray("permissions"); + if (permissionsArray != null) { + return permissionsArray.toList(String.class); + } + } + } catch (Exception e) { + log.error("从Redis获取用户权限失败:{}", e.getMessage()); + } + return Collections.emptyList(); + } + + private String generatePermissionCode(ProceedingJoinPoint joinPoint) { + String className = joinPoint.getTarget().getClass().getSimpleName(); + String methodName = joinPoint.getSignature().getName(); + + String module = extractModule(className); + String action = extractAction(methodName); + + return String.format("%s:%s", module, action); + } + + private String extractModule(String className) { + if (className.startsWith("EduCourse")) { + return "course"; + } else if (className.startsWith("EduStudent")) { + return "user:student"; + } else if (className.startsWith("EduTeacher")) { + return "user:teacher"; + } else if (className.startsWith("EduHomework")) { + return "homework"; + } else if (className.startsWith("EduExam")) { + return "exam"; + } else if (className.startsWith("EduAttendance")) { + return "attendance"; + } else if (className.startsWith("EduExcellentWork")) { + return "excellent"; + }else if (className.startsWith("EduSchool")) { + return "school"; + } else { + return className.replace("Edu", "").replace("ServiceImpl", "").toLowerCase(); + } + } + + private String extractAction(String methodName) { + if (methodName.startsWith("save") || methodName.startsWith("create")) { + return "add"; + } else if (methodName.startsWith("update") && !methodName.startsWith("updateStatus")) { + return "update"; // 修改:update方法返回update而非edit + } else if (methodName.startsWith("updateStatus")) { + return "updateStatus"; // 新增:状态变更方法 + } else if (methodName.startsWith("edit")) { + return "edit"; + } else if (methodName.startsWith("delete") || methodName.startsWith("remove")) { + return "delete"; + } else if (methodName.equals("pageList")) { + return "pageList"; // 新增:分页查询方法 + } else if (methodName.startsWith("query") || methodName.startsWith("get") || methodName.startsWith("list")) { + return "query"; + } else if (methodName.startsWith("addStudent")) { + return "student:add"; + } else if (methodName.startsWith("removeStudent")) { + return "student:remove"; + } else if (methodName.startsWith("submit")) { + return "submit"; + } else if (methodName.startsWith("grade")) { + return "grade"; + } else if (methodName.startsWith("publish")) { + return "publish"; + } else if (methodName.startsWith("mark")) { + return "mark"; + } else if (methodName.startsWith("addLike")) { + return "like"; + } else if (methodName.startsWith("removeLike")) { + return "like:remove"; + } else if (methodName.startsWith("countLikes")) { + return "like:count"; + } else if (methodName.startsWith("recordAttendance")) { + return "record"; + } else if (methodName.startsWith("batchCreate")) { + return "batch:add"; + } else if (methodName.startsWith("isStudentIn")) { + return "student:exists"; + } else if (methodName.startsWith("sendNotification")) { + return "notification:send"; + } else if (methodName.startsWith("markAsRead")) { + return "notification:read"; + } else if (methodName.startsWith("createMakeup")) { + return "makeup"; + } else { + return methodName.toLowerCase(); + } + } +} diff --git a/src/main/java/com/kexue/skills/aspect/PreventDuplicateSubmissionAspect.java b/src/main/java/art/kexue/sxwz/aspect/PreventDuplicateSubmissionAspect.java similarity index 90% rename from src/main/java/com/kexue/skills/aspect/PreventDuplicateSubmissionAspect.java rename to src/main/java/art/kexue/sxwz/aspect/PreventDuplicateSubmissionAspect.java index 4e12813..7c2850e 100644 --- a/src/main/java/com/kexue/skills/aspect/PreventDuplicateSubmissionAspect.java +++ b/src/main/java/art/kexue/sxwz/aspect/PreventDuplicateSubmissionAspect.java @@ -1,9 +1,9 @@ -package com.kexue.skills.aspect; +package art.kexue.sxwz.aspect; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; -import com.kexue.skills.annotation.PreventDuplicateSubmission; -import com.kexue.skills.exception.BizException; +import art.kexue.sxwz.annotation.PreventDuplicateSubmission; +import art.kexue.sxwz.exception.BizException; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; @@ -28,13 +28,13 @@ public class PreventDuplicateSubmissionAspect { .build(); // 处理方法级别注解 - @Around("@annotation(com.kexue.skills.annotation.PreventDuplicateSubmission)") + @Around("@annotation(art.kexue.sxwz.annotation.PreventDuplicateSubmission)") public Object preventDuplicateSubmissionMethod(ProceedingJoinPoint joinPoint) throws Throwable { return preventDuplicateSubmissionImpl(joinPoint); } // 处理类级别注解 - @Around("@within(com.kexue.skills.annotation.PreventDuplicateSubmission)") + @Around("@within(art.kexue.sxwz.annotation.PreventDuplicateSubmission)") public Object preventDuplicateSubmissionClass(ProceedingJoinPoint joinPoint) throws Throwable { return preventDuplicateSubmissionImpl(joinPoint); } @@ -74,4 +74,4 @@ public class PreventDuplicateSubmissionAspect { private String generateKey(HttpServletRequest request, String methodSignature) { return request.getSession().getId() + ":" + methodSignature; } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/aspect/RoleAspect.java b/src/main/java/art/kexue/sxwz/aspect/RoleAspect.java similarity index 81% rename from src/main/java/com/kexue/skills/aspect/RoleAspect.java rename to src/main/java/art/kexue/sxwz/aspect/RoleAspect.java index 0efafc3..7e939e9 100644 --- a/src/main/java/com/kexue/skills/aspect/RoleAspect.java +++ b/src/main/java/art/kexue/sxwz/aspect/RoleAspect.java @@ -1,10 +1,10 @@ -package com.kexue.skills.aspect; +package art.kexue.sxwz.aspect; -import com.kexue.skills.annotation.RequireRole; -import com.kexue.skills.common.ResultCode; -import com.kexue.skills.exception.BizException; -import com.kexue.skills.interceptor.UserContextHolder; -import com.kexue.skills.service.SysUserService; +import art.kexue.sxwz.annotation.RequireRole; +import art.kexue.sxwz.common.ResultCode; +import art.kexue.sxwz.exception.BizException; +import art.kexue.sxwz.interceptor.UserContextHolder; +import art.kexue.sxwz.service.SysUserService; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; @@ -32,13 +32,13 @@ public class RoleAspect { private SysUserService sysUserService; // 处理方法级别注解 - @Around("@annotation(com.kexue.skills.annotation.RequireRole)") + @Around("@annotation(art.kexue.sxwz.annotation.RequireRole)") public Object requireRoleMethod(ProceedingJoinPoint joinPoint) throws Throwable { return requireRoleImpl(joinPoint); } // 处理类级别注解 - @Around("@within(com.kexue.skills.annotation.RequireRole)") + @Around("@within(art.kexue.sxwz.annotation.RequireRole)") public Object requireRoleClass(ProceedingJoinPoint joinPoint) throws Throwable { return requireRoleImpl(joinPoint); } @@ -83,6 +83,13 @@ public class RoleAspect { String.join(",", requireRole.value()), requireRole.getClass().getName()); + // SUPER角色拥有所有权限,直接放行 + if (cn.dev33.satoken.stp.StpUtil.hasRole("SUPER")) { + log.info("用户{}拥有SUPER角色,直接放行", username); + UserContextHolder.setUserName(username); + return joinPoint.proceed(); + } + // 获取用户的角色列表 String[] requiredRoles = requireRole.value(); if (requiredRoles != null && requiredRoles.length > 0) { @@ -90,17 +97,17 @@ public class RoleAspect { List userRoles = cn.dev33.satoken.stp.StpUtil.getRoleList(); log.info("当前用户的角色列表:{}", String.join(",", userRoles)); - // 检查用户是否拥有所有必需的角色 - boolean hasAllRoles = true; + // 修改为OR逻辑:检查用户是否拥有任意一个必需的角色 + boolean hasAnyRole = false; for (String role : requiredRoles) { - if (!userRoles.contains(role)) { - hasAllRoles = false; - log.error("用户缺少角色:{}", role); + if (userRoles.contains(role)) { + hasAnyRole = true; + log.info("用户拥有角色:{}", role); break; } } - if (!hasAllRoles) { + if (!hasAnyRole) { throw new cn.dev33.satoken.exception.NotRoleException(requiredRoles[0]); } } @@ -121,4 +128,4 @@ public class RoleAspect { } return joinPoint.proceed(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/common/Assert.java b/src/main/java/art/kexue/sxwz/common/Assert.java similarity index 99% rename from src/main/java/com/kexue/skills/common/Assert.java rename to src/main/java/art/kexue/sxwz/common/Assert.java index c91f051..2406e8e 100644 --- a/src/main/java/com/kexue/skills/common/Assert.java +++ b/src/main/java/art/kexue/sxwz/common/Assert.java @@ -1,6 +1,6 @@ -package com.kexue.skills.common; +package art.kexue.sxwz.common; -import com.kexue.skills.exception.BizException; +import art.kexue.sxwz.exception.BizException; import java.util.Collection; import java.util.Map; @@ -296,4 +296,4 @@ public class Assert { throw new BizException(errorCode, message); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/common/CacheManager.java b/src/main/java/art/kexue/sxwz/common/CacheManager.java similarity index 97% rename from src/main/java/com/kexue/skills/common/CacheManager.java rename to src/main/java/art/kexue/sxwz/common/CacheManager.java index 6ce3d06..0dd1fb2 100644 --- a/src/main/java/com/kexue/skills/common/CacheManager.java +++ b/src/main/java/art/kexue/sxwz/common/CacheManager.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common; +package art.kexue.sxwz.common; import com.google.common.cache.Cache; @@ -49,4 +49,4 @@ public class CacheManager { //查看缓存剩余时间 -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/common/CommonResult.java b/src/main/java/art/kexue/sxwz/common/CommonResult.java similarity index 99% rename from src/main/java/com/kexue/skills/common/CommonResult.java rename to src/main/java/art/kexue/sxwz/common/CommonResult.java index 7965833..9e558f1 100644 --- a/src/main/java/com/kexue/skills/common/CommonResult.java +++ b/src/main/java/art/kexue/sxwz/common/CommonResult.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common; +package art.kexue.sxwz.common; import io.swagger.annotations.ApiModel; import io.swagger.v3.oas.annotations.media.Schema; @@ -134,3 +134,4 @@ public class CommonResult { } + diff --git a/src/main/java/com/kexue/skills/common/Const.java b/src/main/java/art/kexue/sxwz/common/Const.java similarity index 97% rename from src/main/java/com/kexue/skills/common/Const.java rename to src/main/java/art/kexue/sxwz/common/Const.java index cec56f1..5ab6b4f 100644 --- a/src/main/java/com/kexue/skills/common/Const.java +++ b/src/main/java/art/kexue/sxwz/common/Const.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common; +package art.kexue.sxwz.common; import java.util.Arrays; import java.util.List; @@ -33,3 +33,4 @@ public interface Const { Integer ACCOUNT_STATUS_ACCOUNTED = 1;//已扎帐 Integer ACCOUNT_STATUS_UNACCOUNTED = 2; //未扎帐 } + diff --git a/src/main/java/com/kexue/skills/common/ErrorStatus.java b/src/main/java/art/kexue/sxwz/common/ErrorStatus.java similarity index 95% rename from src/main/java/com/kexue/skills/common/ErrorStatus.java rename to src/main/java/art/kexue/sxwz/common/ErrorStatus.java index 26fdf2d..f8b1c2e 100644 --- a/src/main/java/com/kexue/skills/common/ErrorStatus.java +++ b/src/main/java/art/kexue/sxwz/common/ErrorStatus.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common; +package art.kexue.sxwz.common; /** * 错误代号和信息 @@ -31,3 +31,4 @@ public enum ErrorStatus { return message; } } + diff --git a/src/main/java/com/kexue/skills/common/IErrorCode.java b/src/main/java/art/kexue/sxwz/common/IErrorCode.java similarity index 90% rename from src/main/java/com/kexue/skills/common/IErrorCode.java rename to src/main/java/art/kexue/sxwz/common/IErrorCode.java index deb9c4b..3ea6ac6 100644 --- a/src/main/java/com/kexue/skills/common/IErrorCode.java +++ b/src/main/java/art/kexue/sxwz/common/IErrorCode.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common; +package art.kexue.sxwz.common; /** * 封装API的错误码 @@ -18,3 +18,4 @@ public interface IErrorCode { */ String getMessage(); } + diff --git a/src/main/java/com/kexue/skills/common/Result.java b/src/main/java/art/kexue/sxwz/common/Result.java similarity index 98% rename from src/main/java/com/kexue/skills/common/Result.java rename to src/main/java/art/kexue/sxwz/common/Result.java index 5939e4a..c8883cf 100644 --- a/src/main/java/com/kexue/skills/common/Result.java +++ b/src/main/java/art/kexue/sxwz/common/Result.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common; +package art.kexue.sxwz.common; /** * 请求返回结果 @@ -108,3 +108,4 @@ public class Result { this.data = data; } } + diff --git a/src/main/java/com/kexue/skills/common/ResultCode.java b/src/main/java/art/kexue/sxwz/common/ResultCode.java similarity index 98% rename from src/main/java/com/kexue/skills/common/ResultCode.java rename to src/main/java/art/kexue/sxwz/common/ResultCode.java index 4b02aee..94b0e94 100644 --- a/src/main/java/com/kexue/skills/common/ResultCode.java +++ b/src/main/java/art/kexue/sxwz/common/ResultCode.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common; +package art.kexue.sxwz.common; /** * 枚举了一些常用API操作码 @@ -124,3 +124,4 @@ public enum ResultCode implements IErrorCode { return message; } } + diff --git a/src/main/java/com/kexue/skills/common/ResultEntity.java b/src/main/java/art/kexue/sxwz/common/ResultEntity.java similarity index 97% rename from src/main/java/com/kexue/skills/common/ResultEntity.java rename to src/main/java/art/kexue/sxwz/common/ResultEntity.java index c48589a..d6f61fd 100644 --- a/src/main/java/com/kexue/skills/common/ResultEntity.java +++ b/src/main/java/art/kexue/sxwz/common/ResultEntity.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common; +package art.kexue.sxwz.common; /** * 返回结果工具类 @@ -46,3 +46,4 @@ public class ResultEntity { } } + diff --git a/src/main/java/com/kexue/skills/common/VerifyCode.java b/src/main/java/art/kexue/sxwz/common/VerifyCode.java similarity index 98% rename from src/main/java/com/kexue/skills/common/VerifyCode.java rename to src/main/java/art/kexue/sxwz/common/VerifyCode.java index 26f2d02..1b6107c 100644 --- a/src/main/java/com/kexue/skills/common/VerifyCode.java +++ b/src/main/java/art/kexue/sxwz/common/VerifyCode.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common; +package art.kexue.sxwz.common; import java.awt.*; import java.awt.image.BufferedImage; @@ -73,3 +73,4 @@ public class VerifyCode { } } + diff --git a/src/main/java/com/kexue/skills/common/util/AESUtils.java b/src/main/java/art/kexue/sxwz/common/util/AESUtils.java similarity index 99% rename from src/main/java/com/kexue/skills/common/util/AESUtils.java rename to src/main/java/art/kexue/sxwz/common/util/AESUtils.java index 2c8d8de..2d12a59 100644 --- a/src/main/java/com/kexue/skills/common/util/AESUtils.java +++ b/src/main/java/art/kexue/sxwz/common/util/AESUtils.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; import javax.crypto.*; import javax.crypto.spec.IvParameterSpec; @@ -119,4 +119,4 @@ public class AESUtils { e.printStackTrace(); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/common/util/BytesHelper.java b/src/main/java/art/kexue/sxwz/common/util/BytesHelper.java similarity index 98% rename from src/main/java/com/kexue/skills/common/util/BytesHelper.java rename to src/main/java/art/kexue/sxwz/common/util/BytesHelper.java index 9f53fda..55817c6 100644 --- a/src/main/java/com/kexue/skills/common/util/BytesHelper.java +++ b/src/main/java/art/kexue/sxwz/common/util/BytesHelper.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; import java.io.*; @@ -97,3 +97,4 @@ public class BytesHelper { return 0; } } + diff --git a/src/main/java/com/kexue/skills/common/util/DateConverter.java b/src/main/java/art/kexue/sxwz/common/util/DateConverter.java similarity index 98% rename from src/main/java/com/kexue/skills/common/util/DateConverter.java rename to src/main/java/art/kexue/sxwz/common/util/DateConverter.java index 14e7d0c..cb70c9a 100644 --- a/src/main/java/com/kexue/skills/common/util/DateConverter.java +++ b/src/main/java/art/kexue/sxwz/common/util/DateConverter.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; import cn.hutool.core.date.DateUtil; @@ -88,3 +88,4 @@ public class DateConverter { System.out.println(convertShortTime("12:5")); // 输出:12:05:00 } } + diff --git a/src/main/java/com/kexue/skills/common/util/DateUtil.java b/src/main/java/art/kexue/sxwz/common/util/DateUtil.java similarity index 97% rename from src/main/java/com/kexue/skills/common/util/DateUtil.java rename to src/main/java/art/kexue/sxwz/common/util/DateUtil.java index 9b5f556..0ca7bcf 100644 --- a/src/main/java/com/kexue/skills/common/util/DateUtil.java +++ b/src/main/java/art/kexue/sxwz/common/util/DateUtil.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -41,3 +41,4 @@ public class DateUtil { System.out.println(getDaysBetwwen(7)); }*/ } + diff --git a/src/main/java/com/kexue/skills/common/util/ExportUtils.java b/src/main/java/art/kexue/sxwz/common/util/ExportUtils.java similarity index 98% rename from src/main/java/com/kexue/skills/common/util/ExportUtils.java rename to src/main/java/art/kexue/sxwz/common/util/ExportUtils.java index d0f7bc8..6c142ca 100644 --- a/src/main/java/com/kexue/skills/common/util/ExportUtils.java +++ b/src/main/java/art/kexue/sxwz/common/util/ExportUtils.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; import cn.hutool.core.annotation.AnnotationUtil; import cn.hutool.core.bean.BeanUtil; @@ -9,15 +9,14 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelWriter; import cn.hutool.poi.excel.StyleSet; -import com.kexue.skills.annotation.Excel; +import art.kexue.sxwz.annotation.Excel; import io.swagger.annotations.ApiModelProperty; -import io.swagger.v3.oas.annotations.media.Schema; import org.apache.poi.ss.usermodel.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import jakarta.servlet.http.HttpServletResponse; -import java.io.IOException; + import java.io.OutputStream; import java.lang.reflect.Field; import java.net.URLEncoder; @@ -204,4 +203,4 @@ public class ExportUtils { export(list, clazz, response.getOutputStream()); // 调用新的流式导出方法 } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/common/util/FileHelper.java b/src/main/java/art/kexue/sxwz/common/util/FileHelper.java similarity index 99% rename from src/main/java/com/kexue/skills/common/util/FileHelper.java rename to src/main/java/art/kexue/sxwz/common/util/FileHelper.java index 15fa4ca..c27a16e 100644 --- a/src/main/java/com/kexue/skills/common/util/FileHelper.java +++ b/src/main/java/art/kexue/sxwz/common/util/FileHelper.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; @@ -337,3 +337,4 @@ public final class FileHelper } + diff --git a/src/main/java/com/kexue/skills/common/util/FrontUtils.java b/src/main/java/art/kexue/sxwz/common/util/FrontUtils.java similarity index 99% rename from src/main/java/com/kexue/skills/common/util/FrontUtils.java rename to src/main/java/art/kexue/sxwz/common/util/FrontUtils.java index d556398..010fcf5 100644 --- a/src/main/java/com/kexue/skills/common/util/FrontUtils.java +++ b/src/main/java/art/kexue/sxwz/common/util/FrontUtils.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; import io.swagger.annotations.ApiModelProperty; import io.swagger.v3.oas.annotations.media.Schema; @@ -163,3 +163,4 @@ public class FrontUtils { } } + diff --git a/src/main/java/com/kexue/skills/common/util/HttpUtil.java b/src/main/java/art/kexue/sxwz/common/util/HttpUtil.java similarity index 98% rename from src/main/java/com/kexue/skills/common/util/HttpUtil.java rename to src/main/java/art/kexue/sxwz/common/util/HttpUtil.java index 452b3e0..9156cc7 100644 --- a/src/main/java/com/kexue/skills/common/util/HttpUtil.java +++ b/src/main/java/art/kexue/sxwz/common/util/HttpUtil.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; import com.alibaba.fastjson.JSON; @@ -100,4 +100,4 @@ public class HttpUtil { return response.body(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/common/util/IDUtils.java b/src/main/java/art/kexue/sxwz/common/util/IDUtils.java similarity index 99% rename from src/main/java/com/kexue/skills/common/util/IDUtils.java rename to src/main/java/art/kexue/sxwz/common/util/IDUtils.java index 6af6d32..f9f8be0 100644 --- a/src/main/java/com/kexue/skills/common/util/IDUtils.java +++ b/src/main/java/art/kexue/sxwz/common/util/IDUtils.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -118,3 +118,4 @@ public class IDUtils { } } } + diff --git a/src/main/java/com/kexue/skills/common/util/ImageUtil.java b/src/main/java/art/kexue/sxwz/common/util/ImageUtil.java similarity index 99% rename from src/main/java/com/kexue/skills/common/util/ImageUtil.java rename to src/main/java/art/kexue/sxwz/common/util/ImageUtil.java index 4053bfb..31a9294 100644 --- a/src/main/java/com/kexue/skills/common/util/ImageUtil.java +++ b/src/main/java/art/kexue/sxwz/common/util/ImageUtil.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -85,3 +85,4 @@ public class ImageUtil { imageUtil.thumbnailImage("C:\\Users\\ACER\\Pictures\\雷克萨斯\\index-kv-nx-0821-2880x1480.jpg",190,180,DEFAULT_PREVFIX,false); } } + diff --git a/src/main/java/com/kexue/skills/common/util/IpUtil.java b/src/main/java/art/kexue/sxwz/common/util/IpUtil.java similarity index 98% rename from src/main/java/com/kexue/skills/common/util/IpUtil.java rename to src/main/java/art/kexue/sxwz/common/util/IpUtil.java index adfe538..01184b4 100644 --- a/src/main/java/com/kexue/skills/common/util/IpUtil.java +++ b/src/main/java/art/kexue/sxwz/common/util/IpUtil.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -137,3 +137,4 @@ public class IpUtil { return "127.0.0.1"; } } + diff --git a/src/main/java/com/kexue/skills/common/util/MD5Util.java b/src/main/java/art/kexue/sxwz/common/util/MD5Util.java similarity index 97% rename from src/main/java/com/kexue/skills/common/util/MD5Util.java rename to src/main/java/art/kexue/sxwz/common/util/MD5Util.java index 9d63f23..d63b2b9 100644 --- a/src/main/java/com/kexue/skills/common/util/MD5Util.java +++ b/src/main/java/art/kexue/sxwz/common/util/MD5Util.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; import java.io.UnsupportedEncodingException; import java.math.BigInteger; @@ -41,3 +41,4 @@ public class MD5Util { System.out.println(MD5Util.encode("admin")); } } + diff --git a/src/main/java/com/kexue/skills/common/util/SecurityUtil.java b/src/main/java/art/kexue/sxwz/common/util/SecurityUtil.java similarity index 93% rename from src/main/java/com/kexue/skills/common/util/SecurityUtil.java rename to src/main/java/art/kexue/sxwz/common/util/SecurityUtil.java index 23c0980..249050f 100644 --- a/src/main/java/com/kexue/skills/common/util/SecurityUtil.java +++ b/src/main/java/art/kexue/sxwz/common/util/SecurityUtil.java @@ -1,4 +1,4 @@ -//package com.kexue.skills.publisher.common.util; +//package art.kexue.sxwz.publisher.common.util; // //import org.springframework.security.authentication.AnonymousAuthenticationToken; //import org.springframework.security.core.Authentication; @@ -17,3 +17,4 @@ // return ""; // } //} + diff --git a/src/main/java/com/kexue/skills/common/util/SkillZipParser.java b/src/main/java/art/kexue/sxwz/common/util/SkillZipParser.java similarity index 99% rename from src/main/java/com/kexue/skills/common/util/SkillZipParser.java rename to src/main/java/art/kexue/sxwz/common/util/SkillZipParser.java index 68b81f4..258baff 100644 --- a/src/main/java/com/kexue/skills/common/util/SkillZipParser.java +++ b/src/main/java/art/kexue/sxwz/common/util/SkillZipParser.java @@ -1,6 +1,6 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; -import com.kexue.skills.utils.EscapeCharacterUtils; +import art.kexue.sxwz.utils.EscapeCharacterUtils; import net.sf.sevenzipjbinding.IInArchive; import net.sf.sevenzipjbinding.SevenZip; import net.sf.sevenzipjbinding.SevenZipException; @@ -15,7 +15,6 @@ import java.nio.charset.StandardCharsets; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; -import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.zip.ZipEntry; @@ -1041,4 +1040,4 @@ public class SkillZipParser { return yaml.dump(skillStructure); } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/common/util/UploadHelper.java b/src/main/java/art/kexue/sxwz/common/util/UploadHelper.java similarity index 99% rename from src/main/java/com/kexue/skills/common/util/UploadHelper.java rename to src/main/java/art/kexue/sxwz/common/util/UploadHelper.java index 857bb14..12ac8cd 100644 --- a/src/main/java/com/kexue/skills/common/util/UploadHelper.java +++ b/src/main/java/art/kexue/sxwz/common/util/UploadHelper.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; @@ -244,4 +244,4 @@ public final class UploadHelper } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/common/util/UploadUtils.java b/src/main/java/art/kexue/sxwz/common/util/UploadUtils.java similarity index 95% rename from src/main/java/com/kexue/skills/common/util/UploadUtils.java rename to src/main/java/art/kexue/sxwz/common/util/UploadUtils.java index 80c31e2..7e56646 100644 --- a/src/main/java/com/kexue/skills/common/util/UploadUtils.java +++ b/src/main/java/art/kexue/sxwz/common/util/UploadUtils.java @@ -1,4 +1,4 @@ -package com.kexue.skills.common.util; +package art.kexue.sxwz.common.util; import org.springframework.web.multipart.MultipartFile; @@ -22,3 +22,4 @@ public class UploadUtils { return dest.getName(); } } + diff --git a/src/main/java/com/kexue/skills/config/AccountDeductionProperties.java b/src/main/java/art/kexue/sxwz/config/AccountDeductionProperties.java similarity index 93% rename from src/main/java/com/kexue/skills/config/AccountDeductionProperties.java rename to src/main/java/art/kexue/sxwz/config/AccountDeductionProperties.java index 2a295b7..086f6e6 100644 --- a/src/main/java/com/kexue/skills/config/AccountDeductionProperties.java +++ b/src/main/java/art/kexue/sxwz/config/AccountDeductionProperties.java @@ -1,4 +1,4 @@ -package com.kexue.skills.config; +package art.kexue.sxwz.config; import lombok.Data; import org.springframework.beans.factory.annotation.Value; @@ -24,3 +24,4 @@ public class AccountDeductionProperties { private BigDecimal coefficient; } + diff --git a/src/main/java/com/kexue/skills/config/CaptchaConfig.java b/src/main/java/art/kexue/sxwz/config/CaptchaConfig.java similarity index 94% rename from src/main/java/com/kexue/skills/config/CaptchaConfig.java rename to src/main/java/art/kexue/sxwz/config/CaptchaConfig.java index c3dae9e..97fee3d 100644 --- a/src/main/java/com/kexue/skills/config/CaptchaConfig.java +++ b/src/main/java/art/kexue/sxwz/config/CaptchaConfig.java @@ -1,4 +1,4 @@ -package com.kexue.skills.config; +package art.kexue.sxwz.config; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -28,3 +28,4 @@ public class CaptchaConfig { */ private int length = 4; } + diff --git a/src/main/java/com/kexue/skills/config/DeepSeekConfig.java b/src/main/java/art/kexue/sxwz/config/DeepSeekConfig.java similarity index 97% rename from src/main/java/com/kexue/skills/config/DeepSeekConfig.java rename to src/main/java/art/kexue/sxwz/config/DeepSeekConfig.java index 2ab024b..344586a 100644 --- a/src/main/java/com/kexue/skills/config/DeepSeekConfig.java +++ b/src/main/java/art/kexue/sxwz/config/DeepSeekConfig.java @@ -1,4 +1,4 @@ -package com.kexue.skills.config; +package art.kexue.sxwz.config; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @@ -71,3 +71,4 @@ public class DeepSeekConfig { this.chat = chat; } } + diff --git a/src/main/java/com/kexue/skills/config/FilterConfig.java b/src/main/java/art/kexue/sxwz/config/FilterConfig.java similarity index 90% rename from src/main/java/com/kexue/skills/config/FilterConfig.java rename to src/main/java/art/kexue/sxwz/config/FilterConfig.java index e7470ee..ef0e086 100644 --- a/src/main/java/com/kexue/skills/config/FilterConfig.java +++ b/src/main/java/art/kexue/sxwz/config/FilterConfig.java @@ -1,6 +1,6 @@ -package com.kexue.skills.config; +package art.kexue.sxwz.config; -import com.kexue.skills.interceptor.CorsFilter; +import art.kexue.sxwz.interceptor.CorsFilter; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -29,3 +29,4 @@ public class FilterConfig { return registrationBean; } } + diff --git a/src/main/java/com/kexue/skills/config/GlmConfig.java b/src/main/java/art/kexue/sxwz/config/GlmConfig.java similarity index 97% rename from src/main/java/com/kexue/skills/config/GlmConfig.java rename to src/main/java/art/kexue/sxwz/config/GlmConfig.java index 0d04f8b..f438e8a 100644 --- a/src/main/java/com/kexue/skills/config/GlmConfig.java +++ b/src/main/java/art/kexue/sxwz/config/GlmConfig.java @@ -1,4 +1,4 @@ -package com.kexue.skills.config; +package art.kexue.sxwz.config; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @@ -70,4 +70,4 @@ public class GlmConfig { public void setChat(ChatOptions chat) { this.chat = chat; } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/config/JacksonConfig.java b/src/main/java/art/kexue/sxwz/config/JacksonConfig.java similarity index 96% rename from src/main/java/com/kexue/skills/config/JacksonConfig.java rename to src/main/java/art/kexue/sxwz/config/JacksonConfig.java index edea504..2b54c29 100644 --- a/src/main/java/com/kexue/skills/config/JacksonConfig.java +++ b/src/main/java/art/kexue/sxwz/config/JacksonConfig.java @@ -1,4 +1,4 @@ -package com.kexue.skills.config; +package art.kexue.sxwz.config; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; @@ -24,3 +24,4 @@ public class JacksonConfig { .build(); } } + diff --git a/src/main/java/com/kexue/skills/config/JetCacheConfig.java b/src/main/java/art/kexue/sxwz/config/JetCacheConfig.java similarity index 76% rename from src/main/java/com/kexue/skills/config/JetCacheConfig.java rename to src/main/java/art/kexue/sxwz/config/JetCacheConfig.java index 9bdda86..d737b0d 100644 --- a/src/main/java/com/kexue/skills/config/JetCacheConfig.java +++ b/src/main/java/art/kexue/sxwz/config/JetCacheConfig.java @@ -1,4 +1,4 @@ -package com.kexue.skills.config; +package art.kexue.sxwz.config; import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation; import com.alicp.jetcache.anno.config.EnableMethodCache; @@ -10,7 +10,8 @@ import org.springframework.context.annotation.Configuration; */ @Configuration @EnableCreateCacheAnnotation -@EnableMethodCache(basePackages = "com.kexue.skills.service") +@EnableMethodCache(basePackages = "art.kexue.sxwz.service") public class JetCacheConfig { } + diff --git a/src/main/java/com/kexue/skills/config/LogConfiguration.java b/src/main/java/art/kexue/sxwz/config/LogConfiguration.java similarity index 90% rename from src/main/java/com/kexue/skills/config/LogConfiguration.java rename to src/main/java/art/kexue/sxwz/config/LogConfiguration.java index 922e614..069923a 100644 --- a/src/main/java/com/kexue/skills/config/LogConfiguration.java +++ b/src/main/java/art/kexue/sxwz/config/LogConfiguration.java @@ -1,7 +1,7 @@ -package com.kexue.skills.config; +package art.kexue.sxwz.config; -import com.kexue.skills.interceptor.LogInterceptor; -import com.kexue.skills.mapper.SysLogMapper; +import art.kexue.sxwz.interceptor.LogInterceptor; +import art.kexue.sxwz.mapper.SysLogMapper; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; @@ -38,3 +38,4 @@ public class LogConfiguration implements WebMvcConfigurer { ); } } + diff --git a/src/main/java/com/kexue/skills/config/MyStpInterfaceImpl.java b/src/main/java/art/kexue/sxwz/config/MyStpInterfaceImpl.java similarity index 94% rename from src/main/java/com/kexue/skills/config/MyStpInterfaceImpl.java rename to src/main/java/art/kexue/sxwz/config/MyStpInterfaceImpl.java index 52059f8..74800a5 100644 --- a/src/main/java/com/kexue/skills/config/MyStpInterfaceImpl.java +++ b/src/main/java/art/kexue/sxwz/config/MyStpInterfaceImpl.java @@ -1,6 +1,6 @@ -package com.kexue.skills.config; +package art.kexue.sxwz.config; -import com.kexue.skills.service.SysUserService; +import art.kexue.sxwz.service.SysUserService; import cn.dev33.satoken.stp.StpInterface; import org.springframework.stereotype.Component; @@ -46,3 +46,4 @@ public class MyStpInterfaceImpl implements StpInterface { return java.util.Collections.emptyList(); } } + diff --git a/src/main/java/com/kexue/skills/config/PaymentConfig.java b/src/main/java/art/kexue/sxwz/config/PaymentConfig.java similarity index 97% rename from src/main/java/com/kexue/skills/config/PaymentConfig.java rename to src/main/java/art/kexue/sxwz/config/PaymentConfig.java index a48ae31..c9fcfbb 100644 --- a/src/main/java/com/kexue/skills/config/PaymentConfig.java +++ b/src/main/java/art/kexue/sxwz/config/PaymentConfig.java @@ -1,4 +1,4 @@ -package com.kexue.skills.config; +package art.kexue.sxwz.config; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -64,3 +64,4 @@ public class PaymentConfig { } } + diff --git a/src/main/java/com/kexue/skills/config/RedissonConfig.java b/src/main/java/art/kexue/sxwz/config/RedissonConfig.java similarity index 97% rename from src/main/java/com/kexue/skills/config/RedissonConfig.java rename to src/main/java/art/kexue/sxwz/config/RedissonConfig.java index ee3fc46..6676130 100644 --- a/src/main/java/com/kexue/skills/config/RedissonConfig.java +++ b/src/main/java/art/kexue/sxwz/config/RedissonConfig.java @@ -1,4 +1,4 @@ -package com.kexue.skills.config; +package art.kexue.sxwz.config; import org.redisson.Redisson; import org.redisson.api.RedissonClient; @@ -45,3 +45,4 @@ public class RedissonConfig { } } + diff --git a/src/main/java/com/kexue/skills/config/SaTokenConfig.java b/src/main/java/art/kexue/sxwz/config/SaTokenConfig.java similarity index 97% rename from src/main/java/com/kexue/skills/config/SaTokenConfig.java rename to src/main/java/art/kexue/sxwz/config/SaTokenConfig.java index 1cf75ed..f8fa3af 100644 --- a/src/main/java/com/kexue/skills/config/SaTokenConfig.java +++ b/src/main/java/art/kexue/sxwz/config/SaTokenConfig.java @@ -1,4 +1,4 @@ -package com.kexue.skills.config; +package art.kexue.sxwz.config; import cn.dev33.satoken.interceptor.SaInterceptor; import cn.dev33.satoken.router.SaRouter; @@ -42,4 +42,4 @@ public class SaTokenConfig implements WebMvcConfigurer { .check(() -> StpUtil.checkLogin()); })).addPathPatterns("/**"); } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/config/StartupListener.java b/src/main/java/art/kexue/sxwz/config/StartupListener.java similarity index 98% rename from src/main/java/com/kexue/skills/config/StartupListener.java rename to src/main/java/art/kexue/sxwz/config/StartupListener.java index 394c098..1d32744 100644 --- a/src/main/java/com/kexue/skills/config/StartupListener.java +++ b/src/main/java/art/kexue/sxwz/config/StartupListener.java @@ -1,4 +1,4 @@ -package com.kexue.skills.config; +package art.kexue.sxwz.config; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,4 +58,4 @@ public class StartupListener implements ApplicationListener> getTransactions() { + public CommonResult> getTransactions() { Long userId = Long.parseLong(StpUtil.getLoginId().toString()); return CommonResult.success(this.accountService.getTransactions(userId)); } @@ -177,7 +174,7 @@ public class AccountController { @Operation(summary = "分页查询充值记录", description = "分页查询所有充值记录,默认根据时间倒序") @PostMapping("/getRechargePageList") @RequireAuth - public CommonResult> getRechargePageList(@RequestBody AccountTransactionDto queryDto) { + public CommonResult> getRechargePageList(@RequestBody AccountTransactionDto queryDto) { return CommonResult.success(this.accountService.getRechargePageList(queryDto)); } @@ -203,9 +200,9 @@ public class AccountController { @Operation(summary = "分页查询赠送记录", description = "分页查询所有赠送记录,默认根据时间倒序") @PostMapping("/getGiftPageList") @RequireAuth - public CommonResult> getGiftPageList(@RequestBody AccountTransactionDto queryDto) { + public CommonResult> getGiftPageList(@RequestBody AccountTransactionDto queryDto) { return CommonResult.success(this.accountService.getGiftPageList(queryDto)); } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/controller/AccountFrozenController.java b/src/main/java/art/kexue/sxwz/controller/AccountFrozenController.java similarity index 86% rename from src/main/java/com/kexue/skills/controller/AccountFrozenController.java rename to src/main/java/art/kexue/sxwz/controller/AccountFrozenController.java index 55b4668..f74f0d6 100644 --- a/src/main/java/com/kexue/skills/controller/AccountFrozenController.java +++ b/src/main/java/art/kexue/sxwz/controller/AccountFrozenController.java @@ -1,12 +1,11 @@ -package com.kexue.skills.controller; +package art.kexue.sxwz.controller; -import com.kexue.skills.annotation.Log; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.AccountFrozen; -import com.kexue.skills.entity.dto.AccountFrozenDto; -import com.kexue.skills.entity.dto.AccountReleaseDto; -import com.kexue.skills.service.AccountFrozenService; -import com.kexue.skills.common.Result; +import art.kexue.sxwz.annotation.Log; +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.AccountFrozen; +import art.kexue.sxwz.entity.dto.AccountFrozenDto; +import art.kexue.sxwz.entity.dto.AccountReleaseDto; +import art.kexue.sxwz.service.AccountFrozenService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; @@ -71,3 +70,4 @@ public class AccountFrozenController { } } + diff --git a/src/main/java/com/kexue/skills/controller/CaptchaController.java b/src/main/java/art/kexue/sxwz/controller/CaptchaController.java similarity index 94% rename from src/main/java/com/kexue/skills/controller/CaptchaController.java rename to src/main/java/art/kexue/sxwz/controller/CaptchaController.java index 60cc9cf..75faf38 100644 --- a/src/main/java/com/kexue/skills/controller/CaptchaController.java +++ b/src/main/java/art/kexue/sxwz/controller/CaptchaController.java @@ -1,8 +1,8 @@ -package com.kexue.skills.controller; +package art.kexue.sxwz.controller; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.common.util.IDUtils; -import com.kexue.skills.config.CaptchaConfig; +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.common.util.IDUtils; +import art.kexue.sxwz.config.CaptchaConfig; import com.wf.captcha.SpecCaptcha; import com.wf.captcha.base.Captcha; import io.swagger.v3.oas.annotations.Operation; @@ -14,7 +14,6 @@ import javax.annotation.Resource; import java.io.IOException; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.TimeUnit; /** * 验证码控制器 @@ -103,4 +102,4 @@ public class CaptchaController { return CommonResult.failed("验证码错误"); } } -} \ No newline at end of file +} diff --git a/src/main/java/art/kexue/sxwz/controller/ComputeQuotaController.java b/src/main/java/art/kexue/sxwz/controller/ComputeQuotaController.java new file mode 100644 index 0000000..b67f13a --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/ComputeQuotaController.java @@ -0,0 +1,162 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.ComputeQuota; +import art.kexue.sxwz.entity.dto.ComputeQuotaDto; +import art.kexue.sxwz.service.ComputeQuotaService; +import com.github.pagehelper.PageInfo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +@RestController +@RequestMapping("/api/computeQuota") +@Tag(name = "算力配额管理", description = "算力配额管理接口") +public class ComputeQuotaController { + + @Resource + private ComputeQuotaService computeQuotaService; + + @PostMapping + @Operation(summary = "新增配额", description = "创建算力配额记录") + public CommonResult save(@RequestBody ComputeQuota quota) { + return CommonResult.success(computeQuotaService.save(quota)); + } + + @PutMapping("/{id}") + @Operation(summary = "更新配额", description = "更新算力配额信息") + public CommonResult update(@PathVariable Long id, @RequestBody ComputeQuota quota) { + quota.setId(id); + return CommonResult.success(computeQuotaService.update(quota)); + } + + @DeleteMapping("/{id}") + @Operation(summary = "删除配额", description = "删除算力配额") + public CommonResult delete(@PathVariable Long id) { + computeQuotaService.delete(id); + return CommonResult.success(null); + } + + @GetMapping("/{id}") + @Operation(summary = "查询配额详情", description = "根据ID查询配额详情") + public CommonResult queryById(@PathVariable Long id) { + return CommonResult.success(computeQuotaService.queryById(id)); + } + + @PostMapping("/pageList") + @Operation(summary = "分页查询配额", description = "分页查询算力配额列表") + public CommonResult> getPageList(@RequestBody ComputeQuotaDto queryDto) { + return CommonResult.success(computeQuotaService.getPageList(queryDto)); + } + + @GetMapping("/total") + @Operation(summary = "获取总量统计", description = "获取所有算力的总分配、已使用、剩余统计") + public CommonResult getTotalQuota() { + return CommonResult.success(computeQuotaService.getTotalQuota()); + } + + @GetMapping("/school") + @Operation(summary = "获取学校算力列表", description = "获取所有学校的算力配额列表") + public CommonResult> getSchoolQuotaList() { + return CommonResult.success(computeQuotaService.queryBySubjectType(1)); + } + + @GetMapping("/college") + @Operation(summary = "获取学院算力列表", description = "获取所有学院的算力配额列表") + public CommonResult> getCollegeQuotaList() { + return CommonResult.success(computeQuotaService.queryBySubjectType(2)); + } + + @PostMapping("/allocate") + @Operation(summary = "追加分配算力", description = "为学校或学院追加分配算力小时数(不存在则创建,存在则累加)") + public CommonResult allocateQuota(@RequestBody AllocateRequest request) { + return CommonResult.success(computeQuotaService.allocateQuota( + request.getSubjectType(), + request.getSubjectId(), + request.getSubjectName(), + request.getHours() + )); + } + + @PostMapping("/deduct") + @Operation(summary = "扣除算力", description = "扣除已使用的算力小时数") + public CommonResult deductQuota(@RequestBody DeductRequest request) { + return CommonResult.success(computeQuotaService.addUsedHours( + request.getSubjectType(), + request.getSubjectId(), + request.getHours() + )); + } + + public static class AllocateRequest { + private Integer subjectType; + private Long subjectId; + private String subjectName; + private Long hours; + + public Integer getSubjectType() { + return subjectType; + } + + public void setSubjectType(Integer subjectType) { + this.subjectType = subjectType; + } + + public Long getSubjectId() { + return subjectId; + } + + public void setSubjectId(Long subjectId) { + this.subjectId = subjectId; + } + + public String getSubjectName() { + return subjectName; + } + + public void setSubjectName(String subjectName) { + this.subjectName = subjectName; + } + + public Long getHours() { + return hours; + } + + public void setHours(Long hours) { + this.hours = hours; + } + } + + public static class DeductRequest { + private Integer subjectType; + private Long subjectId; + private Long hours; + + public Integer getSubjectType() { + return subjectType; + } + + public void setSubjectType(Integer subjectType) { + this.subjectType = subjectType; + } + + public Long getSubjectId() { + return subjectId; + } + + public void setSubjectId(Long subjectId) { + this.subjectId = subjectId; + } + + public Long getHours() { + return hours; + } + + public void setHours(Long hours) { + this.hours = hours; + } + } +} \ No newline at end of file diff --git a/src/main/java/art/kexue/sxwz/controller/EduAttendanceController.java b/src/main/java/art/kexue/sxwz/controller/EduAttendanceController.java new file mode 100644 index 0000000..a49cd85 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/EduAttendanceController.java @@ -0,0 +1,140 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.EduAttendance; +import art.kexue.sxwz.entity.EduAttendanceRecord; +import art.kexue.sxwz.entity.dto.EduAttendanceDto; +import art.kexue.sxwz.service.EduAttendanceService; +import com.github.pagehelper.PageInfo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/api/attendance") +@Tag(name = "考勤管理", description = "考勤管理接口") +public class EduAttendanceController { + + @Resource + private EduAttendanceService eduAttendanceService; + + @PostMapping + @Operation(summary = "新增考勤", description = "创建考勤记录") + public CommonResult save(@RequestBody EduAttendance attendance) { + return CommonResult.success(eduAttendanceService.save(attendance)); + } + + @PutMapping("/{id}") + @Operation(summary = "更新考勤", description = "更新考勤信息") + public CommonResult update(@PathVariable Long id, @RequestBody EduAttendance attendance) { + attendance.setId(id); + return CommonResult.success(eduAttendanceService.update(attendance)); + } + + @DeleteMapping("/{id}") + @Operation(summary = "删除考勤", description = "删除考勤") + public CommonResult delete(@PathVariable Long id) { + eduAttendanceService.delete(id); + return CommonResult.success(null); + } + + @GetMapping("/{id}") + @Operation(summary = "查询考勤详情", description = "根据ID查询考勤详情") + public CommonResult queryById(@PathVariable Long id) { + return CommonResult.success(eduAttendanceService.queryById(id)); + } + + @GetMapping("/course/{courseId}") + @Operation(summary = "查询课程考勤列表", description = "根据课程ID查询考勤列表") + public CommonResult> queryByCourseId(@PathVariable Long courseId) { + return CommonResult.success(eduAttendanceService.queryByCourseId(courseId)); + } + + @GetMapping("/teacher/{teacherId}") + @Operation(summary = "查询教师考勤列表", description = "根据教师ID查询考勤列表") + public CommonResult> queryByTeacherId(@PathVariable Long teacherId) { + return CommonResult.success(eduAttendanceService.queryByTeacherId(teacherId)); + } + + @PostMapping("/{attendanceId}/record/{studentId}") + @Operation(summary = "记录考勤", description = "学生记录考勤") + public CommonResult recordAttendance(@PathVariable Long attendanceId, + @PathVariable Long studentId) { + return CommonResult.success(eduAttendanceService.recordAttendance(attendanceId, studentId)); + } + + @GetMapping("/record/{recordId}") + @Operation(summary = "查询考勤记录详情", description = "查询考勤记录详情") + public CommonResult queryRecordById(@PathVariable Long recordId) { + return CommonResult.success(eduAttendanceService.queryRecordById(recordId)); + } + + @GetMapping("/{attendanceId}/records") + @Operation(summary = "查询考勤记录列表", description = "查询考勤的所有记录") + public CommonResult> queryRecordsByAttendanceId(@PathVariable Long attendanceId) { + return CommonResult.success(eduAttendanceService.queryRecordsByAttendanceId(attendanceId)); + } + + @GetMapping("/student/{studentId}/records") + @Operation(summary = "查询学生考勤记录", description = "查询学生的所有考勤记录") + public CommonResult> queryRecordsByStudentId(@PathVariable Long studentId) { + return CommonResult.success(eduAttendanceService.queryRecordsByStudentId(studentId)); + } + + @PostMapping("/{attendanceId}/batch") + @Operation(summary = "批量创建考勤记录", description = "为考勤批量创建学生考勤记录") + public CommonResult batchCreateRecords(@PathVariable Long attendanceId, + @RequestBody List studentIds) { + eduAttendanceService.batchCreateRecords(attendanceId, studentIds); + return CommonResult.success(null); + } + + @PostMapping("/create") + @Operation(summary = "创建上课签到", description = "创建新的上课签到,自动生成二维码") + public CommonResult createAttendance( + @Parameter(description = "学校ID") @RequestParam Long schoolId, + @Parameter(description = "课程ID") @RequestParam Long courseId, + @Parameter(description = "签到时长(分钟),默认30分钟") @RequestParam(required = false) Integer duration) { + return CommonResult.success(eduAttendanceService.createAttendance(schoolId, courseId, duration)); + } + + @GetMapping("/{attendanceId}/qrcode") + @Operation(summary = "生成签到二维码", description = "生成考勤签到的二维码图片(Base64格式)") + public CommonResult> generateQRCode(@PathVariable Long attendanceId) { + String qrCodeBase64 = eduAttendanceService.generateQRCode(attendanceId); + Map result = new HashMap<>(); + result.put("qrCode", qrCodeBase64); + return CommonResult.success(result); + } + + @PostMapping("/scan") + @Operation(summary = "扫码签到", description = "学生扫描二维码进行签到") + public CommonResult scanQRCode( + @Parameter(description = "二维码内容") @RequestParam String qrCodeContent, + @Parameter(description = "学生ID") @RequestParam Long studentId) { + EduAttendanceRecord record = eduAttendanceService.scanQRCode(qrCodeContent, studentId); + if (record == null) { + return CommonResult.failed("签到失败,二维码无效或签到已结束"); + } + return CommonResult.success(record); + } + + @PostMapping("/{attendanceId}/close") + @Operation(summary = "关闭签到", description = "结束当前签到") + public CommonResult closeAttendance(@PathVariable Long attendanceId) { + eduAttendanceService.closeAttendance(attendanceId); + return CommonResult.success(null); + } + + @PostMapping("/pageList") + @Operation(summary = "分页查询考勤", description = "分页查询考勤列表") + public CommonResult> getPageList(@RequestBody EduAttendanceDto queryDto) { + return CommonResult.success(eduAttendanceService.getPageList(queryDto)); + } +} diff --git a/src/main/java/art/kexue/sxwz/controller/EduCollegeController.java b/src/main/java/art/kexue/sxwz/controller/EduCollegeController.java new file mode 100644 index 0000000..d78e801 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/EduCollegeController.java @@ -0,0 +1,66 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.EduCollege; +import art.kexue.sxwz.entity.dto.EduCollegeDto; +import art.kexue.sxwz.service.EduCollegeService; +import com.github.pagehelper.PageInfo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +@RestController +@RequestMapping("/api/college") +@Tag(name = "学院管理", description = "学院信息管理接口") +public class EduCollegeController { + + @Resource + private EduCollegeService eduCollegeService; + + @PostMapping + @Operation(summary = "新增学院", description = "创建学院信息") + public CommonResult save(@RequestBody EduCollege college) { + return CommonResult.success(eduCollegeService.save(college)); + } + + @PutMapping("/{id}") + @Operation(summary = "更新学院", description = "更新学院信息") + public CommonResult update(@PathVariable Long id, @RequestBody EduCollege college) { + college.setId(id); + return CommonResult.success(eduCollegeService.update(college)); + } + + @DeleteMapping("/{id}") + @Operation(summary = "删除学院", description = "删除学院(逻辑删除)") + public CommonResult delete(@PathVariable Long id) { + eduCollegeService.delete(id); + return CommonResult.success(null); + } + + @GetMapping("/{id}") + @Operation(summary = "查询学院详情", description = "根据ID查询学院详情") + public CommonResult queryById(@PathVariable Long id) { + return CommonResult.success(eduCollegeService.queryById(id)); + } + + @PostMapping("/pageList") + @Operation(summary = "分页查询学院", description = "分页查询学院列表") + public CommonResult> getPageList(@RequestBody EduCollegeDto queryDto) { + return CommonResult.success(eduCollegeService.getPageList(queryDto)); + } + + @GetMapping("/list") + @Operation(summary = "获取所有学院", description = "获取所有学院列表") + public CommonResult> getAllList() { + return CommonResult.success(eduCollegeService.queryAll()); + } + + @GetMapping("/name/{name}") + @Operation(summary = "根据名称查询学院", description = "根据学院名称查询学院信息") + public CommonResult queryByName(@PathVariable String name) { + return CommonResult.success(eduCollegeService.queryByName(name)); + } +} \ No newline at end of file diff --git a/src/main/java/art/kexue/sxwz/controller/EduCourseController.java b/src/main/java/art/kexue/sxwz/controller/EduCourseController.java new file mode 100644 index 0000000..f146a41 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/EduCourseController.java @@ -0,0 +1,106 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.EduCourse; +import art.kexue.sxwz.entity.dto.EduCourseDto; +import art.kexue.sxwz.entity.request.BatchBindResultDto; +import art.kexue.sxwz.service.EduCourseService; +import com.github.pagehelper.PageInfo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.List; + +@RestController +@RequestMapping("/api/course") +@Tag(name = "课程管理", description = "课程管理接口") +public class EduCourseController { + + @Resource + private EduCourseService eduCourseService; + + @PostMapping + @Operation(summary = "新增课程", description = "创建课程") + public CommonResult save(@RequestBody EduCourse course) { + return CommonResult.success(eduCourseService.save(course)); + } + + @PutMapping("/{id}") + @Operation(summary = "更新课程", description = "更新课程信息") + public CommonResult update(@PathVariable Long id, @RequestBody EduCourse course) { + course.setId(id); + return CommonResult.success(eduCourseService.update(course)); + } + + @DeleteMapping("/{id}") + @Operation(summary = "删除课程", description = "删除课程") + public CommonResult delete(@PathVariable Long id) { + eduCourseService.delete(id); + return CommonResult.success(null); + } + + @GetMapping("/{id}") + @Operation(summary = "查询课程详情", description = "根据ID查询课程详情") + public CommonResult queryById(@PathVariable Long id) { + return CommonResult.success(eduCourseService.queryById(id)); + } + + @GetMapping("/teacher/{teacherId}") + @Operation(summary = "查询教师课程列表", description = "根据教师ID查询课程列表") + public CommonResult> queryByTeacherId(@PathVariable Long teacherId) { + return CommonResult.success(eduCourseService.queryByTeacherId(teacherId)); + } + + @GetMapping("/school/{schoolId}") + @Operation(summary = "查询学校课程列表", description = "根据学校ID查询课程列表") + public CommonResult> queryBySchoolId(@PathVariable Long schoolId) { + return CommonResult.success(eduCourseService.queryBySchoolId(schoolId)); + } + + @GetMapping("/student/{studentId}") + @Operation(summary = "查询学生课程列表", description = "根据学生ID查询已选课程列表") + public CommonResult> queryByStudentId(@PathVariable Long studentId) { + return CommonResult.success(eduCourseService.queryByStudentId(studentId)); + } + + @PostMapping("/{courseId}/student/{studentId}") + @Operation(summary = "添加学生到课程", description = "将学生添加到课程") + public CommonResult addStudent(@PathVariable Long courseId, @PathVariable Long studentId) { + eduCourseService.addStudent(courseId, studentId); + return CommonResult.success(null); + } + + @DeleteMapping("/{courseId}/student/{studentId}") + @Operation(summary = "移除课程学生", description = "将学生从课程中移除") + public CommonResult removeStudent(@PathVariable Long courseId, @PathVariable Long studentId) { + eduCourseService.removeStudent(courseId, studentId); + return CommonResult.success(null); + } + + @GetMapping("/{courseId}/student/{studentId}/exists") + @Operation(summary = "检查学生是否在课程中", description = "检查学生是否在课程中") + public CommonResult isStudentInCourse(@PathVariable Long courseId, @PathVariable Long studentId) { + return CommonResult.success(eduCourseService.isStudentInCourse(courseId, studentId)); + } + + @PostMapping("/pageList") + @Operation(summary = "分页查询课程", description = "分页查询课程列表") + public CommonResult> getPageList(@RequestBody EduCourseDto queryDto) { + return CommonResult.success(eduCourseService.getPageList(queryDto)); + } + + @PostMapping("/{courseId}/batchBindStudents") + @Operation(summary = "批量绑定学生到课程", description = "通过Excel表格批量绑定学生到课程。Excel格式:第一列为学号或姓名,从第二行开始为数据。") + public CommonResult batchBindStudents( + @PathVariable Long courseId, + @Parameter(description = "Excel文件") @RequestParam("file") MultipartFile file, + @Parameter(description = "是否追加模式(true-追加到现有学生,false-覆盖现有学生)") @RequestParam(value = "append", defaultValue = "false") boolean append) throws IOException { + byte[] excelBytes = file.getBytes(); + return CommonResult.success(eduCourseService.batchBindStudents(courseId, excelBytes, append)); + } +} diff --git a/src/main/java/art/kexue/sxwz/controller/EduExamController.java b/src/main/java/art/kexue/sxwz/controller/EduExamController.java new file mode 100644 index 0000000..4629254 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/EduExamController.java @@ -0,0 +1,108 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.EduExam; +import art.kexue.sxwz.entity.EduExamPaper; +import art.kexue.sxwz.entity.dto.EduExamDto; +import art.kexue.sxwz.service.EduExamService; +import com.github.pagehelper.PageInfo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/api/exam") +@Tag(name = "考试管理", description = "考试管理接口") +public class EduExamController { + + @Resource + private EduExamService eduExamService; + + @PostMapping + @Operation(summary = "新增考试", description = "创建考试") + public CommonResult save(@RequestBody EduExam exam) { + return CommonResult.success(eduExamService.save(exam)); + } + + @PutMapping("/{id}") + @Operation(summary = "更新考试", description = "更新考试信息") + public CommonResult update(@PathVariable Long id, @RequestBody EduExam exam) { + exam.setId(id); + return CommonResult.success(eduExamService.update(exam)); + } + + @DeleteMapping("/{id}") + @Operation(summary = "删除考试", description = "删除考试") + public CommonResult delete(@PathVariable Long id) { + eduExamService.delete(id); + return CommonResult.success(null); + } + + @GetMapping("/{id}") + @Operation(summary = "查询考试详情", description = "根据ID查询考试详情") + public CommonResult queryById(@PathVariable Long id) { + return CommonResult.success(eduExamService.queryById(id)); + } + + @GetMapping("/course/{courseId}") + @Operation(summary = "查询课程考试列表", description = "根据课程ID查询考试列表") + public CommonResult> queryByCourseId(@PathVariable Long courseId) { + return CommonResult.success(eduExamService.queryByCourseId(courseId)); + } + + @GetMapping("/teacher/{teacherId}") + @Operation(summary = "查询教师考试列表", description = "根据教师ID查询考试列表") + public CommonResult> queryByTeacherId(@PathVariable Long teacherId) { + return CommonResult.success(eduExamService.queryByTeacherId(teacherId)); + } + + @GetMapping("/student/{studentId}") + @Operation(summary = "查询学生考试列表", description = "根据学生ID查询考试列表") + public CommonResult> queryByStudentId(@PathVariable Long studentId) { + return CommonResult.success(eduExamService.queryByStudentId(studentId)); + } + + @PostMapping("/{parentExamId}/makeup") + @Operation(summary = "创建补考", description = "为指定考试创建补考") + public CommonResult createMakeupExam(@PathVariable Long parentExamId) { + return CommonResult.success(eduExamService.createMakeupExam(parentExamId)); + } + + @PostMapping("/{examId}/submit/{studentId}") + @Operation(summary = "提交考试", description = "学生提交考试") + public CommonResult submitExam(@PathVariable Long examId, + @PathVariable Long studentId, + @RequestBody Map body) { + return CommonResult.success(eduExamService.submitExam(examId, studentId, body.get("answer"))); + } + + @PutMapping("/paper/{paperId}/grade") + @Operation(summary = "批改考试", description = "批改考试答卷") + public CommonResult gradeExam(@PathVariable Long paperId, + @RequestBody Map body) { + Double score = body.get("score") != null ? ((Number) body.get("score")).doubleValue() : null; + return CommonResult.success(eduExamService.gradeExam(paperId, score)); + } + + @GetMapping("/paper/{paperId}") + @Operation(summary = "查询答卷详情", description = "查询考试答卷详情") + public CommonResult queryPaperById(@PathVariable Long paperId) { + return CommonResult.success(eduExamService.queryPaperById(paperId)); + } + + @GetMapping("/{examId}/papers") + @Operation(summary = "查询考试答卷列表", description = "查询考试的所有答卷") + public CommonResult> queryPapersByExamId(@PathVariable Long examId) { + return CommonResult.success(eduExamService.queryPapersByExamId(examId)); + } + + @PostMapping("/pageList") + @Operation(summary = "分页查询考试", description = "分页查询考试列表") + public CommonResult> getPageList(@RequestBody EduExamDto queryDto) { + return CommonResult.success(eduExamService.getPageList(queryDto)); + } +} diff --git a/src/main/java/art/kexue/sxwz/controller/EduExcellentWorkController.java b/src/main/java/art/kexue/sxwz/controller/EduExcellentWorkController.java new file mode 100644 index 0000000..8d841cc --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/EduExcellentWorkController.java @@ -0,0 +1,96 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.EduExcellentWork; +import art.kexue.sxwz.entity.dto.EduExcellentWorkDto; +import art.kexue.sxwz.service.EduExcellentWorkService; +import com.github.pagehelper.PageInfo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/api/excellent-work") +@Tag(name = "优秀作品", description = "优秀作品管理接口") +public class EduExcellentWorkController { + + @Resource + private EduExcellentWorkService eduExcellentWorkService; + + @PostMapping + @Operation(summary = "新增优秀作品", description = "创建优秀作品记录") + public CommonResult save(@RequestBody EduExcellentWork work) { + return CommonResult.success(eduExcellentWorkService.save(work)); + } + + @DeleteMapping("/{id}") + @Operation(summary = "删除优秀作品", description = "删除优秀作品") + public CommonResult delete(@PathVariable Long id) { + eduExcellentWorkService.delete(id); + return CommonResult.success(null); + } + + @GetMapping("/{id}") + @Operation(summary = "查询优秀作品详情", description = "根据ID查询优秀作品详情") + public CommonResult queryById(@PathVariable Long id) { + return CommonResult.success(eduExcellentWorkService.queryById(id)); + } + + @GetMapping("/school/{schoolId}") + @Operation(summary = "查询学校优秀作品列表", description = "根据学校ID查询优秀作品列表") + public CommonResult> queryBySchoolId(@PathVariable Long schoolId) { + return CommonResult.success(eduExcellentWorkService.queryBySchoolId(schoolId)); + } + + @GetMapping("/student/{studentId}") + @Operation(summary = "查询学生优秀作品列表", description = "根据学生ID查询优秀作品列表") + public CommonResult> queryByStudentId(@PathVariable Long studentId) { + return CommonResult.success(eduExcellentWorkService.queryByStudentId(studentId)); + } + + @PostMapping("/{workId}/like/{userId}") + @Operation(summary = "点赞", description = "为优秀作品点赞") + public CommonResult addLike(@PathVariable Long workId, @PathVariable Long userId) { + eduExcellentWorkService.addLike(workId, userId); + return CommonResult.success(null); + } + + @DeleteMapping("/{workId}/like/{userId}") + @Operation(summary = "取消点赞", description = "取消对优秀作品的点赞") + public CommonResult removeLike(@PathVariable Long workId, @PathVariable Long userId) { + eduExcellentWorkService.removeLike(workId, userId); + return CommonResult.success(null); + } + + @GetMapping("/{workId}/like/{userId}/exists") + @Operation(summary = "检查是否已点赞", description = "检查用户是否已点赞") + public CommonResult hasLiked(@PathVariable Long workId, @PathVariable Long userId) { + return CommonResult.success(eduExcellentWorkService.hasLiked(workId, userId)); + } + + @GetMapping("/{workId}/like-count") + @Operation(summary = "查询点赞数", description = "查询优秀作品的点赞数") + public CommonResult countLikes(@PathVariable Long workId) { + return CommonResult.success(eduExcellentWorkService.countLikes(workId)); + } + + @PostMapping("/mark") + @Operation(summary = "标记为优秀作品", description = "将作业或考试答卷标记为优秀作品") + public CommonResult markAsExcellent(@RequestBody Map body) { + Long submitId = ((Number) body.get("submitId")).longValue(); + Integer workType = ((Number) body.get("workType")).intValue(); + Double score = body.get("score") != null ? ((Number) body.get("score")).doubleValue() : null; + String comment = (String) body.get("comment"); + return CommonResult.success(eduExcellentWorkService.markAsExcellent(submitId, workType, score, comment)); + } + + @PostMapping("/pageList") + @Operation(summary = "分页查询优秀作品", description = "分页查询优秀作品列表") + public CommonResult> getPageList(@RequestBody EduExcellentWorkDto queryDto) { + return CommonResult.success(eduExcellentWorkService.getPageList(queryDto)); + } +} diff --git a/src/main/java/art/kexue/sxwz/controller/EduHomeworkController.java b/src/main/java/art/kexue/sxwz/controller/EduHomeworkController.java new file mode 100644 index 0000000..dd92e4c --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/EduHomeworkController.java @@ -0,0 +1,103 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.EduHomework; +import art.kexue.sxwz.entity.EduHomeworkSubmit; +import art.kexue.sxwz.entity.dto.EduHomeworkDto; +import art.kexue.sxwz.service.EduHomeworkService; +import com.github.pagehelper.PageInfo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/api/homework") +@Tag(name = "作业管理", description = "作业管理接口") +public class EduHomeworkController { + + @Resource + private EduHomeworkService eduHomeworkService; + + @PostMapping + @Operation(summary = "新增作业", description = "创建作业") + public CommonResult save(@RequestBody EduHomework homework) { + return CommonResult.success(eduHomeworkService.save(homework)); + } + + @PutMapping("/{id}") + @Operation(summary = "更新作业", description = "更新作业信息") + public CommonResult update(@PathVariable Long id, @RequestBody EduHomework homework) { + homework.setId(id); + return CommonResult.success(eduHomeworkService.update(homework)); + } + + @DeleteMapping("/{id}") + @Operation(summary = "删除作业", description = "删除作业") + public CommonResult delete(@PathVariable Long id) { + eduHomeworkService.delete(id); + return CommonResult.success(true); + } + + @GetMapping("/{id}") + @Operation(summary = "查询作业详情", description = "根据ID查询作业详情") + public CommonResult queryById(@PathVariable Long id) { + return CommonResult.success(eduHomeworkService.queryById(id)); + } + + @GetMapping("/course/{courseId}") + @Operation(summary = "查询课程作业列表", description = "根据课程ID查询作业列表") + public CommonResult> queryByCourseId(@PathVariable Long courseId) { + return CommonResult.success(eduHomeworkService.queryByCourseId(courseId)); + } + + @GetMapping("/teacher/{teacherId}") + @Operation(summary = "查询教师作业列表", description = "根据教师ID查询作业列表") + public CommonResult> queryByTeacherId(@PathVariable Long teacherId) { + return CommonResult.success(eduHomeworkService.queryByTeacherId(teacherId)); + } + + @GetMapping("/student/{studentId}") + @Operation(summary = "查询学生作业列表", description = "根据学生ID查询作业列表") + public CommonResult> queryByStudentId(@PathVariable Long studentId) { + return CommonResult.success(eduHomeworkService.queryByStudentId(studentId)); + } + + @PostMapping("/{homeworkId}/submit/{studentId}") + @Operation(summary = "提交作业", description = "学生提交作业") + public CommonResult submitHomework(@PathVariable Long homeworkId, + @PathVariable Long studentId, + @RequestBody Map body) { + return CommonResult.success(eduHomeworkService.submitHomework(homeworkId, studentId, body.get("answer"))); + } + + @PutMapping("/submit/{submitId}/grade") + @Operation(summary = "批改作业", description = "教师批改作业") + public CommonResult gradeHomework(@PathVariable Long submitId, + @RequestBody Map body) { + Double score = body.get("score") != null ? ((Number) body.get("score")).doubleValue() : null; + String comment = (String) body.get("comment"); + return CommonResult.success(eduHomeworkService.gradeHomework(submitId, score, comment)); + } + + @GetMapping("/submit/{submitId}") + @Operation(summary = "查询作业提交详情", description = "查询作业提交详情") + public CommonResult querySubmitById(@PathVariable Long submitId) { + return CommonResult.success(eduHomeworkService.querySubmitById(submitId)); + } + + @GetMapping("/{homeworkId}/submits") + @Operation(summary = "查询作业提交列表", description = "查询作业的所有提交") + public CommonResult> querySubmitsByHomeworkId(@PathVariable Long homeworkId) { + return CommonResult.success(eduHomeworkService.querySubmitsByHomeworkId(homeworkId)); + } + + @PostMapping("/pageList") + @Operation(summary = "分页查询作业", description = "分页查询作业列表") + public CommonResult> getPageList(@RequestBody EduHomeworkDto queryDto) { + return CommonResult.success(eduHomeworkService.getPageList(queryDto)); + } +} diff --git a/src/main/java/art/kexue/sxwz/controller/EduSchoolController.java b/src/main/java/art/kexue/sxwz/controller/EduSchoolController.java new file mode 100644 index 0000000..7294a30 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/EduSchoolController.java @@ -0,0 +1,77 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.annotation.RequireRole; +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.EduSchool; +import art.kexue.sxwz.entity.dto.EduSchoolDto; +import art.kexue.sxwz.service.EduSchoolService; +import com.github.pagehelper.PageInfo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +@RestController +@RequestMapping("/api/school") +@Tag(name = "学校管理", description = "学校信息管理接口") +public class EduSchoolController { + + @Resource + private EduSchoolService eduSchoolService; + + @PostMapping + @Operation(summary = "新增学校", description = "创建学校信息") + @RequireRole("SUPER1") + public CommonResult save(@RequestBody EduSchool school) { + return CommonResult.success(eduSchoolService.save(school)); + } + + @PutMapping("/{id}") + @Operation(summary = "更新学校", description = "更新学校信息") + @RequireRole("SUPER1") + public CommonResult update(@PathVariable Long id, @RequestBody EduSchool school) { + school.setId(id); + return CommonResult.success(eduSchoolService.update(school)); + } + + @DeleteMapping("/{id}") + @Operation(summary = "删除学校", description = "删除学校信息") + @RequireRole("SUPER1") + public CommonResult delete(@PathVariable Long id) { + eduSchoolService.delete(id); + return CommonResult.success(null); + } + + @GetMapping("/{id}") + @Operation(summary = "查询学校详情", description = "根据ID查询学校信息") + public CommonResult queryById(@PathVariable Long id) { + return CommonResult.success(eduSchoolService.queryById(id)); + } + + @GetMapping + @Operation(summary = "查询学校列表", description = "查询所有学校信息") + public CommonResult> queryList() { + return CommonResult.success(eduSchoolService.queryAll()); + } + + @GetMapping("/status/{status}") + @Operation(summary = "根据状态查询学校", description = "根据状态查询学校列表") + public CommonResult> queryListByStatus(@PathVariable Integer status) { + return CommonResult.success(eduSchoolService.queryListByStatus(status)); + } + + @PostMapping("/pageList") + @Operation(summary = "分页查询学校", description = "分页查询学校列表") + public CommonResult> getPageList(@RequestBody EduSchoolDto queryDto) { + return CommonResult.success(eduSchoolService.getPageList(queryDto)); + } + + @PutMapping("/{id}/status/{status}") + @Operation(summary = "变更学校状态", description = "启用或禁用学校") + @RequireRole("SUPER1") + public CommonResult updateStatus(@PathVariable Long id, @PathVariable Integer status) { + return CommonResult.success(eduSchoolService.updateStatus(id, status)); + } +} diff --git a/src/main/java/art/kexue/sxwz/controller/EduStudentController.java b/src/main/java/art/kexue/sxwz/controller/EduStudentController.java new file mode 100644 index 0000000..6eae1b0 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/EduStudentController.java @@ -0,0 +1,92 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.EduStudent; +import art.kexue.sxwz.entity.dto.EduStudentDto; +import art.kexue.sxwz.service.EduStudentService; +import com.github.pagehelper.PageInfo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import cn.dev33.satoken.stp.StpUtil; +import java.util.List; + +@RestController +@RequestMapping("/api/student") +@Tag(name = "学生管理", description = "学生扩展信息管理接口") +public class EduStudentController { + + @Resource + private EduStudentService eduStudentService; + + @PostMapping + @Operation(summary = "新增学生", description = "创建学生扩展信息") + public CommonResult save(@RequestBody EduStudent student) { + return CommonResult.success(eduStudentService.save(student)); + } + + @PutMapping("/{id}") + @Operation(summary = "更新学生", description = "更新学生扩展信息") + public CommonResult update(@PathVariable Long id, @RequestBody EduStudent student) { + student.setId(id); + return CommonResult.success(eduStudentService.update(student)); + } + + @DeleteMapping("/{id}") + @Operation(summary = "删除学生", description = "删除学生扩展信息") + public CommonResult delete(@PathVariable Long id) { + eduStudentService.delete(id); + return CommonResult.success(null); + } + + @GetMapping("/{id}") + @Operation(summary = "查询学生详情", description = "根据ID查询学生扩展信息") + public CommonResult queryById(@PathVariable Long id) { + return CommonResult.success(eduStudentService.queryById(id)); + } + + @GetMapping("/user/{userId}") + @Operation(summary = "根据用户ID查询学生", description = "根据用户ID查询学生扩展信息") + public CommonResult queryByUserId(@PathVariable Long userId) { + return CommonResult.success(eduStudentService.queryByUserId(userId)); + } + + @GetMapping("/user") + @Operation(summary = "查询当前用户学生信息", description = "查询当前登录用户的学生扩展信息") + public CommonResult queryCurrentUserStudent() { + Long userId = StpUtil.getLoginIdAsLong(); + return CommonResult.success(eduStudentService.queryByUserId(userId)); + } + + @GetMapping("/school/{schoolId}") + @Operation(summary = "查询学校学生列表", description = "根据学校ID查询学生列表") + public CommonResult> queryListBySchoolId(@PathVariable Long schoolId) { + return CommonResult.success(eduStudentService.queryListBySchoolId(schoolId)); + } + + @GetMapping("/college/{collegeId}") + @Operation(summary = "查询学院学生列表", description = "根据学院ID查询学生列表") + public CommonResult> queryListByCollegeId(@PathVariable Long collegeId) { + return CommonResult.success(eduStudentService.queryListByCollegeId(collegeId)); + } + + @GetMapping("/activation/{code}") + @Operation(summary = "根据激活码查询学生", description = "根据激活码查询未绑定的学生信息") + public CommonResult queryByActivationCode(@PathVariable String code) { + return CommonResult.success(eduStudentService.queryByActivationCode(code)); + } + + @PostMapping("/{studentId}/bind/{userId}") + @Operation(summary = "绑定用户", description = "将学生信息绑定到用户账号") + public CommonResult bindUser(@PathVariable Long studentId, @PathVariable Long userId) { + return CommonResult.success(eduStudentService.bindUser(studentId, userId)); + } + + @PostMapping("/pageList") + @Operation(summary = "分页查询学生", description = "分页查询学生列表") + public CommonResult> getPageList(@RequestBody EduStudentDto queryDto) { + return CommonResult.success(eduStudentService.getPageList(queryDto)); + } +} diff --git a/src/main/java/art/kexue/sxwz/controller/EduTeacherController.java b/src/main/java/art/kexue/sxwz/controller/EduTeacherController.java new file mode 100644 index 0000000..621009e --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/EduTeacherController.java @@ -0,0 +1,92 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.EduTeacher; +import art.kexue.sxwz.entity.dto.EduTeacherDto; +import art.kexue.sxwz.service.EduTeacherService; +import com.github.pagehelper.PageInfo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import cn.dev33.satoken.stp.StpUtil; +import java.util.List; + +@RestController +@RequestMapping("/api/teacher") +@Tag(name = "教师管理", description = "教师扩展信息管理接口") +public class EduTeacherController { + + @Resource + private EduTeacherService eduTeacherService; + + @PostMapping + @Operation(summary = "新增教师", description = "创建教师扩展信息") + public CommonResult save(@RequestBody EduTeacher teacher) { + return CommonResult.success(eduTeacherService.save(teacher)); + } + + @PutMapping("/{id}") + @Operation(summary = "更新教师", description = "更新教师扩展信息") + public CommonResult update(@PathVariable Long id, @RequestBody EduTeacher teacher) { + teacher.setId(id); + return CommonResult.success(eduTeacherService.update(teacher)); + } + + @DeleteMapping("/{id}") + @Operation(summary = "删除教师", description = "删除教师扩展信息") + public CommonResult delete(@PathVariable Long id) { + eduTeacherService.delete(id); + return CommonResult.success(null); + } + + @GetMapping("/{id}") + @Operation(summary = "查询教师详情", description = "根据ID查询教师扩展信息") + public CommonResult queryById(@PathVariable Long id) { + return CommonResult.success(eduTeacherService.queryById(id)); + } + + @GetMapping("/user/{userId}") + @Operation(summary = "根据用户ID查询教师", description = "根据用户ID查询教师扩展信息") + public CommonResult queryByUserId(@PathVariable Long userId) { + return CommonResult.success(eduTeacherService.queryByUserId(userId)); + } + + @GetMapping("/user") + @Operation(summary = "查询当前用户教师信息", description = "查询当前登录用户的教师扩展信息") + public CommonResult queryCurrentUserTeacher() { + Long userId = StpUtil.getLoginIdAsLong(); + return CommonResult.success(eduTeacherService.queryByUserId(userId)); + } + + @GetMapping("/school/{schoolId}") + @Operation(summary = "查询学校教师列表", description = "根据学校ID查询教师列表") + public CommonResult> queryListBySchoolId(@PathVariable Long schoolId) { + return CommonResult.success(eduTeacherService.queryListBySchoolId(schoolId)); + } + + @GetMapping("/college/{collegeId}") + @Operation(summary = "查询学院教师列表", description = "根据学院ID查询教师列表") + public CommonResult> queryListByCollegeId(@PathVariable Long collegeId) { + return CommonResult.success(eduTeacherService.queryListByCollegeId(collegeId)); + } + + @GetMapping("/activation/{code}") + @Operation(summary = "根据激活码查询教师", description = "根据激活码查询未绑定的教师信息") + public CommonResult queryByActivationCode(@PathVariable String code) { + return CommonResult.success(eduTeacherService.queryByActivationCode(code)); + } + + @PostMapping("/{teacherId}/bind/{userId}") + @Operation(summary = "绑定用户", description = "将教师信息绑定到用户账号") + public CommonResult bindUser(@PathVariable Long teacherId, @PathVariable Long userId) { + return CommonResult.success(eduTeacherService.bindUser(teacherId, userId)); + } + + @PostMapping("/pageList") + @Operation(summary = "分页查询教师", description = "分页查询教师列表") + public CommonResult> getPageList(@RequestBody EduTeacherDto queryDto) { + return CommonResult.success(eduTeacherService.getPageList(queryDto)); + } +} diff --git a/src/main/java/com/kexue/skills/controller/LoginController.java b/src/main/java/art/kexue/sxwz/controller/LoginController.java similarity index 90% rename from src/main/java/com/kexue/skills/controller/LoginController.java rename to src/main/java/art/kexue/sxwz/controller/LoginController.java index 858936f..1655856 100644 --- a/src/main/java/com/kexue/skills/controller/LoginController.java +++ b/src/main/java/art/kexue/sxwz/controller/LoginController.java @@ -1,13 +1,13 @@ -package com.kexue.skills.controller; +package art.kexue.sxwz.controller; -import com.kexue.skills.annotation.Log; -import com.kexue.skills.annotation.PreventDuplicateSubmission; -import com.kexue.skills.common.CacheManager; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.request.LoginDto; -import com.kexue.skills.entity.request.LoginUserDto; -import com.kexue.skills.entity.request.PhoneLoginDto; -import com.kexue.skills.service.SysUserService; +import art.kexue.sxwz.annotation.Log; +import art.kexue.sxwz.annotation.PreventDuplicateSubmission; +import art.kexue.sxwz.common.CacheManager; +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.request.LoginDto; +import art.kexue.sxwz.entity.request.LoginUserDto; +import art.kexue.sxwz.entity.request.PhoneLoginDto; +import art.kexue.sxwz.service.SysUserService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.web.bind.annotation.*; @@ -137,3 +137,4 @@ public class LoginController { } + diff --git a/src/main/java/com/kexue/skills/controller/ModelPriceController.java b/src/main/java/art/kexue/sxwz/controller/ModelPriceController.java similarity index 94% rename from src/main/java/com/kexue/skills/controller/ModelPriceController.java rename to src/main/java/art/kexue/sxwz/controller/ModelPriceController.java index 1694081..8d48759 100644 --- a/src/main/java/com/kexue/skills/controller/ModelPriceController.java +++ b/src/main/java/art/kexue/sxwz/controller/ModelPriceController.java @@ -1,10 +1,10 @@ -package com.kexue.skills.controller; +package art.kexue.sxwz.controller; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.ModelPrice; -import com.kexue.skills.entity.dto.ModelPriceDto; -import com.kexue.skills.service.ModelPriceService; -import com.kexue.skills.common.CommonResult; +import art.kexue.sxwz.entity.ModelPrice; +import art.kexue.sxwz.entity.dto.ModelPriceDto; +import art.kexue.sxwz.service.ModelPriceService; +import art.kexue.sxwz.common.CommonResult; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.web.bind.annotation.*; @@ -111,3 +111,4 @@ public class ModelPriceController { } } + diff --git a/src/main/java/com/kexue/skills/controller/PackageConfigController.java b/src/main/java/art/kexue/sxwz/controller/PackageConfigController.java similarity index 91% rename from src/main/java/com/kexue/skills/controller/PackageConfigController.java rename to src/main/java/art/kexue/sxwz/controller/PackageConfigController.java index 7f0b11f..80aff73 100644 --- a/src/main/java/com/kexue/skills/controller/PackageConfigController.java +++ b/src/main/java/art/kexue/sxwz/controller/PackageConfigController.java @@ -1,12 +1,12 @@ -package com.kexue.skills.controller; +package art.kexue.sxwz.controller; import com.github.pagehelper.PageInfo; -import com.kexue.skills.annotation.RequireAuth; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.PackageConfig; -import com.kexue.skills.entity.base.IdDto; -import com.kexue.skills.entity.dto.PackageConfigDto; -import com.kexue.skills.service.PackageConfigService; +import art.kexue.sxwz.annotation.RequireAuth; +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.PackageConfig; +import art.kexue.sxwz.entity.base.IdDto; +import art.kexue.sxwz.entity.dto.PackageConfigDto; +import art.kexue.sxwz.service.PackageConfigService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.web.bind.annotation.*; @@ -119,3 +119,4 @@ public class PackageConfigController { } } + diff --git a/src/main/java/com/kexue/skills/controller/PageController.java b/src/main/java/art/kexue/sxwz/controller/PageController.java similarity index 98% rename from src/main/java/com/kexue/skills/controller/PageController.java rename to src/main/java/art/kexue/sxwz/controller/PageController.java index d5adc26..899ab76 100644 --- a/src/main/java/com/kexue/skills/controller/PageController.java +++ b/src/main/java/art/kexue/sxwz/controller/PageController.java @@ -1,4 +1,4 @@ -//package com.kexue.skills.controller; +//package art.kexue.sxwz.controller; // //import lombok.extern.slf4j.Slf4j; //import org.springframework.stereotype.Controller; @@ -90,3 +90,4 @@ // } // //} + diff --git a/src/main/java/com/kexue/skills/controller/PayController.java b/src/main/java/art/kexue/sxwz/controller/PayController.java similarity index 95% rename from src/main/java/com/kexue/skills/controller/PayController.java rename to src/main/java/art/kexue/sxwz/controller/PayController.java index 9400f1c..d2a1b18 100644 --- a/src/main/java/com/kexue/skills/controller/PayController.java +++ b/src/main/java/art/kexue/sxwz/controller/PayController.java @@ -1,9 +1,9 @@ -package com.kexue.skills.controller; +package art.kexue.sxwz.controller; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.PaymentOrder; -import com.kexue.skills.service.PayService; -import com.kexue.skills.service.PaymentOrderService; +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.PaymentOrder; +import art.kexue.sxwz.service.PayService; +import art.kexue.sxwz.service.PaymentOrderService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; @@ -12,8 +12,8 @@ import org.springframework.web.bind.annotation.*; import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletRequest; -import com.kexue.skills.entity.dto.OrderStatusDto; -import com.kexue.skills.entity.dto.OrderStatusQueryDto; +import art.kexue.sxwz.entity.dto.OrderStatusDto; +import art.kexue.sxwz.entity.dto.OrderStatusQueryDto; import java.util.Map; import java.util.Objects; @@ -190,3 +190,4 @@ public class PayController { } } } + diff --git a/src/main/java/com/kexue/skills/controller/PaymentOrderController.java b/src/main/java/art/kexue/sxwz/controller/PaymentOrderController.java similarity index 89% rename from src/main/java/com/kexue/skills/controller/PaymentOrderController.java rename to src/main/java/art/kexue/sxwz/controller/PaymentOrderController.java index 707ccb2..6cb03cf 100644 --- a/src/main/java/com/kexue/skills/controller/PaymentOrderController.java +++ b/src/main/java/art/kexue/sxwz/controller/PaymentOrderController.java @@ -1,11 +1,11 @@ -package com.kexue.skills.controller; +package art.kexue.sxwz.controller; import com.github.pagehelper.PageInfo; -import com.kexue.skills.annotation.RequireAuth; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.PaymentOrder; -import com.kexue.skills.entity.dto.PaymentOrderDto; -import com.kexue.skills.service.PaymentOrderService; +import art.kexue.sxwz.annotation.RequireAuth; +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.PaymentOrder; +import art.kexue.sxwz.entity.dto.PaymentOrderDto; +import art.kexue.sxwz.service.PaymentOrderService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; @@ -82,4 +82,4 @@ public class PaymentOrderController { public CommonResult queryByOrderNo(@Parameter(description = "订单号") @RequestParam("orderNo") String orderNo) { return CommonResult.success(this.paymentOrderService.queryByOrderNo(orderNo)); } -} \ No newline at end of file +} diff --git a/src/main/java/art/kexue/sxwz/controller/QRCodeController.java b/src/main/java/art/kexue/sxwz/controller/QRCodeController.java new file mode 100644 index 0000000..726e5b7 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/QRCodeController.java @@ -0,0 +1,52 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.utils.QRCodeUtil; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.Map; + +@RestController +@RequestMapping("/api/qrcode") +@CrossOrigin(origins = "*") +@Tag(name = "二维码 Api") +public class QRCodeController { + + @GetMapping("/generate") + @Operation(summary = "生成二维码图片", description = "生成二维码图片,返回PNG格式图片") + public ResponseEntity generateQRCode( + @Parameter(description = "二维码内容(文本或URL)") @RequestParam("content") String content, + @Parameter(description = "二维码宽度,默认300") @RequestParam(value = "width", defaultValue = "300") int width, + @Parameter(description = "二维码高度,默认300") @RequestParam(value = "height", defaultValue = "300") int height) { + + byte[] qrCodeBytes = QRCodeUtil.generateQRCode(content, width, height); + + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.IMAGE_PNG); + headers.setContentLength(qrCodeBytes.length); + + return ResponseEntity.ok().headers(headers).body(qrCodeBytes); + } + + @GetMapping("/generate/base64") + @Operation(summary = "生成二维码Base64", description = "生成二维码并返回Base64编码字符串") + public CommonResult> generateQRCodeBase64( + @Parameter(description = "二维码内容(文本或URL)") @RequestParam("content") String content, + @Parameter(description = "二维码宽度,默认300") @RequestParam(value = "width", defaultValue = "300") int width, + @Parameter(description = "二维码高度,默认300") @RequestParam(value = "height", defaultValue = "300") int height) { + + String base64Image = QRCodeUtil.generateQRCodeBase64(content, width, height); + + Map result = new HashMap<>(); + result.put("qrCodeImage", base64Image); + + return CommonResult.success(result); + } +} diff --git a/src/main/java/com/kexue/skills/controller/SessionController.java b/src/main/java/art/kexue/sxwz/controller/SessionController.java similarity index 85% rename from src/main/java/com/kexue/skills/controller/SessionController.java rename to src/main/java/art/kexue/sxwz/controller/SessionController.java index 9f3ce62..a6a3765 100644 --- a/src/main/java/com/kexue/skills/controller/SessionController.java +++ b/src/main/java/art/kexue/sxwz/controller/SessionController.java @@ -1,8 +1,8 @@ -package com.kexue.skills.controller; +package art.kexue.sxwz.controller; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.dto.SessionDto; -import com.kexue.skills.service.SysUserService; +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.dto.SessionDto; +import art.kexue.sxwz.service.SysUserService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.web.bind.annotation.*; @@ -39,3 +39,4 @@ public class SessionController { return CommonResult.success(sessionDto); } } + diff --git a/src/main/java/art/kexue/sxwz/controller/SysDeptController.java b/src/main/java/art/kexue/sxwz/controller/SysDeptController.java new file mode 100644 index 0000000..18c7639 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/SysDeptController.java @@ -0,0 +1,69 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.SysDept; +import art.kexue.sxwz.service.SysDeptService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +@RestController +@RequestMapping("/api/dept") +@Tag(name = "部门管理", description = "组织机构管理接口") +public class SysDeptController { + + @Resource + private SysDeptService sysDeptService; + + @PostMapping + @Operation(summary = "添加部门", description = "添加新部门") + public CommonResult save(@RequestBody SysDept sysDept) { + return CommonResult.success(sysDeptService.save(sysDept)); + } + + @DeleteMapping("/{id}") + @Operation(summary = "删除部门", description = "删除部门(级联删除子部门)") + public CommonResult delete(@PathVariable Long id) { + sysDeptService.delete(id); + return CommonResult.success(null); + } + + @PutMapping + @Operation(summary = "更新部门", description = "更新部门信息") + public CommonResult update(@RequestBody SysDept sysDept) { + return CommonResult.success(sysDeptService.update(sysDept)); + } + + @GetMapping("/{id}") + @Operation(summary = "查询部门详情", description = "根据ID查询部门详情") + public CommonResult queryById(@PathVariable Long id) { + return CommonResult.success(sysDeptService.queryById(id)); + } + + @GetMapping("/list") + @Operation(summary = "查询部门列表", description = "查询部门列表") + public CommonResult> queryList(SysDept sysDept) { + return CommonResult.success(sysDeptService.queryList(sysDept)); + } + + @GetMapping("/parent/{parentId}") + @Operation(summary = "查询子部门", description = "根据父部门ID查询子部门列表") + public CommonResult> queryByParentId(@PathVariable Long parentId) { + return CommonResult.success(sysDeptService.queryByParentId(parentId)); + } + + @GetMapping("/level/{level}") + @Operation(summary = "按层级查询", description = "根据层级查询部门") + public CommonResult> queryByLevel(@PathVariable Integer level) { + return CommonResult.success(sysDeptService.queryByLevel(level)); + } + + @GetMapping("/tree") + @Operation(summary = "获取部门树", description = "获取部门树形结构") + public CommonResult> getTree(@RequestParam(required = false) Long parentId) { + return CommonResult.success(sysDeptService.getTree(parentId)); + } +} diff --git a/src/main/java/com/kexue/skills/controller/SysDictController.java b/src/main/java/art/kexue/sxwz/controller/SysDictController.java similarity index 93% rename from src/main/java/com/kexue/skills/controller/SysDictController.java rename to src/main/java/art/kexue/sxwz/controller/SysDictController.java index 6011ad0..40e1e68 100644 --- a/src/main/java/com/kexue/skills/controller/SysDictController.java +++ b/src/main/java/art/kexue/sxwz/controller/SysDictController.java @@ -1,15 +1,14 @@ -package com.kexue.skills.controller; +package art.kexue.sxwz.controller; -import com.kexue.skills.entity.SysDict; -import com.kexue.skills.entity.dto.SysDictDto; -import com.kexue.skills.service.SysDictService; +import art.kexue.sxwz.entity.SysDict; +import art.kexue.sxwz.entity.dto.SysDictDto; +import art.kexue.sxwz.service.SysDictService; import org.springframework.web.bind.annotation.*; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import javax.annotation.Resource; import com.github.pagehelper.PageInfo; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.base.IdDto; +import art.kexue.sxwz.common.CommonResult; import java.util.List; import java.util.Map; @@ -121,3 +120,4 @@ public class SysDictController { return CommonResult.success(sysDictService.getListByDictCode(sysDict.getDictCode())); } } + diff --git a/src/main/java/com/kexue/skills/controller/SysLogController.java b/src/main/java/art/kexue/sxwz/controller/SysLogController.java similarity index 90% rename from src/main/java/com/kexue/skills/controller/SysLogController.java rename to src/main/java/art/kexue/sxwz/controller/SysLogController.java index 390b084..2dd8185 100644 --- a/src/main/java/com/kexue/skills/controller/SysLogController.java +++ b/src/main/java/art/kexue/sxwz/controller/SysLogController.java @@ -1,15 +1,14 @@ -package com.kexue.skills.controller; +package art.kexue.sxwz.controller; -import com.kexue.skills.entity.SysLog; -import com.kexue.skills.entity.dto.SysLogDto; -import com.kexue.skills.service.SysLogService; +import art.kexue.sxwz.entity.SysLog; +import art.kexue.sxwz.entity.dto.SysLogDto; +import art.kexue.sxwz.service.SysLogService; import org.springframework.web.bind.annotation.*; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import javax.annotation.Resource; import com.github.pagehelper.PageInfo; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.base.IdDto; +import art.kexue.sxwz.common.CommonResult; /** * (SysLog)表控制层 @@ -87,3 +86,4 @@ public class SysLogController { return CommonResult.success(sysLogService.deleteById(id)); } } + diff --git a/src/main/java/com/kexue/skills/controller/SysMenuController.java b/src/main/java/art/kexue/sxwz/controller/SysMenuController.java similarity index 90% rename from src/main/java/com/kexue/skills/controller/SysMenuController.java rename to src/main/java/art/kexue/sxwz/controller/SysMenuController.java index 5a29464..cc8c2f2 100644 --- a/src/main/java/com/kexue/skills/controller/SysMenuController.java +++ b/src/main/java/art/kexue/sxwz/controller/SysMenuController.java @@ -1,15 +1,14 @@ -package com.kexue.skills.controller; +package art.kexue.sxwz.controller; -import com.kexue.skills.entity.SysMenu; -import com.kexue.skills.entity.dto.SysMenuDto; -import com.kexue.skills.service.SysMenuService; +import art.kexue.sxwz.entity.SysMenu; +import art.kexue.sxwz.entity.dto.SysMenuDto; +import art.kexue.sxwz.service.SysMenuService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import com.github.pagehelper.PageInfo; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.base.IdDto; +import art.kexue.sxwz.common.CommonResult; /** * (SysMenu)表控制层 @@ -87,3 +86,4 @@ public class SysMenuController { return CommonResult.success(sysMenuService.deleteById(id)); } } + diff --git a/src/main/java/art/kexue/sxwz/controller/SysNotificationController.java b/src/main/java/art/kexue/sxwz/controller/SysNotificationController.java new file mode 100644 index 0000000..3612a2d --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/SysNotificationController.java @@ -0,0 +1,147 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.SysNotification; +import art.kexue.sxwz.entity.SysUser; +import art.kexue.sxwz.entity.request.SendNotificationRequest; +import art.kexue.sxwz.service.SysNotificationService; +import art.kexue.sxwz.service.SysUserService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import cn.dev33.satoken.stp.StpUtil; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/api/notification") +@Tag(name = "通知管理", description = "通知管理接口") +public class SysNotificationController { + + @Resource + private SysNotificationService sysNotificationService; + + @Resource + private SysUserService sysUserService; + + @PostMapping + @Operation(summary = "发送通知", description = "发送通知给用户") + public CommonResult save(@RequestBody SysNotification notification) { + return CommonResult.success(sysNotificationService.save(notification)); + } + + @DeleteMapping("/{id}") + @Operation(summary = "删除通知", description = "删除通知") + public CommonResult delete(@PathVariable Long id) { + sysNotificationService.delete(id); + return CommonResult.success(null); + } + + @GetMapping("/{id}") + @Operation(summary = "查询通知详情", description = "根据ID查询通知详情") + public CommonResult queryById(@PathVariable Long id) { + return CommonResult.success(sysNotificationService.queryById(id)); + } + + @GetMapping("/user/{userId}") + @Operation(summary = "查询用户通知列表", description = "根据用户ID和学校ID查询通知列表") + public CommonResult> queryByUserId(@PathVariable Long userId, + @RequestParam Long schoolId) { + return CommonResult.success(sysNotificationService.queryByUserId(userId, schoolId)); + } + + @GetMapping("/user") + @Operation(summary = "查询当前用户通知列表", description = "查询当前登录用户的通知列表") + public CommonResult> queryCurrentUserNotifications(@RequestParam Long schoolId) { + Long userId = cn.dev33.satoken.stp.StpUtil.getLoginIdAsLong(); + return CommonResult.success(sysNotificationService.queryByUserId(userId, schoolId)); + } + + @PutMapping("/{notificationId}/read/{userId}") + @Operation(summary = "标记为已读", description = "将通知标记为已读") + public CommonResult markAsRead(@PathVariable Long userId, @PathVariable Long notificationId) { + sysNotificationService.markAsRead(userId, notificationId); + return CommonResult.success(null); + } + + @PutMapping("/user/{userId}/read-all") + @Operation(summary = "全部标记为已读", description = "将用户所有通知标记为已读") + public CommonResult markAllAsRead(@PathVariable Long userId, @RequestParam Long schoolId) { + sysNotificationService.markAllAsRead(userId, schoolId); + return CommonResult.success(null); + } + + @GetMapping("/user/{userId}/unread-count") + @Operation(summary = "查询未读数量", description = "查询用户未读通知数量") + public CommonResult countUnread(@PathVariable Long userId, @RequestParam Long schoolId) { + return CommonResult.success(sysNotificationService.countUnread(userId, schoolId)); + } + + @PostMapping("/send") + @Operation(summary = "发送通知(简化)", description = "发送通知给用户") + public CommonResult sendNotification(@RequestBody Map body) { + Long schoolId = ((Number) body.get("schoolId")).longValue(); + Long userId = ((Number) body.get("userId")).longValue(); + String title = (String) body.get("title"); + String content = (String) body.get("content"); + Integer type = body.get("type") != null ? ((Number) body.get("type")).intValue() : null; + sysNotificationService.sendNotification(schoolId, userId, title, content, type); + return CommonResult.success(null); + } + + @PostMapping("/send-to-users") + @Operation(summary = "发送通知给指定用户", description = "发送通知给指定的用户列表") + public CommonResult sendToUsers(@RequestBody SendNotificationRequest request) { + Long currentUserId = StpUtil.getLoginIdAsLong(); + SysUser currentUser = sysUserService.queryById(currentUserId); + String senderName = currentUser.getUserName(); + + sysNotificationService.sendUserNotification(request.getSchoolId(), currentUserId, senderName, + request.getTitle(), request.getContent(), + request.getTargetUserIds(), request.getTargetRoleTypes()); + return CommonResult.success(null); + } + + @PostMapping("/send-to-roles") + @Operation(summary = "发送通知给指定角色", description = "发送通知给指定角色类型的所有用户") + public CommonResult sendToRoles(@RequestBody SendNotificationRequest request) { + Long currentUserId = StpUtil.getLoginIdAsLong(); + SysUser currentUser = sysUserService.queryById(currentUserId); + String senderName = currentUser.getUserName(); + + sysNotificationService.sendUserNotification(request.getSchoolId(), currentUserId, senderName, + request.getTitle(), request.getContent(), + request.getTargetUserIds(), request.getTargetRoleTypes()); + return CommonResult.success(null); + } + + @PostMapping("/send-to-course") + @Operation(summary = "发送课程通知", description = "老师发送通知给指定课程的所有学生") + public CommonResult sendToCourse(@RequestBody SendNotificationRequest request) { + Long currentUserId = StpUtil.getLoginIdAsLong(); + SysUser currentUser = sysUserService.queryById(currentUserId); + String senderName = currentUser.getUserName(); + + sysNotificationService.sendCourseNotification(request.getSchoolId(), currentUserId, senderName, + request.getTitle(), request.getContent(), request.getCourseIds()); + return CommonResult.success(null); + } + + @GetMapping("/available-targets") + @Operation(summary = "获取可通知的目标角色", description = "获取当前用户可以通知的下级角色类型") + public CommonResult> getAvailableTargetRoles() { + Long currentUserId = StpUtil.getLoginIdAsLong(); + List roles = sysNotificationService.getAvailableTargetRoles(currentUserId); + return CommonResult.success(roles); + } + + @GetMapping("/users-by-roles") + @Operation(summary = "获取指定角色的用户列表", description = "获取指定角色类型的用户列表") + public CommonResult> getUsersByRoleTypes(@RequestParam Long schoolId, + @RequestParam List roleTypes) { + List users = sysNotificationService.getUsersByRoleTypes(schoolId, roleTypes); + return CommonResult.success(users); + } +} diff --git a/src/main/java/com/kexue/skills/controller/SysRoleController.java b/src/main/java/art/kexue/sxwz/controller/SysRoleController.java similarity index 90% rename from src/main/java/com/kexue/skills/controller/SysRoleController.java rename to src/main/java/art/kexue/sxwz/controller/SysRoleController.java index 9540483..4303350 100644 --- a/src/main/java/com/kexue/skills/controller/SysRoleController.java +++ b/src/main/java/art/kexue/sxwz/controller/SysRoleController.java @@ -1,15 +1,14 @@ -package com.kexue.skills.controller; +package art.kexue.sxwz.controller; -import com.kexue.skills.entity.SysRole; -import com.kexue.skills.entity.dto.SysRoleDto; -import com.kexue.skills.service.SysRoleService; +import art.kexue.sxwz.entity.SysRole; +import art.kexue.sxwz.entity.dto.SysRoleDto; +import art.kexue.sxwz.service.SysRoleService; import org.springframework.web.bind.annotation.*; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import javax.annotation.Resource; import com.github.pagehelper.PageInfo; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.base.IdDto; +import art.kexue.sxwz.common.CommonResult; /** * (SysRole)表控制层 @@ -87,3 +86,4 @@ public class SysRoleController { return CommonResult.success(sysRoleService.deleteById(id)); } } + diff --git a/src/main/java/art/kexue/sxwz/controller/SysUFFserRoleController.java b/src/main/java/art/kexue/sxwz/controller/SysUFFserRoleController.java new file mode 100644 index 0000000..d718f29 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/SysUFFserRoleController.java @@ -0,0 +1,96 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.SysUserRole; +import art.kexue.sxwz.entity.request.AssignRoleDto; +import art.kexue.sxwz.entity.request.AddRoleDto; +import art.kexue.sxwz.service.SysUserRoleService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import cn.dev33.satoken.stp.StpUtil; +import java.util.List; + +@RestController +@RequestMapping("/api/user-role") +@Tag(name = "用户角色管理", description = "用户角色关联管理接口") +public class SysUFFserRoleController { + + @Resource + private SysUserRoleService sysUserRoleService; + + @PostMapping + @Operation(summary = "添加用户角色", description = "为用户添加角色") + public CommonResult save(@RequestBody SysUserRole userRole) { + return CommonResult.success(sysUserRoleService.save(userRole)); + } + + @DeleteMapping("/{id}") + @Operation(summary = "删除用户角色", description = "删除用户角色关联") + public CommonResult delete(@PathVariable Long id) { + sysUserRoleService.delete(id); + return CommonResult.success(null); + } + + @GetMapping("/{id}") + @Operation(summary = "查询用户角色详情", description = "根据ID查询用户角色关联") + public CommonResult queryById(@PathVariable Long id) { + return CommonResult.success(sysUserRoleService.queryById(id)); + } + + @GetMapping("/user/{userId}") + @Operation(summary = "查询用户角色列表", description = "根据用户ID查询角色列表") + public CommonResult> queryByUserId(@PathVariable Long userId) { + return CommonResult.success(sysUserRoleService.queryByUserId(userId)); + } + + @GetMapping("/user") + @Operation(summary = "查询当前用户角色列表", description = "查询当前登录用户的角色列表") + public CommonResult> queryCurrentUserRoles() { + Long userId = StpUtil.getLoginIdAsLong(); + return CommonResult.success(sysUserRoleService.queryByUserId(userId)); + } + + @GetMapping("/user/{userId}/codes") + @Operation(summary = "查询用户角色码列表", description = "根据用户ID查询角色码列表") + public CommonResult> queryRoleCodesByUserId(@PathVariable Long userId) { + return CommonResult.success(sysUserRoleService.queryRoleCodesByUserId(userId)); + } + + @PostMapping("/assign") + @Operation(summary = "分配角色(清空后重新分配)", description = "为用户分配角色列表(会先清空原有角色)") + public CommonResult assignRoles(@RequestBody AddRoleDto addRoleDto) { + sysUserRoleService.assignRoles(addRoleDto.getUserId(), addRoleDto.getRoleCodes()); + return CommonResult.success(null); + } + + @PostMapping("/bind") + @Operation(summary = "绑定用户角色", description = "为用户绑定角色,可以选择清空原有角色或追加角色") + public CommonResult bindRoles(@RequestBody AssignRoleDto assignRoleDto) { + boolean clearExisting = assignRoleDto.getClearExisting() != null ? assignRoleDto.getClearExisting() : true; + sysUserRoleService.assignRoles(assignRoleDto.getUserId(), assignRoleDto.getRoleCodes(), clearExisting); + return CommonResult.success(null); + } + + @PostMapping("/add") + @Operation(summary = "添加角色", description = "为用户追加角色(不清空原有角色)") + public CommonResult addRoles(@RequestBody AddRoleDto addRoleDto) { + sysUserRoleService.addRoles(addRoleDto.getUserId(), addRoleDto.getRoleCodes()); + return CommonResult.success(null); + } + + @PostMapping("/remove") + @Operation(summary = "移除角色", description = "从用户身上移除指定角色") + public CommonResult removeRoles(@RequestBody AddRoleDto addRoleDto) { + sysUserRoleService.removeRoles(addRoleDto.getUserId(), addRoleDto.getRoleCodes()); + return CommonResult.success(null); + } + + @GetMapping("/user/{userId}/has-role/{roleCode}") + @Operation(summary = "检查角色", description = "检查用户是否拥有指定角色") + public CommonResult hasRole(@PathVariable Long userId, @PathVariable String roleCode) { + return CommonResult.success(sysUserRoleService.hasRole(userId, roleCode)); + } +} diff --git a/src/main/java/com/kexue/skills/controller/SysUserController.java b/src/main/java/art/kexue/sxwz/controller/SysUserController.java similarity index 66% rename from src/main/java/com/kexue/skills/controller/SysUserController.java rename to src/main/java/art/kexue/sxwz/controller/SysUserController.java index f5621ff..f41ed3a 100644 --- a/src/main/java/com/kexue/skills/controller/SysUserController.java +++ b/src/main/java/art/kexue/sxwz/controller/SysUserController.java @@ -1,26 +1,28 @@ -package com.kexue.skills.controller; +package art.kexue.sxwz.controller; -import com.kexue.skills.annotation.RequireAuth; -import com.kexue.skills.entity.SysUser; -import com.kexue.skills.entity.dto.SysUserDto; -import com.kexue.skills.entity.request.*; -import com.kexue.skills.exception.BizException; -import com.kexue.skills.service.SysUserService; +import art.kexue.sxwz.entity.request.*; +import art.kexue.sxwz.entity.request.BindPhoneDto; +import art.kexue.sxwz.entity.request.BindWxDto; +import art.kexue.sxwz.annotation.RequireAuth; +import art.kexue.sxwz.annotation.RequireRole; +import art.kexue.sxwz.entity.SysUser; +import art.kexue.sxwz.entity.dto.SysUserDto; +import art.kexue.sxwz.entity.request.*; +import art.kexue.sxwz.exception.BizException; +import art.kexue.sxwz.service.SysUserService; import org.springframework.web.bind.annotation.*; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import javax.annotation.Resource; import jakarta.servlet.http.HttpServletRequest; -import com.kexue.skills.common.CacheManager; +import art.kexue.sxwz.common.CacheManager; import com.github.pagehelper.PageInfo; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.base.IdDto; +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.base.IdDto; import org.redisson.api.RedissonClient; import org.springframework.web.multipart.MultipartFile; -import java.io.File; -import java.io.IOException; -import java.util.UUID; -import org.springframework.beans.factory.annotation.Value; + +import java.util.List; /** * (SysUser)表控制层 @@ -214,17 +216,13 @@ public class SysUserController { } // 解析JSON字符串为LoginUser对象 - com.kexue.skills.entity.request.LoginUser loginUser = cn.hutool.json.JSONUtil.toBean(loginUserJson, com.kexue.skills.entity.request.LoginUser.class); + LoginUser loginUser = cn.hutool.json.JSONUtil.toBean(loginUserJson, LoginUser.class); // 转换为LoginUserDto LoginUserDto loginUserDto = new LoginUserDto(); loginUserDto.setToken(loginUser.getToken()); loginUserDto.setUserInfo(loginUser.getUserInfo()); - loginUserDto.setFavorites(loginUser.getFavorites()); - loginUserDto.setHistory(loginUser.getHistory()); - loginUserDto.setCreate(loginUser.getCreate()); - loginUserDto.setHas(loginUser.getHas()); - + return CommonResult.success(loginUserDto); } @@ -252,7 +250,7 @@ public class SysUserController { } // 解析JSON字符串为LoginUser对象 - com.kexue.skills.entity.request.LoginUser loginUser = cn.hutool.json.JSONUtil.toBean(loginUserJson, com.kexue.skills.entity.request.LoginUser.class); + LoginUser loginUser = cn.hutool.json.JSONUtil.toBean(loginUserJson, LoginUser.class); if (loginUser == null || loginUser.getUserInfo() == null) { throw new BizException("无效的token,请重新登录"); } @@ -267,4 +265,70 @@ public class SysUserController { return CommonResult.success(fileName); } + + @PostMapping("/verifyPhoneCode") + @Operation(summary = "验证手机号验证码", description = "验证手机号和验证码是否匹配,用于更换手机号等场景的原手机号验证") + public CommonResult verifyPhoneCode(@RequestBody VerifyPhoneCodeDto verifyPhoneCodeDto) { + boolean result = sysUserService.verifyPhoneCode(verifyPhoneCodeDto.getPhone(), verifyPhoneCodeDto.getCode()); + return CommonResult.success(result); + } + + @PostMapping("/bindPhone") + @Operation(summary = "绑定电话号码", description = "为当前登录用户绑定手机号码") + @RequireAuth + public CommonResult bindPhone(@RequestBody BindPhoneDto bindPhoneDto) { + boolean result = sysUserService.bindPhone(bindPhoneDto.getPhone(), bindPhoneDto.getCode()); + return CommonResult.success(result); + } + + @PostMapping("/bindWx") + @Operation(summary = "绑定微信", description = "为用户绑定微信ID") + @RequireAuth + public CommonResult bindWx(@RequestBody BindWxDto bindWxDto) { + boolean result = sysUserService.bindWx(bindWxDto.getUserId(), bindWxDto.getWxid()); + return CommonResult.success(result); + } + + @PostMapping("/createSchoolAdmin") + @Operation(summary = "创建学校管理员", description = "创建学校管理员用户,只有公司管理员(SUPER)能操作") + @RequireRole("SUPER") + public CommonResult createSchoolAdmin(@RequestBody CreateUserDto createUserDto) { + return CommonResult.success(sysUserService.createSchoolAdmin(createUserDto)); + } + + @PostMapping("/createCollegeAdmin") + @Operation(summary = "创建学院管理员", description = "创建学院管理员用户,只有学校管理员(SCOOL_ADMIN)能操作") + @RequireRole("SCOOL_ADMIN") + public CommonResult createCollegeAdmin(@RequestBody CreateUserDto createUserDto) { + return CommonResult.success(sysUserService.createCollegeAdmin(createUserDto)); + } + + @PostMapping("/createTeacher") + @Operation(summary = "创建教师用户", description = "创建教师用户,只有学院管理员(COLLEGE_ADMIN)能操作") + @RequireRole("COLLEGE_ADMIN") + public CommonResult createTeacher(@RequestBody CreateUserDto createUserDto) { + return CommonResult.success(sysUserService.createTeacher(createUserDto)); + } + + @PostMapping("/createStudent") + @Operation(summary = "创建学生用户", description = "创建学生用户,只有学院管理员(COLLEGE_ADMIN)能操作") + @RequireRole("COLLEGE_ADMIN") + public CommonResult createStudent(@RequestBody CreateUserDto createUserDto) { + return CommonResult.success(sysUserService.createStudent(createUserDto)); + } + + @PostMapping("/getUsersBySchool") + @Operation(summary = "根据学校ID获取用户列表", description = "根据学校ID和角色类型获取用户列表") + @RequireAuth + public CommonResult> getUsersBySchool(@RequestBody UserBySchoolQueryDto queryDto) { + return CommonResult.success(sysUserService.getUsersBySchoolIdAndRoleType(queryDto.getSchoolId(), queryDto.getRoleType())); + } + + @PostMapping("/getUsersWithExtBySchool") + @Operation(summary = "根据学校ID获取用户列表(级联查询)", description = "根据学校ID和角色类型获取用户列表,级联查询学生/教师扩展信息") + @RequireAuth + public CommonResult> getUsersWithExtBySchool(@RequestBody UserBySchoolQueryDto queryDto) { + return CommonResult.success(sysUserService.getUsersWithExtBySchoolIdAndRoleType(queryDto.getSchoolId(), queryDto.getRoleType())); + } } + diff --git a/src/main/java/art/kexue/sxwz/controller/WechatLoginController.java b/src/main/java/art/kexue/sxwz/controller/WechatLoginController.java new file mode 100644 index 0000000..7e405a7 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/controller/WechatLoginController.java @@ -0,0 +1,55 @@ +package art.kexue.sxwz.controller; + +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.entity.dto.WechatUserDto; +import art.kexue.sxwz.entity.request.LoginUserDto; +import art.kexue.sxwz.service.SysUserService; +import art.kexue.sxwz.service.WechatUserService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@Slf4j +@RestController +@RequestMapping("/api/login/wechat") +@CrossOrigin(origins = "*") +@Tag(name = "微信登录 Api") +public class WechatLoginController { + + @Autowired + private WechatUserService wechatUserService; + + @Autowired + private SysUserService sysUserService; + + @GetMapping("/authorize") + @Operation(summary = "获取微信授权跳转地址", description = "获取微信授权跳转地址,用于前端跳转微信授权页面生成二维码") + public CommonResult getAuthorizationUrl( + @Parameter(description = "自定义回调地址,不传则使用配置中的默认地址") @RequestParam(required = false) String redirectUri) { + String url; + if (redirectUri != null && !redirectUri.isEmpty()) { + url = wechatUserService.buildAuthorizationUrl(redirectUri); + } else { + url = wechatUserService.buildAuthorizationUrl(); + } + return CommonResult.success(url); + } + + @GetMapping("/callback") + @Operation(summary = "微信授权回调", description = "微信授权回调接口,处理code并完成登录,返回与phoneLogin相同的结果") + public CommonResult callback(@Parameter(description = "微信授权回调code") @RequestParam("code") String code) { + try { + WechatUserDto wechatUser = wechatUserService.handleCallback(code); + log.info("微信授权成功,openId: {}, nickname: {}", wechatUser.getOpenId(), wechatUser.getNickname()); + + LoginUserDto loginUserDto = sysUserService.wechatLogin(wechatUser.getOpenId(), wechatUser.getNickname()); + return CommonResult.success(loginUserDto); + } catch (Exception e) { + log.error("微信授权回调处理失败", e); + return CommonResult.failed("微信授权失败: " + e.getMessage()); + } + } +} diff --git a/src/main/java/com/kexue/skills/entity/Account.java b/src/main/java/art/kexue/sxwz/entity/Account.java similarity index 95% rename from src/main/java/com/kexue/skills/entity/Account.java rename to src/main/java/art/kexue/sxwz/entity/Account.java index 228bbe3..eb31713 100644 --- a/src/main/java/com/kexue/skills/entity/Account.java +++ b/src/main/java/art/kexue/sxwz/entity/Account.java @@ -1,10 +1,10 @@ -package com.kexue.skills.entity; +package art.kexue.sxwz.entity; import java.math.BigDecimal; import java.util.Date; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; +import art.kexue.sxwz.entity.base.BaseEntity; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -58,4 +58,4 @@ public class Account extends BaseEntity implements Serializable { @Schema(description ="更新人") private String updateBy; -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/entity/AccountFrozen.java b/src/main/java/art/kexue/sxwz/entity/AccountFrozen.java similarity index 96% rename from src/main/java/com/kexue/skills/entity/AccountFrozen.java rename to src/main/java/art/kexue/sxwz/entity/AccountFrozen.java index bfac8b7..aaa3858 100644 --- a/src/main/java/com/kexue/skills/entity/AccountFrozen.java +++ b/src/main/java/art/kexue/sxwz/entity/AccountFrozen.java @@ -1,10 +1,10 @@ -package com.kexue.skills.entity; +package art.kexue.sxwz.entity; import java.math.BigDecimal; import java.util.Date; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; +import art.kexue.sxwz.entity.base.BaseEntity; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -78,3 +78,4 @@ public class AccountFrozen extends BaseEntity implements Serializable { private Date updateTime; } + diff --git a/src/main/java/com/kexue/skills/entity/AccountTransaction.java b/src/main/java/art/kexue/sxwz/entity/AccountTransaction.java similarity index 97% rename from src/main/java/com/kexue/skills/entity/AccountTransaction.java rename to src/main/java/art/kexue/sxwz/entity/AccountTransaction.java index a40ceb5..0ac4baa 100644 --- a/src/main/java/com/kexue/skills/entity/AccountTransaction.java +++ b/src/main/java/art/kexue/sxwz/entity/AccountTransaction.java @@ -1,10 +1,10 @@ -package com.kexue.skills.entity; +package art.kexue.sxwz.entity; import java.math.BigDecimal; import java.util.Date; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; +import art.kexue.sxwz.entity.base.BaseEntity; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -100,4 +100,4 @@ public class AccountTransaction extends BaseEntity implements Serializable { @Schema(description ="是否删除 :0 未删除,1已删除") private Integer deleteFlag; -} \ No newline at end of file +} diff --git a/src/main/java/art/kexue/sxwz/entity/ComputeQuota.java b/src/main/java/art/kexue/sxwz/entity/ComputeQuota.java new file mode 100644 index 0000000..6b488e9 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/ComputeQuota.java @@ -0,0 +1,51 @@ +package art.kexue.sxwz.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.Date; + +@Data +@Schema(name = "ComputeQuota", description = "算力配额实体") +public class ComputeQuota { + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "分配对象类型:1-学校,2-学院") + private Integer subjectType; + + @Schema(description = "关联的学校/学院ID") + private Long subjectId; + + @Schema(description = "学校/学院名称(冗余存储,方便查询展示)") + private String subjectName; + + @Schema(description = "已分配算力小时数") + private Long allocatedHours; + + @Schema(description = "已使用算力小时数") + private Long usedHours; + + @Schema(description = "剩余算力小时数(计算字段)") + private Long remainingHours; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "更新时间") + private Date updateTime; + + public Long getRemainingHours() { + if (allocatedHours == null) { + allocatedHours = 0L; + } + if (usedHours == null) { + usedHours = 0L; + } + return allocatedHours - usedHours; + } +} \ No newline at end of file diff --git a/src/main/java/art/kexue/sxwz/entity/EduAttendance.java b/src/main/java/art/kexue/sxwz/entity/EduAttendance.java new file mode 100644 index 0000000..6b910bc --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/EduAttendance.java @@ -0,0 +1,47 @@ +package art.kexue.sxwz.entity; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class EduAttendance { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校ID(数据隔离)") + private Long schoolId; + + @Schema(description = "课程ID") + private Long courseId; + + @Schema(description = "签到名称(按时间自动生成)") + private String name; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "开始时间") + private Date startTime; + + @Schema(description = "签到时长(分钟)") + private Integer duration; + + @Schema(description = "签到类型:1-二维码签到,2-手动点名") + private Integer type; + + @Schema(description = "状态:1-进行中,2-已结束") + private Integer status; + + @Schema(description = "二维码内容") + private String qrCode; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "更新时间") + private Date updateTime; +} diff --git a/src/main/java/art/kexue/sxwz/entity/EduAttendanceRecord.java b/src/main/java/art/kexue/sxwz/entity/EduAttendanceRecord.java new file mode 100644 index 0000000..c9a0bc9 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/EduAttendanceRecord.java @@ -0,0 +1,41 @@ +package art.kexue.sxwz.entity; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class EduAttendanceRecord { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校ID(数据隔离)") + private Long schoolId; + + @Schema(description = "考勤ID") + private Long attendanceId; + + @Schema(description = "学生ID") + private Long studentId; + + @Schema(description = "考勤状态:1-出勤,2-迟到,3-缺勤,4-请假") + private Integer status; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "签到时间") + private Date signTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "记录时间") + private Date recordTime; + + @Schema(description = "备注(手动点名时填写)") + private String remark; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; +} diff --git a/src/main/java/art/kexue/sxwz/entity/EduCollege.java b/src/main/java/art/kexue/sxwz/entity/EduCollege.java new file mode 100644 index 0000000..8cba949 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/EduCollege.java @@ -0,0 +1,41 @@ +package art.kexue.sxwz.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.Date; + +@Data +@Schema(name = "EduCollege", description = "学院实体") +public class EduCollege { + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学院名称") + private String name; + + @Schema(description = "管理员用户ID(关联sys_user.id)") + private Long adminUserId; + + @Schema(description = "教师数量") + private Integer teacherCount; + + @Schema(description = "学生数量") + private Integer studentCount; + + @Schema(description = "状态:0-停用,1-正常") + private Integer status; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "更新时间") + private Date updateTime; + + @Schema(description = "逻辑删除:0-未删除,1-已删除") + private Integer deleted; +} \ No newline at end of file diff --git a/src/main/java/art/kexue/sxwz/entity/EduCourse.java b/src/main/java/art/kexue/sxwz/entity/EduCourse.java new file mode 100644 index 0000000..a094737 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/EduCourse.java @@ -0,0 +1,46 @@ +package art.kexue.sxwz.entity; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class EduCourse { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校ID(数据隔离)") + private Long schoolId; + + @Schema(description = "课程名称") + private String name; + + @Schema(description = "课程封面") + private String cover; + + @Schema(description = "课程简介") + private String description; + + @Schema(description = "上课时间") + private String classTime; + + @Schema(description = "授课方式:1-线上,2-线下,3-混合") + private Integer teachingMethod; + + @Schema(description = "创建老师ID") + private Long teacherId; + + @Schema(description = "课程状态:1-进行中,2-已结课") + private Integer status; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "更新时间") + private Date updateTime; +} diff --git a/src/main/java/art/kexue/sxwz/entity/EduCourseStudent.java b/src/main/java/art/kexue/sxwz/entity/EduCourseStudent.java new file mode 100644 index 0000000..a5bdb06 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/EduCourseStudent.java @@ -0,0 +1,30 @@ +package art.kexue.sxwz.entity; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class EduCourseStudent { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校ID(数据隔离)") + private Long schoolId; + + @Schema(description = "课程ID") + private Long courseId; + + @Schema(description = "学生ID") + private Long studentId; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "加入时间") + private Date joinTime; + + @Schema(description = "是否被踢出:0-正常,1-已踢出") + private Integer isKicked; +} diff --git a/src/main/java/art/kexue/sxwz/entity/EduExam.java b/src/main/java/art/kexue/sxwz/entity/EduExam.java new file mode 100644 index 0000000..49dc1d1 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/EduExam.java @@ -0,0 +1,67 @@ +package art.kexue.sxwz.entity; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class EduExam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校ID(数据隔离)") + private Long schoolId; + + @Schema(description = "课程ID") + private Long courseId; + + @Schema(description = "考试名称") + private String name; + + @Schema(description = "考试要求") + private String requirement; + + @Schema(description = "考卷JSON") + private String questions; + + @Schema(description = "考试时长(分钟)") + private Integer duration; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "开始时间") + private Date startTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "截止时间") + private Date endTime; + + @Schema(description = "状态:1-草稿,2-已发布,3-已结束") + private Integer status; + + @Schema(description = "是否补考") + private Integer isMakeup; + + @Schema(description = "关联主考ID") + private Long parentExamId; + + @Schema(description = "是否允许重考") + private Integer allowRetake; + + @Schema(description = "总分") + private BigDecimal totalScore; + + @Schema(description = "及格分") + private BigDecimal passScore; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "更新时间") + private Date updateTime; +} diff --git a/src/main/java/art/kexue/sxwz/entity/EduExamPaper.java b/src/main/java/art/kexue/sxwz/entity/EduExamPaper.java new file mode 100644 index 0000000..f631efb --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/EduExamPaper.java @@ -0,0 +1,44 @@ +package art.kexue.sxwz.entity; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class EduExamPaper { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校ID(数据隔离)") + private Long schoolId; + + @Schema(description = "考试ID") + private Long examId; + + @Schema(description = "学生ID") + private Long studentId; + + @Schema(description = "答案JSON") + private String answers; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "提交时间") + private Date submitTime; + + @Schema(description = "状态:1-待阅卷,2-已阅卷") + private Integer status; + + @Schema(description = "分数") + private BigDecimal score; + + @Schema(description = "评语") + private String comment; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; +} diff --git a/src/main/java/art/kexue/sxwz/entity/EduExcellentWork.java b/src/main/java/art/kexue/sxwz/entity/EduExcellentWork.java new file mode 100644 index 0000000..890b9a4 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/EduExcellentWork.java @@ -0,0 +1,40 @@ +package art.kexue.sxwz.entity; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class EduExcellentWork { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校ID(数据隔离)") + private Long schoolId; + + @Schema(description = "作品类型:1-作业,2-考试") + private Integer workType; + + @Schema(description = "关联作业/考试ID") + private Long workId; + + @Schema(description = "关联提交ID") + private Long submitId; + + @Schema(description = "学生ID") + private Long studentId; + + @Schema(description = "分数") + private BigDecimal score; + + @Schema(description = "评语") + private String comment; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "标记时间") + private Date createTime; +} diff --git a/src/main/java/art/kexue/sxwz/entity/EduHomework.java b/src/main/java/art/kexue/sxwz/entity/EduHomework.java new file mode 100644 index 0000000..d73f72a --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/EduHomework.java @@ -0,0 +1,51 @@ +package art.kexue.sxwz.entity; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class EduHomework { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校ID(数据隔离)") + private Long schoolId; + + @Schema(description = "课程ID") + private Long courseId; + + @Schema(description = "作业名称") + private String name; + + @Schema(description = "作业要求") + private String requirement; + + @Schema(description = "题目JSON") + private String questions; + + @Schema(description = "是否允许迟交") + private Integer allowLate; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "开始时间") + private Date startTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "截止时间") + private Date endTime; + + @Schema(description = "状态:1-草稿,2-已发布") + private Integer status; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "更新时间") + private Date updateTime; +} diff --git a/src/main/java/art/kexue/sxwz/entity/EduHomeworkSubmit.java b/src/main/java/art/kexue/sxwz/entity/EduHomeworkSubmit.java new file mode 100644 index 0000000..8b632a7 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/EduHomeworkSubmit.java @@ -0,0 +1,60 @@ +package art.kexue.sxwz.entity; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class EduHomeworkSubmit { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校ID(数据隔离)") + private Long schoolId; + + @Schema(description = "作业ID") + private Long homeworkId; + + @Schema(description = "学生ID") + private Long studentId; + + @Schema(description = "答案JSON") + private String answers; + + @Schema(description = "答案(兼容字段)") + private String answer; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "提交时间") + private Date submitTime; + + @Schema(description = "是否迟交") + private Integer isLate; + + @Schema(description = "状态:1-待批改,2-已批改,3-已退回") + private Integer status; + + @Schema(description = "分数") + private BigDecimal score; + + @Schema(description = "评语") + private String comment; + + @Schema(description = "是否优秀") + private Integer isExcellent; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "重做截止时间") + private Date redoEndTime; + + @Schema(description = "重做次数") + private Integer redoCount; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; +} diff --git a/src/main/java/art/kexue/sxwz/entity/EduSchool.java b/src/main/java/art/kexue/sxwz/entity/EduSchool.java new file mode 100644 index 0000000..93ce90e --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/EduSchool.java @@ -0,0 +1,37 @@ +package art.kexue.sxwz.entity; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class EduSchool { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校名称") + private String schoolName; + + @Schema(description = "网址") + private String website; + + @Schema(description = "联系电话") + private String contactPhone; + + @Schema(description = "管理员用户ID(关联sys_user.id)") + private Long adminUserId; + + @Schema(description = "状态:0-禁用,1-启用") + private Integer status; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "更新时间") + private Date updateTime; +} diff --git a/src/main/java/art/kexue/sxwz/entity/EduStudent.java b/src/main/java/art/kexue/sxwz/entity/EduStudent.java new file mode 100644 index 0000000..d17b260 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/EduStudent.java @@ -0,0 +1,52 @@ +package art.kexue.sxwz.entity; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class EduStudent { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "用户ID(关联sys_user)") + private Long userId; + + @Schema(description = "学校ID") + private Long schoolId; + + @Schema(description = "学院ID") + private Long collegeId; + + @Schema(description = "专业ID") + private Long majorId; + + @Schema(description = "年级") + private String grade; + + @Schema(description = "班级") + private String className; + + @Schema(description = "学号") + private String studentNo; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "激活码") + private String activationCode; + + @Schema(description = "绑定状态:0-未绑定,1-已绑定") + private Integer bindingStatus; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "更新时间") + private Date updateTime; +} diff --git a/src/main/java/art/kexue/sxwz/entity/EduTeacher.java b/src/main/java/art/kexue/sxwz/entity/EduTeacher.java new file mode 100644 index 0000000..ea1972b --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/EduTeacher.java @@ -0,0 +1,46 @@ +package art.kexue.sxwz.entity; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class EduTeacher { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "用户ID(关联sys_user)") + private Long userId; + + @Schema(description = "学校ID") + private Long schoolId; + + @Schema(description = "学院ID") + private Long collegeId; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "教师编号") + private String teacherNo; + + @Schema(description = "职称") + private String title; + + @Schema(description = "激活码") + private String activationCode; + + @Schema(description = "绑定状态:0-未绑定,1-已绑定") + private Integer bindingStatus; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "更新时间") + private Date updateTime; +} diff --git a/src/main/java/art/kexue/sxwz/entity/EduWorkLike.java b/src/main/java/art/kexue/sxwz/entity/EduWorkLike.java new file mode 100644 index 0000000..0b5f25a --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/EduWorkLike.java @@ -0,0 +1,27 @@ +package art.kexue.sxwz.entity; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class EduWorkLike { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校ID(数据隔离)") + private Long schoolId; + + @Schema(description = "优秀作品ID") + private Long workId; + + @Schema(description = "点赞用户ID") + private Long userId; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "点赞时间") + private Date createTime; +} diff --git a/src/main/java/com/kexue/skills/entity/LogRecord.java b/src/main/java/art/kexue/sxwz/entity/LogRecord.java similarity index 98% rename from src/main/java/com/kexue/skills/entity/LogRecord.java rename to src/main/java/art/kexue/sxwz/entity/LogRecord.java index 01fea27..9a55e93 100644 --- a/src/main/java/com/kexue/skills/entity/LogRecord.java +++ b/src/main/java/art/kexue/sxwz/entity/LogRecord.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity; +package art.kexue.sxwz.entity; import lombok.Data; @@ -118,3 +118,4 @@ public class LogRecord implements Serializable { private Integer status; } } + diff --git a/src/main/java/com/kexue/skills/entity/ModelPrice.java b/src/main/java/art/kexue/sxwz/entity/ModelPrice.java similarity index 95% rename from src/main/java/com/kexue/skills/entity/ModelPrice.java rename to src/main/java/art/kexue/sxwz/entity/ModelPrice.java index ec2bd12..c4ed797 100644 --- a/src/main/java/com/kexue/skills/entity/ModelPrice.java +++ b/src/main/java/art/kexue/sxwz/entity/ModelPrice.java @@ -1,10 +1,10 @@ -package com.kexue.skills.entity; +package art.kexue.sxwz.entity; import java.math.BigDecimal; import java.util.Date; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; +import art.kexue.sxwz.entity.base.BaseEntity; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -65,3 +65,4 @@ public class ModelPrice extends BaseEntity implements Serializable { private Date updatedTime; } + diff --git a/src/main/java/com/kexue/skills/entity/PackageConfig.java b/src/main/java/art/kexue/sxwz/entity/PackageConfig.java similarity index 91% rename from src/main/java/com/kexue/skills/entity/PackageConfig.java rename to src/main/java/art/kexue/sxwz/entity/PackageConfig.java index 8707a35..aac0e27 100644 --- a/src/main/java/com/kexue/skills/entity/PackageConfig.java +++ b/src/main/java/art/kexue/sxwz/entity/PackageConfig.java @@ -1,7 +1,7 @@ -package com.kexue.skills.entity; +package art.kexue.sxwz.entity; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; +import art.kexue.sxwz.entity.base.BaseEntity; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -41,3 +41,4 @@ public class PackageConfig extends BaseEntity implements Serializable { private Date updateTime; } + diff --git a/src/main/java/com/kexue/skills/entity/PaymentOrder.java b/src/main/java/art/kexue/sxwz/entity/PaymentOrder.java similarity index 97% rename from src/main/java/com/kexue/skills/entity/PaymentOrder.java rename to src/main/java/art/kexue/sxwz/entity/PaymentOrder.java index b95ffdf..348eb8d 100644 --- a/src/main/java/com/kexue/skills/entity/PaymentOrder.java +++ b/src/main/java/art/kexue/sxwz/entity/PaymentOrder.java @@ -1,10 +1,10 @@ -package com.kexue.skills.entity; +package art.kexue.sxwz.entity; import java.math.BigDecimal; import java.util.Date; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; +import art.kexue.sxwz.entity.base.BaseEntity; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -96,4 +96,4 @@ public class PaymentOrder extends BaseEntity implements Serializable { @Schema(description ="更新人") private String updateBy; -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/entity/Supplier.java b/src/main/java/art/kexue/sxwz/entity/Supplier.java similarity index 94% rename from src/main/java/com/kexue/skills/entity/Supplier.java rename to src/main/java/art/kexue/sxwz/entity/Supplier.java index 9be09a2..f3b7977 100644 --- a/src/main/java/com/kexue/skills/entity/Supplier.java +++ b/src/main/java/art/kexue/sxwz/entity/Supplier.java @@ -1,9 +1,9 @@ -package com.kexue.skills.entity; +package art.kexue.sxwz.entity; import java.util.Date; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; +import art.kexue.sxwz.entity.base.BaseEntity; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -56,4 +56,4 @@ public class Supplier extends BaseEntity implements Serializable { @Schema(description ="更新人") private String updateBy; -} \ No newline at end of file +} diff --git a/src/main/java/art/kexue/sxwz/entity/SysDept.java b/src/main/java/art/kexue/sxwz/entity/SysDept.java new file mode 100644 index 0000000..b348034 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/SysDept.java @@ -0,0 +1,30 @@ +package art.kexue.sxwz.entity; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +@Schema(description = "部门实体") +public class SysDept { + + @Schema(description = "部门ID") + private Long id; + + @Schema(description = "部门名称") + private String name; + + @Schema(description = "父部门ID") + private Long parentId; + + @Schema(description = "祖级列表 (如:0,1,5)") + private String ancestors; + + @Schema(description = "显示顺序") + private Integer orderNum; + + @Schema(description = "层级 1:学校 2:学院 3:专业 4:班级") + private Integer level; + + @Schema(description = "状态 0正常 1停用") + private String status; +} diff --git a/src/main/java/com/kexue/skills/entity/SysDict.java b/src/main/java/art/kexue/sxwz/entity/SysDict.java similarity index 92% rename from src/main/java/com/kexue/skills/entity/SysDict.java rename to src/main/java/art/kexue/sxwz/entity/SysDict.java index 8554850..49325b0 100644 --- a/src/main/java/com/kexue/skills/entity/SysDict.java +++ b/src/main/java/art/kexue/sxwz/entity/SysDict.java @@ -1,10 +1,9 @@ -package com.kexue.skills.entity; +package art.kexue.sxwz.entity; import java.util.Date; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseEntity; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -58,3 +57,4 @@ public class SysDict extends BaseEntity implements Serializable { private String updateBy; } + diff --git a/src/main/java/com/kexue/skills/entity/SysLog.java b/src/main/java/art/kexue/sxwz/entity/SysLog.java similarity index 94% rename from src/main/java/com/kexue/skills/entity/SysLog.java rename to src/main/java/art/kexue/sxwz/entity/SysLog.java index c47f3a2..8a19a6a 100644 --- a/src/main/java/com/kexue/skills/entity/SysLog.java +++ b/src/main/java/art/kexue/sxwz/entity/SysLog.java @@ -1,9 +1,9 @@ -package com.kexue.skills.entity; +package art.kexue.sxwz.entity; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseEntity; + import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; @@ -94,3 +94,4 @@ public class SysLog extends BaseEntity implements Serializable { private String updateBy; } + diff --git a/src/main/java/com/kexue/skills/entity/SysMenu.java b/src/main/java/art/kexue/sxwz/entity/SysMenu.java similarity index 92% rename from src/main/java/com/kexue/skills/entity/SysMenu.java rename to src/main/java/art/kexue/sxwz/entity/SysMenu.java index 4fb711b..c8d972b 100644 --- a/src/main/java/com/kexue/skills/entity/SysMenu.java +++ b/src/main/java/art/kexue/sxwz/entity/SysMenu.java @@ -1,9 +1,9 @@ -package com.kexue.skills.entity; +package art.kexue.sxwz.entity; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseEntity; + import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; @@ -61,3 +61,4 @@ public class SysMenu extends BaseEntity implements Serializable { private String updateBy; } + diff --git a/src/main/java/art/kexue/sxwz/entity/SysNotification.java b/src/main/java/art/kexue/sxwz/entity/SysNotification.java new file mode 100644 index 0000000..c05d379 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/SysNotification.java @@ -0,0 +1,45 @@ +package art.kexue.sxwz.entity; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class SysNotification { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校ID(数据隔离)") + private Long schoolId; + + @Schema(description = "用户ID") + private Long userId; + + @Schema(description = "通知标题") + private String title; + + @Schema(description = "通知内容") + private String content; + + @Schema(description = "通知类型:1-系统通知,2-作业通知,3-考试通知,4-考勤通知") + private Integer type; + + @Schema(description = "是否已读:0-未读,1-已读") + private Integer isRead; + + @Schema(description = "发送者用户ID") + private Long senderId; + + @Schema(description = "发送者姓名") + private String senderName; + + @Schema(description = "目标类型:1-单个用户,2-角色,3-课程") + private Integer targetType; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; +} diff --git a/src/main/java/com/kexue/skills/entity/SysRole.java b/src/main/java/art/kexue/sxwz/entity/SysRole.java similarity index 90% rename from src/main/java/com/kexue/skills/entity/SysRole.java rename to src/main/java/art/kexue/sxwz/entity/SysRole.java index 8f7c087..22474aa 100644 --- a/src/main/java/com/kexue/skills/entity/SysRole.java +++ b/src/main/java/art/kexue/sxwz/entity/SysRole.java @@ -1,10 +1,9 @@ -package com.kexue.skills.entity; +package art.kexue.sxwz.entity; import java.util.Date; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseEntity; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -49,3 +48,4 @@ public class SysRole extends BaseEntity implements Serializable { private String updateBy; } + diff --git a/src/main/java/art/kexue/sxwz/entity/SysRolePermission.java b/src/main/java/art/kexue/sxwz/entity/SysRolePermission.java new file mode 100644 index 0000000..da39cf5 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/SysRolePermission.java @@ -0,0 +1,37 @@ +package art.kexue.sxwz.entity; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.Date; + +@Data +public class SysRolePermission { + + @Schema(description = "权限主键ID") + private Long permissionId; + + @Schema(description = "角色主键ID") + private Long roleId; + + @Schema(description = "角色标识码") + private String roleCode; + + @Schema(description = "接口/按钮权限码") + private String permissionCode; + + @Schema(description = "权限名称") + private String permissionName; + + @Schema(description = "模块名称") + private String modelName; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "更新时间") + private Date updateTime; +} diff --git a/src/main/java/com/kexue/skills/entity/SysUser.java b/src/main/java/art/kexue/sxwz/entity/SysUser.java similarity index 79% rename from src/main/java/com/kexue/skills/entity/SysUser.java rename to src/main/java/art/kexue/sxwz/entity/SysUser.java index 2ea5d7e..92328ff 100644 --- a/src/main/java/com/kexue/skills/entity/SysUser.java +++ b/src/main/java/art/kexue/sxwz/entity/SysUser.java @@ -1,10 +1,9 @@ -package com.kexue.skills.entity; +package art.kexue.sxwz.entity; import java.util.Date; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseEntity; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -78,4 +77,20 @@ public class SysUser extends BaseEntity implements Serializable { @Schema(description ="用户头像") private String userIcon = "defaultUserIcon.png"; + @Schema(description ="微信ID") + private String wxid; + + @Schema(description ="角色类型:1-超级管理员,2-学校管理员,3-学院管理员,4-教师,5-学生") + private Integer roleType; + + @Schema(description ="学校ID") + private Long schoolId; + + @Schema(description ="学生扩展信息") + private EduStudent eduStudent; + + @Schema(description ="教师扩展信息") + private EduTeacher eduTeacher; + } + diff --git a/src/main/java/art/kexue/sxwz/entity/SysUserRole.java b/src/main/java/art/kexue/sxwz/entity/SysUserRole.java new file mode 100644 index 0000000..859ba2d --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/SysUserRole.java @@ -0,0 +1,24 @@ +package art.kexue.sxwz.entity; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class SysUserRole { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "用户ID") + private Long userId; + + @Schema(description = "角色编码:student-学生,teacher-老师,admin-管理员") + private String roleCode; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Schema(description = "创建时间") + private Date createTime; +} diff --git a/src/main/java/com/kexue/skills/entity/base/BaseEntity.java b/src/main/java/art/kexue/sxwz/entity/base/BaseEntity.java similarity index 68% rename from src/main/java/com/kexue/skills/entity/base/BaseEntity.java rename to src/main/java/art/kexue/sxwz/entity/base/BaseEntity.java index 5fbbe8f..ea7b495 100644 --- a/src/main/java/com/kexue/skills/entity/base/BaseEntity.java +++ b/src/main/java/art/kexue/sxwz/entity/base/BaseEntity.java @@ -1,6 +1,7 @@ -package com.kexue.skills.entity.base; +package art.kexue.sxwz.entity.base; import java.io.Serializable; public class BaseEntity implements Serializable { } + diff --git a/src/main/java/com/kexue/skills/entity/base/BaseQueryDto.java b/src/main/java/art/kexue/sxwz/entity/base/BaseQueryDto.java similarity index 94% rename from src/main/java/com/kexue/skills/entity/base/BaseQueryDto.java rename to src/main/java/art/kexue/sxwz/entity/base/BaseQueryDto.java index cb93078..f26f232 100644 --- a/src/main/java/com/kexue/skills/entity/base/BaseQueryDto.java +++ b/src/main/java/art/kexue/sxwz/entity/base/BaseQueryDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.base; +package art.kexue.sxwz.entity.base; import io.swagger.annotations.ApiModel; import io.swagger.v3.oas.annotations.media.Schema; @@ -26,3 +26,4 @@ public class BaseQueryDto implements Serializable { private Boolean sortDesc; } + diff --git a/src/main/java/com/kexue/skills/entity/base/IdDto.java b/src/main/java/art/kexue/sxwz/entity/base/IdDto.java similarity index 88% rename from src/main/java/com/kexue/skills/entity/base/IdDto.java rename to src/main/java/art/kexue/sxwz/entity/base/IdDto.java index b50f9b8..71e8b25 100644 --- a/src/main/java/com/kexue/skills/entity/base/IdDto.java +++ b/src/main/java/art/kexue/sxwz/entity/base/IdDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.base; +package art.kexue.sxwz.entity.base; import io.swagger.annotations.ApiModel; import io.swagger.v3.oas.annotations.media.Schema; @@ -16,3 +16,4 @@ public class IdDto { @Schema(description ="主键ID") private Long id; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/AccountDto.java b/src/main/java/art/kexue/sxwz/entity/dto/AccountDto.java similarity index 77% rename from src/main/java/com/kexue/skills/entity/dto/AccountDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/AccountDto.java index 893a43d..e07d38d 100644 --- a/src/main/java/com/kexue/skills/entity/dto/AccountDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/AccountDto.java @@ -1,6 +1,6 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; /** @@ -20,4 +20,4 @@ public class AccountDto extends BaseQueryDto { private Integer deleteFlag; -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/entity/dto/AccountFrozenDto.java b/src/main/java/art/kexue/sxwz/entity/dto/AccountFrozenDto.java similarity index 96% rename from src/main/java/com/kexue/skills/entity/dto/AccountFrozenDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/AccountFrozenDto.java index 51d6acd..718b743 100644 --- a/src/main/java/com/kexue/skills/entity/dto/AccountFrozenDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/AccountFrozenDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import java.math.BigDecimal; import java.util.Date; @@ -43,3 +43,4 @@ public class AccountFrozenDto { private Date expireAt; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/AccountReleaseDto.java b/src/main/java/art/kexue/sxwz/entity/dto/AccountReleaseDto.java similarity index 95% rename from src/main/java/com/kexue/skills/entity/dto/AccountReleaseDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/AccountReleaseDto.java index d573363..27163b7 100644 --- a/src/main/java/com/kexue/skills/entity/dto/AccountReleaseDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/AccountReleaseDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import java.math.BigDecimal; @@ -33,3 +33,4 @@ public class AccountReleaseDto { private String finalizeReason; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/AccountTransactionDto.java b/src/main/java/art/kexue/sxwz/entity/dto/AccountTransactionDto.java similarity index 87% rename from src/main/java/com/kexue/skills/entity/dto/AccountTransactionDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/AccountTransactionDto.java index 9e5ed25..37d87f5 100644 --- a/src/main/java/com/kexue/skills/entity/dto/AccountTransactionDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/AccountTransactionDto.java @@ -1,6 +1,6 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; import java.util.Date; @@ -38,4 +38,4 @@ public class AccountTransactionDto extends BaseQueryDto { private Date createTimeEnd; -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/entity/dto/CmsCategoryDto.java b/src/main/java/art/kexue/sxwz/entity/dto/CmsCategoryDto.java similarity index 82% rename from src/main/java/com/kexue/skills/entity/dto/CmsCategoryDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/CmsCategoryDto.java index 1386e53..8024ca2 100644 --- a/src/main/java/com/kexue/skills/entity/dto/CmsCategoryDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/CmsCategoryDto.java @@ -1,6 +1,6 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; /** @@ -26,4 +26,4 @@ public class CmsCategoryDto extends BaseQueryDto { private Integer deleteFlag; -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/entity/dto/CmsCategoryTagDto.java b/src/main/java/art/kexue/sxwz/entity/dto/CmsCategoryTagDto.java similarity index 85% rename from src/main/java/com/kexue/skills/entity/dto/CmsCategoryTagDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/CmsCategoryTagDto.java index 1a89c05..1c68e62 100644 --- a/src/main/java/com/kexue/skills/entity/dto/CmsCategoryTagDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/CmsCategoryTagDto.java @@ -1,6 +1,6 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -26,3 +26,4 @@ public class CmsCategoryTagDto extends BaseQueryDto { private Integer deleteFlag; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/CmsContentDto.java b/src/main/java/art/kexue/sxwz/entity/dto/CmsContentDto.java similarity index 93% rename from src/main/java/com/kexue/skills/entity/dto/CmsContentDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/CmsContentDto.java index faa0431..86eff0c 100644 --- a/src/main/java/com/kexue/skills/entity/dto/CmsContentDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/CmsContentDto.java @@ -1,6 +1,6 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; import java.util.List; @@ -71,3 +71,4 @@ public class CmsContentDto extends BaseQueryDto { private String icon; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/CmsTagDto.java b/src/main/java/art/kexue/sxwz/entity/dto/CmsTagDto.java similarity index 80% rename from src/main/java/com/kexue/skills/entity/dto/CmsTagDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/CmsTagDto.java index 0f672cf..80f9a9c 100644 --- a/src/main/java/com/kexue/skills/entity/dto/CmsTagDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/CmsTagDto.java @@ -1,6 +1,6 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; /** @@ -24,4 +24,4 @@ public class CmsTagDto extends BaseQueryDto { private Integer deleteFlag; -} \ No newline at end of file +} diff --git a/src/main/java/art/kexue/sxwz/entity/dto/ComputeQuotaDto.java b/src/main/java/art/kexue/sxwz/entity/dto/ComputeQuotaDto.java new file mode 100644 index 0000000..c4d0e3c --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/dto/ComputeQuotaDto.java @@ -0,0 +1,23 @@ +package art.kexue.sxwz.entity.dto; + +import art.kexue.sxwz.entity.base.BaseQueryDto; +import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +@ApiModel +public class ComputeQuotaDto extends BaseQueryDto { + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "分配对象类型:1-学校,2-学院") + private Integer subjectType; + + @Schema(description = "关联的学校/学院ID") + private Long subjectId; + + @Schema(description = "学校/学院名称") + private String subjectName; +} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/entity/dto/ConsumptionGroupedDto.java b/src/main/java/art/kexue/sxwz/entity/dto/ConsumptionGroupedDto.java similarity index 98% rename from src/main/java/com/kexue/skills/entity/dto/ConsumptionGroupedDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/ConsumptionGroupedDto.java index 7caa7f4..7860a55 100644 --- a/src/main/java/com/kexue/skills/entity/dto/ConsumptionGroupedDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/ConsumptionGroupedDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import java.io.Serializable; import java.math.BigDecimal; @@ -99,3 +99,4 @@ public class ConsumptionGroupedDto implements Serializable { private Integer deleteFlag; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/ContentPurchaseDto.java b/src/main/java/art/kexue/sxwz/entity/dto/ContentPurchaseDto.java similarity index 95% rename from src/main/java/com/kexue/skills/entity/dto/ContentPurchaseDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/ContentPurchaseDto.java index dffefe7..db4dbbd 100644 --- a/src/main/java/com/kexue/skills/entity/dto/ContentPurchaseDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/ContentPurchaseDto.java @@ -1,6 +1,6 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -65,4 +65,4 @@ public class ContentPurchaseDto extends BaseQueryDto { @Schema(description ="是否删除 :0 未删除,1已删除") private Integer deleteFlag; -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/entity/dto/CustomerDto.java b/src/main/java/art/kexue/sxwz/entity/dto/CustomerDto.java similarity index 82% rename from src/main/java/com/kexue/skills/entity/dto/CustomerDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/CustomerDto.java index fb05dd6..fa22a8c 100644 --- a/src/main/java/com/kexue/skills/entity/dto/CustomerDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/CustomerDto.java @@ -1,6 +1,6 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; /** @@ -26,4 +26,4 @@ public class CustomerDto extends BaseQueryDto { private Integer deleteFlag; -} \ No newline at end of file +} diff --git a/src/main/java/art/kexue/sxwz/entity/dto/EduAttendanceDto.java b/src/main/java/art/kexue/sxwz/entity/dto/EduAttendanceDto.java new file mode 100644 index 0000000..1476714 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/dto/EduAttendanceDto.java @@ -0,0 +1,29 @@ +package art.kexue.sxwz.entity.dto; + +import art.kexue.sxwz.entity.base.BaseQueryDto; +import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel +public class EduAttendanceDto extends BaseQueryDto implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校ID") + private Long schoolId; + + @Schema(description = "课程ID") + private Long courseId; + + @Schema(description = "教师ID") + private Long teacherId; + + @Schema(description = "状态") + private Integer status; +} diff --git a/src/main/java/art/kexue/sxwz/entity/dto/EduCollegeDto.java b/src/main/java/art/kexue/sxwz/entity/dto/EduCollegeDto.java new file mode 100644 index 0000000..1f9ef28 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/dto/EduCollegeDto.java @@ -0,0 +1,20 @@ +package art.kexue.sxwz.entity.dto; + +import art.kexue.sxwz.entity.base.BaseQueryDto; +import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +@ApiModel +public class EduCollegeDto extends BaseQueryDto { + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学院名称") + private String name; + + @Schema(description = "状态:0-停用,1-正常") + private Integer status; +} \ No newline at end of file diff --git a/src/main/java/art/kexue/sxwz/entity/dto/EduCourseDto.java b/src/main/java/art/kexue/sxwz/entity/dto/EduCourseDto.java new file mode 100644 index 0000000..b7a01cf --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/dto/EduCourseDto.java @@ -0,0 +1,35 @@ +package art.kexue.sxwz.entity.dto; + +import art.kexue.sxwz.entity.base.BaseQueryDto; +import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel +public class EduCourseDto extends BaseQueryDto implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校ID") + private Long schoolId; + + @Schema(description = "学院ID") + private Long collegeId; + + @Schema(description = "教师ID") + private Long teacherId; + + @Schema(description = "课程名称") + private String courseName; + + @Schema(description = "课程代码") + private String courseCode; + + @Schema(description = "状态") + private Integer status; +} diff --git a/src/main/java/art/kexue/sxwz/entity/dto/EduExamDto.java b/src/main/java/art/kexue/sxwz/entity/dto/EduExamDto.java new file mode 100644 index 0000000..5d461cb --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/dto/EduExamDto.java @@ -0,0 +1,32 @@ +package art.kexue.sxwz.entity.dto; + +import art.kexue.sxwz.entity.base.BaseQueryDto; +import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel +public class EduExamDto extends BaseQueryDto implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "课程ID") + private Long courseId; + + @Schema(description = "教师ID") + private Long teacherId; + + @Schema(description = "学校ID") + private Long schoolId; + + @Schema(description = "考试类型(正常/补考)") + private Integer examType; + + @Schema(description = "状态") + private Integer status; +} diff --git a/src/main/java/art/kexue/sxwz/entity/dto/EduExcellentWorkDto.java b/src/main/java/art/kexue/sxwz/entity/dto/EduExcellentWorkDto.java new file mode 100644 index 0000000..178875c --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/dto/EduExcellentWorkDto.java @@ -0,0 +1,32 @@ +package art.kexue.sxwz.entity.dto; + +import art.kexue.sxwz.entity.base.BaseQueryDto; +import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel +public class EduExcellentWorkDto extends BaseQueryDto implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校ID") + private Long schoolId; + + @Schema(description = "学生ID") + private Long studentId; + + @Schema(description = "作品类型") + private Integer workType; + + @Schema(description = "提交ID") + private Long submitId; + + @Schema(description = "状态") + private Integer status; +} diff --git a/src/main/java/art/kexue/sxwz/entity/dto/EduHomeworkDto.java b/src/main/java/art/kexue/sxwz/entity/dto/EduHomeworkDto.java new file mode 100644 index 0000000..4f81193 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/dto/EduHomeworkDto.java @@ -0,0 +1,29 @@ +package art.kexue.sxwz.entity.dto; + +import art.kexue.sxwz.entity.base.BaseQueryDto; +import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel +public class EduHomeworkDto extends BaseQueryDto implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "课程ID") + private Long courseId; + + @Schema(description = "教师ID") + private Long teacherId; + + @Schema(description = "作业标题") + private String title; + + @Schema(description = "状态") + private Integer status; +} diff --git a/src/main/java/art/kexue/sxwz/entity/dto/EduSchoolDto.java b/src/main/java/art/kexue/sxwz/entity/dto/EduSchoolDto.java new file mode 100644 index 0000000..c29656d --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/dto/EduSchoolDto.java @@ -0,0 +1,29 @@ +package art.kexue.sxwz.entity.dto; + +import art.kexue.sxwz.entity.base.BaseQueryDto; +import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel +public class EduSchoolDto extends BaseQueryDto implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "学校名称") + private String schoolName; + + @Schema(description = "网址") + private String website; + + @Schema(description = "联系电话") + private String contactPhone; + + @Schema(description = "状态:0-禁用,1-启用") + private Integer status; +} diff --git a/src/main/java/art/kexue/sxwz/entity/dto/EduStudentDto.java b/src/main/java/art/kexue/sxwz/entity/dto/EduStudentDto.java new file mode 100644 index 0000000..d53f6ac --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/dto/EduStudentDto.java @@ -0,0 +1,44 @@ +package art.kexue.sxwz.entity.dto; + +import art.kexue.sxwz.entity.base.BaseQueryDto; +import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel +public class EduStudentDto extends BaseQueryDto implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "用户ID") + private Long userId; + + @Schema(description = "学校ID") + private Long schoolId; + + @Schema(description = "学院ID") + private Long collegeId; + + @Schema(description = "专业ID") + private Long majorId; + + @Schema(description = "年级") + private String grade; + + @Schema(description = "班级") + private String className; + + @Schema(description = "学号") + private String studentNo; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "绑定状态") + private Integer bindingStatus; +} diff --git a/src/main/java/art/kexue/sxwz/entity/dto/EduTeacherDto.java b/src/main/java/art/kexue/sxwz/entity/dto/EduTeacherDto.java new file mode 100644 index 0000000..3d6e239 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/dto/EduTeacherDto.java @@ -0,0 +1,35 @@ +package art.kexue.sxwz.entity.dto; + +import art.kexue.sxwz.entity.base.BaseQueryDto; +import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel +public class EduTeacherDto extends BaseQueryDto implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + private Long id; + + @Schema(description = "用户ID") + private Long userId; + + @Schema(description = "学校ID") + private Long schoolId; + + @Schema(description = "学院ID") + private Long collegeId; + + @Schema(description = "教师姓名") + private String realName; + + @Schema(description = "工号") + private String teacherNo; + + @Schema(description = "绑定状态") + private Integer bindingStatus; +} diff --git a/src/main/java/com/kexue/skills/entity/dto/GiftBalanceDto.java b/src/main/java/art/kexue/sxwz/entity/dto/GiftBalanceDto.java similarity index 97% rename from src/main/java/com/kexue/skills/entity/dto/GiftBalanceDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/GiftBalanceDto.java index b7903f1..b06dbc8 100644 --- a/src/main/java/com/kexue/skills/entity/dto/GiftBalanceDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/GiftBalanceDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import java.math.BigDecimal; @@ -63,4 +63,4 @@ public class GiftBalanceDto { public void setRemark(String remark) { this.remark = remark; } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/entity/dto/ModelPriceDto.java b/src/main/java/art/kexue/sxwz/entity/dto/ModelPriceDto.java similarity index 92% rename from src/main/java/com/kexue/skills/entity/dto/ModelPriceDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/ModelPriceDto.java index 40e40ff..06c0dc3 100644 --- a/src/main/java/com/kexue/skills/entity/dto/ModelPriceDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/ModelPriceDto.java @@ -1,6 +1,6 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -51,3 +51,4 @@ public class ModelPriceDto extends BaseQueryDto { private Date updatedTime; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/OrderStatusDto.java b/src/main/java/art/kexue/sxwz/entity/dto/OrderStatusDto.java similarity index 96% rename from src/main/java/com/kexue/skills/entity/dto/OrderStatusDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/OrderStatusDto.java index 6d11ea4..242a39c 100644 --- a/src/main/java/com/kexue/skills/entity/dto/OrderStatusDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/OrderStatusDto.java @@ -1,6 +1,6 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.PaymentOrder; +import art.kexue.sxwz.entity.PaymentOrder; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -74,4 +74,4 @@ public class OrderStatusDto { default: return "未知状态"; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/entity/dto/OrderStatusQueryDto.java b/src/main/java/art/kexue/sxwz/entity/dto/OrderStatusQueryDto.java similarity index 88% rename from src/main/java/com/kexue/skills/entity/dto/OrderStatusQueryDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/OrderStatusQueryDto.java index 5de6668..ec77808 100644 --- a/src/main/java/com/kexue/skills/entity/dto/OrderStatusQueryDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/OrderStatusQueryDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -15,4 +15,4 @@ public class OrderStatusQueryDto { @Schema(description = "订单号") private String orderNo; -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/entity/dto/PackageConfigDto.java b/src/main/java/art/kexue/sxwz/entity/dto/PackageConfigDto.java similarity index 81% rename from src/main/java/com/kexue/skills/entity/dto/PackageConfigDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/PackageConfigDto.java index df97e87..eb31ef2 100644 --- a/src/main/java/com/kexue/skills/entity/dto/PackageConfigDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/PackageConfigDto.java @@ -1,6 +1,6 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; import java.math.BigDecimal; @@ -25,3 +25,4 @@ public class PackageConfigDto extends BaseQueryDto { private BigDecimal giftAmount; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/PaymentOrderDto.java b/src/main/java/art/kexue/sxwz/entity/dto/PaymentOrderDto.java similarity index 80% rename from src/main/java/com/kexue/skills/entity/dto/PaymentOrderDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/PaymentOrderDto.java index dcf74e1..9b47819 100644 --- a/src/main/java/com/kexue/skills/entity/dto/PaymentOrderDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/PaymentOrderDto.java @@ -1,8 +1,7 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; -import org.checkerframework.checker.formatter.qual.Format; import java.util.Date; @@ -39,4 +38,4 @@ public class PaymentOrderDto extends BaseQueryDto { private Date createTimeEnd; -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/entity/dto/QueryContentDto.java b/src/main/java/art/kexue/sxwz/entity/dto/QueryContentDto.java similarity index 68% rename from src/main/java/com/kexue/skills/entity/dto/QueryContentDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/QueryContentDto.java index 2a8e093..2eada90 100644 --- a/src/main/java/com/kexue/skills/entity/dto/QueryContentDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/QueryContentDto.java @@ -1,10 +1,8 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; -import java.util.List; - /** * (CmsContent)查询DTO类 * @@ -16,3 +14,4 @@ public class QueryContentDto extends BaseQueryDto { private Long contentId; private Integer languageType; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/SessionDto.java b/src/main/java/art/kexue/sxwz/entity/dto/SessionDto.java similarity index 89% rename from src/main/java/com/kexue/skills/entity/dto/SessionDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/SessionDto.java index 9052d7b..f8c145a 100644 --- a/src/main/java/com/kexue/skills/entity/dto/SessionDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/SessionDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -17,3 +17,4 @@ public class SessionDto { @Schema(description = "是否为新会话") private boolean isNew; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/SkillPackageInfoDto.java b/src/main/java/art/kexue/sxwz/entity/dto/SkillPackageInfoDto.java similarity index 95% rename from src/main/java/com/kexue/skills/entity/dto/SkillPackageInfoDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/SkillPackageInfoDto.java index d7f5f6e..61661cb 100644 --- a/src/main/java/com/kexue/skills/entity/dto/SkillPackageInfoDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/SkillPackageInfoDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import lombok.Data; @@ -51,3 +51,4 @@ public class SkillPackageInfoDto implements Serializable { */ private List structure; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/SkillStructureNodeDto.java b/src/main/java/art/kexue/sxwz/entity/dto/SkillStructureNodeDto.java similarity index 95% rename from src/main/java/com/kexue/skills/entity/dto/SkillStructureNodeDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/SkillStructureNodeDto.java index ce54669..00f797f 100644 --- a/src/main/java/com/kexue/skills/entity/dto/SkillStructureNodeDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/SkillStructureNodeDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import lombok.Data; @@ -51,3 +51,4 @@ public class SkillStructureNodeDto implements Serializable { */ private String content; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/SupplierDto.java b/src/main/java/art/kexue/sxwz/entity/dto/SupplierDto.java similarity index 82% rename from src/main/java/com/kexue/skills/entity/dto/SupplierDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/SupplierDto.java index fbb4cf4..bf2b889 100644 --- a/src/main/java/com/kexue/skills/entity/dto/SupplierDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/SupplierDto.java @@ -1,6 +1,6 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; /** @@ -26,4 +26,4 @@ public class SupplierDto extends BaseQueryDto { private Integer deleteFlag; -} \ No newline at end of file +} diff --git a/src/main/java/art/kexue/sxwz/entity/dto/SysDeptDto.java b/src/main/java/art/kexue/sxwz/entity/dto/SysDeptDto.java new file mode 100644 index 0000000..1e4e197 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/dto/SysDeptDto.java @@ -0,0 +1,27 @@ +package art.kexue.sxwz.entity.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +@Schema(description = "部门查询条件") +public class SysDeptDto { + + @Schema(description = "部门名称") + private String name; + + @Schema(description = "父部门ID") + private Long parentId; + + @Schema(description = "层级") + private Integer level; + + @Schema(description = "状态") + private String status; + + @Schema(description = "页码") + private Integer pageNum = 1; + + @Schema(description = "每页条数") + private Integer pageSize = 10; +} diff --git a/src/main/java/com/kexue/skills/entity/dto/SysDictDto.java b/src/main/java/art/kexue/sxwz/entity/dto/SysDictDto.java similarity index 93% rename from src/main/java/com/kexue/skills/entity/dto/SysDictDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/SysDictDto.java index ae5d86b..a4233aa 100644 --- a/src/main/java/com/kexue/skills/entity/dto/SysDictDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/SysDictDto.java @@ -1,9 +1,9 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import java.util.Date; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; @@ -47,3 +47,4 @@ public class SysDictDto extends BaseQueryDto implements Serializable { private Date createTime; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/SysLogDto.java b/src/main/java/art/kexue/sxwz/entity/dto/SysLogDto.java similarity index 92% rename from src/main/java/com/kexue/skills/entity/dto/SysLogDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/SysLogDto.java index 9925a03..d33d733 100644 --- a/src/main/java/com/kexue/skills/entity/dto/SysLogDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/SysLogDto.java @@ -1,9 +1,9 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import java.io.Serializable; import java.util.Date; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; @@ -45,3 +45,4 @@ public class SysLogDto extends BaseQueryDto implements Serializable { private Date endTime; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/SysMenuDto.java b/src/main/java/art/kexue/sxwz/entity/dto/SysMenuDto.java similarity index 88% rename from src/main/java/com/kexue/skills/entity/dto/SysMenuDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/SysMenuDto.java index 8524221..b168f05 100644 --- a/src/main/java/com/kexue/skills/entity/dto/SysMenuDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/SysMenuDto.java @@ -1,10 +1,9 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; -import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.v3.oas.annotations.media.Schema; @@ -48,3 +47,4 @@ public class SysMenuDto extends BaseQueryDto implements Serializable { private Object deleteFlag; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/SysRoleDto.java b/src/main/java/art/kexue/sxwz/entity/dto/SysRoleDto.java similarity index 91% rename from src/main/java/com/kexue/skills/entity/dto/SysRoleDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/SysRoleDto.java index 7828bdb..0ed1039 100644 --- a/src/main/java/com/kexue/skills/entity/dto/SysRoleDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/SysRoleDto.java @@ -1,9 +1,9 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import java.util.Date; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; @@ -41,3 +41,4 @@ public class SysRoleDto extends BaseQueryDto implements Serializable { private String deleteFlag; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/SysUserDto.java b/src/main/java/art/kexue/sxwz/entity/dto/SysUserDto.java similarity index 81% rename from src/main/java/com/kexue/skills/entity/dto/SysUserDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/SysUserDto.java index 66a714a..c5fe1ab 100644 --- a/src/main/java/com/kexue/skills/entity/dto/SysUserDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/SysUserDto.java @@ -1,9 +1,9 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import java.util.Date; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; @@ -54,5 +54,12 @@ public class SysUserDto extends BaseQueryDto implements Serializable { @Schema(description ="是否删除 :0 未删除,1已删除") private Integer deleteFlag; + + @Schema(description ="角色类型:1-超级管理员,2-学校管理员,3-学院管理员,4-教师,5-学生") + private Integer roleType; + + @Schema(description ="学校ID") + private Long schoolId; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/SysUserRoleDto.java b/src/main/java/art/kexue/sxwz/entity/dto/SysUserRoleDto.java similarity index 79% rename from src/main/java/com/kexue/skills/entity/dto/SysUserRoleDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/SysUserRoleDto.java index 5e6c793..97268e4 100644 --- a/src/main/java/com/kexue/skills/entity/dto/SysUserRoleDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/SysUserRoleDto.java @@ -1,10 +1,9 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import java.io.Serializable; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import lombok.Data; -import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.v3.oas.annotations.media.Schema; @@ -27,3 +26,4 @@ public class SysUserRoleDto extends BaseQueryDto implements Serializable { private Long userId; } + diff --git a/src/main/java/com/kexue/skills/entity/dto/TokenConsumptionDto.java b/src/main/java/art/kexue/sxwz/entity/dto/TokenConsumptionDto.java similarity index 97% rename from src/main/java/com/kexue/skills/entity/dto/TokenConsumptionDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/TokenConsumptionDto.java index 8c16a97..178c242 100644 --- a/src/main/java/com/kexue/skills/entity/dto/TokenConsumptionDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/TokenConsumptionDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -50,3 +50,4 @@ public class TokenConsumptionDto { private String outputMode; } + diff --git a/src/main/java/art/kexue/sxwz/entity/dto/WechatUserDto.java b/src/main/java/art/kexue/sxwz/entity/dto/WechatUserDto.java new file mode 100644 index 0000000..c9b6e30 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/dto/WechatUserDto.java @@ -0,0 +1,23 @@ +package art.kexue.sxwz.entity.dto; + +import lombok.Data; + +@Data +public class WechatUserDto { + + private String openId; + + private String unionId; + + private String nickname; + + private String avatarUrl; + + private Integer sex; + + private String country; + + private String province; + + private String city; +} diff --git a/src/main/java/com/kexue/skills/entity/dto/WithdrawalRecordDto.java b/src/main/java/art/kexue/sxwz/entity/dto/WithdrawalRecordDto.java similarity index 90% rename from src/main/java/com/kexue/skills/entity/dto/WithdrawalRecordDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/WithdrawalRecordDto.java index c9af45b..8f0f4e0 100644 --- a/src/main/java/com/kexue/skills/entity/dto/WithdrawalRecordDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/WithdrawalRecordDto.java @@ -1,6 +1,6 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; -import com.kexue.skills.entity.base.BaseQueryDto; +import art.kexue.sxwz.entity.base.BaseQueryDto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -38,4 +38,4 @@ public class WithdrawalRecordDto extends BaseQueryDto { @Schema(description ="持卡人姓名") private String bankCardholder; -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/entity/dto/YamlContentDto.java b/src/main/java/art/kexue/sxwz/entity/dto/YamlContentDto.java similarity index 88% rename from src/main/java/com/kexue/skills/entity/dto/YamlContentDto.java rename to src/main/java/art/kexue/sxwz/entity/dto/YamlContentDto.java index 3abf397..0a8e5c4 100644 --- a/src/main/java/com/kexue/skills/entity/dto/YamlContentDto.java +++ b/src/main/java/art/kexue/sxwz/entity/dto/YamlContentDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.dto; +package art.kexue.sxwz.entity.dto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -12,3 +12,4 @@ public class YamlContentDto implements Serializable { @Schema(description = "yaml内容") private String yamlContent; } + diff --git a/src/main/java/art/kexue/sxwz/entity/request/AddRoleDto.java b/src/main/java/art/kexue/sxwz/entity/request/AddRoleDto.java new file mode 100644 index 0000000..43b8e9a --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/request/AddRoleDto.java @@ -0,0 +1,17 @@ +package art.kexue.sxwz.entity.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +@Data +@Schema(description = "添加角色请求") +public class AddRoleDto { + + @Schema(description = "用户ID") + private Long userId; + + @Schema(description = "角色编码列表") + private List roleCodes; +} diff --git a/src/main/java/com/kexue/skills/entity/request/AdminResetPasswordDto.java b/src/main/java/art/kexue/sxwz/entity/request/AdminResetPasswordDto.java similarity index 93% rename from src/main/java/com/kexue/skills/entity/request/AdminResetPasswordDto.java rename to src/main/java/art/kexue/sxwz/entity/request/AdminResetPasswordDto.java index fa9a197..bdee13a 100644 --- a/src/main/java/com/kexue/skills/entity/request/AdminResetPasswordDto.java +++ b/src/main/java/art/kexue/sxwz/entity/request/AdminResetPasswordDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.request; +package art.kexue.sxwz.entity.request; import io.swagger.annotations.ApiModel; import io.swagger.v3.oas.annotations.media.Schema; @@ -21,3 +21,4 @@ public class AdminResetPasswordDto implements Serializable { @Schema(description = "新密码") private String newPassword; } + diff --git a/src/main/java/art/kexue/sxwz/entity/request/AssignRoleDto.java b/src/main/java/art/kexue/sxwz/entity/request/AssignRoleDto.java new file mode 100644 index 0000000..be89697 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/request/AssignRoleDto.java @@ -0,0 +1,20 @@ +package art.kexue.sxwz.entity.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +@Data +@Schema(description = "分配角色请求") +public class AssignRoleDto { + + @Schema(description = "用户ID") + private Long userId; + + @Schema(description = "角色编码列表") + private List roleCodes; + + @Schema(description = "是否清空原有角色(true-清空后重新分配,false-追加角色),默认true") + private Boolean clearExisting = true; +} diff --git a/src/main/java/art/kexue/sxwz/entity/request/BatchBindResultDto.java b/src/main/java/art/kexue/sxwz/entity/request/BatchBindResultDto.java new file mode 100644 index 0000000..48ed30d --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/request/BatchBindResultDto.java @@ -0,0 +1,36 @@ +package art.kexue.sxwz.entity.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +@Schema(name = "BatchBindResultDto", description = "批量绑定结果") +public class BatchBindResultDto { + + @Schema(description = "成功数量") + private Integer successCount; + + @Schema(description = "失败数量") + private Integer failCount; + + @Schema(description = "总数量") + private Integer totalCount; + + @Schema(description = "失败详情列表") + private List failItems = new ArrayList<>(); + + @Data + public static class FailItem { + @Schema(description = "行号") + private Integer rowNum; + + @Schema(description = "学生标识(学号或姓名)") + private String studentIdentifier; + + @Schema(description = "失败原因") + private String reason; + } +} diff --git a/src/main/java/art/kexue/sxwz/entity/request/BindPhoneDto.java b/src/main/java/art/kexue/sxwz/entity/request/BindPhoneDto.java new file mode 100644 index 0000000..4698f63 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/request/BindPhoneDto.java @@ -0,0 +1,15 @@ +package art.kexue.sxwz.entity.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +@Schema(description = "绑定电话号码请求") +public class BindPhoneDto { + + @Schema(description = "手机号码", required = true) + private String phone; + + @Schema(description = "短信验证码", required = true) + private String code; +} \ No newline at end of file diff --git a/src/main/java/art/kexue/sxwz/entity/request/BindWxDto.java b/src/main/java/art/kexue/sxwz/entity/request/BindWxDto.java new file mode 100644 index 0000000..e6cdec1 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/request/BindWxDto.java @@ -0,0 +1,15 @@ +package art.kexue.sxwz.entity.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +@Schema(description = "绑定微信请求") +public class BindWxDto { + + @Schema(description = "用户ID") + private Long userId; + + @Schema(description = "微信ID") + private String wxid; +} diff --git a/src/main/java/art/kexue/sxwz/entity/request/CreateUserDto.java b/src/main/java/art/kexue/sxwz/entity/request/CreateUserDto.java new file mode 100644 index 0000000..3735692 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/request/CreateUserDto.java @@ -0,0 +1,49 @@ +package art.kexue.sxwz.entity.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +@Schema(name = "CreateUserDto", description = "创建用户请求参数") +public class CreateUserDto implements Serializable { + + private static final long serialVersionUID = 1L; + + @Schema(description = "用户名") + private String userName; + + @Schema(description = "密码") + private String password; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "手机号") + private String tel; + + @Schema(description = "学校ID") + private Long schoolId; + + @Schema(description = "学院ID") + private Long collegeId; + + @Schema(description = "专业ID(学生用户)") + private Long majorId; + + @Schema(description = "年级(学生用户)") + private String grade; + + @Schema(description = "班级(学生用户)") + private String className; + + @Schema(description = "学号(学生用户)") + private String studentNo; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "工号(教师用户)") + private String teacherNo; +} diff --git a/src/main/java/com/kexue/skills/entity/request/GenIntroduceRequest.java b/src/main/java/art/kexue/sxwz/entity/request/GenIntroduceRequest.java similarity index 91% rename from src/main/java/com/kexue/skills/entity/request/GenIntroduceRequest.java rename to src/main/java/art/kexue/sxwz/entity/request/GenIntroduceRequest.java index b9829de..7de82c9 100644 --- a/src/main/java/com/kexue/skills/entity/request/GenIntroduceRequest.java +++ b/src/main/java/art/kexue/sxwz/entity/request/GenIntroduceRequest.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.request; +package art.kexue.sxwz.entity.request; import io.swagger.annotations.ApiModel; import io.swagger.v3.oas.annotations.media.Schema; @@ -21,3 +21,4 @@ public class GenIntroduceRequest implements Serializable { private String content; } + diff --git a/src/main/java/com/kexue/skills/entity/request/ImportPathDto.java b/src/main/java/art/kexue/sxwz/entity/request/ImportPathDto.java similarity index 93% rename from src/main/java/com/kexue/skills/entity/request/ImportPathDto.java rename to src/main/java/art/kexue/sxwz/entity/request/ImportPathDto.java index 29716bf..4c8c1bc 100644 --- a/src/main/java/com/kexue/skills/entity/request/ImportPathDto.java +++ b/src/main/java/art/kexue/sxwz/entity/request/ImportPathDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.request; +package art.kexue.sxwz.entity.request; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -24,3 +24,4 @@ public class ImportPathDto implements Serializable { private String filePath; } + diff --git a/src/main/java/com/kexue/skills/entity/request/LoginDto.java b/src/main/java/art/kexue/sxwz/entity/request/LoginDto.java similarity index 72% rename from src/main/java/com/kexue/skills/entity/request/LoginDto.java rename to src/main/java/art/kexue/sxwz/entity/request/LoginDto.java index cb2a6d2..c5c80df 100644 --- a/src/main/java/com/kexue/skills/entity/request/LoginDto.java +++ b/src/main/java/art/kexue/sxwz/entity/request/LoginDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.request; +package art.kexue.sxwz.entity.request; import io.swagger.annotations.ApiModel; import io.swagger.v3.oas.annotations.media.Schema; @@ -18,4 +18,7 @@ public class LoginDto implements Serializable { String captchaId; @Schema(description ="验证码值") String captchaValue; + @Schema(description ="角色类型:1-超级管理员,2-学校管理员,3-学院管理员,4-教师,5-学生") + Integer roleType; } + diff --git a/src/main/java/com/kexue/skills/entity/request/LoginUser.java b/src/main/java/art/kexue/sxwz/entity/request/LoginUser.java similarity index 55% rename from src/main/java/com/kexue/skills/entity/request/LoginUser.java rename to src/main/java/art/kexue/sxwz/entity/request/LoginUser.java index 1a3915c..ba30182 100644 --- a/src/main/java/com/kexue/skills/entity/request/LoginUser.java +++ b/src/main/java/art/kexue/sxwz/entity/request/LoginUser.java @@ -1,7 +1,7 @@ -package com.kexue.skills.entity.request; +package art.kexue.sxwz.entity.request; -import com.kexue.skills.entity.Account; -import com.kexue.skills.entity.SysUser; +import art.kexue.sxwz.entity.Account; +import art.kexue.sxwz.entity.SysUser; import lombok.Data; import java.util.List; @@ -24,6 +24,11 @@ public class LoginUser { */ private List roles; + /** + * 用户权限列表 + */ + private List permissions; + /** * 已购买的cmsContentId列表 */ @@ -38,24 +43,5 @@ public class LoginUser { * token */ private String token; - - /** - * 最近点赞的20条记录 - */ - private List favorites; - - /** - * 最近查看的20条记录 - */ - private List history; - - /** - * 最近创建的20条记录 - */ - private List create; - - /** - * 最近购买的20条记录 - */ - private List has; } + diff --git a/src/main/java/com/kexue/skills/entity/request/LoginUserDto.java b/src/main/java/art/kexue/sxwz/entity/request/LoginUserDto.java similarity index 50% rename from src/main/java/com/kexue/skills/entity/request/LoginUserDto.java rename to src/main/java/art/kexue/sxwz/entity/request/LoginUserDto.java index 29b66ca..e7cd68d 100644 --- a/src/main/java/com/kexue/skills/entity/request/LoginUserDto.java +++ b/src/main/java/art/kexue/sxwz/entity/request/LoginUserDto.java @@ -1,6 +1,6 @@ -package com.kexue.skills.entity.request; +package art.kexue.sxwz.entity.request; -import com.kexue.skills.entity.SysUser; +import art.kexue.sxwz.entity.SysUser; import io.swagger.annotations.ApiModel; import lombok.Data; @@ -22,22 +22,13 @@ public class LoginUserDto { SysUser userInfo; /** - * 最近点赞的20条记录 + * 用户角色列表 */ - List favorites; + List roles; /** - * 最近查看的20条记录 + * 用户权限列表 */ - List history; - - /** - * 最近创建的20条记录 - */ - List create; - - /** - * 最近购买的20条记录 - */ - List has; + List permissions; } + diff --git a/src/main/java/com/kexue/skills/entity/request/PhoneLoginDto.java b/src/main/java/art/kexue/sxwz/entity/request/PhoneLoginDto.java similarity index 68% rename from src/main/java/com/kexue/skills/entity/request/PhoneLoginDto.java rename to src/main/java/art/kexue/sxwz/entity/request/PhoneLoginDto.java index 7f281fe..9077428 100644 --- a/src/main/java/com/kexue/skills/entity/request/PhoneLoginDto.java +++ b/src/main/java/art/kexue/sxwz/entity/request/PhoneLoginDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.request; +package art.kexue.sxwz.entity.request; import io.swagger.annotations.ApiModel; import io.swagger.v3.oas.annotations.media.Schema; @@ -26,4 +26,10 @@ public class PhoneLoginDto implements Serializable { @Schema(description ="邀请码") private String inviteCode; -} \ No newline at end of file + + @Schema(description ="角色类型:1-超级管理员,2-学校管理员,3-学院管理员,4-教师,5-学生") + private Integer roleType; + + @Schema(description ="微信ID") + private String wxid; +} diff --git a/src/main/java/com/kexue/skills/entity/request/ResetPasswordDto.java b/src/main/java/art/kexue/sxwz/entity/request/ResetPasswordDto.java similarity index 93% rename from src/main/java/com/kexue/skills/entity/request/ResetPasswordDto.java rename to src/main/java/art/kexue/sxwz/entity/request/ResetPasswordDto.java index ff9d9dc..b9fd77f 100644 --- a/src/main/java/com/kexue/skills/entity/request/ResetPasswordDto.java +++ b/src/main/java/art/kexue/sxwz/entity/request/ResetPasswordDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.request; +package art.kexue.sxwz.entity.request; import io.swagger.annotations.ApiModel; import io.swagger.v3.oas.annotations.media.Schema; @@ -24,3 +24,4 @@ public class ResetPasswordDto implements Serializable { @Schema(description ="新密码") private String newPassword; } + diff --git a/src/main/java/com/kexue/skills/entity/request/ResetPwdDto.java b/src/main/java/art/kexue/sxwz/entity/request/ResetPwdDto.java similarity index 92% rename from src/main/java/com/kexue/skills/entity/request/ResetPwdDto.java rename to src/main/java/art/kexue/sxwz/entity/request/ResetPwdDto.java index 105dce9..75686bb 100644 --- a/src/main/java/com/kexue/skills/entity/request/ResetPwdDto.java +++ b/src/main/java/art/kexue/sxwz/entity/request/ResetPwdDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.request; +package art.kexue.sxwz.entity.request; import io.swagger.annotations.ApiModel; import io.swagger.v3.oas.annotations.media.Schema; @@ -21,3 +21,4 @@ public class ResetPwdDto implements Serializable { @Schema(description ="新密码") private String newPassword; } + diff --git a/src/main/java/art/kexue/sxwz/entity/request/SendNotificationRequest.java b/src/main/java/art/kexue/sxwz/entity/request/SendNotificationRequest.java new file mode 100644 index 0000000..e420daa --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/request/SendNotificationRequest.java @@ -0,0 +1,38 @@ +package art.kexue.sxwz.entity.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +import java.util.List; + +@Data +@Schema(description = "发送通知请求") +public class SendNotificationRequest { + + @NotNull(message = "学校ID不能为空") + @Schema(description = "学校ID", example = "1") + private Long schoolId; + + @NotBlank(message = "通知标题不能为空") + @Schema(description = "通知标题", example = "重要通知") + private String title; + + @NotBlank(message = "通知内容不能为空") + @Schema(description = "通知内容", example = "这是一条重要通知") + private String content; + + @NotNull(message = "通知类型不能为空") + @Schema(description = "通知类型:5-用户通知,6-课程通知", example = "5") + private Integer type; + + @Schema(description = "目标用户ID列表") + private List targetUserIds; + + @Schema(description = "目标角色类型列表") + private List targetRoleTypes; + + @Schema(description = "课程ID列表(老师群发课程通知时使用)") + private List courseIds; +} diff --git a/src/main/java/com/kexue/skills/entity/request/StatQueryDto.java b/src/main/java/art/kexue/sxwz/entity/request/StatQueryDto.java similarity index 93% rename from src/main/java/com/kexue/skills/entity/request/StatQueryDto.java rename to src/main/java/art/kexue/sxwz/entity/request/StatQueryDto.java index b63c254..8bb87d1 100644 --- a/src/main/java/com/kexue/skills/entity/request/StatQueryDto.java +++ b/src/main/java/art/kexue/sxwz/entity/request/StatQueryDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.request; +package art.kexue.sxwz.entity.request; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; @@ -22,3 +22,4 @@ public class StatQueryDto implements Serializable { @Schema(description = "查询类型,参数:1 日,2 月,3 年") private Integer queryType; } + diff --git a/src/main/java/com/kexue/skills/entity/request/SysUserUpdateDto.java b/src/main/java/art/kexue/sxwz/entity/request/SysUserUpdateDto.java similarity index 75% rename from src/main/java/com/kexue/skills/entity/request/SysUserUpdateDto.java rename to src/main/java/art/kexue/sxwz/entity/request/SysUserUpdateDto.java index 6fcd206..ea0e24c 100644 --- a/src/main/java/com/kexue/skills/entity/request/SysUserUpdateDto.java +++ b/src/main/java/art/kexue/sxwz/entity/request/SysUserUpdateDto.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.request; +package art.kexue.sxwz.entity.request; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -35,4 +35,14 @@ public class SysUserUpdateDto implements Serializable { @Schema(description = "状态(1-正常,0-禁用)") private Integer enable; + @Schema(description = "角色类型") + private Integer roleType; + + @Schema(description = "学校ID") + private Integer schoolId; + + @Schema(description = "真实姓名") + private Integer realName; + } + diff --git a/src/main/java/com/kexue/skills/entity/request/UploadResponse.java b/src/main/java/art/kexue/sxwz/entity/request/UploadResponse.java similarity index 87% rename from src/main/java/com/kexue/skills/entity/request/UploadResponse.java rename to src/main/java/art/kexue/sxwz/entity/request/UploadResponse.java index 0efa463..0bc448b 100644 --- a/src/main/java/com/kexue/skills/entity/request/UploadResponse.java +++ b/src/main/java/art/kexue/sxwz/entity/request/UploadResponse.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.request; +package art.kexue.sxwz.entity.request; import io.swagger.annotations.ApiModel; import lombok.Data; @@ -16,3 +16,4 @@ public class UploadResponse implements Serializable { String fileName; String fileUrl; } + diff --git a/src/main/java/art/kexue/sxwz/entity/request/UserBySchoolQueryDto.java b/src/main/java/art/kexue/sxwz/entity/request/UserBySchoolQueryDto.java new file mode 100644 index 0000000..48f22cb --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/request/UserBySchoolQueryDto.java @@ -0,0 +1,21 @@ +package art.kexue.sxwz.entity.request; + +import art.kexue.sxwz.entity.base.BaseQueryDto; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +@Schema(name = "UserBySchoolQueryDto", description = "根据学校ID和角色类型查询用户请求参数") +public class UserBySchoolQueryDto extends BaseQueryDto implements Serializable { + + private static final long serialVersionUID = 1L; + + @Schema(description = "学校ID", required = true) + private Long schoolId; + + @Schema(description = "角色类型:1-超级管理员,2-学校管理员,3-学院管理员,4-教师,5-学生") + private Integer roleType; + +} \ No newline at end of file diff --git a/src/main/java/art/kexue/sxwz/entity/request/VerifyPhoneCodeDto.java b/src/main/java/art/kexue/sxwz/entity/request/VerifyPhoneCodeDto.java new file mode 100644 index 0000000..e1361c5 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/entity/request/VerifyPhoneCodeDto.java @@ -0,0 +1,20 @@ +package art.kexue.sxwz.entity.request; + +import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +@ApiModel(value = "验证手机号验证码请求") +public class VerifyPhoneCodeDto implements Serializable { + + private static final long serialVersionUID = 1L; + + @Schema(description = "手机号", required = true) + private String phone; + + @Schema(description = "验证码", required = true) + private String code; +} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/entity/response/SkillResponse.java b/src/main/java/art/kexue/sxwz/entity/response/SkillResponse.java similarity index 87% rename from src/main/java/com/kexue/skills/entity/response/SkillResponse.java rename to src/main/java/art/kexue/sxwz/entity/response/SkillResponse.java index 7b348e7..f4841cd 100644 --- a/src/main/java/com/kexue/skills/entity/response/SkillResponse.java +++ b/src/main/java/art/kexue/sxwz/entity/response/SkillResponse.java @@ -1,4 +1,4 @@ -package com.kexue.skills.entity.response; +package art.kexue.sxwz.entity.response; import lombok.Data; @@ -13,4 +13,4 @@ public class SkillResponse implements Serializable { private String description; private List tags; private String summary; -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/exception/BizException.java b/src/main/java/art/kexue/sxwz/exception/BizException.java similarity index 96% rename from src/main/java/com/kexue/skills/exception/BizException.java rename to src/main/java/art/kexue/sxwz/exception/BizException.java index d95a836..7c4ebba 100644 --- a/src/main/java/com/kexue/skills/exception/BizException.java +++ b/src/main/java/art/kexue/sxwz/exception/BizException.java @@ -1,4 +1,4 @@ -package com.kexue.skills.exception; +package art.kexue.sxwz.exception; public class BizException extends RuntimeException { @@ -48,4 +48,4 @@ public class BizException extends RuntimeException { ", errorMessage='" + errorMessage + '\'' + '}'; } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/exception/GlobalExceptionHandler.java b/src/main/java/art/kexue/sxwz/exception/GlobalExceptionHandler.java similarity index 84% rename from src/main/java/com/kexue/skills/exception/GlobalExceptionHandler.java rename to src/main/java/art/kexue/sxwz/exception/GlobalExceptionHandler.java index 0d150ff..942b87b 100644 --- a/src/main/java/com/kexue/skills/exception/GlobalExceptionHandler.java +++ b/src/main/java/art/kexue/sxwz/exception/GlobalExceptionHandler.java @@ -1,6 +1,6 @@ -package com.kexue.skills.exception; +package art.kexue.sxwz.exception; -import com.kexue.skills.common.CommonResult; +import art.kexue.sxwz.common.CommonResult; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; @@ -17,8 +17,9 @@ public class GlobalExceptionHandler { if (e == null) { return CommonResult.success("未知错误"); } + e.printStackTrace(); return CommonResult.success(e.getErrorCode(), e.getMessage()); } // 其他异常处理... -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/interceptor/BizExceptionAdvice.java b/src/main/java/art/kexue/sxwz/interceptor/BizExceptionAdvice.java similarity index 85% rename from src/main/java/com/kexue/skills/interceptor/BizExceptionAdvice.java rename to src/main/java/art/kexue/sxwz/interceptor/BizExceptionAdvice.java index 0a051d7..e0f351d 100644 --- a/src/main/java/com/kexue/skills/interceptor/BizExceptionAdvice.java +++ b/src/main/java/art/kexue/sxwz/interceptor/BizExceptionAdvice.java @@ -1,7 +1,8 @@ -package com.kexue.skills.interceptor; +package art.kexue.sxwz.interceptor; -import com.kexue.skills.common.*; -import com.kexue.skills.exception.BizException; +import art.kexue.sxwz.common.CommonResult; +import art.kexue.sxwz.common.*; +import art.kexue.sxwz.exception.BizException; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; @@ -24,3 +25,4 @@ public class BizExceptionAdvice { return CommonResult.failed("未知错误,请联系管理员!"); } } + diff --git a/src/main/java/com/kexue/skills/interceptor/CachedBodyFilter.java b/src/main/java/art/kexue/sxwz/interceptor/CachedBodyFilter.java similarity index 98% rename from src/main/java/com/kexue/skills/interceptor/CachedBodyFilter.java rename to src/main/java/art/kexue/sxwz/interceptor/CachedBodyFilter.java index 82be7c2..57672d9 100644 --- a/src/main/java/com/kexue/skills/interceptor/CachedBodyFilter.java +++ b/src/main/java/art/kexue/sxwz/interceptor/CachedBodyFilter.java @@ -1,4 +1,4 @@ -package com.kexue.skills.interceptor; +package art.kexue.sxwz.interceptor; import jakarta.servlet.*; import jakarta.servlet.http.HttpServletRequest; @@ -50,3 +50,4 @@ public class CachedBodyFilter implements Filter { } } } + diff --git a/src/main/java/com/kexue/skills/interceptor/CachedBodyHttpServletRequest.java b/src/main/java/art/kexue/sxwz/interceptor/CachedBodyHttpServletRequest.java similarity index 98% rename from src/main/java/com/kexue/skills/interceptor/CachedBodyHttpServletRequest.java rename to src/main/java/art/kexue/sxwz/interceptor/CachedBodyHttpServletRequest.java index a839e6a..39cc3ac 100644 --- a/src/main/java/com/kexue/skills/interceptor/CachedBodyHttpServletRequest.java +++ b/src/main/java/art/kexue/sxwz/interceptor/CachedBodyHttpServletRequest.java @@ -1,4 +1,4 @@ -package com.kexue.skills.interceptor; +package art.kexue.sxwz.interceptor; import jakarta.servlet.ReadListener; import jakarta.servlet.ServletInputStream; @@ -86,3 +86,4 @@ public class CachedBodyHttpServletRequest extends HttpServletRequestWrapper { } } } + diff --git a/src/main/java/com/kexue/skills/interceptor/CachedBodyHttpServletResponse.java b/src/main/java/art/kexue/sxwz/interceptor/CachedBodyHttpServletResponse.java similarity index 98% rename from src/main/java/com/kexue/skills/interceptor/CachedBodyHttpServletResponse.java rename to src/main/java/art/kexue/sxwz/interceptor/CachedBodyHttpServletResponse.java index 639bfcd..d818c1c 100644 --- a/src/main/java/com/kexue/skills/interceptor/CachedBodyHttpServletResponse.java +++ b/src/main/java/art/kexue/sxwz/interceptor/CachedBodyHttpServletResponse.java @@ -1,4 +1,4 @@ -package com.kexue.skills.interceptor; +package art.kexue.sxwz.interceptor; import jakarta.servlet.ServletOutputStream; import jakarta.servlet.WriteListener; @@ -92,3 +92,4 @@ public class CachedBodyHttpServletResponse extends HttpServletResponseWrapper { } } } + diff --git a/src/main/java/com/kexue/skills/interceptor/CorsFilter.java b/src/main/java/art/kexue/sxwz/interceptor/CorsFilter.java similarity index 96% rename from src/main/java/com/kexue/skills/interceptor/CorsFilter.java rename to src/main/java/art/kexue/sxwz/interceptor/CorsFilter.java index 5c7e877..8494a9f 100644 --- a/src/main/java/com/kexue/skills/interceptor/CorsFilter.java +++ b/src/main/java/art/kexue/sxwz/interceptor/CorsFilter.java @@ -1,4 +1,4 @@ -package com.kexue.skills.interceptor; +package art.kexue.sxwz.interceptor; import jakarta.servlet.*; import jakarta.servlet.http.HttpServletRequest; @@ -29,4 +29,4 @@ public class CorsFilter implements Filter { chain.doFilter(req, res); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/interceptor/LogInterceptor.java b/src/main/java/art/kexue/sxwz/interceptor/LogInterceptor.java similarity index 97% rename from src/main/java/com/kexue/skills/interceptor/LogInterceptor.java rename to src/main/java/art/kexue/sxwz/interceptor/LogInterceptor.java index 3b6e1fe..c6e3f06 100644 --- a/src/main/java/com/kexue/skills/interceptor/LogInterceptor.java +++ b/src/main/java/art/kexue/sxwz/interceptor/LogInterceptor.java @@ -1,12 +1,13 @@ -package com.kexue.skills.interceptor; +package art.kexue.sxwz.interceptor; +import art.kexue.sxwz.entity.SysLog; import cn.hutool.core.util.StrUtil; import cn.hutool.http.useragent.UserAgent; import cn.hutool.http.useragent.UserAgentUtil; import com.fasterxml.jackson.databind.ObjectMapper; -import com.kexue.skills.annotation.Log; -import com.kexue.skills.entity.LogRecord; -import com.kexue.skills.mapper.SysLogMapper; +import art.kexue.sxwz.annotation.Log; +import art.kexue.sxwz.entity.LogRecord; +import art.kexue.sxwz.mapper.SysLogMapper; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; @@ -15,11 +16,7 @@ import org.springframework.scheduling.annotation.Async; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerInterceptor; -import javax.annotation.Resource; -import java.io.IOException; import java.time.Instant; -import java.time.LocalDateTime; -import java.time.ZoneId; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; @@ -259,7 +256,7 @@ public class LogInterceptor implements HandlerInterceptor { public void saveLogAsync(LogRecord logRecord) { try { // 转换为 SysLog 实体 - com.kexue.skills.entity.SysLog sysLog = new com.kexue.skills.entity.SysLog(); + SysLog sysLog = new SysLog(); // 设置基本信息 sysLog.setDescription(StrUtil.blankToDefault(logRecord.getDescription(), "")); @@ -410,3 +407,4 @@ public class LogInterceptor implements HandlerInterceptor { } } } + diff --git a/src/main/java/com/kexue/skills/interceptor/UserContextHolder.java b/src/main/java/art/kexue/sxwz/interceptor/UserContextHolder.java similarity index 91% rename from src/main/java/com/kexue/skills/interceptor/UserContextHolder.java rename to src/main/java/art/kexue/sxwz/interceptor/UserContextHolder.java index e7410e1..90e7679 100644 --- a/src/main/java/com/kexue/skills/interceptor/UserContextHolder.java +++ b/src/main/java/art/kexue/sxwz/interceptor/UserContextHolder.java @@ -1,4 +1,4 @@ -package com.kexue.skills.interceptor; +package art.kexue.sxwz.interceptor; /** * @author 维哥 @@ -20,3 +20,4 @@ public class UserContextHolder { USER_HOLDER.remove(); } } + diff --git a/src/main/java/com/kexue/skills/mapper/AccountFrozenMapper.java b/src/main/java/art/kexue/sxwz/mapper/AccountFrozenMapper.java similarity index 94% rename from src/main/java/com/kexue/skills/mapper/AccountFrozenMapper.java rename to src/main/java/art/kexue/sxwz/mapper/AccountFrozenMapper.java index 541e424..d3d7013 100644 --- a/src/main/java/com/kexue/skills/mapper/AccountFrozenMapper.java +++ b/src/main/java/art/kexue/sxwz/mapper/AccountFrozenMapper.java @@ -1,6 +1,6 @@ -package com.kexue.skills.mapper; +package art.kexue.sxwz.mapper; -import com.kexue.skills.entity.AccountFrozen; +import art.kexue.sxwz.entity.AccountFrozen; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -60,3 +60,6 @@ public interface AccountFrozenMapper { List selectExpiredFrozen(Date currentTime); } + + + diff --git a/src/main/java/com/kexue/skills/mapper/AccountMapper.java b/src/main/java/art/kexue/sxwz/mapper/AccountMapper.java similarity index 94% rename from src/main/java/com/kexue/skills/mapper/AccountMapper.java rename to src/main/java/art/kexue/sxwz/mapper/AccountMapper.java index 9e58517..eb291e8 100644 --- a/src/main/java/com/kexue/skills/mapper/AccountMapper.java +++ b/src/main/java/art/kexue/sxwz/mapper/AccountMapper.java @@ -1,7 +1,7 @@ -package com.kexue.skills.mapper; +package art.kexue.sxwz.mapper; -import com.kexue.skills.entity.Account; -import com.kexue.skills.entity.dto.AccountDto; +import art.kexue.sxwz.entity.Account; +import art.kexue.sxwz.entity.dto.AccountDto; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -100,4 +100,6 @@ public interface AccountMapper { */ int deleteById(Long accountId); -} \ No newline at end of file +} + + diff --git a/src/main/java/com/kexue/skills/mapper/AccountTransactionMapper.java b/src/main/java/art/kexue/sxwz/mapper/AccountTransactionMapper.java similarity index 92% rename from src/main/java/com/kexue/skills/mapper/AccountTransactionMapper.java rename to src/main/java/art/kexue/sxwz/mapper/AccountTransactionMapper.java index 9e5fc8e..a061dac 100644 --- a/src/main/java/com/kexue/skills/mapper/AccountTransactionMapper.java +++ b/src/main/java/art/kexue/sxwz/mapper/AccountTransactionMapper.java @@ -1,8 +1,8 @@ -package com.kexue.skills.mapper; +package art.kexue.sxwz.mapper; -import com.kexue.skills.entity.AccountTransaction; -import com.kexue.skills.entity.dto.AccountTransactionDto; -import com.kexue.skills.entity.dto.ConsumptionGroupedDto; +import art.kexue.sxwz.entity.AccountTransaction; +import art.kexue.sxwz.entity.dto.AccountTransactionDto; +import art.kexue.sxwz.entity.dto.ConsumptionGroupedDto; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -111,4 +111,6 @@ public interface AccountTransactionMapper { * @return 查询结果 */ List getConsumptionGroupedPageList(AccountTransactionDto queryDto); -} \ No newline at end of file +} + + diff --git a/src/main/java/art/kexue/sxwz/mapper/ComputeQuotaMapper.java b/src/main/java/art/kexue/sxwz/mapper/ComputeQuotaMapper.java new file mode 100644 index 0000000..463ad8b --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/ComputeQuotaMapper.java @@ -0,0 +1,30 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.ComputeQuota; +import art.kexue.sxwz.entity.dto.ComputeQuotaDto; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface ComputeQuotaMapper { + + int insert(ComputeQuota record); + + ComputeQuota queryById(Long id); + + int updateByIdSelective(ComputeQuota record); + + int deleteById(Long id); + + List getPageList(ComputeQuotaDto queryDto); + + ComputeQuota queryBySubject(@Param("subjectType") Integer subjectType, @Param("subjectId") Long subjectId); + + List queryBySubjectType(Integer subjectType); + + int updateUsedHours(@Param("subjectType") Integer subjectType, @Param("subjectId") Long subjectId, @Param("usedHours") Long usedHours); + + ComputeQuota getTotalQuota(); +} \ No newline at end of file diff --git a/src/main/java/art/kexue/sxwz/mapper/EduAttendanceMapper.java b/src/main/java/art/kexue/sxwz/mapper/EduAttendanceMapper.java new file mode 100644 index 0000000..59b244e --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/EduAttendanceMapper.java @@ -0,0 +1,29 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.EduAttendance; +import art.kexue.sxwz.entity.dto.EduAttendanceDto; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface EduAttendanceMapper { + + int insert(EduAttendance record); + + + EduAttendance queryById(Long id); + + int updateByIdSelective(EduAttendance record); + + + int deleteById(Long id); + + List queryByCourseId(Long courseId); + + List queryByTeacherId(Long teacherId); + + List getPageList(EduAttendanceDto queryDto); +} + + diff --git a/src/main/java/art/kexue/sxwz/mapper/EduAttendanceRecordMapper.java b/src/main/java/art/kexue/sxwz/mapper/EduAttendanceRecordMapper.java new file mode 100644 index 0000000..2771e84 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/EduAttendanceRecordMapper.java @@ -0,0 +1,30 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.EduAttendanceRecord; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface EduAttendanceRecordMapper { + + int insert(EduAttendanceRecord record); + + EduAttendanceRecord queryById(Long id); + + int updateByIdSelective(EduAttendanceRecord record); + + + int deleteById(Long id); + + List queryByAttendanceId(Long attendanceId); + + List queryByStudentId(Long studentId); + + EduAttendanceRecord queryByAttendanceIdAndStudentId(@Param("attendanceId") Long attendanceId, @Param("studentId") Long studentId); + + int batchInsert(List list); +} + + diff --git a/src/main/java/art/kexue/sxwz/mapper/EduCollegeMapper.java b/src/main/java/art/kexue/sxwz/mapper/EduCollegeMapper.java new file mode 100644 index 0000000..65243e9 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/EduCollegeMapper.java @@ -0,0 +1,27 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.EduCollege; +import art.kexue.sxwz.entity.dto.EduCollegeDto; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface EduCollegeMapper { + + int insert(EduCollege record); + + EduCollege queryById(Long id); + + int updateByIdSelective(EduCollege record); + + int deleteById(Long id); + + List getPageList(EduCollegeDto queryDto); + + EduCollege queryByName(String name); + + int updateTeacherCount(Long id, Integer count); + + int updateStudentCount(Long id, Integer count); +} \ No newline at end of file diff --git a/src/main/java/art/kexue/sxwz/mapper/EduCourseMapper.java b/src/main/java/art/kexue/sxwz/mapper/EduCourseMapper.java new file mode 100644 index 0000000..6ee73ab --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/EduCourseMapper.java @@ -0,0 +1,30 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.EduCourse; +import art.kexue.sxwz.entity.dto.EduCourseDto; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface EduCourseMapper { + + int insert(EduCourse record); + + EduCourse queryById(Long id); + + int updateByIdSelective(EduCourse record); + + + int deleteById(Long id); + + List queryByTeacherId(Long teacherId); + + List queryBySchoolId(Long schoolId); + + List queryByStudentId(Long studentId); + + List getPageList(EduCourseDto queryDto); +} + + diff --git a/src/main/java/art/kexue/sxwz/mapper/EduCourseStudentMapper.java b/src/main/java/art/kexue/sxwz/mapper/EduCourseStudentMapper.java new file mode 100644 index 0000000..f8d9c2d --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/EduCourseStudentMapper.java @@ -0,0 +1,35 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.EduCourseStudent; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface +EduCourseStudentMapper { + + int insert(EduCourseStudent record); + + EduCourseStudent queryById(Long id); + + int updateByIdSelective(EduCourseStudent record); + + + int deleteById(Long id); + + List queryByCourseId(Long courseId); + + List queryByStudentId(Long studentId); + + EduCourseStudent queryByCourseIdAndStudentId(@Param("courseId") Long courseId, @Param("studentId") Long studentId); + + int batchInsert(List list); + + int deleteByCourseId(Long courseId); + + int deleteByStudentId(Long studentId); +} + + diff --git a/src/main/java/art/kexue/sxwz/mapper/EduExamMapper.java b/src/main/java/art/kexue/sxwz/mapper/EduExamMapper.java new file mode 100644 index 0000000..132c35c --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/EduExamMapper.java @@ -0,0 +1,32 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.EduExam; +import art.kexue.sxwz.entity.dto.EduExamDto; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface EduExamMapper { + + int insert(EduExam record); + + EduExam queryById(Long id); + + int updateByIdSelective(EduExam record); + + + int deleteById(Long id); + + List queryByCourseId(Long courseId); + + List queryByTeacherId(Long teacherId); + + List queryByStudentId(Long studentId); + + List queryMakeupByParentId(Long parentExamId); + + List getPageList(EduExamDto queryDto); +} + + diff --git a/src/main/java/art/kexue/sxwz/mapper/EduExamPaperMapper.java b/src/main/java/art/kexue/sxwz/mapper/EduExamPaperMapper.java new file mode 100644 index 0000000..4fe1bf7 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/EduExamPaperMapper.java @@ -0,0 +1,28 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.EduExamPaper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface EduExamPaperMapper { + + int insert(EduExamPaper record); + + EduExamPaper queryById(Long id); + + int updateByIdSelective(EduExamPaper record); + + + int deleteById(Long id); + + List queryByExamId(Long examId); + + List queryByStudentId(Long studentId); + + EduExamPaper queryByExamIdAndStudentId(@Param("examId") Long examId, @Param("studentId") Long studentId); +} + + diff --git a/src/main/java/art/kexue/sxwz/mapper/EduExcellentWorkMapper.java b/src/main/java/art/kexue/sxwz/mapper/EduExcellentWorkMapper.java new file mode 100644 index 0000000..5c621a9 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/EduExcellentWorkMapper.java @@ -0,0 +1,30 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.EduExcellentWork; +import art.kexue.sxwz.entity.dto.EduExcellentWorkDto; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface EduExcellentWorkMapper { + + int insert(EduExcellentWork record); + + EduExcellentWork queryById(Long id); + + int updateByIdSelective(EduExcellentWork record); + + + int deleteById(Long id); + + List queryBySchoolId(Long schoolId); + + List queryByStudentId(Long studentId); + + List getPageList(EduExcellentWorkDto queryDto); + + EduExcellentWork queryBySubmitId(Long submitId); +} + + diff --git a/src/main/java/art/kexue/sxwz/mapper/EduHomeworkMapper.java b/src/main/java/art/kexue/sxwz/mapper/EduHomeworkMapper.java new file mode 100644 index 0000000..ae56215 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/EduHomeworkMapper.java @@ -0,0 +1,30 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.EduHomework; +import art.kexue.sxwz.entity.dto.EduHomeworkDto; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface EduHomeworkMapper { + + int insert(EduHomework record); + + EduHomework queryById(Long id); + + int updateByIdSelective(EduHomework record); + + + int deleteById(Long id); + + List queryByCourseId(Long courseId); + + List queryByTeacherId(Long teacherId); + + List queryByStudentId(Long studentId); + + List getPageList(EduHomeworkDto queryDto); +} + + diff --git a/src/main/java/art/kexue/sxwz/mapper/EduHomeworkSubmitMapper.java b/src/main/java/art/kexue/sxwz/mapper/EduHomeworkSubmitMapper.java new file mode 100644 index 0000000..0cbb881 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/EduHomeworkSubmitMapper.java @@ -0,0 +1,30 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.EduHomeworkSubmit; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface EduHomeworkSubmitMapper { + + int insert(EduHomeworkSubmit record); + + EduHomeworkSubmit queryById(Long id); + + int updateByIdSelective(EduHomeworkSubmit record); + + + int deleteById(Long id); + + List queryByHomeworkId(Long homeworkId); + + List queryByStudentId(Long studentId); + + EduHomeworkSubmit queryByHomeworkIdAndStudentId(@Param("homeworkId") Long homeworkId, @Param("studentId") Long studentId); + + List queryExcellentByCourseId(Long courseId); +} + + diff --git a/src/main/java/art/kexue/sxwz/mapper/EduSchoolMapper.java b/src/main/java/art/kexue/sxwz/mapper/EduSchoolMapper.java new file mode 100644 index 0000000..47d0186 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/EduSchoolMapper.java @@ -0,0 +1,27 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.EduSchool; +import art.kexue.sxwz.entity.dto.EduSchoolDto; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface EduSchoolMapper { + + int insert(EduSchool record); + + EduSchool queryById(Long id); + + int updateByIdSelective(EduSchool record); + + int deleteById(Long id); + + List queryAll(); + + List queryListByStatus(Integer status); + + List getPageList(EduSchoolDto queryDto); +} + + diff --git a/src/main/java/art/kexue/sxwz/mapper/EduStudentMapper.java b/src/main/java/art/kexue/sxwz/mapper/EduStudentMapper.java new file mode 100644 index 0000000..dc7797b --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/EduStudentMapper.java @@ -0,0 +1,40 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.EduStudent; +import art.kexue.sxwz.entity.dto.EduStudentDto; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface EduStudentMapper { + + int insert(EduStudent record); + + EduStudent queryById(Long id); + + int updateByIdSelective(EduStudent record); + + int deleteById(Long id); + + EduStudent queryByUserId(Long userId); + + List queryListBySchoolId(Long schoolId); + + List queryListByCollegeId(Long collegeId); + + List queryByClass(@Param("schoolId") Long schoolId, @Param("collegeId") Long collegeId, + @Param("majorId") Long majorId, @Param("grade") String grade, + @Param("className") String className); + + EduStudent queryByActivationCode(String activationCode); + + EduStudent queryByStudentNo(String studentNo); + + EduStudent queryByRealName(String realName); + + List getPageList(EduStudentDto queryDto); +} + + diff --git a/src/main/java/art/kexue/sxwz/mapper/EduTeacherMapper.java b/src/main/java/art/kexue/sxwz/mapper/EduTeacherMapper.java new file mode 100644 index 0000000..b448454 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/EduTeacherMapper.java @@ -0,0 +1,32 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.EduTeacher; +import art.kexue.sxwz.entity.dto.EduTeacherDto; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface EduTeacherMapper { + + int insert(EduTeacher record); + + EduTeacher queryById(Long id); + + int updateByIdSelective(EduTeacher record); + + + int deleteById(Long id); + + EduTeacher queryByUserId(Long userId); + + List queryListBySchoolId(Long schoolId); + + List queryListByCollegeId(Long collegeId); + + EduTeacher queryByActivationCode(String activationCode); + + List getPageList(EduTeacherDto queryDto); +} + + diff --git a/src/main/java/art/kexue/sxwz/mapper/EduWorkLikeMapper.java b/src/main/java/art/kexue/sxwz/mapper/EduWorkLikeMapper.java new file mode 100644 index 0000000..dff533a --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/EduWorkLikeMapper.java @@ -0,0 +1,32 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.EduWorkLike; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface EduWorkLikeMapper { + + int insert(EduWorkLike record); + + EduWorkLike queryById(Long id); + + int updateByIdSelective(EduWorkLike record); + + + int deleteById(Long id); + + List queryByWorkId(Long workId); + + List queryByUserId(Long userId); + + EduWorkLike queryByWorkIdAndUserId(@Param("workId") Long workId, @Param("userId") Long userId); + + int deleteByWorkIdAndUserId(@Param("workId") Long workId, @Param("userId") Long userId); + + int countByWorkId(Long workId); +} + + diff --git a/src/main/java/com/kexue/skills/mapper/ModelPriceMapper.java b/src/main/java/art/kexue/sxwz/mapper/ModelPriceMapper.java similarity index 93% rename from src/main/java/com/kexue/skills/mapper/ModelPriceMapper.java rename to src/main/java/art/kexue/sxwz/mapper/ModelPriceMapper.java index 438d2ce..bc9e840 100644 --- a/src/main/java/com/kexue/skills/mapper/ModelPriceMapper.java +++ b/src/main/java/art/kexue/sxwz/mapper/ModelPriceMapper.java @@ -1,7 +1,7 @@ -package com.kexue.skills.mapper; +package art.kexue.sxwz.mapper; -import com.kexue.skills.entity.ModelPrice; -import com.kexue.skills.entity.dto.ModelPriceDto; +import art.kexue.sxwz.entity.ModelPrice; +import art.kexue.sxwz.entity.dto.ModelPriceDto; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -83,3 +83,6 @@ public interface ModelPriceMapper { int deleteById(Long id); } + + + diff --git a/src/main/java/com/kexue/skills/mapper/PackageConfigMapper.java b/src/main/java/art/kexue/sxwz/mapper/PackageConfigMapper.java similarity index 86% rename from src/main/java/com/kexue/skills/mapper/PackageConfigMapper.java rename to src/main/java/art/kexue/sxwz/mapper/PackageConfigMapper.java index f3bdbf4..3b5238e 100644 --- a/src/main/java/com/kexue/skills/mapper/PackageConfigMapper.java +++ b/src/main/java/art/kexue/sxwz/mapper/PackageConfigMapper.java @@ -1,9 +1,8 @@ -package com.kexue.skills.mapper; +package art.kexue.sxwz.mapper; -import com.kexue.skills.entity.PackageConfig; -import com.kexue.skills.entity.dto.PackageConfigDto; +import art.kexue.sxwz.entity.PackageConfig; +import art.kexue.sxwz.entity.dto.PackageConfigDto; import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; import java.util.List; @@ -64,3 +63,6 @@ public interface PackageConfigMapper { int deleteById(Long id); } + + + diff --git a/src/main/java/com/kexue/skills/mapper/PaymentOrderMapper.java b/src/main/java/art/kexue/sxwz/mapper/PaymentOrderMapper.java similarity index 93% rename from src/main/java/com/kexue/skills/mapper/PaymentOrderMapper.java rename to src/main/java/art/kexue/sxwz/mapper/PaymentOrderMapper.java index 5717fa5..3ed0cf5 100644 --- a/src/main/java/com/kexue/skills/mapper/PaymentOrderMapper.java +++ b/src/main/java/art/kexue/sxwz/mapper/PaymentOrderMapper.java @@ -1,7 +1,7 @@ -package com.kexue.skills.mapper; +package art.kexue.sxwz.mapper; -import com.kexue.skills.entity.PaymentOrder; -import com.kexue.skills.entity.dto.PaymentOrderDto; +import art.kexue.sxwz.entity.PaymentOrder; +import art.kexue.sxwz.entity.dto.PaymentOrderDto; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -91,4 +91,6 @@ public interface PaymentOrderMapper { * @return 影响行数 */ int deleteById(Long orderId); -} \ No newline at end of file +} + + diff --git a/src/main/java/art/kexue/sxwz/mapper/SysDeptMapper.java b/src/main/java/art/kexue/sxwz/mapper/SysDeptMapper.java new file mode 100644 index 0000000..9db5c84 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/SysDeptMapper.java @@ -0,0 +1,29 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.SysDept; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface SysDeptMapper { + + int insert(SysDept record); + + SysDept selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(SysDept record); + + int updateByPrimaryKey(SysDept record); + + int deleteByPrimaryKey(Long id); + + List queryList(SysDept sysDept); + + List queryByParentId(Long parentId); + + List queryByLevel(Integer level); + + int deleteByParentId(Long parentId); +} + + diff --git a/src/main/java/com/kexue/skills/mapper/SysDictMapper.java b/src/main/java/art/kexue/sxwz/mapper/SysDictMapper.java similarity index 89% rename from src/main/java/com/kexue/skills/mapper/SysDictMapper.java rename to src/main/java/art/kexue/sxwz/mapper/SysDictMapper.java index 07f316b..a4b2721 100644 --- a/src/main/java/com/kexue/skills/mapper/SysDictMapper.java +++ b/src/main/java/art/kexue/sxwz/mapper/SysDictMapper.java @@ -1,13 +1,11 @@ -package com.kexue.skills.mapper; +package art.kexue.sxwz.mapper; -import com.kexue.skills.entity.SysDict; -import com.kexue.skills.entity.dto.SysDictDto; +import art.kexue.sxwz.entity.SysDict; +import art.kexue.sxwz.entity.dto.SysDictDto; import org.apache.ibatis.annotations.Param; import java.util.List; -import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Mapper; -import java.util.List; /** * 系统字典表(SysDict)表数据库访问层 @@ -87,3 +85,6 @@ public interface SysDictMapper { List getDictListByCode(String dictCode); } + + + diff --git a/src/main/java/com/kexue/skills/mapper/SysLogMapper.java b/src/main/java/art/kexue/sxwz/mapper/SysLogMapper.java similarity index 89% rename from src/main/java/com/kexue/skills/mapper/SysLogMapper.java rename to src/main/java/art/kexue/sxwz/mapper/SysLogMapper.java index cb62f78..4e44fdd 100644 --- a/src/main/java/com/kexue/skills/mapper/SysLogMapper.java +++ b/src/main/java/art/kexue/sxwz/mapper/SysLogMapper.java @@ -1,13 +1,11 @@ -package com.kexue.skills.mapper; +package art.kexue.sxwz.mapper; -import com.kexue.skills.entity.SysLog; -import com.kexue.skills.entity.dto.SysLogDto; +import art.kexue.sxwz.entity.SysLog; +import art.kexue.sxwz.entity.dto.SysLogDto; import org.apache.ibatis.annotations.Param; import java.util.List; -import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Mapper; -import java.util.List; /** * (SysLog)表数据库访问层 @@ -85,3 +83,6 @@ public interface SysLogMapper { int deleteById(Long logId); } + + + diff --git a/src/main/java/com/kexue/skills/mapper/SysMenuMapper.java b/src/main/java/art/kexue/sxwz/mapper/SysMenuMapper.java similarity index 89% rename from src/main/java/com/kexue/skills/mapper/SysMenuMapper.java rename to src/main/java/art/kexue/sxwz/mapper/SysMenuMapper.java index b27b220..e389995 100644 --- a/src/main/java/com/kexue/skills/mapper/SysMenuMapper.java +++ b/src/main/java/art/kexue/sxwz/mapper/SysMenuMapper.java @@ -1,13 +1,11 @@ -package com.kexue.skills.mapper; +package art.kexue.sxwz.mapper; -import com.kexue.skills.entity.SysMenu; -import com.kexue.skills.entity.dto.SysMenuDto; +import art.kexue.sxwz.entity.SysMenu; +import art.kexue.sxwz.entity.dto.SysMenuDto; import org.apache.ibatis.annotations.Param; import java.util.List; -import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Mapper; -import java.util.List; /** * (SysMenu)表数据库访问层 @@ -85,3 +83,6 @@ public interface SysMenuMapper { int deleteById(Long menuId); } + + + diff --git a/src/main/java/art/kexue/sxwz/mapper/SysNotificationMapper.java b/src/main/java/art/kexue/sxwz/mapper/SysNotificationMapper.java new file mode 100644 index 0000000..65a000f --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/SysNotificationMapper.java @@ -0,0 +1,32 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.SysNotification; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface SysNotificationMapper { + + int insert(SysNotification record); + + SysNotification queryById(Long id); + + int updateByIdSelective(SysNotification record); + + + int deleteById(Long id); + + List queryByUserId(@Param("userId") Long userId, @Param("schoolId") Long schoolId); + + int updateReadStatus(@Param("userId") Long userId, @Param("notificationId") Long notificationId); + + int updateAllRead(@Param("userId") Long userId, @Param("schoolId") Long schoolId); + + int countUnread(@Param("userId") Long userId, @Param("schoolId") Long schoolId); + +int batchInsert(List list); +} + + diff --git a/src/main/java/com/kexue/skills/mapper/SysRoleMapper.java b/src/main/java/art/kexue/sxwz/mapper/SysRoleMapper.java similarity index 89% rename from src/main/java/com/kexue/skills/mapper/SysRoleMapper.java rename to src/main/java/art/kexue/sxwz/mapper/SysRoleMapper.java index 5b8f988..687ddec 100644 --- a/src/main/java/com/kexue/skills/mapper/SysRoleMapper.java +++ b/src/main/java/art/kexue/sxwz/mapper/SysRoleMapper.java @@ -1,13 +1,11 @@ -package com.kexue.skills.mapper; +package art.kexue.sxwz.mapper; -import com.kexue.skills.entity.SysRole; -import com.kexue.skills.entity.dto.SysRoleDto; +import art.kexue.sxwz.entity.SysRole; +import art.kexue.sxwz.entity.dto.SysRoleDto; import org.apache.ibatis.annotations.Param; import java.util.List; -import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Mapper; -import java.util.List; /** * (SysRole)表数据库访问层 @@ -85,3 +83,6 @@ public interface SysRoleMapper { int deleteById(Long roleId); } + + + diff --git a/src/main/java/art/kexue/sxwz/mapper/SysRolePermissionMapper.java b/src/main/java/art/kexue/sxwz/mapper/SysRolePermissionMapper.java new file mode 100644 index 0000000..a735e9e --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/SysRolePermissionMapper.java @@ -0,0 +1,29 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.SysRolePermission; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface SysRolePermissionMapper { + + int insert(SysRolePermission record); + + SysRolePermission queryById(Long id); + + int updateByIdSelective(SysRolePermission record); + + + int deleteById(Long id); + + List queryByRoleId(Long roleId); + + List queryPermissionCodesByRoleCode(String roleCode); + + List queryPermissionCodesByRoleCodes(List roleCodes); + + List queryPermissionCodesByUserId(Long userId); +} + + diff --git a/src/main/java/com/kexue/skills/mapper/SysUserMapper.java b/src/main/java/art/kexue/sxwz/mapper/SysUserMapper.java similarity index 81% rename from src/main/java/com/kexue/skills/mapper/SysUserMapper.java rename to src/main/java/art/kexue/sxwz/mapper/SysUserMapper.java index f58b69e..ef6c9fc 100644 --- a/src/main/java/com/kexue/skills/mapper/SysUserMapper.java +++ b/src/main/java/art/kexue/sxwz/mapper/SysUserMapper.java @@ -1,7 +1,7 @@ -package com.kexue.skills.mapper; +package art.kexue.sxwz.mapper; -import com.kexue.skills.entity.SysUser; -import com.kexue.skills.entity.dto.SysUserDto; +import art.kexue.sxwz.entity.SysUser; +import art.kexue.sxwz.entity.dto.SysUserDto; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -89,5 +89,13 @@ public interface SysUserMapper { SysUser getBySessionId(String sessionId); SysUser getByInviteCode(String inviteCode); - + + SysUser getByWxid(String wxid); + + List getUsersBySchoolIdAndRoleType(@Param("schoolId") Long schoolId, @Param("roleType") Integer roleType); + + List getUsersWithExtBySchoolIdAndRoleType(@Param("schoolId") Long schoolId, @Param("roleType") Integer roleType); } + + + diff --git a/src/main/java/art/kexue/sxwz/mapper/SysUserRoleMapper.java b/src/main/java/art/kexue/sxwz/mapper/SysUserRoleMapper.java new file mode 100644 index 0000000..a348124 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/mapper/SysUserRoleMapper.java @@ -0,0 +1,32 @@ +package art.kexue.sxwz.mapper; + +import art.kexue.sxwz.entity.SysUserRole; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface SysUserRoleMapper { + + int insert(SysUserRole record); + + SysUserRole queryById(Long id); + + int updateByIdSelective(SysUserRole record); + + + int deleteById(Long id); + + List queryByUserId(Long userId); + + List queryRoleCodesByUserId(Long userId); + + int deleteByUserId(Long userId); + + int deleteByUserIdAndRoleCode(@Param("userId") Long userId, @Param("roleCode") String roleCode); + + SysUserRole queryByUserIdAndRoleCode(@Param("userId") Long userId, @Param("roleCode") String roleCode); +} + + diff --git a/src/main/java/com/kexue/skills/service/AccountFrozenService.java b/src/main/java/art/kexue/sxwz/service/AccountFrozenService.java similarity index 81% rename from src/main/java/com/kexue/skills/service/AccountFrozenService.java rename to src/main/java/art/kexue/sxwz/service/AccountFrozenService.java index 8ceb836..13025e8 100644 --- a/src/main/java/com/kexue/skills/service/AccountFrozenService.java +++ b/src/main/java/art/kexue/sxwz/service/AccountFrozenService.java @@ -1,8 +1,8 @@ -package com.kexue.skills.service; +package art.kexue.sxwz.service; -import com.kexue.skills.entity.AccountFrozen; -import com.kexue.skills.entity.dto.AccountFrozenDto; -import com.kexue.skills.entity.dto.AccountReleaseDto; +import art.kexue.sxwz.entity.AccountFrozen; +import art.kexue.sxwz.entity.dto.AccountFrozenDto; +import art.kexue.sxwz.entity.dto.AccountReleaseDto; /** * 账户冻结单服务 @@ -41,3 +41,4 @@ public interface AccountFrozenService { AccountFrozen getBySessionId(String sessionId); } + diff --git a/src/main/java/com/kexue/skills/service/AccountService.java b/src/main/java/art/kexue/sxwz/service/AccountService.java similarity index 91% rename from src/main/java/com/kexue/skills/service/AccountService.java rename to src/main/java/art/kexue/sxwz/service/AccountService.java index 3c22bda..0bffb69 100644 --- a/src/main/java/com/kexue/skills/service/AccountService.java +++ b/src/main/java/art/kexue/sxwz/service/AccountService.java @@ -1,12 +1,12 @@ -package com.kexue.skills.service; +package art.kexue.sxwz.service; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.Account; -import com.kexue.skills.entity.AccountTransaction; -import com.kexue.skills.entity.dto.AccountDto; -import com.kexue.skills.entity.dto.AccountTransactionDto; -import com.kexue.skills.entity.dto.ConsumptionGroupedDto; -import com.kexue.skills.entity.dto.TokenConsumptionDto; +import art.kexue.sxwz.entity.Account; +import art.kexue.sxwz.entity.AccountTransaction; +import art.kexue.sxwz.entity.dto.AccountDto; +import art.kexue.sxwz.entity.dto.AccountTransactionDto; +import art.kexue.sxwz.entity.dto.ConsumptionGroupedDto; +import art.kexue.sxwz.entity.dto.TokenConsumptionDto; import java.math.BigDecimal; import java.util.List; @@ -162,7 +162,7 @@ public interface AccountService extends BaseService { * @param userId 用户ID * @return 交易记录列表 */ - List getTransactions(Long userId); + List getTransactions(Long userId); /** * 分页查询充值记录 @@ -187,4 +187,4 @@ public interface AccountService extends BaseService { * @return 分页结果 */ PageInfo getGiftPageList(AccountTransactionDto queryDto); -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/service/BaseService.java b/src/main/java/art/kexue/sxwz/service/BaseService.java similarity index 89% rename from src/main/java/com/kexue/skills/service/BaseService.java rename to src/main/java/art/kexue/sxwz/service/BaseService.java index fc1ee66..f138d21 100644 --- a/src/main/java/com/kexue/skills/service/BaseService.java +++ b/src/main/java/art/kexue/sxwz/service/BaseService.java @@ -1,4 +1,4 @@ -package com.kexue.skills.service; +package art.kexue.sxwz.service; /** * 基础Service接口,包含所有Service通用的常量和方法 @@ -18,3 +18,4 @@ public interface BaseService { */ Integer PAGENUM = 1; } + diff --git a/src/main/java/art/kexue/sxwz/service/ComputeQuotaService.java b/src/main/java/art/kexue/sxwz/service/ComputeQuotaService.java new file mode 100644 index 0000000..f741e21 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/ComputeQuotaService.java @@ -0,0 +1,30 @@ +package art.kexue.sxwz.service; + +import art.kexue.sxwz.entity.ComputeQuota; +import art.kexue.sxwz.entity.dto.ComputeQuotaDto; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +public interface ComputeQuotaService extends BaseService { + + ComputeQuota save(ComputeQuota quota); + + ComputeQuota update(ComputeQuota quota); + + void delete(Long id); + + ComputeQuota queryById(Long id); + + PageInfo getPageList(ComputeQuotaDto queryDto); + + List queryBySubjectType(Integer subjectType); + + ComputeQuota queryBySubject(Integer subjectType, Long subjectId); + + ComputeQuota getTotalQuota(); + + ComputeQuota allocateQuota(Integer subjectType, Long subjectId, String subjectName, Long hours); + + boolean addUsedHours(Integer subjectType, Long subjectId, Long hours); +} \ No newline at end of file diff --git a/src/main/java/art/kexue/sxwz/service/EduAttendanceService.java b/src/main/java/art/kexue/sxwz/service/EduAttendanceService.java new file mode 100644 index 0000000..8cdb520 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/EduAttendanceService.java @@ -0,0 +1,43 @@ +package art.kexue.sxwz.service; + +import art.kexue.sxwz.entity.EduAttendance; +import art.kexue.sxwz.entity.EduAttendanceRecord; +import art.kexue.sxwz.entity.dto.EduAttendanceDto; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +public interface EduAttendanceService extends BaseService { + + EduAttendance save(EduAttendance attendance); + + EduAttendance update(EduAttendance attendance); + + void delete(Long id); + + EduAttendance queryById(Long id); + + List queryByCourseId(Long courseId); + + List queryByTeacherId(Long teacherId); + + EduAttendanceRecord recordAttendance(Long attendanceId, Long studentId); + + EduAttendanceRecord queryRecordById(Long id); + + List queryRecordsByAttendanceId(Long attendanceId); + + List queryRecordsByStudentId(Long studentId); + + void batchCreateRecords(Long attendanceId, List studentIds); + + EduAttendance createAttendance(Long schoolId, Long courseId, Integer duration); + + String generateQRCode(Long attendanceId); + + EduAttendanceRecord scanQRCode(String qrCodeContent, Long studentId); + + void closeAttendance(Long attendanceId); + + PageInfo getPageList(EduAttendanceDto queryDto); +} diff --git a/src/main/java/art/kexue/sxwz/service/EduCollegeService.java b/src/main/java/art/kexue/sxwz/service/EduCollegeService.java new file mode 100644 index 0000000..ac3abaf --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/EduCollegeService.java @@ -0,0 +1,24 @@ +package art.kexue.sxwz.service; + +import art.kexue.sxwz.entity.EduCollege; +import art.kexue.sxwz.entity.dto.EduCollegeDto; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +public interface EduCollegeService extends BaseService { + + EduCollege save(EduCollege college); + + EduCollege update(EduCollege college); + + void delete(Long id); + + EduCollege queryById(Long id); + + PageInfo getPageList(EduCollegeDto queryDto); + + List queryAll(); + + EduCollege queryByName(String name); +} \ No newline at end of file diff --git a/src/main/java/art/kexue/sxwz/service/EduCourseService.java b/src/main/java/art/kexue/sxwz/service/EduCourseService.java new file mode 100644 index 0000000..1953aec --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/EduCourseService.java @@ -0,0 +1,42 @@ +package art.kexue.sxwz.service; + +import art.kexue.sxwz.entity.EduCourse; +import art.kexue.sxwz.entity.dto.EduCourseDto; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +public interface EduCourseService extends BaseService { + + EduCourse save(EduCourse course); + + EduCourse update(EduCourse course); + + void delete(Long id); + + EduCourse queryById(Long id); + + List queryByTeacherId(Long teacherId); + + List queryBySchoolId(Long schoolId); + + List queryByStudentId(Long studentId); + + void addStudent(Long courseId, Long studentId); + + void removeStudent(Long courseId, Long studentId); + + Boolean isStudentInCourse(Long courseId, Long studentId); + + PageInfo getPageList(EduCourseDto queryDto); + + /** + * 通过Excel批量绑定学生到课程 + * + * @param courseId 课程ID + * @param excelBytes Excel文件字节数组 + * @param append 是否追加模式(true-追加,false-覆盖) + * @return 绑定结果 + */ + art.kexue.sxwz.entity.request.BatchBindResultDto batchBindStudents(Long courseId, byte[] excelBytes, boolean append); +} diff --git a/src/main/java/art/kexue/sxwz/service/EduExamService.java b/src/main/java/art/kexue/sxwz/service/EduExamService.java new file mode 100644 index 0000000..8c9696c --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/EduExamService.java @@ -0,0 +1,39 @@ +package art.kexue.sxwz.service; + +import art.kexue.sxwz.entity.EduExam; +import art.kexue.sxwz.entity.EduExamPaper; +import art.kexue.sxwz.entity.dto.EduExamDto; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +public interface EduExamService extends BaseService { + + EduExam save(EduExam exam); + + EduExam update(EduExam exam); + + void delete(Long id); + + EduExam queryById(Long id); + + List queryByCourseId(Long courseId); + + List queryByTeacherId(Long teacherId); + + List queryByStudentId(Long studentId); + + EduExam createMakeupExam(Long parentExamId); + + EduExamPaper submitExam(Long examId, Long studentId, String answer); + + EduExamPaper gradeExam(Long paperId, Double score); + + EduExamPaper queryPaperById(Long paperId); + + List queryPapersByExamId(Long examId); + + PageInfo getPageList(EduExamDto queryDto); + + EduExamPaper queryPaperByExamIdAndStudentId(Long examId, Long studentId); +} diff --git a/src/main/java/art/kexue/sxwz/service/EduExcellentWorkService.java b/src/main/java/art/kexue/sxwz/service/EduExcellentWorkService.java new file mode 100644 index 0000000..24d0fb2 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/EduExcellentWorkService.java @@ -0,0 +1,34 @@ +package art.kexue.sxwz.service; + +import art.kexue.sxwz.entity.EduExcellentWork; +import art.kexue.sxwz.entity.dto.EduExcellentWorkDto; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +public interface EduExcellentWorkService extends BaseService { + + EduExcellentWork save(EduExcellentWork work); + + void delete(Long id); + + EduExcellentWork queryById(Long id); + + List queryBySchoolId(Long schoolId); + + List queryByStudentId(Long studentId); + + EduExcellentWork queryBySubmitId(Long submitId); + + void addLike(Long workId, Long userId); + + void removeLike(Long workId, Long userId); + + boolean hasLiked(Long workId, Long userId); + + int countLikes(Long workId); + + EduExcellentWork markAsExcellent(Long submitId, Integer workType, Double score, String comment); + + PageInfo getPageList(EduExcellentWorkDto queryDto); +} diff --git a/src/main/java/art/kexue/sxwz/service/EduHomeworkService.java b/src/main/java/art/kexue/sxwz/service/EduHomeworkService.java new file mode 100644 index 0000000..19e6960 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/EduHomeworkService.java @@ -0,0 +1,36 @@ +package art.kexue.sxwz.service; + +import art.kexue.sxwz.entity.EduHomework; +import art.kexue.sxwz.entity.EduHomeworkSubmit; +import art.kexue.sxwz.entity.dto.EduHomeworkDto; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +public interface EduHomeworkService extends BaseService { + + EduHomework save(EduHomework homework); + + EduHomework update(EduHomework homework); + + void delete(Long id); + + EduHomework queryById(Long id); + + List queryByCourseId(Long courseId); + + List queryByTeacherId(Long teacherId); + + List queryByStudentId(Long studentId); + + EduHomeworkSubmit submitHomework(Long homeworkId, Long studentId, String answer); + + EduHomeworkSubmit gradeHomework(Long submitId, Double score, String comment); + + EduHomeworkSubmit querySubmitById(Long submitId); + + List querySubmitsByHomeworkId(Long homeworkId); + + PageInfo getPageList(EduHomeworkDto queryDto); + EduHomeworkSubmit querySubmitByHomeworkIdAndStudentId(Long homeworkId, Long studentId); +} diff --git a/src/main/java/art/kexue/sxwz/service/EduSchoolService.java b/src/main/java/art/kexue/sxwz/service/EduSchoolService.java new file mode 100644 index 0000000..bcdee5b --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/EduSchoolService.java @@ -0,0 +1,26 @@ +package art.kexue.sxwz.service; + +import art.kexue.sxwz.entity.EduSchool; +import art.kexue.sxwz.entity.dto.EduSchoolDto; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +public interface EduSchoolService extends BaseService { + + EduSchool save(EduSchool school); + + EduSchool update(EduSchool school); + + void delete(Long id); + + EduSchool queryById(Long id); + + List queryAll(); + + List queryListByStatus(Integer status); + + PageInfo getPageList(EduSchoolDto queryDto); + + EduSchool updateStatus(Long id, Integer status); +} diff --git a/src/main/java/art/kexue/sxwz/service/EduStudentService.java b/src/main/java/art/kexue/sxwz/service/EduStudentService.java new file mode 100644 index 0000000..355be07 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/EduStudentService.java @@ -0,0 +1,32 @@ +package art.kexue.sxwz.service; + +import art.kexue.sxwz.entity.EduStudent; +import art.kexue.sxwz.entity.dto.EduStudentDto; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +public interface EduStudentService extends BaseService { + + EduStudent save(EduStudent student); + + EduStudent update(EduStudent student); + + void delete(Long id); + + EduStudent queryById(Long id); + + EduStudent queryByUserId(Long userId); + + List queryListBySchoolId(Long schoolId); + + List queryListByCollegeId(Long collegeId); + + List queryByClass(Long schoolId, Long collegeId, Long majorId, String grade, String className); + + EduStudent queryByActivationCode(String activationCode); + + EduStudent bindUser(Long studentId, Long userId); + + PageInfo getPageList(EduStudentDto queryDto); +} diff --git a/src/main/java/art/kexue/sxwz/service/EduTeacherService.java b/src/main/java/art/kexue/sxwz/service/EduTeacherService.java new file mode 100644 index 0000000..9f408b4 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/EduTeacherService.java @@ -0,0 +1,30 @@ +package art.kexue.sxwz.service; + +import art.kexue.sxwz.entity.EduTeacher; +import art.kexue.sxwz.entity.dto.EduTeacherDto; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +public interface EduTeacherService extends BaseService { + + EduTeacher save(EduTeacher teacher); + + EduTeacher update(EduTeacher teacher); + + void delete(Long id); + + EduTeacher queryById(Long id); + + EduTeacher queryByUserId(Long userId); + + List queryListBySchoolId(Long schoolId); + + List queryListByCollegeId(Long collegeId); + + EduTeacher queryByActivationCode(String activationCode); + + EduTeacher bindUser(Long teacherId, Long userId); + + PageInfo getPageList(EduTeacherDto queryDto); +} diff --git a/src/main/java/com/kexue/skills/service/ModelPriceService.java b/src/main/java/art/kexue/sxwz/service/ModelPriceService.java similarity index 93% rename from src/main/java/com/kexue/skills/service/ModelPriceService.java rename to src/main/java/art/kexue/sxwz/service/ModelPriceService.java index 4da6e6c..e2707a8 100644 --- a/src/main/java/com/kexue/skills/service/ModelPriceService.java +++ b/src/main/java/art/kexue/sxwz/service/ModelPriceService.java @@ -1,8 +1,8 @@ -package com.kexue.skills.service; +package art.kexue.sxwz.service; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.ModelPrice; -import com.kexue.skills.entity.dto.ModelPriceDto; +import art.kexue.sxwz.entity.ModelPrice; +import art.kexue.sxwz.entity.dto.ModelPriceDto; import java.util.List; @@ -81,3 +81,4 @@ public interface ModelPriceService extends BaseService { int deleteById(Long id); } + diff --git a/src/main/java/com/kexue/skills/service/PackageConfigService.java b/src/main/java/art/kexue/sxwz/service/PackageConfigService.java similarity index 91% rename from src/main/java/com/kexue/skills/service/PackageConfigService.java rename to src/main/java/art/kexue/sxwz/service/PackageConfigService.java index 03db44f..be3844e 100644 --- a/src/main/java/com/kexue/skills/service/PackageConfigService.java +++ b/src/main/java/art/kexue/sxwz/service/PackageConfigService.java @@ -1,8 +1,8 @@ -package com.kexue.skills.service; +package art.kexue.sxwz.service; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.PackageConfig; -import com.kexue.skills.entity.dto.PackageConfigDto; +import art.kexue.sxwz.entity.PackageConfig; +import art.kexue.sxwz.entity.dto.PackageConfigDto; import java.util.List; @@ -71,3 +71,4 @@ public interface PackageConfigService extends BaseService { int deleteById(Long id); } + diff --git a/src/main/java/com/kexue/skills/service/PayService.java b/src/main/java/art/kexue/sxwz/service/PayService.java similarity index 93% rename from src/main/java/com/kexue/skills/service/PayService.java rename to src/main/java/art/kexue/sxwz/service/PayService.java index 09ac6e1..2f1247a 100644 --- a/src/main/java/com/kexue/skills/service/PayService.java +++ b/src/main/java/art/kexue/sxwz/service/PayService.java @@ -1,6 +1,6 @@ -package com.kexue.skills.service; +package art.kexue.sxwz.service; -import com.kexue.skills.entity.PaymentOrder; +import art.kexue.sxwz.entity.PaymentOrder; import jakarta.servlet.http.HttpServletRequest; import java.util.Map; @@ -44,3 +44,4 @@ public interface PayService { */ Map handleAlipayReturn(HttpServletRequest request); } + diff --git a/src/main/java/com/kexue/skills/service/PaymentOrderService.java b/src/main/java/art/kexue/sxwz/service/PaymentOrderService.java similarity index 95% rename from src/main/java/com/kexue/skills/service/PaymentOrderService.java rename to src/main/java/art/kexue/sxwz/service/PaymentOrderService.java index efa8a2c..434d55a 100644 --- a/src/main/java/com/kexue/skills/service/PaymentOrderService.java +++ b/src/main/java/art/kexue/sxwz/service/PaymentOrderService.java @@ -1,8 +1,8 @@ -package com.kexue.skills.service; +package art.kexue.sxwz.service; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.PaymentOrder; -import com.kexue.skills.entity.dto.PaymentOrderDto; +import art.kexue.sxwz.entity.PaymentOrder; +import art.kexue.sxwz.entity.dto.PaymentOrderDto; import java.util.List; @@ -113,4 +113,4 @@ public interface PaymentOrderService extends BaseService { * @return 处理结果 */ boolean handlePaymentCallback(String orderNo, Integer status, String channelOrderNo); -} \ No newline at end of file +} diff --git a/src/main/java/art/kexue/sxwz/service/SysDeptService.java b/src/main/java/art/kexue/sxwz/service/SysDeptService.java new file mode 100644 index 0000000..b7e2c99 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/SysDeptService.java @@ -0,0 +1,27 @@ +package art.kexue.sxwz.service; + +import art.kexue.sxwz.entity.SysDept; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +public interface SysDeptService { + + SysDept save(SysDept sysDept); + + void delete(Long id); + + SysDept update(SysDept sysDept); + + SysDept queryById(Long id); + + List queryList(SysDept sysDept); + + PageInfo getPageList(SysDept sysDept); + + List queryByParentId(Long parentId); + + List queryByLevel(Integer level); + + List getTree(Long parentId); +} diff --git a/src/main/java/com/kexue/skills/service/SysDictService.java b/src/main/java/art/kexue/sxwz/service/SysDictService.java similarity index 91% rename from src/main/java/com/kexue/skills/service/SysDictService.java rename to src/main/java/art/kexue/sxwz/service/SysDictService.java index fab7dbf..1a0742f 100644 --- a/src/main/java/com/kexue/skills/service/SysDictService.java +++ b/src/main/java/art/kexue/sxwz/service/SysDictService.java @@ -1,8 +1,8 @@ -package com.kexue.skills.service; +package art.kexue.sxwz.service; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.SysDict; -import com.kexue.skills.entity.dto.SysDictDto; +import art.kexue.sxwz.entity.SysDict; +import art.kexue.sxwz.entity.dto.SysDictDto; import java.util.List; import java.util.Map; @@ -71,3 +71,4 @@ public interface SysDictService extends BaseService { List getListByDictCode(String dictCode); } + diff --git a/src/main/java/com/kexue/skills/service/SysLogService.java b/src/main/java/art/kexue/sxwz/service/SysLogService.java similarity index 90% rename from src/main/java/com/kexue/skills/service/SysLogService.java rename to src/main/java/art/kexue/sxwz/service/SysLogService.java index de06067..ecf7d09 100644 --- a/src/main/java/com/kexue/skills/service/SysLogService.java +++ b/src/main/java/art/kexue/sxwz/service/SysLogService.java @@ -1,8 +1,8 @@ -package com.kexue.skills.service; +package art.kexue.sxwz.service; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.SysLog; -import com.kexue.skills.entity.dto.SysLogDto; +import art.kexue.sxwz.entity.SysLog; +import art.kexue.sxwz.entity.dto.SysLogDto; import java.util.List; /** @@ -63,3 +63,4 @@ public interface SysLogService extends BaseService { boolean deleteById(Long logId); } + diff --git a/src/main/java/com/kexue/skills/service/SysMenuService.java b/src/main/java/art/kexue/sxwz/service/SysMenuService.java similarity index 90% rename from src/main/java/com/kexue/skills/service/SysMenuService.java rename to src/main/java/art/kexue/sxwz/service/SysMenuService.java index bc4218c..3a802dd 100644 --- a/src/main/java/com/kexue/skills/service/SysMenuService.java +++ b/src/main/java/art/kexue/sxwz/service/SysMenuService.java @@ -1,8 +1,8 @@ -package com.kexue.skills.service; +package art.kexue.sxwz.service; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.SysMenu; -import com.kexue.skills.entity.dto.SysMenuDto; +import art.kexue.sxwz.entity.SysMenu; +import art.kexue.sxwz.entity.dto.SysMenuDto; import java.util.List; /** @@ -63,3 +63,4 @@ public interface SysMenuService extends BaseService { boolean deleteById(Long menuId); } + diff --git a/src/main/java/art/kexue/sxwz/service/SysNotificationService.java b/src/main/java/art/kexue/sxwz/service/SysNotificationService.java new file mode 100644 index 0000000..7c4fd41 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/SysNotificationService.java @@ -0,0 +1,41 @@ +package art.kexue.sxwz.service; + +import art.kexue.sxwz.entity.SysNotification; +import art.kexue.sxwz.entity.SysUser; + +import java.util.List; + +public interface SysNotificationService { + + SysNotification save(SysNotification notification); + + void delete(Long id); + + SysNotification queryById(Long id); + + List queryByUserId(Long userId, Long schoolId); + + void markAsRead(Long userId, Long notificationId); + + void markAllAsRead(Long userId, Long schoolId); + + int countUnread(Long userId, Long schoolId); + + void sendNotification(Long schoolId, Long userId, String title, String content, Integer type); + + void sendUserNotification(Long schoolId, Long senderId, String senderName, + String title, String content, + List targetUserIds, List targetRoleTypes); + + void sendCourseNotification(Long schoolId, Long teacherId, String teacherName, + String title, String content, List courseIds); + + void sendSystemNotification(Long schoolId, List targetUserIds, + String title, String content); + + List getAvailableTargetRoles(Long currentUserId); + + List getUsersByRoleTypes(Long schoolId, List roleTypes); + + void batchInsert(List notifications); +} diff --git a/src/main/java/com/kexue/skills/service/SysRoleService.java b/src/main/java/art/kexue/sxwz/service/SysRoleService.java similarity index 90% rename from src/main/java/com/kexue/skills/service/SysRoleService.java rename to src/main/java/art/kexue/sxwz/service/SysRoleService.java index 4ac032a..38f49b6 100644 --- a/src/main/java/com/kexue/skills/service/SysRoleService.java +++ b/src/main/java/art/kexue/sxwz/service/SysRoleService.java @@ -1,8 +1,8 @@ -package com.kexue.skills.service; +package art.kexue.sxwz.service; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.SysRole; -import com.kexue.skills.entity.dto.SysRoleDto; +import art.kexue.sxwz.entity.SysRole; +import art.kexue.sxwz.entity.dto.SysRoleDto; import java.util.List; /** @@ -63,3 +63,4 @@ public interface SysRoleService extends BaseService { boolean deleteById(Long roleId); } + diff --git a/src/main/java/art/kexue/sxwz/service/SysUserRoleService.java b/src/main/java/art/kexue/sxwz/service/SysUserRoleService.java new file mode 100644 index 0000000..14a3cc7 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/SysUserRoleService.java @@ -0,0 +1,32 @@ +package art.kexue.sxwz.service; + +import art.kexue.sxwz.entity.SysUserRole; + +import java.util.List; + +public interface SysUserRoleService { + + SysUserRole save(SysUserRole userRole); + + void delete(Long id); + + SysUserRole queryById(Long id); + + List queryByUserId(Long userId); + + List queryRoleCodesByUserId(Long userId); + + void deleteByUserId(Long userId); + + void deleteByUserIdAndRoleCode(Long userId, String roleCode); + + boolean hasRole(Long userId, String roleCode); + + void assignRoles(Long userId, List roleCodes); + + void assignRoles(Long userId, List roleCodes, boolean clearExisting); + + void addRoles(Long userId, List roleCodes); + + void removeRoles(Long userId, List roleCodes); +} diff --git a/src/main/java/com/kexue/skills/service/SysUserService.java b/src/main/java/art/kexue/sxwz/service/SysUserService.java similarity index 57% rename from src/main/java/com/kexue/skills/service/SysUserService.java rename to src/main/java/art/kexue/sxwz/service/SysUserService.java index cc8f92f..5f186af 100644 --- a/src/main/java/com/kexue/skills/service/SysUserService.java +++ b/src/main/java/art/kexue/sxwz/service/SysUserService.java @@ -1,9 +1,11 @@ -package com.kexue.skills.service; +package art.kexue.sxwz.service; +import art.kexue.sxwz.entity.dto.SessionDto; +import art.kexue.sxwz.entity.request.*; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.SysUser; -import com.kexue.skills.entity.dto.SysUserDto; -import com.kexue.skills.entity.request.*; +import art.kexue.sxwz.entity.SysUser; +import art.kexue.sxwz.entity.dto.SysUserDto; +import art.kexue.sxwz.entity.request.*; import org.springframework.web.multipart.MultipartFile; @@ -101,12 +103,21 @@ public interface SysUserService extends BaseService { boolean resetPasswordByUsernameOrPhone(String usernameOrPhone, String newPassword, String operator); /** - * 发送手机验证码 + * 发送短信验证码 * * @param phone 手机号 * @return 是否发送成功 */ boolean sendSmsCode(String phone); + + /** + * 验证手机号验证码 + * + * @param phone 手机号 + * @param code 验证码 + * @return 是否验证成功 + */ + boolean verifyPhoneCode(String phone, String code); /** * 手机号登录 @@ -130,7 +141,7 @@ public interface SysUserService extends BaseService { * @param userId 用户ID * @return 会话信息 */ - com.kexue.skills.entity.dto.SessionDto createSession(Long userId); + SessionDto createSession(Long userId); /** * 查询用户角色列表 @@ -158,4 +169,82 @@ public interface SysUserService extends BaseService { * @return 上传成功的文件名 */ String uploadAvatar(MultipartFile file, Long userId, String token); + + /** + * 绑定手机号 + * + * @param phone 手机号码 + * @param code 短信验证码 + * @return 是否成功 + */ + boolean bindPhone(String phone, String code); + + /** + * 绑定微信 + * + * @param userId 用户ID + * @param wxid 微信ID + * @return 是否成功 + */ + boolean bindWx(Long userId, String wxid); + + /** + * 微信扫码登录 + * + * @param wxid 微信ID + * @param nickname 微信昵称 + * @return 登录结果 + */ + LoginUserDto wechatLogin(String wxid, String nickname); + + /** + * 创建学校管理员(只有公司管理员能操作) + * + * @param createUserDto 用户创建参数 + * @return 创建的用户 + */ + SysUser createSchoolAdmin(CreateUserDto createUserDto); + + /** + * 创建学院管理员(只有学校管理员能操作) + * + * @param createUserDto 用户创建参数 + * @return 创建的用户 + */ + SysUser createCollegeAdmin(CreateUserDto createUserDto); + + /** + * 创建教师用户(只有学院管理员能操作) + * + * @param createUserDto 用户创建参数 + * @return 创建的用户 + */ + SysUser createTeacher(CreateUserDto createUserDto); + + /** + * 创建学生用户(只有学院管理员能操作) + * + * @param createUserDto 用户创建参数 + * @return 创建的用户 + */ + SysUser createStudent(CreateUserDto createUserDto); + + /** + * 根据学校ID和角色类型获取用户列表 + * + * @param schoolId 学校ID + * @param roleType 角色类型 + * @return 用户列表 + */ + List getUsersBySchoolIdAndRoleType(Long schoolId, Integer roleType); + + /** + * 根据学校ID和角色类型获取用户列表(级联查询学生/教师扩展信息) + * + * @param schoolId 学校ID + * @param roleType 角色类型 + * @return 用户列表(包含学生/教师扩展信息) + */ + List getUsersWithExtBySchoolIdAndRoleType(Long schoolId, Integer roleType); } + diff --git a/src/main/java/art/kexue/sxwz/service/WechatUserService.java b/src/main/java/art/kexue/sxwz/service/WechatUserService.java new file mode 100644 index 0000000..107d3ab --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/WechatUserService.java @@ -0,0 +1,12 @@ +package art.kexue.sxwz.service; + +import art.kexue.sxwz.entity.dto.WechatUserDto; + +public interface WechatUserService { + + String buildAuthorizationUrl(String redirectUri); + + String buildAuthorizationUrl(); + + WechatUserDto handleCallback(String code) throws Exception; +} diff --git a/src/main/java/com/kexue/skills/service/impl/AccountFrozenServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/AccountFrozenServiceImpl.java similarity index 87% rename from src/main/java/com/kexue/skills/service/impl/AccountFrozenServiceImpl.java rename to src/main/java/art/kexue/sxwz/service/impl/AccountFrozenServiceImpl.java index 61f06ca..ad3183a 100644 --- a/src/main/java/com/kexue/skills/service/impl/AccountFrozenServiceImpl.java +++ b/src/main/java/art/kexue/sxwz/service/impl/AccountFrozenServiceImpl.java @@ -1,23 +1,23 @@ -package com.kexue.skills.service.impl; +package art.kexue.sxwz.service.impl; -import com.kexue.skills.entity.Account; -import com.kexue.skills.entity.AccountFrozen; -import com.kexue.skills.entity.SysUser; -import com.kexue.skills.entity.dto.AccountFrozenDto; -import com.kexue.skills.entity.dto.AccountReleaseDto; -import com.kexue.skills.entity.dto.ModelPriceDto; -import com.kexue.skills.exception.BizException; -import com.kexue.skills.mapper.AccountFrozenMapper; -import com.kexue.skills.mapper.AccountMapper; -import com.kexue.skills.mapper.SysUserMapper; -import com.kexue.skills.service.AccountFrozenService; -import com.kexue.skills.service.ModelPriceService; -import com.kexue.skills.entity.ModelPrice; -import com.kexue.skills.entity.AccountTransaction; -import com.kexue.skills.mapper.AccountTransactionMapper; -import com.kexue.skills.common.util.IDUtils; -import com.kexue.skills.common.ResultCode; -import com.kexue.skills.config.AccountDeductionProperties; +import art.kexue.sxwz.entity.Account; +import art.kexue.sxwz.entity.AccountFrozen; +import art.kexue.sxwz.entity.SysUser; +import art.kexue.sxwz.entity.dto.AccountFrozenDto; +import art.kexue.sxwz.entity.dto.AccountReleaseDto; +import art.kexue.sxwz.entity.dto.ModelPriceDto; +import art.kexue.sxwz.exception.BizException; +import art.kexue.sxwz.mapper.AccountFrozenMapper; +import art.kexue.sxwz.mapper.AccountMapper; +import art.kexue.sxwz.mapper.SysUserMapper; +import art.kexue.sxwz.service.AccountFrozenService; +import art.kexue.sxwz.service.ModelPriceService; +import art.kexue.sxwz.entity.ModelPrice; +import art.kexue.sxwz.entity.AccountTransaction; +import art.kexue.sxwz.mapper.AccountTransactionMapper; +import art.kexue.sxwz.common.util.IDUtils; +import art.kexue.sxwz.common.ResultCode; +import art.kexue.sxwz.config.AccountDeductionProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -72,6 +72,7 @@ public class AccountFrozenServiceImpl implements AccountFrozenService { * @return 冻结单信息 */ @Override + @Transactional(rollbackFor = Exception.class) public AccountFrozen createFrozen(AccountFrozenDto accountFrozenDto) { // 1. 验证创建冻结单参数 validateCreateFrozenParams(accountFrozenDto); @@ -189,24 +190,67 @@ public class AccountFrozenServiceImpl implements AccountFrozenService { * @return 冻结金额(单位:积分) */ private BigDecimal calculateTokenFrozenAmount(AccountFrozenDto accountFrozenDto) { + LOG.debug("开始计算token类型冻结金额 - sessionId: {}, modelName: {}, estimatedInputTokens: {}, estimatedOutputTokens: {}", + accountFrozenDto.getSessionId(), accountFrozenDto.getModelName(), + accountFrozenDto.getEstimatedInputTokens(), accountFrozenDto.getEstimatedOutputTokens()); + + // 1. 验证必要参数 if (accountFrozenDto.getEstimatedInputTokens() == null || accountFrozenDto.getEstimatedOutputTokens() == null || accountFrozenDto.getModelName() == null) { + LOG.warn("token冻结金额计算缺少必要参数,返回原始冻结金额 - sessionId: {}, frozenAmount: {}", + accountFrozenDto.getSessionId(), accountFrozenDto.getFrozenAmount()); return accountFrozenDto.getFrozenAmount(); } + + // 2. 标准化模型名称 String modelName = normalizeModelName(accountFrozenDto.getModelName()); + LOG.debug("标准化模型名称 - 原始名称: {}, 标准化后: {}", accountFrozenDto.getModelName(), modelName); + + // 3. 获取模型价格列表 List modelPriceList = getModelPriceList(modelName); + LOG.debug("获取模型价格列表 - modelName: {}, 价格规则数量: {}", modelName, modelPriceList.size()); + if (modelPriceList.isEmpty()) { + LOG.warn("模型价格列表为空,请检查模型价格表: {}", modelName); return accountFrozenDto.getFrozenAmount(); } + + // 4. 查找输入模型价格 ModelPrice inputModelPrice = findInputModelPrice(modelPriceList, accountFrozenDto.getEstimatedInputTokens()); + LOG.debug("查找输入模型价格 - estimatedInputTokens: {}, 匹配结果: {}", + accountFrozenDto.getEstimatedInputTokens(), + inputModelPrice != null ? "inputPerCent=" + inputModelPrice.getInputPerCent() : "未找到匹配"); + + // 5. 查找输出模型价格 ModelPrice outputModelPrice = findOutputModelPrice(modelPriceList, accountFrozenDto.getEstimatedOutputTokens()); + LOG.debug("查找输出模型价格 - estimatedOutputTokens: {}, 匹配结果: {}", + accountFrozenDto.getEstimatedOutputTokens(), + outputModelPrice != null ? "outputPerCent=" + outputModelPrice.getOutputPerCent() : "未找到匹配"); + if (inputModelPrice == null || outputModelPrice == null) { + LOG.warn("未找到匹配的模型价格规则 - inputModelPrice: {}, outputModelPrice: {}", + inputModelPrice != null ? "已找到" : "未找到", + outputModelPrice != null ? "已找到" : "未找到"); return accountFrozenDto.getFrozenAmount(); } + + // 6. 计算总的token费用 long totalFee = calculateTotalTokenFee(accountFrozenDto, inputModelPrice, outputModelPrice); + LOG.debug("计算token总费用 - inputFee: {}, outputFee: {}, totalFee: {}", + calculateTokenFee(accountFrozenDto.getEstimatedInputTokens(), inputModelPrice.getInputPerCent()), + calculateTokenFee(accountFrozenDto.getEstimatedOutputTokens(), outputModelPrice.getOutputPerCent()), + totalFee); + + // 7. 应用扣费系数 BigDecimal baseAmount = BigDecimal.valueOf(totalFee); - return baseAmount.multiply(accountDeductionProperties.getCoefficient()); + BigDecimal coefficient = accountDeductionProperties.getCoefficient(); + BigDecimal finalAmount = baseAmount.multiply(coefficient); + + LOG.info("token冻结金额计算完成 - sessionId: {}, 基础金额: {}分, 扣费系数: {}, 最终冻结金额: {}积分", + accountFrozenDto.getSessionId(), totalFee, coefficient, finalAmount); + + return finalAmount; } /** @@ -380,6 +424,7 @@ public class AccountFrozenServiceImpl implements AccountFrozenService { * @return 冻结单信息 */ @Override + @Transactional(rollbackFor = Exception.class) public AccountFrozen releaseFrozen(AccountReleaseDto accountReleaseDto) { // 1. 验证释放冻结单参数 validateReleaseParams(accountReleaseDto); @@ -490,7 +535,8 @@ public class AccountFrozenServiceImpl implements AccountFrozenService { accountFrozen.getModelName() == null) { return finalAmount; } - List modelPriceList = getModelPriceList(accountFrozen.getModelName()); + String modelName = normalizeModelName(accountFrozen.getModelName()); + List modelPriceList = getModelPriceList(modelName); if (modelPriceList.isEmpty()) { return finalAmount; } @@ -564,9 +610,6 @@ public class AccountFrozenServiceImpl implements AccountFrozenService { * @param finalAmount 最终扣减金额 */ private void doCreateTransaction(AccountFrozen accountFrozen, Account account, BigDecimal finalAmount) { - if (finalAmount.compareTo(BigDecimal.ZERO) <= 0) { - return; - } BigDecimal beforeBalance = account.getBalance() == null ? BigDecimal.ZERO : account.getBalance(); AccountTransaction transaction = buildTransaction(accountFrozen, account, finalAmount, beforeBalance); accountTransactionMapper.insert(transaction); @@ -664,4 +707,4 @@ public class AccountFrozenServiceImpl implements AccountFrozenService { return accountFrozenMapper.selectBySessionId(sessionId); } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/service/impl/AccountServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/AccountServiceImpl.java similarity index 94% rename from src/main/java/com/kexue/skills/service/impl/AccountServiceImpl.java rename to src/main/java/art/kexue/sxwz/service/impl/AccountServiceImpl.java index 32107cd..6513498 100644 --- a/src/main/java/com/kexue/skills/service/impl/AccountServiceImpl.java +++ b/src/main/java/art/kexue/sxwz/service/impl/AccountServiceImpl.java @@ -1,24 +1,24 @@ -package com.kexue.skills.service.impl; +package art.kexue.sxwz.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.Account; -import com.kexue.skills.entity.AccountTransaction; -import com.kexue.skills.entity.SysUser; -import com.kexue.skills.entity.dto.AccountDto; -import com.kexue.skills.entity.dto.AccountTransactionDto; -import com.kexue.skills.entity.dto.ConsumptionGroupedDto; -import com.kexue.skills.common.Assert; -import com.kexue.skills.entity.dto.TokenConsumptionDto; -import com.kexue.skills.exception.BizException; -import com.kexue.skills.mapper.AccountMapper; -import com.kexue.skills.mapper.AccountTransactionMapper; -import com.kexue.skills.mapper.SysUserMapper; -import com.kexue.skills.service.AccountService; -import com.kexue.skills.service.ModelPriceService; -import com.kexue.skills.service.PackageConfigService; -import com.kexue.skills.entity.ModelPrice; -import com.kexue.skills.entity.PackageConfig; +import art.kexue.sxwz.entity.Account; +import art.kexue.sxwz.entity.AccountTransaction; +import art.kexue.sxwz.entity.SysUser; +import art.kexue.sxwz.entity.dto.AccountDto; +import art.kexue.sxwz.entity.dto.AccountTransactionDto; +import art.kexue.sxwz.entity.dto.ConsumptionGroupedDto; +import art.kexue.sxwz.common.Assert; +import art.kexue.sxwz.entity.dto.TokenConsumptionDto; +import art.kexue.sxwz.exception.BizException; +import art.kexue.sxwz.mapper.AccountMapper; +import art.kexue.sxwz.mapper.AccountTransactionMapper; +import art.kexue.sxwz.mapper.SysUserMapper; +import art.kexue.sxwz.service.AccountService; +import art.kexue.sxwz.service.ModelPriceService; +import art.kexue.sxwz.service.PackageConfigService; +import art.kexue.sxwz.entity.ModelPrice; +import art.kexue.sxwz.entity.PackageConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -65,7 +65,9 @@ public class AccountServiceImpl implements AccountService { */ @Override public PageInfo getPageList(AccountDto queryDto) { - PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize()); + int pageNum = queryDto.getPageNum() == null ? 1 : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? 10 : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); List list = accountMapper.getPageList(queryDto); return new PageInfo<>(list); } @@ -530,7 +532,7 @@ public class AccountServiceImpl implements AccountService { * @return 交易记录列表 */ @Override - public List getTransactions(Long userId) { + public List getTransactions(Long userId) { return accountTransactionMapper.queryByUserId(userId); } @@ -542,7 +544,9 @@ public class AccountServiceImpl implements AccountService { */ @Override public PageInfo getRechargePageList(AccountTransactionDto queryDto) { - PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize()); + int pageNum = queryDto.getPageNum() == null ? 1 : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? 10 : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); List list = accountTransactionMapper.getRechargePageList(queryDto); return new PageInfo<>(list); } @@ -657,8 +661,10 @@ public class AccountServiceImpl implements AccountService { */ @Override public PageInfo getGiftPageList(AccountTransactionDto queryDto) { - PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize()); + int pageNum = queryDto.getPageNum() == null ? 1 : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? 10 : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); List list = accountTransactionMapper.getGiftPageList(queryDto); return new PageInfo<>(list); } -} \ No newline at end of file +} diff --git a/src/main/java/art/kexue/sxwz/service/impl/ComputeQuotaServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/ComputeQuotaServiceImpl.java new file mode 100644 index 0000000..0abbcf0 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/impl/ComputeQuotaServiceImpl.java @@ -0,0 +1,147 @@ +package art.kexue.sxwz.service.impl; + +import art.kexue.sxwz.common.Assert; +import art.kexue.sxwz.entity.ComputeQuota; +import art.kexue.sxwz.entity.dto.ComputeQuotaDto; +import art.kexue.sxwz.exception.BizException; +import art.kexue.sxwz.mapper.ComputeQuotaMapper; +import art.kexue.sxwz.service.ComputeQuotaService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service("computeQuotaService") +@Slf4j +public class ComputeQuotaServiceImpl implements ComputeQuotaService { + + @Resource + private ComputeQuotaMapper computeQuotaMapper; + + @Override + public ComputeQuota save(ComputeQuota quota) { + Assert.notNull(quota.getSubjectType(), "分配对象类型不能为空"); + Assert.notNull(quota.getSubjectId(), "关联ID不能为空"); + Assert.notBlank(quota.getSubjectName(), "名称不能为空"); + + ComputeQuota existing = computeQuotaMapper.queryBySubject(quota.getSubjectType(), quota.getSubjectId()); + Assert.isNull(existing, "该主体已存在配额记录"); + + if (quota.getAllocatedHours() == null) { + quota.setAllocatedHours(0L); + } + if (quota.getUsedHours() == null) { + quota.setUsedHours(0L); + } + + computeQuotaMapper.insert(quota); + log.info("创建算力配额成功,类型:{},ID:{},名称:{}", quota.getSubjectType(), quota.getSubjectId(), quota.getSubjectName()); + return quota; + } + + @Override + public ComputeQuota update(ComputeQuota quota) { + Assert.notNull(quota.getId(), "ID不能为空"); + + ComputeQuota existing = computeQuotaMapper.queryById(quota.getId()); + Assert.notNull(existing, "配额记录不存在"); + + computeQuotaMapper.updateByIdSelective(quota); + log.info("更新算力配额成功,ID:{}", quota.getId()); + return computeQuotaMapper.queryById(quota.getId()); + } + + @Override + public void delete(Long id) { + Assert.notNull(id, "ID不能为空"); + + ComputeQuota existing = computeQuotaMapper.queryById(id); + Assert.notNull(existing, "配额记录不存在"); + + computeQuotaMapper.deleteById(id); + log.info("删除算力配额成功,ID:{}", id); + } + + @Override + public ComputeQuota queryById(Long id) { + Assert.notNull(id, "ID不能为空"); + return computeQuotaMapper.queryById(id); + } + + @Override + public PageInfo getPageList(ComputeQuotaDto queryDto) { + int pageNum = queryDto.getPageNum() == null ? PAGENUM : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? PAGESIZE : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); + List dataList = computeQuotaMapper.getPageList(queryDto); + return new PageInfo<>(dataList); + } + + @Override + public List queryBySubjectType(Integer subjectType) { + Assert.notNull(subjectType, "分配对象类型不能为空"); + return computeQuotaMapper.queryBySubjectType(subjectType); + } + + @Override + public ComputeQuota queryBySubject(Integer subjectType, Long subjectId) { + Assert.notNull(subjectType, "分配对象类型不能为空"); + Assert.notNull(subjectId, "关联ID不能为空"); + return computeQuotaMapper.queryBySubject(subjectType, subjectId); + } + + @Override + public ComputeQuota getTotalQuota() { + return computeQuotaMapper.getTotalQuota(); + } + + @Override + public ComputeQuota allocateQuota(Integer subjectType, Long subjectId, String subjectName, Long hours) { + Assert.notNull(subjectType, "分配对象类型不能为空"); + Assert.notNull(subjectId, "关联ID不能为空"); + Assert.notBlank(subjectName, "名称不能为空"); + Assert.notNull(hours, "分配小时数不能为空"); + Assert.isTrue(hours >= 0, "分配小时数不能为负数"); + + ComputeQuota existing = computeQuotaMapper.queryBySubject(subjectType, subjectId); + + if (existing == null) { + ComputeQuota quota = new ComputeQuota(); + quota.setSubjectType(subjectType); + quota.setSubjectId(subjectId); + quota.setSubjectName(subjectName); + quota.setAllocatedHours(hours); + quota.setUsedHours(0L); + computeQuotaMapper.insert(quota); + log.info("新增算力配额:类型{},ID{},名称{},分配{}小时", subjectType, subjectId, subjectName, hours); + return quota; + } else { + existing.setAllocatedHours(existing.getAllocatedHours() + hours); + computeQuotaMapper.updateByIdSelective(existing); + log.info("追加算力配额:类型{},ID{},名称{},追加{}小时", subjectType, subjectId, subjectName, hours); + return computeQuotaMapper.queryById(existing.getId()); + } + } + + @Override + public boolean addUsedHours(Integer subjectType, Long subjectId, Long hours) { + Assert.notNull(subjectType, "分配对象类型不能为空"); + Assert.notNull(subjectId, "关联ID不能为空"); + Assert.notNull(hours, "使用小时数不能为空"); + Assert.isTrue(hours >= 0, "使用小时数不能为负数"); + + ComputeQuota quota = computeQuotaMapper.queryBySubject(subjectType, subjectId); + Assert.notNull(quota, "配额记录不存在"); + + if (quota.getUsedHours() + hours > quota.getAllocatedHours()) { + throw new BizException("算力不足,无法扣除"); + } + + computeQuotaMapper.updateUsedHours(subjectType, subjectId, quota.getUsedHours() + hours); + log.info("扣除算力:类型{},ID{},扣除{}小时", subjectType, subjectId, hours); + return true; + } +} \ No newline at end of file diff --git a/src/main/java/art/kexue/sxwz/service/impl/EduAttendanceServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/EduAttendanceServiceImpl.java new file mode 100644 index 0000000..043e9a1 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/impl/EduAttendanceServiceImpl.java @@ -0,0 +1,264 @@ +package art.kexue.sxwz.service.impl; + +import art.kexue.sxwz.entity.EduAttendance; +import art.kexue.sxwz.entity.EduAttendanceRecord; +import art.kexue.sxwz.entity.dto.EduAttendanceDto; +import art.kexue.sxwz.mapper.EduAttendanceMapper; +import art.kexue.sxwz.mapper.EduAttendanceRecordMapper; +import art.kexue.sxwz.mapper.EduCourseMapper; +import art.kexue.sxwz.mapper.EduCourseStudentMapper; +import art.kexue.sxwz.service.EduAttendanceService; +import art.kexue.sxwz.utils.QRCodeUtil; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +@Slf4j +@Service +public class EduAttendanceServiceImpl implements EduAttendanceService { + + @Resource + private EduAttendanceMapper eduAttendanceMapper; + + @Resource + private EduAttendanceRecordMapper eduAttendanceRecordMapper; + + @Resource + private EduCourseMapper eduCourseMapper; + + @Resource + private EduCourseStudentMapper eduCourseStudentMapper; + + @Override + @Transactional + public EduAttendance save(EduAttendance attendance) { + Date now = new Date(); + attendance.setCreateTime(now); + attendance.setUpdateTime(now); + eduAttendanceMapper.insert(attendance); + return attendance; + } + + @Override + @Transactional + public EduAttendance update(EduAttendance attendance) { + attendance.setUpdateTime(new Date()); + eduAttendanceMapper.updateByIdSelective(attendance); + return eduAttendanceMapper.queryById(attendance.getId()); + } + + @Override + @Transactional + public void delete(Long id) { + eduAttendanceMapper.deleteById(id); + } + + @Override + public EduAttendance queryById(Long id) { + return eduAttendanceMapper.queryById(id); + } + + @Override + public List queryByCourseId(Long courseId) { + return eduAttendanceMapper.queryByCourseId(courseId); + } + + @Override + public List queryByTeacherId(Long teacherId) { + return eduAttendanceMapper.queryByTeacherId(teacherId); + } + + @Override + @Transactional + public EduAttendanceRecord recordAttendance(Long attendanceId, Long studentId) { + EduAttendance attendance = eduAttendanceMapper.queryById(attendanceId); + if (attendance == null) { + return null; + } + + EduAttendanceRecord existing = eduAttendanceRecordMapper.queryByAttendanceIdAndStudentId(attendanceId, studentId); + if (existing != null) { + existing.setStatus(1); + existing.setRecordTime(new Date()); + eduAttendanceRecordMapper.updateByIdSelective(existing); + return existing; + } + + EduAttendanceRecord record = new EduAttendanceRecord(); + record.setSchoolId(attendance.getSchoolId()); + record.setAttendanceId(attendanceId); + record.setStudentId(studentId); + record.setStatus(1); + record.setRecordTime(new Date()); + record.setCreateTime(new Date()); + eduAttendanceRecordMapper.insert(record); + return record; + } + + @Override + public EduAttendanceRecord queryRecordById(Long id) { + return eduAttendanceRecordMapper.queryById(id); + } + + @Override + public List queryRecordsByAttendanceId(Long attendanceId) { + return eduAttendanceRecordMapper.queryByAttendanceId(attendanceId); + } + + @Override + public List queryRecordsByStudentId(Long studentId) { + return eduAttendanceRecordMapper.queryByStudentId(studentId); + } + + @Override + @Transactional + public void batchCreateRecords(Long attendanceId, List studentIds) { + EduAttendance attendance = eduAttendanceMapper.queryById(attendanceId); + if (attendance == null) { + return; + } + + List records = new ArrayList<>(); + Date now = new Date(); + + for (Long studentId : studentIds) { + EduAttendanceRecord record = new EduAttendanceRecord(); + record.setSchoolId(attendance.getSchoolId()); + record.setAttendanceId(attendanceId); + record.setStudentId(studentId); + record.setStatus(0); + record.setCreateTime(now); + records.add(record); + } + + if (!records.isEmpty()) { + eduAttendanceRecordMapper.batchInsert(records); + } + } + + @Override + @Transactional + public EduAttendance createAttendance(Long schoolId, Long courseId, Integer duration) { + Date now = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + String name = sdf.format(now) + " 上课签到"; + + EduAttendance attendance = new EduAttendance(); + attendance.setSchoolId(schoolId); + attendance.setCourseId(courseId); + attendance.setName(name); + attendance.setStartTime(now); + attendance.setDuration(duration != null ? duration : 30); + attendance.setType(1); + attendance.setStatus(1); + attendance.setCreateTime(now); + attendance.setUpdateTime(now); + + eduAttendanceMapper.insert(attendance); + + generateQRCode(attendance.getId()); + + log.info("创建上课签到成功,考勤ID: {}, 课程ID: {}", attendance.getId(), courseId); + return attendance; + } + + @Override + public String generateQRCode(Long attendanceId) { + EduAttendance attendance = eduAttendanceMapper.queryById(attendanceId); + if (attendance == null) { + return null; + } + + String qrCodeContent = "SXWZ_ATTENDANCE_" + attendanceId + "_" + UUID.randomUUID().toString().replace("-", ""); + + String qrCodeBase64 = QRCodeUtil.generateQRCodeBase64(qrCodeContent, 300, 300); + + attendance.setQrCode(qrCodeContent); + attendance.setUpdateTime(new Date()); + eduAttendanceMapper.updateByIdSelective(attendance); + + log.info("生成签到二维码成功,考勤ID: {}", attendanceId); + return qrCodeBase64; + } + + @Override + @Transactional + public EduAttendanceRecord scanQRCode(String qrCodeContent, Long studentId) { + if (!qrCodeContent.startsWith("SXWZ_ATTENDANCE_")) { + return null; + } + + String[] parts = qrCodeContent.split("_"); + if (parts.length < 3) { + return null; + } + + Long attendanceId; + try { + attendanceId = Long.parseLong(parts[2]); + } catch (NumberFormatException e) { + return null; + } + + EduAttendance attendance = eduAttendanceMapper.queryById(attendanceId); + if (attendance == null || attendance.getStatus() != 1) { + return null; + } + + Date now = new Date(); + long diffMinutes = (now.getTime() - attendance.getStartTime().getTime()) / (60 * 1000); + + EduAttendanceRecord existing = eduAttendanceRecordMapper.queryByAttendanceIdAndStudentId(attendanceId, studentId); + if (existing != null) { + int status = diffMinutes <= attendance.getDuration() ? 1 : 2; + existing.setStatus(status); + existing.setSignTime(now); + existing.setRecordTime(now); + eduAttendanceRecordMapper.updateByIdSelective(existing); + return existing; + } + + EduAttendanceRecord record = new EduAttendanceRecord(); + record.setSchoolId(attendance.getSchoolId()); + record.setAttendanceId(attendanceId); + record.setStudentId(studentId); + record.setStatus(diffMinutes <= attendance.getDuration() ? 1 : 2); + record.setSignTime(now); + record.setRecordTime(now); + record.setCreateTime(now); + eduAttendanceRecordMapper.insert(record); + + log.info("学生签到成功,考勤ID: {}, 学生ID: {}", attendanceId, studentId); + return record; + } + + @Override + @Transactional + public void closeAttendance(Long attendanceId) { + EduAttendance attendance = eduAttendanceMapper.queryById(attendanceId); + if (attendance != null) { + attendance.setStatus(2); + attendance.setUpdateTime(new Date()); + eduAttendanceMapper.updateByIdSelective(attendance); + log.info("关闭签到成功,考勤ID: {}", attendanceId); + } + } + + @Override + public PageInfo getPageList(EduAttendanceDto queryDto) { + int pageNum = queryDto.getPageNum() == null ? PAGENUM : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? PAGESIZE : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); + List dataList = eduAttendanceMapper.getPageList(queryDto); + return new PageInfo<>(dataList); + } +} diff --git a/src/main/java/art/kexue/sxwz/service/impl/EduCollegeServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/EduCollegeServiceImpl.java new file mode 100644 index 0000000..48f2e71 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/impl/EduCollegeServiceImpl.java @@ -0,0 +1,102 @@ +package art.kexue.sxwz.service.impl; + +import art.kexue.sxwz.common.Assert; +import art.kexue.sxwz.entity.EduCollege; +import art.kexue.sxwz.entity.dto.EduCollegeDto; +import art.kexue.sxwz.mapper.EduCollegeMapper; +import art.kexue.sxwz.service.EduCollegeService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service("eduCollegeService") +@Slf4j +public class EduCollegeServiceImpl implements EduCollegeService { + + @Resource + private EduCollegeMapper eduCollegeMapper; + + @Override + public EduCollege save(EduCollege college) { + Assert.notBlank(college.getName(), "学院名称不能为空"); + + EduCollege existing = eduCollegeMapper.queryByName(college.getName()); + Assert.isNull(existing, "学院名称已存在"); + + if (college.getStatus() == null) { + college.setStatus(1); + } + if (college.getTeacherCount() == null) { + college.setTeacherCount(0); + } + if (college.getStudentCount() == null) { + college.setStudentCount(0); + } + if (college.getDeleted() == null) { + college.setDeleted(0); + } + + eduCollegeMapper.insert(college); + log.info("创建学院成功,名称:{}", college.getName()); + return college; + } + + @Override + public EduCollege update(EduCollege college) { + Assert.notNull(college.getId(), "ID不能为空"); + + EduCollege existing = eduCollegeMapper.queryById(college.getId()); + Assert.notNull(existing, "学院不存在"); + + if (college.getName() != null && !college.getName().equals(existing.getName())) { + EduCollege byName = eduCollegeMapper.queryByName(college.getName()); + Assert.isNull(byName, "学院名称已存在"); + } + + eduCollegeMapper.updateByIdSelective(college); + log.info("更新学院成功,ID:{}", college.getId()); + return eduCollegeMapper.queryById(college.getId()); + } + + @Override + public void delete(Long id) { + Assert.notNull(id, "ID不能为空"); + + EduCollege existing = eduCollegeMapper.queryById(id); + Assert.notNull(existing, "学院不存在"); + + eduCollegeMapper.deleteById(id); + log.info("删除学院成功,ID:{}", id); + } + + @Override + public EduCollege queryById(Long id) { + Assert.notNull(id, "ID不能为空"); + return eduCollegeMapper.queryById(id); + } + + @Override + public PageInfo getPageList(EduCollegeDto queryDto) { + int pageNum = queryDto.getPageNum() == null ? PAGENUM : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? PAGESIZE : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); + List dataList = eduCollegeMapper.getPageList(queryDto); + return new PageInfo<>(dataList); + } + + @Override + public List queryAll() { + EduCollegeDto queryDto = new EduCollegeDto(); + return eduCollegeMapper.getPageList(queryDto); + } + + @Override + public EduCollege queryByName(String name) { + Assert.notBlank(name, "学院名称不能为空"); + return eduCollegeMapper.queryByName(name); + } +} \ No newline at end of file diff --git a/src/main/java/art/kexue/sxwz/service/impl/EduCourseServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/EduCourseServiceImpl.java new file mode 100644 index 0000000..5d3c28b --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/impl/EduCourseServiceImpl.java @@ -0,0 +1,267 @@ +package art.kexue.sxwz.service.impl; + +import art.kexue.sxwz.entity.EduCourse; +import art.kexue.sxwz.entity.EduCourseStudent; +import art.kexue.sxwz.entity.EduStudent; +import art.kexue.sxwz.entity.dto.EduCourseDto; +import art.kexue.sxwz.entity.request.BatchBindResultDto; +import art.kexue.sxwz.mapper.EduCourseMapper; +import art.kexue.sxwz.mapper.EduCourseStudentMapper; +import art.kexue.sxwz.mapper.EduStudentMapper; +import art.kexue.sxwz.service.EduCourseService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Slf4j +@Service +public class EduCourseServiceImpl implements EduCourseService { + + @Resource + private EduCourseMapper eduCourseMapper; + + @Resource + private EduCourseStudentMapper eduCourseStudentMapper; + + @Resource + private EduStudentMapper eduStudentMapper; + + @Override + @Transactional + public EduCourse save(EduCourse course) { + Date now = new Date(); + course.setCreateTime(now); + course.setUpdateTime(now); + eduCourseMapper.insert(course); + return course; + } + + @Override + @Transactional + public EduCourse update(EduCourse course) { + course.setUpdateTime(new Date()); + eduCourseMapper.updateByIdSelective(course); + return eduCourseMapper.queryById(course.getId()); + } + + @Override + @Transactional + public void delete(Long id) { + eduCourseStudentMapper.deleteByCourseId(id); + eduCourseMapper.deleteById(id); + } + + @Override + public EduCourse queryById(Long id) { + return eduCourseMapper.queryById(id); + } + + @Override + public List queryByTeacherId(Long teacherId) { + return eduCourseMapper.queryByTeacherId(teacherId); + } + + @Override + public List queryBySchoolId(Long schoolId) { + return eduCourseMapper.queryBySchoolId(schoolId); + } + + @Override + public List queryByStudentId(Long studentId) { + return eduCourseMapper.queryByStudentId(studentId); + } + + @Override + @Transactional + public void addStudent(Long courseId, Long studentId) { + EduCourse course = eduCourseMapper.queryById(courseId); + if (course != null && !isStudentInCourse(courseId, studentId)) { + EduCourseStudent cs = new EduCourseStudent(); + cs.setSchoolId(course.getSchoolId()); + cs.setCourseId(courseId); + cs.setStudentId(studentId); + cs.setJoinTime(new Date()); + cs.setIsKicked(0); + eduCourseStudentMapper.insert(cs); + } + } + + @Override + @Transactional + public void removeStudent(Long courseId, Long studentId) { + EduCourseStudent cs = eduCourseStudentMapper.queryByCourseIdAndStudentId(courseId, studentId); + if (cs != null) { + cs.setIsKicked(1); + eduCourseStudentMapper.updateByIdSelective(cs); + } + } + + @Override + public Boolean isStudentInCourse(Long courseId, Long studentId) { + EduCourseStudent cs = eduCourseStudentMapper.queryByCourseIdAndStudentId(courseId, studentId); + return cs != null && cs.getIsKicked() == 0; + } + + @Override + public PageInfo getPageList(EduCourseDto queryDto) { + int pageNum = queryDto.getPageNum() == null ? PAGENUM : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? PAGESIZE : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); + List dataList = eduCourseMapper.getPageList(queryDto); + return new PageInfo<>(dataList); + } + + @Override + @Transactional + public BatchBindResultDto batchBindStudents(Long courseId, byte[] excelBytes, boolean append) { + BatchBindResultDto result = new BatchBindResultDto(); + List failItems = new ArrayList<>(); + int successCount = 0; + int failCount = 0; + int totalCount = 0; + + EduCourse course = eduCourseMapper.queryById(courseId); + if (course == null) { + BatchBindResultDto.FailItem item = new BatchBindResultDto.FailItem(); + item.setRowNum(0); + item.setStudentIdentifier(""); + item.setReason("课程不存在"); + failItems.add(item); + result.setFailItems(failItems); + result.setSuccessCount(0); + result.setFailCount(1); + result.setTotalCount(1); + return result; + } + + if (!append) { + eduCourseStudentMapper.deleteByCourseId(courseId); + log.info("覆盖模式:已清除课程{}的所有学生绑定", courseId); + } + + try (InputStream inputStream = new ByteArrayInputStream(excelBytes); + Workbook workbook = new XSSFWorkbook(inputStream)) { + + Sheet sheet = workbook.getSheetAt(0); + int lastRowNum = sheet.getLastRowNum(); + + for (int i = 1; i <= lastRowNum; i++) { + Row row = sheet.getRow(i); + if (row == null) { + continue; + } + + totalCount++; + String studentIdentifier = getCellValueAsString(row.getCell(0)); + + if (studentIdentifier == null || studentIdentifier.trim().isEmpty()) { + continue; + } + + try { + EduStudent student = eduStudentMapper.queryByStudentNo(studentIdentifier.trim()); + if (student == null) { + student = eduStudentMapper.queryByRealName(studentIdentifier.trim()); + } + + if (student == null) { + BatchBindResultDto.FailItem item = new BatchBindResultDto.FailItem(); + item.setRowNum(i + 1); + item.setStudentIdentifier(studentIdentifier); + item.setReason("学生不存在"); + failItems.add(item); + failCount++; + continue; + } + + if (isStudentInCourse(courseId, student.getId())) { + if (!append) { + successCount++; + } else { + BatchBindResultDto.FailItem item = new BatchBindResultDto.FailItem(); + item.setRowNum(i + 1); + item.setStudentIdentifier(studentIdentifier); + item.setReason("学生已在课程中"); + failItems.add(item); + failCount++; + } + continue; + } + + EduCourseStudent cs = new EduCourseStudent(); + cs.setSchoolId(course.getSchoolId()); + cs.setCourseId(courseId); + cs.setStudentId(student.getId()); + cs.setJoinTime(new Date()); + cs.setIsKicked(0); + eduCourseStudentMapper.insert(cs); + successCount++; + + } catch (Exception e) { + log.error("处理第{}行学生{}时发生异常: {}", i + 1, studentIdentifier, e.getMessage()); + BatchBindResultDto.FailItem item = new BatchBindResultDto.FailItem(); + item.setRowNum(i + 1); + item.setStudentIdentifier(studentIdentifier); + item.setReason("处理异常: " + e.getMessage()); + failItems.add(item); + failCount++; + } + } + + } catch (Exception e) { + log.error("解析Excel文件失败: {}", e.getMessage()); + BatchBindResultDto.FailItem item = new BatchBindResultDto.FailItem(); + item.setRowNum(0); + item.setStudentIdentifier(""); + item.setReason("Excel文件解析失败: " + e.getMessage()); + failItems.add(item); + failCount++; + totalCount++; + } + + result.setSuccessCount(successCount); + result.setFailCount(failCount); + result.setTotalCount(totalCount); + result.setFailItems(failItems); + + log.info("批量绑定完成:总数={}, 成功={}, 失败={}", totalCount, successCount, failCount); + return result; + } + + private String getCellValueAsString(Cell cell) { + if (cell == null) { + return null; + } + + switch (cell.getCellType()) { + case STRING: + return cell.getStringCellValue(); + case NUMERIC: + if (DateUtil.isCellDateFormatted(cell)) { + return cell.getLocalDateTimeCellValue().toString(); + } + return String.valueOf((long) cell.getNumericCellValue()); + case BOOLEAN: + return String.valueOf(cell.getBooleanCellValue()); + case FORMULA: + try { + return cell.getStringCellValue(); + } catch (Exception e) { + return String.valueOf(cell.getNumericCellValue()); + } + default: + return null; + } + } +} diff --git a/src/main/java/art/kexue/sxwz/service/impl/EduExamServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/EduExamServiceImpl.java new file mode 100644 index 0000000..eaf27f5 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/impl/EduExamServiceImpl.java @@ -0,0 +1,168 @@ +package art.kexue.sxwz.service.impl; + +import art.kexue.sxwz.entity.EduExam; +import art.kexue.sxwz.entity.EduExamPaper; +import art.kexue.sxwz.entity.dto.EduExamDto; +import art.kexue.sxwz.mapper.EduExamMapper; +import art.kexue.sxwz.mapper.EduExamPaperMapper; +import art.kexue.sxwz.service.EduExamService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Service +public class EduExamServiceImpl implements EduExamService { + + @Resource + private EduExamMapper eduExamMapper; + + @Resource + private EduExamPaperMapper eduExamPaperMapper; + + @Override + @Transactional + public EduExam save(EduExam exam) { + Date now = new Date(); + exam.setCreateTime(now); + exam.setUpdateTime(now); + eduExamMapper.insert(exam); + return exam; + } + + @Override + @Transactional + public EduExam update(EduExam exam) { + exam.setUpdateTime(new Date()); + eduExamMapper.updateByIdSelective(exam); + return eduExamMapper.queryById(exam.getId()); + } + + @Override + @Transactional + public void delete(Long id) { + eduExamMapper.deleteById(id); + } + + @Override + public EduExam queryById(Long id) { + return eduExamMapper.queryById(id); + } + + @Override + public List queryByCourseId(Long courseId) { + return eduExamMapper.queryByCourseId(courseId); + } + + @Override + public List queryByTeacherId(Long teacherId) { + return eduExamMapper.queryByTeacherId(teacherId); + } + + @Override + public List queryByStudentId(Long studentId) { + return eduExamMapper.queryByStudentId(studentId); + } + + @Override + @Transactional + public EduExam createMakeupExam(Long parentExamId) { + EduExam parent = eduExamMapper.queryById(parentExamId); + if (parent == null) { + return null; + } + + EduExam makeup = new EduExam(); + makeup.setSchoolId(parent.getSchoolId()); + makeup.setCourseId(parent.getCourseId()); + makeup.setName(parent.getName() + "(补考)"); + makeup.setQuestions(parent.getQuestions()); + makeup.setDuration(parent.getDuration()); + makeup.setAllowRetake(0); + makeup.setTotalScore(parent.getTotalScore()); + makeup.setPassScore(parent.getPassScore()); + makeup.setParentExamId(parentExamId); + makeup.setStatus(1); + + Date now = new Date(); + makeup.setCreateTime(now); + makeup.setUpdateTime(now); + + eduExamMapper.insert(makeup); + return makeup; + } + + @Override + @Transactional + public EduExamPaper submitExam(Long examId, Long studentId, String answer) { + EduExam exam = eduExamMapper.queryById(examId); + if (exam == null) { + return null; + } + + Date now = new Date(); + + EduExamPaper existing = eduExamPaperMapper.queryByExamIdAndStudentId(examId, studentId); + if (existing != null) { + if (exam.getAllowRetake() == 1) { + existing.setAnswers(answer); + existing.setSubmitTime(now); + existing.setStatus(1); + eduExamPaperMapper.updateByIdSelective(existing); + return existing; + } + return existing; + } + + EduExamPaper paper = new EduExamPaper(); + paper.setSchoolId(exam.getSchoolId()); + paper.setExamId(examId); + paper.setStudentId(studentId); + paper.setAnswers(answer); + paper.setSubmitTime(now); + paper.setStatus(1); + eduExamPaperMapper.insert(paper); + return paper; + } + + @Override + @Transactional + public EduExamPaper gradeExam(Long paperId, Double score) { + EduExamPaper paper = eduExamPaperMapper.queryById(paperId); + if (paper != null) { + paper.setScore(BigDecimal.valueOf(score)); + paper.setStatus(2); + eduExamPaperMapper.updateByIdSelective(paper); + } + return paper; + } + + @Override + public EduExamPaper queryPaperById(Long paperId) { + return eduExamPaperMapper.queryById(paperId); + } + + @Override + public List queryPapersByExamId(Long examId) { + return eduExamPaperMapper.queryByExamId(examId); + } + + @Override + public EduExamPaper queryPaperByExamIdAndStudentId(Long examId, Long studentId) { + return eduExamPaperMapper.queryByExamIdAndStudentId(examId, studentId); + } + + @Override + public PageInfo getPageList(EduExamDto queryDto) { + int pageNum = queryDto.getPageNum() == null ? PAGENUM : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? PAGESIZE : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); + List dataList = eduExamMapper.getPageList(queryDto); + return new PageInfo<>(dataList); + } +} diff --git a/src/main/java/art/kexue/sxwz/service/impl/EduExcellentWorkServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/EduExcellentWorkServiceImpl.java new file mode 100644 index 0000000..14ee35f --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/impl/EduExcellentWorkServiceImpl.java @@ -0,0 +1,163 @@ +package art.kexue.sxwz.service.impl; + +import art.kexue.sxwz.entity.EduExcellentWork; +import art.kexue.sxwz.entity.EduWorkLike; +import art.kexue.sxwz.entity.EduHomeworkSubmit; +import art.kexue.sxwz.entity.EduExamPaper; +import art.kexue.sxwz.entity.dto.EduExcellentWorkDto; +import art.kexue.sxwz.mapper.EduExcellentWorkMapper; +import art.kexue.sxwz.mapper.EduWorkLikeMapper; +import art.kexue.sxwz.mapper.EduHomeworkSubmitMapper; +import art.kexue.sxwz.mapper.EduExamPaperMapper; +import art.kexue.sxwz.service.EduExcellentWorkService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Service +public class EduExcellentWorkServiceImpl implements EduExcellentWorkService { + + @Resource + private EduExcellentWorkMapper eduExcellentWorkMapper; + + @Resource + private EduWorkLikeMapper eduWorkLikeMapper; + + @Resource + private EduHomeworkSubmitMapper eduHomeworkSubmitMapper; + + @Resource + private EduExamPaperMapper eduExamPaperMapper; + + @Override + @Transactional + public EduExcellentWork save(EduExcellentWork work) { + work.setCreateTime(new Date()); + eduExcellentWorkMapper.insert(work); + return work; + } + + @Override + @Transactional + public void delete(Long id) { + eduExcellentWorkMapper.deleteById(id); + } + + @Override + public EduExcellentWork queryById(Long id) { + return eduExcellentWorkMapper.queryById(id); + } + + @Override + public List queryBySchoolId(Long schoolId) { + return eduExcellentWorkMapper.queryBySchoolId(schoolId); + } + + @Override + public List queryByStudentId(Long studentId) { + return eduExcellentWorkMapper.queryByStudentId(studentId); + } + + @Override + public EduExcellentWork queryBySubmitId(Long submitId) { + return eduExcellentWorkMapper.queryBySubmitId(submitId); + } + + @Override + @Transactional + public void addLike(Long workId, Long userId) { + EduExcellentWork work = eduExcellentWorkMapper.queryById(workId); + if (work == null) { + return; + } + + EduWorkLike existing = eduWorkLikeMapper.queryByWorkIdAndUserId(workId, userId); + if (existing == null) { + EduWorkLike like = new EduWorkLike(); + like.setSchoolId(work.getSchoolId()); + like.setWorkId(workId); + like.setUserId(userId); + like.setCreateTime(new Date()); + eduWorkLikeMapper.insert(like); + } + } + + @Override + @Transactional + public void removeLike(Long workId, Long userId) { + eduWorkLikeMapper.deleteByWorkIdAndUserId(workId, userId); + } + + @Override + public boolean hasLiked(Long workId, Long userId) { + return eduWorkLikeMapper.queryByWorkIdAndUserId(workId, userId) != null; + } + + @Override + public int countLikes(Long workId) { + return eduWorkLikeMapper.countByWorkId(workId); + } + + @Override + @Transactional + public EduExcellentWork markAsExcellent(Long submitId, Integer workType, Double score, String comment) { + EduExcellentWork existing = eduExcellentWorkMapper.queryBySubmitId(submitId); + if (existing != null) { + return existing; + } + + Long schoolId = null; + Long studentId = null; + + if (workType == 1) { + EduHomeworkSubmit submit = eduHomeworkSubmitMapper.queryById(submitId); + if (submit != null) { + schoolId = submit.getSchoolId(); + studentId = submit.getStudentId(); + if (score == null && submit.getScore() != null) { + score = submit.getScore().doubleValue(); + } + } + } else if (workType == 2) { + EduExamPaper paper = eduExamPaperMapper.queryById(submitId); + if (paper != null) { + schoolId = paper.getSchoolId(); + studentId = paper.getStudentId(); + if (score == null && paper.getScore() != null) { + score = paper.getScore().doubleValue(); + } + } + } + + if (schoolId == null || studentId == null) { + return null; + } + + EduExcellentWork work = new EduExcellentWork(); + work.setSchoolId(schoolId); + work.setWorkType(workType); + work.setSubmitId(submitId); + work.setStudentId(studentId); + work.setScore(score != null ? BigDecimal.valueOf(score) : null); + work.setComment(comment); + work.setCreateTime(new Date()); + + eduExcellentWorkMapper.insert(work); + return work; + } + + @Override + public PageInfo getPageList(EduExcellentWorkDto queryDto) { + int pageNum = queryDto.getPageNum() == null ? PAGENUM : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? PAGESIZE : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); + List dataList = eduExcellentWorkMapper.getPageList(queryDto); + return new PageInfo<>(dataList); + } +} diff --git a/src/main/java/art/kexue/sxwz/service/impl/EduHomeworkServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/EduHomeworkServiceImpl.java new file mode 100644 index 0000000..1f779f0 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/impl/EduHomeworkServiceImpl.java @@ -0,0 +1,145 @@ +package art.kexue.sxwz.service.impl; + +import art.kexue.sxwz.entity.EduHomework; +import art.kexue.sxwz.entity.EduHomeworkSubmit; +import art.kexue.sxwz.entity.dto.EduHomeworkDto; +import art.kexue.sxwz.mapper.EduHomeworkMapper; +import art.kexue.sxwz.mapper.EduHomeworkSubmitMapper; +import art.kexue.sxwz.mapper.EduCourseMapper; +import art.kexue.sxwz.service.EduHomeworkService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +@Service +public class EduHomeworkServiceImpl implements EduHomeworkService { + + @Resource + private EduHomeworkMapper eduHomeworkMapper; + + @Resource + private EduHomeworkSubmitMapper eduHomeworkSubmitMapper; + + @Resource + private EduCourseMapper eduCourseMapper; + + @Override + @Transactional + public EduHomework save(EduHomework homework) { + Date now = new Date(); + homework.setCreateTime(now); + homework.setUpdateTime(now); + eduHomeworkMapper.insert(homework); + return homework; + } + + @Override + @Transactional + public EduHomework update(EduHomework homework) { + homework.setUpdateTime(new Date()); + eduHomeworkMapper.updateByIdSelective(homework); + return eduHomeworkMapper.queryById(homework.getId()); + } + + @Override + @Transactional + public void delete(Long id) { + eduHomeworkMapper.deleteById(id); + } + + @Override + public EduHomework queryById(Long id) { + return eduHomeworkMapper.queryById(id); + } + + @Override + public List queryByCourseId(Long courseId) { + return eduHomeworkMapper.queryByCourseId(courseId); + } + + @Override + public List queryByTeacherId(Long teacherId) { + return eduHomeworkMapper.queryByTeacherId(teacherId); + } + + @Override + public List queryByStudentId(Long studentId) { + return eduHomeworkMapper.queryByStudentId(studentId); + } + + @Override + @Transactional + public EduHomeworkSubmit submitHomework(Long homeworkId, Long studentId, String answer) { + EduHomework homework = eduHomeworkMapper.queryById(homeworkId); + if (homework == null) { + return null; + } + + Date now = new Date(); + boolean isLate = now.after(homework.getEndTime()); + + EduHomeworkSubmit existing = eduHomeworkSubmitMapper.queryByHomeworkIdAndStudentId(homeworkId, studentId); + if (existing != null) { + existing.setAnswer(answer); + existing.setSubmitTime(now); + existing.setIsLate(isLate ? 1 : 0); + eduHomeworkSubmitMapper.updateByIdSelective(existing); + return existing; + } + + EduHomeworkSubmit submit = new EduHomeworkSubmit(); + submit.setSchoolId(homework.getSchoolId()); + submit.setHomeworkId(homeworkId); + submit.setStudentId(studentId); + submit.setAnswer(answer); + submit.setSubmitTime(now); + submit.setIsLate(isLate ? 1 : 0); + submit.setStatus(1); + submit.setCreateTime(now); + eduHomeworkSubmitMapper.insert(submit); + return submit; + } + + @Override + @Transactional + public EduHomeworkSubmit gradeHomework(Long submitId, Double score, String comment) { + EduHomeworkSubmit submit = eduHomeworkSubmitMapper.queryById(submitId); + if (submit != null) { + submit.setScore(BigDecimal.valueOf(score)); + submit.setComment(comment); + submit.setStatus(2); + eduHomeworkSubmitMapper.updateByIdSelective(submit); + } + return submit; + } + + @Override + public EduHomeworkSubmit querySubmitById(Long submitId) { + return eduHomeworkSubmitMapper.queryById(submitId); + } + + @Override + public List querySubmitsByHomeworkId(Long homeworkId) { + return eduHomeworkSubmitMapper.queryByHomeworkId(homeworkId); + } + + @Override + public EduHomeworkSubmit querySubmitByHomeworkIdAndStudentId(Long homeworkId, Long studentId) { + return eduHomeworkSubmitMapper.queryByHomeworkIdAndStudentId(homeworkId, studentId); + } + + @Override + public PageInfo getPageList(EduHomeworkDto queryDto) { + int pageNum = queryDto.getPageNum() == null ? PAGENUM : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? PAGESIZE : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); + List dataList = eduHomeworkMapper.getPageList(queryDto); + return new PageInfo<>(dataList); + } +} diff --git a/src/main/java/art/kexue/sxwz/service/impl/EduSchoolServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/EduSchoolServiceImpl.java new file mode 100644 index 0000000..07e323d --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/impl/EduSchoolServiceImpl.java @@ -0,0 +1,81 @@ +package art.kexue.sxwz.service.impl; + +import art.kexue.sxwz.entity.EduSchool; +import art.kexue.sxwz.entity.dto.EduSchoolDto; +import art.kexue.sxwz.mapper.EduSchoolMapper; +import art.kexue.sxwz.service.EduSchoolService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +@Service +public class EduSchoolServiceImpl implements EduSchoolService { + + @Resource + private EduSchoolMapper eduSchoolMapper; + + @Override + @Transactional + public EduSchool save(EduSchool school) { + Date now = new Date(); + school.setCreateTime(now); + school.setUpdateTime(now); + eduSchoolMapper.insert(school); + return school; + } + + @Override + @Transactional + public EduSchool update(EduSchool school) { + school.setUpdateTime(new Date()); + eduSchoolMapper.updateByIdSelective(school); + return eduSchoolMapper.queryById(school.getId()); + } + + @Override + @Transactional + public void delete(Long id) { + eduSchoolMapper.deleteById(id); + } + + @Override + public EduSchool queryById(Long id) { + return eduSchoolMapper.queryById(id); + } + + @Override + public List queryAll() { + return eduSchoolMapper.queryAll(); + } + + @Override + public List queryListByStatus(Integer status) { + return eduSchoolMapper.queryListByStatus(status); + } + + @Override + public PageInfo getPageList(EduSchoolDto queryDto) { + int pageNum = queryDto.getPageNum() == null ? PAGENUM : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? PAGESIZE : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); + List dataList = eduSchoolMapper.getPageList(queryDto); + return new PageInfo<>(dataList); + } + + @Override + @Transactional + public EduSchool updateStatus(Long id, Integer status) { + EduSchool school = eduSchoolMapper.queryById(id); + if (school != null) { + school.setStatus(status); + school.setUpdateTime(new Date()); + eduSchoolMapper.updateByIdSelective(school); + } + return school; + } +} diff --git a/src/main/java/art/kexue/sxwz/service/impl/EduStudentServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/EduStudentServiceImpl.java new file mode 100644 index 0000000..5e5a4ac --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/impl/EduStudentServiceImpl.java @@ -0,0 +1,97 @@ +package art.kexue.sxwz.service.impl; + +import art.kexue.sxwz.entity.EduStudent; +import art.kexue.sxwz.entity.dto.EduStudentDto; +import art.kexue.sxwz.mapper.EduStudentMapper; +import art.kexue.sxwz.service.EduStudentService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +@Service +public class EduStudentServiceImpl implements EduStudentService { + + @Resource + private EduStudentMapper eduStudentMapper; + + @Override + @Transactional + public EduStudent save(EduStudent student) { + Date now = new Date(); + student.setCreateTime(now); + student.setUpdateTime(now); + eduStudentMapper.insert(student); + return student; + } + + @Override + @Transactional + public EduStudent update(EduStudent student) { + student.setUpdateTime(new Date()); + eduStudentMapper.updateByIdSelective(student); + return eduStudentMapper.queryById(student.getId()); + } + + @Override + @Transactional + public void delete(Long id) { + eduStudentMapper.deleteById(id); + } + + @Override + public EduStudent queryById(Long id) { + return eduStudentMapper.queryById(id); + } + + @Override + public EduStudent queryByUserId(Long userId) { + return eduStudentMapper.queryByUserId(userId); + } + + @Override + public List queryListBySchoolId(Long schoolId) { + return eduStudentMapper.queryListBySchoolId(schoolId); + } + + @Override + public List queryListByCollegeId(Long collegeId) { + return eduStudentMapper.queryListByCollegeId(collegeId); + } + + @Override + public List queryByClass(Long schoolId, Long collegeId, Long majorId, String grade, String className) { + return eduStudentMapper.queryByClass(schoolId, collegeId, majorId, grade, className); + } + + @Override + public EduStudent queryByActivationCode(String activationCode) { + return eduStudentMapper.queryByActivationCode(activationCode); + } + + @Override + @Transactional + public EduStudent bindUser(Long studentId, Long userId) { + EduStudent student = eduStudentMapper.queryById(studentId); + if (student != null) { + student.setUserId(userId); + student.setBindingStatus(1); + student.setUpdateTime(new Date()); + eduStudentMapper.updateByIdSelective(student); + } + return student; + } + + @Override + public PageInfo getPageList(EduStudentDto queryDto) { + int pageNum = queryDto.getPageNum() == null ? PAGENUM : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? PAGESIZE : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); + List dataList = eduStudentMapper.getPageList(queryDto); + return new PageInfo<>(dataList); + } +} diff --git a/src/main/java/art/kexue/sxwz/service/impl/EduTeacherServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/EduTeacherServiceImpl.java new file mode 100644 index 0000000..2558c47 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/impl/EduTeacherServiceImpl.java @@ -0,0 +1,92 @@ +package art.kexue.sxwz.service.impl; + +import art.kexue.sxwz.entity.EduTeacher; +import art.kexue.sxwz.entity.dto.EduTeacherDto; +import art.kexue.sxwz.mapper.EduTeacherMapper; +import art.kexue.sxwz.service.EduTeacherService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +@Service +public class EduTeacherServiceImpl implements EduTeacherService { + + @Resource + private EduTeacherMapper eduTeacherMapper; + + @Override + @Transactional + public EduTeacher save(EduTeacher teacher) { + Date now = new Date(); + teacher.setCreateTime(now); + teacher.setUpdateTime(now); + eduTeacherMapper.insert(teacher); + return teacher; + } + + @Override + @Transactional + public EduTeacher update(EduTeacher teacher) { + teacher.setUpdateTime(new Date()); + eduTeacherMapper.updateByIdSelective(teacher); + return eduTeacherMapper.queryById(teacher.getId()); + } + + @Override + @Transactional + public void delete(Long id) { + eduTeacherMapper.deleteById(id); + } + + @Override + public EduTeacher queryById(Long id) { + return eduTeacherMapper.queryById(id); + } + + @Override + public EduTeacher queryByUserId(Long userId) { + return eduTeacherMapper.queryByUserId(userId); + } + + @Override + public List queryListBySchoolId(Long schoolId) { + return eduTeacherMapper.queryListBySchoolId(schoolId); + } + + @Override + public List queryListByCollegeId(Long collegeId) { + return eduTeacherMapper.queryListByCollegeId(collegeId); + } + + @Override + public EduTeacher queryByActivationCode(String activationCode) { + return eduTeacherMapper.queryByActivationCode(activationCode); + } + + @Override + @Transactional + public EduTeacher bindUser(Long teacherId, Long userId) { + EduTeacher teacher = eduTeacherMapper.queryById(teacherId); + if (teacher != null) { + teacher.setUserId(userId); + teacher.setBindingStatus(1); + teacher.setUpdateTime(new Date()); + eduTeacherMapper.updateByIdSelective(teacher); + } + return teacher; + } + + @Override + public PageInfo getPageList(EduTeacherDto queryDto) { + int pageNum = queryDto.getPageNum() == null ? PAGENUM : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? PAGESIZE : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); + List dataList = eduTeacherMapper.getPageList(queryDto); + return new PageInfo<>(dataList); + } +} diff --git a/src/main/java/com/kexue/skills/service/impl/ModelPriceServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/ModelPriceServiceImpl.java similarity index 87% rename from src/main/java/com/kexue/skills/service/impl/ModelPriceServiceImpl.java rename to src/main/java/art/kexue/sxwz/service/impl/ModelPriceServiceImpl.java index a21597d..fd7f928 100644 --- a/src/main/java/com/kexue/skills/service/impl/ModelPriceServiceImpl.java +++ b/src/main/java/art/kexue/sxwz/service/impl/ModelPriceServiceImpl.java @@ -1,11 +1,11 @@ -package com.kexue.skills.service.impl; +package art.kexue.sxwz.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.ModelPrice; -import com.kexue.skills.entity.dto.ModelPriceDto; -import com.kexue.skills.mapper.ModelPriceMapper; -import com.kexue.skills.service.ModelPriceService; +import art.kexue.sxwz.entity.ModelPrice; +import art.kexue.sxwz.entity.dto.ModelPriceDto; +import art.kexue.sxwz.mapper.ModelPriceMapper; +import art.kexue.sxwz.service.ModelPriceService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -32,7 +32,9 @@ public class ModelPriceServiceImpl implements ModelPriceService { */ @Override public PageInfo getPageList(ModelPriceDto queryDto) { - PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize()); + int pageNum = queryDto.getPageNum() == null ? 1 : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? 10 : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); List list = this.modelPriceMapper.getPageList(queryDto); return new PageInfo<>(list); } @@ -125,3 +127,4 @@ public class ModelPriceServiceImpl implements ModelPriceService { } } + diff --git a/src/main/java/com/kexue/skills/service/impl/PackageConfigServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/PackageConfigServiceImpl.java similarity index 78% rename from src/main/java/com/kexue/skills/service/impl/PackageConfigServiceImpl.java rename to src/main/java/art/kexue/sxwz/service/impl/PackageConfigServiceImpl.java index 6bf7c34..6ad4274 100644 --- a/src/main/java/com/kexue/skills/service/impl/PackageConfigServiceImpl.java +++ b/src/main/java/art/kexue/sxwz/service/impl/PackageConfigServiceImpl.java @@ -1,11 +1,11 @@ -package com.kexue.skills.service.impl; +package art.kexue.sxwz.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.PackageConfig; -import com.kexue.skills.entity.dto.PackageConfigDto; -import com.kexue.skills.mapper.PackageConfigMapper; -import com.kexue.skills.service.PackageConfigService; +import art.kexue.sxwz.entity.PackageConfig; +import art.kexue.sxwz.entity.dto.PackageConfigDto; +import art.kexue.sxwz.mapper.PackageConfigMapper; +import art.kexue.sxwz.service.PackageConfigService; import org.springframework.stereotype.Service; import jakarta.annotation.Resource; @@ -25,7 +25,9 @@ public class PackageConfigServiceImpl implements PackageConfigService { @Override public PageInfo getPageList(PackageConfigDto queryDto) { - PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize()); + int pageNum = queryDto.getPageNum() == null ? 1 : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? 10 : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); List list = packageConfigMapper.getList(queryDto); return new PageInfo<>(list); } @@ -64,3 +66,4 @@ public class PackageConfigServiceImpl implements PackageConfigService { } } + diff --git a/src/main/java/com/kexue/skills/service/impl/PayServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/PayServiceImpl.java similarity index 98% rename from src/main/java/com/kexue/skills/service/impl/PayServiceImpl.java rename to src/main/java/art/kexue/sxwz/service/impl/PayServiceImpl.java index 45b9be7..1e5f3c2 100644 --- a/src/main/java/com/kexue/skills/service/impl/PayServiceImpl.java +++ b/src/main/java/art/kexue/sxwz/service/impl/PayServiceImpl.java @@ -1,18 +1,17 @@ -package com.kexue.skills.service.impl; +package art.kexue.sxwz.service.impl; import com.alipay.api.AlipayApiException; import com.alipay.api.AlipayClient; import com.alipay.api.DefaultAlipayClient; import com.alipay.api.request.AlipayTradePagePayRequest; import com.alipay.api.response.AlipayTradePagePayResponse; -import com.kexue.skills.common.util.HttpUtil; -import com.kexue.skills.config.PaymentConfig; -import com.kexue.skills.entity.PaymentOrder; -import com.kexue.skills.service.PayService; -import com.kexue.skills.service.PaymentOrderService; -import com.kexue.skills.service.AccountService; -import com.kexue.skills.service.PackageConfigService; -import com.kexue.skills.entity.PackageConfig; +import art.kexue.sxwz.common.util.HttpUtil; +import art.kexue.sxwz.config.PaymentConfig; +import art.kexue.sxwz.entity.PaymentOrder; +import art.kexue.sxwz.service.PayService; +import art.kexue.sxwz.service.PaymentOrderService; +import art.kexue.sxwz.service.AccountService; +import art.kexue.sxwz.service.PackageConfigService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -733,3 +732,4 @@ public class PayServiceImpl implements PayService { } + diff --git a/src/main/java/com/kexue/skills/service/impl/PaymentOrderServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/PaymentOrderServiceImpl.java similarity index 68% rename from src/main/java/com/kexue/skills/service/impl/PaymentOrderServiceImpl.java rename to src/main/java/art/kexue/sxwz/service/impl/PaymentOrderServiceImpl.java index eea0c33..8caa419 100644 --- a/src/main/java/com/kexue/skills/service/impl/PaymentOrderServiceImpl.java +++ b/src/main/java/art/kexue/sxwz/service/impl/PaymentOrderServiceImpl.java @@ -1,12 +1,12 @@ -package com.kexue.skills.service.impl; +package art.kexue.sxwz.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.PaymentOrder; -import com.kexue.skills.entity.dto.PaymentOrderDto; -import com.kexue.skills.mapper.PaymentOrderMapper; -import com.kexue.skills.service.AccountService; -import com.kexue.skills.service.PaymentOrderService; +import art.kexue.sxwz.entity.PaymentOrder; +import art.kexue.sxwz.entity.dto.PaymentOrderDto; +import art.kexue.sxwz.mapper.PaymentOrderMapper; +import art.kexue.sxwz.service.AccountService; +import art.kexue.sxwz.service.PaymentOrderService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -34,11 +34,6 @@ public class PaymentOrderServiceImpl implements PaymentOrderService { @Resource private AccountService accountService; - @Resource - private com.kexue.skills.service.ContentPurchaseService contentPurchaseService; - - @Resource - private com.kexue.skills.service.CmsContentService cmsContentService; /** * 分页查询 @@ -48,7 +43,9 @@ public class PaymentOrderServiceImpl implements PaymentOrderService { */ @Override public PageInfo getPageList(PaymentOrderDto queryDto) { - PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize()); + int pageNum = queryDto.getPageNum() == null ? 1 : queryDto.getPageNum(); + int pageSize = queryDto.getPageSize() == null ? 10 : queryDto.getPageSize(); + PageHelper.startPage(pageNum, pageSize); List list = this.paymentOrderMapper.getPageList(queryDto); return new PageInfo<>(list); } @@ -238,7 +235,7 @@ public class PaymentOrderServiceImpl implements PaymentOrderService { } else if ("purchase_content".equals(order.getBusinessType())) { // 购买内容业务,创建或更新购买记录 try { - handleContentPurchaseCallback(order); + // handleContentPurchaseCallback(order); } catch (Exception e) { logger.error("购买内容业务处理失败:{}", e.getMessage(), e); return false; @@ -248,74 +245,7 @@ public class PaymentOrderServiceImpl implements PaymentOrderService { return true; } - - /** - * 处理内容购买回调逻辑 - * - * @param order 支付订单 - */ - private void handleContentPurchaseCallback(PaymentOrder order) { - Long userId = order.getUserId(); - Long contentId = order.getBusinessId(); - - // 1. 先查询是否已存在购买记录 - com.kexue.skills.entity.ContentPurchase existingPurchase = - contentPurchaseService.queryByUserIdAndContentId(userId, contentId); - - if (existingPurchase != null) { - // 2. 如果已存在购买记录且状态为待支付,更新为已支付 - if (existingPurchase.getStatus() == 1) { // 1.待支付 - contentPurchaseService.updateStatus(existingPurchase.getPurchaseId(), 2); // 2.已支付 - logger.info("更新购买记录状态为已支付,userId: {}, contentId: {}", userId, contentId); - } else { - logger.warn("购买记录已存在且状态为已支付,无需更新,userId: {}, contentId: {}", userId, contentId); - } - } else { - // 3. 如果不存在购买记录,创建新的购买记录 - logger.info("购买记录不存在,创建新记录,userId: {}, contentId: {}", userId, contentId); - createContentPurchaseRecord(order); - } - } - - /** - * 创建内容购买记录 - * - * @param order 支付订单 - */ - private void createContentPurchaseRecord(PaymentOrder order) { - try { - // 查询内容信息获取标题 - String contentTitle = order.getProductName(); - if (order.getBusinessId() != null) { - com.kexue.skills.entity.CmsContent content = cmsContentService.queryById(order.getBusinessId()); - if (content != null) { - contentTitle = content.getTitle(); - } - } - - // 创建购买记录 - com.kexue.skills.entity.ContentPurchase purchase = new com.kexue.skills.entity.ContentPurchase(); - purchase.setUserId(order.getUserId()); - purchase.setContentId(order.getBusinessId()); - purchase.setContentTitle(contentTitle); - purchase.setPayType(mapPayType(order.getPayType())); // 转换支付方式类型 - purchase.setAmount(order.getAmount()); - purchase.setPoints(0); // 微信/支付宝支付不计积分 - purchase.setStatus(2); // 2.已支付 - purchase.setPurchaseTime(new Date()); - purchase.setCreateTime(new Date()); - purchase.setUpdateTime(new Date()); - purchase.setDeleteFlag(0); - - contentPurchaseService.insert(purchase); - logger.info("创建购买记录成功,userId: {}, contentId: {}, purchaseId: {}", - order.getUserId(), order.getBusinessId(), purchase.getPurchaseId()); - } catch (Exception e) { - logger.error("创建购买记录失败:{}", e.getMessage(), e); - throw new RuntimeException("创建购买记录失败:" + e.getMessage(), e); - } - } - + /** * 映射支付方式类型 * payment_order.pay_type: 1.微信 2.支付宝 @@ -349,4 +279,4 @@ public class PaymentOrderServiceImpl implements PaymentOrderService { String random = UUID.randomUUID().toString().substring(0, 6).replaceAll("-", ""); return timestamp + random; } -} \ No newline at end of file +} diff --git a/src/main/java/art/kexue/sxwz/service/impl/SysDeptServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/SysDeptServiceImpl.java new file mode 100644 index 0000000..450a8f8 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/impl/SysDeptServiceImpl.java @@ -0,0 +1,113 @@ +package art.kexue.sxwz.service.impl; + +import art.kexue.sxwz.common.util.IDUtils; +import art.kexue.sxwz.entity.SysDept; +import art.kexue.sxwz.mapper.SysDeptMapper; +import art.kexue.sxwz.service.SysDeptService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +@Service +public class SysDeptServiceImpl implements SysDeptService { + + @Resource + private SysDeptMapper sysDeptMapper; + + @Override + @Transactional + public SysDept save(SysDept sysDept) { + if (sysDept.getId() == null) { + sysDept.setId(IDUtils.getSnowflakeId()); + } + if (sysDept.getParentId() == null) { + sysDept.setParentId(0L); + } + if (sysDept.getParentId() == 0) { + sysDept.setAncestors("0"); + } else { + SysDept parent = sysDeptMapper.selectByPrimaryKey(sysDept.getParentId()); + if (parent != null) { + sysDept.setAncestors(parent.getAncestors() + "," + sysDept.getParentId()); + sysDept.setLevel(parent.getLevel() + 1); + } + } + if (sysDept.getLevel() == null) { + sysDept.setLevel(1); + } + if (sysDept.getStatus() == null) { + sysDept.setStatus("0"); + } + if (sysDept.getOrderNum() == null) { + sysDept.setOrderNum(0); + } + sysDeptMapper.insert(sysDept); + return sysDept; + } + + @Override + @Transactional + public void delete(Long id) { + sysDeptMapper.deleteByPrimaryKey(id); + sysDeptMapper.deleteByParentId(id); + } + + @Override + @Transactional + public SysDept update(SysDept sysDept) { + sysDeptMapper.updateByPrimaryKeySelective(sysDept); + return sysDeptMapper.selectByPrimaryKey(sysDept.getId()); + } + + @Override + public SysDept queryById(Long id) { + return sysDeptMapper.selectByPrimaryKey(id); + } + + @Override + public List queryList(SysDept sysDept) { + return sysDeptMapper.queryList(sysDept); + } + + @Override + public PageInfo getPageList(SysDept sysDept) { + int pageNum = sysDept.getOrderNum() != null ? sysDept.getOrderNum() : 1; + int pageSize = sysDept.getLevel() != null ? sysDept.getLevel() : 10; + PageHelper.startPage(pageNum, pageSize); + List list = sysDeptMapper.queryList(sysDept); + return new PageInfo<>(list); + } + + @Override + public List queryByParentId(Long parentId) { + return sysDeptMapper.queryByParentId(parentId); + } + + @Override + public List queryByLevel(Integer level) { + return sysDeptMapper.queryByLevel(level); + } + + @Override + public List getTree(Long parentId) { + List tree = new ArrayList<>(); + List deptList = sysDeptMapper.queryByParentId(parentId != null ? parentId : 0L); + for (SysDept dept : deptList) { + buildTree(tree, dept); + } + return tree; + } + + private void buildTree(List tree, SysDept dept) { + tree.add(dept); + List children = sysDeptMapper.queryByParentId(dept.getId()); + for (SysDept child : children) { + buildTree(tree, child); + } + } +} diff --git a/src/main/java/com/kexue/skills/service/impl/SysDictServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/SysDictServiceImpl.java similarity index 92% rename from src/main/java/com/kexue/skills/service/impl/SysDictServiceImpl.java rename to src/main/java/art/kexue/sxwz/service/impl/SysDictServiceImpl.java index cf96e91..b17be92 100644 --- a/src/main/java/com/kexue/skills/service/impl/SysDictServiceImpl.java +++ b/src/main/java/art/kexue/sxwz/service/impl/SysDictServiceImpl.java @@ -1,11 +1,11 @@ -package com.kexue.skills.service.impl; +package art.kexue.sxwz.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.SysDict; -import com.kexue.skills.entity.dto.SysDictDto; -import com.kexue.skills.mapper.SysDictMapper; -import com.kexue.skills.service.SysDictService; +import art.kexue.sxwz.entity.SysDict; +import art.kexue.sxwz.entity.dto.SysDictDto; +import art.kexue.sxwz.mapper.SysDictMapper; +import art.kexue.sxwz.service.SysDictService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -116,3 +116,4 @@ public class SysDictServiceImpl implements SysDictService { return sysDictMapper.getDictListByCode(dictCode); } } + diff --git a/src/main/java/com/kexue/skills/service/impl/SysLogServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/SysLogServiceImpl.java similarity index 90% rename from src/main/java/com/kexue/skills/service/impl/SysLogServiceImpl.java rename to src/main/java/art/kexue/sxwz/service/impl/SysLogServiceImpl.java index 37cb739..04464bc 100644 --- a/src/main/java/com/kexue/skills/service/impl/SysLogServiceImpl.java +++ b/src/main/java/art/kexue/sxwz/service/impl/SysLogServiceImpl.java @@ -1,9 +1,9 @@ -package com.kexue.skills.service.impl; +package art.kexue.sxwz.service.impl; -import com.kexue.skills.entity.SysLog; -import com.kexue.skills.entity.dto.SysLogDto; -import com.kexue.skills.mapper.SysLogMapper; -import com.kexue.skills.service.SysLogService; +import art.kexue.sxwz.entity.SysLog; +import art.kexue.sxwz.entity.dto.SysLogDto; +import art.kexue.sxwz.mapper.SysLogMapper; +import art.kexue.sxwz.service.SysLogService; import org.springframework.stereotype.Service; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -96,3 +96,4 @@ public class SysLogServiceImpl implements SysLogService { return sysLogMapper.deleteById(logId) > 0; } } + diff --git a/src/main/java/com/kexue/skills/service/impl/SysMenuServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/SysMenuServiceImpl.java similarity index 92% rename from src/main/java/com/kexue/skills/service/impl/SysMenuServiceImpl.java rename to src/main/java/art/kexue/sxwz/service/impl/SysMenuServiceImpl.java index 964db30..444e2e5 100644 --- a/src/main/java/com/kexue/skills/service/impl/SysMenuServiceImpl.java +++ b/src/main/java/art/kexue/sxwz/service/impl/SysMenuServiceImpl.java @@ -1,12 +1,12 @@ -package com.kexue.skills.service.impl; +package art.kexue.sxwz.service.impl; import com.alicp.jetcache.anno.CacheInvalidate; import com.alicp.jetcache.anno.CachePenetrationProtect; import com.alicp.jetcache.anno.Cached; -import com.kexue.skills.entity.SysMenu; -import com.kexue.skills.entity.dto.SysMenuDto; -import com.kexue.skills.mapper.SysMenuMapper; -import com.kexue.skills.service.SysMenuService; +import art.kexue.sxwz.entity.SysMenu; +import art.kexue.sxwz.entity.dto.SysMenuDto; +import art.kexue.sxwz.mapper.SysMenuMapper; +import art.kexue.sxwz.service.SysMenuService; import org.springframework.stereotype.Service; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -103,3 +103,4 @@ public class SysMenuServiceImpl implements SysMenuService { return sysMenuMapper.deleteById(menuId) > 0; } } + diff --git a/src/main/java/art/kexue/sxwz/service/impl/SysNotificationServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/SysNotificationServiceImpl.java new file mode 100644 index 0000000..8f5fc81 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/impl/SysNotificationServiceImpl.java @@ -0,0 +1,233 @@ +package art.kexue.sxwz.service.impl; + +import art.kexue.sxwz.entity.EduCourseStudent; +import art.kexue.sxwz.entity.SysNotification; +import art.kexue.sxwz.entity.SysUser; +import art.kexue.sxwz.exception.BizException; +import art.kexue.sxwz.mapper.EduCourseStudentMapper; +import art.kexue.sxwz.mapper.SysNotificationMapper; +import art.kexue.sxwz.service.SysNotificationService; +import art.kexue.sxwz.service.SysUserService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + +@Service +public class SysNotificationServiceImpl implements SysNotificationService { + + @Resource + private SysNotificationMapper sysNotificationMapper; + + @Resource + private SysUserService sysUserService; + + @Resource + private EduCourseStudentMapper eduCourseStudentMapper; + + @Override + @Transactional + public SysNotification save(SysNotification notification) { + notification.setCreateTime(new Date()); + notification.setIsRead(0); + sysNotificationMapper.insert(notification); + return notification; + } + + @Override + @Transactional + public void delete(Long id) { + sysNotificationMapper.deleteById(id); + } + + @Override + public SysNotification queryById(Long id) { + return sysNotificationMapper.queryById(id); + } + + @Override + public List queryByUserId(Long userId, Long schoolId) { + return sysNotificationMapper.queryByUserId(userId, schoolId); + } + + @Override + @Transactional + public void markAsRead(Long userId, Long notificationId) { + sysNotificationMapper.updateReadStatus(userId, notificationId); + } + + @Override + @Transactional + public void markAllAsRead(Long userId, Long schoolId) { + sysNotificationMapper.updateAllRead(userId, schoolId); + } + + @Override + public int countUnread(Long userId, Long schoolId) { + return sysNotificationMapper.countUnread(userId, schoolId); + } + + @Override + @Transactional + public void sendNotification(Long schoolId, Long userId, String title, String content, Integer type) { + SysNotification notification = new SysNotification(); + notification.setSchoolId(schoolId); + notification.setUserId(userId); + notification.setTitle(title); + notification.setContent(content); + notification.setType(type); + notification.setIsRead(0); + notification.setCreateTime(new Date()); + sysNotificationMapper.insert(notification); + } + + @Override + @Transactional + public void sendUserNotification(Long schoolId, Long senderId, String senderName, + String title, String content, + List targetUserIds, List targetRoleTypes) { + List notifications = new ArrayList<>(); + Date now = new Date(); + + if (targetUserIds != null && !targetUserIds.isEmpty()) { + for (Long userId : targetUserIds) { + SysNotification notification = createNotification(schoolId, userId, title, content, + 5, senderId, senderName, 1); + notification.setCreateTime(now); + notifications.add(notification); + } + } + + if (targetRoleTypes != null && !targetRoleTypes.isEmpty()) { + for (Integer roleType : targetRoleTypes) { + List users = sysUserService.getUsersBySchoolIdAndRoleType(schoolId, roleType); + for (SysUser user : users) { + SysNotification notification = createNotification(schoolId, user.getUserId(), title, content, + 5, senderId, senderName, 2); + notification.setCreateTime(now); + notifications.add(notification); + } + } + } + + if (!notifications.isEmpty()) { + sysNotificationMapper.batchInsert(notifications); + } + } + + @Override + @Transactional + public void sendCourseNotification(Long schoolId, Long teacherId, String teacherName, + String title, String content, List courseIds) { + if (courseIds == null || courseIds.isEmpty()) { + throw new BizException("请选择课程"); + } + + Set studentIds = new HashSet<>(); + for (Long courseId : courseIds) { + List courseStudents = eduCourseStudentMapper.queryByCourseId(courseId); + for (EduCourseStudent cs : courseStudents) { + if (cs.getIsKicked() == null || cs.getIsKicked() == 0) { + studentIds.add(cs.getStudentId()); + } + } + } + + List notifications = new ArrayList<>(); + Date now = new Date(); + + for (Long studentId : studentIds) { + SysNotification notification = createNotification(schoolId, studentId, title, content, + 6, teacherId, teacherName, 3); + notification.setCreateTime(now); + notifications.add(notification); + } + + if (!notifications.isEmpty()) { + sysNotificationMapper.batchInsert(notifications); + } + } + + @Override + @Transactional + public void sendSystemNotification(Long schoolId, List targetUserIds, + String title, String content) { + List notifications = new ArrayList<>(); + Date now = new Date(); + + for (Long userId : targetUserIds) { + SysNotification notification = createNotification(schoolId, userId, title, content, + 1, null, "系统", 1); + notification.setCreateTime(now); + notifications.add(notification); + } + + if (!notifications.isEmpty()) { + sysNotificationMapper.batchInsert(notifications); + } + } + + @Override + public List getAvailableTargetRoles(Long currentUserId) { + SysUser user = sysUserService.queryById(currentUserId); + if (user == null || user.getRoleType() == null) { + return Collections.emptyList(); + } + + Integer roleType = user.getRoleType(); + switch (roleType) { + case 1: + List roles = sysUserService.queryUserRoles(currentUserId); + if (roles.contains("SUPER")) { + return Arrays.asList(1, 2, 3, 4, 5); + } else if (roles.contains("SUPER1")) { + return Arrays.asList(2, 3, 4, 5); + } + return Arrays.asList(2, 3, 4, 5); + case 2: + return Arrays.asList(3, 4, 5); + case 3: + return Arrays.asList(4, 5); + case 4: + return Collections.singletonList(5); + default: + return Collections.emptyList(); + } + } + + @Override + public List getUsersByRoleTypes(Long schoolId, List roleTypes) { + List result = new ArrayList<>(); + for (Integer roleType : roleTypes) { + List users = sysUserService.getUsersBySchoolIdAndRoleType(schoolId, roleType); + result.addAll(users); + } + return result; + } + + @Override + @Transactional + public void batchInsert(List notifications) { + if (notifications != null && !notifications.isEmpty()) { + sysNotificationMapper.batchInsert(notifications); + } + } + + private SysNotification createNotification(Long schoolId, Long userId, String title, + String content, Integer type, Long senderId, + String senderName, Integer targetType) { + SysNotification notification = new SysNotification(); + notification.setSchoolId(schoolId); + notification.setUserId(userId); + notification.setTitle(title); + notification.setContent(content); + notification.setType(type); + notification.setIsRead(0); + notification.setSenderId(senderId); + notification.setSenderName(senderName); + notification.setTargetType(targetType); + return notification; + } +} diff --git a/src/main/java/com/kexue/skills/service/impl/SysRoleServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/SysRoleServiceImpl.java similarity index 92% rename from src/main/java/com/kexue/skills/service/impl/SysRoleServiceImpl.java rename to src/main/java/art/kexue/sxwz/service/impl/SysRoleServiceImpl.java index 4bffa9b..49c6588 100644 --- a/src/main/java/com/kexue/skills/service/impl/SysRoleServiceImpl.java +++ b/src/main/java/art/kexue/sxwz/service/impl/SysRoleServiceImpl.java @@ -1,12 +1,12 @@ -package com.kexue.skills.service.impl; +package art.kexue.sxwz.service.impl; import com.alicp.jetcache.anno.CacheInvalidate; import com.alicp.jetcache.anno.CachePenetrationProtect; import com.alicp.jetcache.anno.Cached; -import com.kexue.skills.entity.SysRole; -import com.kexue.skills.entity.dto.SysRoleDto; -import com.kexue.skills.mapper.SysRoleMapper; -import com.kexue.skills.service.SysRoleService; +import art.kexue.sxwz.entity.SysRole; +import art.kexue.sxwz.entity.dto.SysRoleDto; +import art.kexue.sxwz.mapper.SysRoleMapper; +import art.kexue.sxwz.service.SysRoleService; import org.springframework.stereotype.Service; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -103,3 +103,4 @@ public class SysRoleServiceImpl implements SysRoleService { return sysRoleMapper.deleteById(roleId) > 0; } } + diff --git a/src/main/java/art/kexue/sxwz/service/impl/SysUserRoleServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/SysUserRoleServiceImpl.java new file mode 100644 index 0000000..ef42df6 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/impl/SysUserRoleServiceImpl.java @@ -0,0 +1,112 @@ +package art.kexue.sxwz.service.impl; + +import art.kexue.sxwz.entity.SysUserRole; +import art.kexue.sxwz.mapper.SysUserRoleMapper; +import art.kexue.sxwz.service.SysUserRoleService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; + +@Service +public class SysUserRoleServiceImpl implements SysUserRoleService { + + @Resource + private SysUserRoleMapper sysUserRoleMapper; + + @Override + @Transactional + public SysUserRole save(SysUserRole userRole) { + sysUserRoleMapper.insert(userRole); + return userRole; + } + + @Override + @Transactional + public void delete(Long id) { + sysUserRoleMapper.deleteById(id); + } + + @Override + public SysUserRole queryById(Long id) { + return sysUserRoleMapper.queryById(id); + } + + @Override + public List queryByUserId(Long userId) { + return sysUserRoleMapper.queryByUserId(userId); + } + + @Override + public List queryRoleCodesByUserId(Long userId) { + return sysUserRoleMapper.queryRoleCodesByUserId(userId); + } + + @Override + @Transactional + public void deleteByUserId(Long userId) { + sysUserRoleMapper.deleteByUserId(userId); + } + + @Override + @Transactional + public void deleteByUserIdAndRoleCode(Long userId, String roleCode) { + sysUserRoleMapper.deleteByUserIdAndRoleCode(userId, roleCode); + } + + @Override + public boolean hasRole(Long userId, String roleCode) { + return sysUserRoleMapper.queryByUserIdAndRoleCode(userId, roleCode) != null; + } + + @Override + @Transactional + public void assignRoles(Long userId, List roleCodes) { + assignRoles(userId, roleCodes, true); + } + + @Override + @Transactional + public void assignRoles(Long userId, List roleCodes, boolean clearExisting) { + if (clearExisting) { + sysUserRoleMapper.deleteByUserId(userId); + } + + if (roleCodes != null && !roleCodes.isEmpty()) { + for (String roleCode : roleCodes) { + if (!hasRole(userId, roleCode)) { + SysUserRole userRole = new SysUserRole(); + userRole.setUserId(userId); + userRole.setRoleCode(roleCode); + sysUserRoleMapper.insert(userRole); + } + } + } + } + + @Override + @Transactional + public void addRoles(Long userId, List roleCodes) { + if (roleCodes != null && !roleCodes.isEmpty()) { + for (String roleCode : roleCodes) { + if (!hasRole(userId, roleCode)) { + SysUserRole userRole = new SysUserRole(); + userRole.setUserId(userId); + userRole.setRoleCode(roleCode); + sysUserRoleMapper.insert(userRole); + } + } + } + } + + @Override + @Transactional + public void removeRoles(Long userId, List roleCodes) { + if (roleCodes != null && !roleCodes.isEmpty()) { + for (String roleCode : roleCodes) { + sysUserRoleMapper.deleteByUserIdAndRoleCode(userId, roleCode); + } + } + } +} diff --git a/src/main/java/com/kexue/skills/service/impl/SysUserServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/SysUserServiceImpl.java similarity index 65% rename from src/main/java/com/kexue/skills/service/impl/SysUserServiceImpl.java rename to src/main/java/art/kexue/sxwz/service/impl/SysUserServiceImpl.java index 52da689..006d205 100644 --- a/src/main/java/com/kexue/skills/service/impl/SysUserServiceImpl.java +++ b/src/main/java/art/kexue/sxwz/service/impl/SysUserServiceImpl.java @@ -1,48 +1,47 @@ -package com.kexue.skills.service.impl; +package art.kexue.sxwz.service.impl; +import art.kexue.sxwz.common.Assert; +import art.kexue.sxwz.common.CacheManager; +import art.kexue.sxwz.common.Const; +import art.kexue.sxwz.config.CaptchaConfig; +import art.kexue.sxwz.entity.Account; +import art.kexue.sxwz.entity.SysUser; +import art.kexue.sxwz.entity.dto.SessionDto; +import art.kexue.sxwz.entity.dto.SysUserDto; +import art.kexue.sxwz.entity.request.*; +import art.kexue.sxwz.exception.BizException; +import art.kexue.sxwz.entity.EduStudent; +import art.kexue.sxwz.entity.EduTeacher; +import art.kexue.sxwz.mapper.AccountMapper; +import art.kexue.sxwz.mapper.EduStudentMapper; +import art.kexue.sxwz.mapper.EduTeacherMapper; +import art.kexue.sxwz.mapper.SysUserMapper; +import art.kexue.sxwz.mapper.SysUserRoleMapper; +import art.kexue.sxwz.mapper.SysRolePermissionMapper; +import art.kexue.sxwz.service.AccountService; +import art.kexue.sxwz.service.SysUserService; +import art.kexue.sxwz.utils.MD5Util; +import cn.dev33.satoken.stp.StpUtil; import com.alicp.jetcache.anno.CacheInvalidate; import com.alicp.jetcache.anno.CachePenetrationProtect; import com.alicp.jetcache.anno.Cached; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; -import com.kexue.skills.common.Assert; -import com.kexue.skills.common.CacheManager; -import com.kexue.skills.common.Const; -import com.kexue.skills.common.LoginUserCacheUtil; -import com.kexue.skills.config.CaptchaConfig; -import com.kexue.skills.entity.Account; -import com.kexue.skills.entity.ContentPurchase; -import com.kexue.skills.entity.SysUser; -import com.kexue.skills.entity.SysUserRole; -import com.kexue.skills.entity.dto.ContentPurchaseDto; -import com.kexue.skills.entity.dto.SessionDto; -import com.kexue.skills.entity.dto.SysUserDto; -import com.kexue.skills.entity.request.*; -import com.kexue.skills.exception.BizException; -import com.kexue.skills.mapper.AccountMapper; -import com.kexue.skills.mapper.ContentPurchaseMapper; -import com.kexue.skills.mapper.CmsContentLikeMapper; -import com.kexue.skills.mapper.CmsContentViewMapper; -import com.kexue.skills.mapper.CmsContentMapper; -import com.kexue.skills.mapper.SysUserMapper; -import com.kexue.skills.mapper.SysUserRoleMapper; -import com.kexue.skills.service.SysUserService; -import com.kexue.skills.service.AccountService; -import com.kexue.skills.utils.MD5Util; +import jodd.util.StringUtil; import lombok.extern.slf4j.Slf4j; import org.dromara.sms4j.api.SmsBlend; import org.dromara.sms4j.core.factory.SmsFactory; import org.redisson.api.RedissonClient; -import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.io.File; +import java.io.IOException; import java.math.BigDecimal; import java.security.NoSuchAlgorithmException; import java.util.*; -import org.springframework.web.multipart.MultipartFile; -import java.io.File; -import java.io.IOException; /** * (SysUser)表服务实现类 @@ -71,16 +70,13 @@ public class SysUserServiceImpl implements SysUserService { private SysUserRoleMapper sysUserRoleMapper; @Resource - private ContentPurchaseMapper contentPurchaseMapper; + private SysRolePermissionMapper sysRolePermissionMapper; @Resource - private CmsContentLikeMapper cmsContentLikeMapper; + private EduStudentMapper eduStudentMapper; @Resource - private CmsContentViewMapper cmsContentViewMapper; - - @Resource - private CmsContentMapper cmsContentMapper; + private EduTeacherMapper eduTeacherMapper; @Resource private AccountService accountService; @@ -101,12 +97,45 @@ public class SysUserServiceImpl implements SysUserService { public PageInfo getPageList(SysUserDto queryDto) { int pageNum = queryDto.getPageNum()==null?PAGENUM:queryDto.getPageNum(); int pageSize = queryDto.getPageSize()==null? PAGESIZE :queryDto.getPageSize(); - PageHelper.startPage(pageNum,pageSize); + + StringBuilder orderBy = new StringBuilder(); + if (queryDto.getSortBy() != null && !queryDto.getSortBy().isEmpty()) { + String sortField = convertSortField(queryDto.getSortBy()); + if (sortField != null) { + orderBy.append(sortField); + if (Boolean.TRUE.equals(queryDto.getSortDesc())) { + orderBy.append(" DESC"); + } else { + orderBy.append(" ASC"); + } + } + } + + if (orderBy.length() > 0) { + PageHelper.startPage(pageNum, pageSize, orderBy.toString()); + } else { + PageHelper.startPage(pageNum, pageSize); + } + List dataList = sysUserMapper.getPageList(queryDto); // 将所有返回的用户密码设置为null dataList.forEach(user -> user.setPwd(null)); return new PageInfo<>(dataList); } + + private String convertSortField(String sortBy) { + Map fieldMapping = new HashMap<>(); + fieldMapping.put("userId", "user_id"); + fieldMapping.put("userName", "user_name"); + fieldMapping.put("realName", "real_name"); + fieldMapping.put("tel", "tel"); + fieldMapping.put("email", "email"); + fieldMapping.put("createTime", "create_time"); + fieldMapping.put("enable", "enable"); + fieldMapping.put("roleType", "role_type"); + fieldMapping.put("schoolId", "school_id"); + return fieldMapping.get(sortBy); + } /** * 通过ID查询单条数据 @@ -289,10 +318,10 @@ public class SysUserServiceImpl implements SysUserService { sysUserMapper.update(sysUser); // 判断更新的用户是否是当前登录用户,如果是则更新用户缓存 - Long currentUserId = loginUserCacheUtil.getCurrentUserId(); + Long currentUserId = StpUtil.getLoginIdAsLong(); if (currentUserId != null && currentUserId.equals(sysUserUpdateDto.getUserId())) { // 获取当前登录用户的 token - String token = loginUserCacheUtil.getTokenFromRequest(); + String token = StpUtil.getTokenValue(); updateUserCache(currentUserId, sysUser, token); } }else { @@ -496,34 +525,40 @@ public class SysUserServiceImpl implements SysUserService { loginUser.setUserInfo(sysUser); // 查询并设置用户角色列表 - loginUser.setRoles(queryUserRoles(sysUser.getUserId())); + List roles = queryUserRoles(sysUser.getUserId()); + loginUser.setRoles(roles); - // 查询并设置用户已购买的内容ID列表 - loginUser.setPurchasedContentIds(queryPurchasedContentIds(sysUser.getUserId())); + // 查询并设置用户权限列表 + List permissions = queryUserPermissions(roles); + loginUser.setPermissions(permissions); // 查询并设置用户账户信息 loginUser.setAccount(queryUserAccount(sysUser.getUserId())); - - - // 查询并设置用户最近点赞记录 - loginUser.setFavorites(queryRecentFavorites(sysUser.getUserId())); - - // 查询并设置用户最近查看记录 - loginUser.setHistory(queryRecentViews(sysUser.getUserId())); - - // 查询并设置用户最近创建记录 - loginUser.setCreate(queryRecentCreatedContent(sysUser.getUserId())); - - // 查询并设置用户最近购买记录 - loginUser.setHas(queryRecentPurchases(sysUser.getUserId())); - // 设置token loginUser.setToken(token); return loginUser; } + /** + * 根据角色列表查询用户权限列表 + * + * @param roles 角色编码列表 + * @return 权限编码列表 + */ + private List queryUserPermissions(List roles) { + try { + if (roles == null || roles.isEmpty()) { + return Collections.emptyList(); + } + return sysRolePermissionMapper.queryPermissionCodesByRoleCodes(roles); + } catch (Exception e) { + log.error("查询用户权限列表失败:{}", e.getMessage()); + return Collections.emptyList(); + } + } + /** * 查询用户角色列表 * @@ -540,30 +575,6 @@ public class SysUserServiceImpl implements SysUserService { return java.util.Collections.emptyList(); } } - - /** - * 查询用户已购买的内容ID列表 - * - * @param userId 用户ID - * @return 内容ID列表 - */ - private List queryPurchasedContentIds(Long userId) { - List purchasedContentIds = new java.util.ArrayList<>(); - try { - ContentPurchaseDto purchaseDto = new ContentPurchaseDto(); - purchaseDto.setUserId(userId); - List purchases = contentPurchaseMapper.getList(purchaseDto); - - for (ContentPurchase purchase : purchases) { - purchasedContentIds.add(purchase.getContentId()); - } - } catch (Exception e) { - log.error("查询用户已购买内容列表失败:{}", e.getMessage()); - purchasedContentIds = java.util.Collections.emptyList(); - } - return purchasedContentIds; - } - /** * 查询用户账户信息 * @@ -576,81 +587,8 @@ public class SysUserServiceImpl implements SysUserService { - /** - * 查询用户最近点赞记录 - * - * @param userId 用户ID - * @return 最近点赞记录 - */ - private List queryRecentFavorites(Long userId) { - try { - return cmsContentLikeMapper.queryRecentLikesByUserId(userId, 20); - } catch (Exception e) { - log.error("查询用户最近点赞记录失败:{}", e.getMessage()); - return java.util.Collections.emptyList(); - } - } - - /** - * 查询用户最近查看记录 - * - * @param userId 用户ID - * @return 最近查看记录 - */ - private List queryRecentViews(Long userId) { - try { - return cmsContentViewMapper.queryRecentViewsByUserId(userId, 20); - } catch (Exception e) { - log.error("查询用户最近查看记录失败:{}", e.getMessage()); - return java.util.Collections.emptyList(); - } - } - - /** - * 查询用户最近创建记录 - * - * @param userId 用户ID - * @return 最近创建记录 - */ - private List queryRecentCreatedContent(Long userId) { - try { - return cmsContentMapper.queryRecentCreatedByUserId(userId, 20); - } catch (Exception e) { - log.error("查询用户最近创建记录失败:{}", e.getMessage()); - return java.util.Collections.emptyList(); - } - } - - /** - * 查询用户最近购买记录 - * - * @param userId 用户ID - * @return 最近购买记录 - */ - private List queryRecentPurchases(Long userId) { - List has = new java.util.ArrayList<>(); - try { - ContentPurchaseDto purchaseDto = new ContentPurchaseDto(); - purchaseDto.setUserId(userId); - List purchases = contentPurchaseMapper.getList(purchaseDto); - if (purchases != null && !purchases.isEmpty()) { - java.util.LinkedHashSet contentIdSet = new java.util.LinkedHashSet<>(); - for (ContentPurchase purchase : purchases) { - if (contentIdSet.size() < 20) { - contentIdSet.add(purchase.getContentId()); - } else { - break; - } - } - has.addAll(contentIdSet); - } - } catch (Exception e) { - log.error("查询用户最近购买记录失败:{}", e.getMessage()); - has = java.util.Collections.emptyList(); - } - return has; - } - + + /** * 存储登录信息到Redis * @@ -672,20 +610,16 @@ public class SysUserServiceImpl implements SysUserService { LoginUserDto sysUserDto = new LoginUserDto(); sysUserDto.setUserInfo(loginUser.getUserInfo()); sysUserDto.setToken(loginUser.getToken()); - sysUserDto.setFavorites(loginUser.getFavorites()); - sysUserDto.setHistory(loginUser.getHistory()); - sysUserDto.setCreate(loginUser.getCreate()); - sysUserDto.setHas(loginUser.getHas()); + sysUserDto.setRoles(loginUser.getRoles()); + sysUserDto.setPermissions(loginUser.getPermissions()); return sysUserDto; } - @Resource - private LoginUserCacheUtil loginUserCacheUtil; @Override public boolean resetPassword(ResetPwdDto resetPasswordDto) { // 1. 检查登录状态 - Long currentUserId = loginUserCacheUtil.getCurrentUserId(); + Long currentUserId = StpUtil.getLoginIdAsLong(); Assert.notNull(currentUserId, "请先登录"); // 2. 检查参数 @@ -693,10 +627,10 @@ public class SysUserServiceImpl implements SysUserService { Assert.notNull(resetPasswordDto.getNewPassword(), "新密码不能为空"); // 3. 检查是否是管理员 - boolean isAdmin = isAdminUser(currentUserId); + /*boolean isAdmin = isAdminUser(currentUserId); if (!isAdmin) { throw new BizException("只有管理员才能重置密码"); - } + }*/ // 4. 查询用户(支持用户名或手机号) SysUser sysUser = sysUserMapper.queryById(resetPasswordDto.getUserId()); @@ -758,7 +692,7 @@ public class SysUserServiceImpl implements SysUserService { @Override public boolean resetPwd(Long userId, String newPassword, String operator) { // 获取当前登录用户ID - Long currentUserId = loginUserCacheUtil.getCurrentUserId(); + Long currentUserId = StpUtil.getLoginIdAsLong(); Assert.notNull(currentUserId, "请先登录"); // 查询用户是否存在 @@ -790,7 +724,7 @@ public class SysUserServiceImpl implements SysUserService { @Override public boolean resetPasswordByUsernameOrPhone(String usernameOrPhone, String newPassword, String operator) { // 获取当前登录用户ID - Long currentUserId = loginUserCacheUtil.getCurrentUserId(); + Long currentUserId = StpUtil.getLoginIdAsLong(); Assert.notNull(currentUserId, "请先登录"); // 查询用户是否存在(先尝试通过用户名查询,再尝试通过手机号查询) @@ -873,6 +807,39 @@ public class SysUserServiceImpl implements SysUserService { } return false; } + + @Override + public boolean verifyPhoneCode(String phone, String code) { + SysUser sysUser = null; + try { + long userId = Long.parseLong(StpUtil.getLoginId().toString()); + sysUser = sysUserMapper.queryById(userId); + Assert.notNull(sysUser, "用户不存在"); + if (StringUtil.isEmpty(sysUser.getTel())){ + return true ; + } + }catch (Exception e){ + Assert.notNull(sysUser, "用户不存在或尚未登录,请先登录!"); + return true ; + } + Assert.equals(sysUser.getTel(), phone, "手机号错误"); + Assert.notBlank(phone, "手机号不能为空"); + Assert.notBlank(code, "验证码不能为空"); + + String phoneRegex = "^1[3-9]\\d{9}$"; + if (!phone.matches(phoneRegex)) { + throw new BizException("手机号格式不正确"); + } + + String cachedCode = (String) redissonClient.getBucket("sms_code:" + phone).get(); + Assert.notNull(cachedCode, "验证码已过期"); + Assert.equals(cachedCode, code, "验证码错误"); + + redissonClient.getBucket("sms_code:" + phone).delete(); + + log.info("手机号{}验证码验证成功", phone); + return true; + } /** * 生成6位随机验证码 @@ -911,7 +878,28 @@ public class SysUserServiceImpl implements SysUserService { // 如果用户不存在,自动创建账号 if (sysUser == null) { - sysUser = createUserByPhone(phone, phoneLoginDto.getInviteCode()); + sysUser = createUserByPhone(phone, phoneLoginDto.getInviteCode(), + phoneLoginDto.getRoleType(), phoneLoginDto.getWxid()); + + // 根据角色类型创建相应的扩展记录 + if (phoneLoginDto.getRoleType() != null) { + createExtendedRecord(sysUser.getUserId(), phoneLoginDto.getRoleType()); + + // 设置用户角色 + assignRoleToUser(sysUser.getUserId(), phoneLoginDto.getRoleType()); + } + } + + // 如果用户存在但是没有设置 roleType,更新 roleType + if (sysUser != null && phoneLoginDto.getRoleType() != null && sysUser.getRoleType() == null) { + sysUser.setRoleType(phoneLoginDto.getRoleType()); + sysUserMapper.update(sysUser); + + // 根据角色类型创建相应的扩展记录 + createExtendedRecord(sysUser.getUserId(), phoneLoginDto.getRoleType()); + + // 设置用户角色 + assignRoleToUser(sysUser.getUserId(), phoneLoginDto.getRoleType()); } // 检查用户是否已有 token,如果有则使旧 token 失效 @@ -953,40 +941,14 @@ public class SysUserServiceImpl implements SysUserService { loginUser.setUserInfo(sysUser); loginUser.setRoles(roles); - // 查询用户已购买的内容ID列表 - List purchasedContentIds = new java.util.ArrayList<>(); - try { - // 创建查询条件,查询用户的购买记录 - ContentPurchaseDto purchaseDto = new ContentPurchaseDto(); - purchaseDto.setUserId(sysUser.getUserId()); - List purchases = contentPurchaseMapper.getList(purchaseDto); - - // 遍历购买记录,获取内容ID - for (ContentPurchase purchase : purchases) { - purchasedContentIds.add(purchase.getContentId()); - } - } catch (Exception e) { - log.error("查询用户已购买内容列表失败:{}", e.getMessage()); - purchasedContentIds = java.util.Collections.emptyList(); - } - loginUser.setPurchasedContentIds(purchasedContentIds); + // 查询并设置用户权限列表 + List permissions = queryUserPermissions(roles); + loginUser.setPermissions(permissions); // 查询用户账户信息 Account account = accountMapper.queryByUserId(sysUser.getUserId()); loginUser.setAccount(account); - // 查询并设置用户最近点赞记录 - loginUser.setFavorites(queryRecentFavorites(sysUser.getUserId())); - - // 查询并设置用户最近查看记录 - loginUser.setHistory(queryRecentViews(sysUser.getUserId())); - - // 查询并设置用户最近创建记录 - loginUser.setCreate(queryRecentCreatedContent(sysUser.getUserId())); - - // 查询并设置用户最近购买记录 - loginUser.setHas(queryRecentPurchases(sysUser.getUserId())); - // 设置token loginUser.setToken(token); @@ -1003,21 +965,125 @@ public class SysUserServiceImpl implements SysUserService { return sysUserDto; } + + @Override + public LoginUserDto wechatLogin(String wxid, String nickname) { + Assert.notBlank(wxid, "微信ID不能为空"); + + SysUser sysUser = sysUserMapper.getByWxid(wxid); + + if (sysUser == null) { + sysUser = createUserByWechat(wxid, nickname); + createExtendedRecord(sysUser.getUserId(), 5); + assignRoleToUser(sysUser.getUserId(), 5); + } + + String oldToken = CacheManager.getTokenFromCache(sysUser.getUserName()); + if (oldToken != null && !oldToken.isEmpty()) { + log.info("检测到用户 {} 已有旧 token: {}", sysUser.getUserName(), oldToken); + try { + redissonClient.getBucket("loginUser:" + oldToken).delete(); + } catch (Exception e) { + log.error("删除 Redis 中的旧 token 失败:{}", e.getMessage()); + } + try { + cn.dev33.satoken.stp.StpUtil.logoutByTokenValue(oldToken); + } catch (Exception e) { + log.error("Sa-Token 使旧 token 失效失败:{}", e.getMessage()); + } + CacheManager.removeTokenFromCache(sysUser.getUserName()); + } + + List roles = queryUserRoles(sysUser.getUserId()); + log.info("用户{}的角色列表:{}", sysUser.getUserName(), String.join(",", roles)); + + String token = generateToken(sysUser.getUserId(), roles); + + LoginUser loginUser = new LoginUser(); + sysUser.setPwd(null); + loginUser.setUserInfo(sysUser); + loginUser.setRoles(roles); + + List permissions = queryUserPermissions(roles); + loginUser.setPermissions(permissions); + + Account account = accountMapper.queryByUserId(sysUser.getUserId()); + loginUser.setAccount(account); + + loginUser.setToken(token); + + redissonClient.getBucket("loginUser:" + token).set(cn.hutool.json.JSONUtil.toJsonStr(loginUser), 86400, java.util.concurrent.TimeUnit.SECONDS); + + CacheManager.putTokenToCache(sysUser.getUserName(), token); + + LoginUserDto sysUserDto = buildLoginUserDto(loginUser); + + log.info("用户:{} 微信登录成功,token:{}", sysUser.getUserName(), token); + + return sysUserDto; + } + + private SysUser createUserByWechat(String wxid, String nickname) { + SysUser sysUser = new SysUser(); + + sysUser.setUserName("wx_" + wxid); + sysUser.setWxid(wxid); + if (nickname != null && !nickname.isEmpty()) { + // sysUser.setNickName(nickname); + } + sysUser.setRoleType(5); + sysUser.setEnable(Const.USER_STATUS_NORMAL); + sysUser.setDeleteFlag(Const.DELETE_FLAG_NO); + sysUser.setSalt(System.currentTimeMillis() + ""); + + try { + sysUser.setPwd(MD5Util.doubleEncrypt(wxid, sysUser.getSalt())); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + + sysUserMapper.insert(sysUser); + + Account account = new Account(); + account.setUserId(sysUser.getUserId()); + account.setBalance(new BigDecimal("0")); + account.setFrozenAmount(new BigDecimal("0")); +// account.setTotalRecharge(new BigDecimal("0")); +// account.setTotalConsume(new BigDecimal("0")); +// account.setStatus(1); + accountMapper.insert(account); + + log.info("通过微信创建用户成功,wxid: {}", wxid); + + return sysUser; + } /** * 根据手机号创建用户 * * @param phone 手机号 * @param inviteCode 邀请码 + * @param roleType 角色类型 + * @param wxid 微信 ID * @return 创建的用户对象 */ - private SysUser createUserByPhone(String phone, String inviteCode) { + private SysUser createUserByPhone(String phone, String inviteCode, Integer roleType, String wxid) { SysUser sysUser = new SysUser(); // 设置用户名(使用手机号作为用户名) sysUser.setUserName(phone); sysUser.setTel(phone); + // 设置微信 ID + if (wxid != null && !wxid.isEmpty()) { + sysUser.setWxid(wxid); + } + + // 设置角色类型 + if (roleType != null) { + sysUser.setRoleType(roleType); + } + // 生成随机邀请码(8位字母数字组合) String generatedInviteCode = generateInviteCode(); sysUser.setInviteCode(generatedInviteCode); @@ -1259,4 +1325,326 @@ public class SysUserServiceImpl implements SysUserService { return fileName; } + + /** + * 根据角色类型创建扩展记录 + * + * @param userId 用户ID + * @param roleType 角色类型 + */ + private void createExtendedRecord(Long userId, Integer roleType) { + try { + if (roleType == null) { + return; + } + + switch (roleType) { + case 4: // 老师 + createEduTeacher(userId); + break; + case 5: // 学生 + createEduStudent(userId); + break; + case 1: // 超级管理员 + case 2: // 学校管理员 + case 3: // 学院管理员 + // 管理员暂时不需要创建扩展记录 + break; + default: + break; + } + } catch (Exception e) { + log.error("创建角色{}的扩展记录失败:{}", roleType, e.getMessage()); + } + } + + /** + * 创建学生记录 + * + * @param userId 用户ID + */ + private void createEduStudent(Long userId) { + try { + // 先检查是否已存在 + EduStudent existing = eduStudentMapper.queryByUserId(userId); + if (existing != null) { + log.info("用户{}的学生记录已存在", userId); + return; + } + + EduStudent student = new EduStudent(); + student.setUserId(userId); + student.setBindingStatus(0); // 未绑定 + eduStudentMapper.insert(student); + log.info("创建用户{}的学生记录成功", userId); + } catch (Exception e) { + log.error("创建学生记录失败:{}", e.getMessage()); + } + } + + /** + * 创建教师记录 + * + * @param userId 用户ID + */ + private void createEduTeacher(Long userId) { + try { + // 先检查是否已存在 + EduTeacher existing = eduTeacherMapper.queryByUserId(userId); + if (existing != null) { + log.info("用户{}的教师记录已存在", userId); + return; + } + + EduTeacher teacher = new EduTeacher(); + teacher.setUserId(userId); + teacher.setBindingStatus(0); // 未绑定 + eduTeacherMapper.insert(teacher); + log.info("创建用户{}的教师记录成功", userId); + } catch (Exception e) { + log.error("创建教师记录失败:{}", e.getMessage()); + } + } + + /** + * 根据角色类型为用户分配角色 + * + * @param userId 用户ID + * @param roleType 角色类型 + */ + private void assignRoleToUser(Long userId, Integer roleType) { + try { + String roleCode = getRoleCodeByType(roleType); + if (roleCode == null) { + log.warn("未知的角色类型:{}", roleType); + return; + } + + // 先检查用户是否已有这个角色 + List existingRoles = queryUserRoles(userId); + if (existingRoles.contains(roleCode)) { + log.info("用户{}已有角色{}", userId, roleCode); + return; + } + + // 删除用户原有角色 + sysUserRoleMapper.deleteByUserId(userId); + + // 创建新角色关联 + art.kexue.sxwz.entity.SysUserRole userRole = new art.kexue.sxwz.entity.SysUserRole(); + userRole.setUserId(userId); + userRole.setRoleCode(roleCode); + userRole.setCreateTime(new Date()); + sysUserRoleMapper.insert(userRole); + + log.info("为用户{}分配角色{}成功", userId, roleCode); + } catch (Exception e) { + log.error("为用户{}分配角色失败:{}", userId, e.getMessage()); + } + } + + /** + * 根据角色类型获取角色编码 + * + * @param roleType 角色类型 + * @return 角色编码 + */ + private String getRoleCodeByType(Integer roleType) { + if (roleType == null) { + return null; + } + + switch (roleType) { + case 1: + return "SUPER"; + case 2: + return "SUPER1"; + case 3: + return "SCOOL_ADMIN"; + case 4: + return "COLLEGE_ADMIN"; + case 5: + return "TEACHER"; + case 6: + return "STUDENT"; + default: + return null; + } + } + + @Override + public boolean bindPhone(String phone, String code) { + // 1. 验证登录,获取当前登录用户 + long userId = Long.parseLong(StpUtil.getLoginId().toString()); + SysUser sysUser = sysUserMapper.queryById(userId); + Assert.notNull(sysUser, "用户不存在"); + + // 2. 校验手机号格式 + Assert.notBlank(phone, "手机号不能为空"); + Assert.notBlank(code, "验证码不能为空"); + + String phoneRegex = "^1[3-9]\\d{9}$"; + if (!phone.matches(phoneRegex)) { + throw new BizException("手机号格式不正确"); + } + + // 3. 检查手机号是否已被其他用户绑定 + SysUser existingUser = sysUserMapper.getByTel(phone); + if (existingUser != null && !existingUser.getUserId().equals(userId)) { + throw new BizException("该手机号已被其他用户绑定"); + } + + // 4. 验证验证码 + String cachedCode = (String) redissonClient.getBucket("sms_code:" + phone).get(); + Assert.notNull(cachedCode, "验证码已过期"); + Assert.equals(cachedCode, code, "验证码错误"); + + // 验证成功后删除新验证码 + redissonClient.getBucket("sms_code:" + phone).delete(); + + // 更新手机号 + sysUser.setTel(phone); + sysUserMapper.update(sysUser); + + log.info("用户{}绑定手机号{}成功", userId, phone); + return true; + } + + @Override + public boolean bindWx(Long userId, String wxid) { + Assert.notNull(userId, "用户ID不能为空"); + Assert.notBlank(wxid, "微信ID不能为空"); + + SysUser sysUser = sysUserMapper.queryById(userId); + Assert.notNull(sysUser, "用户不存在"); + + sysUser.setWxid(wxid); + sysUserMapper.update(sysUser); + + log.info("用户{}绑定微信ID{}成功", userId, wxid); + return true; + } + + @Override + public SysUser createSchoolAdmin(CreateUserDto createUserDto) { + return createUser(createUserDto, 2); + } + + @Override + public SysUser createCollegeAdmin(CreateUserDto createUserDto) { + Assert.notNull(createUserDto.getSchoolId(), "学校ID不能为空"); + return createUser(createUserDto, 3); + } + + @Override + public SysUser createTeacher(CreateUserDto createUserDto) { + Assert.notNull(createUserDto.getSchoolId(), "学校ID不能为空"); + Assert.notNull(createUserDto.getCollegeId(), "学院ID不能为空"); + return createUser(createUserDto, 4); + } + + @Override + public SysUser createStudent(CreateUserDto createUserDto) { + Assert.notNull(createUserDto.getSchoolId(), "学校ID不能为空"); + Assert.notNull(createUserDto.getCollegeId(), "学院ID不能为空"); + return createUser(createUserDto, 5); + } + + private SysUser createUser(CreateUserDto createUserDto, Integer roleType) { + Assert.notBlank(createUserDto.getUserName(), "用户名不能为空"); + Assert.notBlank(createUserDto.getPassword(), "密码不能为空"); + + SysUser existing = getByUsername(createUserDto.getUserName()); + Assert.isNull(existing, "用户名已存在"); + + SysUser sysUser = new SysUser(); + sysUser.setUserName(createUserDto.getUserName()); + sysUser.setEmail(createUserDto.getEmail()); + sysUser.setTel(createUserDto.getTel()); + sysUser.setRoleType(roleType); + sysUser.setEnable(Const.USER_STATUS_NORMAL); + sysUser.setDeleteFlag(Const.DELETE_FLAG_NO); + sysUser.setSalt(System.currentTimeMillis() + ""); + + try { + String encryptedPwd = MD5Util.doubleEncrypt(createUserDto.getPassword(), sysUser.getSalt()); + sysUser.setPwd(encryptedPwd); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + + sysUser.setInviteCode(generateInviteCode()); + sysUserMapper.insert(sysUser); + + Account account = new Account(); + account.setUserId(sysUser.getUserId()); + account.setUserName(sysUser.getUserName()); + account.setBalance(BigDecimal.ZERO); + account.setFrozenAmount(BigDecimal.ZERO); + account.setDeleteFlag(Const.DELETE_FLAG_NO); + accountMapper.insert(account); + + accountService.addGiftBalance(sysUser.getUserId(), BigDecimal.valueOf(100), + "gift_" + System.currentTimeMillis(), null, "register", "注册赠送"); + + createExtendedRecord(sysUser.getUserId(), roleType, createUserDto); + assignRoleToUser(sysUser.getUserId(), roleType); + + sysUser.setPwd(null); + log.info("创建用户成功,用户名:{},角色类型:{}", createUserDto.getUserName(), roleType); + return sysUser; + } + + private void createExtendedRecord(Long userId, Integer roleType, CreateUserDto createUserDto) { + if (roleType == null) { + return; + } + + switch (roleType) { + case 4: + EduTeacher teacher = new EduTeacher(); + teacher.setUserId(userId); + teacher.setSchoolId(createUserDto.getSchoolId()); + teacher.setCollegeId(createUserDto.getCollegeId()); + teacher.setRealName(createUserDto.getRealName()); + teacher.setTeacherNo(createUserDto.getTeacherNo()); + teacher.setBindingStatus(0); + eduTeacherMapper.insert(teacher); + log.info("创建教师记录成功,用户ID:{}", userId); + break; + case 5: + EduStudent student = new EduStudent(); + student.setUserId(userId); + student.setSchoolId(createUserDto.getSchoolId()); + student.setCollegeId(createUserDto.getCollegeId()); + student.setMajorId(createUserDto.getMajorId()); + student.setGrade(createUserDto.getGrade()); + student.setClassName(createUserDto.getClassName()); + student.setStudentNo(createUserDto.getStudentNo()); + student.setRealName(createUserDto.getRealName()); + student.setBindingStatus(0); + eduStudentMapper.insert(student); + log.info("创建学生记录成功,用户ID:{}", userId); + break; + default: + break; + } + } + + @Override + public List getUsersBySchoolIdAndRoleType(Long schoolId, Integer roleType) { + Assert.notNull(schoolId, "学校ID不能为空"); + List users = sysUserMapper.getUsersBySchoolIdAndRoleType(schoolId, roleType); + users.forEach(user -> user.setPwd(null)); + return users; + } + + @Override + public List getUsersWithExtBySchoolIdAndRoleType(Long schoolId, Integer roleType) { + Assert.notNull(schoolId, "学校ID不能为空"); + List users = sysUserMapper.getUsersWithExtBySchoolIdAndRoleType(schoolId, roleType); + users.forEach(user -> user.setPwd(null)); + return users; + } } + diff --git a/src/main/java/art/kexue/sxwz/service/impl/WechatUserServiceImpl.java b/src/main/java/art/kexue/sxwz/service/impl/WechatUserServiceImpl.java new file mode 100644 index 0000000..7d0c956 --- /dev/null +++ b/src/main/java/art/kexue/sxwz/service/impl/WechatUserServiceImpl.java @@ -0,0 +1,77 @@ +package art.kexue.sxwz.service.impl; + +import art.kexue.sxwz.config.WechatConfig; +import art.kexue.sxwz.entity.dto.WechatUserDto; +import art.kexue.sxwz.service.WechatUserService; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.api.WxConsts; +import me.chanjar.weixin.mp.api.WxMpService; +import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken; +import me.chanjar.weixin.mp.bean.result.WxMpUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.UUID; + +@Slf4j +@Service +public class WechatUserServiceImpl implements WechatUserService { + + @Autowired + private WxMpService wxMpService; + + @Autowired + private WechatConfig wechatConfig; + + @Override + public String buildAuthorizationUrl(String redirectUri) { + log.info("构建微信授权URL,回调地址: {}", redirectUri); + String state = generateState(); + return wxMpService.getOAuth2Service().buildAuthorizationUrl( + redirectUri, + WxConsts.OAuth2Scope.SNSAPI_USERINFO, + state + ); + } + + @Override + public String buildAuthorizationUrl() { + log.info("使用配置的回调地址构建微信授权URL"); + String state = generateState(); + return wxMpService.getOAuth2Service().buildAuthorizationUrl( + wechatConfig.getRedirectUri(), + WxConsts.OAuth2Scope.SNSAPI_USERINFO, + state + ); + } + + @Override + public WechatUserDto handleCallback(String code) throws Exception { + log.info("处理微信回调,code: {}", code); + + WxOAuth2AccessToken accessToken = wxMpService.getOAuth2Service().getAccessToken(code); + String openId = accessToken.getOpenId(); + String unionId = accessToken.getUnionId(); + + log.info("获取到用户OpenID: {}, UnionID: {}", openId, unionId); + + WxMpUser user = wxMpService.getUserService().userInfo(openId, null); + + WechatUserDto dto = new WechatUserDto(); + dto.setOpenId(openId); + dto.setUnionId(unionId); + dto.setNickname(user.getNickname()); + dto.setAvatarUrl(user.getHeadImgUrl()); +// dto.setSex(user.getSex()); +// dto.setCountry(user.getCountry()); +// dto.setProvince(user.getProvince()); +// dto.setCity(user.getCity()); + + log.info("获取微信用户信息成功,昵称: {}", dto.getNickname()); + return dto; + } + + private String generateState() { + return UUID.randomUUID().toString().replace("-", ""); + } +} diff --git a/src/main/java/com/kexue/skills/utils/EscapeCharacterUtils.java b/src/main/java/art/kexue/sxwz/utils/EscapeCharacterUtils.java similarity index 99% rename from src/main/java/com/kexue/skills/utils/EscapeCharacterUtils.java rename to src/main/java/art/kexue/sxwz/utils/EscapeCharacterUtils.java index 008a43b..c54fb6e 100644 --- a/src/main/java/com/kexue/skills/utils/EscapeCharacterUtils.java +++ b/src/main/java/art/kexue/sxwz/utils/EscapeCharacterUtils.java @@ -1,4 +1,4 @@ -package com.kexue.skills.utils; +package art.kexue.sxwz.utils; import java.util.HashMap; import java.util.Map; @@ -68,3 +68,4 @@ public class EscapeCharacterUtils { // 输出:HelloWorld"Java"转义符 } } + diff --git a/src/main/java/com/kexue/skills/utils/MD5Util.java b/src/main/java/art/kexue/sxwz/utils/MD5Util.java similarity index 98% rename from src/main/java/com/kexue/skills/utils/MD5Util.java rename to src/main/java/art/kexue/sxwz/utils/MD5Util.java index ba335bb..d64b582 100644 --- a/src/main/java/com/kexue/skills/utils/MD5Util.java +++ b/src/main/java/art/kexue/sxwz/utils/MD5Util.java @@ -1,4 +1,4 @@ -package com.kexue.skills.utils; +package art.kexue.sxwz.utils; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -54,3 +54,4 @@ public class MD5Util { return encryptToHex(clientEncryptedPassword + salt); } } + diff --git a/src/main/java/art/kexue/sxwz/utils/QRCodeUtil.java b/src/main/java/art/kexue/sxwz/utils/QRCodeUtil.java new file mode 100644 index 0000000..f58f14a --- /dev/null +++ b/src/main/java/art/kexue/sxwz/utils/QRCodeUtil.java @@ -0,0 +1,191 @@ +package art.kexue.sxwz.utils; + +import com.google.zxing.*; +import com.google.zxing.client.j2se.MatrixToImageWriter; +import com.google.zxing.common.BitMatrix; +import com.google.zxing.qrcode.QRCodeWriter; +import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Base64; +import java.util.HashMap; +import java.util.Map; + +/** + * 二维码生成工具类 + */ +public class QRCodeUtil { + + /** + * 默认二维码宽度 + */ + private static final int DEFAULT_WIDTH = 300; + + /** + * 默认二维码高度 + */ + private static final int DEFAULT_HEIGHT = 300; + + /** + * 默认图片格式 + */ + private static final String DEFAULT_FORMAT = "PNG"; + + /** + * 生成二维码字节数组 + * + * @param content 二维码内容(文本或URL) + * @return 二维码图片字节数组 + */ + public static byte[] generateQRCode(String content) { + return generateQRCode(content, DEFAULT_WIDTH, DEFAULT_HEIGHT); + } + + /** + * 生成二维码字节数组 + * + * @param content 二维码内容(文本或URL) + * @param width 宽度 + * @param height 高度 + * @return 二维码图片字节数组 + */ + public static byte[] generateQRCode(String content, int width, int height) { + try { + Map hints = new HashMap<>(); + // 设置字符编码 + hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); + // 设置容错级别(H最高) + hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); + // 设置边距 + hints.put(EncodeHintType.MARGIN, 1); + + QRCodeWriter qrCodeWriter = new QRCodeWriter(); + BitMatrix bitMatrix = qrCodeWriter.encode(content, BarcodeFormat.QR_CODE, width, height, hints); + + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + MatrixToImageWriter.writeToStream(bitMatrix, DEFAULT_FORMAT, outputStream); + + return outputStream.toByteArray(); + } catch (WriterException | IOException e) { + throw new RuntimeException("生成二维码失败: " + e.getMessage(), e); + } + } + + /** + * 生成二维码Base64字符串 + * + * @param content 二维码内容(文本或URL) + * @return Base64编码的二维码图片字符串(包含data:image/png;base64,前缀) + */ + public static String generateQRCodeBase64(String content) { + return generateQRCodeBase64(content, DEFAULT_WIDTH, DEFAULT_HEIGHT); + } + + /** + * 生成二维码Base64字符串 + * + * @param content 二维码内容(文本或URL) + * @param width 宽度 + * @param height 高度 + * @return Base64编码的二维码图片字符串(包含data:image/png;base64,前缀) + */ + public static String generateQRCodeBase64(String content, int width, int height) { + byte[] qrCodeBytes = generateQRCode(content, width, height); + String base64 = Base64.getEncoder().encodeToString(qrCodeBytes); + return "data:image/png;base64," + base64; + } + + /** + * 生成带Logo的二维码字节数组 + * + * @param content 二维码内容(文本或URL) + * @param logoBytes Logo图片字节数组 + * @return 带Logo的二维码图片字节数组 + */ + public static byte[] generateQRCodeWithLogo(String content, byte[] logoBytes) { + return generateQRCodeWithLogo(content, logoBytes, DEFAULT_WIDTH, DEFAULT_HEIGHT); + } + + /** + * 生成带Logo的二维码字节数组 + * + * @param content 二维码内容(文本或URL) + * @param logoBytes Logo图片字节数组 + * @param width 宽度 + * @param height 高度 + * @return 带Logo的二维码图片字节数组 + */ + public static byte[] generateQRCodeWithLogo(String content, byte[] logoBytes, int width, int height) { + try { + Map hints = new HashMap<>(); + hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); + hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); + hints.put(EncodeHintType.MARGIN, 1); + + QRCodeWriter qrCodeWriter = new QRCodeWriter(); + BitMatrix bitMatrix = qrCodeWriter.encode(content, BarcodeFormat.QR_CODE, width, height, hints); + + // 将BitMatrix转换为BufferedImage + java.awt.image.BufferedImage qrImage = MatrixToImageWriter.toBufferedImage(bitMatrix); + + // 如果有Logo,添加Logo + if (logoBytes != null && logoBytes.length > 0) { + java.io.ByteArrayInputStream logoStream = new java.io.ByteArrayInputStream(logoBytes); + java.awt.image.BufferedImage logoImage = javax.imageio.ImageIO.read(logoStream); + + if (logoImage != null) { + int logoWidth = qrImage.getWidth() / 5; + int logoHeight = qrImage.getHeight() / 5; + int logoX = (qrImage.getWidth() - logoWidth) / 2; + int logoY = (qrImage.getHeight() - logoHeight) / 2; + + // 缩放Logo图片 + java.awt.image.BufferedImage scaledLogo = new java.awt.image.BufferedImage(logoWidth, logoHeight, logoImage.getType()); + java.awt.Graphics2D g = scaledLogo.createGraphics(); + g.drawImage(logoImage, 0, 0, logoWidth, logoHeight, null); + g.dispose(); + + // 将Logo绘制到二维码上 + java.awt.Graphics2D qrG = qrImage.createGraphics(); + qrG.drawImage(scaledLogo, logoX, logoY, null); + qrG.dispose(); + } + } + + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + javax.imageio.ImageIO.write(qrImage, DEFAULT_FORMAT, outputStream); + + return outputStream.toByteArray(); + } catch (WriterException | IOException e) { + throw new RuntimeException("生成带Logo的二维码失败: " + e.getMessage(), e); + } + } + + /** + * 生成带Logo的二维码Base64字符串 + * + * @param content 二维码内容(文本或URL) + * @param logoBytes Logo图片字节数组 + * @return Base64编码的带Logo二维码图片字符串 + */ + public static String generateQRCodeWithLogoBase64(String content, byte[] logoBytes) { + byte[] qrCodeBytes = generateQRCodeWithLogo(content, logoBytes); + String base64 = Base64.getEncoder().encodeToString(qrCodeBytes); + return "data:image/png;base64," + base64; + } + + /** + * 验证URL格式 + * + * @param url URL字符串 + * @return 是否为有效的URL + */ + public static boolean isValidUrl(String url) { + if (url == null || url.isEmpty()) { + return false; + } + String urlRegex = "^(https?|ftp):\\/\\/[\\w\\-]+(\\.[\\w\\-]+)+([\\w\\-.,@?^=%&:/~+#]*[\\w\\-@?^=%&/~+#])?$"; + return url.matches(urlRegex); + } +} diff --git a/src/main/java/com/kexue/skills/utils/YamlToMapUtil.java b/src/main/java/art/kexue/sxwz/utils/YamlToMapUtil.java similarity index 98% rename from src/main/java/com/kexue/skills/utils/YamlToMapUtil.java rename to src/main/java/art/kexue/sxwz/utils/YamlToMapUtil.java index 23498cb..3c9f46f 100644 --- a/src/main/java/com/kexue/skills/utils/YamlToMapUtil.java +++ b/src/main/java/art/kexue/sxwz/utils/YamlToMapUtil.java @@ -1,4 +1,4 @@ -package com.kexue.skills.utils; +package art.kexue.sxwz.utils; import org.apache.commons.io.FileUtils; import org.yaml.snakeyaml.Yaml; @@ -8,10 +8,8 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; -import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; -import java.util.Objects; /** * 通用 YAML 解析工具:YAML 文件/文本 → Map(支持嵌套结构) @@ -155,4 +153,4 @@ public class YamlToMapUtil { e.printStackTrace(); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/utils/YamlUtil.java b/src/main/java/art/kexue/sxwz/utils/YamlUtil.java similarity index 92% rename from src/main/java/com/kexue/skills/utils/YamlUtil.java rename to src/main/java/art/kexue/sxwz/utils/YamlUtil.java index 34193f9..efc7e78 100644 --- a/src/main/java/com/kexue/skills/utils/YamlUtil.java +++ b/src/main/java/art/kexue/sxwz/utils/YamlUtil.java @@ -1,4 +1,4 @@ -package com.kexue.skills.utils; +package art.kexue.sxwz.utils; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; @@ -15,4 +15,4 @@ public class YamlUtil { Yaml yaml = new Yaml(options); return yaml.dump(obj); } -} \ No newline at end of file +} diff --git a/src/main/java/com/kexue/skills/common/LoginUserCacheUtil.java b/src/main/java/com/kexue/skills/common/LoginUserCacheUtil.java deleted file mode 100644 index 68e33eb..0000000 --- a/src/main/java/com/kexue/skills/common/LoginUserCacheUtil.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.kexue.skills.common; - -import com.kexue.skills.entity.request.LoginUser; -import com.kexue.skills.mapper.*; -import jakarta.servlet.http.HttpServletRequest; -import org.redisson.api.RedissonClient; -import org.springframework.stereotype.Component; -import org.springframework.web.context.request.ServletRequestAttributes; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; - -/** - * LoginUser缓存工具类 - * 用于更新Redis中的LoginUser对象 - */ -@Component -public class LoginUserCacheUtil { - - @Resource - private RedissonClient redissonClient; - - @Resource - private CmsContentLikeMapper cmsContentLikeMapper; - - @Resource - private CmsContentViewMapper cmsContentViewMapper; - - @Resource - private CmsContentMapper cmsContentMapper; - - @Resource - private ContentPurchaseMapper contentPurchaseMapper; - - /** - * 更新用户的收藏列表 - * - * @param token 用户token - * @param userId 用户ID - */ - public void updateFavorites(String token, Long userId) { - updateLoginUserList(token, userId, "favorites", () -> cmsContentLikeMapper.queryRecentLikesByUserId(userId, 20)); - } - - /** - * 更新用户的查看历史列表 - * - * @param token 用户token - * @param userId 用户ID - */ - public void updateHistory(String token, Long userId) { - updateLoginUserList(token, userId, "history", () -> cmsContentViewMapper.queryRecentViewsByUserId(userId, 20)); - } - - /** - * 更新用户的创建记录列表 - * - * @param token 用户token - * @param userId 用户ID - */ - public void updateCreate(String token, Long userId) { - updateLoginUserList(token, userId, "create", () -> cmsContentMapper.queryRecentCreatedByUserId(userId, 20)); - } - - /** - * 更新用户的购买记录列表 - * - * @param token 用户token - * @param userId 用户ID - */ - public void updateHas(String token, Long userId) { - updateLoginUserList(token, userId, "has", () -> { - List has = new ArrayList<>(); - try { - com.kexue.skills.entity.dto.ContentPurchaseDto purchaseDto = new com.kexue.skills.entity.dto.ContentPurchaseDto(); - purchaseDto.setUserId(userId); - List purchases = contentPurchaseMapper.getList(purchaseDto); - if (purchases != null && !purchases.isEmpty()) { - java.util.LinkedHashSet contentIdSet = new java.util.LinkedHashSet<>(); - for (com.kexue.skills.entity.ContentPurchase purchase : purchases) { - if (contentIdSet.size() < 20) { - contentIdSet.add(purchase.getContentId()); - } else { - break; - } - } - has.addAll(contentIdSet); - } - } catch (Exception e) { - e.printStackTrace(); - has = java.util.Collections.emptyList(); - } - return has; - }); - } - - /** - * 更新LoginUser中的列表属性 - * - * @param token 用户token - * @param userId 用户ID - * @param fieldName 字段名 - * @param supplier 列表数据提供者 - */ - private void updateLoginUserList(String token, Long userId, String fieldName, java.util.function.Supplier> supplier) { - try { - String key = "loginUser:" + token; - Object loginUserObj = redissonClient.getBucket(key).get(); - if (loginUserObj != null) { - String loginUserJson = loginUserObj.toString(); - com.kexue.skills.entity.request.LoginUser loginUser = com.alibaba.fastjson.JSON.parseObject(loginUserJson, com.kexue.skills.entity.request.LoginUser.class); - - if (loginUser != null && loginUser.getUserInfo() != null && loginUser.getUserInfo().getUserId().equals(userId)) { - List list = supplier.get(); - - switch (fieldName) { - case "favorites": - loginUser.setFavorites(list); - break; - case "history": - loginUser.setHistory(list); - break; - case "create": - loginUser.setCreate(list); - break; - case "has": - loginUser.setHas(list); - break; - } - - // 写回Redis - redissonClient.getBucket(key).set(com.alibaba.fastjson.JSON.toJSONString(loginUser)); - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 从请求中获取token - * - * @return token - */ - public String getTokenFromRequest() { - org.springframework.web.context.request.RequestAttributes requestAttributes = org.springframework.web.context.request.RequestContextHolder.getRequestAttributes(); - if (requestAttributes != null && requestAttributes instanceof org.springframework.web.context.request.ServletRequestAttributes) { - HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest(); - if (request != null) { - return request.getHeader("Authorization"); - } - } - return null; - } - - /** - * 获取当前登录用户ID - * - * @return 用户ID - */ - public Long getCurrentUserId() { - try { - Object loginId = cn.dev33.satoken.stp.StpUtil.getLoginId(); - return Long.parseLong(loginId.toString()); - } catch (Exception e) { - return null; - } - } -} diff --git a/src/main/java/com/kexue/skills/controller/CmsCategoryController.java b/src/main/java/com/kexue/skills/controller/CmsCategoryController.java deleted file mode 100644 index a7264b8..0000000 --- a/src/main/java/com/kexue/skills/controller/CmsCategoryController.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.kexue.skills.controller; - -import com.github.pagehelper.PageInfo; -import com.kexue.skills.annotation.RequireAuth; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.CmsCategory; -import com.kexue.skills.entity.base.IdDto; -import com.kexue.skills.entity.dto.CmsCategoryDto; -import com.kexue.skills.service.CmsCategoryService; -import com.kexue.skills.service.CmsTagService; -import com.kexue.skills.service.CmsCategoryTagService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; - -/** - * (CmsCategory)表控制层 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@RestController -@RequestMapping("api/cmsCategory") -@Tag(name = "内容类目(skills-分类) Api") -@CrossOrigin(origins = "*") -public class CmsCategoryController { - /** - * 服务对象 - */ - @Resource - private CmsCategoryService cmsCategoryService; - - /** - * 标签服务对象 - */ - @Resource - private CmsTagService cmsTagService; - - /** - * 分类标签关联服务对象 - */ - @Resource - private CmsCategoryTagService cmsCategoryTagService; - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @PostMapping("/getPageList") - @Operation(summary = "查询分页列表", description = "查询分页列表") - public CommonResult> getPageList(@RequestBody CmsCategoryDto queryDto) { - return CommonResult.success(cmsCategoryService.getPageList(queryDto)); - } - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @PostMapping("/getList") - @Operation(summary = "查询列表", description = "查询列表") - public CommonResult> getList(@RequestBody CmsCategoryDto queryDto) { - return CommonResult.success(new PageInfo<>(cmsCategoryService.getList(queryDto))); - } - - /** - * 新增数据 - * - * @param cmsCategory 实体 - * @return 新增结果 - */ - @PostMapping("/insert") - @Operation(summary = "新增分类", description = "新增分类") - @RequireAuth - public CommonResult insert(@RequestBody CmsCategory cmsCategory) { - return CommonResult.success(cmsCategoryService.insert(cmsCategory)); - } - - /** - * 编辑数据 - * - * @param cmsCategory 实体 - * @return 编辑结果 - */ - @PostMapping("/update") - @Operation(summary = "更新分类", description = "更新分类") - @RequireAuth - public CommonResult update(@RequestBody CmsCategory cmsCategory) { - return CommonResult.success(cmsCategoryService.update(cmsCategory)); - } - - /** - * 通过主键逻辑删除 - * - * @param idDto 主键 - * @return 删除数据 - */ - @PostMapping("/logicDeleteById") - @Operation(summary = "逻辑删除分类", description = "逻辑删除分类") - @RequireAuth - public CommonResult logicDeleteById(@RequestBody IdDto idDto) { - return CommonResult.success(cmsCategoryService.logicDeleteById(idDto.getId(), "admin") > 0); - } - - /** - * 删除数据 - * - * @param categoryId 主键 - * @return 删除数据 - */ - @PostMapping("deleteById/{categoryId}") - @Operation(summary = "物理删除分类", description = "物理删除分类") - @RequireAuth - public CommonResult deleteById(@PathVariable("categoryId") Long categoryId) { - return CommonResult.success(cmsCategoryService.deleteById(categoryId) > 0); - } - - /** - * 获取分类树列表 - * - * @return 分类树列表 - */ - @GetMapping("/getCategoryTreeList") - @Operation(summary = "获取分类树列表", description = "获取分类树列表,包含分类名称、分类ID和子分类列表") - public CommonResult> getCategoryTreeList() { - return CommonResult.success(cmsCategoryService.getCategoryTreeList()); - } - - /** - * 获取分类字典 - * - * @return 分类字典,key为分类ID,value为分类名称 - */ - @GetMapping("/getCategoryDict") - @Operation(summary = "获取分类字典", description = "获取分类字典,返回Map,分类ID和分类名称的映射") - public CommonResult> getCategoryDict() { - return CommonResult.success(cmsCategoryService.getCategoryDict()); - } - - /** - * 获取标签列表 - * - * @param categoryId 分类ID(可选),不传则返回所有标签 - * @return 标签列表 - */ - @GetMapping("/tagList") - @Operation(summary = "获取标签列表", description = "获取标签列表,若传入分类ID则返回该分类下的标签,否则返回所有标签") - public CommonResult> getTagList(@RequestParam(value = "categoryId", required = false) Long categoryId) { - if (categoryId != null) { - // 根据分类ID查询标签列表 - return CommonResult.success(cmsCategoryTagService.getTagsByCategoryId(categoryId)); - } else { - // 查询所有标签 - com.kexue.skills.entity.dto.CmsTagDto queryDto = new com.kexue.skills.entity.dto.CmsTagDto(); - queryDto.setDeleteFlag(0); - queryDto.setStatus(1); - return CommonResult.success(cmsTagService.getList(queryDto)); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/controller/CmsContentController.java b/src/main/java/com/kexue/skills/controller/CmsContentController.java deleted file mode 100644 index f7ef7c5..0000000 --- a/src/main/java/com/kexue/skills/controller/CmsContentController.java +++ /dev/null @@ -1,378 +0,0 @@ -package com.kexue.skills.controller; - -import com.github.pagehelper.PageInfo; -import com.kexue.skills.annotation.Log; -import com.kexue.skills.annotation.RequireAuth; -import com.kexue.skills.common.Assert; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.CmsContent; -import com.kexue.skills.entity.base.IdDto; -import com.kexue.skills.entity.dto.CmsContentDto; -import com.kexue.skills.entity.dto.QueryContentDto; -import com.kexue.skills.entity.request.ImportPathDto; -import com.kexue.skills.service.CmsContentService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import java.io.IOException; - -/** - * (CmsContent)表控制层 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@RestController -@RequestMapping("api/cmsContent") -@Tag(name = "skill(skills)管理 Api") -@CrossOrigin(origins = "*") -public class CmsContentController { - /** - * 服务对象 - */ - @Resource - private CmsContentService cmsContentService; - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @PostMapping("/getPageList") - @Operation(summary = "查询分页列表", description = "查询分页列表") - public CommonResult> getPageList(@RequestBody CmsContentDto queryDto) { - return CommonResult.success(cmsContentService.getPageList(queryDto)); - } - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @PostMapping("/getList") - @Operation(summary = "查询列表", description = "查询列表") - public CommonResult> getList(@RequestBody CmsContentDto queryDto) { - return CommonResult.success(new PageInfo<>(cmsContentService.getList(queryDto))); - } - - /** - * 通过主键查询单条数据 - * - * @param contentId 主键 - * @return 单条数据 - */ - @PostMapping("queryById/{contentId}") - @Operation(summary = "通过ID查询skill", description = "通过ID查询skill") - public CommonResult queryById(@PathVariable("contentId") Long contentId) { - // 增加阅读量 - cmsContentService.increaseViewCount(contentId); - return CommonResult.success(cmsContentService.queryById(contentId)); - } - - /** - * 新增数据 - * - * @param cmsContent 实体 - * @return 新增结果 - */ - @PostMapping("/insert") - @Operation(summary = "新增skill", description = "新增skill") - @RequireAuth - public CommonResult insert(@RequestBody CmsContent cmsContent) { - return CommonResult.success(cmsContentService.insert(cmsContent)); - } - - /** - * 编辑数据 - * - * @param cmsContent 实体 - * @return 编辑结果 - */ - @PostMapping("/update") - @Operation(summary = "更新skill", description = "更新skill") - @RequireAuth - public CommonResult update(@RequestBody CmsContent cmsContent) { - return CommonResult.success(cmsContentService.update(cmsContent)); - } - - /** - * 更新审核状态 - * - * @param contentId skillID - * @param auditStatus 审核状态 - * @param reviewerId 审核人ID - * @param reviewerName 审核人名称 - * @param auditComment 审核意见 - * @return 审核结果 - */ - @PostMapping("/updateAuditStatus") - @Operation(summary = "更新审核状态", description = "更新审核状态") - @RequireAuth - public CommonResult updateAuditStatus(@RequestParam("contentId") Long contentId, - @RequestParam("auditStatus") Integer auditStatus, - @RequestParam("reviewerId") Long reviewerId, - @RequestParam("reviewerName") String reviewerName, - @RequestParam(value = "auditComment", required = false) String auditComment) { - return CommonResult.success(cmsContentService.updateAuditStatus(contentId, auditStatus, reviewerId, reviewerName, auditComment, reviewerName) > 0); - } - - /** - * 更新发布状态 - * - * @param contentId skillID - * @param publishStatus 发布状态 - * @param publishTime 发布时间 - * @param updateBy 更新人 - * @return 发布结果 - */ - @PostMapping("/updatePublishStatus") - @Operation(summary = "更新发布状态", description = "更新发布状态") - @RequireAuth - public CommonResult updatePublishStatus(@RequestParam("contentId") Long contentId, - @RequestParam("publishStatus") Integer publishStatus, - @RequestParam(value = "publishTime", required = false) String publishTime, - @RequestParam("updateBy") String updateBy) { - return CommonResult.success(cmsContentService.updatePublishStatus(contentId, publishStatus, publishTime, updateBy) > 0); - } - - /** - * 增加阅读量 - * - * @param contentId skillID - * @return 增加结果 - */ - @PostMapping("/increaseViewCount/{contentId}") - @Operation(summary = "增加阅读量", description = "增加阅读量") - public CommonResult increaseViewCount(@PathVariable("contentId") Long contentId) { - return CommonResult.success(cmsContentService.increaseViewCount(contentId) > 0); - } - - /** - * 通过主键逻辑删除 - * - * @param idDto 主键 - * @return 删除数据 - */ - @PostMapping("/logicDeleteById") - @Operation(summary = "逻辑删除skill", description = "逻辑删除skill") - @RequireAuth - public CommonResult logicDeleteById(@RequestBody IdDto idDto) { - return CommonResult.success(cmsContentService.logicDeleteById(idDto.getId(), "admin") > 0); - } - - /** - * 删除数据 - * - * @param contentId 主键 - * @return 删除数据 - */ - @PostMapping("deleteById/{contentId}") - @Operation(summary = "物理删除skill", description = "物理删除skill") - @RequireAuth - public CommonResult deleteById(@PathVariable("contentId") Long contentId) { - return CommonResult.success(cmsContentService.deleteById(contentId) > 0); - } - - /** - * 添加收藏 - * - * @param contentId skillID - * @return 操作结果 - */ - @PostMapping("/addFavorite") - @Operation(summary = "添加收藏", description = "添加skill收藏") - @RequireAuth - public CommonResult addFavorite(@RequestParam("contentId") Long contentId) { - return CommonResult.success(cmsContentService.addFavorite(contentId) > 0); - } - - /** - * 取消收藏 - * - * @param contentId skillID - * @return 操作结果 - */ - @PostMapping("/removeFavorite") - @Operation(summary = "取消收藏", description = "取消skill收藏") - @RequireAuth - public CommonResult removeFavorite(@RequestParam("contentId") Long contentId) { - return CommonResult.success(cmsContentService.removeFavorite(contentId) > 0); - } - - /** - * 添加查看记录 - * - * @param contentId skillID - * @return 操作结果 - */ - @PostMapping("/addView") - @Operation(summary = "添加查看记录", description = "添加skill查看记录") - @RequireAuth - public CommonResult addView(@RequestParam("contentId") Long contentId) { - return CommonResult.success(cmsContentService.addView(contentId) > 0); - } - - /** - * 获取用户历史查看的内容列表 - * - * @param queryDto 筛选条件,包含分页信息 - * @return 查询结果 - */ - @PostMapping("/getUserHistory") - @Operation(summary = "获取用户历史查看", description = "获取当前用户历史查看的内容列表,带分页") - @RequireAuth - public CommonResult> getUserHistory(@RequestBody CmsContentDto queryDto) { - return CommonResult.success(cmsContentService.getPageListByUserHistory(queryDto)); - } - - /** - * 获取用户收藏的内容列表 - * - * @param queryDto 筛选条件,包含分页信息 - * @return 查询结果 - */ - @PostMapping("/getUserFavorites") - @Operation(summary = "获取用户收藏", description = "获取当前用户收藏的内容列表,带分页") - @RequireAuth - public CommonResult> getUserFavorites(@RequestBody CmsContentDto queryDto) { - return CommonResult.success(cmsContentService.getPageListByUserFavorites(queryDto)); - } - - /** - * 获取用户购买的内容列表 - * - * @param queryDto 筛选条件,包含分页信息 - * @return 查询结果 - */ - @PostMapping("/getUserPurchases") - @Operation(summary = "获取用户拥有", description = "获取当前用户购买的内容列表,带分页") - @RequireAuth - public CommonResult> getUserPurchases(@RequestBody CmsContentDto queryDto) { - return CommonResult.success(cmsContentService.getPageListByUserPurchases(queryDto)); - } - - /** - * 获取用户创建的内容列表 - * - * @param queryDto 筛选条件,包含分页信息和发布状态 - * @return 查询结果 - */ - @PostMapping("/getUserCreated") - @Operation(summary = "获取用户创建", description = "获取当前用户创建的内容列表,带分页,可查询已发布、未发布") - @RequireAuth - public CommonResult> getUserCreated(@RequestBody CmsContentDto queryDto) { - return CommonResult.success(cmsContentService.getPageListByUserCreated(queryDto)); - } - - /** - * 导入Excel数据到CmsContent - * - * @param file Excel文件 - * @param createBy 创建人 - * @return 导入结果 - */ - @PostMapping("/importFromExcel") - @Operation(summary = "导入Excel数据", description = "从Excel文件导入数据到CmsContent") - @RequireAuth - public CommonResult importFromExcel(@RequestParam("file") MultipartFile file, @RequestParam("createBy") String createBy) { - try { - byte[] fileBytes = file.getBytes(); - int successCount = cmsContentService.importFromExcel(fileBytes, createBy); - return CommonResult.success(successCount); - } catch (IOException e) { - e.printStackTrace(); - return CommonResult.failed("导入失败:" + e.getMessage()); - } - } - - /** - * 获取CmsContent的content字段内容 - * - * @param queryContentDto 包含contentId和languageType的DTO对象 - * @return content或contentEn字段的内容 - */ - @PostMapping("/getContent") - @Operation(summary = "获取内容详情", description = "根据languageType获取content或contentEn字段的内容") - public CommonResult getContent(@RequestBody QueryContentDto queryContentDto) { - String content = cmsContentService.getContent(queryContentDto.getContentId(), queryContentDto.getLanguageType()); - return CommonResult.success(content); - } - - /** - * 获取CmsContent的title字段内容 - * - * @param contentId 内容ID - * @return title字段的内容 - */ - @PostMapping("/getTitle/{contentId}") - @Operation(summary = "获取标题", description = "根据contentId获取title字段的内容") - public CommonResult getTitle(@PathVariable("contentId") Long contentId) { - String title = cmsContentService.getTitle(contentId); - return CommonResult.success(title); - } - - /** - * 从指定目录导入Excel数据到CmsContent - * - * @param importPathDto 导入路径请求参数 - * @param createBy 创建人 - * @return 导入结果 - */ - @PostMapping("/importFromPath") - @Operation(summary = "从目录导入Excel数据", description = "从指定目录导入Excel数据到CmsContent") - @RequireAuth - public CommonResult importFromPath(@RequestBody ImportPathDto importPathDto, @RequestParam("createBy") String createBy) { - try { - int successCount = cmsContentService.importFromPath(importPathDto, createBy); - return CommonResult.success(successCount); - } catch (Exception e) { - e.printStackTrace(); - return CommonResult.failed("导入失败:" + e.getMessage()); - } - } - - /** - * 从ZIP文件批量导入Excel数据到CmsContent - * - * @param file ZIP文件 - * @param createBy 创建人 - * @return 导入结果 - */ - @PostMapping("/importFromZip") - @Operation(summary = "从ZIP文件批量导入Excel数据", description = "上传ZIP文件,批量导入其中的所有Excel文件到CmsContent") - @RequireAuth - public CommonResult importFromZip(@RequestParam("file") MultipartFile file, @RequestParam("createBy") String createBy) { - try { - byte[] zipFileBytes = file.getBytes(); - int successCount = cmsContentService.importFromZip(zipFileBytes, createBy); - return CommonResult.success(successCount); - } catch (IOException e) { - e.printStackTrace(); - return CommonResult.failed("导入失败:" + e.getMessage()); - } - } - - /** - * 从指定目录读取Excel数据并更新CmsContent - * - * @param importPathDto 导入路径请求参数 - * @param updateBy 更新人 - * @return 更新结果 - */ - @PostMapping("/updateFromPath") - @Operation(summary = "从目录更新Excel数据", description = "从指定目录读取Excel数据并更新CmsContent") - @RequireAuth - public CommonResult updateFromPath(@RequestBody ImportPathDto importPathDto, @RequestParam("updateBy") String updateBy) { - try { - int successCount = cmsContentService.updateFromPath(importPathDto, updateBy); - return CommonResult.success(successCount); - } catch (Exception e) { - e.printStackTrace(); - return CommonResult.failed("更新失败:" + e.getMessage()); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/controller/CmsTagController.java b/src/main/java/com/kexue/skills/controller/CmsTagController.java deleted file mode 100644 index 7045624..0000000 --- a/src/main/java/com/kexue/skills/controller/CmsTagController.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.kexue.skills.controller; - -import com.github.pagehelper.PageInfo; -import com.kexue.skills.annotation.RequireAuth; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.CmsTag; -import com.kexue.skills.entity.base.IdDto; -import com.kexue.skills.entity.dto.CmsTagDto; -import com.kexue.skills.service.CmsTagService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; - -/** - * (CmsTag)表控制层 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@RestController -@RequestMapping("api/cmsTag") -@Tag(name = "标签管理 Api") -@CrossOrigin(origins = "*") -public class CmsTagController { - /** - * 服务对象 - */ - @Resource - private CmsTagService cmsTagService; - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @PostMapping("/getPageList") - @Operation(summary = "查询分页列表", description = "查询分页列表") - public CommonResult> getPageList(@RequestBody CmsTagDto queryDto) { - return CommonResult.success(cmsTagService.getPageList(queryDto)); - } - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @PostMapping("/getList") - @Operation(summary = "查询列表", description = "查询列表") - public CommonResult> getList(@RequestBody CmsTagDto queryDto) { - return CommonResult.success(new PageInfo<>(cmsTagService.getList(queryDto))); - } - - /** - * 通过主键查询单条数据 - * - * @param tagId 主键 - * @return 单条数据 - */ - @PostMapping("queryById/{tagId}") - @Operation(summary = "通过ID查询标签", description = "通过ID查询标签") - public CommonResult queryById(@PathVariable("tagId") Long tagId) { - return CommonResult.success(cmsTagService.queryById(tagId)); - } - - /** - * 新增数据 - * - * @param cmsTag 实体 - * @return 新增结果 - */ - @PostMapping("/insert") - @Operation(summary = "新增标签", description = "新增标签") - @RequireAuth - public CommonResult insert(@RequestBody CmsTag cmsTag) { - return CommonResult.success(cmsTagService.insert(cmsTag)); - } - - /** - * 编辑数据 - * - * @param cmsTag 实体 - * @return 编辑结果 - */ - @PostMapping("/update") - @Operation(summary = "更新标签", description = "更新标签") - @RequireAuth - public CommonResult update(@RequestBody CmsTag cmsTag) { - return CommonResult.success(cmsTagService.update(cmsTag)); - } - - /** - * 通过主键逻辑删除 - * - * @param idDto 主键 - * @return 删除数据 - */ - @PostMapping("/logicDeleteById") - @Operation(summary = "逻辑删除标签", description = "逻辑删除标签") - @RequireAuth - public CommonResult logicDeleteById(@RequestBody IdDto idDto) { - return CommonResult.success(cmsTagService.logicDeleteById(idDto.getId(), "admin") > 0); - } - - /** - * 删除数据 - * - * @param tagId 主键 - * @return 删除数据 - */ - @PostMapping("deleteById/{tagId}") - @Operation(summary = "物理删除标签", description = "物理删除标签") - @RequireAuth - public CommonResult deleteById(@PathVariable("tagId") Long tagId) { - return CommonResult.success(cmsTagService.deleteById(tagId) > 0); - } - - -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/controller/CommonController.java b/src/main/java/com/kexue/skills/controller/CommonController.java deleted file mode 100644 index 0054bef..0000000 --- a/src/main/java/com/kexue/skills/controller/CommonController.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.kexue.skills.controller; - -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.config.UploadConfig; -import com.kexue.skills.entity.request.UploadResponse; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; - -/** - * @author 维哥 - * @Description - * @create 2025-02-27 10:55 - */ -@RestController -@RequestMapping("api/common") -@Tag(name = "Common Api") -@CrossOrigin(origins = "*") -@Slf4j -public class CommonController { - - @Resource - private UploadConfig uploadConfig; - - - /** - * 文件上传接口 - * URL: http://localhost:8080/common/uploadFile - * Method: POST - * Body: form-data - * Key: file - * Value: 选择一个文件进行上传 - * @param file - * @return - */ - @PostMapping("/uploadFile") - @Operation(summary = "文件上传", description = "文件上传接口") - public CommonResult uploadFile(@RequestParam("file") MultipartFile file) { - if (file.isEmpty()) { - return CommonResult.failed("文件为空,请选择文件后再上传"); - } - - try { - // 创建上传目录(如果不存在) - Path uploadPath = Paths.get(uploadConfig.getFileUploadDir()); - if (!Files.exists(uploadPath)) { - Files.createDirectories(uploadPath); - } - - // 构建文件保存路径 - Path filePath = uploadPath.resolve(file.getOriginalFilename()); - - // 保存文件 - Files.copy(file.getInputStream(), filePath, StandardCopyOption.REPLACE_EXISTING); - - UploadResponse uploadResponse = new UploadResponse(); - uploadResponse.setFileName(file.getOriginalFilename()); - uploadResponse.setFileUrl(uploadConfig.getFileUrlPrefix() + file.getOriginalFilename()); - return CommonResult.success(uploadResponse); - } catch (IOException e) { - e.printStackTrace(); - return CommonResult.failed("文件上传失败: " + e.getMessage()); - } - } - - /** - * 图片上传接口 - * URL: http://localhost:8080/common/uploadImage - * Method: POST - * Body: form-data - * Key: file - * Value: 选择一个图片文件进行上传 - * @param image - * @return - */ - @PostMapping("/uploadImage") - @Operation(summary = "图片上传", description = "图片上传接口") - public CommonResult uploadImage(@RequestParam("image") MultipartFile image) { - if (image.isEmpty()) { - return CommonResult.failed("图片为空,请选择图片后再上传"); - } - - // 检查文件是否为图片 - if (!image.getContentType().startsWith("image")) { - return CommonResult.failed("上传的文件不是图片"); - } - - try { - // 创建上传目录(如果不存在) - Path uploadPath = Paths.get(uploadConfig.getImgUploadDir()); - if (!Files.exists(uploadPath)) { - Files.createDirectories(uploadPath); - } - - // 构建文件保存路径 - Path filePath = uploadPath.resolve(image.getOriginalFilename()); - - // 保存文件 - Files.copy(image.getInputStream(), filePath, StandardCopyOption.REPLACE_EXISTING); - - UploadResponse uploadResponse = new UploadResponse(); - uploadResponse.setFileName(image.getOriginalFilename()); - uploadResponse.setFileUrl(uploadConfig.getImgUrlPrefix() + image.getOriginalFilename()); - return CommonResult.success(uploadResponse); - } catch (IOException e) { - e.printStackTrace(); - return CommonResult.failed("图片上传失败: " + e.getMessage()); - } - } - - // 在 CommonController.java 中新增接口 - - - - -} diff --git a/src/main/java/com/kexue/skills/controller/ContentPurchaseController.java b/src/main/java/com/kexue/skills/controller/ContentPurchaseController.java deleted file mode 100644 index 2f68f47..0000000 --- a/src/main/java/com/kexue/skills/controller/ContentPurchaseController.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.kexue.skills.controller; - -import cn.dev33.satoken.stp.StpUtil; -import com.github.pagehelper.PageInfo; -import com.kexue.skills.annotation.RequireAuth; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.ContentPurchase; -import com.kexue.skills.entity.dto.ContentPurchaseDto; -import com.kexue.skills.service.ContentPurchaseService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * (ContentPurchase)表控制层 - * 内容购买控制器 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Tag(name = "内容购买管理 Api") -@RestController -@RequestMapping("/api/contentPurchase") -public class ContentPurchaseController { - /** - * 服务对象 - */ - @Resource - private ContentPurchaseService contentPurchaseService; - - /** - * 分页查询 - * - * @param queryDto 查询参数 - * @return 分页结果 - */ - @Operation(summary = "分页查询内容购买记录", description = "分页查询内容购买记录") - @PostMapping("/pageList") - @RequireAuth - public CommonResult> getPageList(@RequestBody ContentPurchaseDto queryDto) { - return CommonResult.success(this.contentPurchaseService.getPageList(queryDto)); - } - - /** - * 查询列表 - * - * @param queryDto 查询参数 - * @return 列表结果 - */ - @Operation(summary = "查询内容购买记录列表", description = "查询内容购买记录列表") - @PostMapping("/list") - @RequireAuth - public CommonResult> getList(@RequestBody ContentPurchaseDto queryDto) { - return CommonResult.success(this.contentPurchaseService.getList(queryDto)); - } - - /** - * 通过主键查询单条数据 - * - * @param purchaseId 主键 - * @return 单条数据 - */ - @Operation(summary = "通过ID查询内容购买记录", description = "通过ID查询内容购买记录") - @PostMapping("/queryById/{purchaseId}") - @RequireAuth - public CommonResult queryById(@Parameter(description = "购买记录ID") @PathVariable("purchaseId") Long purchaseId) { - return CommonResult.success(this.contentPurchaseService.queryById(purchaseId)); - } - - /** - * 购买内容 - * - * @param contentId 内容ID - * @param payType 支付方式:1.余额支付 2.积分支付 - * @return 购买结果 - */ - @Operation(summary = "购买内容", description = "购买内容") - @PostMapping("/purchase") - @RequireAuth - public CommonResult purchaseContent( - @Parameter(description = "内容ID") @RequestParam("contentId") Long contentId, - @Parameter(description = "支付方式:1.余额支付 2.积分支付") @RequestParam("payType") Integer payType) { - Long userId = Long.parseLong(StpUtil.getLoginId().toString()); - return CommonResult.success(this.contentPurchaseService.purchaseContent(userId, contentId, payType)); - } - - /** - * 检查用户是否有权限访问内容 - * - * @param contentId 内容ID - * @return 是否有权限 - */ - @Operation(summary = "检查内容访问权限", description = "检查内容访问权限") - @PostMapping("/checkPermission") - @RequireAuth - public CommonResult checkAccessPermission( - @Parameter(description = "内容ID") @RequestParam("contentId") Long contentId) { - Long userId = Long.parseLong(StpUtil.getLoginId().toString()); - boolean hasPermission = this.contentPurchaseService.checkAccessPermission(userId, contentId); - return CommonResult.success(hasPermission); - } -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/controller/SkillGenController.java b/src/main/java/com/kexue/skills/controller/SkillGenController.java deleted file mode 100644 index ebdabce..0000000 --- a/src/main/java/com/kexue/skills/controller/SkillGenController.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.kexue.skills.controller; - -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.CmsContent; -import com.kexue.skills.entity.dto.YamlContentDto; -import com.kexue.skills.entity.request.GenIntroduceRequest; -import com.kexue.skills.entity.request.SkillGenRequest; -import com.kexue.skills.entity.request.SkillPreGenRequest; -import com.kexue.skills.entity.request.SkillUploadDto; -import com.kexue.skills.entity.response.SkillResponse; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; - -/** - * 技能生成控制器 - * - * @author 维哥 - * @since 2026-01-28 - */ -@RestController -@RequestMapping("api/skillGen") -@Tag(name = "技能生成 Api") -@CrossOrigin(origins = "*") -public class SkillGenController { - - @Resource - private com.kexue.skills.service.SkillGenService skillGenService; - - /** - * 生成技能 - * - * @param request 生成请求 - * @return 生成结果 - */ - @PostMapping("/preGenerate") - @Operation(summary = "预生成技能", description = "生成技能") - public CommonResult preGenerate(@RequestBody SkillPreGenRequest request) { - return CommonResult.success(skillGenService.preGenerateV2(request)); - } - - @PostMapping("/generate") - @Operation(summary = "生成技能", description = "生成技能") - public CommonResult generate(@RequestBody SkillGenRequest request) { - return CommonResult.success(skillGenService.generate(request)); - } - - /** - * 分析技能 - * - * @param request 分析请求 - * @return 分析结果 - */ - @PostMapping("/analyze") - @Operation(summary = "分析技能", description = "分析技能") - public CommonResult analyze(@RequestBody com.kexue.skills.entity.request.SkillAnalyzeRequest request) { - return CommonResult.success(skillGenService.analyzeSkill(request)); - } - - /** - * 生成技能介绍 - * - * @param request 技能内容 - * @return 技能介绍 - */ - @PostMapping("/genIntroduce") - @Operation(summary = "生成技能介绍", description = "生成技能介绍") - public CommonResult genIntroduce(@RequestBody GenIntroduceRequest request) { - return CommonResult.success(skillGenService.genIntroduce(request.getContent())); - } - - /** - * 根据技能描述生成技能介绍 - * - * @param request 技能描述 - * @return 技能介绍 - */ - @PostMapping("/genIntroduceByDescription") - @Operation(summary = "根据技能描述生成技能介绍", description = "根据技能描述生成技能介绍") - public CommonResult genIntroduceByDescription(@RequestBody GenIntroduceRequest request) { - return CommonResult.success(skillGenService.genIntroduceByDescription(request.getContent())); - } - - /** - * 上传技能压缩包 - * - * @param skillUploadDto 技能压缩包URL - * @return 生成的技能内容 - */ - @PostMapping("/uploadSkill") - @Operation(summary = "上传技能压缩包", description = "上传技能压缩包并生成技能") - public CommonResult uploadSkill(@RequestBody SkillUploadDto skillUploadDto) { - return CommonResult.success(skillGenService.uploadSkill(skillUploadDto.getUrl())); - } - - /** - * 上传本地技能压缩包V2 - * - * @param file 技能压缩包文件 - * @return 生成的技能内容 - */ - @PostMapping("/uploadSkillV2") - @Operation(summary = "上传本地技能压缩包V2", description = "上传本地zip或rar文件并生成技能") - public CommonResult uploadSkillV2( - @RequestParam("file") MultipartFile file) { - try { - byte[] fileBytes = file.getBytes(); - String fileName = file.getOriginalFilename(); - CmsContent cmsContent = skillGenService.uploadSkillV2(fileBytes, fileName); - return CommonResult.success(cmsContent); - } catch (Exception e) { - return CommonResult.failed("上传失败:" + e.getMessage()); - } - } - /** - * 上传本地技能压缩包V3 直接传入yamlContent - * - * @param yamlContentDto 技能压缩包文件 - * @return 生成的技能内容 - */ - @PostMapping("/uploadSkillV3") - @Operation(summary = "上传本地技能压缩包V3,直接传入yamlContent", description = "直接传入yamlContent") - public CommonResult uploadSkillV3(@RequestBody YamlContentDto yamlContentDto) { - CmsContent cmsContent = skillGenService.uploadSkillV3(yamlContentDto.getYamlContent()); - return CommonResult.success(cmsContent); - } - - /** - * 上传本地技能压缩包V2 - * - * @param file 技能压缩包文件 - * @return 生成的技能内容 - */ - @PostMapping("/uploadSkillV4") - @Operation(summary = "上传本地技能压缩包V2", description = "上传本地zip或rar文件并生成技能") - public CommonResult uploadSkillV4( - @RequestParam("file") MultipartFile file) { - try { - byte[] fileBytes = file.getBytes(); - String fileName = file.getOriginalFilename(); - CmsContent cmsContent = skillGenService.uploadSkillV4(fileBytes, fileName); - return CommonResult.success(cmsContent); - } catch (Exception e) { - return CommonResult.failed("上传失败:" + e.getMessage()); - } - } - -} diff --git a/src/main/java/com/kexue/skills/controller/SysUserRoleController.java b/src/main/java/com/kexue/skills/controller/SysUserRoleController.java deleted file mode 100644 index 35d4b85..0000000 --- a/src/main/java/com/kexue/skills/controller/SysUserRoleController.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.kexue.skills.controller; - -import com.kexue.skills.entity.SysUserRole; -import com.kexue.skills.entity.dto.SysUserRoleDto; -import com.kexue.skills.service.SysUserRoleService; -import org.springframework.web.bind.annotation.*; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import javax.annotation.Resource; -import com.github.pagehelper.PageInfo; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.base.IdDto; - -/** - * (SysUserRole)表控制层 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@RestController -@RequestMapping("api/sysUserRole") -@Tag(name = "用户角色管理 Api") -@CrossOrigin(origins = "*") -public class SysUserRoleController { - /** - * 服务对象 - */ - @Resource - private SysUserRoleService sysUserRoleService; - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @PostMapping("/getPageList") - @Operation(summary = "查询分页列表", description = "查询分页列表") - public CommonResult> getPageList(@RequestBody SysUserRoleDto queryDto) { - return CommonResult.success(sysUserRoleService.getPageList(queryDto)); - } - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @PostMapping("queryById/{id}") - @Operation(summary = "通过ID查询用户角色关联", description = "通过ID查询用户角色关联") - public CommonResult queryById(@PathVariable("id") Long id) { - return CommonResult.success(sysUserRoleService.queryById(id)); - } - - /** - * 新增数据 - * - * @param SysUserRole 实体 - * @return 新增结果 - */ - @PostMapping("/insert") - @Operation(summary = "新增用户角色关联", description = "新增用户角色关联") - public CommonResult insert(@RequestBody SysUserRole SysUserRole) { - return CommonResult.success(sysUserRoleService.insert(SysUserRole)); - } - - /** - * 编辑数据 - * - * @param SysUserRole 实体 - * @return 编辑结果 - */ - @PostMapping("/update") - @Operation(summary = "更新用户角色关联", description = "更新用户角色关联") - public CommonResult update(@RequestBody SysUserRole SysUserRole) { - return CommonResult.success(sysUserRoleService.update(SysUserRole)); - } - - /** - * 删除数据 - * - * @param id - * @return 删除数据 - */ - @PostMapping("deleteById/{id}") - @Operation(summary = "删除用户角色关联", description = "删除用户角色关联") - public CommonResult deleteById(@PathVariable("id") Long id) { - return CommonResult.success(sysUserRoleService.deleteById(id)); - } -} diff --git a/src/main/java/com/kexue/skills/controller/WithdrawalRecordController.java b/src/main/java/com/kexue/skills/controller/WithdrawalRecordController.java deleted file mode 100644 index f447218..0000000 --- a/src/main/java/com/kexue/skills/controller/WithdrawalRecordController.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.kexue.skills.controller; - -import com.github.pagehelper.PageInfo; -import com.kexue.skills.annotation.RequireAuth; -import com.kexue.skills.common.CommonResult; -import com.kexue.skills.entity.WithdrawalRecord; -import com.kexue.skills.entity.dto.WithdrawalRecordDto; -import com.kexue.skills.service.WithdrawalRecordService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; -import java.math.BigDecimal; - -/** - * 提现记录控制器 - * - * @author 王志维 - * @since 2026-03-25 - */ -@Tag(name = "提现记录管理 Api") -@RestController -@RequestMapping("/api/withdrawalRecord") -public class WithdrawalRecordController { - /** - * 服务对象 - */ - @Resource - private WithdrawalRecordService withdrawalRecordService; - - /** - * 分页查询 - * - * @param queryDto 查询参数 - * @return 分页结果 - */ - @Operation(summary = "分页查询提现记录", description = "分页查询提现记录") - @PostMapping("/pageList") - @RequireAuth - public CommonResult> getPageList(@RequestBody WithdrawalRecordDto queryDto) { - return CommonResult.success(this.withdrawalRecordService.getPageList(queryDto)); - } - - /** - * 查询列表 - * - * @param queryDto 查询参数 - * @return 列表结果 - */ - @Operation(summary = "查询提现记录列表", description = "查询提现记录列表") - @PostMapping("/list") - @RequireAuth - public CommonResult> getList(@RequestBody WithdrawalRecordDto queryDto) { - return CommonResult.success(this.withdrawalRecordService.getList(queryDto)); - } - - /** - * 通过主键查询单条数据 - * - * @param recordId 主键 - * @return 单条数据 - */ - @Operation(summary = "通过ID查询提现记录", description = "通过ID查询提现记录") - @PostMapping("/queryById/{recordId}") - @RequireAuth - public CommonResult queryById(@Parameter(description = "提现记录ID") @PathVariable("recordId") Long recordId) { - return CommonResult.success(this.withdrawalRecordService.queryById(recordId)); - } - - /** - * 通过用户ID查询提现记录 - * - * @param userId 用户ID - * @return 提现记录列表 - */ - @Operation(summary = "通过用户ID查询提现记录", description = "通过用户ID查询提现记录") - @PostMapping("/queryByUserId/{userId}") - @RequireAuth - public CommonResult> queryByUserId(@Parameter(description = "用户ID") @PathVariable("userId") Long userId) { - return CommonResult.success(this.withdrawalRecordService.queryByUserId(userId)); - } - - /** - * 提交提现申请 - * - * @param userId 用户ID - * @param amount 提现金额 - * @param bankName 银行名称 - * @param bankAccount 银行账号 - * @param bankCardholder 持卡人姓名 - * @param remark 备注 - * @return 提现记录 - */ - @Operation(summary = "提交提现申请", description = "提交提现申请") - @PostMapping("/submit") - @RequireAuth - public CommonResult submitWithdrawal( - @Parameter(description = "用户ID") @RequestParam("userId") Long userId, - @Parameter(description = "提现金额") @RequestParam("amount") BigDecimal amount, - @Parameter(description = "银行名称") @RequestParam("bankName") String bankName, - @Parameter(description = "银行账号") @RequestParam("bankAccount") String bankAccount, - @Parameter(description = "持卡人姓名") @RequestParam("bankCardholder") String bankCardholder, - @Parameter(description = "备注") @RequestParam("remark") String remark) { - WithdrawalRecord record = this.withdrawalRecordService.submitWithdrawal(userId, amount, bankName, bankAccount, bankCardholder, remark); - return CommonResult.success(record); - } - - /** - * 处理提现 - * - * @param recordId 记录ID - * @param status 状态 - * @param remark 备注 - * @return 处理结果 - */ - @Operation(summary = "处理提现", description = "处理提现") - @PostMapping("/process") - @RequireAuth - public CommonResult processWithdrawal( - @Parameter(description = "提现记录ID") @RequestParam("recordId") Long recordId, - @Parameter(description = "状态:3.成功 4.失败") @RequestParam("status") Integer status, - @Parameter(description = "备注") @RequestParam("remark") String remark) { - int result = this.withdrawalRecordService.processWithdrawal(recordId, status, remark); - return CommonResult.success(result); - } -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/entity/CmsCategory.java b/src/main/java/com/kexue/skills/entity/CmsCategory.java deleted file mode 100644 index 2ef5b83..0000000 --- a/src/main/java/com/kexue/skills/entity/CmsCategory.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.kexue.skills.entity; - -import java.util.Date; - -import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -/** - * (CmsCategory)实体类 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Data -public class CmsCategory extends BaseEntity implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description ="主键ID") - private Long categoryId; - - @Schema(description ="分类名称") - private String categoryName; - - @Schema(description ="父分类ID") - private Long parentId; - - @Schema(description ="分类层级") - private Integer level; - - @Schema(description ="排序") - private Integer sort; - - @Schema(description ="状态(1启用,2禁用)") - private Integer status; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="创建时间") - private Date createTime; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="更新时间") - private Date updateTime; - - @Schema(description ="创建人") - private String createBy; - - @Schema(description ="更新人") - private String updateBy; - - @Schema(description ="是否删除 :0 未删除,1已删除") - private Integer deleteFlag; - - @Schema(description ="子分类列表") - private java.util.List subCategoryList; - -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/entity/CmsCategoryTag.java b/src/main/java/com/kexue/skills/entity/CmsCategoryTag.java deleted file mode 100644 index 262fa42..0000000 --- a/src/main/java/com/kexue/skills/entity/CmsCategoryTag.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.kexue.skills.entity; - -import java.util.Date; - -import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -/** - * (CmsCategoryTag)实体类 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Data -public class CmsCategoryTag extends BaseEntity implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description ="主键ID") - private Long id; - - @Schema(description ="分类ID") - private Long categoryId; - - @Schema(description ="标签ID") - private Long tagId; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="创建时间") - private Date createTime; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="更新时间") - private Date updateTime; - - @Schema(description ="创建人") - private String createBy; - - @Schema(description ="更新人") - private String updateBy; - - @Schema(description ="是否删除 :0 未删除,1已删除") - private Integer deleteFlag; - -} diff --git a/src/main/java/com/kexue/skills/entity/CmsContent.java b/src/main/java/com/kexue/skills/entity/CmsContent.java deleted file mode 100644 index b5314e6..0000000 --- a/src/main/java/com/kexue/skills/entity/CmsContent.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.kexue.skills.entity; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; - -import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -/** - * (CmsContent)实体类 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Data -public class CmsContent extends BaseEntity implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description ="主键ID") - private Long contentId; - - @Schema(description ="标题") - private String title; - - @Schema(description ="英文标题") - private String titleEn; - - @Schema(description ="是否是官方:0否,1是") - private Boolean isOfficial; - - @Schema(description ="图标") - private String icon; - - @Schema(description ="背景") - private String background; - - @Schema(description ="文件URL") - private String fileUrl; - - @Schema(description ="内容摘要") - private String summary; - - @Schema(description ="详细描述") - private String description; - - @Schema(description ="英文描述") - private String descriptionEn; - - @Schema(description ="需求说明") - private String requirement; - - @Schema(description ="介绍信息") - private String introduce; - - @Schema(description ="英文介绍") - private String introduceEn; - - @Schema(description ="分享数量") - private Integer shareCount; - - @Schema(description ="点赞量") - private Integer likeCount; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="创建时间") - private Date createTime; - - @Schema(description ="付费金额") - private BigDecimal price; - - @Schema(description ="内容类型(1文章,2视频,3图片)") - private Integer contentType; - - @Schema(description ="内容详情") - private String content; - - @Schema(description ="英文内容") - private String contentEn; - - @Schema(description ="封面图片") - private String coverImage; - - @Schema(description ="作者ID") - private Long authorId; - - @Schema(description ="作者名称") - private String authorName; - - @Schema(description ="审核人ID") - private Long reviewerId; - - @Schema(description ="审核人名称") - private String reviewerName; - - @Schema(description ="审核状态(1未发布,2待审核,3审核通过,4审核未通过)") - private Integer auditStatus; - - @Schema(description ="审核意见") - private String auditComment; - - @Schema(description ="发布状态(1未发布,2已发布,3已下架)--> 公有还是私有:1私有,2公有") - private Integer publishStatus; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="发布时间") - private Date publishTime; - - @Schema(description ="阅读量") - private Integer viewCount; - - @Schema(description ="评论量") - private Integer commentCount; - - @Schema(description ="排序") - private Integer sort; - - @Schema(description ="所需积分") - private Integer requiredPoints; - - @Schema(description ="是否支持积分支付:0不支持,1支持") - private Integer supportPointsPay; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="更新时间") - private Date updateTime; - - @Schema(description ="创建人") - private String createBy; - - @Schema(description ="更新人") - private String updateBy; - - @Schema(description ="是否删除 :0 未删除,1已删除") - private Integer deleteFlag; - - @Schema(description ="子分类列表") - private java.util.List subCategoryList; - - @Schema(description ="是否付费:0免费,1付费") - private Integer isPaid; - - @Schema(description ="副标题") - private String subtitle; - - @Schema(description ="来源") - private String origin; - - @Schema(description ="标签") - private String tags; - -} diff --git a/src/main/java/com/kexue/skills/entity/CmsContentLike.java b/src/main/java/com/kexue/skills/entity/CmsContentLike.java deleted file mode 100644 index 2bb4af7..0000000 --- a/src/main/java/com/kexue/skills/entity/CmsContentLike.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.kexue.skills.entity; - -import java.util.Date; - -/** - * CMS内容点赞记录实体类 - * - * @author 王志维 - * @since 2026-01-26 - */ -public class CmsContentLike { - /** - * 点赞记录ID - */ - private Long likeId; - - /** - * 用户ID - */ - private Long userId; - - /** - * 用户名 - */ - private String userName; - - /** - * 内容ID - */ - private Long contentId; - - /** - * 内容标题 - */ - private String contentTitle; - - /** - * 点赞时间 - */ - private Date likeTime; - - /** - * 删除标志:0未删除,1已删除 - */ - private Integer deleteFlag; - - /** - * 创建人 - */ - private String createBy; - - /** - * 更新人 - */ - private String updateBy; - - // getter和setter方法 - public Long getLikeId() { - return likeId; - } - - public void setLikeId(Long likeId) { - this.likeId = likeId; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public Long getContentId() { - return contentId; - } - - public void setContentId(Long contentId) { - this.contentId = contentId; - } - - public String getContentTitle() { - return contentTitle; - } - - public void setContentTitle(String contentTitle) { - this.contentTitle = contentTitle; - } - - public Date getLikeTime() { - return likeTime; - } - - public void setLikeTime(Date likeTime) { - this.likeTime = likeTime; - } - - public Integer getDeleteFlag() { - return deleteFlag; - } - - public void setDeleteFlag(Integer deleteFlag) { - this.deleteFlag = deleteFlag; - } - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public String getUpdateBy() { - return updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/entity/CmsContentView.java b/src/main/java/com/kexue/skills/entity/CmsContentView.java deleted file mode 100644 index 895de63..0000000 --- a/src/main/java/com/kexue/skills/entity/CmsContentView.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.kexue.skills.entity; - -import java.util.Date; - -/** - * CMS内容查看记录实体类 - * - * @author 王志维 - * @since 2026-01-26 - */ -public class CmsContentView { - /** - * 查看记录ID - */ - private Long viewId; - - /** - * 用户ID - */ - private Long userId; - - /** - * 用户名 - */ - private String userName; - - /** - * 内容ID - */ - private Long contentId; - - /** - * 内容标题 - */ - private String contentTitle; - - /** - * 查看时间 - */ - private Date viewTime; - - /** - * 删除标志:0未删除,1已删除 - */ - private Integer deleteFlag; - - /** - * 创建人 - */ - private String createBy; - - /** - * 更新人 - */ - private String updateBy; - - // getter和setter方法 - public Long getViewId() { - return viewId; - } - - public void setViewId(Long viewId) { - this.viewId = viewId; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public Long getContentId() { - return contentId; - } - - public void setContentId(Long contentId) { - this.contentId = contentId; - } - - public String getContentTitle() { - return contentTitle; - } - - public void setContentTitle(String contentTitle) { - this.contentTitle = contentTitle; - } - - public Date getViewTime() { - return viewTime; - } - - public void setViewTime(Date viewTime) { - this.viewTime = viewTime; - } - - public Integer getDeleteFlag() { - return deleteFlag; - } - - public void setDeleteFlag(Integer deleteFlag) { - this.deleteFlag = deleteFlag; - } - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public String getUpdateBy() { - return updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/entity/CmsTag.java b/src/main/java/com/kexue/skills/entity/CmsTag.java deleted file mode 100644 index 8bfd096..0000000 --- a/src/main/java/com/kexue/skills/entity/CmsTag.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.kexue.skills.entity; - -import java.util.Date; - -import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -/** - * (CmsTag)实体类 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Data -public class CmsTag extends BaseEntity implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description ="主键ID") - private Long tagId; - - @Schema(description ="标签名称") - private String tagName; - - @Schema(description ="标签描述") - private String description; - - @Schema(description ="使用次数") - private Integer useCount; - - @Schema(description ="状态(1启用,2禁用)") - private Integer status; - - @Schema(description ="标签图标") - private String icon; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="创建时间") - private Date createTime; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="更新时间") - private Date updateTime; - - @Schema(description ="创建人") - private String createBy; - - @Schema(description ="更新人") - private String updateBy; - - @Schema(description ="是否删除 :0 未删除,1已删除") - private Integer deleteFlag; - -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/entity/ContentPurchase.java b/src/main/java/com/kexue/skills/entity/ContentPurchase.java deleted file mode 100644 index dc7018d..0000000 --- a/src/main/java/com/kexue/skills/entity/ContentPurchase.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.kexue.skills.entity; - -import java.util.Date; - -import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -/** - * (ContentPurchase)实体类 - * 内容购买记录表,记录用户购买的内容信息 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Data -public class ContentPurchase extends BaseEntity implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description ="主键ID") - private Long purchaseId; - - @Schema(description ="用户ID") - private Long userId; - - @Schema(description ="用户名") - private String userName; - - @Schema(description ="内容ID") - private Long contentId; - - @Schema(description ="内容标题") - private String contentTitle; - - @Schema(description ="购买方式:1.余额支付 2.积分支付") - private Integer payType; - - @Schema(description ="支付金额") - private java.math.BigDecimal amount; - - @Schema(description ="支付积分") - private Integer points; - - @Schema(description ="购买状态:1.待支付 2.已支付 3.已取消") - private Integer status; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="购买时间") - private Date purchaseTime; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="创建时间") - private Date createTime; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="更新时间") - private Date updateTime; - - @Schema(description ="是否删除 :0 未删除,1已删除") - private Integer deleteFlag; - - @Schema(description ="创建人") - private String createBy; - - @Schema(description ="更新人") - private String updateBy; - -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/entity/Customer.java b/src/main/java/com/kexue/skills/entity/Customer.java deleted file mode 100644 index 88a090a..0000000 --- a/src/main/java/com/kexue/skills/entity/Customer.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.kexue.skills.entity; - -import java.util.Date; - -import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -/** - * (Customer)实体类 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Data -public class Customer extends BaseEntity implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description ="主键ID") - private Long customerId; - - @Schema(description ="客户名称") - private String customerName; - - @Schema(description ="联系人") - private String contactPerson; - - @Schema(description ="联系电话") - private String contactPhone; - - @Schema(description ="地址") - private String address; - - @Schema(description ="备注") - private String remark; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="创建时间") - private Date createTime; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="更新时间") - private Date updateTime; - - @Schema(description ="是否启用(1启用,2禁用)") - private Integer enable; - - @Schema(description ="是否删除 :0 未删除,1已删除") - private Integer deleteFlag; - - @Schema(description ="创建人") - private String createBy; - - @Schema(description ="更新人") - private String updateBy; - -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/entity/SysUserRole.java b/src/main/java/com/kexue/skills/entity/SysUserRole.java deleted file mode 100644 index cf32ce2..0000000 --- a/src/main/java/com/kexue/skills/entity/SysUserRole.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.kexue.skills.entity; - - -import java.io.Serializable; -import java.util.Date; - -import com.kexue.skills.entity.base.BaseEntity; -import com.kexue.skills.entity.base.BaseQueryDto; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -/** - * (SysUserRole)实体类 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Data -public class SysUserRole extends BaseEntity implements Serializable { - private static final long serialVersionUID = -52125282568963778L; - - @Schema(description ="角色ID") - private Long roleId; - - @Schema(description ="用户ID") - private Long userId; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="创建时间") - private Date createTime; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="更新时间") - private Date updateTime; - - @Schema(description ="是否删除 :0 未删除,1已删除") - private Integer deleteFlag; - - @Schema(description ="创建人") - private String createBy; - - @Schema(description ="更新人") - private String updateBy; - -} diff --git a/src/main/java/com/kexue/skills/entity/WithdrawalRecord.java b/src/main/java/com/kexue/skills/entity/WithdrawalRecord.java deleted file mode 100644 index 9a557e7..0000000 --- a/src/main/java/com/kexue/skills/entity/WithdrawalRecord.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.kexue.skills.entity; - -import java.math.BigDecimal; -import java.util.Date; - -import java.io.Serializable; -import com.kexue.skills.entity.base.BaseEntity; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -/** - * 提现记录实体类 - * - * @author 王志维 - * @since 2026-03-25 - */ -@Data -public class WithdrawalRecord extends BaseEntity implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description ="主键ID") - private Long recordId; - - @Schema(description ="用户ID") - private Long userId; - - @Schema(description ="用户名") - private String userName; - - @Schema(description ="提现金额") - private BigDecimal withdrawalAmount; - - @Schema(description ="手续费") - private BigDecimal feeAmount; - - @Schema(description ="实际到账金额") - private BigDecimal actualAmount; - - @Schema(description ="提现状态:1.待处理 2.处理中 3.成功 4.失败") - private Integer status; - - @Schema(description ="提现单号") - private String withdrawalNo; - - @Schema(description ="银行名称") - private String bankName; - - @Schema(description ="银行账号") - private String bankAccount; - - @Schema(description ="持卡人姓名") - private String bankCardholder; - - @Schema(description ="备注") - private String remark; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="创建时间") - private Date createTime; - - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @Schema(description ="更新时间") - private Date updateTime; - - @Schema(description ="是否删除 :0 未删除,1已删除") - private Integer deleteFlag; - - @Schema(description ="创建人") - private String createBy; - - @Schema(description ="更新人") - private String updateBy; - -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/entity/request/SkillAnalyzeRequest.java b/src/main/java/com/kexue/skills/entity/request/SkillAnalyzeRequest.java deleted file mode 100644 index ad0bb4f..0000000 --- a/src/main/java/com/kexue/skills/entity/request/SkillAnalyzeRequest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.kexue.skills.entity.request; - -import io.swagger.annotations.ApiModel; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; - -/** - * 技能分析请求参数 - * - * @author 维哥 - * @since 2026-01-28 - */ -@Data -@ApiModel(value = "技能分析请求参数") -public class SkillAnalyzeRequest implements Serializable { - - @Schema(description = "技能ID") - private Long skillId; - - @Schema(description = "分析类型") - private String analyzeType; -} diff --git a/src/main/java/com/kexue/skills/entity/request/SkillGenRequest.java b/src/main/java/com/kexue/skills/entity/request/SkillGenRequest.java deleted file mode 100644 index a78b954..0000000 --- a/src/main/java/com/kexue/skills/entity/request/SkillGenRequest.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.kexue.skills.entity.request; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -@Data -public class SkillGenRequest implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "技能名称") - private String name; - @Schema(description = "技能描述") - private String description; - @Schema(description = "技能标签") - private List tags; - @Schema(description = "技能说明") - private String introduce; - @Schema(description = "需求说明") - private String requirement; -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/entity/request/SkillPreGenRequest.java b/src/main/java/com/kexue/skills/entity/request/SkillPreGenRequest.java deleted file mode 100644 index f8bd1d9..0000000 --- a/src/main/java/com/kexue/skills/entity/request/SkillPreGenRequest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.kexue.skills.entity.request; - -import io.swagger.annotations.ApiModel; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - * 技能生成请求参数 - * - * @author 维哥 - * @since 2026-01-28 - */ -@Data -@ApiModel(value = "技能生成请求参数") -public class SkillPreGenRequest implements Serializable { - - @Schema(description = "用户提示词") - private String prompt; - - @Schema(description = "文件地址") - private String fileUrl; - - @Schema(description = "文件地址列表") - private List fileUrls; - - -} diff --git a/src/main/java/com/kexue/skills/entity/request/SkillRequest.java b/src/main/java/com/kexue/skills/entity/request/SkillRequest.java deleted file mode 100644 index 5e04a7c..0000000 --- a/src/main/java/com/kexue/skills/entity/request/SkillRequest.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.kexue.skills.entity.request; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class SkillRequest implements Serializable { - private static final long serialVersionUID = 1L; - - private String model; - private List messages; - private double temperature; - private int max_tokens; - private ResponseFormat response_format; - - public SkillRequest(boolean useDefaultSettings) { - if (useDefaultSettings) { - this.model = "deepseek-chat"; - this.messages = new ArrayList<>(); - - Message systemMessage = new Message(); - systemMessage.setRole("system"); - systemMessage.setContent("你是一个专业的AI技能设计助手。请严格按照指定的JSON格式输出,仅包含要求的字段,以中文形式返回。"); - this.messages.add(systemMessage); - - Message userMessage = new Message(); - userMessage.setRole("user"); - userMessage.setContent("主题:我想要做一个将数据库设计表转换成sql schema语言并迁移到数据库服务器中的skill。请根据agent skills撰写规范帮我生成这个skill的名称、描述,并从数据库中选择一个或者多个标签。输出json格式,仅输出以上所提到的名称、描述、标签,节点名称分别为name、description、tags,节点内容以中文形式返回。"); - this.messages.add(userMessage); - - this.temperature = 0.3; - this.max_tokens = 500; - - this.response_format = new ResponseFormat(); - this.response_format.setType("json_object"); - } - } - - public SkillRequest(boolean useDefaultSettings, String model, Double temperature, Integer maxTokens, String prompt, String tagsList) { - if (useDefaultSettings) { - this.model = model; - this.messages = new ArrayList<>(); - - Message systemMessage = new Message(); - systemMessage.setRole("system"); - systemMessage.setContent("你是一个专业的AI技能设计助手。请严格按照指定的JSON格式输出,仅包含要求的字段,以中文形式返回。"); - this.messages.add(systemMessage); - - Message userMessage = new Message(); - userMessage.setRole("user"); - userMessage.setContent("主题:"+ prompt +"。请根据agent skills撰写规范帮我生成这个skill的名称、描述,并从以下标签列表中选择一个或者多个标签:\"" + tagsList + "\"。输出json格式,仅输出以上所提到的名称、描述、标签,节点名称分别为name、description、tags,节点内容以中文形式返回,tags只需要返回序号数组"); - this.messages.add(userMessage); - - this.temperature = temperature; - this.max_tokens = maxTokens; - - this.response_format = new ResponseFormat(); - this.response_format.setType("json_object"); - } - } - - public SkillRequest(boolean useDefaultSettings, String model, String systemContent,String userContent,Double temperature, Integer maxTokens,String type) { - if (useDefaultSettings) { - this.model = model; - this.messages = new ArrayList<>(); - - Message systemMessage = new Message(); - systemMessage.setRole("system"); - systemMessage.setContent(systemContent); - this.messages.add(systemMessage); - - Message userMessage = new Message(); - userMessage.setRole("user"); - userMessage.setContent(userContent); - this.messages.add(userMessage); - - this.temperature = temperature; - this.max_tokens = maxTokens; - - this.response_format = new ResponseFormat(); - this.response_format.setType(type); - } - } - - // 新的构造方法,支持文件URL列表 - public SkillRequest(String model, String systemContent, String prompt, List fileUrls, double temperature, int maxTokens) { - this.model = model; - this.messages = new ArrayList<>(); - - Message systemMessage = new Message(); - systemMessage.setRole("system"); - systemMessage.setContent(systemContent); - this.messages.add(systemMessage); - - // 构建包含文件URL的用户消息 - List messageContents = new ArrayList<>(); - - // 添加文件URL - if (fileUrls != null && !fileUrls.isEmpty()) { - for (String fileUrl : fileUrls) { - MessageContent fileContent = new MessageContent(); - fileContent.setType("file_url"); - FileUrl fileUrlObj = new FileUrl(); - fileUrlObj.setUrl(fileUrl); - fileContent.setFile_url(fileUrlObj); - messageContents.add(fileContent); - } - } - - // 添加文本内容 - MessageContent textContent = new MessageContent(); - textContent.setType("text"); - textContent.setText(prompt); - messageContents.add(textContent); - - Message userMessage = new Message(); - userMessage.setRole("user"); - userMessage.setContent(messageContents); - this.messages.add(userMessage); - - this.temperature = temperature; - this.max_tokens = maxTokens; - - this.response_format = new ResponseFormat(); - this.response_format.setType("json_object"); - } - - public static SkillRequest createDefault() { - return new SkillRequest(true); - } - - @Data - @AllArgsConstructor - @NoArgsConstructor - public static class Message implements Serializable { - private static final long serialVersionUID = 1L; - - private String role; - private Object content; // 可以是String或List - } - - @Data - @AllArgsConstructor - @NoArgsConstructor - public static class MessageContent implements Serializable { - private static final long serialVersionUID = 1L; - - private String type; - private String text; - private FileUrl file_url; - } - - @Data - @AllArgsConstructor - @NoArgsConstructor - public static class FileUrl implements Serializable { - private static final long serialVersionUID = 1L; - - private String url; - } - - @Data - @AllArgsConstructor - @NoArgsConstructor - public static class ResponseFormat implements Serializable { - private static final long serialVersionUID = 1L; - - private String type; - } -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/entity/request/SkillUploadDto.java b/src/main/java/com/kexue/skills/entity/request/SkillUploadDto.java deleted file mode 100644 index 422b461..0000000 --- a/src/main/java/com/kexue/skills/entity/request/SkillUploadDto.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.kexue.skills.entity.request; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; - -@Data -public class SkillUploadDto implements Serializable { - - @Schema(description = "技能包地址", required = true) - private String url; -} diff --git a/src/main/java/com/kexue/skills/mapper/CmsCategoryMapper.java b/src/main/java/com/kexue/skills/mapper/CmsCategoryMapper.java deleted file mode 100644 index 9e60aaa..0000000 --- a/src/main/java/com/kexue/skills/mapper/CmsCategoryMapper.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.kexue.skills.mapper; - -import com.kexue.skills.entity.CmsCategory; -import com.kexue.skills.entity.dto.CmsCategoryDto; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * (CmsCategory)表数据库访问层 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Mapper -public interface CmsCategoryMapper { - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getPageList(CmsCategoryDto queryDto); - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getList(CmsCategoryDto queryDto); - - /** - * 通过ID查询单条数据 - * - * @param categoryId 主键 - * @return 实例对象 - */ - CmsCategory queryById(Long categoryId); - - /** - * 新增数据 - * - * @param cmsCategory 实例对象 - * @return 影响行数 - */ - int insert(CmsCategory cmsCategory); - - /** - * 更新数据 - * - * @param cmsCategory 实例对象 - * @return 影响行数 - */ - int update(CmsCategory cmsCategory); - - /** - * 通过主键逻辑删除 - * - * @param categoryId 主键 - * @return 影响行数 - */ - int logicDeleteById(@Param("categoryId") Long categoryId, @Param("updateBy") String updateBy); - - /** - * 通过主键物理删除 - * - * @param categoryId 主键 - * @return 影响行数 - */ - int deleteById(Long categoryId); -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/mapper/CmsCategoryTagMapper.java b/src/main/java/com/kexue/skills/mapper/CmsCategoryTagMapper.java deleted file mode 100644 index 36ac5ed..0000000 --- a/src/main/java/com/kexue/skills/mapper/CmsCategoryTagMapper.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.kexue.skills.mapper; - -import com.kexue.skills.entity.CmsCategoryTag; -import com.kexue.skills.entity.dto.CmsCategoryTagDto; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * (CmsCategoryTag)表数据库访问层 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Mapper -public interface CmsCategoryTagMapper { - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getPageList(CmsCategoryTagDto queryDto); - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getList(CmsCategoryTagDto queryDto); - - /** - * 通过ID查询单条数据 - * - * @param id 主键 - * @return 实例对象 - */ - CmsCategoryTag queryById(Long id); - - /** - * 新增数据 - * - * @param cmsCategoryTag 实例对象 - * @return 影响行数 - */ - int insert(CmsCategoryTag cmsCategoryTag); - - /** - * 更新数据 - * - * @param cmsCategoryTag 实例对象 - * @return 影响行数 - */ - int update(CmsCategoryTag cmsCategoryTag); - - /** - * 通过主键逻辑删除 - * - * @param id 主键 - * @param updateBy 更新人 - * @return 影响行数 - */ - int logicDeleteById(@Param("id") Long id, @Param("updateBy") String updateBy); - - /** - * 通过主键物理删除 - * - * @param id 主键 - * @return 影响行数 - */ - int deleteById(Long id); - - /** - * 根据分类ID删除关联 - * - * @param categoryId 分类ID - * @param updateBy 更新人 - * @return 影响行数 - */ - int deleteByCategoryId(@Param("categoryId") Long categoryId, @Param("updateBy") String updateBy); - - /** - * 根据标签ID删除关联 - * - * @param tagId 标签ID - * @param updateBy 更新人 - * @return 影响行数 - */ - int deleteByTagId(@Param("tagId") Long tagId, @Param("updateBy") String updateBy); - - /** - * 批量插入关联 - * - * @param categoryTagList 关联列表 - * @return 影响行数 - */ - int batchInsert(List categoryTagList); -} diff --git a/src/main/java/com/kexue/skills/mapper/CmsContentLikeMapper.java b/src/main/java/com/kexue/skills/mapper/CmsContentLikeMapper.java deleted file mode 100644 index d16391e..0000000 --- a/src/main/java/com/kexue/skills/mapper/CmsContentLikeMapper.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.kexue.skills.mapper; - -import com.kexue.skills.entity.CmsContentLike; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * CMS内容点赞记录Mapper接口 - * - * @author 王志维 - * @since 2026-01-26 - */ -@Mapper -public interface CmsContentLikeMapper { - /** - * 新增点赞记录 - * - * @param cmsContentLike 点赞记录对象 - * @return 受影响的行数 - */ - int insert(CmsContentLike cmsContentLike); - - /** - * 删除点赞记录 - * - * @param likeId 点赞记录ID - * @return 受影响的行数 - */ - int deleteById(Long likeId); - - /** - * 更新点赞记录 - * - * @param cmsContentLike 点赞记录对象 - * @return 受影响的行数 - */ - int update(CmsContentLike cmsContentLike); - - /** - * 查询点赞记录 - * - * @param likeId 点赞记录ID - * @return 点赞记录对象 - */ - CmsContentLike queryById(Long likeId); - - /** - * 查询用户是否已点赞该内容 - * - * @param userId 用户ID - * @param contentId 内容ID - * @return 点赞记录对象,不存在则返回null - */ - CmsContentLike queryByUserIdAndContentId(@Param("userId") Long userId, @Param("contentId") Long contentId); - - /** - * 查询用户最近的点赞记录 - * - * @param userId 用户ID - * @param limit 查询数量 - * @return 点赞记录列表 - */ - List queryRecentLikesByUserId(@Param("userId") Long userId, @Param("limit") int limit); - - /** - * 查询内容的点赞记录数量 - * - * @param contentId 内容ID - * @return 点赞记录数量 - */ - int countByContentId(Long contentId); -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/mapper/CmsContentMapper.java b/src/main/java/com/kexue/skills/mapper/CmsContentMapper.java deleted file mode 100644 index 7898f6c..0000000 --- a/src/main/java/com/kexue/skills/mapper/CmsContentMapper.java +++ /dev/null @@ -1,235 +0,0 @@ -package com.kexue.skills.mapper; - -import com.kexue.skills.entity.CmsContent; -import com.kexue.skills.entity.dto.CmsContentDto; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * (CmsContent)表数据库访问层 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Mapper -public interface CmsContentMapper { - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getPageList(CmsContentDto queryDto); - - /** - * 带分页的查询 - * - * @param queryDto 筛选条件 - * @param offset 偏移量 - * @param limit 限制数量 - * @return 查询结果 - */ - List getPageListWithPagination(@Param("queryDto") CmsContentDto queryDto, @Param("offset") int offset, @Param("limit") int limit); - - /** - * 查询总记录数 - * - * @param queryDto 筛选条件 - * @return 总记录数 - */ - int getPageListCount(CmsContentDto queryDto); - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getList(CmsContentDto queryDto); - - /** - * 通过ID查询单条数据 - * - * @param contentId 主键 - * @return 实例对象 - */ - CmsContent queryById(Long contentId); - - /** - * 通过ID和语言类型查询单条数据 - * - * @param queryDto 筛选条件 - * @return 实例对象 - */ - CmsContent queryByIdWithLanguage(CmsContentDto queryDto); - - /** - * 新增数据 - * - * @param cmsContent 实例对象 - * @return 影响行数 - */ - int insert(CmsContent cmsContent); - - /** - * 批量新增数据 - * - * @param cmsContentList 实例对象列表 - * @return 影响行数 - */ - int batchInsert(@Param("cmsContentList") List cmsContentList); - - /** - * 更新数据 - * - * @param cmsContent 实例对象 - * @return 影响行数 - */ - int update(CmsContent cmsContent); - - /** - * 更新审核状态 - * - * @param contentId 内容ID - * @param auditStatus 审核状态 - * @param reviewerId 审核人ID - * @param reviewerName 审核人名称 - * @param auditComment 审核意见 - * @return 影响行数 - */ - int updateAuditStatus(@Param("contentId") Long contentId, - @Param("auditStatus") Integer auditStatus, - @Param("reviewerId") Long reviewerId, - @Param("reviewerName") String reviewerName, - @Param("auditComment") String auditComment, - @Param("updateBy") String updateBy); - - /** - * 更新发布状态 - * - * @param contentId 内容ID - * @param publishStatus 发布状态 - * @param publishTime 发布时间 - * @return 影响行数 - */ - int updatePublishStatus(@Param("contentId") Long contentId, - @Param("publishStatus") Integer publishStatus, - @Param("publishTime") String publishTime, - @Param("updateBy") String updateBy); - - /** - * 通过主键逻辑删除 - * - * @param contentId 主键 - * @return 影响行数 - */ - int logicDeleteById(@Param("contentId") Long contentId, @Param("updateBy") String updateBy); - - /** - * 通过主键物理删除 - * - * @param contentId 主键 - * @return 影响行数 - */ - int deleteById(Long contentId); - - /** - * 增加阅读量 - * - * @param contentId 内容ID - * @return 影响行数 - */ - int increaseViewCount(Long contentId); - - /** - * 查询用户最近创建的内容ID列表 - * - * @param userId 用户ID - * @param limit 查询数量 - * @return 内容ID列表 - */ - List queryRecentCreatedByUserId(@Param("userId") Long userId, @Param("limit") int limit); - - /** - * 获取用户历史查看的内容列表 - * - * @param userId 用户ID - * @param offset 偏移量 - * @param limit 限制数量 - * @return 查询结果 - */ - List getPageListByUserHistory(@Param("userId") Long userId, @Param("offset") int offset, @Param("limit") int limit); - - /** - * 获取用户历史查看的内容总数 - * - * @param userId 用户ID - * @return 总记录数 - */ - int getPageListByUserHistoryCount(@Param("userId") Long userId); - - /** - * 获取用户收藏的内容列表 - * - * @param userId 用户ID - * @param offset 偏移量 - * @param limit 限制数量 - * @return 查询结果 - */ - List getPageListByUserFavorites(@Param("userId") Long userId, @Param("offset") int offset, @Param("limit") int limit); - - /** - * 获取用户收藏的内容总数 - * - * @param userId 用户ID - * @return 总记录数 - */ - int getPageListByUserFavoritesCount(@Param("userId") Long userId); - - /** - * 获取用户购买的内容列表 - * - * @param userId 用户ID - * @param offset 偏移量 - * @param limit 限制数量 - * @return 查询结果 - */ - List getPageListByUserPurchases(@Param("userId") Long userId, @Param("offset") int offset, @Param("limit") int limit); - - /** - * 获取用户购买的内容总数 - * - * @param userId 用户ID - * @return 总记录数 - */ - int getPageListByUserPurchasesCount(@Param("userId") Long userId); - - /** - * 获取用户创建的内容列表 - * - * @param userId 用户ID - * @param publishStatus 发布状态 - * @param offset 偏移量 - * @param limit 限制数量 - * @return 查询结果 - */ - List getPageListByUserCreated(@Param("userId") Long userId, @Param("publishStatus") Integer publishStatus, @Param("offset") int offset, @Param("limit") int limit); - - /** - * 获取用户创建的内容总数 - * - * @param userId 用户ID - * @param publishStatus 发布状态 - * @return 总记录数 - */ - int getPageListByUserCreatedCount(@Param("userId") Long userId, @Param("publishStatus") Integer publishStatus); - - /** - * 清空表数据 - * - * @return 影响行数 - */ - int truncateTable(); -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/mapper/CmsContentViewMapper.java b/src/main/java/com/kexue/skills/mapper/CmsContentViewMapper.java deleted file mode 100644 index ca5e751..0000000 --- a/src/main/java/com/kexue/skills/mapper/CmsContentViewMapper.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.kexue.skills.mapper; - -import com.kexue.skills.entity.CmsContentView; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * CMS内容查看记录Mapper接口 - * - * @author 王志维 - * @since 2026-01-26 - */ -@Mapper -public interface CmsContentViewMapper { - /** - * 新增查看记录 - * - * @param cmsContentView 查看记录对象 - * @return 受影响的行数 - */ - int insert(CmsContentView cmsContentView); - - /** - * 删除查看记录 - * - * @param viewId 查看记录ID - * @return 受影响的行数 - */ - int deleteById(Long viewId); - - /** - * 更新查看记录 - * - * @param cmsContentView 查看记录对象 - * @return 受影响的行数 - */ - int update(CmsContentView cmsContentView); - - /** - * 查询查看记录 - * - * @param viewId 查看记录ID - * @return 查看记录对象 - */ - CmsContentView queryById(Long viewId); - - /** - * 查询用户最近的查看记录 - * - * @param userId 用户ID - * @param limit 查询数量 - * @return 查看记录列表 - */ - List queryRecentViewsByUserId(@Param("userId") Long userId, @Param("limit") int limit); - - /** - * 查询内容的查看记录数量 - * - * @param contentId 内容ID - * @return 查看记录数量 - */ - int countByContentId(Long contentId); - - /** - * 查询用户是否已查看该内容 - * - * @param userId 用户ID - * @param contentId 内容ID - * @return 查看记录对象,不存在则返回null - */ - CmsContentView queryByUserIdAndContentId(@Param("userId") Long userId, @Param("contentId") Long contentId); -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/mapper/CmsTagMapper.java b/src/main/java/com/kexue/skills/mapper/CmsTagMapper.java deleted file mode 100644 index 0b44032..0000000 --- a/src/main/java/com/kexue/skills/mapper/CmsTagMapper.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.kexue.skills.mapper; - -import com.kexue.skills.entity.CmsTag; -import com.kexue.skills.entity.dto.CmsTagDto; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * (CmsTag)表数据库访问层 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Mapper -public interface CmsTagMapper { - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getPageList(CmsTagDto queryDto); - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getList(CmsTagDto queryDto); - - /** - * 通过ID查询单条数据 - * - * @param tagId 主键 - * @return 实例对象 - */ - CmsTag queryById(Long tagId); - - /** - * 新增数据 - * - * @param cmsTag 实例对象 - * @return 影响行数 - */ - int insert(CmsTag cmsTag); - - /** - * 更新数据 - * - * @param cmsTag 实例对象 - * @return 影响行数 - */ - int update(CmsTag cmsTag); - - /** - * 通过主键逻辑删除 - * - * @param tagId 主键 - * @return 影响行数 - */ - int logicDeleteById(@Param("tagId") Long tagId, @Param("updateBy") String updateBy); - - /** - * 通过主键物理删除 - * - * @param tagId 主键 - * @return 影响行数 - */ - int deleteById(Long tagId); - - /** - * 根据分类ID查询标签列表 - * - * @param categoryId 分类ID - * @return 标签列表 - */ - List getTagsByCategoryId(@Param("categoryId") Long categoryId); -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/mapper/ContentPurchaseMapper.java b/src/main/java/com/kexue/skills/mapper/ContentPurchaseMapper.java deleted file mode 100644 index 1d2a10e..0000000 --- a/src/main/java/com/kexue/skills/mapper/ContentPurchaseMapper.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.kexue.skills.mapper; - -import com.kexue.skills.entity.ContentPurchase; -import com.kexue.skills.entity.dto.ContentPurchaseDto; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * (ContentPurchase)表数据库访问层 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Mapper -public interface ContentPurchaseMapper { - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getPageList(ContentPurchaseDto queryDto); - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getList(ContentPurchaseDto queryDto); - - /** - * 通过主键查询单条数据 - * - * @param purchaseId 主键 - * @return 实例对象 - */ - ContentPurchase queryById(Long purchaseId); - - /** - * 通过用户ID和内容ID查询购买记录 - * - * @param userId 用户ID - * @param contentId 内容ID - * @return 实例对象 - */ - ContentPurchase queryByUserIdAndContentId(@Param("userId") Long userId, @Param("contentId") Long contentId); - - /** - * 新增数据 - * - * @param purchase 实例对象 - * @return 影响行数 - */ - int insert(ContentPurchase purchase); - - /** - * 更新数据 - * - * @param purchase 实例对象 - * @return 影响行数 - */ - int update(ContentPurchase purchase); - - /** - * 更新购买状态 - * - * @param purchaseId 购买ID - * @param status 状态 - * @return 影响行数 - */ - int updateStatus(@Param("purchaseId") Long purchaseId, @Param("status") Integer status); - - /** - * 通过主键逻辑删除 - * - * @param purchaseId 主键 - * @return 影响行数 - */ - int logicDeleteById(@Param("purchaseId") Long purchaseId, @Param("updateBy") String updateBy); - - /** - * 通过主键物理删除 - * - * @param purchaseId 主键 - * @return 影响行数 - */ - int deleteById(Long purchaseId); -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/mapper/SysUserRoleMapper.java b/src/main/java/com/kexue/skills/mapper/SysUserRoleMapper.java deleted file mode 100644 index 3d5308d..0000000 --- a/src/main/java/com/kexue/skills/mapper/SysUserRoleMapper.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.kexue.skills.mapper; - -import com.kexue.skills.entity.SysUserRole; -import com.kexue.skills.entity.dto.SysUserRoleDto; -import org.apache.ibatis.annotations.Param; -import java.util.List; - -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Mapper; -import java.util.List; - -/** - * (SysUserRole)表数据库访问层 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Mapper -public interface SysUserRoleMapper { - - /** - * 查询指定行数据 - * - * @param sysUserRoleDto 查询条件 - * @return 对象列表 - */ - List getPageList(SysUserRoleDto sysUserRoleDto); - - /** - * 通过ID查询单条数据 - * - * @param roleId 主键 - * @return 实例对象 - */ - SysUserRole queryById(Long roleId); - - /** - * 查询指定行数据 - * - * @param offset 查询起始位置 - * @param limit 查询条数 - * @return 对象列表 - */ - List queryAllByLimit(@Param("offset") int offset, @Param("limit") int limit); - - - /** - * 通过实体作为筛选条件查询 - * - * @param sysUserRole 实例对象 - * @return 对象列表 - */ - List queryAll(SysUserRole sysUserRole); - - /** - * 新增数据 - * - * @param sysUserRole 实例对象 - * @return 影响行数 - */ - int insert(SysUserRole sysUserRole); - - /** - * 批量新增数据 - * - * @param list 实例对象list - * @return 影响行数 - */ - int insertBatch(List list); - - /** - * 修改数据 - * - * @param sysUserRole 实例对象 - * @return 影响行数 - */ - int update(SysUserRole sysUserRole); - - /** - * 通过主键删除数据 - * - * @param roleId 主键 - * @return 影响行数 - */ - int deleteById(Long roleId); - - /** - * 通过用户 ID 查询角色编码列表(关联查询 sys_role 和 sys_user_role) - * - * @param userId 用户 ID - * @return 角色编码列表 - */ - List queryRoleCodesByUserId(@Param("userId") Long userId); - -} diff --git a/src/main/java/com/kexue/skills/mapper/WithdrawalRecordMapper.java b/src/main/java/com/kexue/skills/mapper/WithdrawalRecordMapper.java deleted file mode 100644 index 8459e2b..0000000 --- a/src/main/java/com/kexue/skills/mapper/WithdrawalRecordMapper.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.kexue.skills.mapper; - -import com.kexue.skills.entity.WithdrawalRecord; -import com.kexue.skills.entity.dto.WithdrawalRecordDto; -import java.util.List; -import java.util.Map; - -/** - * 提现记录Mapper接口 - * - * @author 王志维 - * @since 2026-03-25 - */ -public interface WithdrawalRecordMapper { - /** - * 通过ID查询单条数据 - * - * @param recordId 主键 - * @return 实例对象 - */ - WithdrawalRecord queryById(Long recordId); - - /** - * 通过用户ID查询提现记录 - * - * @param userId 用户ID - * @return 实例对象 - */ - List queryByUserId(Long userId); - - /** - * 通过提现单号查询提现记录 - * - * @param withdrawalNo 提现单号 - * @return 实例对象 - */ - WithdrawalRecord queryByWithdrawalNo(String withdrawalNo); - - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getPageList(WithdrawalRecordDto queryDto); - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getList(WithdrawalRecordDto queryDto); - - /** - * 新增数据 - * - * @param withdrawalRecord 实例对象 - * @return 影响行数 - */ - int insert(WithdrawalRecord withdrawalRecord); - - /** - * 更新数据 - * - * @param withdrawalRecord 实例对象 - * @return 影响行数 - */ - int update(WithdrawalRecord withdrawalRecord); - - /** - * 更新提现状态 - * - * @param params 参数 - * @return 影响行数 - */ - int updateStatus(Map params); - - /** - * 通过主键逻辑删除 - * - * @param params 参数 - * @return 影响行数 - */ - int logicDeleteById(Map params); - - /** - * 通过主键物理删除 - * - * @param recordId 主键 - * @return 影响行数 - */ - int deleteById(Long recordId); -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/service/CmsCategoryService.java b/src/main/java/com/kexue/skills/service/CmsCategoryService.java deleted file mode 100644 index 7c390f8..0000000 --- a/src/main/java/com/kexue/skills/service/CmsCategoryService.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.kexue.skills.service; - -import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.CmsCategory; -import com.kexue.skills.entity.dto.CmsCategoryDto; - -import java.util.List; - -/** - * (CmsCategory)表服务接口 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -public interface CmsCategoryService extends BaseService { - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - PageInfo getPageList(CmsCategoryDto queryDto); - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getList(CmsCategoryDto queryDto); - - /** - * 通过主键查询单条数据 - * - * @param categoryId 主键 - * @return 实例对象 - */ - CmsCategory queryById(Long categoryId); - - /** - * 新增数据 - * - * @param cmsCategory 实例对象 - * @return 实例对象 - */ - CmsCategory insert(CmsCategory cmsCategory); - - /** - * 更新数据 - * - * @param cmsCategory 实例对象 - * @return 实例对象 - */ - CmsCategory update(CmsCategory cmsCategory); - - /** - * 通过主键逻辑删除 - * - * @param categoryId 主键 - * @param updateBy 更新人 - * @return 影响行数 - */ - int logicDeleteById(Long categoryId, String updateBy); - - /** - * 通过主键物理删除 - * - * @param categoryId 主键 - * @return 影响行数 - */ - int deleteById(Long categoryId); - - /** - * 查询分类树列表 - * - * @return 分类树列表 - */ - List getCategoryTreeList(); - - /** - * 获取分类字典 - * - * @return 分类字典,key为分类ID,value为分类名称 - */ - java.util.Map getCategoryDict(); -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/service/CmsCategoryTagService.java b/src/main/java/com/kexue/skills/service/CmsCategoryTagService.java deleted file mode 100644 index 93f909b..0000000 --- a/src/main/java/com/kexue/skills/service/CmsCategoryTagService.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.kexue.skills.service; - -import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.CmsCategoryTag; -import com.kexue.skills.entity.dto.CmsCategoryTagDto; - -import java.util.List; - -/** - * (CmsCategoryTag)表服务接口 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -public interface CmsCategoryTagService extends BaseService { - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - PageInfo getPageList(CmsCategoryTagDto queryDto); - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getList(CmsCategoryTagDto queryDto); - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 实例对象 - */ - CmsCategoryTag queryById(Long id); - - /** - * 新增数据 - * - * @param cmsCategoryTag 实例对象 - * @return 实例对象 - */ - CmsCategoryTag insert(CmsCategoryTag cmsCategoryTag); - - /** - * 更新数据 - * - * @param cmsCategoryTag 实例对象 - * @return 实例对象 - */ - CmsCategoryTag update(CmsCategoryTag cmsCategoryTag); - - /** - * 通过主键逻辑删除 - * - * @param id 主键 - * @param updateBy 更新人 - * @return 影响行数 - */ - int logicDeleteById(Long id, String updateBy); - - /** - * 通过主键物理删除 - * - * @param id 主键 - * @return 影响行数 - */ - int deleteById(Long id); - - /** - * 根据分类ID删除关联 - * - * @param categoryId 分类ID - * @param updateBy 更新人 - * @return 影响行数 - */ - int deleteByCategoryId(Long categoryId, String updateBy); - - /** - * 根据标签ID删除关联 - * - * @param tagId 标签ID - * @param updateBy 更新人 - * @return 影响行数 - */ - int deleteByTagId(Long tagId, String updateBy); - - /** - * 批量插入关联 - * - * @param categoryTagList 关联列表 - * @return 影响行数 - */ - int batchInsert(List categoryTagList); - - /** - * 批量设置分类标签关联 - * - * @param categoryId 分类ID - * @param tagIds 标签ID列表 - * @param updateBy 更新人 - * @return 影响行数 - */ - int batchSetCategoryTags(Long categoryId, List tagIds, String updateBy); - - /** - * 根据分类ID获取标签列表 - * - * @param categoryId 分类ID - * @return 标签列表 - */ - List getTagsByCategoryId(Long categoryId); -} diff --git a/src/main/java/com/kexue/skills/service/CmsContentService.java b/src/main/java/com/kexue/skills/service/CmsContentService.java deleted file mode 100644 index 4dd6274..0000000 --- a/src/main/java/com/kexue/skills/service/CmsContentService.java +++ /dev/null @@ -1,222 +0,0 @@ -package com.kexue.skills.service; - -import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.CmsContent; -import com.kexue.skills.entity.dto.CmsContentDto; -import com.kexue.skills.entity.request.ImportPathDto; - -import java.util.List; - -/** - * (CmsContent)表服务接口 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -public interface CmsContentService extends BaseService { - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - PageInfo getPageList(CmsContentDto queryDto); - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getList(CmsContentDto queryDto); - - /** - * 通过主键查询单条数据 - * - * @param contentId 主键 - * @return 实例对象 - */ - CmsContent queryById(Long contentId); - - /** - * 新增数据 - * - * @param cmsContent 实例对象 - * @return 实例对象 - */ - CmsContent insert(CmsContent cmsContent); - - /** - * 更新数据 - * - * @param cmsContent 实例对象 - * @return 实例对象 - */ - CmsContent update(CmsContent cmsContent); - - /** - * 更新审核状态 - * - * @param contentId 内容ID - * @param auditStatus 审核状态 - * @param reviewerId 审核人ID - * @param reviewerName 审核人名称 - * @param auditComment 审核意见 - * @param updateBy 更新人 - * @return 影响行数 - */ - int updateAuditStatus(Long contentId, Integer auditStatus, Long reviewerId, String reviewerName, String auditComment, String updateBy); - - /** - * 更新发布状态 - * - * @param contentId 内容ID - * @param publishStatus 发布状态 - * @param publishTime 发布时间 - * @param updateBy 更新人 - * @return 影响行数 - */ - int updatePublishStatus(Long contentId, Integer publishStatus, String publishTime, String updateBy); - - /** - * 增加阅读量 - * - * @param contentId 内容ID - * @return 影响行数 - */ - int increaseViewCount(Long contentId); - - /** - * 通过主键逻辑删除 - * - * @param contentId 主键 - * @param updateBy 更新人 - * @return 影响行数 - */ - int logicDeleteById(Long contentId, String updateBy); - - /** - * 通过主键物理删除 - * - * @param contentId 主键 - * @return 影响行数 - */ - int deleteById(Long contentId); - - /** - * 添加收藏 - * - * @param contentId 内容ID - * @return 影响行数 - */ - int addFavorite(Long contentId); - - /** - * 取消收藏 - * - * @param contentId 内容ID - * @return 影响行数 - */ - int removeFavorite(Long contentId); - - /** - * 检查用户是否已收藏该内容 - * - * @param contentId 内容ID - * @return 是否已收藏 - */ - boolean isFavorited(Long contentId); - - /** - * 添加查看记录 - * - * @param contentId 内容ID - * @return 影响行数 - */ - int addView(Long contentId); - - /** - * 获取用户历史查看的内容列表 - * - * @param queryDto 筛选条件,包含分页信息 - * @return 查询结果 - */ - PageInfo getPageListByUserHistory(CmsContentDto queryDto); - - /** - * 获取用户收藏的内容列表 - * - * @param queryDto 筛选条件,包含分页信息 - * @return 查询结果 - */ - PageInfo getPageListByUserFavorites(CmsContentDto queryDto); - - /** - * 获取用户购买的内容列表 - * - * @param queryDto 筛选条件,包含分页信息 - * @return 查询结果 - */ - PageInfo getPageListByUserPurchases(CmsContentDto queryDto); - - /** - * 获取用户创建的内容列表 - * - * @param queryDto 筛选条件,包含分页信息 - * @return 查询结果 - */ - PageInfo getPageListByUserCreated(CmsContentDto queryDto); - - /** - * 导入Excel数据到CmsContent - * - * @param fileBytes Excel文件字节数组 - * @param createBy 创建人 - * @return 导入结果 - */ - int importFromExcel(byte[] fileBytes, String createBy); - - /** - * 获取CmsContent的content字段内容 - * - * @param contentId 内容ID - * @param languageType 语言类型:0 中文,1 英文 - * @return content或contentEn字段的内容 - */ - String getContent(Long contentId, Integer languageType); - - /** - * 获取CmsContent的title字段内容 - * - * @param contentId 内容ID - * @return title字段的内容 - */ - String getTitle(Long contentId); - - /** - * 从指定目录导入Excel数据到CmsContent - * - * @param importPathDto 导入路径请求参数 - * @param createBy 创建人 - * @return 导入结果 - */ - int importFromPath(ImportPathDto importPathDto, String createBy); - - /** - * 从ZIP文件批量导入Excel数据到CmsContent - * - * @param zipFileBytes ZIP文件字节数组 - * @param createBy 创建人 - * @return 成功导入的记录数 - */ - int importFromZip(byte[] zipFileBytes, String createBy); - - /** - * 从指定目录读取Excel数据并更新CmsContent - * - * @param importPathDto 导入路径请求参数 - * @param updateBy 更新人 - * @return 成功更新的记录数 - */ - int updateFromPath(ImportPathDto importPathDto, String updateBy); -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/service/CmsTagService.java b/src/main/java/com/kexue/skills/service/CmsTagService.java deleted file mode 100644 index 9537f22..0000000 --- a/src/main/java/com/kexue/skills/service/CmsTagService.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.kexue.skills.service; - -import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.CmsTag; -import com.kexue.skills.entity.dto.CmsTagDto; - -import java.util.List; - -/** - * (CmsTag)表服务接口 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -public interface CmsTagService extends BaseService { - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - PageInfo getPageList(CmsTagDto queryDto); - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getList(CmsTagDto queryDto); - - /** - * 通过主键查询单条数据 - * - * @param tagId 主键 - * @return 实例对象 - */ - CmsTag queryById(Long tagId); - - /** - * 新增数据 - * - * @param cmsTag 实例对象 - * @return 实例对象 - */ - CmsTag insert(CmsTag cmsTag); - - /** - * 更新数据 - * - * @param cmsTag 实例对象 - * @return 实例对象 - */ - CmsTag update(CmsTag cmsTag); - - /** - * 通过主键逻辑删除 - * - * @param tagId 主键 - * @param updateBy 更新人 - * @return 影响行数 - */ - int logicDeleteById(Long tagId, String updateBy); - - /** - * 通过主键物理删除 - * - * @param tagId 主键 - * @return 影响行数 - */ - int deleteById(Long tagId); - - /** - * 根据分类ID查询标签列表 - * - * @param categoryId 分类ID - * @return 标签列表 - */ - List getTagsByCategoryId(Long categoryId); -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/service/ContentPurchaseService.java b/src/main/java/com/kexue/skills/service/ContentPurchaseService.java deleted file mode 100644 index 2ab4a89..0000000 --- a/src/main/java/com/kexue/skills/service/ContentPurchaseService.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.kexue.skills.service; - -import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.ContentPurchase; -import com.kexue.skills.entity.dto.ContentPurchaseDto; - -import java.util.List; - -/** - * (ContentPurchase)表服务接口 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -public interface ContentPurchaseService extends BaseService { - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - PageInfo getPageList(ContentPurchaseDto queryDto); - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getList(ContentPurchaseDto queryDto); - - /** - * 通过主键查询单条数据 - * - * @param purchaseId 主键 - * @return 实例对象 - */ - ContentPurchase queryById(Long purchaseId); - - /** - * 通过用户ID和内容ID查询购买记录 - * - * @param userId 用户ID - * @param contentId 内容ID - * @return 实例对象 - */ - ContentPurchase queryByUserIdAndContentId(Long userId, Long contentId); - - /** - * 新增数据 - * - * @param purchase 实例对象 - * @return 实例对象 - */ - ContentPurchase insert(ContentPurchase purchase); - - /** - * 更新数据 - * - * @param purchase 实例对象 - * @return 实例对象 - */ - ContentPurchase update(ContentPurchase purchase); - - /** - * 更新购买状态 - * - * @param purchaseId 购买ID - * @param status 状态 - * @return 影响行数 - */ - int updateStatus(Long purchaseId, Integer status); - - /** - * 通过主键逻辑删除 - * - * @param purchaseId 主键 - * @param updateBy 更新人 - * @return 影响行数 - */ - int logicDeleteById(Long purchaseId, String updateBy); - - /** - * 通过主键物理删除 - * - * @param purchaseId 主键 - * @return 影响行数 - */ - int deleteById(Long purchaseId); - - /** - * 购买内容 - * - * @param userId 用户ID - * @param contentId 内容ID - * @param payType 支付方式:1.余额支付 2.积分支付 - * @return 购买结果 - */ - ContentPurchase purchaseContent(Long userId, Long contentId, Integer payType); - - /** - * 检查用户是否有权限访问内容 - * - * @param userId 用户ID - * @param contentId 内容ID - * @return 是否有权限 - */ - boolean checkAccessPermission(Long userId, Long contentId); -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/service/SkillGenService.java b/src/main/java/com/kexue/skills/service/SkillGenService.java deleted file mode 100644 index c4b0688..0000000 --- a/src/main/java/com/kexue/skills/service/SkillGenService.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.kexue.skills.service; - -import com.alibaba.fastjson.JSONObject; -import com.kexue.skills.entity.CmsContent; -import com.kexue.skills.entity.request.SkillGenRequest; -import com.kexue.skills.entity.request.SkillPreGenRequest; -import com.kexue.skills.entity.request.SkillAnalyzeRequest; -import com.kexue.skills.entity.response.SkillResponse; - -/** - * 技能生成服务接口 - * - * @author 维哥 - * @since 2026-01-28 - */ -public interface SkillGenService { - - /** - * 生成技能 - * - * @param request 生成请求 - * @return 生成结果 - */ - SkillResponse preGenerate(SkillPreGenRequest request); - - SkillResponse preGenerateV2(SkillPreGenRequest request); - - CmsContent generate(SkillGenRequest request); - - - /** - * 分析技能 - * - * @param request 分析请求 - * @return 分析结果 - */ - String analyzeSkill(SkillAnalyzeRequest request); - - /** - * 生成技能介绍 - * - * @param content 技能内容 - * @return 技能介绍 - */ - String genIntroduce(String content); - - /** - * 根据技能描述生成技能介绍 - * - * @param description 技能描述 - * @return 技能介绍 - */ - String genIntroduceByDescription(String description); - - /** - * 上传技能压缩包并生成技能 - * - * @param skillUrl 技能压缩包URL - * @return 生成的技能内容 - */ - CmsContent uploadSkill(String skillUrl); - - /** - * 上传本地技能压缩包并生成技能V2 - * - * @param fileBytes 技能压缩包字节数组 - * @param fileName 文件名 - * @return 生成的技能内容 - */ - CmsContent uploadSkillV2(byte[] fileBytes, String fileName); - - CmsContent uploadSkillV4(byte[] fileBytes, String fileName); - - CmsContent uploadSkillV3(String yamlContent); -} diff --git a/src/main/java/com/kexue/skills/service/SysUserRoleService.java b/src/main/java/com/kexue/skills/service/SysUserRoleService.java deleted file mode 100644 index faf8739..0000000 --- a/src/main/java/com/kexue/skills/service/SysUserRoleService.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.kexue.skills.service; -import com.github.pagehelper.PageInfo; - -import com.kexue.skills.entity.SysUserRole; -import com.kexue.skills.entity.dto.SysUserRoleDto; -import java.util.List; - -/** - * (SysUserRole)表服务接口 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -public interface SysUserRoleService extends BaseService { - - /** - * 分页查询 - * - * @param sysUserRoleDto 筛选条件 - * @return 查询结果 - */ - PageInfo getPageList(SysUserRoleDto sysUserRoleDto); - - /** - * 通过ID查询单条数据 - * - * @param roleId 主键 - * @return 实例对象 - */ - SysUserRole queryById(Long roleId); - - /** - * 查询多条数据 - * - * @param offset 查询起始位置 - * @param limit 查询条数 - * @return 对象列表 - */ - List queryAllByLimit(int offset, int limit); - - /** - * 新增数据 - * - * @param sysUserRole 实例对象 - * @return 实例对象 - */ - SysUserRole insert(SysUserRole sysUserRole); - - /** - * 修改数据 - * - * @param sysUserRole 实例对象 - * @return 实例对象 - */ - SysUserRole update(SysUserRole sysUserRole); - - /** - * 通过主键删除数据 - * - * @param roleId 主键 - * @return 是否成功 - */ - boolean deleteById(Long roleId); - -} diff --git a/src/main/java/com/kexue/skills/service/WithdrawalRecordService.java b/src/main/java/com/kexue/skills/service/WithdrawalRecordService.java deleted file mode 100644 index 0e32aea..0000000 --- a/src/main/java/com/kexue/skills/service/WithdrawalRecordService.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.kexue.skills.service; - -import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.WithdrawalRecord; -import com.kexue.skills.entity.dto.WithdrawalRecordDto; -import java.util.List; - -/** - * 提现记录Service接口 - * - * @author 王志维 - * @since 2026-03-25 - */ -public interface WithdrawalRecordService { - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - PageInfo getPageList(WithdrawalRecordDto queryDto); - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - List getList(WithdrawalRecordDto queryDto); - - /** - * 通过主键查询单条数据 - * - * @param recordId 主键 - * @return 实例对象 - */ - WithdrawalRecord queryById(Long recordId); - - /** - * 通过用户ID查询提现记录 - * - * @param userId 用户ID - * @return 实例对象 - */ - List queryByUserId(Long userId); - - /** - * 通过提现单号查询提现记录 - * - * @param withdrawalNo 提现单号 - * @return 实例对象 - */ - WithdrawalRecord queryByWithdrawalNo(String withdrawalNo); - - /** - * 新增数据 - * - * @param withdrawalRecord 实例对象 - * @return 实例对象 - */ - WithdrawalRecord insert(WithdrawalRecord withdrawalRecord); - - /** - * 更新数据 - * - * @param withdrawalRecord 实例对象 - * @return 实例对象 - */ - WithdrawalRecord update(WithdrawalRecord withdrawalRecord); - - /** - * 更新提现状态 - * - * @param recordId 记录ID - * @param status 状态 - * @return 影响行数 - */ - int updateStatus(Long recordId, Integer status); - - /** - * 通过主键逻辑删除 - * - * @param recordId 主键 - * @param updateBy 更新人 - * @return 影响行数 - */ - int logicDeleteById(Long recordId, String updateBy); - - /** - * 通过主键物理删除 - * - * @param recordId 主键 - * @return 影响行数 - */ - int deleteById(Long recordId); - - /** - * 提交提现申请 - * - * @param userId 用户ID - * @param amount 提现金额 - * @param bankName 银行名称 - * @param bankAccount 银行账号 - * @param bankCardholder 持卡人姓名 - * @param remark 备注 - * @return 提现记录 - */ - WithdrawalRecord submitWithdrawal(Long userId, java.math.BigDecimal amount, String bankName, String bankAccount, String bankCardholder, String remark); - - /** - * 处理提现 - * - * @param recordId 记录ID - * @param status 状态 - * @param remark 备注 - * @return 影响行数 - */ - int processWithdrawal(Long recordId, Integer status, String remark); -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/service/impl/CmsCategoryServiceImpl.java b/src/main/java/com/kexue/skills/service/impl/CmsCategoryServiceImpl.java deleted file mode 100644 index 9e8f559..0000000 --- a/src/main/java/com/kexue/skills/service/impl/CmsCategoryServiceImpl.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.kexue.skills.service.impl; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.CmsCategory; -import com.kexue.skills.entity.dto.CmsCategoryDto; -import com.kexue.skills.mapper.CmsCategoryMapper; -import com.kexue.skills.service.CmsCategoryService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.util.Date; -import java.util.List; - -/** - * (CmsCategory)表服务实现类 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Service("cmsCategoryService") -@Transactional(rollbackFor = Exception.class) -public class CmsCategoryServiceImpl implements CmsCategoryService { - @Resource - private CmsCategoryMapper cmsCategoryMapper; - - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @Override - public PageInfo getPageList(CmsCategoryDto queryDto) { - PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize()); - List list = this.cmsCategoryMapper.getPageList(queryDto); - return new PageInfo<>(list); - } - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @Override - public List getList(CmsCategoryDto queryDto) { - return this.cmsCategoryMapper.getList(queryDto); - } - - /** - * 通过主键查询单条数据 - * - * @param categoryId 主键 - * @return 实例对象 - */ - @Override - public CmsCategory queryById(Long categoryId) { - return this.cmsCategoryMapper.queryById(categoryId); - } - - /** - * 新增数据 - * - * @param cmsCategory 实例对象 - * @return 实例对象 - */ - @Override - public CmsCategory insert(CmsCategory cmsCategory) { - // 设置创建时间和更新时间 - Date now = new Date(); - cmsCategory.setCreateTime(now); - cmsCategory.setUpdateTime(now); - // 设置默认值 - cmsCategory.setDeleteFlag(0); - if (cmsCategory.getStatus() == null) { - cmsCategory.setStatus(1); - } - if (cmsCategory.getSort() == null) { - cmsCategory.setSort(0); - } - // 保存数据 - this.cmsCategoryMapper.insert(cmsCategory); - return cmsCategory; - } - - /** - * 更新数据 - * - * @param cmsCategory 实例对象 - * @return 实例对象 - */ - @Override - public CmsCategory update(CmsCategory cmsCategory) { - // 设置更新时间 - cmsCategory.setUpdateTime(new Date()); - // 更新数据 - this.cmsCategoryMapper.update(cmsCategory); - return this.queryById(cmsCategory.getCategoryId()); - } - - /** - * 通过主键逻辑删除 - * - * @param categoryId 主键 - * @param updateBy 更新人 - * @return 影响行数 - */ - @Override - public int logicDeleteById(Long categoryId, String updateBy) { - return this.cmsCategoryMapper.logicDeleteById(categoryId, updateBy); - } - - /** - * 通过主键物理删除 - * - * @param categoryId 主键 - * @return 影响行数 - */ - @Override - public int deleteById(Long categoryId) { - return this.cmsCategoryMapper.deleteById(categoryId); - } - - /** - * 查询分类树列表 - * - * @return 分类树列表 - */ - @Override - public List getCategoryTreeList() { - // 查询所有分类 - CmsCategoryDto queryDto = new CmsCategoryDto(); - queryDto.setDeleteFlag(0); // 只查询未删除的分类 - List allCategories = this.cmsCategoryMapper.getList(queryDto); - - // 构建分类树 - return buildCategoryTree(allCategories, null); - } - - /** - * 递归构建分类树 - * - * @param allCategories 所有分类列表 - * @param parentId 父分类ID - * @return 分类树列表 - */ - private List buildCategoryTree(List allCategories, Long parentId) { - List tree = new java.util.ArrayList<>(); - - for (CmsCategory category : allCategories) { - // 找出当前父分类下的子分类 - if ((parentId == null && category.getParentId() == null) || - (parentId != null && parentId.equals(category.getParentId()))) { - // 递归查询子分类 - List subCategories = buildCategoryTree(allCategories, category.getCategoryId()); - category.setSubCategoryList(subCategories); - tree.add(category); - } - } - - return tree; - } - - /** - * 获取分类字典 - * - * @return 分类字典,key为分类ID,value为分类名称 - */ - @Override - public java.util.Map getCategoryDict() { - // 查询所有分类 - CmsCategoryDto queryDto = new CmsCategoryDto(); - queryDto.setDeleteFlag(0); // 只查询未删除的分类 - List allCategories = this.cmsCategoryMapper.getList(queryDto); - - // 构建分类字典 - java.util.Map categoryDict = new java.util.HashMap<>(); - for (CmsCategory category : allCategories) { - categoryDict.put(category.getCategoryId(), category.getCategoryName()); - } - - return categoryDict; - } -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/service/impl/CmsCategoryTagServiceImpl.java b/src/main/java/com/kexue/skills/service/impl/CmsCategoryTagServiceImpl.java deleted file mode 100644 index 97b6713..0000000 --- a/src/main/java/com/kexue/skills/service/impl/CmsCategoryTagServiceImpl.java +++ /dev/null @@ -1,219 +0,0 @@ -package com.kexue.skills.service.impl; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.CmsCategoryTag; -import com.kexue.skills.entity.CmsTag; -import com.kexue.skills.entity.dto.CmsCategoryTagDto; -import com.kexue.skills.entity.dto.CmsTagDto; -import com.kexue.skills.mapper.CmsCategoryTagMapper; -import com.kexue.skills.service.CmsCategoryTagService; -import com.kexue.skills.service.CmsTagService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * (CmsCategoryTag)表服务实现类 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Service("cmsCategoryTagService") -@Transactional(rollbackFor = Exception.class) -public class CmsCategoryTagServiceImpl implements CmsCategoryTagService { - @Resource - private CmsCategoryTagMapper cmsCategoryTagMapper; - - @Resource - private CmsTagService cmsTagService; - - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @Override - public PageInfo getPageList(CmsCategoryTagDto queryDto) { - PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize()); - List list = this.cmsCategoryTagMapper.getPageList(queryDto); - return new PageInfo<>(list); - } - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @Override - public List getList(CmsCategoryTagDto queryDto) { - return this.cmsCategoryTagMapper.getList(queryDto); - } - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 实例对象 - */ - @Override - public CmsCategoryTag queryById(Long id) { - return this.cmsCategoryTagMapper.queryById(id); - } - - /** - * 新增数据 - * - * @param cmsCategoryTag 实例对象 - * @return 实例对象 - */ - @Override - public CmsCategoryTag insert(CmsCategoryTag cmsCategoryTag) { - // 设置创建时间和更新时间 - Date now = new Date(); - cmsCategoryTag.setCreateTime(now); - cmsCategoryTag.setUpdateTime(now); - // 设置默认值 - cmsCategoryTag.setDeleteFlag(0); - // 保存数据 - this.cmsCategoryTagMapper.insert(cmsCategoryTag); - return cmsCategoryTag; - } - - /** - * 更新数据 - * - * @param cmsCategoryTag 实例对象 - * @return 实例对象 - */ - @Override - public CmsCategoryTag update(CmsCategoryTag cmsCategoryTag) { - // 设置更新时间 - cmsCategoryTag.setUpdateTime(new Date()); - // 更新数据 - this.cmsCategoryTagMapper.update(cmsCategoryTag); - return this.queryById(cmsCategoryTag.getId()); - } - - /** - * 通过主键逻辑删除 - * - * @param id 主键 - * @param updateBy 更新人 - * @return 影响行数 - */ - @Override - public int logicDeleteById(Long id, String updateBy) { - return this.cmsCategoryTagMapper.logicDeleteById(id, updateBy); - } - - /** - * 通过主键物理删除 - * - * @param id 主键 - * @return 影响行数 - */ - @Override - public int deleteById(Long id) { - return this.cmsCategoryTagMapper.deleteById(id); - } - - /** - * 根据分类ID删除关联 - * - * @param categoryId 分类ID - * @param updateBy 更新人 - * @return 影响行数 - */ - @Override - public int deleteByCategoryId(Long categoryId, String updateBy) { - return this.cmsCategoryTagMapper.deleteByCategoryId(categoryId, updateBy); - } - - /** - * 根据标签ID删除关联 - * - * @param tagId 标签ID - * @param updateBy 更新人 - * @return 影响行数 - */ - @Override - public int deleteByTagId(Long tagId, String updateBy) { - return this.cmsCategoryTagMapper.deleteByTagId(tagId, updateBy); - } - - /** - * 批量插入关联 - * - * @param categoryTagList 关联列表 - * @return 影响行数 - */ - @Override - public int batchInsert(List categoryTagList) { - if (categoryTagList == null || categoryTagList.isEmpty()) { - return 0; - } - // 设置默认值 - Date now = new Date(); - for (CmsCategoryTag tag : categoryTagList) { - tag.setCreateTime(now); - tag.setUpdateTime(now); - tag.setDeleteFlag(0); - } - return this.cmsCategoryTagMapper.batchInsert(categoryTagList); - } - - /** - * 批量设置分类标签关联 - * - * @param categoryId 分类ID - * @param tagIds 标签ID列表 - * @param updateBy 更新人 - * @return 影响行数 - */ - @Override - public int batchSetCategoryTags(Long categoryId, List tagIds, String updateBy) { - // 先删除该分类的所有关联 - int deleteCount = this.deleteByCategoryId(categoryId, updateBy); - - // 然后批量插入新的关联 - if (tagIds == null || tagIds.isEmpty()) { - return deleteCount; - } - - List categoryTagList = new ArrayList<>(); - Date now = new Date(); - for (Long tagId : tagIds) { - CmsCategoryTag categoryTag = new CmsCategoryTag(); - categoryTag.setCategoryId(categoryId); - categoryTag.setTagId(tagId); - categoryTag.setCreateTime(now); - categoryTag.setUpdateTime(now); - categoryTag.setCreateBy(updateBy); - categoryTag.setUpdateBy(updateBy); - categoryTag.setDeleteFlag(0); - categoryTagList.add(categoryTag); - } - - int insertCount = this.batchInsert(categoryTagList); - return deleteCount + insertCount; - } - - /** - * 根据分类ID获取标签列表 - * - * @param categoryId 分类ID - * @return 标签列表 - */ - @Override - public List getTagsByCategoryId(Long categoryId) { - // 直接使用SQL联合查询获取标签列表,提高效率 - return cmsTagService.getTagsByCategoryId(categoryId); - } -} diff --git a/src/main/java/com/kexue/skills/service/impl/CmsContentServiceImpl.java b/src/main/java/com/kexue/skills/service/impl/CmsContentServiceImpl.java deleted file mode 100644 index 24a9e83..0000000 --- a/src/main/java/com/kexue/skills/service/impl/CmsContentServiceImpl.java +++ /dev/null @@ -1,1199 +0,0 @@ -package com.kexue.skills.service.impl; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.github.pagehelper.util.StringUtil; -import com.kexue.skills.common.Assert; -import com.kexue.skills.common.LoginUserCacheUtil; -import com.kexue.skills.entity.CmsContent; -import com.kexue.skills.entity.CmsContentView; -import com.kexue.skills.entity.CmsContentLike; -import com.kexue.skills.entity.base.BaseQueryDto; -import com.kexue.skills.entity.dto.CmsContentDto; -import com.kexue.skills.entity.request.ImportPathDto; -import com.kexue.skills.mapper.CmsContentMapper; -import com.kexue.skills.mapper.CmsContentViewMapper; -import com.kexue.skills.mapper.CmsContentLikeMapper; -import com.kexue.skills.mapper.CmsTagMapper; -import com.kexue.skills.entity.CmsTag; -import com.kexue.skills.entity.dto.CmsTagDto; -import com.kexue.skills.service.CmsContentService; -import cn.hutool.poi.excel.ExcelReader; -import cn.hutool.poi.excel.ExcelUtil; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.math.BigDecimal; -import java.util.*; -import java.util.stream.Collectors; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import cn.dev33.satoken.stp.StpUtil; - -/** - * (CmsContent)表服务实现类 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Service("cmsContentService") -@Transactional(rollbackFor = Exception.class) -public class CmsContentServiceImpl implements CmsContentService { - @Resource - private CmsContentMapper cmsContentMapper; - - @Resource - private CmsContentViewMapper cmsContentViewMapper; - - @Resource - private CmsContentLikeMapper cmsContentLikeMapper; - - @Resource - private CmsTagMapper cmsTagMapper; - - @Resource - private LoginUserCacheUtil loginUserCacheUtil; - - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @Override - public PageInfo getPageList(CmsContentDto queryDto) { - // 添加参数校验,确保分页参数有效 - if (queryDto.getPageNum() == null || queryDto.getPageNum() < 1) { - queryDto.setPageNum(BaseQueryDto.DEFAULT_CURRENT_PAGE); - } - if (queryDto.getPageSize() == null || queryDto.getPageSize() < 1) { - queryDto.setPageSize(BaseQueryDto.DEFAULT_PAGE_SIZE); - } - - // 使用 PageHelper 进行分页 - PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize()); - // 设置默认语言类型为中文 - if (queryDto.getLanguageType() == null) { - queryDto.setLanguageType(0); - } - List list = this.cmsContentMapper.getPageList(queryDto); - return new PageInfo<>(list); - } - - /** - * 内存分页方法 - * - * @param list 原始数据列表 - * @param pageNum 页码 - * @param pageSize 每页大小 - * @return 当前页的 list,对应的页码没有数据则返回空 list - */ - private List memoryPagination(List list, int pageNum, int pageSize) { - // 参数校验 - if (list == null) { - return new ArrayList<>(); - } - if (pageNum < 1) { - pageNum = 1; - } - if (pageSize < 1) { - pageSize = 10; - } - - // 计算总记录数 - int total = list.size(); - - // 计算分页参数 - int startIndex = (pageNum - 1) * pageSize; - int endIndex = Math.min(startIndex + pageSize, total); - - // 截取分页数据 - List pageList = new ArrayList<>(); - if (startIndex < total) { - pageList = list.subList(startIndex, endIndex); - } - - return pageList; - } - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @Override - public List getList(CmsContentDto queryDto) { - // 设置默认语言类型为中文 - if (queryDto.getLanguageType() == null) { - queryDto.setLanguageType(0); - } - return this.cmsContentMapper.getList(queryDto); - } - - /** - * 通过主键查询单条数据 - * - * @param contentId 主键 - * @return 实例对象 - */ - @Override - public CmsContent queryById(Long contentId) { - Assert.notNull(contentId, "内容ID不能为空"); - CmsContent content = this.cmsContentMapper.queryById(contentId); - if (content == null) { - return null; - } - - try { - // 尝试获取当前登录用户ID - Long userId = Long.parseLong(StpUtil.getLoginId().toString()); - // 检查用户是否已经查看过该内容(5分钟内) - CmsContentView existingView = cmsContentViewMapper.queryByUserIdAndContentId(userId, contentId); - if (existingView == null) { - // 新增查看记录 - CmsContentView viewRecord = new CmsContentView(); - viewRecord.setUserId(userId); - viewRecord.setUserName(StpUtil.getLoginIdAsString()); - viewRecord.setContentId(contentId); - viewRecord.setContentTitle(content.getTitle()); - viewRecord.setViewTime(new Date()); - viewRecord.setDeleteFlag(0); - viewRecord.setCreateBy(StpUtil.getLoginIdAsString()); - viewRecord.setUpdateBy(StpUtil.getLoginIdAsString()); - cmsContentViewMapper.insert(viewRecord); - } else { - // 检查是否超过5分钟 - Date fiveMinutesAgo = new Date(System.currentTimeMillis() - 5 * 60 * 1000); - if (existingView.getViewTime().before(fiveMinutesAgo)) { - // 更新查看时间 - existingView.setViewTime(new Date()); - existingView.setUpdateBy(StpUtil.getLoginIdAsString()); - cmsContentViewMapper.update(existingView); - } - } - } catch (Exception e) { - // 未登录用户,不记录查看历史 - } - - return content; - } - - /** - * 通过主键查询单条数据,带权限检查 - * - * @param contentId 主键 - * @param userId 用户ID - * @return 实例对象 - */ - public CmsContent queryByIdWithPermission(Long contentId, Long userId) { - Assert.notNull(contentId, "内容ID不能为空"); - CmsContent content = this.cmsContentMapper.queryById(contentId); - if (content == null) { - return null; - } - - // 如果是付费内容,检查用户是否购买过 - if (content.getIsPaid() == 1) { - // 这里需要调用ContentPurchaseService检查权限,但为了避免循环依赖,我们返回完整内容 - // 权限检查将在Controller层进行 - } - - return content; - } - - /** - * 新增数据 - * - * @param cmsContent 实例对象 - * @return 实例对象 - */ - @Override - public CmsContent insert(CmsContent cmsContent) { - // 设置创建时间和更新时间 - Date now = new Date(); - cmsContent.setCreateTime(now); - cmsContent.setUpdateTime(now); - // 设置默认值 - cmsContent.setDeleteFlag(0); - if (cmsContent.getAuditStatus() == null) { - cmsContent.setAuditStatus(1); // 默认草稿状态 - } - if (cmsContent.getPublishStatus() == null) { - cmsContent.setPublishStatus(1); // 默认未发布状态 - } - if (cmsContent.getViewCount() == null) { - cmsContent.setViewCount(0); - } - if (cmsContent.getLikeCount() == null) { - cmsContent.setLikeCount(0); - } - if (cmsContent.getCommentCount() == null) { - cmsContent.setCommentCount(0); - } - if (cmsContent.getShareCount() == null) { - cmsContent.setShareCount(0); - } - if (cmsContent.getSort() == null) { - cmsContent.setSort(0); - } - if (cmsContent.getIsOfficial() == null) { - cmsContent.setIsOfficial(false); - } - cmsContent.setAuthorId(StpUtil.getLoginIdAsLong()); - // 保存数据 - this.cmsContentMapper.insert(cmsContent); - return cmsContent; - } - - /** - * 更新数据 - * - * @param cmsContent 实例对象 - * @return 实例对象 - */ - @Override - public CmsContent update(CmsContent cmsContent) { - Assert.notNull(cmsContent.getContentId(), "内容ID不能为空"); - // 设置更新时间 - cmsContent.setUpdateTime(new Date()); - // 更新数据 - this.cmsContentMapper.update(cmsContent); - return this.queryById(cmsContent.getContentId()); - } - - /** - * 更新审核状态 - * - * @param contentId 内容ID - * @param auditStatus 审核状态 - * @param reviewerId 审核人ID - * @param reviewerName 审核人名称 - * @param auditComment 审核意见 - * @param updateBy 更新人 - * @return 影响行数 - */ - @Override - public int updateAuditStatus(Long contentId, Integer auditStatus, Long reviewerId, String reviewerName, String auditComment, String updateBy) { - Assert.notNull(contentId, "内容ID不能为空"); - return this.cmsContentMapper.updateAuditStatus(contentId, auditStatus, reviewerId, reviewerName, auditComment, updateBy); - } - - /** - * 更新发布状态 - * - * @param contentId 内容ID - * @param publishStatus 发布状态 - * @param publishTime 发布时间 - * @param updateBy 更新人 - * @return 影响行数 - */ - @Override - public int updatePublishStatus(Long contentId, Integer publishStatus, String publishTime, String updateBy) { - Assert.notNull(contentId, "内容ID不能为空"); - return this.cmsContentMapper.updatePublishStatus(contentId, publishStatus, publishTime, updateBy); - } - - /** - * 增加阅读量 - * - * @param contentId 内容ID - * @return 影响行数 - */ - @Override - public int increaseViewCount(Long contentId) { - Assert.notNull(contentId, "内容ID不能为空"); - // 增加阅读量 - int result = this.cmsContentMapper.increaseViewCount(contentId); - - try { - // 尝试获取当前登录用户ID - Long userId = Long.parseLong(StpUtil.getLoginId().toString()); - // 调用addView方法添加查看记录 - this.addView(contentId); - } catch (Exception e) { - // 未登录用户,不记录查看历史 - } - - return result; - } - - /** - * 通过主键逻辑删除 - * - * @param contentId 主键 - * @param updateBy 更新人 - * @return 影响行数 - */ - @Override - public int logicDeleteById(Long contentId, String updateBy) { - Assert.notNull(contentId, "内容ID不能为空"); - return this.cmsContentMapper.logicDeleteById(contentId, updateBy); - } - - /** - * 通过主键物理删除 - * - * @param contentId 主键 - * @return 影响行数 - */ - @Override - public int deleteById(Long contentId) { - Assert.notNull(contentId, "内容ID不能为空"); - return this.cmsContentMapper.deleteById(contentId); - } - - /** - * 添加/取消收藏 - * - * @param contentId 内容ID - * @return 影响行数 - */ - @Override - public int addFavorite(Long contentId) { - Assert.notNull(contentId, "内容ID不能为空"); - // 获取当前登录用户ID - Long userId = Long.parseLong(StpUtil.getLoginId().toString()); - // 获取当前登录用户名 - String userName = StpUtil.getLoginIdAsString(); - - // 检查内容是否存在 - CmsContent content = this.cmsContentMapper.queryById(contentId); - if (content == null) { - return 0; - } - if(Objects.isNull(content.getLikeCount())){ - content.setLikeCount(0); - } - - // 检查用户是否已经收藏过该内容 - CmsContentLike existingLike = cmsContentLikeMapper.queryByUserIdAndContentId(userId, contentId); - int result = 0; - - if (existingLike != null) { - // 已经收藏过,执行取消收藏操作 - result = cmsContentLikeMapper.deleteById(existingLike.getLikeId()); - - // 减少内容的点赞数 - if (content != null && content.getLikeCount() > 0) { - content.setLikeCount(content.getLikeCount() - 1); - this.cmsContentMapper.update(content); - } - } else { - // 未收藏过,执行添加收藏操作 - CmsContentLike likeRecord = new CmsContentLike(); - likeRecord.setUserId(userId); - likeRecord.setUserName(userName); - likeRecord.setContentId(contentId); - likeRecord.setContentTitle(content.getTitle()); - likeRecord.setLikeTime(new Date()); - likeRecord.setDeleteFlag(0); - - // 增加内容的点赞数 - content.setLikeCount(content.getLikeCount() + 1); - this.cmsContentMapper.update(content); - - result = cmsContentLikeMapper.insert(likeRecord); - } - - // 更新Redis中的LoginUser对象 - if (result > 0) { - String token = loginUserCacheUtil.getTokenFromRequest(); - if (token != null) { - loginUserCacheUtil.updateFavorites(token, userId); - } - } - - return result; - } - - /** - * 取消收藏 - * - * @param contentId 内容ID - * @return 影响行数 - */ - @Override - public int removeFavorite(Long contentId) { - Assert.notNull(contentId, "内容ID不能为空"); - // 获取当前登录用户ID - Long userId = Long.parseLong(StpUtil.getLoginId().toString()); - - // 检查用户是否已经收藏过该内容 - CmsContentLike existingLike = cmsContentLikeMapper.queryByUserIdAndContentId(userId, contentId); - if (existingLike == null) { - return 0; // 没有收藏过,无需取消 - } - - // 删除收藏记录 - int result = cmsContentLikeMapper.deleteById(existingLike.getLikeId()); - - // 减少内容的点赞数 - CmsContent content = this.cmsContentMapper.queryById(contentId); - if (content != null && content.getLikeCount() > 0) { - content.setLikeCount(content.getLikeCount() - 1); - this.cmsContentMapper.update(content); - } - - // 更新Redis中的LoginUser对象 - if (result > 0) { - String token = loginUserCacheUtil.getTokenFromRequest(); - if (token != null) { - loginUserCacheUtil.updateFavorites(token, userId); - } - } - - return result; - } - - /** - * 检查用户是否已收藏该内容 - * - * @param contentId 内容ID - * @return 是否已收藏 - */ - @Override - public boolean isFavorited(Long contentId) { - Assert.notNull(contentId, "内容ID不能为空"); - try { - // 获取当前登录用户ID - Long userId = Long.parseLong(StpUtil.getLoginId().toString()); - CmsContentLike existingLike = cmsContentLikeMapper.queryByUserIdAndContentId(userId, contentId); - return existingLike != null; - } catch (Exception e) { - // 未登录用户,返回false - return false; - } - } - - /** - * 添加查看记录 - * - * @param contentId 内容ID - * @return 影响行数 - */ - @Override - public int addView(Long contentId) { - Assert.notNull(contentId, "内容ID不能为空"); - try { - // 获取当前登录用户ID - Long userId = Long.parseLong(StpUtil.getLoginId().toString()); - // 获取当前登录用户名 - String userName = StpUtil.getLoginIdAsString(); - - // 检查内容是否存在 - CmsContent content = this.cmsContentMapper.queryById(contentId); - if (content == null) { - return 0; - } - - // 检查用户是否已经查看过该内容(5分钟内) - CmsContentView existingView = cmsContentViewMapper.queryByUserIdAndContentId(userId, contentId); - int result = 0; - if (existingView == null) { - // 新增查看记录 - CmsContentView viewRecord = new CmsContentView(); - viewRecord.setUserId(userId); - viewRecord.setUserName(userName); - viewRecord.setContentId(contentId); - viewRecord.setContentTitle(content.getTitle()); - viewRecord.setViewTime(new Date()); - viewRecord.setDeleteFlag(0); - viewRecord.setCreateBy(userName); - viewRecord.setUpdateBy(userName); - result = cmsContentViewMapper.insert(viewRecord); - } else { - // 检查是否超过5分钟 - Date fiveMinutesAgo = new Date(System.currentTimeMillis() - 5 * 60 * 1000); - if (existingView.getViewTime().before(fiveMinutesAgo)) { - // 更新查看时间 - existingView.setViewTime(new Date()); - existingView.setUpdateBy(userName); - result = cmsContentViewMapper.update(existingView); - } - // 5分钟内已查看过,不重复记录 - } - - // 更新Redis中的LoginUser对象 - if (result > 0) { - String token = loginUserCacheUtil.getTokenFromRequest(); - if (token != null) { - loginUserCacheUtil.updateHistory(token, userId); - } - } - - return result; - } catch (Exception e) { - // 未登录用户,不记录查看历史 - return 0; - } - } - - @Override - public PageInfo getPageListByUserHistory(CmsContentDto queryDto) { - // 获取当前登录用户ID - Long userId = Long.parseLong(StpUtil.getLoginId().toString()); - - // 添加参数校验,确保分页参数有效 - if (queryDto.getPageNum() == null || queryDto.getPageNum() < 1) { - queryDto.setPageNum(BaseQueryDto.DEFAULT_CURRENT_PAGE); - } - if (queryDto.getPageSize() == null || queryDto.getPageSize() < 1) { - queryDto.setPageSize(BaseQueryDto.DEFAULT_PAGE_SIZE); - } - - // 计算偏移量 - int offset = (queryDto.getPageNum() - 1) * queryDto.getPageSize(); - int limit = queryDto.getPageSize(); - - // 查询数据 - List list = this.cmsContentMapper.getPageListByUserHistory(userId, offset, limit); - int total = this.cmsContentMapper.getPageListByUserHistoryCount(userId); - - // 构建分页结果 - PageInfo pageInfo = new PageInfo<>(list); - pageInfo.setTotal(total); - pageInfo.setPageNum(queryDto.getPageNum()); - pageInfo.setPageSize(queryDto.getPageSize()); - pageInfo.setPages((total + limit - 1) / limit); - - return pageInfo; - } - - @Override - public PageInfo getPageListByUserFavorites(CmsContentDto queryDto) { - // 获取当前登录用户ID - Long userId = Long.parseLong(StpUtil.getLoginId().toString()); - - // 添加参数校验,确保分页参数有效 - if (queryDto.getPageNum() == null || queryDto.getPageNum() < 1) { - queryDto.setPageNum(BaseQueryDto.DEFAULT_CURRENT_PAGE); - } - if (queryDto.getPageSize() == null || queryDto.getPageSize() < 1) { - queryDto.setPageSize(BaseQueryDto.DEFAULT_PAGE_SIZE); - } - - // 计算偏移量 - int offset = (queryDto.getPageNum() - 1) * queryDto.getPageSize(); - int limit = queryDto.getPageSize(); - - // 查询数据 - List list = this.cmsContentMapper.getPageListByUserFavorites(userId, offset, limit); - int total = this.cmsContentMapper.getPageListByUserFavoritesCount(userId); - - // 构建分页结果 - PageInfo pageInfo = new PageInfo<>(list); - pageInfo.setTotal(total); - pageInfo.setPageNum(queryDto.getPageNum()); - pageInfo.setPageSize(queryDto.getPageSize()); - pageInfo.setPages((total + limit - 1) / limit); - - return pageInfo; - } - - @Override - public PageInfo getPageListByUserPurchases(CmsContentDto queryDto) { - // 获取当前登录用户ID - Long userId = Long.parseLong(StpUtil.getLoginId().toString()); - - // 添加参数校验,确保分页参数有效 - if (queryDto.getPageNum() == null || queryDto.getPageNum() < 1) { - queryDto.setPageNum(BaseQueryDto.DEFAULT_CURRENT_PAGE); - } - if (queryDto.getPageSize() == null || queryDto.getPageSize() < 1) { - queryDto.setPageSize(BaseQueryDto.DEFAULT_PAGE_SIZE); - } - - // 计算偏移量 - int offset = (queryDto.getPageNum() - 1) * queryDto.getPageSize(); - int limit = queryDto.getPageSize(); - - // 查询数据 - List list = this.cmsContentMapper.getPageListByUserPurchases(userId, offset, limit); - int total = this.cmsContentMapper.getPageListByUserPurchasesCount(userId); - - // 构建分页结果 - PageInfo pageInfo = new PageInfo<>(list); - pageInfo.setTotal(total); - pageInfo.setPageNum(queryDto.getPageNum()); - pageInfo.setPageSize(queryDto.getPageSize()); - pageInfo.setPages((total + limit - 1) / limit); - - return pageInfo; - } - - @Override - public PageInfo getPageListByUserCreated(CmsContentDto queryDto) { - // 获取当前登录用户ID - Long userId = Long.parseLong(StpUtil.getLoginId().toString()); - - // 添加参数校验,确保分页参数有效 - if (queryDto.getPageNum() == null || queryDto.getPageNum() < 1) { - queryDto.setPageNum(BaseQueryDto.DEFAULT_CURRENT_PAGE); - } - if (queryDto.getPageSize() == null || queryDto.getPageSize() < 1) { - queryDto.setPageSize(BaseQueryDto.DEFAULT_PAGE_SIZE); - } - - // 计算偏移量 - int offset = (queryDto.getPageNum() - 1) * queryDto.getPageSize(); - int limit = queryDto.getPageSize(); - - // 查询数据 - List list = this.cmsContentMapper.getPageListByUserCreated(userId, queryDto.getPublishStatus(), offset, limit); - int total = this.cmsContentMapper.getPageListByUserCreatedCount(userId, queryDto.getPublishStatus()); - - // 构建分页结果 - PageInfo pageInfo = new PageInfo<>(list); - pageInfo.setTotal(total); - pageInfo.setPageNum(queryDto.getPageNum()); - pageInfo.setPageSize(queryDto.getPageSize()); - pageInfo.setPages((total + limit - 1) / limit); - - return pageInfo; - } - - @Override - public int importFromExcel(byte[] fileBytes, String createBy) { - int successCount = 0; - final int BATCH_SIZE = 10; // 批量处理大小 - - try (InputStream inputStream = new ByteArrayInputStream(fileBytes); - ExcelReader reader = ExcelUtil.getReader(inputStream)) { - - // 获取总行数(包括标题行) - int totalRows = reader.getRowCount(); - if (totalRows <= 1) { - // 只有标题行或空文件 - return 0; - } - - Date now = new Date(); - List batchList = new ArrayList<>(BATCH_SIZE); - - // 读取标题行 - List headerObjList = reader.readRow(0); - if (headerObjList == null || headerObjList.isEmpty()) { - return 0; - } - // 转换为List - List headerList = new ArrayList<>(); - for (Object obj : headerObjList) { - headerList.add(obj != null ? obj.toString() : ""); - } - - // 从第二行开始读取数据(第一行为标题行) - for (int rowIndex = 1; rowIndex < totalRows; rowIndex++) { - try { - List rowList = reader.readRow(rowIndex); - if (rowList == null || rowList.isEmpty()) { - continue; - } - - // 转换为Map - Map row = new HashMap<>(); - - - - for (int i = 0; i < headerList.size() && i < rowList.size(); i++) { - row.put(headerList.get(i), rowList.get(i)); - } - if (row.isEmpty()) { - continue; - } - - // 打印映射后的数据 - System.out.println("映射后的数据:" + row); - - CmsContent cmsContent = new CmsContent(); - - // 设置创建时间和更新时间 - cmsContent.setCreateTime(now); - cmsContent.setUpdateTime(now); - cmsContent.setCreateBy(createBy); - cmsContent.setUpdateBy(createBy); - - // 设置默认值 - cmsContent.setDeleteFlag(0); - cmsContent.setAuditStatus(1); // 默认草稿状态 - cmsContent.setPublishStatus(1); // 默认未发布状态 - cmsContent.setViewCount(0); - cmsContent.setLikeCount(0); - cmsContent.setCommentCount(0); - cmsContent.setSort(0); - cmsContent.setIsOfficial(true); // 固定设置为1 - - // 读取Excel中的字段 - // content_id - 数据库自动生成,不需要读取 - cmsContent.setTitle(getStringValue(row, "title")); - cmsContent.setTitleEn(getStringValue(row, "title_en")); - cmsContent.setOrigin(getStringValue(row, "origin")); - - // 处理tags字段,避免NullPointerException - String tags = getStringValue(row, "tags"); - if (tags == null) { - System.err.println("第 " + rowIndex + " 行数据的tags字段为null,跳过该条记录"); - continue; - } - cmsContent.setTags(tags.replaceAll(" ","")); - - cmsContent.setIcon(getStringValue(row, "icon")); - cmsContent.setIsOfficial(true); // 固定设置为1 - cmsContent.setPrice(getBigDecimalValue(row, "price")); - cmsContent.setLikeCount(100 + new Random().nextInt(3000)); - cmsContent.setShareCount(100 + new Random().nextInt(1000)); - cmsContent.setContentType(getIntegerValue(row, "content_type")); - cmsContent.setContent(getStringValue(row, "content")); - cmsContent.setContentEn(getStringValue(row, "content_en")); - cmsContent.setAuditStatus(getIntegerValue(row, "audit_status")); - cmsContent.setPublishStatus(getIntegerValue(row, "publish_status")); - cmsContent.setPublishTime(now); // 设置为与update_time一致 - cmsContent.setViewCount(getIntegerValue(row, "view_count")); - cmsContent.setCommentCount(getIntegerValue(row, "comment_count")); - cmsContent.setIsPaid(getIntegerValue(row, "is_paid")); - cmsContent.setSupportPointsPay(getIntegerValue(row, "support_points_pay")); - cmsContent.setDescription(getStringValue(row, "description")); - cmsContent.setDescriptionEn(getStringValue(row, "description_en")); - cmsContent.setIntroduce(getStringValue(row, "introduce")); - cmsContent.setIntroduceEn(getStringValue(row, "introduce_en")); - // create_time - 由系统生成,不需要读取 - // update_time - 由系统生成,不需要读取 - cmsContent.setDeleteFlag(getIntegerValue(row, "delete_flag")); - - batchList.add(cmsContent); - - // 达到批量大小或最后一行时,执行批量插入 - if (batchList.size() >= BATCH_SIZE) { - if (!batchList.isEmpty()) { - // 执行批量插入 - this.cmsContentMapper.batchInsert(batchList); - successCount += batchList.size(); - batchList.clear(); // 清空批次 - } - } - } catch (Exception e) { - System.err.println("处理第 " + rowIndex + " 行数据时出错: " + e.getMessage()); - e.printStackTrace(); - // 跳过当前行,继续处理下一行 - continue; - } - } - - // 处理最后一批不足BATCH_SIZE的数据 - if (!batchList.isEmpty()) { - this.cmsContentMapper.batchInsert(batchList); - successCount += batchList.size(); - batchList.clear(); - } - } catch (Exception e) { - e.printStackTrace(); - } - - return successCount; - } - - /** - * 从Map中获取字符串值 - */ - private String getStringValue(Map row, String key) { - Object value = row.get(key); - return value != null ? value.toString() : null; - } - - /** - * 从Map中获取布尔值 - */ - private Boolean getBooleanValue(Map row, String key) { - Object value = row.get(key); - if (value == null) { - return null; - } - if (value instanceof Boolean) { - return (Boolean) value; - } - if (value instanceof String) { - return Boolean.parseBoolean((String) value); - } - return null; - } - - /** - * 从Map中获取整数值 - */ - private Integer getIntegerValue(Map row, String key) { - Object value = row.get(key); - if (value == null) { - return null; - } - if (value instanceof Number) { - return ((Number) value).intValue(); - } - if (value instanceof String) { - try { - return Integer.parseInt((String) value); - } catch (NumberFormatException e) { - return null; - } - } - return null; - } - - /** - * 从Map中获取BigDecimal值 - */ - private BigDecimal getBigDecimalValue(Map row, String key) { - Object value = row.get(key); - if (value == null) { - return null; - } - if (value instanceof Number) { - return BigDecimal.valueOf(((Number) value).doubleValue()); - } - if (value instanceof String) { - try { - return new BigDecimal((String) value); - } catch (NumberFormatException e) { - return null; - } - } - return null; - } - - /** - * 从Map中获取日期值 - */ - private Date getDateValue(Map row, String key) { - Object value = row.get(key); - if (value == null) { - return null; - } - if (value instanceof Date) { - return (Date) value; - } - return null; - } - - @Override - public String getContent(Long contentId, Integer languageType) { - Assert.notNull(contentId, "内容ID不能为空"); - CmsContent cmsContent = this.cmsContentMapper.queryById(contentId); - if (cmsContent == null) { - return null; - } - - // 当languageType为1时返回contentEn,否则返回content - if (languageType != null && languageType == 1) { - return cmsContent.getContentEn(); - } else { - return cmsContent.getContent(); - } - } - - @Override - public String getTitle(Long contentId) { - Assert.notNull(contentId, "内容ID不能为空"); - CmsContent cmsContent = this.cmsContentMapper.queryById(contentId); - if (cmsContent == null) { - return null; - } - return cmsContent.getTitle(); - } - - @Override - public int importFromPath(ImportPathDto importPathDto, String createBy) { - int totalSuccessCount = 0; - - try { - // 检查目录是否存在 - File directory = new File(importPathDto.getFilePath()); - if (!directory.exists() || !directory.isDirectory()) { - System.err.println("目录不存在或不是有效目录: " + importPathDto.getFilePath()); - return 0; - } - - // 如果不是追加模式,清空表 - if (!importPathDto.isAppend()) { - cmsContentMapper.truncateTable(); - } - - // 读取目录下所有 Excel 文件(排除 Office 临时锁定文件) - File[] files = directory.listFiles((dir, name) -> { - // 跳过以 ~$ 开头的临时锁定文件 - if (name.startsWith("~$")) { - return false; - } - return name.endsWith(".xls") || name.endsWith(".xlsx"); - }); - if (files == null || files.length == 0) { - return 0; - } - - // 记录文件总数 - int totalFiles = files.length; - System.out.println("总共发现 " + totalFiles + " 个 Excel 文件需要导入"); - - // 遍历所有 Excel 文件并导入 - for (int i = 0; i < files.length; i++) { - File file = files[i]; - System.out.println("当前处理第 " + (i + 1) + " 个文件,文件名称是:" + file.getName()); - try (FileInputStream fis = new FileInputStream(file)) { - // 读取文件内容到字节数组 - byte[] fileBytes = new byte[(int) file.length()]; - fis.read(fileBytes); - - // 调用现有的 importFromExcel 方法进行导入 - int successCount = importFromExcel(fileBytes, createBy); - totalSuccessCount += successCount; - System.out.println("第 " + (i + 1) + " 个文件导入成功,导入了 " + successCount + " 条记录"); - } catch (Exception e) { - System.err.println("导入文件失败: " + file.getAbsolutePath()); - e.printStackTrace(); - // 单个文件导入失败不影响其他文件 - continue; - } - } - System.out.println("导入完成,共处理 " + totalFiles + " 个文件,成功导入 " + totalSuccessCount + " 条记录"); - } catch (Exception e) { - System.err.println("导入操作失败: " + importPathDto.getFilePath()); - e.printStackTrace(); - } - - return totalSuccessCount; - } - - @Override - public int importFromZip(byte[] zipFileBytes, String createBy) { - int totalSuccessCount = 0; - int totalFiles = 0; - - try (ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(zipFileBytes))) { - ZipEntry entry; - - // 遍历ZIP文件中的所有条目 - while ((entry = zipInputStream.getNextEntry()) != null) { - String fileName = entry.getName(); - - // 跳过目录和非Excel文件 - if (entry.isDirectory() || (!fileName.endsWith(".xls") && !fileName.endsWith(".xlsx"))) { - zipInputStream.closeEntry(); - continue; - } - - // 跳过Office临时锁定文件 - String simpleName = new File(fileName).getName(); - if (simpleName.startsWith("~$")) { - zipInputStream.closeEntry(); - continue; - } - - totalFiles++; - System.out.println("当前处理第 " + totalFiles + " 个文件,文件名称是:" + fileName); - - try { - // 读取Excel文件内容到字节数组 - byte[] fileBytes = zipInputStream.readAllBytes(); - - // 调用现有的 importFromExcel 方法进行导入 - int successCount = importFromExcel(fileBytes, createBy); - totalSuccessCount += successCount; - System.out.println("第 " + totalFiles + " 个文件导入成功,导入了 " + successCount + " 条记录"); - } catch (Exception e) { - System.err.println("导入文件失败: " + fileName); - e.printStackTrace(); - // 单个文件导入失败不影响其他文件 - } finally { - zipInputStream.closeEntry(); - } - } - - System.out.println("导入完成,共处理 " + totalFiles + " 个文件,成功导入 " + totalSuccessCount + " 条记录"); - } catch (Exception e) { - System.err.println("ZIP文件导入操作失败"); - e.printStackTrace(); - } - - return totalSuccessCount; - } - - @Override - public int updateFromPath(ImportPathDto importPathDto, String updateBy) { - int totalSuccessCount = 0; - - try { - // 检查目录是否存在 - File directory = new File(importPathDto.getFilePath()); - if (!directory.exists() || !directory.isDirectory()) { - System.err.println("目录不存在或不是有效目录: " + importPathDto.getFilePath()); - return 0; - } - - // 读取目录下所有 Excel 文件(排除 Office 临时锁定文件) - File[] files = directory.listFiles((dir, name) -> { - // 跳过以 ~$ 开头的临时锁定文件 - if (name.startsWith("~$")) { - return false; - } - return name.endsWith(".xls") || name.endsWith(".xlsx"); - }); - if (files == null || files.length == 0) { - return 0; - } - - // 记录文件总数 - int totalFiles = files.length; - System.out.println("总共发现 " + totalFiles + " 个 Excel 文件需要处理"); - - // 遍历所有 Excel 文件并处理 - for (int i = 0; i < files.length; i++) { - File file = files[i]; - System.out.println("当前处理第 " + (i + 1) + " 个文件,文件名称是:" + file.getName()); - try (FileInputStream fis = new FileInputStream(file)) { - // 读取文件内容到字节数组 - byte[] fileBytes = new byte[(int) file.length()]; - fis.read(fileBytes); - - // 调用 updateFromExcel 方法进行更新 - int successCount = updateFromExcel(fileBytes, updateBy); - totalSuccessCount += successCount; - System.out.println("第 " + (i + 1) + " 个文件处理成功,更新了 " + successCount + " 条记录"); - } catch (Exception e) { - System.err.println("处理文件失败: " + file.getAbsolutePath()); - e.printStackTrace(); - // 单个文件处理失败不影响其他文件 - continue; - } - } - System.out.println("处理完成,共处理 " + totalFiles + " 个文件,成功更新 " + totalSuccessCount + " 条记录"); - } catch (Exception e) { - System.err.println("更新操作失败: " + importPathDto.getFilePath()); - e.printStackTrace(); - } - - return totalSuccessCount; - } - - /** - * 从Excel文件读取数据并更新CmsContent - * - * @param fileBytes Excel文件字节数组 - * @param updateBy 更新人 - * @return 成功更新的记录数 - */ - private int updateFromExcel(byte[] fileBytes, String updateBy) { - int successCount = 0; - - try (InputStream inputStream = new ByteArrayInputStream(fileBytes); - ExcelReader reader = ExcelUtil.getReader(inputStream)) { - - // 获取总行数(包括标题行) - int totalRows = reader.getRowCount(); - if (totalRows <= 1) { - // 只有标题行或空文件 - return 0; - } - - Date now = new Date(); - - // 读取标题行 - List headerObjList = reader.readRow(0); - if (headerObjList == null || headerObjList.isEmpty()) { - return 0; - } - // 转换为List - List headerList = new ArrayList<>(); - for (Object obj : headerObjList) { - headerList.add(obj != null ? obj.toString() : ""); - } - - // 从第二行开始读取数据(第一行为标题行) - for (int rowIndex = 1; rowIndex < totalRows; rowIndex++) { - try { - List rowList = reader.readRow(rowIndex); - if (rowList == null || rowList.isEmpty()) { - continue; - } - - // 转换为Map - Map row = new HashMap<>(); - for (int i = 0; i < headerList.size() && i < rowList.size(); i++) { - row.put(headerList.get(i), rowList.get(i)); - } - if (row.isEmpty()) { - continue; - } - - // 读取关键字段用于查询 - String title = getStringValue(row, "title"); - String origin = getStringValue(row, "origin"); - String tags = getStringValue(row, "tags"); - // 去掉tags中的空格 - if (tags != null) { - tags = tags.replaceAll(" ", ""); - } - String icon = getStringValue(row, "icon"); - - // 根据关键字段查询记录 - CmsContentDto queryDto = new CmsContentDto(); - queryDto.setTitle(title); - queryDto.setOrigin(origin); -// queryDto.setTags(tags); -// queryDto.setIcon(icon); - queryDto.setDeleteFlag(0); - - List existingList = cmsContentMapper.getList(queryDto); - if (existingList != null && !existingList.isEmpty()) { - // 找到匹配的记录,进行更新 - CmsContent existingContent = existingList.get(0); - - // 更新字段 - existingContent.setTitle(getStringValue(row, "title")); - existingContent.setTitleEn(getStringValue(row, "title_en")); - existingContent.setOrigin(getStringValue(row, "origin")); - existingContent.setTags(tags); - existingContent.setIcon(getStringValue(row, "icon")); - existingContent.setPrice(getBigDecimalValue(row, "price")); - existingContent.setContentType(getIntegerValue(row, "content_type")); - existingContent.setContent(getStringValue(row, "content")); - existingContent.setContentEn(getStringValue(row, "content_en")); - existingContent.setAuditStatus(getIntegerValue(row, "audit_status")); - existingContent.setPublishStatus(getIntegerValue(row, "publish_status")); - existingContent.setViewCount(getIntegerValue(row, "view_count")); - existingContent.setLikeCount(getIntegerValue(row, "like_count")); - existingContent.setCommentCount(getIntegerValue(row, "comment_count")); - existingContent.setIsPaid(getIntegerValue(row, "is_paid")); - existingContent.setSupportPointsPay(getIntegerValue(row, "support_points_pay")); - existingContent.setDescription(getStringValue(row, "description")); - existingContent.setDescriptionEn(getStringValue(row, "description_en")); - existingContent.setIntroduce(getStringValue(row, "introduce")); - existingContent.setIntroduceEn(getStringValue(row, "introduce_en")); - - // 设置更新时间和更新人 - existingContent.setUpdateTime(now); - existingContent.setUpdateBy(updateBy); - - // 执行更新 - cmsContentMapper.update(existingContent); - successCount++; - } - } catch (Exception e) { - System.err.println("处理第 " + rowIndex + " 行数据时出错: " + e.getMessage()); - e.printStackTrace(); - // 跳过当前行,继续处理下一行 - continue; - } - } - } catch (Exception e) { - e.printStackTrace(); - } - - return successCount; - } - - -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/service/impl/CmsTagServiceImpl.java b/src/main/java/com/kexue/skills/service/impl/CmsTagServiceImpl.java deleted file mode 100644 index 5d900e1..0000000 --- a/src/main/java/com/kexue/skills/service/impl/CmsTagServiceImpl.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.kexue.skills.service.impl; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.CmsTag; -import com.kexue.skills.entity.dto.CmsTagDto; -import com.kexue.skills.mapper.CmsTagMapper; -import com.kexue.skills.service.CmsTagService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.util.Date; -import java.util.List; - -/** - * (CmsTag)表服务实现类 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Service("cmsTagService") -@Transactional(rollbackFor = Exception.class) -public class CmsTagServiceImpl implements CmsTagService { - @Resource - private CmsTagMapper cmsTagMapper; - - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @Override - public PageInfo getPageList(CmsTagDto queryDto) { - PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize()); - List list = this.cmsTagMapper.getPageList(queryDto); - return new PageInfo<>(list); - } - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @Override - public List getList(CmsTagDto queryDto) { - return this.cmsTagMapper.getList(queryDto); - } - - /** - * 通过主键查询单条数据 - * - * @param tagId 主键 - * @return 实例对象 - */ - @Override - public CmsTag queryById(Long tagId) { - return this.cmsTagMapper.queryById(tagId); - } - - /** - * 新增数据 - * - * @param cmsTag 实例对象 - * @return 实例对象 - */ - @Override - public CmsTag insert(CmsTag cmsTag) { - // 设置创建时间和更新时间 - Date now = new Date(); - cmsTag.setCreateTime(now); - cmsTag.setUpdateTime(now); - // 设置默认值 - cmsTag.setDeleteFlag(0); - if (cmsTag.getStatus() == null) { - cmsTag.setStatus(1); - } - if (cmsTag.getUseCount() == null) { - cmsTag.setUseCount(0); - } - // 保存数据 - this.cmsTagMapper.insert(cmsTag); - return cmsTag; - } - - /** - * 更新数据 - * - * @param cmsTag 实例对象 - * @return 实例对象 - */ - @Override - public CmsTag update(CmsTag cmsTag) { - // 设置更新时间 - cmsTag.setUpdateTime(new Date()); - // 更新数据 - this.cmsTagMapper.update(cmsTag); - return this.queryById(cmsTag.getTagId()); - } - - /** - * 通过主键逻辑删除 - * - * @param tagId 主键 - * @param updateBy 更新人 - * @return 影响行数 - */ - @Override - public int logicDeleteById(Long tagId, String updateBy) { - return this.cmsTagMapper.logicDeleteById(tagId, updateBy); - } - - /** - * 通过主键物理删除 - * - * @param tagId 主键 - * @return 影响行数 - */ - @Override - public int deleteById(Long tagId) { - return this.cmsTagMapper.deleteById(tagId); - } - - /** - * 根据分类ID查询标签列表 - * - * @param categoryId 分类ID - * @return 标签列表 - */ - @Override - public List getTagsByCategoryId(Long categoryId) { - return this.cmsTagMapper.getTagsByCategoryId(categoryId); - } -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/service/impl/ContentPurchaseServiceImpl.java b/src/main/java/com/kexue/skills/service/impl/ContentPurchaseServiceImpl.java deleted file mode 100644 index af083b5..0000000 --- a/src/main/java/com/kexue/skills/service/impl/ContentPurchaseServiceImpl.java +++ /dev/null @@ -1,270 +0,0 @@ -package com.kexue.skills.service.impl; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.kexue.skills.common.LoginUserCacheUtil; -import com.kexue.skills.entity.CmsContent; -import com.kexue.skills.entity.ContentPurchase; -import com.kexue.skills.entity.dto.ContentPurchaseDto; -import com.kexue.skills.common.Assert; -import com.kexue.skills.exception.BizException; -import com.kexue.skills.mapper.ContentPurchaseMapper; -import com.kexue.skills.service.AccountService; -import com.kexue.skills.service.CmsContentService; -import com.kexue.skills.service.ContentPurchaseService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import cn.dev33.satoken.stp.StpUtil; - -/** - * (ContentPurchase)表服务实现类 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Service("contentPurchaseService") -@Transactional(rollbackFor = Exception.class) -public class ContentPurchaseServiceImpl implements ContentPurchaseService { - @Resource - private ContentPurchaseMapper contentPurchaseMapper; - - @Resource - private CmsContentService cmsContentService; - - @Resource - private AccountService accountService; - - @Resource - private LoginUserCacheUtil loginUserCacheUtil; - - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @Override - public PageInfo getPageList(ContentPurchaseDto queryDto) { - PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize()); - List list = this.contentPurchaseMapper.getPageList(queryDto); - return new PageInfo<>(list); - } - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @Override - public List getList(ContentPurchaseDto queryDto) { - return this.contentPurchaseMapper.getList(queryDto); - } - - /** - * 通过主键查询单条数据 - * - * @param purchaseId 主键 - * @return 实例对象 - */ - @Override - public ContentPurchase queryById(Long purchaseId) { - return this.contentPurchaseMapper.queryById(purchaseId); - } - - /** - * 通过用户ID和内容ID查询购买记录 - * - * @param userId 用户ID - * @param contentId 内容ID - * @return 实例对象 - */ - @Override - public ContentPurchase queryByUserIdAndContentId(Long userId, Long contentId) { - return this.contentPurchaseMapper.queryByUserIdAndContentId(userId, contentId); - } - - /** - * 新增数据 - * - * @param purchase 实例对象 - * @return 实例对象 - */ - @Override - public ContentPurchase insert(ContentPurchase purchase) { - // 设置创建时间和更新时间 - Date now = new Date(); - purchase.setCreateTime(now); - purchase.setUpdateTime(now); - // 设置默认值 - purchase.setDeleteFlag(0); - // 保存数据 - this.contentPurchaseMapper.insert(purchase); - return purchase; - } - - /** - * 更新数据 - * - * @param purchase 实例对象 - * @return 实例对象 - */ - @Override - public ContentPurchase update(ContentPurchase purchase) { - // 设置更新时间 - purchase.setUpdateTime(new Date()); - // 更新数据 - this.contentPurchaseMapper.update(purchase); - return this.queryById(purchase.getPurchaseId()); - } - - /** - * 更新购买状态 - * - * @param purchaseId 购买ID - * @param status 状态 - * @return 影响行数 - */ - @Override - public int updateStatus(Long purchaseId, Integer status) { - return this.contentPurchaseMapper.updateStatus(purchaseId, status); - } - - /** - * 通过主键逻辑删除 - * - * @param purchaseId 主键 - * @param updateBy 更新人 - * @return 影响行数 - */ - @Override - public int logicDeleteById(Long purchaseId, String updateBy) { - return this.contentPurchaseMapper.logicDeleteById(purchaseId, updateBy); - } - - /** - * 通过主键物理删除 - * - * @param purchaseId 主键 - * @return 影响行数 - */ - @Override - public int deleteById(Long purchaseId) { - return this.contentPurchaseMapper.deleteById(purchaseId); - } - - /** - * 购买内容 - * - * @param userId 用户ID - * @param contentId 内容ID - * @param payType 支付方式:1.余额支付 2.积分支付 3.微信支付 4.支付宝支付 - * @return 购买结果 - */ - @Override - public ContentPurchase purchaseContent(Long userId, Long contentId, Integer payType) { - // 1. 查询内容信息 - CmsContent content = this.cmsContentService.queryById(contentId); - Assert.notNull(content, "内容不存在"); - - // 2. 检查内容是否需要付费 - Assert.isTrue(content.getIsPaid() != 0, "该内容为免费内容,无需购买"); - - // 3. 检查用户是否已经购买过该内容 - ContentPurchase existingPurchase = this.queryByUserIdAndContentId(userId, contentId); - if (existingPurchase != null && existingPurchase.getStatus() == 2) { - // 已经购买过,直接返回 - return existingPurchase; - } - - // 4. 创建购买记录 - ContentPurchase purchase = new ContentPurchase(); - purchase.setUserId(userId); - purchase.setContentId(contentId); - purchase.setContentTitle(content.getTitle()); - purchase.setPayType(payType); - purchase.setStatus(1); // 待支付 - purchase.setCreateTime(new Date()); - purchase.setUpdateTime(new Date()); - purchase.setDeleteFlag(0); - - // 5. 根据支付方式处理支付 - String transactionNo = UUID.randomUUID().toString().replaceAll("-", ""); - boolean isPaid = false; - if (payType == 1) { - // 余额支付 - BigDecimal price = content.getPrice(); - purchase.setAmount(price); - purchase.setPoints(0); - - // 扣除用户余额 - this.accountService.reduceBalance(userId, price, transactionNo, contentId, "purchase_content", "购买内容:" + content.getTitle()); - - // 6. 更新购买记录状态 - purchase.setStatus(2); // 已支付 - purchase.setPurchaseTime(new Date()); - this.insert(purchase); - isPaid = true; - } else if (payType == 3 || payType == 4) { - // 微信支付或支付宝支付 - // 这里只创建购买记录,实际支付由前端调用支付接口完成 - // 支付完成后通过回调更新购买记录状态 - BigDecimal price = content.getPrice(); - purchase.setAmount(price); - purchase.setPoints(0); - - // 插入购买记录(状态为待支付) - this.insert(purchase); - } else { - Assert.isTrue(false, "不支持的支付方式"); - } - - // 更新Redis中的LoginUser对象 - if (isPaid) { - String token = loginUserCacheUtil.getTokenFromRequest(); - if (token != null) { - loginUserCacheUtil.updateHas(token, userId); - } - } - - return purchase; - } - - /** - * 检查用户是否有权限访问内容 - * - * @param userId 用户ID - * @param contentId 内容ID - * @return 是否有权限 - */ - @Override - public boolean checkAccessPermission(Long userId, Long contentId) { - // 1. 查询内容信息 - CmsContent content = this.cmsContentService.queryById(contentId); - if (content == null) { - return false; - } - - // 2. 如果是免费内容,直接允许访问 - if (content.getIsPaid() == 0) { - return true; - } - - // 3. 如果是付费内容,检查用户是否购买过 - ContentPurchase purchase = this.queryByUserIdAndContentId(userId, contentId); - if (purchase != null && purchase.getStatus() == 2) { - // 已经购买过,允许访问 - return true; - } - - // 4. 未购买,不允许访问 - return false; - } -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/service/impl/SkillGenServiceImpl.java b/src/main/java/com/kexue/skills/service/impl/SkillGenServiceImpl.java deleted file mode 100644 index 58ec230..0000000 --- a/src/main/java/com/kexue/skills/service/impl/SkillGenServiceImpl.java +++ /dev/null @@ -1,756 +0,0 @@ -package com.kexue.skills.service.impl; - -import cn.dev33.satoken.stp.StpUtil; -import cn.hutool.core.collection.CollectionUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.kexue.skills.common.Assert; -import com.kexue.skills.common.util.HttpUtil; -import com.kexue.skills.config.DeepSeekConfig; -import com.kexue.skills.config.GlmConfig; -import com.kexue.skills.entity.CmsContent; -import com.kexue.skills.entity.CmsTag; -import com.kexue.skills.entity.dto.CmsTagDto; -import com.kexue.skills.entity.request.SkillAnalyzeRequest; -import com.kexue.skills.entity.request.SkillGenRequest; -import com.kexue.skills.entity.request.SkillPreGenRequest; -import com.kexue.skills.entity.request.SkillRequest; -import com.kexue.skills.entity.response.SkillResponse; -import com.kexue.skills.exception.BizException; -import com.kexue.skills.mapper.CmsContentMapper; -import com.kexue.skills.service.CmsTagService; -import com.kexue.skills.service.SkillGenService; -import com.kexue.skills.utils.EscapeCharacterUtils; -import com.kexue.skills.utils.YamlToMapUtil; -import jodd.util.StringUtil; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.yaml.snakeyaml.error.YAMLException; - -import javax.annotation.Resource; -import java.io.File; -import java.io.FileOutputStream; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.*; -import java.util.stream.Collectors; - -/** - * 技能生成服务实现 - * - * @author 维哥 - * @since 2026-01-28 - */ -@Slf4j -@Service -public class SkillGenServiceImpl implements SkillGenService { - - @Autowired - private DeepSeekConfig deepSeekConfig; - - @Autowired - private GlmConfig glmConfig; - - @Autowired - private CmsTagService cmsTagService; - - @Resource - private CmsContentMapper cmsContentMapper; - - /** - * 生成技能 - * - * @param request 生成请求 - * @return 生成结果 - */ - @Override - public SkillResponse preGenerate(SkillPreGenRequest request) { - log.info("生成技能请求: {}", request); - String url = deepSeekConfig.getBaseUrl() + "/v1/chat/completions"; - - // 从数据库中读取cms_tag表的标签信息 - CmsTagDto tagDto = new CmsTagDto(); - tagDto.setDeleteFlag(0); - tagDto.setStatus(1); - List tags = cmsTagService.getList(tagDto); - - // 将标签名称拼接成逗号分隔的字符串 - StringBuilder tagsList = new StringBuilder(); - for (int i = 0; i < tags.size(); i++) { - CmsTag tag = tags.get(i); - tagsList.append(tag.getTagId()+"."+tag.getTagName()); - if (i < tags.size() - 1) { - tagsList.append(","); - } - } - - SkillRequest skillRequest = new SkillRequest(true, deepSeekConfig.getChat().getModel(), - deepSeekConfig.getChat().getTemperature(), deepSeekConfig.getChat().getMaxTokens(), - request.getPrompt(), tagsList.toString()); - - String deepseekResponse = ""; - try { - // 发送HTTP请求到deepseek API - deepseekResponse = HttpUtil.sendPostRequest(url, skillRequest, deepSeekConfig.getApiKey(), null); - log.info("Deepseek API响应: {}", deepseekResponse); - - // 解析deepseek返回结果 - JSONObject responseJson = JSON.parseObject(deepseekResponse); - List choices = responseJson.getJSONArray("choices").toJavaList(JSONObject.class); - - if (choices != null && !choices.isEmpty()) { - // 获取最新的choice(这里是第一个,因为只有一个) - JSONObject latestChoice = choices.get(0); - JSONObject message = latestChoice.getJSONObject("message"); - String content = message.getString("content"); - - // 解析content中的JSON - JSONObject skillJson = JSON.parseObject(content); - SkillResponse skillResponse = new SkillResponse(); - skillResponse.setName(skillJson.getString("name")); - skillResponse.setDescription(skillJson.getString("description")); - skillResponse.setTags(skillJson.getJSONArray("tags").toJavaList(String.class)); - - log.info("解析技能响应: {}", skillResponse); - return skillResponse; - } - } catch (Exception e) { - log.error("调用Deepseek API失败: {}", e.getMessage(), e); - throw new BizException("调用Deepseek API失败:"+ e.getMessage()+" Deepseek API响应:"+ deepseekResponse); - } - - return null; - } - - @Override - public SkillResponse preGenerateV2(SkillPreGenRequest request) { - log.info("生成技能请求V2: {}", request); - String url = glmConfig.getBaseUrl() + "/chat/completions"; - String apiKey = glmConfig.getApiKey(); - String model = glmConfig.getChat().getModel(); - double temperature = glmConfig.getChat().getTemperature(); - int maxTokens = glmConfig.getChat().getMaxTokens(); - - // 从数据库中读取cms_tag表的标签信息 - CmsTagDto tagDto = new CmsTagDto(); - tagDto.setDeleteFlag(0); - tagDto.setStatus(1); - List tags = cmsTagService.getList(tagDto); - - // 将标签名称拼接成逗号分隔的字符串 - StringBuilder tagsList = new StringBuilder(); - for (int i = 0; i < tags.size(); i++) { - CmsTag tag = tags.get(i); - tagsList.append(tag.getTagId()+"."+tag.getTagName()); - if (i < tags.size() - 1) { - tagsList.append(","); - } - } - - // 构建系统消息内容 - String systemContent = "你是一个专业的AI技能设计助手。请根据agent skills撰写规范,按照用户提出的主题描述及参考文件,生成这个skill的名称、描述,并从以下标签列表中选择至少3个标签:\"" + tagsList.toString() + "\",tags只需要返回序号数组,并简述这个skill的具体价值点。输出json格式,仅输出以上所提到的名称、描述、标签、价值点,节点名称分别为name、description、tags、value_point,节点内容以中文形式返回。请严格按照指定的JSON格式输出,仅包含要求的字段,以中文形式返回。"; - - // 准备文件URL列表 - List fileUrls = new ArrayList<>(); - if (request.getFileUrl() != null && !request.getFileUrl().isEmpty()) { - fileUrls.add(request.getFileUrl()); - } - if (request.getFileUrls() != null && !request.getFileUrls().isEmpty()) { - fileUrls.addAll(request.getFileUrls()); - } - - // 创建技能请求 - SkillRequest skillRequest = new SkillRequest(model, systemContent, request.getPrompt(), fileUrls, temperature, maxTokens); - - String response = ""; - try { - // 发送HTTP请求到API - response = HttpUtil.sendPostRequest(url, skillRequest, apiKey, null); - log.info("API响应: {}", response); - - // 解析返回结果 - JSONObject responseJson = JSON.parseObject(response); - List choices = responseJson.getJSONArray("choices").toJavaList(JSONObject.class); - - if (choices != null && !choices.isEmpty()) { - // 获取最新的choice(这里是第一个,因为只有一个) - JSONObject latestChoice = choices.get(0); - JSONObject message = latestChoice.getJSONObject("message"); - String content = message.getString("content"); - - // 解析content中的JSON - JSONObject skillJson = JSON.parseObject(content); - SkillResponse skillResponse = new SkillResponse(); - skillResponse.setName(skillJson.getString("name")); - skillResponse.setDescription(skillJson.getString("description")); - skillResponse.setTags(skillJson.getJSONArray("tags").toJavaList(String.class)); - skillResponse.setSummary(skillJson.getString("value_point")); - - log.info("解析技能响应: {}", skillResponse); - return skillResponse; - } - } catch (Exception e) { - log.error("调用API失败: {}", e.getMessage(), e); - throw new BizException("调用Deepseek API失败:"+ e.getMessage()+" Deepseek API响应:"+ response); - } - return null; - } - - @Override - public CmsContent generate(SkillGenRequest request) { - log.info("生成技能请求: {}", request); - // 参数验证,确保每个参数都必须传递 - Assert.notEmpty(request.getName(), "技能名称不能为空"); - Assert.notEmpty(request.getDescription(), "技能描述不能为空"); - Assert.notEmpty(request.getTags(), "技能标签不能为空"); - Assert.notEmpty(request.getRequirement(), "技能摘要不能为空"); - String url = deepSeekConfig.getBaseUrl() + "/v1/chat/completions"; - - // 从数据库中读取cms_tag表的标签信息 - CmsTagDto tagDto = new CmsTagDto(); - tagDto.setDeleteFlag(0); - tagDto.setStatus(1); - List tags = cmsTagService.getList(tagDto); - - List tags1 = request.getTags(); - - // 将标签名称拼接成逗号分隔的字符串 - StringBuilder tagsList = new StringBuilder(); - String defaultIcon = ""; - for (int i = 0; i < tags.size(); i++) { - CmsTag tag = tags.get(i); - if (tags1.contains(tag.getTagId()+"")) { - if (StringUtil.isEmpty(defaultIcon)){ - defaultIcon = tag.getIcon(); - } - tagsList.append(tag.getTagName()); - if (i < tags.size() - 1) { - tagsList.append(","); - } - } - } - String systemContent = """ - 你是AI技能包设计专家,仅输出【完整的纯YAML文本】,输出内容是完整可解析的技能YAML描述文件,绝非片段,不包含任何多余文字(无解释、无注释、无引言、无结尾)。 - - ### 一、YAML顶层强制规则(仅一个节点:package) - 1. 顶层只能有 package 一个节点,所有信息(名称、版本、目录结构等)均嵌套在 package 下 - 2. package 节点必含子字段:name、version、description、author、created、tags、structure(缺一不可) - 3. 最终必须输出完整闭合的YAML结构,禁止输出残缺片段、部分节点 - - ### 二、package子字段规范(固定格式) - 1. name:技能名称(与用户提供的Skill名称完全一致,不修改) - 2. version:固定为 "1.0.0" - 3. description:用户提供的Skill描述(完整复制,不增删任何内容) - 4. author:固定为 "AI技能生成助手" - 5. created:格式为 "YYYY-MM-DD"(使用当前日期,如2026-04-01) - 6. tags:数组格式,值为用户提供的Skill标签(中文,自动去重,逗号后加空格) - 7. structure:技能包目录树,根目录固定为 /,structure下直接编写根目录的一级子文件/子文件夹,禁止重复描述根目录本身 - - ### 三、structure目录树规则(仅Python脚本,无其他语言) - #### 1. 基础必含文件(所有技能通用) - - 根目录 / 下必生成:skills.md 文件,归属父路径 /,文件必须保留后缀名 .md - - #### 2. structure核心编写规则 - 1. structure节点下不写根目录/的描述,直接从一级子文件/子文件夹开始编写 - 2. 【path路径强制规则】path只写父级目录路径,不拼接文件名称/目录名称 - - 目录自身名称使用 name 字段体现,目录一律无后缀名 - - 文件自身名称使用 name 字段体现,文件必须保留标准后缀名 - - 示例:scripts目录在根目录下 → path: /,name: scripts - - 示例:skills.md在根目录下 → path: /,name: skills.md - - 示例:main.py在scripts目录下 → path: /scripts,name: main.py - 3. 所有directory/file节点均为根目录/的直接/间接子节点 - - #### 3. Python脚本目录/文件判断逻辑 - - 若用户提供的“Skill描述”“Skill摘要”中包含“脚本”“代码”“执行”“运行”“处理”“计算”等需执行逻辑的关键词: - 1. 必须新增 scripts 目录,该目录为文件夹,无任何后缀名,path: /,name: scripts - 2. 必须在该目录下固定生成 main.py 文件,文件必须带 .py 后缀,不允许省略或修改文件名 - - 若用户需求中无任何执行逻辑相关描述(如纯文档、纯说明类技能):不生成 scripts 目录,避免冗余 - - #### 4. 节点必含字段 - - directory类型:name、type、path(仅父级路径)、format(固定"dir")、description、children(空目录写 children: []) - - file类型:name、type、path(仅父级路径)、format(仅markdown/python两种)、description、content(非空,有实际可用内容) - - ### 四、文件content内容规范(Python脚本必实用) - #### 1. 根目录下 skills.md - - # 技能名称(不加多余符号,居中可加空格但不强制) - - ## 技能描述(整合用户“描述+摘要”,补充逻辑连贯性) - - ## 标签(格式:- 标签1\n- 标签2) - - ## 使用说明(分点写:适用场景、操作步骤,需脚本则写“运行scripts/main.py脚本”,无需则写“直接参考文档使用”) - - ## 目录结构(用代码块 ``` 列出所有文件/目录路径) - - #### 2. scripts目录下 main.py - - 必含依赖导入(如 import pandas as pd,无依赖则不写) - - 必含入口函数 def execute(params: dict) -> dict:(参数为dict,返回dict结果) - - 函数内必含: - 1. 参数校验(判断必填键是否存在,缺失返回错误) - 2. 核心逻辑(匹配技能需求,如数据处理、文本分析) - 3. 结果返回(成功:{"status": "success", "data": 结果};失败:{"status": "fail", "error": 信息}) - - 必含注释:函数说明、参数/返回值说明、示例调用(if __name__ == "__main__": 块) - - 禁止空函数、语法错误,确保复制后可直接运行 - - ### 五、YAML语法死规定(100%无解析错误) - 1. 缩进:统一2个空格(禁止Tab,禁止1/3/4空格,嵌套层级严格对齐) - - package 下子字段缩进2空格 - - structure 下目录/文件节点缩进4空格(package→structure→children,每层+2空格) - 2. 路径:全部遵循path只写父目录规则,Unix风格 /,禁止 \\ 或 ./ - 3. 字符串:特殊字符(:、#、空格)无需转义,直接书写 - 4. 数组:tags格式严格为 tags: [标签1, 标签2](逗号后加空格,无多余逗号) - 5. content:多行内容用 | 开头,内容行首顶格,内部遵循对应格式缩进(Python用4空格) - - ### 六、错误规避红线(绝对不能触碰) - 1. 禁止顶层出现除 package 外的任何节点 - 2. 禁止在YAML前后加任何多余文字 - 3. 禁止生成非Python脚本,禁止生成无后缀的脚本文件 - 4. 禁止字段缺失 - 5. 禁止输出YAML片段,必须输出完整可解析文件 - 6. structure禁止描述根目录/,直接从一级子节点开始 - 7. 严禁path中携带文件/目录名称,必须只写父级路径 - 8. 严禁将scripts目录错误添加后缀名,严禁修改Python脚本名为非main.py - - 最终输出仅完整纯YAML,直接可复制存储、解析使用,无任何冗余或格式问题! - """; - - String userContent = """ - 基于以下信息生成技能包YAML,严格遵守system指令(仅Python脚本,无其他语言): - 1. Skill名称:%s - 2. Skill描述:%s - 3. Skill标签:%s(中文,直接使用,不修改) - 4. Skill摘要/需求:%s(用于完善skills.md的“使用说明”章节) - """.formatted( - request.getName(), - request.getDescription(), - tagsList.toString(), - request.getRequirement() - ); - SkillRequest skillRequest = new SkillRequest(true, deepSeekConfig.getChat().getModel(),systemContent,userContent,deepSeekConfig.getChat().getTemperature(), 8192,"text"); - String deepseekResponse = ""; - try { - // 发送HTTP请求到deepseek API - deepseekResponse = HttpUtil.sendPostRequest(url, skillRequest, deepSeekConfig.getApiKey(), null); - log.info("Deepseek API响应: {}", deepseekResponse); - JSONObject responseJson = JSON.parseObject(deepseekResponse); - String content = responseJson.getJSONArray("choices").toJavaList(JSONObject.class).get(0).getJSONObject("message").getString("content"); - content = EscapeCharacterUtils.removeEscapeCharacters( content);//去除转义字符 - CmsContent cmsContent = getCmsContent(request, content, StpUtil.getLoginIdAsLong(),defaultIcon); - List list = tags.stream().filter(tag -> tag.getTagId() == Long.parseLong(cmsContent.getTags().split(",")[0])).toList(); - if (CollectionUtil.isNotEmpty( list)){ - cmsContent.setIcon(list.get(0).getIcon()); - } - // 保存到数据库 - cmsContentMapper.insert(cmsContent); - return cmsContent; - } catch (Exception e) { - log.error("调用Deepseek API失败: {}", e.getMessage(), e); - throw new BizException("调用Deepseek API失败:"+ e.getMessage()+" Deepseek API响应:"+ deepseekResponse); - } - } - - private CmsContent getCmsContent(SkillGenRequest request, String CmsContent,Long userId,String defaultIcon){ - CmsContent cmsContent = new CmsContent(); - cmsContent.setTitle(request.getName()); - cmsContent.setDescription(request.getDescription()); - cmsContent.setContent(CmsContent); - cmsContent.setTags(request.getTags().stream().map(String::valueOf).collect(Collectors.joining(","))); - cmsContent.setIsPaid(0);//免费 - cmsContent.setIsOfficial(false); - cmsContent.setPublishStatus(1); - cmsContent.setAuthorId(userId); - cmsContent.setAuthorName(null); - cmsContent.setAuditStatus(1); - cmsContent.setViewCount(0); - cmsContent.setCommentCount(0); - cmsContent.setRequiredPoints(0); - cmsContent.setSupportPointsPay(0); - cmsContent.setPrice(new BigDecimal(0)); - cmsContent.setLikeCount(0); - cmsContent.setShareCount(0); - cmsContent.setCreateTime(new Date()); - cmsContent.setUpdateTime(new Date()); - cmsContent.setContentType(1); - cmsContent.setCreateBy(userId+""); - cmsContent.setUpdateBy(userId+""); - cmsContent.setDeleteFlag(0); - cmsContent.setIcon(defaultIcon); - cmsContent.setRequirement(request.getRequirement()); - cmsContent.setIntroduce(request.getIntroduce()); - return cmsContent; - } - - - /** - * 分析技能 - * - * @param request 分析请求 - * @return 分析结果 - */ - @Override - public String analyzeSkill(SkillAnalyzeRequest request) { - log.info("分析技能请求: {}", request); - // 这里可以实现技能分析逻辑 - // 不需要数据库操作,直接返回结果 - return "技能分析成功: " + request.getSkillId(); - } - - @Override - public String genIntroduce(String content) { - log.info("生成技能介绍请求: {}", content); - String url = deepSeekConfig.getBaseUrl() + "/v1/chat/completions"; - - String systemContent = "你是一个专业的AI技能设计助手。我会给你提供一个完整的skill的内容,请你帮我总结出skill的作用,能够解决的问题,输出一段描述文本"; - SkillRequest skillRequest = new SkillRequest(true, deepSeekConfig.getChat().getModel(), systemContent, content, 0.3, 500, "text"); - String deepseekResponse = ""; - try { - // 发送HTTP请求到deepseek API - deepseekResponse = HttpUtil.sendPostRequest(url, skillRequest, deepSeekConfig.getApiKey(), null); - log.info("Deepseek API响应: {}", deepseekResponse); - - // 解析返回结果 - JSONObject responseJson = JSON.parseObject(deepseekResponse); - List choices = responseJson.getJSONArray("choices").toJavaList(JSONObject.class); - - if (choices != null && !choices.isEmpty()) { - JSONObject latestChoice = choices.get(0); - JSONObject message = latestChoice.getJSONObject("message"); - return EscapeCharacterUtils.removeEscapeCharacters( message.getString("content"));//去除转义字符 - } - } catch (Exception e) { - log.error("调用Deepseek API失败: {}", e.getMessage(), e); - throw new BizException("调用Deepseek API失败:"+ e.getMessage()+" Deepseek API响应:"+ deepseekResponse); - } - - return null; - } - - @Override - public String genIntroduceByDescription(String description) { - log.info("根据技能描述生成技能介绍请求: {}", description); - String url = deepSeekConfig.getBaseUrl() + "/v1/chat/completions"; - - String systemContent = "你是一个专业的AI技能设计助手。我会给你提供一个skill的描述,请你基于这个描述,生成一段详细的技能介绍,包括技能的作用、能够解决的问题、使用场景等,输出一段完整的描述文本"; - SkillRequest skillRequest = new SkillRequest(true, deepSeekConfig.getChat().getModel(), systemContent, description, 0.3, 500, "text"); - String deepseekResponse = ""; - try { - // 发送HTTP请求到deepseek API - deepseekResponse = HttpUtil.sendPostRequest(url, skillRequest, deepSeekConfig.getApiKey(), null); - log.info("Deepseek API响应: {}", deepseekResponse); - - // 解析返回结果 - JSONObject responseJson = JSON.parseObject(deepseekResponse); - List choices = responseJson.getJSONArray("choices").toJavaList(JSONObject.class); - - if (choices != null && !choices.isEmpty()) { - JSONObject latestChoice = choices.get(0); - JSONObject message = latestChoice.getJSONObject("message"); - return EscapeCharacterUtils.removeEscapeCharacters( message.getString("content"));//去除转义字符 - } - } catch (Exception e) { - log.error("调用Deepseek API失败: {}", e.getMessage(), e); - throw new BizException("调用Deepseek API失败:"+ e.getMessage()+" Deepseek API响应:"+ deepseekResponse); - } - - return null; - } - - @Override - public CmsContent uploadSkill(String skillUrl) { - log.info("上传技能压缩包请求: {}", skillUrl); - String url = deepSeekConfig.getBaseUrl() + "/v1/chat/completions"; - - // 从数据库中读取cms_tag表的标签信息 - CmsTagDto tagDto = new CmsTagDto(); - tagDto.setDeleteFlag(0); - tagDto.setStatus(1); - List tags = cmsTagService.getList(tagDto); - - // 将标签名称拼接成逗号分隔的字符串 - StringBuilder tagsList = new StringBuilder(); - for (int i = 0; i < tags.size(); i++) { - CmsTag tag = tags.get(i); - tagsList.append(tag.getTagId()+"."+tag.getTagName()); - if (i < tags.size() - 1) { - tagsList.append(","); - } - } - - // 构建系统消息内容 - String systemContent = """ - 你是一位专业的AI技能包解析助手,需完成以下任务: - 1. 我会提供一个技能包压缩包(格式包含zip/rar)的URL,你需解析该压缩包根目录下的SKILL.md文件; 或者提供一个在线的SKILL.md文件的url; - 2. 基于SKILL.md内容,提炼出: - - skill的核心标题(name); - - skill的核心描述(description); - - 详细功能介绍(introduce); - - 从指定标签列表中选取至少3个适配标签(tagList),标签范围:TAG_LIST; - - 选择标签的时候只需要输出对应的标签编号 - 3. 生成content字段:基于技能包的名称、描述、标签,按照skills目录结构输出完整的技能包YAML内容(包含skills.md本体、scripts目录脚本等),需遵循以下严格规范: - - 包含技能包必需的文件和目录; - - 多行内容使用「|」字面块表示; - - 所有内容从行首开始,无前置空格; - - 空目录标注为「children: []」; - - 文件内容需具备实际使用价值; - - YAML文档需完整,核心概要包含name、version、description、author、created、tags等属性; - - 核心节点为structure,用于描述技能包文件目录结构;structure下每个节点需包含基础属性:name、type、path、format、description;content和children为互选属性(type为file时,content字段填写文件内容;type为directory时,children数组填写子目录/文件节点)。 - 请将最终结果以JSON格式输出,JSON结构必须包含:name(技能名称),description(技能描述)、introduce(功能介绍)、tagList(标签列表)、content(完整YAML格式技能包内容),无需额外说明,仅输出符合要求的JSON内容。 - """; - systemContent = systemContent.replace("TAG_LIST", tagsList.toString()); - - // 构建用户消息内容 - String userContent = skillUrl; - - // 创建技能请求 - SkillRequest skillRequest = new SkillRequest(true, deepSeekConfig.getChat().getModel(), systemContent, userContent, 0.5, 8192, "json_object"); - - String deepseekResponse = ""; - try { - // 发送HTTP请求到DeepSeek API - deepseekResponse = HttpUtil.sendPostRequest(url, skillRequest, deepSeekConfig.getApiKey(), null); - log.info("Deepseek API响应: {}", deepseekResponse); - - // 解析返回结果 - JSONObject responseJson = JSON.parseObject(deepseekResponse); - List choices = responseJson.getJSONArray("choices").toJavaList(JSONObject.class); - - if (choices != null && !choices.isEmpty()) { - // 获取最新的choice - JSONObject latestChoice = choices.get(0); - JSONObject message = latestChoice.getJSONObject("message"); - String content = message.getString("content"); - - // 解析content中的JSON - JSONObject skillJson = JSON.parseObject(content); - - // 构建技能生成请求 - SkillGenRequest request = new SkillGenRequest(); - request.setName(skillJson.getString("name")); - request.setDescription(skillJson.getString("description")); - request.setIntroduce(skillJson.getString("introduce")); - request.setTags(skillJson.getJSONArray("tagList").toJavaList(String.class)); - - // 生成CmsContent对象 - CmsContent cmsContent = getCmsContent(request, skillJson.getString("content"), StpUtil.getLoginIdAsLong(), ""); - List list = tags.stream().filter(tag -> tag.getTagId() == Long.parseLong(cmsContent.getTags().split(",")[0])).toList(); - if (CollectionUtil.isNotEmpty( list)){ - cmsContent.setIcon(list.get(0).getIcon()); - } - // 保存到数据库 - // cmsContentMapper.insert(cmsContent); - return cmsContent; - } - } catch (Exception e) { - log.error("调用Deepseek API失败: {}", e.getMessage(), e); - throw new BizException("调用Deepseek API失败:"+ e.getMessage()+" Deepseek API响应:"+ deepseekResponse); - } - - return null; - } - - @Override - public CmsContent uploadSkillV2(byte[] fileBytes, String fileName) { - log.info("上传本地技能压缩包请求: {}", fileName); - - try { - // 创建临时文件 - String fileExtension = ""; - if (fileName.contains(".")) { - int dotIndex = fileName.lastIndexOf("."); - if (dotIndex != -1) { - fileExtension = fileName.substring(dotIndex); - } - } - File tempFile = File.createTempFile("skill", fileExtension); - try (FileOutputStream fos = new FileOutputStream(tempFile)) { - fos.write(fileBytes); - } - - // 生成默认参数 - String author = StpUtil.getLoginIdAsString(); - // 从文件名中提取技能名称 - String defaultSkillName = fileName; - if (fileName.contains(".")) { - int dotIndex = fileName.lastIndexOf("."); - if (dotIndex != -1) { - defaultSkillName = fileName.substring(0, dotIndex); - } - } - - // 1. 提取压缩包中的skillMdText - Map skillInfo = com.kexue.skills.common.util.SkillZipParser.extractSkillMdText(tempFile.getAbsolutePath(), defaultSkillName); - String skillMdText = (String) skillInfo.get("skillMdText"); - - // 从数据库中读取cms_tag表的标签信息 - CmsTagDto tagDto = new CmsTagDto(); - tagDto.setDeleteFlag(0); - tagDto.setStatus(1); - List tags = cmsTagService.getList(tagDto); - - // 2. 解析skillMdText获取SkillGenRequest - SkillGenRequest request = null; - if (skillMdText != null && !skillMdText.isEmpty()) { - request = parseSkillMdText(skillMdText, tags); - } else { - // 如果没有找到md文件,使用默认值 - request = new SkillGenRequest(); - request.setName(defaultSkillName); - request.setDescription("未知"); - request.setIntroduce("未知"); - request.setTags(Arrays.asList("1001", "1000")); - } - - // 3. 使用SkillGenRequest中的信息生成yaml - String yamlContent = com.kexue.skills.common.util.SkillZipParser.generateYamlFromSkillInfo( - tempFile.getAbsolutePath(), - author, - request.getName(), - request.getDescription(), - request.getTags() - ); - log.info("解析出skill 压缩包内容:{}", yamlContent); - - // 4. 生成CmsContent对象 - CmsContent cmsContent = getCmsContent(request, yamlContent, StpUtil.getLoginIdAsLong(), ""); - if (Objects.nonNull(cmsContent.getTags())) { - String s = cmsContent.getTags().split(",")[0]; - long l = 1000;// 默认值 - try { - l = Long.parseLong(s); - } catch (NumberFormatException e) { - // 异常是因为大模型返回的tag带中文了,忽略 - } - long finalL = l; - List list = tags.stream().filter(tag -> tag.getTagId() == finalL).toList(); - if (CollectionUtil.isNotEmpty(list)){ - cmsContent.setIcon(list.get(0).getIcon()); - } - } - // 保存到数据库 - // cmsContentMapper.insert(cmsContent); - // 删除临时文件 - tempFile.delete(); - - return cmsContent; - } catch (Exception e) { - log.error("上传本地技能压缩包失败: {}", e.getMessage(), e); - throw new BizException("上传本地技能压缩包失败:" + e.getMessage()); - } - } - - @Override - public CmsContent uploadSkillV3(String yamlContent) { - log.info("uploadSkillV3 上传技能压缩包请求: {}", yamlContent); - try { - Map yamlMap = YamlToMapUtil.yamlTextToMap(yamlContent); - - Map packageMap = (Map)yamlMap.get("package"); - String skillName = (String) packageMap.get("name"); - String skillDescription = (String) packageMap.get("description"); - List tagList = (List) packageMap.get("tags"); - List tagsStrList = tagList.stream().map(String::valueOf).toList(); - String skillIcon = getDefaultIcon(tagsStrList.get(0)); - SkillGenRequest request = new SkillGenRequest(); - request.setName(skillName); - request.setDescription(skillDescription); - request.setTags(tagsStrList); - request.setIntroduce(genIntroduceByDescription(skillDescription)); - return getCmsContent(request, yamlContent, StpUtil.getLoginIdAsLong(), skillIcon); - } catch (YAMLException e) { - throw new BizException("yaml解析失败:"+ e.getMessage()); - } - } - - private String getDefaultIcon(String tagId){ - CmsTagDto tagDto = new CmsTagDto(); - tagDto.setDeleteFlag(0); - tagDto.setStatus(1); - List tagList = cmsTagService.getList(tagDto); - - String defaultIcon = ""; - for (int i = 0; i < tagList.size(); i++) { - CmsTag tag = tagList.get(i); - if (tagId.contains(tag.getTagId()+"")) { - if (StringUtil.isEmpty(defaultIcon)){ - defaultIcon = tag.getIcon(); - break; - } - } - } - return defaultIcon; - } - - public SkillGenRequest parseSkillMdText(String skillMdText,List tags) { - String url = deepSeekConfig.getBaseUrl() + "/v1/chat/completions"; - - // 将标签名称拼接成逗号分隔的字符串 - StringBuilder tagsList = new StringBuilder(); - for (int i = 0; i < tags.size(); i++) { - CmsTag tag = tags.get(i); - tagsList.append(tag.getTagId()+"."+tag.getTagName()); - if (i < tags.size() - 1) { - tagsList.append(","); - } - } - - // 构建系统消息内容 - String systemContent = """ - 你是一位专业的AI技能包解析助手,需完成以下任务: - 1. 我会提供一个技能包压缩包SKILL.md文件的具体内容; - 2. 基于SKILL.md内容,提炼出: - - skill的核心标题(name); - - skill的核心描述(description); - - 详细功能介绍(introduce); - - 从指定标签列表中选取至少3个适配标签(tagList),标签范围:TAG_LIST; - - 选择标签的时候只需要输出对应的标签编号,特别注意:只需要标签编号 - 请将最终结果以JSON格式输出,JSON结构必须包含:name(技能名称),description(技能描述)、introduce(功能介绍)、tagList(标签列表),无需额外说明,仅输出符合要求的JSON内容。 - """; - systemContent = systemContent.replace("TAG_LIST", tagsList.toString()); - - // 创建技能请求 - SkillRequest skillRequest = new SkillRequest(true, deepSeekConfig.getChat().getModel(), systemContent, skillMdText, 0.5, 8192, "json_object"); - - String deepseekResponse = ""; - try { - // 发送HTTP请求到DeepSeek API - deepseekResponse = HttpUtil.sendPostRequest(url, skillRequest, deepSeekConfig.getApiKey(), null); - log.info("Deepseek API响应: {}", deepseekResponse); - - // 解析返回结果 - JSONObject responseJson = JSON.parseObject(deepseekResponse); - List choices = responseJson.getJSONArray("choices").toJavaList(JSONObject.class); - - if (choices != null && !choices.isEmpty()) { - // 获取最新的choice - JSONObject latestChoice = choices.get(0); - JSONObject message = latestChoice.getJSONObject("message"); - String content = message.getString("content"); - - // 解析content中的JSON - JSONObject skillJson = JSON.parseObject(content); - - // 构建技能生成请求 - SkillGenRequest request = new SkillGenRequest(); - request.setName(skillJson.getString("name")); - request.setDescription(skillJson.getString("description")); - request.setIntroduce(skillJson.getString("introduce")); - // 处理tagList可能不存在的情况 - if (skillJson.containsKey("tagList")) { - request.setTags(skillJson.getJSONArray("tagList").toJavaList(String.class)); - } else { - request.setTags(Arrays.asList("1001", "1002")); - } - return request; - } - } catch (Exception e) { - log.error("调用Deepseek API失败: {}", e.getMessage(), e); - throw new BizException("调用Deepseek API失败:"+ e.getMessage()+" Deepseek API响应:"+ deepseekResponse); - } - - return null; - } - - - @Override - public CmsContent uploadSkillV4(byte[] fileBytes, String fileName) { - return null; - } -} diff --git a/src/main/java/com/kexue/skills/service/impl/SysUserRoleServiceImpl.java b/src/main/java/com/kexue/skills/service/impl/SysUserRoleServiceImpl.java deleted file mode 100644 index f1f49bb..0000000 --- a/src/main/java/com/kexue/skills/service/impl/SysUserRoleServiceImpl.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.kexue.skills.service.impl; - -import com.kexue.skills.entity.SysUserRole; -import com.kexue.skills.entity.dto.SysUserRoleDto; -import com.kexue.skills.mapper.SysUserRoleMapper; -import com.kexue.skills.service.SysUserRoleService; -import org.springframework.stereotype.Service; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; - -import javax.annotation.Resource; -import java.util.List; - -/** - * (SysUserRole)表服务实现类 - * - * @author 王志维 - * @since 2025-02-21 23:01:48 - */ -@Service("sysUserRoleService") -public class SysUserRoleServiceImpl implements SysUserRoleService { - - @Resource - private SysUserRoleMapper sysUserRoleMapper; - - /** - * 分页查询数据 - * - * @param queryDto - * @return 数据分页列表 - */ - @Override - public PageInfo getPageList(SysUserRoleDto queryDto) { - int pageNum = queryDto.getPageNum()==null?PAGENUM:queryDto.getPageNum(); - int pageSize = queryDto.getPageSize()==null? PAGESIZE :queryDto.getPageSize(); - PageHelper.startPage(pageNum,pageSize); - List dataList = sysUserRoleMapper.getPageList(queryDto); - return new PageInfo<>(dataList); - } - - /** - * 通过ID查询单条数据 - * - * @param roleId 主键 - * @return 实例对象 - */ - @Override - public SysUserRole queryById(Long roleId) { - return sysUserRoleMapper.queryById(roleId); - } - - /** - * 查询多条数据 - * - * @param offset 查询起始位置 - * @param limit 查询条数 - * @return 对象列表 - */ - @Override - public List queryAllByLimit(int offset, int limit) { - return sysUserRoleMapper.queryAllByLimit(offset, limit); - } - - /** - * 新增数据 - * - * @param sysUserRole 实例对象 - * @return 实例对象 - */ - @Override - public SysUserRole insert(SysUserRole sysUserRole) { - sysUserRoleMapper.insert(sysUserRole); - return sysUserRole; - } - - /** - * 修改数据 - * - * @param sysUserRole 实例对象 - * @return 实例对象 - */ - @Override - public SysUserRole update(SysUserRole sysUserRole) { - sysUserRoleMapper.update(sysUserRole); - return queryById(sysUserRole.getRoleId()); - } - - /** - * 通过主键删除数据 - * - * @param roleId 主键 - * @return 是否成功 - */ - @Override - public boolean deleteById(Long roleId) { - return sysUserRoleMapper.deleteById(roleId) > 0; - } -} diff --git a/src/main/java/com/kexue/skills/service/impl/WithdrawalRecordServiceImpl.java b/src/main/java/com/kexue/skills/service/impl/WithdrawalRecordServiceImpl.java deleted file mode 100644 index 313b92c..0000000 --- a/src/main/java/com/kexue/skills/service/impl/WithdrawalRecordServiceImpl.java +++ /dev/null @@ -1,288 +0,0 @@ -package com.kexue.skills.service.impl; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.kexue.skills.entity.Account; -import com.kexue.skills.entity.WithdrawalRecord; -import com.kexue.skills.entity.dto.WithdrawalRecordDto; -import com.kexue.skills.common.Assert; -import com.kexue.skills.exception.BizException; -import com.kexue.skills.mapper.WithdrawalRecordMapper; -import com.kexue.skills.service.AccountService; -import com.kexue.skills.service.WithdrawalRecordService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.HashMap; -import java.util.UUID; - -/** - * 提现记录Service实现类 - * - * @author 王志维 - * @since 2026-03-25 - */ -@Service("withdrawalRecordService") -@Transactional(rollbackFor = Exception.class) -public class WithdrawalRecordServiceImpl implements WithdrawalRecordService { - @Resource - private WithdrawalRecordMapper withdrawalRecordMapper; - - @Resource - private AccountService accountService; - - /** - * 提现手续费比例 - */ - private static final BigDecimal FEE_RATE = new BigDecimal("0.02"); - - /** - * 分页查询 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @Override - public PageInfo getPageList(WithdrawalRecordDto queryDto) { - PageHelper.startPage(queryDto.getPageNum(), queryDto.getPageSize()); - List list = this.withdrawalRecordMapper.getPageList(queryDto); - return new PageInfo<>(list); - } - - /** - * 查询列表 - * - * @param queryDto 筛选条件 - * @return 查询结果 - */ - @Override - public List getList(WithdrawalRecordDto queryDto) { - return this.withdrawalRecordMapper.getList(queryDto); - } - - /** - * 通过主键查询单条数据 - * - * @param recordId 主键 - * @return 实例对象 - */ - @Override - public WithdrawalRecord queryById(Long recordId) { - return this.withdrawalRecordMapper.queryById(recordId); - } - - /** - * 通过用户ID查询提现记录 - * - * @param userId 用户ID - * @return 实例对象 - */ - @Override - public List queryByUserId(Long userId) { - return this.withdrawalRecordMapper.queryByUserId(userId); - } - - /** - * 通过提现单号查询提现记录 - * - * @param withdrawalNo 提现单号 - * @return 实例对象 - */ - @Override - public WithdrawalRecord queryByWithdrawalNo(String withdrawalNo) { - return this.withdrawalRecordMapper.queryByWithdrawalNo(withdrawalNo); - } - - /** - * 新增数据 - * - * @param withdrawalRecord 实例对象 - * @return 实例对象 - */ - @Override - public WithdrawalRecord insert(WithdrawalRecord withdrawalRecord) { - // 设置创建时间和更新时间 - Date now = new Date(); - withdrawalRecord.setCreateTime(now); - withdrawalRecord.setUpdateTime(now); - // 设置默认值 - withdrawalRecord.setDeleteFlag(0); - // 保存数据 - this.withdrawalRecordMapper.insert(withdrawalRecord); - return withdrawalRecord; - } - - /** - * 更新数据 - * - * @param withdrawalRecord 实例对象 - * @return 实例对象 - */ - @Override - public WithdrawalRecord update(WithdrawalRecord withdrawalRecord) { - // 设置更新时间 - withdrawalRecord.setUpdateTime(new Date()); - // 更新数据 - this.withdrawalRecordMapper.update(withdrawalRecord); - return this.queryById(withdrawalRecord.getRecordId()); - } - - /** - * 更新提现状态 - * - * @param recordId 记录ID - * @param status 状态 - * @return 影响行数 - */ - @Override - public int updateStatus(Long recordId, Integer status) { - Map params = new HashMap<>(); - params.put("recordId", recordId); - params.put("status", status); - return this.withdrawalRecordMapper.updateStatus(params); - } - - /** - * 通过主键逻辑删除 - * - * @param recordId 主键 - * @param updateBy 更新人 - * @return 影响行数 - */ - @Override - public int logicDeleteById(Long recordId, String updateBy) { - Map params = new HashMap<>(); - params.put("recordId", recordId); - return this.withdrawalRecordMapper.logicDeleteById(params); - } - - /** - * 通过主键物理删除 - * - * @param recordId 主键 - * @return 影响行数 - */ - @Override - public int deleteById(Long recordId) { - return this.withdrawalRecordMapper.deleteById(recordId); - } - - /** - * 提交提现申请 - * - * @param userId 用户ID - * @param amount 提现金额 - * @param bankName 银行名称 - * @param bankAccount 银行账号 - * @param bankCardholder 持卡人姓名 - * @param remark 备注 - * @return 提现记录 - */ - @Override - public WithdrawalRecord submitWithdrawal(Long userId, BigDecimal amount, String bankName, String bankAccount, String bankCardholder, String remark) { - // 1. 查询账户信息 - Account account = accountService.queryByUserId(userId); - Assert.notNull(account, "账户不存在"); - - // 2. 检查可提现余额是否足够 - Assert.isTrue(account.getWithdrawableBalance().compareTo(amount) >= 0, "可提现余额不足"); - - // 3. 计算手续费和实际到账金额 - BigDecimal feeAmount = amount.multiply(FEE_RATE); - BigDecimal actualAmount = amount.subtract(feeAmount); - - // 4. 生成提现单号 - String withdrawalNo = generateWithdrawalNo(); - - // 5. 创建提现记录 - WithdrawalRecord record = new WithdrawalRecord(); - record.setUserId(userId); - record.setUserName(account.getUserName()); - record.setWithdrawalAmount(amount); - record.setFeeAmount(feeAmount); - record.setActualAmount(actualAmount); - record.setStatus(1); // 1.待处理 - record.setWithdrawalNo(withdrawalNo); - record.setBankName(bankName); - record.setBankAccount(bankAccount); - record.setBankCardholder(bankCardholder); - record.setRemark(remark); - record.setCreateTime(new Date()); - record.setUpdateTime(new Date()); - record.setDeleteFlag(0); - this.withdrawalRecordMapper.insert(record); - - // 6. 冻结可提现余额 - account.setWithdrawableBalance(account.getWithdrawableBalance().subtract(amount)); - account.setFrozenAmount(account.getFrozenAmount().add(amount)); - account.setUpdateTime(new Date()); - accountService.update(account); - - return record; - } - - /** - * 处理提现 - * - * @param recordId 记录ID - * @param status 状态 - * @param remark 备注 - * @return 影响行数 - */ - @Override - public int processWithdrawal(Long recordId, Integer status, String remark) { - // 1. 查询提现记录 - WithdrawalRecord record = this.queryById(recordId); - Assert.notNull(record, "提现记录不存在"); - - // 2. 检查状态是否为待处理 - Assert.isTrue(record.getStatus() == 1, "提现记录状态不正确"); - - // 3. 更新提现状态 - Map params = new HashMap<>(); - params.put("recordId", recordId); - params.put("status", status); - int result = this.withdrawalRecordMapper.updateStatus(params); - - // 4. 如果提现成功,减少可提现余额,增加冻结金额 - if (status == 3) { // 3.成功 - Account account = accountService.queryByUserId(record.getUserId()); - if (account != null) { - // 减少冻结金额 - account.setFrozenAmount(account.getFrozenAmount().subtract(record.getWithdrawalAmount())); - // 减少总余额 - account.setBalance(account.getBalance().subtract(record.getWithdrawalAmount())); - account.setUpdateTime(new Date()); - accountService.update(account); - } - } else if (status == 4) { // 4.失败 - // 解冻金额 - Account account = accountService.queryByUserId(record.getUserId()); - if (account != null) { - account.setFrozenAmount(account.getFrozenAmount().subtract(record.getWithdrawalAmount())); - account.setWithdrawableBalance(account.getWithdrawableBalance().add(record.getWithdrawalAmount())); - account.setUpdateTime(new Date()); - accountService.update(account); - } - } - - return result; - } - - /** - * 生成提现单号 - * - * @return 提现单号 - */ - private String generateWithdrawalNo() { - // 提现单号生成规则:W + 时间戳 + 6位随机数 - String timestamp = String.valueOf(System.currentTimeMillis()); - String random = UUID.randomUUID().toString().substring(0, 6).replaceAll("-", ""); - return "W" + timestamp + random; - } -} \ No newline at end of file diff --git a/src/main/java/com/kexue/skills/task/AccountFrozenTask.java b/src/main/java/com/kexue/skills/task/AccountFrozenTask.java deleted file mode 100644 index c43f692..0000000 --- a/src/main/java/com/kexue/skills/task/AccountFrozenTask.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.kexue.skills.task; - -import com.kexue.skills.entity.AccountFrozen; -import com.kexue.skills.mapper.AccountFrozenMapper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import java.util.Date; -import java.util.List; - -/** - * 账户冻结单定时任务 - * 扫描过期的冻结单并更新状态 - * - * @author 系统生成 - * @since 2026-04-11 - */ -@Component -public class AccountFrozenTask { - - private static final Logger logger = LoggerFactory.getLogger(AccountFrozenTask.class); - - @Resource - private AccountFrozenMapper accountFrozenMapper; - - /** - * 定时扫描过期的冻结单 - * 每隔30分钟执行一次 - */ - @Scheduled(cron = "0 0/30 * * * ?") - public void scanExpiredFrozen() { - logger.info("开始扫描过期的冻结单"); - - try { - // 查询所有状态为RESERVED且过期的冻结单 - List expiredFrozenList = accountFrozenMapper.selectExpiredFrozen(new Date()); - - if (expiredFrozenList != null && !expiredFrozenList.isEmpty()) { - logger.info("发现 {} 个过期的冻结单", expiredFrozenList.size()); - - for (AccountFrozen frozen : expiredFrozenList) { - // 更新状态为FINALIZED - frozen.setStatus("FINALIZED"); - frozen.setFinalizeReason("timeout"); - frozen.setUpdateTime(new Date()); - - // 执行更新 - accountFrozenMapper.updateByPrimaryKey(frozen); - logger.info("已处理过期冻结单: {}", frozen.getFrozenId()); - } - } else { - logger.info("未发现过期的冻结单"); - } - } catch (Exception e) { - logger.error("扫描过期冻结单时发生错误", e); - } - - logger.info("扫描过期冻结单完成"); - } - -} diff --git a/src/main/java/com/kexue/skills/task/DieselBillTask.java b/src/main/java/com/kexue/skills/task/DieselBillTask.java deleted file mode 100644 index f55d7a9..0000000 --- a/src/main/java/com/kexue/skills/task/DieselBillTask.java +++ /dev/null @@ -1,57 +0,0 @@ -//package com.kexue.skills.task; -// -//import cn.hutool.core.collection.CollectionUtil; -//import com.kexue.skills.common.Const; -//import com.kexue.skills.entity.DieselBill; -//import com.kexue.skills.entity.PurchaseOrder; -//import com.kexue.skills.entity.request.BillDetailDto; -//import com.kexue.skills.entity.request.OrderDetailDto; -//import com.kexue.skills.service.DieselBillService; -//import com.kexue.skills.service.PurchaseOrderService; -//import lombok.extern.slf4j.Slf4j; -//import org.springframework.scheduling.annotation.Scheduled; -//import org.springframework.stereotype.Component; -//import org.springframework.transaction.annotation.Transactional; -//import org.springframework.transaction.interceptor.TransactionAspectSupport; -// -//import javax.annotation.Resource; -//import java.util.List; -//import java.util.Objects; -// -///** -// * @author 维哥 -// * @Description 查询所有已卖完的采购单,统计采购单的采购成本、销售成本、盈利金额、鱼损金额,更新到采购单汇总表 -// * @create 2025-03-04 11:55 -// */ -//@Component -//@Slf4j -//public class DieselBillTask { -// -// @Resource -// private DieselBillService dieselBillService; -// -// @Scheduled(cron = "0 */10 * * * *") -// @Transactional -// public void calculateIceBillStatistics() { -// try { -// log.info("采购单汇总开始..."); -// List listByOrderStatus = dieselBillService.getListByOrderStatus(Const.ACCOUNT_STATUS_ACCOUNTED); -// if (CollectionUtil.isNotEmpty(listByOrderStatus)) { -// listByOrderStatus.forEach(bill -> { -// BillDetailDto dieselBillDetailById = dieselBillService.getDieselBillDetailById(bill.getId()); -// if (Objects.nonNull(dieselBillDetailById)) { -// DieselBill dieselBill = dieselBillDetailById.getDieselBill(); -// if (Objects.nonNull(dieselBill)) { -// dieselBillService.update(dieselBill); -// log.info("定时任务,更新油帐成功,orderId:{}", bill.getId()); -// } -// } -// }); -// } -// } catch (Exception e) { -// log.error("更新油帐汇总异常", e); -// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); -// } -// } -// -//} diff --git a/src/main/resources/application-common.yml b/src/main/resources/application-common.yml index 40c38ee..d39353a 100644 --- a/src/main/resources/application-common.yml +++ b/src/main/resources/application-common.yml @@ -4,7 +4,8 @@ common: redis: # host: 127.0.0.1 # port: 6379 - host: 43.248.97.19 - port: 16379 - password: 654321 +# password: 654321 + host: 43.248.97.33 + port: 16380 + password: 5Qsd1rTx3S7rKs0A database: 1 diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 621a5ef..218d553 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,5 +1,5 @@ server: - port: 19001 + port: 16001 servlet: session: timeout: 86400s @@ -8,7 +8,7 @@ spring: driver-class-name: com.mysql.cj.jdbc.Driver username: root password: 123456 - url: jdbc:mysql://127.0.0.1:3306/agent_skills?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false&allowPublicKeyRetrieval=true + url: jdbc:mysql://127.0.0.1:3306/kexue_server?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false&allowPublicKeyRetrieval=true hikari: pool-name: DevHikariPool maximum-pool-size: 12 @@ -61,7 +61,7 @@ sa-token: # 验证码配置 captcha: # 是否启用验证码验证 - enabled: true + enabled: false # 验证码有效期(秒) expire-time: 300 # 验证码长度 diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index c8446a7..7011ef8 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -1,14 +1,14 @@ server: - port: 19000 + port: 16000 servlet: session: timeout: 86400s spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - username: agent_skills - password: agent_skills@xueai666 - url: jdbc:mysql://127.0.0.1:12306/agent_skills?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false&allowPublicKeyRetrieval=true + username: root + password: C9MUjc5ChtqHeCtQ + url: jdbc:mysql://127.0.0.1:13307/kexue_server?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&autoReconnect=true&maxReconnects=10&failOverReadOnly=false&allowPublicKeyRetrieval=true hikari: pool-name: ProdHikariPool maximum-pool-size: 30 @@ -58,7 +58,7 @@ sa-token: # 验证码配置 captcha: # 是否启用验证码验证 - enabled: true + enabled: false # 验证码有效期(秒) expire-time: 300 # 验证码长度 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index e2ad121..e4cac0a 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -2,8 +2,8 @@ spring: profiles: active: prod application: - name: agentSkills - version: 1.0.0 + name: kexueServer + version: 2.0.0 # 禁用会话持久化,避免启动时恢复损坏的会话文件 session: store-type: none @@ -59,7 +59,7 @@ springdoc: path: /doc.html layout: StandaloneLayout doc-expansion: none - packages-to-scan: com.kexue.skills.controller + packages-to-scan: art.kexue.sxwz.controller mybatis: mapper-locations: classpath:mapper/*.xml @@ -108,3 +108,12 @@ account: # 扣费系数,默认2倍(实际消耗1积分,扣除2积分) coefficient: 2 +# 微信登录配置 +wechat: + login: + app-id: ${WECHAT_APP_ID:wx7d13d99de5be3bfa} + app-secret: ${WECHAT_APP_SECRET:e10adc3949ba59abbe56e057f20f883e} + redirect-uri: ${WECHAT_REDIRECT_URI:http://127.0.0.1:16001/api/login/wechat/callback} + scope: snsapi_login + state-expire-minutes: 5 + diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index f8edb37..90e3575 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -2,7 +2,7 @@ - + @@ -13,10 +13,10 @@ - ${LOG_HOME}/skill.log + ${LOG_HOME}/kexuerServer.log - ${LOG_HOME}/skill.%d{yyyy-MM-dd}.log + ${LOG_HOME}/kexuerServer.%d{yyyy-MM-dd}.log 30 @@ -33,7 +33,7 @@ - + diff --git a/src/main/resources/mapper/AccountFrozenMapper.xml b/src/main/resources/mapper/AccountFrozenMapper.xml index defc619..e4ea88a 100644 --- a/src/main/resources/mapper/AccountFrozenMapper.xml +++ b/src/main/resources/mapper/AccountFrozenMapper.xml @@ -1,8 +1,8 @@ - + - + @@ -36,7 +36,7 @@ where frozen_id = #{frozenId} - + insert into account_frozen (frozen_id, account_transaction_id, user_id, call_id, session_id, model_name, question, frozen_amount, frozen_type, final_amount, usage_input_tokens, usage_output_tokens, usage_total_tokens, @@ -47,7 +47,7 @@ #{finalizeReason}, #{status}, #{expireAt}, #{createTime}, #{updateTime}) - + update account_frozen set account_transaction_id = #{accountTransactionId}, @@ -91,3 +91,6 @@ + + + diff --git a/src/main/resources/mapper/AccountMapper.xml b/src/main/resources/mapper/AccountMapper.xml index 5e6377c..7433a8b 100644 --- a/src/main/resources/mapper/AccountMapper.xml +++ b/src/main/resources/mapper/AccountMapper.xml @@ -1,8 +1,8 @@ - + - + @@ -109,7 +109,7 @@ update_by = #{updateBy}, delete_flag = #{deleteFlag}, - where account_id = #{accountId} + where user_id = #{userId} @@ -148,4 +148,6 @@ delete from account where account_id = #{accountId} - \ No newline at end of file + + + diff --git a/src/main/resources/mapper/AccountTransactionMapper.xml b/src/main/resources/mapper/AccountTransactionMapper.xml index 0ad1eaa..1f77a76 100644 --- a/src/main/resources/mapper/AccountTransactionMapper.xml +++ b/src/main/resources/mapper/AccountTransactionMapper.xml @@ -1,8 +1,8 @@ - + - + @@ -294,7 +294,7 @@ - + @@ -456,4 +456,6 @@ ORDER BY create_time DESC - \ No newline at end of file + + + diff --git a/src/main/resources/mapper/CmsCategoryMapper.xml b/src/main/resources/mapper/CmsCategoryMapper.xml deleted file mode 100644 index 3902d58..0000000 --- a/src/main/resources/mapper/CmsCategoryMapper.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - insert into cms_category(category_name, parent_id, level, sort, status, create_time, update_time, create_by, update_by, delete_flag) - values (#{categoryName}, #{parentId}, #{level}, #{sort}, #{status}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy}, #{deleteFlag}) - - - - - update cms_category - - - category_name = #{categoryName}, - - - parent_id = #{parentId}, - - - level = #{level}, - - - sort = #{sort}, - - - status = #{status}, - - - update_time = #{updateTime}, - - - update_by = #{updateBy}, - - - where category_id = #{categoryId} - - - - - update cms_category - set delete_flag = 1, update_by = #{updateBy}, update_time = now() - where category_id = #{categoryId} - - - - - delete from cms_category where category_id = #{categoryId} - - - \ No newline at end of file diff --git a/src/main/resources/mapper/CmsCategoryTagMapper.xml b/src/main/resources/mapper/CmsCategoryTagMapper.xml deleted file mode 100644 index fbe761d..0000000 --- a/src/main/resources/mapper/CmsCategoryTagMapper.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - insert into cms_category_tag(category_id, tag_id, create_time, update_time, create_by, update_by, delete_flag) - values (#{categoryId}, #{tagId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy}, #{deleteFlag}) - - - - - update cms_category_tag - - - category_id = #{categoryId}, - - - tag_id = #{tagId}, - - - update_time = #{updateTime}, - - - update_by = #{updateBy}, - - - where id = #{id} - - - - - update cms_category_tag - set delete_flag = 1, update_by = #{updateBy}, update_time = now() - where id = #{id} - - - - - delete from cms_category_tag where id = #{id} - - - - - update cms_category_tag - set delete_flag = 1, update_by = #{updateBy}, update_time = now() - where category_id = #{categoryId} - - - - - update cms_category_tag - set delete_flag = 1, update_by = #{updateBy}, update_time = now() - where tag_id = #{tagId} - - - - - insert into cms_category_tag(category_id, tag_id, create_time, update_time, create_by, update_by, delete_flag) - values - - (#{item.categoryId}, #{item.tagId}, #{item.createTime}, #{item.updateTime}, #{item.createBy}, #{item.updateBy}, #{item.deleteFlag}) - - - - diff --git a/src/main/resources/mapper/CmsContentLikeMapper.xml b/src/main/resources/mapper/CmsContentLikeMapper.xml deleted file mode 100644 index 01d3ea5..0000000 --- a/src/main/resources/mapper/CmsContentLikeMapper.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - INSERT INTO cms_content_like ( - user_id, user_name, content_id, content_title, like_time, delete_flag - ) VALUES ( - #{userId}, #{userName}, #{contentId}, #{contentTitle}, NOW(), #{deleteFlag, jdbcType=INTEGER} - ) - - - - UPDATE cms_content_like - - user_id = #{userId}, - user_name = #{userName}, - content_id = #{contentId}, - content_title = #{contentTitle}, - like_time = #{likeTime}, - delete_flag = #{deleteFlag}, - - WHERE like_id = #{likeId} - - - - DELETE FROM cms_content_like WHERE like_id = #{likeId} - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/mapper/CmsContentMapper.xml b/src/main/resources/mapper/CmsContentMapper.xml deleted file mode 100644 index 052b3b8..0000000 --- a/src/main/resources/mapper/CmsContentMapper.xml +++ /dev/null @@ -1,623 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - insert into cms_content(title, title_en, subtitle, content_type, summary, description, description_en, requirement, introduce, introduce_en, content, content_en, cover_image, author_id, author_name, - reviewer_id, reviewer_name, audit_status, audit_comment, publish_status, publish_time, - view_count, like_count, comment_count, sort, is_paid, price, required_points, support_points_pay, is_official, share_count, file_url, icon, background, origin, tags, create_time, update_time, create_by, update_by, delete_flag) - values (#{title}, #{titleEn}, #{subtitle}, #{contentType}, #{summary}, #{description}, #{descriptionEn}, #{requirement}, #{introduce}, #{introduceEn}, #{content}, #{contentEn}, #{coverImage}, #{authorId}, #{authorName}, - #{reviewerId}, #{reviewerName}, #{auditStatus}, #{auditComment}, #{publishStatus}, #{publishTime}, - #{viewCount}, #{likeCount}, #{commentCount}, #{sort}, #{isPaid}, #{price}, #{requiredPoints}, #{supportPointsPay}, #{isOfficial}, #{shareCount}, #{fileUrl}, #{icon}, #{background}, #{origin}, #{tags}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy}, #{deleteFlag}) - - - - - insert into cms_content(title, title_en, subtitle, content_type, summary, description, description_en, requirement, introduce, introduce_en, content, content_en, cover_image, author_id, author_name, - reviewer_id, reviewer_name, audit_status, audit_comment, publish_status, publish_time, - view_count, like_count, comment_count, sort, is_paid, price, required_points, support_points_pay, is_official, share_count, file_url, icon, background, origin, tags, create_time, update_time, create_by, update_by, delete_flag) - values - - (#{item.title}, #{item.titleEn}, #{item.subtitle}, #{item.contentType}, #{item.summary}, #{item.description}, #{item.descriptionEn}, #{item.requirement}, #{item.introduce}, #{item.introduceEn}, #{item.content}, #{item.contentEn}, #{item.coverImage}, #{item.authorId}, #{item.authorName}, - #{item.reviewerId}, #{item.reviewerName}, #{item.auditStatus}, #{item.auditComment}, #{item.publishStatus}, #{item.publishTime}, - #{item.viewCount}, #{item.likeCount}, #{item.commentCount}, #{item.sort}, #{item.isPaid}, #{item.price}, #{item.requiredPoints}, #{item.supportPointsPay}, #{item.isOfficial}, #{item.shareCount}, #{item.fileUrl}, #{item.icon}, #{item.background}, #{item.origin}, #{item.tags}, #{item.createTime}, #{item.updateTime}, #{item.createBy}, #{item.updateBy}, #{item.deleteFlag}) - - - - - - update cms_content - - - title = #{title}, - - - title_en = #{titleEn}, - - - subtitle = #{subtitle}, - - - content_type = #{contentType}, - - - summary = #{summary}, - - - description = #{description}, - - - description_en = #{descriptionEn}, - - - requirement = #{requirement}, - - - introduce = #{introduce}, - - - introduce_en = #{introduceEn}, - - - content = #{content}, - - - content_en = #{contentEn}, - - - cover_image = #{coverImage}, - - - author_id = #{authorId}, - - - author_name = #{authorName}, - - - reviewer_id = #{reviewerId}, - - - reviewer_name = #{reviewerName}, - - - audit_status = #{auditStatus}, - - - audit_comment = #{auditComment}, - - - publish_status = #{publishStatus}, - - - publish_time = #{publishTime}, - - - view_count = #{viewCount}, - - - like_count = #{likeCount}, - - - comment_count = #{commentCount}, - - - sort = #{sort}, - - - is_paid = #{isPaid}, - - - price = #{price}, - - - required_points = #{requiredPoints}, - - - support_points_pay = #{supportPointsPay}, - - - is_official = #{isOfficial}, - - - share_count = #{shareCount}, - - - file_url = #{fileUrl}, - - - icon = #{icon}, - - - background = #{background}, - - - origin = #{origin}, - - - tags = #{tags}, - - - update_time = #{updateTime}, - - - update_by = #{updateBy}, - - - where content_id = #{contentId} - - - - - update cms_content - set audit_status = #{auditStatus}, - reviewer_id = #{reviewerId}, - reviewer_name = #{reviewerName}, - audit_comment = #{auditComment}, - update_by = #{updateBy}, - update_time = now() - where content_id = #{contentId} - - - - - update cms_content - set publish_status = #{publishStatus}, - publish_time = #{publishTime}, - update_by = #{updateBy}, - update_time = now() - where content_id = #{contentId} - - - - - update cms_content - set delete_flag = 1, update_by = #{updateBy}, update_time = now() - where content_id = #{contentId} - - - - - delete from cms_content where content_id = #{contentId} - - - - - update cms_content - set view_count = view_count + 1 - where content_id = #{contentId} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - truncate table cms_content - - - diff --git a/src/main/resources/mapper/CmsContentViewMapper.xml b/src/main/resources/mapper/CmsContentViewMapper.xml deleted file mode 100644 index f9f86ce..0000000 --- a/src/main/resources/mapper/CmsContentViewMapper.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - INSERT INTO cms_content_view ( - user_id, user_name, content_id, content_title, view_time, delete_flag - ) VALUES ( - #{userId}, #{userName}, #{contentId}, #{contentTitle}, NOW(), #{deleteFlag, jdbcType=INTEGER} - ) - - - - UPDATE cms_content_view - - user_id = #{userId}, - user_name = #{userName}, - content_id = #{contentId}, - content_title = #{contentTitle}, - view_time = #{viewTime}, - delete_flag = #{deleteFlag}, - - WHERE view_id = #{viewId} - - - - DELETE FROM cms_content_view WHERE view_id = #{viewId} - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/mapper/CmsTagMapper.xml b/src/main/resources/mapper/CmsTagMapper.xml deleted file mode 100644 index 3102a0e..0000000 --- a/src/main/resources/mapper/CmsTagMapper.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - insert into cms_tag(tag_name, description, use_count, status, icon, create_time, update_time, create_by, update_by, delete_flag) - values (#{tagName}, #{description}, #{useCount}, #{status}, #{icon}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy}, #{deleteFlag}) - - - - - update cms_tag - - - tag_name = #{tagName}, - - - description = #{description}, - - - use_count = #{useCount}, - - - status = #{status}, - - - icon = #{icon}, - - - update_time = #{updateTime}, - - - update_by = #{updateBy}, - - - where tag_id = #{tagId} - - - - - update cms_tag - set delete_flag = 1, update_by = #{updateBy}, update_time = now() - where tag_id = #{tagId} - - - - - delete from cms_tag where tag_id = #{tagId} - - - - - - \ No newline at end of file diff --git a/src/main/resources/mapper/ComputeQuotaMapper.xml b/src/main/resources/mapper/ComputeQuotaMapper.xml new file mode 100644 index 0000000..838a4d2 --- /dev/null +++ b/src/main/resources/mapper/ComputeQuotaMapper.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + insert into compute_quota(subject_type, subject_id, subject_name, allocated_hours, used_hours) + values (#{subjectType}, #{subjectId}, #{subjectName}, #{allocatedHours}, #{usedHours}) + + + + + + update compute_quota + + subject_type = #{subjectType}, + subject_id = #{subjectId}, + subject_name = #{subjectName}, + allocated_hours = #{allocatedHours}, + used_hours = #{usedHours}, + + where id = #{id} + + + + delete from compute_quota where id = #{id} + + + + + + + + + + update compute_quota + set used_hours = #{usedHours} + where subject_type = #{subjectType} and subject_id = #{subjectId} + + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/ContentPurchaseMapper.xml b/src/main/resources/mapper/ContentPurchaseMapper.xml deleted file mode 100644 index a16ca19..0000000 --- a/src/main/resources/mapper/ContentPurchaseMapper.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - insert into content_purchase - - user_id, - user_name, - content_id, - content_title, - pay_type, - amount, - points, - status, - purchase_time, - create_time, - update_time, - create_by, - update_by, - delete_flag, - - - #{userId}, - #{userName}, - #{contentId}, - #{contentTitle}, - #{payType}, - #{amount}, - #{points}, - #{status}, - #{purchaseTime}, - #{createTime}, - #{updateTime}, - #{createBy}, - #{updateBy}, - #{deleteFlag}, - - - - - - update content_purchase - - user_id = #{userId}, - user_name = #{userName}, - content_id = #{contentId}, - content_title = #{contentTitle}, - pay_type = #{payType}, - amount = #{amount}, - points = #{points}, - status = #{status}, - purchase_time = #{purchaseTime}, - update_time = #{updateTime}, - update_by = #{updateBy}, - delete_flag = #{deleteFlag}, - - where purchase_id = #{purchaseId} - - - - - update content_purchase - set status = #{status}, - update_time = now() - where purchase_id = #{purchaseId} - - - - - update content_purchase - set delete_flag = 1, - update_by = #{updateBy}, - update_time = now() - where purchase_id = #{purchaseId} - - - - - delete from content_purchase - where purchase_id = #{purchaseId} - - \ No newline at end of file diff --git a/src/main/resources/mapper/EduAttendanceMapper.xml b/src/main/resources/mapper/EduAttendanceMapper.xml new file mode 100644 index 0000000..d0c9160 --- /dev/null +++ b/src/main/resources/mapper/EduAttendanceMapper.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + id, school_id, course_id, attendance_time, type, duration, status, create_time, update_time + + + + INSERT INTO edu_attendance + + school_id, + course_id, + create_time, + type, + duration, + status, + + + #{schoolId}, + #{courseId}, + #{create_time}, + #{type}, + #{duration}, + #{status}, + + + + + + + + UPDATE edu_attendance + + school_id = #{schoolId}, + course_id = #{courseId}, + create_time = #{createTime}, + type = #{type}, + duration = #{duration}, + status = #{status}, + update_time = #{updateTime}, + + WHERE id = #{id} + + + + + DELETE FROM edu_attendance WHERE id = #{id} + + + + + + + + + + + diff --git a/src/main/resources/mapper/EduAttendanceRecordMapper.xml b/src/main/resources/mapper/EduAttendanceRecordMapper.xml new file mode 100644 index 0000000..e74f5f5 --- /dev/null +++ b/src/main/resources/mapper/EduAttendanceRecordMapper.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + id, school_id, attendance_id, student_id, status, record_time, create_time + + + + INSERT INTO edu_attendance_record + + school_id, + attendance_id, + student_id, + status, + + + #{schoolId}, + #{attendanceId}, + #{studentId}, + #{status}, + + + + + + + + UPDATE edu_attendance_record + + school_id = #{schoolId}, + attendance_id = #{attendanceId}, + student_id = #{studentId}, + status = #{status}, + record_time = #{recordTime}, + + WHERE id = #{id} + + + + + DELETE FROM edu_attendance_record WHERE id = #{id} + + + + + + + + + + INSERT INTO edu_attendance_record (school_id, attendance_id, student_id, status) + VALUES + + (#{item.schoolId}, #{item.attendanceId}, #{item.studentId}, #{item.status}) + + + + + + diff --git a/src/main/resources/mapper/EduCollegeMapper.xml b/src/main/resources/mapper/EduCollegeMapper.xml new file mode 100644 index 0000000..4aff45d --- /dev/null +++ b/src/main/resources/mapper/EduCollegeMapper.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + insert into edu_college(name, admin_user_id, teacher_count, student_count, status, deleted) + values (#{name}, #{adminUserId}, #{teacherCount}, #{studentCount}, #{status}, #{deleted}) + + + + + + update edu_college + + name = #{name}, + admin_user_id = #{adminUserId}, + teacher_count = #{teacherCount}, + student_count = #{studentCount}, + status = #{status}, + deleted = #{deleted}, + + where id = #{id} + + + + update edu_college set deleted = 1 where id = #{id} + + + + + + + + update edu_college set teacher_count = #{count} where id = #{id} + + + + update edu_college set student_count = #{count} where id = #{id} + + + \ No newline at end of file diff --git a/src/main/resources/mapper/EduCourseMapper.xml b/src/main/resources/mapper/EduCourseMapper.xml new file mode 100644 index 0000000..12272c5 --- /dev/null +++ b/src/main/resources/mapper/EduCourseMapper.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + id, school_id, name, cover, description, class_time, teaching_method, teacher_id, status, create_time, update_time + + + + INSERT INTO edu_course + + school_id, + name, + cover, + description, + class_time, + teaching_method, + teacher_id, + status, + + + #{schoolId}, + #{name}, + #{cover}, + #{description}, + #{classTime}, + #{teachingMethod}, + #{teacherId}, + #{status}, + + + + + + + UPDATE edu_course + + school_id = #{schoolId}, + name = #{name}, + cover = #{cover}, + description = #{description}, + class_time = #{classTime}, + teaching_method = #{teachingMethod}, + teacher_id = #{teacherId}, + status = #{status}, + update_time = #{updateTime}, + + WHERE id = #{id} + + + + + DELETE FROM edu_course WHERE id = #{id} + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/EduCourseStudentMapper.xml b/src/main/resources/mapper/EduCourseStudentMapper.xml new file mode 100644 index 0000000..6090fd6 --- /dev/null +++ b/src/main/resources/mapper/EduCourseStudentMapper.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + id, school_id, course_id, student_id, join_time, is_kicked + + + + INSERT INTO edu_course_student + + school_id, + course_id, + student_id, + is_kicked, + + + #{schoolId}, + #{courseId}, + #{studentId}, + #{isKicked}, + + + + + + + + UPDATE edu_course_student + + school_id = #{schoolId}, + course_id = #{courseId}, + student_id = #{studentId}, + join_time = #{joinTime}, + is_kicked = #{isKicked}, + + WHERE id = #{id} + + + + + DELETE FROM edu_course_student WHERE id = #{id} + + + + + + + + + + INSERT INTO edu_course_student (school_id, course_id, student_id) + VALUES + + (#{item.schoolId}, #{item.courseId}, #{item.studentId}) + + + + + DELETE FROM edu_course_student WHERE course_id = #{courseId} + + + + DELETE FROM edu_course_student WHERE student_id = #{studentId} + + + + + diff --git a/src/main/resources/mapper/EduExamMapper.xml b/src/main/resources/mapper/EduExamMapper.xml new file mode 100644 index 0000000..a99a5d0 --- /dev/null +++ b/src/main/resources/mapper/EduExamMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + id, school_id, course_id, name, questions, duration, allow_retake, start_time, end_time, total_score, pass_score, parent_exam_id, status, create_time, update_time + + + + INSERT INTO edu_exam + + school_id, + course_id, + name, + questions, + duration, + allow_retake, + start_time, + end_time, + total_score, + pass_score, + status, + + + #{schoolId}, + #{courseId}, + #{name}, + #{questions}, + #{duration}, + #{allowRetake}, + #{startTime}, + #{endTime}, + #{totalScore}, + #{passScore}, + #{status}, + + + + + + + UPDATE edu_exam + + school_id = #{schoolId}, + course_id = #{courseId}, + name = #{name}, + questions = #{questions}, + duration = #{duration}, + allow_retake = #{allowRetake}, + start_time = #{startTime}, + end_time = #{endTime}, + total_score = #{totalScore}, + pass_score = #{passScore}, + parent_exam_id = #{parentExamId}, + status = #{status}, + update_time = #{updateTime}, + + WHERE id = #{id} + + + + + DELETE FROM edu_exam WHERE id = #{id} + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/EduExamPaperMapper.xml b/src/main/resources/mapper/EduExamPaperMapper.xml new file mode 100644 index 0000000..bfb9c7c --- /dev/null +++ b/src/main/resources/mapper/EduExamPaperMapper.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + id, school_id, exam_id, student_id, answer, submit_time, score, status, create_time + + + + INSERT INTO edu_exam_paper + + school_id, + exam_id, + student_id, + answer, + status, + + + #{schoolId}, + #{examId}, + #{studentId}, + #{answer}, + #{status}, + + + + + + + UPDATE edu_exam_paper + + school_id = #{schoolId}, + exam_id = #{examId}, + student_id = #{studentId}, + answer = #{answer}, + submit_time = #{submitTime}, + score = #{score}, + status = #{status}, + + WHERE id = #{id} + + + + + DELETE FROM edu_exam_paper WHERE id = #{id} + + + + + + + + + + + diff --git a/src/main/resources/mapper/EduExcellentWorkMapper.xml b/src/main/resources/mapper/EduExcellentWorkMapper.xml new file mode 100644 index 0000000..56bbc0f --- /dev/null +++ b/src/main/resources/mapper/EduExcellentWorkMapper.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + id, school_id, work_type, work_id, submit_id, student_id, score, comment, create_time + + + + INSERT INTO edu_excellent_work + + school_id, + work_type, + work_id, + submit_id, + student_id, + score, + comment, + + + #{schoolId}, + #{workType}, + #{workId}, + #{submitId}, + #{studentId}, + #{score}, + #{comment}, + + + + + INSERT INTO edu_excellent_work + + id, + school_id, + work_type, + work_id, + submit_id, + student_id, + score, + comment, + create_time, + + + #{id}, + #{schoolId}, + #{workType}, + #{workId}, + #{submitId}, + #{studentId}, + #{score}, + #{comment}, + #{createTime}, + + + + + + + UPDATE edu_excellent_work + + school_id = #{schoolId}, + work_type = #{workType}, + work_id = #{workId}, + submit_id = #{submitId}, + student_id = #{studentId}, + score = #{score}, + comment = #{comment}, + + WHERE id = #{id} + + + + + DELETE FROM edu_excellent_work WHERE id = #{id} + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/EduHomeworkMapper.xml b/src/main/resources/mapper/EduHomeworkMapper.xml new file mode 100644 index 0000000..56e47fa --- /dev/null +++ b/src/main/resources/mapper/EduHomeworkMapper.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + id, school_id, course_id, name, requirement, questions, allow_late, start_time, end_time, status, create_time, update_time + + + + INSERT INTO edu_homework + + school_id, + course_id, + name, + requirement, + questions, + allow_late, + start_time, + end_time, + status, + + + #{schoolId}, + #{courseId}, + #{name}, + #{requirement}, + #{questions}, + #{allowLate}, + #{startTime}, + #{endTime}, + #{status}, + + + + + + + UPDATE edu_homework + + school_id = #{schoolId}, + course_id = #{courseId}, + name = #{name}, + requirement = #{requirement}, + questions = #{questions}, + allow_late = #{allowLate}, + start_time = #{startTime}, + end_time = #{endTime}, + status = #{status}, + update_time = #{updateTime}, + + WHERE id = #{id} + + + + + DELETE FROM edu_homework WHERE id = #{id} + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/EduHomeworkSubmitMapper.xml b/src/main/resources/mapper/EduHomeworkSubmitMapper.xml new file mode 100644 index 0000000..454c874 --- /dev/null +++ b/src/main/resources/mapper/EduHomeworkSubmitMapper.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + id, school_id, homework_id, student_id, answer, submit_time, is_late, status, score, comment, create_time + + + + INSERT INTO edu_homework_submit + + school_id, + homework_id, + student_id, + answer, + is_late, + status, + + + #{schoolId}, + #{homeworkId}, + #{studentId}, + #{answer}, + #{isLate}, + #{status}, + + + + + + + UPDATE edu_homework_submit + + school_id = #{schoolId}, + homework_id = #{homeworkId}, + student_id = #{studentId}, + answer = #{answer}, + submit_time = #{submitTime}, + is_late = #{isLate}, + status = #{status}, + score = #{score}, + comment = #{comment}, + + WHERE id = #{id} + + + + + DELETE FROM edu_homework_submit WHERE id = #{id} + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/EduSchoolMapper.xml b/src/main/resources/mapper/EduSchoolMapper.xml new file mode 100644 index 0000000..7653e62 --- /dev/null +++ b/src/main/resources/mapper/EduSchoolMapper.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + id, school_name, website, contact_phone, admin_user_id, status, create_time, update_time + + + + INSERT INTO edu_school + + school_name, + website, + contact_phone, + admin_user_id, + status, + + + #{schoolName}, + #{website}, + #{contactPhone}, + #{adminUserId}, + #{status}, + + + + + + + UPDATE edu_school + + school_name = #{schoolName}, + website = #{website}, + contact_phone = #{contactPhone}, + admin_user_id = #{adminUserId}, + status = #{status}, + update_time = #{updateTime}, + + WHERE id = #{id} + + + + DELETE FROM edu_school WHERE id = #{id} + + + + + + + + + + + diff --git a/src/main/resources/mapper/EduStudentMapper.xml b/src/main/resources/mapper/EduStudentMapper.xml new file mode 100644 index 0000000..003812b --- /dev/null +++ b/src/main/resources/mapper/EduStudentMapper.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + id, user_id, school_id, college_id, major_id, grade, class_name, student_no, real_name, activation_code, binding_status, create_time, update_time + + + + INSERT INTO edu_student + + user_id, + school_id, + college_id, + major_id, + grade, + class_name, + student_no, + real_name, + activation_code, + binding_status, + + + #{userId}, + #{schoolId}, + #{collegeId}, + #{majorId}, + #{grade}, + #{className}, + #{studentNo}, + #{realName}, + #{activationCode}, + #{bindingStatus}, + + + + + + + UPDATE edu_student + + user_id = #{userId}, + school_id = #{schoolId}, + college_id = #{collegeId}, + major_id = #{majorId}, + grade = #{grade}, + class_name = #{className}, + student_no = #{studentNo}, + real_name = #{realName}, + activation_code = #{activationCode}, + binding_status = #{bindingStatus}, + update_time = #{updateTime}, + + WHERE id = #{id} + + + + DELETE FROM edu_student WHERE id = #{id} + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/EduTeacherMapper.xml b/src/main/resources/mapper/EduTeacherMapper.xml new file mode 100644 index 0000000..92b275b --- /dev/null +++ b/src/main/resources/mapper/EduTeacherMapper.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + id, user_id, school_id, college_id, real_name, teacher_no, title, activation_code, binding_status, create_time, update_time + + + + INSERT INTO edu_teacher + + user_id, + school_id, + college_id, + real_name, + teacher_no, + title, + activation_code, + binding_status, + + + #{userId}, + #{schoolId}, + #{collegeId}, + #{realName}, + #{teacherNo}, + #{title}, + #{activationCode}, + #{bindingStatus}, + + + + + + + UPDATE edu_teacher + + user_id = #{userId}, + school_id = #{schoolId}, + college_id = #{collegeId}, + real_name = #{realName}, + teacher_no = #{teacherNo}, + title = #{title}, + activation_code = #{activationCode}, + binding_status = #{bindingStatus}, + update_time = #{updateTime}, + + WHERE id = #{id} + + + + DELETE FROM edu_teacher WHERE id = #{id} + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/EduWorkLikeMapper.xml b/src/main/resources/mapper/EduWorkLikeMapper.xml new file mode 100644 index 0000000..861db34 --- /dev/null +++ b/src/main/resources/mapper/EduWorkLikeMapper.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + id, school_id, work_id, user_id, create_time + + + + INSERT INTO edu_work_like + + school_id, + work_id, + user_id, + + + #{schoolId}, + #{workId}, + #{userId}, + + + + + + + UPDATE edu_work_like + + school_id = #{schoolId}, + work_id = #{workId}, + user_id = #{userId}, + + WHERE id = #{id} + + + + + DELETE FROM edu_work_like WHERE id = #{id} + + + + + + + + + + DELETE FROM edu_work_like WHERE work_id = #{workId} AND user_id = #{userId} + + + + + + + diff --git a/src/main/resources/mapper/ModelPriceMapper.xml b/src/main/resources/mapper/ModelPriceMapper.xml index 8550aa7..cda249d 100644 --- a/src/main/resources/mapper/ModelPriceMapper.xml +++ b/src/main/resources/mapper/ModelPriceMapper.xml @@ -1,8 +1,8 @@ - + - + @@ -146,3 +146,6 @@ + + + diff --git a/src/main/resources/mapper/PackageConfigMapper.xml b/src/main/resources/mapper/PackageConfigMapper.xml index 2d91f74..bf1a91d 100644 --- a/src/main/resources/mapper/PackageConfigMapper.xml +++ b/src/main/resources/mapper/PackageConfigMapper.xml @@ -1,8 +1,8 @@ - + - + @@ -88,3 +88,6 @@ + + + diff --git a/src/main/resources/mapper/PaymentOrderMapper.xml b/src/main/resources/mapper/PaymentOrderMapper.xml index 94a53ed..7494ad8 100644 --- a/src/main/resources/mapper/PaymentOrderMapper.xml +++ b/src/main/resources/mapper/PaymentOrderMapper.xml @@ -1,8 +1,8 @@ - + - + @@ -111,7 +111,7 @@ - select order_id, order_no, user_id, user_name, amount, pay_type, status, channel_order_no, code_url, qr_code, business_id, business_type, remark, create_time, update_time, create_by, update_by, delete_flag @@ -208,4 +208,6 @@ delete from payment_order where order_id = #{orderId} - \ No newline at end of file + + + diff --git a/src/main/resources/mapper/SysDeptMapper.xml b/src/main/resources/mapper/SysDeptMapper.xml new file mode 100644 index 0000000..5239200 --- /dev/null +++ b/src/main/resources/mapper/SysDeptMapper.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + id, name, parent_id, ancestors, order_num, level, status + + + + + + + + + + + + INSERT INTO sys_dept (id, name, parent_id, ancestors, order_num, level, status) + VALUES (#{id}, #{name}, #{parentId}, #{ancestors}, #{orderNum}, #{level}, #{status}) + + + + INSERT INTO sys_dept + + id, + name, + parent_id, + ancestors, + order_num, + level, + status, + + + #{id}, + #{name}, + #{parentId}, + #{ancestors}, + #{orderNum}, + #{level}, + #{status}, + + + + + UPDATE sys_dept + + name = #{name}, + parent_id = #{parentId}, + ancestors = #{ancestors}, + order_num = #{orderNum}, + level = #{level}, + status = #{status}, + + WHERE id = #{id} + + + + UPDATE sys_dept + SET name = #{name}, + parent_id = #{parentId}, + ancestors = #{ancestors}, + order_num = #{orderNum}, + level = #{level}, + status = #{status} + WHERE id = #{id} + + + + DELETE FROM sys_dept WHERE id = #{id} + + + + DELETE FROM sys_dept WHERE parent_id = #{parentId} + + + + diff --git a/src/main/resources/mapper/SysDictMapper.xml b/src/main/resources/mapper/SysDictMapper.xml index 1437f7a..964de92 100644 --- a/src/main/resources/mapper/SysDictMapper.xml +++ b/src/main/resources/mapper/SysDictMapper.xml @@ -1,8 +1,8 @@ - + - + @@ -164,3 +164,6 @@ + + + diff --git a/src/main/resources/mapper/SysLogMapper.xml b/src/main/resources/mapper/SysLogMapper.xml index b0f0a47..af21654 100644 --- a/src/main/resources/mapper/SysLogMapper.xml +++ b/src/main/resources/mapper/SysLogMapper.xml @@ -1,8 +1,8 @@ - + - + @@ -222,3 +222,6 @@ + + + diff --git a/src/main/resources/mapper/SysMenuMapper.xml b/src/main/resources/mapper/SysMenuMapper.xml index e61b581..cdf3408 100644 --- a/src/main/resources/mapper/SysMenuMapper.xml +++ b/src/main/resources/mapper/SysMenuMapper.xml @@ -1,8 +1,8 @@ - + - + @@ -110,23 +110,10 @@ - INSERT INTO sys_menu ( - - - - - ${column.name} - - - - ) VALUES - - - ( - - #{item.${column.property}} - - ) + INSERT INTO sys_menu (menu_pid, menu_name, menu_src, menu_icon, menu_style, sort, note, delete_flag) + VALUES + + (#{item.menuPid}, #{item.menuName}, #{item.menuSrc}, #{item.menuIcon}, #{item.menuStyle}, #{item.sort}, #{item.note}, #{item.deleteFlag}) @@ -168,3 +155,6 @@ + + + diff --git a/src/main/resources/mapper/SysNotificationMapper.xml b/src/main/resources/mapper/SysNotificationMapper.xml new file mode 100644 index 0000000..91d4526 --- /dev/null +++ b/src/main/resources/mapper/SysNotificationMapper.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + id, school_id, user_id, title, content, type, is_read, sender_id, sender_name, target_type, create_time + + + + INSERT INTO sys_notification + + school_id, + user_id, + title, + content, + type, + is_read, + sender_id, + sender_name, + target_type, + create_time, + + + #{schoolId}, + #{userId}, + #{title}, + #{content}, + #{type}, + #{isRead}, + #{senderId}, + #{senderName}, + #{targetType}, + #{createTime}, + + + + + INSERT INTO sys_notification + + id, + school_id, + user_id, + title, + content, + type, + is_read, + sender_id, + sender_name, + target_type, + create_time, + + + #{id}, + #{schoolId}, + #{userId}, + #{title}, + #{content}, + #{type}, + #{isRead}, + #{senderId}, + #{senderName}, + #{targetType}, + #{createTime}, + + + + + + + UPDATE sys_notification + + school_id = #{schoolId}, + user_id = #{userId}, + title = #{title}, + content = #{content}, + type = #{type}, + is_read = #{isRead}, + + WHERE id = #{id} + + + + + DELETE FROM sys_notification WHERE id = #{id} + + + + + + UPDATE sys_notification SET is_read = 1 + WHERE id = #{notificationId} AND user_id = #{userId} + + + + UPDATE sys_notification SET is_read = 1 + WHERE user_id = #{userId} AND school_id = #{schoolId} + + + + + + INSERT INTO sys_notification (school_id, user_id, title, content, type, is_read, sender_id, sender_name, target_type, create_time) + VALUES + + (#{item.schoolId}, #{item.userId}, #{item.title}, #{item.content}, #{item.type}, #{item.isRead}, #{item.senderId}, #{item.senderName}, #{item.targetType}, #{item.createTime}) + + + + + + diff --git a/src/main/resources/mapper/SysRoleMapper.xml b/src/main/resources/mapper/SysRoleMapper.xml index 8353899..3cecd4f 100644 --- a/src/main/resources/mapper/SysRoleMapper.xml +++ b/src/main/resources/mapper/SysRoleMapper.xml @@ -1,8 +1,8 @@ - + - + @@ -89,23 +89,10 @@ - INSERT INTO sys_role ( - - - - - ${column.name} - - - - ) VALUES - - - ( - - #{item.${column.property}} - - ) + INSERT INTO sys_role (role_code, role_name, create_time, remark, delete_flag) + VALUES + + (#{item.roleCode}, #{item.roleName}, #{item.createTime}, #{item.remark}, #{item.deleteFlag}) @@ -135,3 +122,6 @@ + + + diff --git a/src/main/resources/mapper/SysRolePermissionMapper.xml b/src/main/resources/mapper/SysRolePermissionMapper.xml new file mode 100644 index 0000000..df93b05 --- /dev/null +++ b/src/main/resources/mapper/SysRolePermissionMapper.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + permission_id, role_id, role_code, permission_code, permission_name, model_name, create_time, update_time + + + + INSERT INTO sys_role_permission + + permission_id, + role_id, + role_code, + permission_code, + permission_name, + model_name, + + + #{permissionId}, + #{roleId}, + #{roleCode}, + #{permissionCode}, + #{permissionName}, + #{modelName}, + + + + + INSERT INTO sys_role_permission + + permission_id, + role_id, + role_code, + permission_code, + permission_name, + model_name, + create_time, + update_time, + + + #{permissionId}, + #{roleId}, + #{roleCode}, + #{permissionCode}, + #{permissionName}, + #{modelName}, + #{createTime}, + #{updateTime}, + + + + + + + UPDATE sys_role_permission + + role_id = #{roleId}, + role_code = #{roleCode}, + permission_code = #{permissionCode}, + permission_name = #{permissionName}, + model_name = #{modelName}, + update_time = #{updateTime}, + + WHERE permission_id = #{permissionId} + + + + + DELETE FROM sys_role_permission WHERE permission_id = #{id} + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/SysUserMapper.xml b/src/main/resources/mapper/SysUserMapper.xml index a5e53b5..b4af0a1 100644 --- a/src/main/resources/mapper/SysUserMapper.xml +++ b/src/main/resources/mapper/SysUserMapper.xml @@ -1,8 +1,8 @@ - + - + @@ -19,12 +19,20 @@ + + + + + + + + @@ -32,7 +40,7 @@ @@ -82,7 +96,7 @@ - insert into sys_user(user_name, pwd, real_name, tel, email, salt, remark, create_time, enable, delete_flag, session_id, invite_code, invited_code, invited_by, user_icon) - values (#{userName}, #{pwd}, #{realName}, #{tel}, #{email}, #{salt}, #{remark}, #{createTime}, #{enable}, #{deleteFlag}, #{sessionId}, #{inviteCode}, #{invitedCode}, #{invitedBy}, #{userIcon}) + insert into sys_user(user_name, pwd, real_name, tel, email, salt, remark, create_time, enable, delete_flag, session_id, invite_code, invited_code, invited_by, user_icon, wxid, role_type, school_id) + values (#{userName}, #{pwd}, #{realName}, #{tel}, #{email}, #{salt}, #{remark}, #{createTime}, #{enable}, #{deleteFlag}, #{sessionId}, #{inviteCode}, #{invitedCode}, #{invitedBy}, #{userIcon}, #{wxid}, #{roleType}, #{schoolId}) - INSERT INTO sys_user ( - - - - - ${column.name} - - - - ) VALUES - - - ( - - #{item.${column.property}} - - ) + INSERT INTO sys_user (user_name, pwd, real_name, tel, email, salt, remark, create_time, enable, delete_flag, session_id, invite_code, invited_code, invited_by, user_icon, wxid, role_type, school_id) + VALUES + + (#{item.userName}, #{item.pwd}, #{item.realName}, #{item.tel}, #{item.email}, #{item.salt}, #{item.remark}, #{item.createTime}, #{item.enable}, #{item.deleteFlag}, #{item.sessionId}, #{item.inviteCode}, #{item.invitedCode}, #{item.invitedBy}, #{item.userIcon}, #{item.wxid}, #{item.roleType}, #{item.schoolId}) @@ -198,6 +205,15 @@ user_icon = #{userIcon}, + + wxid = #{wxid}, + + + role_type = #{roleType}, + + + school_id = #{schoolId}, + where user_id = #{userId} @@ -209,7 +225,7 @@ select - user_id, user_name, pwd, real_name, tel, email, salt, remark, create_time, enable, delete_flag, session_id, invite_code, invited_code, invited_by, user_icon + user_id, user_name, pwd, real_name, tel, email, salt, remark, create_time, enable, delete_flag, session_id, invite_code, invited_code, invited_by, user_icon, wxid, role_type, school_id from sys_user where tel = #{tel} and delete_flag = 0 limit 1 + select - user_id, user_name, pwd, real_name, tel, email, salt, remark, create_time, enable, delete_flag, session_id, invite_code, invited_code, invited_by, user_icon + user_id, user_name, pwd, real_name, tel, email, salt, remark, create_time, enable, delete_flag, session_id, invite_code, invited_code, invited_by, user_icon, wxid, role_type, school_id from sys_user where invite_code = #{inviteCode} and delete_flag = 0 limit 1 + + + + + + + + + diff --git a/src/main/resources/mapper/SysUserRoleMapper.xml b/src/main/resources/mapper/SysUserRoleMapper.xml index 1abb346..1b9ad4f 100644 --- a/src/main/resources/mapper/SysUserRoleMapper.xml +++ b/src/main/resources/mapper/SysUserRoleMapper.xml @@ -1,106 +1,136 @@ - + - - - + + + + + - - - - - - - insert into sys_user_role() - values () + + insert into sys_user_role(user_id, role_code, create_time) + values (#{userId}, #{roleCode}, #{createTime}) + + + + insert into sys_user_role + + user_id, + role_code, + create_time, + + + #{userId}, + #{roleCode}, + #{createTime}, + + + + + INSERT INTO sys_user_role (user_id, role_code, create_time) + VALUES + + (#{item.userId}, #{item.roleCode}, #{item.createTime}) + - - - - INSERT INTO sys_user_role ( - - - - - ${column.name} - - - - ) VALUES - - - ( - - #{item.${column.property}} - - ) - - - update sys_user_role + user_id = #{userId}, + role_code = #{roleCode}, + create_time = #{createTime}, - where role_id = #{roleId} + where id = #{id} - - - delete from sys_user_role where role_id = #{roleId} + + update sys_user_role + + user_id = #{userId}, + role_code = #{roleCode}, + create_time = #{createTime}, + + where id = #{id} + + + + + delete from sys_user_role where id = #{id} - + + delete from sys_user_role where user_id = #{userId} + + + + delete from sys_user_role where user_id = #{userId} and role_code = #{roleCode} + + + + + + + + diff --git a/src/main/resources/mapper/WithdrawalRecordMapper.xml b/src/main/resources/mapper/WithdrawalRecordMapper.xml deleted file mode 100644 index 8e7bf9d..0000000 --- a/src/main/resources/mapper/WithdrawalRecordMapper.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - record_id, user_id, user_name, withdrawal_amount, fee_amount, actual_amount, status, withdrawal_no, bank_name, bank_account, bank_cardholder, remark, create_time, update_time, delete_flag, create_by, update_by - - - - - - - - - - - - - - INSERT INTO withdrawal_record ( - user_id, user_name, withdrawal_amount, fee_amount, actual_amount, status, withdrawal_no, bank_name, bank_account, bank_cardholder, remark, create_time, update_time, delete_flag, create_by, update_by - ) VALUES ( - #{userId}, #{userName}, #{withdrawalAmount}, #{feeAmount}, #{actualAmount}, #{status}, #{withdrawalNo}, #{bankName}, #{bankAccount}, #{bankCardholder}, #{remark}, #{createTime}, #{updateTime}, #{deleteFlag}, #{createBy}, #{updateBy} - ) - - - - UPDATE withdrawal_record - - user_id = #{userId}, - user_name = #{userName}, - withdrawal_amount = #{withdrawalAmount}, - fee_amount = #{feeAmount}, - actual_amount = #{actualAmount}, - status = #{status}, - withdrawal_no = #{withdrawalNo}, - bank_name = #{bankName}, - bank_account = #{bankAccount}, - bank_cardholder = #{bankCardholder}, - remark = #{remark}, - create_by = #{createBy}, - update_by = #{updateBy}, - update_time = #{updateTime} - - WHERE record_id = #{recordId} - - - - UPDATE withdrawal_record - SET status = #{status}, update_time = CURRENT_TIMESTAMP - WHERE record_id = #{recordId} - - - - UPDATE withdrawal_record - SET delete_flag = 1, update_time = CURRENT_TIMESTAMP - WHERE record_id = #{recordId} - - - - DELETE FROM withdrawal_record - WHERE record_id = #{recordId} - - - \ No newline at end of file diff --git a/src/test/java/com/kexue/skills/WechatPayTest.java b/src/test/java/art/kexue/sxwz/WechatPayTest.java similarity index 99% rename from src/test/java/com/kexue/skills/WechatPayTest.java rename to src/test/java/art/kexue/sxwz/WechatPayTest.java index ac159d7..60c3e74 100644 --- a/src/test/java/com/kexue/skills/WechatPayTest.java +++ b/src/test/java/art/kexue/sxwz/WechatPayTest.java @@ -1,7 +1,7 @@ -package com.kexue.skills; +package art.kexue.sxwz; -import com.kexue.skills.entity.PaymentOrder; -import com.kexue.skills.service.PayService; +import art.kexue.sxwz.entity.PaymentOrder; +import art.kexue.sxwz.service.PayService; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; diff --git a/src/test/java/com/kexue/skills/WechatPayValidationTest.java b/src/test/java/art/kexue/sxwz/WechatPayValidationTest.java similarity index 99% rename from src/test/java/com/kexue/skills/WechatPayValidationTest.java rename to src/test/java/art/kexue/sxwz/WechatPayValidationTest.java index 3649589..5a198c2 100644 --- a/src/test/java/com/kexue/skills/WechatPayValidationTest.java +++ b/src/test/java/art/kexue/sxwz/WechatPayValidationTest.java @@ -1,6 +1,6 @@ -package com.kexue.skills; +package art.kexue.sxwz; -import com.kexue.skills.entity.PaymentOrder; +import art.kexue.sxwz.entity.PaymentOrder; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; diff --git a/src/test/java/com/hyxp/portal/PublisherApplicationTests.java b/src/test/java/com/hyxp/portal/PublisherApplicationTests.java deleted file mode 100644 index 18a25cc..0000000 --- a/src/test/java/com/hyxp/portal/PublisherApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.kexue.skills; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class PublisherApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/实训平台客户端完整需求文档(V2.0).md b/实训平台客户端完整需求文档(V2.0).md new file mode 100644 index 0000000..06c78ab --- /dev/null +++ b/实训平台客户端完整需求文档(V2.0).md @@ -0,0 +1,275 @@ +# 实训平台客户端完整需求文档(V2\.0) + +## 文档说明 + +本文档基于原始零散需求、批注优化与核心业务规则整合,**剔除疑问、统一口径、明确边界、规范格式**,形成可直接交付研发的完整客户端需求,覆盖用户体系、注册登录、通知、充值、教学管理、优秀作品、个人中心全模块。 + +## 一、核心基础规则 + +### 1\. 通用约束 + +1. **数据权限**:所有 API 查询严格校验`token`与对应用户 ID,仅允许查询当前账户信息,禁止越权访问 + +2. **数据排序**:所有数据获取接口默认按**日期最新**排序 + +3. **权限边界**:未采购平台的学校,师生仅可登录、使用基础功能,**无教学管理模块(作业 / 考试 / 课程 / 考勤)权限** + +4. **角色定义**:客户端仅支持**老师、学生**两种核心身份,无其他角色 + +### 2\. 账户体系规则(强制) + +1. **身份绑定流程**:绑定已采购院校需遵循「填身份信息→院校预校验→专属激活码→绑码校验」流程,禁止跳步 + +2. **激活码规则**:1 人 1 码、与姓名 / 学号 / 院校 / 角色强绑定,绑定后失效,无通用码 + +3. **账户状态与权限** + + - 可学用户(未绑院校):仅基础功能,无教学模块 + + - 试用用户(绑未采购院校):基础 \+ 试用功能,无教学模块 + + - 学校用户(绑已采购院校):全功能权限,开放教学模块 + + - 冻结用户:禁止登录,禁用所有功能 + +## 二、注册需求 + +### 1\. 注册方式 + +支持**手机号验证码注册、账号密码注册**两种自由注册方式,二选一。 + +### 2\. 注册必填信息 + +所有注册方式均需填写:**学校、学院、专业、年级、班级**,信息与平台组织机构库关联选择,非纯文本输入。 + +### 3\. 注册默认角色 + +自由注册默认角色为**学生**,老师角色需院校管理员后台批量创建 / 审核开通。 + +### 4\. 密码规则 + +密码需满足:**不低于 8 位,数字 \+ 字母混合**,禁止纯数字 / 纯字母。 + +## 三、登录需求 + +### 1\. 登录方式 + +老师、学生均支持 4 种登录方式:**微信扫码登录、手机号验证码登录、账号密码登录、手机号密码登录**,登录失败返回标准化错误提示。 + +### 2\. 微信登录规则 + +微信扫码登录需提前绑定微信,注册阶段同步写入`wxid`至用户表,实现微信与账户唯一绑定。 + +### 3\. 自动注册规则 + +手机号验证码登录、微信扫码登录时,**无账户则自动创建新用户**,默认角色为学生,学校 / 学院 / 专业 / 年级 / 班级信息沿用注册规则必填。 + +## 四、通知需求 + +用户(老师 / 学生)在通知中心页面可完成以下操作,解决消息漏看、状态混乱问题: + +1. **获取通知列表**:查看全部系统通知,按时间倒序排列 + +2. **查看通知详情**:点击单条通知查看完整内容 + +3. **单条通知已读**:查看详情后自动触发,变更为已读状态 + +4. **全部通知已读**:点击「全部已读」按钮,一键标记所有通知为已读 + +## 五、充值需求 + +用户在充值中心页面可完成算力充值,解决算力付费、套餐选择问题: + +1. **获取充值套餐**:展示管理员后台配置的官方充值套餐,包含套餐名称、算力额度、价格、有效期 + +2. **套餐支付**:选择固定套餐,通过**微信 / 支付宝扫码**完成支付 + +3. **自定义充值**:支持自由输入充值金额,通过**微信 / 支付宝扫码**完成支付 + +4. **支付结果**:支付成功后实时到账算力,支付失败返回失败原因 + +## 六、教学板块需求 + +### 6\.1 通用规则 + +1. **草稿定义**:未发布的作业 / 考试为**草稿**,仅可编辑 / 删除;发布后草稿修改不影响已发布内容 + +2. **发布规则**:作业 / 考试仅可发布至老师创建的课程,支持多选课程,发布后学生收到通知 + +3. **题目类型**:支持填空题、单选题、多选题、简答题,简答题支持文字作答、图片上传、文件上传(老师配置) + +### 6\.2 课程管理 + +#### 老师端(课程创建者) + +老师在课程管理页面可完成以下操作,解决班级管理、教学组织问题: + +1. **筛选学生**:按学院 / 专业 / 年级 / 班级筛选学生,返回**真实姓名、头像、用户 ID、联系方式、学号** + +2. **创建课程**:填写课程名称、封面、简介、上课时间、授课方式,支持**批量添加学生**(班级全选 / Excel 导入手机号),创建成功后通知学生 + +3. **管理课程**:修改课程信息(已结课课程不可编辑)、删除草稿状态课程 + +4. **查看课程列表**:查看自己创建的所有课程,展示课程名、上课时间、状态 + +5. **课程学生管理**:查看课程内学生列表、批量添加学生、踢出学生(踢出后保留作业 / 考试数据),操作后通知学生 + +6. **导出成绩**:选择课程内考试,导出 Excel 成绩表,包含姓名、学号、平均分、分数、排名、总评成绩 + +#### 学生端 + +学生在课程中心页面可完成以下操作,解决课程学习、信息查看问题: + +1. **查看课程**:展示已加入的课程,包含课程标题、老师、封面、上课时间 + +2. **查看课程内容**:查看课程内作业、考试、考勤信息 + +### 6\.3 作业管理 + +#### 老师端 + +老师在作业管理页面可完成以下操作,解决作业布置、批改、管理问题: + +1. **作业草稿管理**:创建、编辑、删除作业草稿,草稿包含名称、要求、题目、是否允许迟交、截止时间 + +2. **发布作业**:将草稿发布至课程,设置开始 / 截止时间,通知课程内学生 + +3. **查看作业列表**:查看课程内作业,展示标题、截止时间、提交情况、批改状态 + +4. **作业批改管理**:查看学生提交详情、批改作业(打分 \+ 评语)、修改分数、批量退回作业(设置重交截止时间,通知学生) + +5. **优秀标记**:将学生作业标记为优秀 / 取消优秀 + +6. **删除作业**:删除作业及已提交 / 批改数据 + +#### 学生端 + +学生在作业页面可完成以下操作,解决作业提交、修改、重做问题: + +1. **查看作业**:查看课程内作业列表,展示标题、时间、提交状态、迟交权限 + +2. **提交作业**:按题目要求作答,支持文字 / 图片 / 文件 + +3. **修改作业**:截止时间前可修改已提交作业 + +4. **重做作业**:按老师退回要求,在截止时间前重新提交 + +### 6\.4 考试管理 + +#### 老师端 + +老师在考试管理页面可完成以下操作,解决考试组织、阅卷、补考问题: + +1. **考试草稿管理**:创建、编辑、删除考试草稿,草稿包含名称、要求、考卷、时间 + +2. **发布考试**:将草稿发布至课程,设置开始 / 截止时间、考试时长,通知学生 + +3. **查看考试列表**:查看课程内考试,展示名称、时间、时长、状态、提交情况 + +4. **考试阅卷管理**:查看学生答卷、打分、写评语、修改分数 + +5. **补考管理**:筛选不及格学生,创建并发布补考,补考成绩规则:及格覆盖原成绩,超上限按上限计分 + +6. **删除考试**:删除考试及学生答卷数据 + +#### 学生端 + +学生在考试页面可完成以下操作,解决考试参与、补考问题: + +1. **查看考试**:查看课程内考试列表,展示名称、时间、状态、分数 + +2. **参加考试**:在考试时间内进入答题页,倒计时作答,超时强制提交(切页视为空提交) + +3. **参加补考**:完成老师发布的补考并提交 + +### 6\.5 考勤管理 + +#### 老师端 + +老师在考勤页面可完成以下操作,解决课堂签到、统计问题: + +1. **发起签到**:课程内开启签到,设置时长,支持**二维码签到、手动点名**两种方式,通知所有学生 + +2. **管理签到**:查看全部签到记录(名称、时间、状态、出勤统计)、查看单次签到详情、修改学生考勤状态(出勤 / 迟到 / 缺勤 / 请假),手动点名可添加备注 + +3. **签到规则**:未签到自动标记为旷课,签到记录按开始时间命名 + +#### 学生端 + +学生在考勤页面可完成以下操作,解决签到、查看考勤问题: + +1. **扫码签到**:扫描老师二维码完成签到 + +2. **查看考勤**:查看所有考勤记录与个人状态(出勤 / 迟到 / 缺勤 / 请假) + +## 七、优秀作品需求 + +用户在优秀作品页面可完成以下操作,解决作品展示、互动问题: + +1. **查看优秀作品**:获取所有老师标记的优秀作业 / 考试作品 + +2. **作品互动**:老师 / 学生可对作品点赞,**每个作品仅可点赞 1 次** + +## 八、个人中心需求 + +用户在个人中心页面可完成以下操作,解决信息管理、账单查看问题: + +1. **查看个人信息**:展示部门、昵称、手机号、头像 + +2. **查看消费记录**:查看算力消耗、获取明细 + +3. **查看订单记录**:查看所有充值订单(已支付 / 未支付) + +4. **修改基础信息**:修改昵称、头像 + +5. **修改密码** + + - 正常修改:输入原密码 \+ 新密码,新密码需符合规则且与原密码不同 + + - 找回密码:忘记原密码可通过手机号验证码修改 + + - 规则:修改后强制重新登录,返回标准化错误提示 + +6. **修改绑定手机号** + + - 流程:验证原手机号→输入新手机号→双重验证码校验 + + - 规则:手机号 11 位格式校验、唯一性校验,验证码 5 分钟有效、60 秒内仅可发送 1 次 + + - 异常:返回验证码错误、过期、手机号已占用等提示 + +## 九、异常处理与提示规范 + +所有功能异常返回统一提示语: + +1. 原密码错误:原密码错误,请重新输入 + +2. 新密码重复:新密码不能与原密码相同 + +3. 验证码错误:验证码错误,请重新输入 + +4. 验证码过期:验证码已过期,请重新获取 + +5. 手机号已占用:该手机号已被其他账号使用 + +6. 操作失败:修改失败,请稍后重试 + +7. 越权访问:无权限访问该数据,请核对账号信息 + +## 十、研发强制红线 + +1. **权限双重校验**:前端展示 \+ 后端接口双重校验账户状态与权限,禁止越权 + +2. **数据隔离**:用户数据严格按 ID 隔离,token 校验不通过直接拒绝请求 + +3. **操作留痕**:课程 / 作业 / 考试 / 考勤 / 充值操作全量日志留存≥1 年,不可篡改 + +4. **流程不可逆**:院校绑定、注册登录、作业考试发布流程严格按文档执行,禁止绕过规则 + +--- + +要不要我把这份需求**按研发视角拆分为接口清单 \+ 页面原型说明**,直接交付开发团队使用? + +当前文件内容过长,豆包只阅读了前 63%。 + +> (注:文档部分内容可能由 AI 生成) diff --git a/数据导入模板-学生批量绑定到课程.xlsx b/数据导入模板-学生批量绑定到课程.xlsx new file mode 100644 index 0000000..6f5e1b0 Binary files /dev/null and b/数据导入模板-学生批量绑定到课程.xlsx differ