Compare commits
4 Commits
feature/coupon
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 8da58a8f51 | |||
| 0b2146f237 | |||
| 7cc9a68144 | |||
| b5c8a087dd |
@@ -14,6 +14,7 @@
|
|||||||
3. [团课管理接口](#团课管理接口)
|
3. [团课管理接口](#团课管理接口)
|
||||||
- [获取所有团课](#获取所有团课)
|
- [获取所有团课](#获取所有团课)
|
||||||
- [分页获取团课](#分页获取团课)
|
- [分页获取团课](#分页获取团课)
|
||||||
|
- [多条件查询团课](#多条件查询团课)
|
||||||
- [根据ID获取团课详情](#根据ID获取团课详情)
|
- [根据ID获取团课详情](#根据ID获取团课详情)
|
||||||
- [创建团课](#创建团课)
|
- [创建团课](#创建团课)
|
||||||
- [更新团课](#更新团课)
|
- [更新团课](#更新团课)
|
||||||
@@ -154,6 +155,149 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### 多条件查询团课
|
||||||
|
|
||||||
|
| 属性 | 值 |
|
||||||
|
|------|-----|
|
||||||
|
| **HTTP方法** | POST |
|
||||||
|
| **接口路径** | `/api/groupCourse/search` |
|
||||||
|
| **所属文件** | `GroupCourseHandler.java` |
|
||||||
|
|
||||||
|
**功能说明**: 支持团课名称模糊查询、类型筛选、日期范围、时间段、价格排序、剩余名额排序等多条件组合查询,默认不查询不可预约的团课(已取消或已结束)。
|
||||||
|
|
||||||
|
**请求体**:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"courseName": "瑜伽",
|
||||||
|
"courseType": 1,
|
||||||
|
"startDate": "2026-06-01T00:00:00",
|
||||||
|
"endDate": "2026-06-30T23:59:59",
|
||||||
|
"timePeriod": "morning",
|
||||||
|
"priceSort": "asc",
|
||||||
|
"remainingMost": true,
|
||||||
|
"page": 0,
|
||||||
|
"size": 10
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
||||||
|
|--------|------|------|--------|------|
|
||||||
|
| courseName | String | 否 | - | 课程名称(模糊查询,不区分大小写) |
|
||||||
|
| courseType | Long | 否 | - | 课程类型ID |
|
||||||
|
| startDate | LocalDateTime | 否 | - | 查询开始日期 |
|
||||||
|
| endDate | LocalDateTime | 否 | - | 查询结束日期 |
|
||||||
|
| timePeriod | String | 否 | - | 时间段:`morning`(6:00-12:00)、`afternoon`(12:00-18:00)、`evening`(18:00-24:00) |
|
||||||
|
| priceSort | String | 否 | - | 价格排序:`asc`(从低到高)、`desc`(从高到低) |
|
||||||
|
| remainingMost | Boolean | 否 | false | 是否按剩余名额最多排序 |
|
||||||
|
| page | Integer | 否 | 0 | 页码,从0开始 |
|
||||||
|
| size | Integer | 否 | 10 | 每页数量,最大100 |
|
||||||
|
|
||||||
|
**查询条件优先级说明**:
|
||||||
|
|
||||||
|
| 优先级 | 条件类型 | 说明 |
|
||||||
|
|--------|----------|------|
|
||||||
|
| 1 | 默认过滤 | 自动过滤已删除和不可预约的团课(status != 0) |
|
||||||
|
| 2 | 基础筛选 | courseName、courseType、startDate、endDate、timePeriod |
|
||||||
|
| 3 | 排序规则 | remainingMost优先,其次priceSort,默认按startTime升序 |
|
||||||
|
|
||||||
|
**成功响应** (200 OK):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"message": "查询成功",
|
||||||
|
"data": {
|
||||||
|
"content": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"courseName": "瑜伽入门",
|
||||||
|
"coachId": 1,
|
||||||
|
"courseType": 1,
|
||||||
|
"startTime": "2026-06-15T09:00:00",
|
||||||
|
"endTime": "2026-06-15T10:00:00",
|
||||||
|
"maxMembers": 20,
|
||||||
|
"currentMembers": 5,
|
||||||
|
"status": 0,
|
||||||
|
"location": "健身房A区",
|
||||||
|
"coverImage": "https://example.com/yoga.jpg",
|
||||||
|
"description": "适合初学者的瑜伽课程",
|
||||||
|
"pointCardAmount": 1,
|
||||||
|
"storedValueAmount": 50.00,
|
||||||
|
"createdAt": "2026-06-01T10:00:00",
|
||||||
|
"updatedAt": "2026-06-01T10:00:00"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"totalPages": 3,
|
||||||
|
"totalElements": 25,
|
||||||
|
"currentPage": 0,
|
||||||
|
"pageSize": 10,
|
||||||
|
"first": true,
|
||||||
|
"last": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**失败响应** (400 Bad Request):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"message": "查询失败的原因"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**使用示例**:
|
||||||
|
|
||||||
|
1. **查询瑜伽课程**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"courseName": "瑜伽"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **查询特定类型的早晨课程**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"courseType": 1,
|
||||||
|
"timePeriod": "morning"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **查询下周的课程,按价格从低到高排序**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"startDate": "2026-06-16T00:00:00",
|
||||||
|
"endDate": "2026-06-22T23:59:59",
|
||||||
|
"priceSort": "asc"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **查询剩余名额最多的晚间课程**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"timePeriod": "evening",
|
||||||
|
"remainingMost": true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **多条件组合查询**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"courseName": "瑜伽",
|
||||||
|
"courseType": 1,
|
||||||
|
"startDate": "2026-06-01T00:00:00",
|
||||||
|
"endDate": "2026-06-30T23:59:59",
|
||||||
|
"timePeriod": "morning",
|
||||||
|
"priceSort": "asc",
|
||||||
|
"remainingMost": true,
|
||||||
|
"page": 0,
|
||||||
|
"size": 10
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### 根据ID获取团课详情
|
### 根据ID获取团课详情
|
||||||
|
|
||||||
| 属性 | 值 |
|
| 属性 | 值 |
|
||||||
@@ -460,26 +604,26 @@
|
|||||||
| 属性 | 值 |
|
| 属性 | 值 |
|
||||||
|------|-----|
|
|------|-----|
|
||||||
| **HTTP方法** | POST |
|
| **HTTP方法** | POST |
|
||||||
| **接口路径** | `/api/groupCourse/{courseId}/signin` |
|
| **接口路径** | `/api/groupCourse/signin/{memberId}` |
|
||||||
| **所属文件** | `GroupCourseHandler.java` |
|
| **所属文件** | `GroupCourseHandler.java` |
|
||||||
|
|
||||||
**路径参数**:
|
**路径参数**:
|
||||||
|
|
||||||
| 参数名 | 类型 | 必填 | 说明 |
|
| 参数名 | 类型 | 必填 | 说明 |
|
||||||
|--------|------|------|------|
|
|--------|------|------|------|
|
||||||
| courseId | Long | 是 | 团课ID |
|
| memberId | Long | 是 | 会员ID |
|
||||||
|
|
||||||
**请求体**:
|
**请求体**:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"memberId": 1001
|
"courseId": 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
| 参数名 | 类型 | 必填 | 说明 |
|
| 参数名 | 类型 | 必填 | 说明 |
|
||||||
|--------|------|------|------|
|
|--------|------|------|------|
|
||||||
| memberId | Long | **是** | 会员ID |
|
| courseId | Long | **是** | 团课ID |
|
||||||
|
|
||||||
**成功响应** (200 OK):
|
**成功响应** (200 OK):
|
||||||
|
|
||||||
@@ -494,16 +638,39 @@
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**失败响应** (400 Bad Request):
|
**失败响应** (400 Bad Request) —— 校验规则及对应错误信息:
|
||||||
|
|
||||||
|
| 序号 | 校验规则 | 错误信息 |
|
||||||
|
|------|----------|----------|
|
||||||
|
| 1 | 团课不存在或已被删除 | `团课不存在或已删除` |
|
||||||
|
| 2 | 团课状态为"已取消" | `团课已取消,无法签到` |
|
||||||
|
| 3 | 团课状态为"已结束" | `团课已结束,无法签到` |
|
||||||
|
| 4 | 当前时间早于开课前2小时 | `未到签到时间,请在开课前2小时内签到` |
|
||||||
|
| 5 | 当前时间晚于团课结束时间 | `团课已结束,无法签到` |
|
||||||
|
| 6 | 课程当前人数已达上限 | `课程已满员,无法签到` |
|
||||||
|
| 7 | 用户今日无到店签到记录 | `请先完成到店签到` |
|
||||||
|
| 8 | 到店签到状态非SUCCESS | `到店签到未成功,请重新签到` |
|
||||||
|
| 9 | 用户未预约此课程 | `您未预约此课程,无法签到` |
|
||||||
|
| - | 请求体为空 | `请求体不能为空` |
|
||||||
|
| - | 请求体缺少courseId | `courseId不能为空` |
|
||||||
|
|
||||||
|
> **说明**: 校验按上表顺序依次执行,命中第一个失败条件即返回对应错误信息。
|
||||||
|
|
||||||
|
**失败响应示例**:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"success": false,
|
"success": false,
|
||||||
"message": "课程已满员"
|
"message": "未到签到时间,请在开课前2小时内签到"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"message": "您未预约此课程,无法签到"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### 删除团课
|
### 删除团课
|
||||||
|
|
||||||
@@ -1493,7 +1660,14 @@
|
|||||||
### 团课管理
|
### 团课管理
|
||||||
1. **创建团课**:课程名称为必填项
|
1. **创建团课**:课程名称为必填项
|
||||||
2. **取消团课**:需提前24小时通知,否则拒绝操作
|
2. **取消团课**:需提前24小时通知,否则拒绝操作
|
||||||
3. **团课签到**:验证课程状态必须为正常,且未达最大人数限制
|
3. **团课签到**:严格按以下顺序校验,任一不通过即拒绝签到:
|
||||||
|
- 团课是否存在且未被删除
|
||||||
|
- 团课状态不为"已取消"
|
||||||
|
- 团课状态不为"已结束"(含已过结束时间)
|
||||||
|
- 当前时间在开课前2小时内(签到时间窗口)
|
||||||
|
- 课程当前人数未达到最大人数上限
|
||||||
|
- 用户今日已成功到店签到(查询 sign_in_record 表当日 SUCCESS 记录)
|
||||||
|
- 用户已预约该课程(有效预约)
|
||||||
4. **删除团课**:采用软删除机制,数据保留可恢复
|
4. **删除团课**:采用软删除机制,数据保留可恢复
|
||||||
|
|
||||||
### 团课预约
|
### 团课预约
|
||||||
|
|||||||
@@ -0,0 +1,530 @@
|
|||||||
|
# 团课推荐模块 API 文档
|
||||||
|
|
||||||
|
> **文档版本**: v1.0
|
||||||
|
> **创建日期**: 2026-06-15
|
||||||
|
> **作者**: 张翔
|
||||||
|
> **状态**: 正式发布
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📋 目录
|
||||||
|
|
||||||
|
1. [概述](#概述)
|
||||||
|
2. [基础路径](#基础路径)
|
||||||
|
3. [团课推荐管理接口](#团课推荐管理接口)
|
||||||
|
- [获取所有团课推荐](#获取所有团课推荐)
|
||||||
|
- [获取所有启用的团课推荐](#获取所有启用的团课推荐)
|
||||||
|
- [根据ID获取团课推荐](#根据ID获取团课推荐)
|
||||||
|
- [根据团课ID获取推荐](#根据团课ID获取推荐)
|
||||||
|
- [创建团课推荐](#创建团课推荐)
|
||||||
|
- [更新团课推荐](#更新团课推荐)
|
||||||
|
- [删除团课推荐](#删除团课推荐)
|
||||||
|
- [启用团课推荐](#启用团课推荐)
|
||||||
|
- [禁用团课推荐](#禁用团课推荐)
|
||||||
|
4. [数据模型](#数据模型)
|
||||||
|
- [GroupCourseRecommend(团课推荐)](#GroupCourseRecommend团课推荐)
|
||||||
|
5. [状态码说明](#状态码说明)
|
||||||
|
6. [业务规则](#业务规则)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 概述
|
||||||
|
|
||||||
|
团课推荐模块提供团课推荐信息的创建、编辑、查询、删除和状态管理功能。推荐信息包含团课ID、推荐标题、推荐内容、推荐理由、优先级等必要信息,支持按优先级排序展示。
|
||||||
|
|
||||||
|
## 基础路径
|
||||||
|
|
||||||
|
所有接口的基础路径为: `http://{host}:{port}/api/groupCourse/recommend`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 团课推荐管理接口
|
||||||
|
|
||||||
|
### 获取所有团课推荐
|
||||||
|
|
||||||
|
| 属性 | 值 |
|
||||||
|
|------|-----|
|
||||||
|
| **HTTP方法** | GET |
|
||||||
|
| **接口路径** | `/api/groupCourse/recommend/list` |
|
||||||
|
| **所属文件** | `GroupCourseRecommendHandler.java` |
|
||||||
|
|
||||||
|
**请求参数**:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
||||||
|
|--------|------|------|--------|------|
|
||||||
|
| sortBy | string | 否 | priority | 排序字段(支持:priority、createdAt、updatedAt) |
|
||||||
|
| sortOrder | string | 否 | desc | 排序方式(asc-升序,desc-降序) |
|
||||||
|
|
||||||
|
**成功响应** (200 OK):
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"courseId": 1,
|
||||||
|
"recommendTitle": "本周热门课程",
|
||||||
|
"recommendContent": "这是一门非常棒的课程,快来参加吧!",
|
||||||
|
"recommendReason": "教练专业,课程内容丰富",
|
||||||
|
"priority": 10,
|
||||||
|
"isActive": true,
|
||||||
|
"groupCourse": {
|
||||||
|
"id": 1,
|
||||||
|
"courseName": "瑜伽入门",
|
||||||
|
"coachId": 1,
|
||||||
|
"courseType": 1,
|
||||||
|
"startTime": "2026-06-15T09:00:00",
|
||||||
|
"endTime": "2026-06-15T10:00:00",
|
||||||
|
"maxMembers": 20,
|
||||||
|
"currentMembers": 15,
|
||||||
|
"status": 0,
|
||||||
|
"location": "健身房A区",
|
||||||
|
"coverImage": "https://example.com/yoga.jpg",
|
||||||
|
"description": "适合初学者的瑜伽课程"
|
||||||
|
},
|
||||||
|
"createdAt": "2026-06-15T10:00:00",
|
||||||
|
"updatedAt": "2026-06-15T10:00:00"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 获取所有启用的团课推荐
|
||||||
|
|
||||||
|
| 属性 | 值 |
|
||||||
|
|------|-----|
|
||||||
|
| **HTTP方法** | GET |
|
||||||
|
| **接口路径** | `/api/groupCourse/recommend/active` |
|
||||||
|
| **所属文件** | `GroupCourseRecommendHandler.java` |
|
||||||
|
|
||||||
|
**功能说明**: 获取系统中所有已启用的团课推荐列表,按优先级从高到低排序。
|
||||||
|
|
||||||
|
**成功响应** (200 OK):
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"courseId": 3,
|
||||||
|
"recommendTitle": "新学员推荐",
|
||||||
|
"recommendContent": "专为新学员设计的入门课程,轻松上手",
|
||||||
|
"recommendReason": "零基础友好,教练耐心指导",
|
||||||
|
"priority": 20,
|
||||||
|
"isActive": true,
|
||||||
|
"groupCourse": {
|
||||||
|
"id": 3,
|
||||||
|
"courseName": "基础有氧",
|
||||||
|
"coachId": 2,
|
||||||
|
"courseType": 2,
|
||||||
|
"startTime": "2026-06-16T18:00:00",
|
||||||
|
"endTime": "2026-06-16T19:00:00",
|
||||||
|
"maxMembers": 30,
|
||||||
|
"currentMembers": 8,
|
||||||
|
"status": 0,
|
||||||
|
"location": "健身房B区",
|
||||||
|
"coverImage": "https://example.com/aerobic.jpg",
|
||||||
|
"description": "适合所有健身水平的有氧课程"
|
||||||
|
},
|
||||||
|
"createdAt": "2026-06-15T11:00:00",
|
||||||
|
"updatedAt": "2026-06-15T11:00:00"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 根据ID获取团课推荐
|
||||||
|
|
||||||
|
| 属性 | 值 |
|
||||||
|
|------|-----|
|
||||||
|
| **HTTP方法** | GET |
|
||||||
|
| **接口路径** | `/api/groupCourse/recommend/{id}` |
|
||||||
|
| **所属文件** | `GroupCourseRecommendHandler.java` |
|
||||||
|
|
||||||
|
**路径参数**:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必填 | 说明 |
|
||||||
|
|--------|------|------|------|
|
||||||
|
| id | Long | 是 | 团课推荐ID |
|
||||||
|
|
||||||
|
**成功响应** (200 OK):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"courseId": 1,
|
||||||
|
"recommendTitle": "本周热门课程",
|
||||||
|
"recommendContent": "这是一门非常棒的课程,快来参加吧!",
|
||||||
|
"recommendReason": "教练专业,课程内容丰富",
|
||||||
|
"priority": 10,
|
||||||
|
"isActive": true,
|
||||||
|
"groupCourse": {
|
||||||
|
"id": 1,
|
||||||
|
"courseName": "瑜伽入门",
|
||||||
|
"coachId": 1,
|
||||||
|
"courseType": 1,
|
||||||
|
"startTime": "2026-06-15T09:00:00",
|
||||||
|
"endTime": "2026-06-15T10:00:00",
|
||||||
|
"maxMembers": 20,
|
||||||
|
"currentMembers": 15,
|
||||||
|
"status": 0,
|
||||||
|
"location": "健身房A区",
|
||||||
|
"coverImage": "https://example.com/yoga.jpg",
|
||||||
|
"description": "适合初学者的瑜伽课程"
|
||||||
|
},
|
||||||
|
"createdAt": "2026-06-15T10:00:00",
|
||||||
|
"updatedAt": "2026-06-15T10:00:00"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**失败响应** (404 Not Found):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 根据团课ID获取推荐
|
||||||
|
|
||||||
|
| 属性 | 值 |
|
||||||
|
|------|-----|
|
||||||
|
| **HTTP方法** | GET |
|
||||||
|
| **接口路径** | `/api/groupCourse/recommend/course/{courseId}` |
|
||||||
|
| **所属文件** | `GroupCourseRecommendHandler.java` |
|
||||||
|
|
||||||
|
**路径参数**:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必填 | 说明 |
|
||||||
|
|--------|------|------|------|
|
||||||
|
| courseId | Long | 是 | 团课ID |
|
||||||
|
|
||||||
|
**成功响应** (200 OK):
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"courseId": 1,
|
||||||
|
"recommendTitle": "本周热门课程",
|
||||||
|
"recommendContent": "这是一门非常棒的课程,快来参加吧!",
|
||||||
|
"recommendReason": "教练专业,课程内容丰富",
|
||||||
|
"priority": 10,
|
||||||
|
"isActive": true,
|
||||||
|
"groupCourse": {
|
||||||
|
"id": 1,
|
||||||
|
"courseName": "瑜伽入门",
|
||||||
|
"coachId": 1,
|
||||||
|
"courseType": 1,
|
||||||
|
"startTime": "2026-06-15T09:00:00",
|
||||||
|
"endTime": "2026-06-15T10:00:00",
|
||||||
|
"maxMembers": 20,
|
||||||
|
"currentMembers": 15,
|
||||||
|
"status": 0,
|
||||||
|
"location": "健身房A区"
|
||||||
|
},
|
||||||
|
"createdAt": "2026-06-15T10:00:00",
|
||||||
|
"updatedAt": "2026-06-15T10:00:00"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 创建团课推荐
|
||||||
|
|
||||||
|
| 属性 | 值 |
|
||||||
|
|------|-----|
|
||||||
|
| **HTTP方法** | POST |
|
||||||
|
| **接口路径** | `/api/groupCourse/recommend` |
|
||||||
|
| **所属文件** | `GroupCourseRecommendHandler.java` |
|
||||||
|
|
||||||
|
**请求体**:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"courseId": 1,
|
||||||
|
"recommendTitle": "本周热门课程",
|
||||||
|
"recommendContent": "这是一门非常棒的课程,快来参加吧!",
|
||||||
|
"recommendReason": "教练专业,课程内容丰富",
|
||||||
|
"priority": 10,
|
||||||
|
"isActive": true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
||||||
|
|--------|------|------|--------|------|
|
||||||
|
| courseId | Long | **是** | - | 团课ID(必须是有效的团课) |
|
||||||
|
| recommendTitle | String | 否 | - | 推荐标题 |
|
||||||
|
| recommendContent | String | 否 | - | 推荐内容 |
|
||||||
|
| recommendReason | String | 否 | - | 推荐理由 |
|
||||||
|
| priority | Integer | 否 | 0 | 优先级(数字越大优先级越高) |
|
||||||
|
| isActive | Boolean | 否 | true | 是否启用 |
|
||||||
|
|
||||||
|
**成功响应** (200 OK):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"message": "团课推荐创建成功",
|
||||||
|
"data": {
|
||||||
|
"id": 1,
|
||||||
|
"courseId": 1,
|
||||||
|
"recommendTitle": "本周热门课程",
|
||||||
|
"recommendContent": "这是一门非常棒的课程,快来参加吧!",
|
||||||
|
"recommendReason": "教练专业,课程内容丰富",
|
||||||
|
"priority": 10,
|
||||||
|
"isActive": true,
|
||||||
|
"createdAt": "2026-06-15T10:00:00",
|
||||||
|
"updatedAt": "2026-06-15T10:00:00"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**失败响应** (400 Bad Request):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"message": "团课ID不能为空"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 更新团课推荐
|
||||||
|
|
||||||
|
| 属性 | 值 |
|
||||||
|
|------|-----|
|
||||||
|
| **HTTP方法** | PUT |
|
||||||
|
| **接口路径** | `/api/groupCourse/recommend/{id}` |
|
||||||
|
| **所属文件** | `GroupCourseRecommendHandler.java` |
|
||||||
|
|
||||||
|
**路径参数**:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必填 | 说明 |
|
||||||
|
|--------|------|------|------|
|
||||||
|
| id | Long | 是 | 团课推荐ID |
|
||||||
|
|
||||||
|
**请求体**:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"recommendTitle": "本周热门课程(更新)",
|
||||||
|
"recommendContent": "更新后的推荐内容",
|
||||||
|
"recommendReason": "更新后的推荐理由",
|
||||||
|
"priority": 15,
|
||||||
|
"isActive": true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必填 | 说明 |
|
||||||
|
|--------|------|------|------|
|
||||||
|
| courseId | Long | 否 | 团课ID |
|
||||||
|
| recommendTitle | String | 否 | 推荐标题 |
|
||||||
|
| recommendContent | String | 否 | 推荐内容 |
|
||||||
|
| recommendReason | String | 否 | 推荐理由 |
|
||||||
|
| priority | Integer | 否 | 优先级 |
|
||||||
|
| isActive | Boolean | 否 | 是否启用 |
|
||||||
|
|
||||||
|
**成功响应** (200 OK):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"message": "团课推荐更新成功",
|
||||||
|
"data": {
|
||||||
|
"id": 1,
|
||||||
|
"courseId": 1,
|
||||||
|
"recommendTitle": "本周热门课程(更新)",
|
||||||
|
"recommendContent": "更新后的推荐内容",
|
||||||
|
"recommendReason": "更新后的推荐理由",
|
||||||
|
"priority": 15,
|
||||||
|
"isActive": true,
|
||||||
|
"updatedAt": "2026-06-15T12:00:00"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**失败响应** (400 Bad Request):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"message": "团课推荐不存在"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 删除团课推荐
|
||||||
|
|
||||||
|
| 属性 | 值 |
|
||||||
|
|------|-----|
|
||||||
|
| **HTTP方法** | DELETE |
|
||||||
|
| **接口路径** | `/api/groupCourse/recommend/{id}` |
|
||||||
|
| **所属文件** | `GroupCourseRecommendHandler.java` |
|
||||||
|
|
||||||
|
**路径参数**:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必填 | 说明 |
|
||||||
|
|--------|------|------|------|
|
||||||
|
| id | Long | 是 | 团课推荐ID |
|
||||||
|
|
||||||
|
**成功响应** (200 OK):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"message": "团课推荐删除成功"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**失败响应** (400 Bad Request):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"message": "团课推荐不存在"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 启用团课推荐
|
||||||
|
|
||||||
|
| 属性 | 值 |
|
||||||
|
|------|-----|
|
||||||
|
| **HTTP方法** | POST |
|
||||||
|
| **接口路径** | `/api/groupCourse/recommend/{id}/enable` |
|
||||||
|
| **所属文件** | `GroupCourseRecommendHandler.java` |
|
||||||
|
|
||||||
|
**路径参数**:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必填 | 说明 |
|
||||||
|
|--------|------|------|------|
|
||||||
|
| id | Long | 是 | 团课推荐ID |
|
||||||
|
|
||||||
|
**成功响应** (200 OK):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"message": "团课推荐启用成功",
|
||||||
|
"data": {
|
||||||
|
"id": 1,
|
||||||
|
"courseId": 1,
|
||||||
|
"recommendTitle": "本周热门课程",
|
||||||
|
"isActive": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**失败响应** (400 Bad Request):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"message": "团课推荐不存在"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 禁用团课推荐
|
||||||
|
|
||||||
|
| 属性 | 值 |
|
||||||
|
|------|-----|
|
||||||
|
| **HTTP方法** | POST |
|
||||||
|
| **接口路径** | `/api/groupCourse/recommend/{id}/disable` |
|
||||||
|
| **所属文件** | `GroupCourseRecommendHandler.java` |
|
||||||
|
|
||||||
|
**路径参数**:
|
||||||
|
|
||||||
|
| 参数名 | 类型 | 必填 | 说明 |
|
||||||
|
|--------|------|------|------|
|
||||||
|
| id | Long | 是 | 团课推荐ID |
|
||||||
|
|
||||||
|
**成功响应** (200 OK):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"message": "团课推荐禁用成功",
|
||||||
|
"data": {
|
||||||
|
"id": 1,
|
||||||
|
"courseId": 1,
|
||||||
|
"recommendTitle": "本周热门课程",
|
||||||
|
"isActive": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**失败响应** (400 Bad Request):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"message": "团课推荐不存在"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 数据模型
|
||||||
|
|
||||||
|
### GroupCourseRecommend(团课推荐)
|
||||||
|
|
||||||
|
| 字段名 | 类型 | 说明 |
|
||||||
|
|--------|------|------|
|
||||||
|
| id | Long | 主键ID |
|
||||||
|
| courseId | Long | 团课ID(关联group_course.id) |
|
||||||
|
| recommendTitle | String | 推荐标题 |
|
||||||
|
| recommendContent | String | 推荐内容 |
|
||||||
|
| recommendReason | String | 推荐理由 |
|
||||||
|
| priority | Integer | 优先级(数字越大优先级越高),默认0 |
|
||||||
|
| isActive | Boolean | 是否启用,默认true |
|
||||||
|
| groupCourse | GroupCourse | 关联的团课信息(查询时自动填充) |
|
||||||
|
| createdBy | String | 创建人 |
|
||||||
|
| updatedBy | String | 更新人 |
|
||||||
|
| createdAt | LocalDateTime | 创建时间 |
|
||||||
|
| updatedAt | LocalDateTime | 更新时间 |
|
||||||
|
| deletedAt | LocalDateTime | 删除时间(软删除) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 状态码说明
|
||||||
|
|
||||||
|
### 推荐状态
|
||||||
|
|
||||||
|
| 状态值 | 含义 |
|
||||||
|
|--------|------|
|
||||||
|
| true | 启用 |
|
||||||
|
| false | 禁用 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 业务规则
|
||||||
|
|
||||||
|
### 团课推荐管理
|
||||||
|
1. **创建推荐**:团课ID为必填项,且必须是有效的团课
|
||||||
|
2. **优先级排序**:获取启用的推荐列表时,按优先级从高到低排序
|
||||||
|
3. **删除推荐**:采用软删除机制,数据保留可恢复
|
||||||
|
4. **状态管理**:支持启用/禁用推荐状态,禁用的推荐不会在推荐列表中显示
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 附录:错误响应格式
|
||||||
|
|
||||||
|
所有接口的错误响应统一格式:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"message": "错误描述信息"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*文档结束*
|
||||||
@@ -86,6 +86,25 @@
|
|||||||
<artifactId>gym-member</artifactId>
|
<artifactId>gym-member</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- ZXing二维码生成库 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.zxing</groupId>
|
||||||
|
<artifactId>core</artifactId>
|
||||||
|
<version>3.5.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.zxing</groupId>
|
||||||
|
<artifactId>javase</artifactId>
|
||||||
|
<version>3.5.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 阿里云OSS SDK -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun.oss</groupId>
|
||||||
|
<artifactId>aliyun-sdk-oss</artifactId>
|
||||||
|
<version>3.17.1</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
+184
-1
@@ -1,16 +1,19 @@
|
|||||||
|
|
||||||
package cn.novalon.gym.manage.groupcourse.dao;
|
package cn.novalon.gym.manage.groupcourse.dao;
|
||||||
|
|
||||||
|
import cn.novalon.gym.manage.groupcourse.dto.GroupCourseQueryDto;
|
||||||
import cn.novalon.gym.manage.groupcourse.entity.GroupCourseEntity;
|
import cn.novalon.gym.manage.groupcourse.entity.GroupCourseEntity;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.r2dbc.repository.Modifying;
|
import org.springframework.data.r2dbc.repository.Modifying;
|
||||||
import org.springframework.data.r2dbc.repository.Query;
|
import org.springframework.data.r2dbc.repository.Query;
|
||||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||||
|
import org.springframework.r2dbc.core.DatabaseClient;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface GroupCourseDao extends R2dbcRepository<GroupCourseEntity, Long> {
|
public interface GroupCourseDao extends R2dbcRepository<GroupCourseEntity, Long> {
|
||||||
@@ -38,4 +41,184 @@ public interface GroupCourseDao extends R2dbcRepository<GroupCourseEntity, Long>
|
|||||||
Mono<Integer> softDelete(Long id, LocalDateTime deletedAt);
|
Mono<Integer> softDelete(Long id, LocalDateTime deletedAt);
|
||||||
|
|
||||||
Flux<GroupCourseEntity> findByCourseTypeAndDeletedAtIsNull(Long courseType);
|
Flux<GroupCourseEntity> findByCourseTypeAndDeletedAtIsNull(Long courseType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多条件查询团课(使用 DatabaseClient 构建动态 SQL)
|
||||||
|
*/
|
||||||
|
default Flux<GroupCourseEntity> searchGroupCourses(DatabaseClient databaseClient, GroupCourseQueryDto query) {
|
||||||
|
StringBuilder sql = new StringBuilder("SELECT * FROM group_course WHERE deleted_at IS NULL");
|
||||||
|
List<String> conditions = new ArrayList<>();
|
||||||
|
|
||||||
|
// 默认不查询不可预约的团课(仅查询 status = '0')
|
||||||
|
conditions.add("status = '0'");
|
||||||
|
|
||||||
|
// 1. 团课名称模糊查询
|
||||||
|
if (query.getCourseName() != null && !query.getCourseName().isEmpty()) {
|
||||||
|
conditions.add("course_name ILIKE :courseName");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 基于团课类型查询
|
||||||
|
if (query.getCourseType() != null) {
|
||||||
|
conditions.add("course_type = :courseType");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 基于日期时间段查询
|
||||||
|
if (query.getStartDate() != null) {
|
||||||
|
conditions.add("start_time >= :startDate");
|
||||||
|
}
|
||||||
|
if (query.getEndDate() != null) {
|
||||||
|
conditions.add("start_time <= :endDate");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 基于早晨/下午/夜晚时间段查询
|
||||||
|
if (query.getTimePeriod() != null && !query.getTimePeriod().isEmpty()) {
|
||||||
|
switch (query.getTimePeriod().toLowerCase()) {
|
||||||
|
case "morning":
|
||||||
|
conditions.add("EXTRACT(HOUR FROM start_time) >= 6 AND EXTRACT(HOUR FROM start_time) < 12");
|
||||||
|
break;
|
||||||
|
case "afternoon":
|
||||||
|
conditions.add("EXTRACT(HOUR FROM start_time) >= 12 AND EXTRACT(HOUR FROM start_time) < 18");
|
||||||
|
break;
|
||||||
|
case "evening":
|
||||||
|
conditions.add("EXTRACT(HOUR FROM start_time) >= 18 AND EXTRACT(HOUR FROM start_time) < 24");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sql.append(" AND ").append(String.join(" AND ", conditions));
|
||||||
|
|
||||||
|
// 5. 价格排序 / 6. 剩余名额最多排序
|
||||||
|
boolean hasPriceSort = query.getPriceSort() != null && !query.getPriceSort().isEmpty();
|
||||||
|
boolean hasRemainingMost = query.getRemainingMost() != null && query.getRemainingMost();
|
||||||
|
|
||||||
|
if (hasPriceSort || hasRemainingMost) {
|
||||||
|
sql.append(" ORDER BY");
|
||||||
|
List<String> orderClauses = new ArrayList<>();
|
||||||
|
|
||||||
|
if (hasRemainingMost) {
|
||||||
|
orderClauses.add(" (max_members - current_members) DESC");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasPriceSort) {
|
||||||
|
if ("asc".equalsIgnoreCase(query.getPriceSort())) {
|
||||||
|
orderClauses.add(" stored_value_amount ASC");
|
||||||
|
} else if ("desc".equalsIgnoreCase(query.getPriceSort())) {
|
||||||
|
orderClauses.add(" stored_value_amount DESC");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sql.append(String.join(",", orderClauses));
|
||||||
|
} else {
|
||||||
|
sql.append(" ORDER BY start_time ASC");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分页
|
||||||
|
int page = query.getPage() != null ? query.getPage() : 0;
|
||||||
|
int size = query.getSize() != null ? query.getSize() : 10;
|
||||||
|
if (size < 1) size = 10;
|
||||||
|
if (size > 100) size = 100;
|
||||||
|
int offset = page * size;
|
||||||
|
sql.append(" LIMIT :limit OFFSET :offset");
|
||||||
|
|
||||||
|
DatabaseClient.GenericExecuteSpec spec = databaseClient.sql(sql.toString());
|
||||||
|
|
||||||
|
if (query.getCourseName() != null && !query.getCourseName().isEmpty()) {
|
||||||
|
spec = spec.bind("courseName", "%" + query.getCourseName() + "%");
|
||||||
|
}
|
||||||
|
if (query.getCourseType() != null) {
|
||||||
|
spec = spec.bind("courseType", query.getCourseType());
|
||||||
|
}
|
||||||
|
if (query.getStartDate() != null) {
|
||||||
|
spec = spec.bind("startDate", query.getStartDate());
|
||||||
|
}
|
||||||
|
if (query.getEndDate() != null) {
|
||||||
|
spec = spec.bind("endDate", query.getEndDate());
|
||||||
|
}
|
||||||
|
spec = spec.bind("limit", size);
|
||||||
|
spec = spec.bind("offset", offset);
|
||||||
|
|
||||||
|
return spec.map((row, meta) -> {
|
||||||
|
GroupCourseEntity entity = new GroupCourseEntity();
|
||||||
|
entity.setId(row.get("id", Long.class));
|
||||||
|
entity.setCourseName(row.get("course_name", String.class));
|
||||||
|
entity.setCoachId(row.get("coach_id", Long.class));
|
||||||
|
entity.setCourseType(row.get("course_type", Long.class));
|
||||||
|
entity.setStartTime(row.get("start_time", LocalDateTime.class));
|
||||||
|
entity.setEndTime(row.get("end_time", LocalDateTime.class));
|
||||||
|
entity.setMaxMembers(row.get("max_members", Integer.class));
|
||||||
|
entity.setCurrentMembers(row.get("current_members", Integer.class));
|
||||||
|
String statusStr = row.get("status", String.class);
|
||||||
|
entity.setStatus(statusStr != null ? Long.parseLong(statusStr) : null);
|
||||||
|
entity.setLocation(row.get("location", String.class));
|
||||||
|
entity.setCoverImage(row.get("cover_image", String.class));
|
||||||
|
entity.setDescription(row.get("description", String.class));
|
||||||
|
entity.setPointCardAmount(row.get("point_card_amount", Integer.class));
|
||||||
|
entity.setStoredValueAmount(row.get("stored_value_amount", java.math.BigDecimal.class));
|
||||||
|
entity.setCreateBy(row.get("create_by", String.class));
|
||||||
|
entity.setUpdateBy(row.get("update_by", String.class));
|
||||||
|
entity.setCreatedAt(row.get("created_at", LocalDateTime.class));
|
||||||
|
entity.setUpdatedAt(row.get("updated_at", LocalDateTime.class));
|
||||||
|
entity.setDeletedAt(row.get("deleted_at", LocalDateTime.class));
|
||||||
|
return entity;
|
||||||
|
}).all();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多条件查询团课总数
|
||||||
|
*/
|
||||||
|
default Mono<Long> countSearchGroupCourses(DatabaseClient databaseClient, GroupCourseQueryDto query) {
|
||||||
|
StringBuilder sql = new StringBuilder("SELECT COUNT(*) FROM group_course WHERE deleted_at IS NULL");
|
||||||
|
List<String> conditions = new ArrayList<>();
|
||||||
|
|
||||||
|
conditions.add("status = '0'");
|
||||||
|
|
||||||
|
if (query.getCourseName() != null && !query.getCourseName().isEmpty()) {
|
||||||
|
conditions.add("course_name ILIKE :courseName");
|
||||||
|
}
|
||||||
|
if (query.getCourseType() != null) {
|
||||||
|
conditions.add("course_type = :courseType");
|
||||||
|
}
|
||||||
|
if (query.getStartDate() != null) {
|
||||||
|
conditions.add("start_time >= :startDate");
|
||||||
|
}
|
||||||
|
if (query.getEndDate() != null) {
|
||||||
|
conditions.add("start_time <= :endDate");
|
||||||
|
}
|
||||||
|
if (query.getTimePeriod() != null && !query.getTimePeriod().isEmpty()) {
|
||||||
|
switch (query.getTimePeriod().toLowerCase()) {
|
||||||
|
case "morning":
|
||||||
|
conditions.add("EXTRACT(HOUR FROM start_time) >= 6 AND EXTRACT(HOUR FROM start_time) < 12");
|
||||||
|
break;
|
||||||
|
case "afternoon":
|
||||||
|
conditions.add("EXTRACT(HOUR FROM start_time) >= 12 AND EXTRACT(HOUR FROM start_time) < 18");
|
||||||
|
break;
|
||||||
|
case "evening":
|
||||||
|
conditions.add("EXTRACT(HOUR FROM start_time) >= 18 AND EXTRACT(HOUR FROM start_time) < 24");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sql.append(" AND ").append(String.join(" AND ", conditions));
|
||||||
|
|
||||||
|
DatabaseClient.GenericExecuteSpec spec = databaseClient.sql(sql.toString());
|
||||||
|
|
||||||
|
if (query.getCourseName() != null && !query.getCourseName().isEmpty()) {
|
||||||
|
spec = spec.bind("courseName", "%" + query.getCourseName() + "%");
|
||||||
|
}
|
||||||
|
if (query.getCourseType() != null) {
|
||||||
|
spec = spec.bind("courseType", query.getCourseType());
|
||||||
|
}
|
||||||
|
if (query.getStartDate() != null) {
|
||||||
|
spec = spec.bind("startDate", query.getStartDate());
|
||||||
|
}
|
||||||
|
if (query.getEndDate() != null) {
|
||||||
|
spec = spec.bind("endDate", query.getEndDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
return spec.map((row, meta) -> row.get(0, Long.class)).one();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+42
@@ -0,0 +1,42 @@
|
|||||||
|
package cn.novalon.gym.manage.groupcourse.dao;
|
||||||
|
|
||||||
|
import cn.novalon.gym.manage.groupcourse.entity.GroupCourseRecommendEntity;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
import org.springframework.data.r2dbc.repository.Modifying;
|
||||||
|
import org.springframework.data.r2dbc.repository.Query;
|
||||||
|
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import reactor.core.publisher.Flux;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface GroupCourseRecommendDao extends R2dbcRepository<GroupCourseRecommendEntity, Long> {
|
||||||
|
|
||||||
|
Mono<GroupCourseRecommendEntity> findByIdAndDeletedAtIsNull(Long id);
|
||||||
|
|
||||||
|
Flux<GroupCourseRecommendEntity> findAllByDeletedAtIsNull();
|
||||||
|
|
||||||
|
Flux<GroupCourseRecommendEntity> findAllByDeletedAtIsNull(Sort sort);
|
||||||
|
|
||||||
|
Flux<GroupCourseRecommendEntity> findByCourseIdAndDeletedAtIsNull(Long courseId);
|
||||||
|
|
||||||
|
Mono<GroupCourseRecommendEntity> findByCourseIdAndDeletedAtIsNullAndIsActiveTrue(Long courseId);
|
||||||
|
|
||||||
|
Flux<GroupCourseRecommendEntity> findByIsActiveTrueAndDeletedAtIsNull();
|
||||||
|
|
||||||
|
Flux<GroupCourseRecommendEntity> findByIsActiveTrueAndDeletedAtIsNull(Sort sort);
|
||||||
|
|
||||||
|
@Modifying
|
||||||
|
@Query("UPDATE group_course_recommend SET is_active = :isActive, updated_at = :updatedAt WHERE id = :id AND deleted_at IS NULL")
|
||||||
|
Mono<Integer> updateActiveStatus(Long id, Boolean isActive, LocalDateTime updatedAt);
|
||||||
|
|
||||||
|
@Modifying
|
||||||
|
@Query("UPDATE group_course_recommend SET deleted_at = :deletedAt WHERE id = :id")
|
||||||
|
Mono<Integer> softDelete(Long id, LocalDateTime deletedAt);
|
||||||
|
|
||||||
|
@Modifying
|
||||||
|
@Query("UPDATE group_course_recommend SET deleted_at = :deletedAt WHERE course_id = :courseId")
|
||||||
|
Mono<Integer> softDeleteByCourseId(Long courseId, LocalDateTime deletedAt);
|
||||||
|
}
|
||||||
+12
@@ -60,6 +60,10 @@ public class GroupCourse extends BaseDomain{
|
|||||||
@Schema(description = "储值卡额度(消耗金额)", example = "50.00")
|
@Schema(description = "储值卡额度(消耗金额)", example = "50.00")
|
||||||
private java.math.BigDecimal storedValueAmount;
|
private java.math.BigDecimal storedValueAmount;
|
||||||
|
|
||||||
|
//二维码路径
|
||||||
|
@Schema(description = "二维码路径", example = "D:\\Games\\exmp\\image\\abc123_20260618120000.png")
|
||||||
|
private String qrCodePath;
|
||||||
|
|
||||||
public String getCourseName() {
|
public String getCourseName() {
|
||||||
return courseName;
|
return courseName;
|
||||||
}
|
}
|
||||||
@@ -163,4 +167,12 @@ public class GroupCourse extends BaseDomain{
|
|||||||
public void setStoredValueAmount(java.math.BigDecimal storedValueAmount) {
|
public void setStoredValueAmount(java.math.BigDecimal storedValueAmount) {
|
||||||
this.storedValueAmount = storedValueAmount;
|
this.storedValueAmount = storedValueAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getQrCodePath() {
|
||||||
|
return qrCodePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQrCodePath(String qrCodePath) {
|
||||||
|
this.qrCodePath = qrCodePath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
@@ -54,6 +54,9 @@ public class GroupCourseDetail extends BaseDomain {
|
|||||||
@Schema(description = "储值卡额度(消耗金额)", example = "50.00")
|
@Schema(description = "储值卡额度(消耗金额)", example = "50.00")
|
||||||
private BigDecimal storedValueAmount;
|
private BigDecimal storedValueAmount;
|
||||||
|
|
||||||
|
@Schema(description = "二维码路径", example = "D:\\Games\\exmp\\image\\abc123_20260618120000.png")
|
||||||
|
private String qrCodePath;
|
||||||
|
|
||||||
// ===== 关联的类型信息 =====
|
// ===== 关联的类型信息 =====
|
||||||
|
|
||||||
@Schema(description = "类型信息")
|
@Schema(description = "类型信息")
|
||||||
@@ -187,6 +190,14 @@ public class GroupCourseDetail extends BaseDomain {
|
|||||||
this.storedValueAmount = storedValueAmount;
|
this.storedValueAmount = storedValueAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getQrCodePath() {
|
||||||
|
return qrCodePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQrCodePath(String qrCodePath) {
|
||||||
|
this.qrCodePath = qrCodePath;
|
||||||
|
}
|
||||||
|
|
||||||
public GroupCourseType getTypeInfo() {
|
public GroupCourseType getTypeInfo() {
|
||||||
return typeInfo;
|
return typeInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
+84
@@ -0,0 +1,84 @@
|
|||||||
|
package cn.novalon.gym.manage.groupcourse.domain;
|
||||||
|
|
||||||
|
import cn.novalon.gym.manage.sys.core.domain.BaseDomain;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
public class GroupCourseRecommend extends BaseDomain {
|
||||||
|
|
||||||
|
@Schema(description = "团课ID", example = "1")
|
||||||
|
private Long courseId;
|
||||||
|
|
||||||
|
@Schema(description = "推荐标题", example = "本周热门课程")
|
||||||
|
private String recommendTitle;
|
||||||
|
|
||||||
|
@Schema(description = "推荐内容", example = "这是一门非常棒的课程,快来参加吧!")
|
||||||
|
private String recommendContent;
|
||||||
|
|
||||||
|
@Schema(description = "推荐理由", example = "教练专业,课程内容丰富")
|
||||||
|
private String recommendReason;
|
||||||
|
|
||||||
|
@Schema(description = "优先级(数字越大优先级越高)", example = "10")
|
||||||
|
private Integer priority;
|
||||||
|
|
||||||
|
@Schema(description = "是否启用", example = "true")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
@Schema(description = "团课信息")
|
||||||
|
private GroupCourse groupCourse;
|
||||||
|
|
||||||
|
public Long getCourseId() {
|
||||||
|
return courseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCourseId(Long courseId) {
|
||||||
|
this.courseId = courseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecommendTitle() {
|
||||||
|
return recommendTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecommendTitle(String recommendTitle) {
|
||||||
|
this.recommendTitle = recommendTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecommendContent() {
|
||||||
|
return recommendContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecommendContent(String recommendContent) {
|
||||||
|
this.recommendContent = recommendContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecommendReason() {
|
||||||
|
return recommendReason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecommendReason(String recommendReason) {
|
||||||
|
this.recommendReason = recommendReason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPriority() {
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriority(Integer priority) {
|
||||||
|
this.priority = priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(Boolean isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupCourse getGroupCourse() {
|
||||||
|
return groupCourse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupCourse(GroupCourse groupCourse) {
|
||||||
|
this.groupCourse = groupCourse;
|
||||||
|
}
|
||||||
|
}
|
||||||
+116
@@ -0,0 +1,116 @@
|
|||||||
|
package cn.novalon.gym.manage.groupcourse.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团课多条件查询请求DTO
|
||||||
|
*
|
||||||
|
* @author 张翔
|
||||||
|
* @date 2026-06-14
|
||||||
|
*/
|
||||||
|
@Schema(description = "团课多条件查询参数")
|
||||||
|
public class GroupCourseQueryDto {
|
||||||
|
|
||||||
|
@Schema(description = "课程名称(模糊查询)", example = "瑜伽")
|
||||||
|
private String courseName;
|
||||||
|
|
||||||
|
@Schema(description = "课程类型ID", example = "1")
|
||||||
|
private Long courseType;
|
||||||
|
|
||||||
|
@Schema(description = "查询开始日期", example = "2026-06-01T00:00:00")
|
||||||
|
private LocalDateTime startDate;
|
||||||
|
|
||||||
|
@Schema(description = "查询结束日期", example = "2026-06-30T23:59:59")
|
||||||
|
private LocalDateTime endDate;
|
||||||
|
|
||||||
|
@Schema(description = "时间段:morning-早晨(6:00-12:00), afternoon-下午(12:00-18:00), evening-夜晚(18:00-24:00)", example = "morning")
|
||||||
|
private String timePeriod;
|
||||||
|
|
||||||
|
@Schema(description = "价格排序:asc-从低到高, desc-从高到低", example = "asc")
|
||||||
|
private String priceSort;
|
||||||
|
|
||||||
|
@Schema(description = "按剩余名额最多排序", example = "true")
|
||||||
|
private Boolean remainingMost;
|
||||||
|
|
||||||
|
@Schema(description = "页码", example = "0")
|
||||||
|
private Integer page = 0;
|
||||||
|
|
||||||
|
@Schema(description = "每页大小", example = "10")
|
||||||
|
private Integer size = 10;
|
||||||
|
|
||||||
|
// ===== Getters and Setters =====
|
||||||
|
|
||||||
|
public String getCourseName() {
|
||||||
|
return courseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCourseName(String courseName) {
|
||||||
|
this.courseName = courseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCourseType() {
|
||||||
|
return courseType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCourseType(Long courseType) {
|
||||||
|
this.courseType = courseType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getStartDate() {
|
||||||
|
return startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartDate(LocalDateTime startDate) {
|
||||||
|
this.startDate = startDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDateTime getEndDate() {
|
||||||
|
return endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndDate(LocalDateTime endDate) {
|
||||||
|
this.endDate = endDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTimePeriod() {
|
||||||
|
return timePeriod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimePeriod(String timePeriod) {
|
||||||
|
this.timePeriod = timePeriod;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPriceSort() {
|
||||||
|
return priceSort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriceSort(String priceSort) {
|
||||||
|
this.priceSort = priceSort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getRemainingMost() {
|
||||||
|
return remainingMost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemainingMost(Boolean remainingMost) {
|
||||||
|
this.remainingMost = remainingMost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPage() {
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPage(Integer page) {
|
||||||
|
this.page = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSize() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSize(Integer size) {
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
@@ -62,6 +62,10 @@ public class GroupCourseEntity extends BaseEntity {
|
|||||||
@Column("stored_value_amount")
|
@Column("stored_value_amount")
|
||||||
private java.math.BigDecimal storedValueAmount;
|
private java.math.BigDecimal storedValueAmount;
|
||||||
|
|
||||||
|
//二维码路径
|
||||||
|
@Column("qr_code_path")
|
||||||
|
private String qrCodePath;
|
||||||
|
|
||||||
public String getCourseName() {
|
public String getCourseName() {
|
||||||
return courseName;
|
return courseName;
|
||||||
}
|
}
|
||||||
@@ -165,4 +169,12 @@ public class GroupCourseEntity extends BaseEntity {
|
|||||||
public void setStoredValueAmount(java.math.BigDecimal storedValueAmount) {
|
public void setStoredValueAmount(java.math.BigDecimal storedValueAmount) {
|
||||||
this.storedValueAmount = storedValueAmount;
|
this.storedValueAmount = storedValueAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getQrCodePath() {
|
||||||
|
return qrCodePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQrCodePath(String qrCodePath) {
|
||||||
|
this.qrCodePath = qrCodePath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+77
@@ -0,0 +1,77 @@
|
|||||||
|
package cn.novalon.gym.manage.groupcourse.entity;
|
||||||
|
|
||||||
|
import cn.novalon.gym.manage.db.entity.BaseEntity;
|
||||||
|
import org.springframework.data.relational.core.mapping.Column;
|
||||||
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Table("group_course_recommend")
|
||||||
|
public class GroupCourseRecommendEntity extends BaseEntity {
|
||||||
|
|
||||||
|
@Column("course_id")
|
||||||
|
private Long courseId;
|
||||||
|
|
||||||
|
@Column("recommend_title")
|
||||||
|
private String recommendTitle;
|
||||||
|
|
||||||
|
@Column("recommend_content")
|
||||||
|
private String recommendContent;
|
||||||
|
|
||||||
|
@Column("recommend_reason")
|
||||||
|
private String recommendReason;
|
||||||
|
|
||||||
|
@Column("priority")
|
||||||
|
private Integer priority;
|
||||||
|
|
||||||
|
@Column("is_active")
|
||||||
|
private Boolean isActive;
|
||||||
|
|
||||||
|
public Long getCourseId() {
|
||||||
|
return courseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCourseId(Long courseId) {
|
||||||
|
this.courseId = courseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecommendTitle() {
|
||||||
|
return recommendTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecommendTitle(String recommendTitle) {
|
||||||
|
this.recommendTitle = recommendTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecommendContent() {
|
||||||
|
return recommendContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecommendContent(String recommendContent) {
|
||||||
|
this.recommendContent = recommendContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecommendReason() {
|
||||||
|
return recommendReason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecommendReason(String recommendReason) {
|
||||||
|
this.recommendReason = recommendReason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPriority() {
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriority(Integer priority) {
|
||||||
|
this.priority = priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIsActive() {
|
||||||
|
return isActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsActive(Boolean isActive) {
|
||||||
|
this.isActive = isActive;
|
||||||
|
}
|
||||||
|
}
|
||||||
+27
-5
@@ -5,6 +5,7 @@ import cn.novalon.gym.manage.common.dto.PageRequest;
|
|||||||
import cn.novalon.gym.manage.common.util.RedisUtil;
|
import cn.novalon.gym.manage.common.util.RedisUtil;
|
||||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
||||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseDetail;
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseDetail;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.dto.GroupCourseQueryDto;
|
||||||
import cn.novalon.gym.manage.groupcourse.service.IGroupCourseService;
|
import cn.novalon.gym.manage.groupcourse.service.IGroupCourseService;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@@ -158,7 +159,7 @@ public class GroupCourseHandler {
|
|||||||
|
|
||||||
@Operation(summary = "团课签到", description = "会员签到参加团课")
|
@Operation(summary = "团课签到", description = "会员签到参加团课")
|
||||||
public Mono<ServerResponse> signIn(ServerRequest request) {
|
public Mono<ServerResponse> signIn(ServerRequest request) {
|
||||||
Long courseId = Long.valueOf(request.pathVariable("courseId"));
|
Long memberId = Long.valueOf(request.pathVariable("memberId"));
|
||||||
|
|
||||||
return request.bodyToMono(Map.class)
|
return request.bodyToMono(Map.class)
|
||||||
.flatMap(body -> {
|
.flatMap(body -> {
|
||||||
@@ -169,15 +170,15 @@ public class GroupCourseHandler {
|
|||||||
return ServerResponse.badRequest().bodyValue(response);
|
return ServerResponse.badRequest().bodyValue(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object memberIdObj = body.get("memberId");
|
Object courseIdObj = body.get("courseId");
|
||||||
if (memberIdObj == null) {
|
if (courseIdObj == null) {
|
||||||
Map<String, Object> response = new HashMap<>();
|
Map<String, Object> response = new HashMap<>();
|
||||||
response.put("success", false);
|
response.put("success", false);
|
||||||
response.put("message", "memberId不能为空");
|
response.put("message", "courseId不能为空");
|
||||||
return ServerResponse.badRequest().bodyValue(response);
|
return ServerResponse.badRequest().bodyValue(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
Long memberId = ((Number) memberIdObj).longValue();
|
Long courseId = ((Number) courseIdObj).longValue();
|
||||||
|
|
||||||
return groupCourseService.signIn(courseId, memberId)
|
return groupCourseService.signIn(courseId, memberId)
|
||||||
.flatMap(course -> {
|
.flatMap(course -> {
|
||||||
@@ -215,6 +216,27 @@ public class GroupCourseHandler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "多条件查询团课", description = "支持团课名称模糊查询、类型筛选、日期范围、时间段、价格排序、剩余名额排序等多条件组合查询")
|
||||||
|
public Mono<ServerResponse> searchGroupCourses(ServerRequest request) {
|
||||||
|
return request.bodyToMono(GroupCourseQueryDto.class)
|
||||||
|
.flatMap(query -> {
|
||||||
|
return groupCourseService.searchGroupCourses(query)
|
||||||
|
.flatMap(response -> {
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
result.put("success", true);
|
||||||
|
result.put("message", "查询成功");
|
||||||
|
result.put("data", response);
|
||||||
|
return ServerResponse.ok().bodyValue(result);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.onErrorResume(error -> {
|
||||||
|
Map<String, Object> errorResponse = new HashMap<>();
|
||||||
|
errorResponse.put("success", false);
|
||||||
|
errorResponse.put("message", error.getMessage());
|
||||||
|
return ServerResponse.badRequest().bodyValue(errorResponse);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "测试-根据Key获取Redis缓存", description = "测试接口:根据传入的key值获取Redis中缓存的数据")
|
@Operation(summary = "测试-根据Key获取Redis缓存", description = "测试接口:根据传入的key值获取Redis中缓存的数据")
|
||||||
public Mono<ServerResponse> getCacheByKey(ServerRequest request) {
|
public Mono<ServerResponse> getCacheByKey(ServerRequest request) {
|
||||||
return request.bodyToMono(Map.class)
|
return request.bodyToMono(Map.class)
|
||||||
|
|||||||
+164
@@ -0,0 +1,164 @@
|
|||||||
|
package cn.novalon.gym.manage.groupcourse.handler;
|
||||||
|
|
||||||
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseRecommend;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.service.IGroupCourseRecommendService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||||
|
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Tag(name = "团课推荐管理", description = "团课推荐相关操作")
|
||||||
|
public class GroupCourseRecommendHandler {
|
||||||
|
|
||||||
|
private final IGroupCourseRecommendService recommendService;
|
||||||
|
|
||||||
|
public GroupCourseRecommendHandler(IGroupCourseRecommendService recommendService) {
|
||||||
|
this.recommendService = recommendService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取所有团课推荐", description = "获取系统中所有团课推荐列表,支持按优先级排序")
|
||||||
|
public Mono<ServerResponse> getAllRecommendations(ServerRequest request) {
|
||||||
|
String sortBy = request.queryParam("sortBy").orElse("priority");
|
||||||
|
String sortOrder = request.queryParam("sortOrder").orElse("desc");
|
||||||
|
|
||||||
|
return ServerResponse.ok()
|
||||||
|
.body(recommendService.findAll(sortBy, sortOrder), GroupCourseRecommend.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取所有启用的团课推荐", description = "获取系统中所有已启用的团课推荐列表(按优先级排序)")
|
||||||
|
public Mono<ServerResponse> getAllActiveRecommendations(ServerRequest request) {
|
||||||
|
return ServerResponse.ok()
|
||||||
|
.body(recommendService.findAllActive(), GroupCourseRecommend.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据ID获取团课推荐", description = "根据ID获取团课推荐详情")
|
||||||
|
public Mono<ServerResponse> getRecommendationById(ServerRequest request) {
|
||||||
|
Long id = Long.valueOf(request.pathVariable("id"));
|
||||||
|
return recommendService.findById(id)
|
||||||
|
.flatMap(recommend -> ServerResponse.ok().bodyValue(recommend))
|
||||||
|
.switchIfEmpty(ServerResponse.notFound().build());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据团课ID获取推荐", description = "根据团课ID获取该团课的推荐信息")
|
||||||
|
public Mono<ServerResponse> getRecommendationsByCourseId(ServerRequest request) {
|
||||||
|
Long courseId = Long.valueOf(request.pathVariable("courseId"));
|
||||||
|
return ServerResponse.ok()
|
||||||
|
.body(recommendService.findByCourseId(courseId), GroupCourseRecommend.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "创建团课推荐", description = "创建新的团课推荐")
|
||||||
|
public Mono<ServerResponse> createRecommendation(ServerRequest request) {
|
||||||
|
return request.bodyToMono(GroupCourseRecommend.class)
|
||||||
|
.flatMap(recommend -> {
|
||||||
|
if (recommend.getCourseId() == null) {
|
||||||
|
Map<String, Object> error = new HashMap<>();
|
||||||
|
error.put("success", false);
|
||||||
|
error.put("message", "团课ID不能为空");
|
||||||
|
return ServerResponse.badRequest().bodyValue(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return recommendService.create(recommend)
|
||||||
|
.flatMap(r -> {
|
||||||
|
Map<String, Object> response = new HashMap<>();
|
||||||
|
response.put("success", true);
|
||||||
|
response.put("message", "团课推荐创建成功");
|
||||||
|
response.put("data", r);
|
||||||
|
return ServerResponse.ok().bodyValue(response);
|
||||||
|
})
|
||||||
|
.onErrorResume(error -> {
|
||||||
|
Map<String, Object> response = new HashMap<>();
|
||||||
|
response.put("success", false);
|
||||||
|
response.put("message", error.getMessage());
|
||||||
|
return ServerResponse.badRequest().bodyValue(response);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "更新团课推荐", description = "更新指定团课推荐信息")
|
||||||
|
public Mono<ServerResponse> updateRecommendation(ServerRequest request) {
|
||||||
|
Long id = Long.valueOf(request.pathVariable("id"));
|
||||||
|
|
||||||
|
return request.bodyToMono(GroupCourseRecommend.class)
|
||||||
|
.flatMap(recommend -> {
|
||||||
|
return recommendService.update(id, recommend)
|
||||||
|
.flatMap(r -> {
|
||||||
|
Map<String, Object> response = new HashMap<>();
|
||||||
|
response.put("success", true);
|
||||||
|
response.put("message", "团课推荐更新成功");
|
||||||
|
response.put("data", r);
|
||||||
|
return ServerResponse.ok().bodyValue(response);
|
||||||
|
})
|
||||||
|
.onErrorResume(error -> {
|
||||||
|
Map<String, Object> response = new HashMap<>();
|
||||||
|
response.put("success", false);
|
||||||
|
response.put("message", error.getMessage());
|
||||||
|
return ServerResponse.badRequest().bodyValue(response);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除团课推荐", description = "删除指定团课推荐(软删除)")
|
||||||
|
public Mono<ServerResponse> deleteRecommendation(ServerRequest request) {
|
||||||
|
Long id = Long.valueOf(request.pathVariable("id"));
|
||||||
|
|
||||||
|
return recommendService.delete(id)
|
||||||
|
.then(Mono.defer(() -> {
|
||||||
|
Map<String, Object> response = new HashMap<>();
|
||||||
|
response.put("success", true);
|
||||||
|
response.put("message", "团课推荐删除成功");
|
||||||
|
return ServerResponse.ok().bodyValue(response);
|
||||||
|
}))
|
||||||
|
.onErrorResume(error -> {
|
||||||
|
Map<String, Object> response = new HashMap<>();
|
||||||
|
response.put("success", false);
|
||||||
|
response.put("message", error.getMessage());
|
||||||
|
return ServerResponse.badRequest().bodyValue(response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "启用团课推荐", description = "启用指定团课推荐")
|
||||||
|
public Mono<ServerResponse> enableRecommendation(ServerRequest request) {
|
||||||
|
Long id = Long.valueOf(request.pathVariable("id"));
|
||||||
|
|
||||||
|
return recommendService.enable(id)
|
||||||
|
.flatMap(r -> {
|
||||||
|
Map<String, Object> response = new HashMap<>();
|
||||||
|
response.put("success", true);
|
||||||
|
response.put("message", "团课推荐启用成功");
|
||||||
|
response.put("data", r);
|
||||||
|
return ServerResponse.ok().bodyValue(response);
|
||||||
|
})
|
||||||
|
.onErrorResume(error -> {
|
||||||
|
Map<String, Object> response = new HashMap<>();
|
||||||
|
response.put("success", false);
|
||||||
|
response.put("message", error.getMessage());
|
||||||
|
return ServerResponse.badRequest().bodyValue(response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "禁用团课推荐", description = "禁用指定团课推荐")
|
||||||
|
public Mono<ServerResponse> disableRecommendation(ServerRequest request) {
|
||||||
|
Long id = Long.valueOf(request.pathVariable("id"));
|
||||||
|
|
||||||
|
return recommendService.disable(id)
|
||||||
|
.flatMap(r -> {
|
||||||
|
Map<String, Object> response = new HashMap<>();
|
||||||
|
response.put("success", true);
|
||||||
|
response.put("message", "团课推荐禁用成功");
|
||||||
|
response.put("data", r);
|
||||||
|
return ServerResponse.ok().bodyValue(response);
|
||||||
|
})
|
||||||
|
.onErrorResume(error -> {
|
||||||
|
Map<String, Object> response = new HashMap<>();
|
||||||
|
response.put("success", false);
|
||||||
|
response.put("message", error.getMessage());
|
||||||
|
return ServerResponse.badRequest().bodyValue(response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
+89
@@ -0,0 +1,89 @@
|
|||||||
|
package cn.novalon.gym.manage.groupcourse.initializer;
|
||||||
|
|
||||||
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.repository.IGroupCourseRepository;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.util.QRCodeUtil;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目启动时补全缺失的团课二维码
|
||||||
|
* 遍历所有未删除的团课,对qrCodePath为空的课程生成二维码并上传至阿里云OSS
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class QrCodeInitializer implements CommandLineRunner {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(QrCodeInitializer.class);
|
||||||
|
|
||||||
|
private final IGroupCourseRepository groupCourseRepository;
|
||||||
|
private final ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
public QrCodeInitializer(IGroupCourseRepository groupCourseRepository,
|
||||||
|
ObjectMapper objectMapper) {
|
||||||
|
this.groupCourseRepository = groupCourseRepository;
|
||||||
|
this.objectMapper = objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(String... args) {
|
||||||
|
logger.info("===== 开始检查团课二维码缺失情况 =====");
|
||||||
|
|
||||||
|
groupCourseRepository.findByDeletedAtIsNull()
|
||||||
|
.filter(course -> course.getQrCodePath() == null || course.getQrCodePath().isEmpty())
|
||||||
|
.flatMap(course -> {
|
||||||
|
try {
|
||||||
|
logger.info("发现缺失二维码的团课 - id={}, name={}", course.getId(), course.getCourseName());
|
||||||
|
|
||||||
|
// 生成二维码内容:团课基础信息JSON
|
||||||
|
Map<String, Object> qrCodeContent = new HashMap<>();
|
||||||
|
qrCodeContent.put("id", course.getId());
|
||||||
|
qrCodeContent.put("courseName", course.getCourseName());
|
||||||
|
qrCodeContent.put("coachId", course.getCoachId());
|
||||||
|
qrCodeContent.put("courseType", course.getCourseType());
|
||||||
|
qrCodeContent.put("startTime", course.getStartTime() != null ? course.getStartTime().toString() : null);
|
||||||
|
qrCodeContent.put("endTime", course.getEndTime() != null ? course.getEndTime().toString() : null);
|
||||||
|
qrCodeContent.put("maxMembers", course.getMaxMembers());
|
||||||
|
qrCodeContent.put("location", course.getLocation());
|
||||||
|
qrCodeContent.put("description", course.getDescription());
|
||||||
|
|
||||||
|
String jsonContent = objectMapper.writeValueAsString(qrCodeContent);
|
||||||
|
|
||||||
|
// 生成二维码并上传到阿里云OSS
|
||||||
|
String uuid = UUID.randomUUID().toString().replace("-", "");
|
||||||
|
String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||||
|
String fileName = "qr_" + uuid + "_" + timestamp + ".png";
|
||||||
|
String ossUrl = QRCodeUtil.generateQRCodeAndUploadToOSS(jsonContent, fileName);
|
||||||
|
|
||||||
|
course.setQrCodePath(ossUrl);
|
||||||
|
|
||||||
|
// 更新数据库
|
||||||
|
return groupCourseRepository.update(course)
|
||||||
|
.doOnSuccess(updated -> logger.info("团课二维码补全成功 - id={}, name={}, ossUrl={}",
|
||||||
|
updated.getId(), updated.getCourseName(), ossUrl))
|
||||||
|
.doOnError(error -> logger.error("团课二维码补全失败(更新DB) - id={}, name={}, error: {}",
|
||||||
|
course.getId(), course.getCourseName(), error.getMessage()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("团课二维码补全失败(生成) - id={}, name={}, error: {}",
|
||||||
|
course.getId(), course.getCourseName(), e.getMessage(), e);
|
||||||
|
return Mono.empty();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collectList()
|
||||||
|
.doOnSuccess(list -> logger.info("===== 团课二维码检查完毕,共补全 {} 个缺失二维码 =====", list.size()))
|
||||||
|
.onErrorResume(error -> {
|
||||||
|
logger.error("团课二维码初始化检查异常: {}", error.getMessage(), error);
|
||||||
|
return Mono.empty();
|
||||||
|
})
|
||||||
|
.subscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
package cn.novalon.gym.manage.groupcourse.repository;
|
||||||
|
|
||||||
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseRecommend;
|
||||||
|
import reactor.core.publisher.Flux;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
public interface IGroupCourseRecommendRepository {
|
||||||
|
|
||||||
|
Mono<GroupCourseRecommend> findById(Long id);
|
||||||
|
|
||||||
|
Flux<GroupCourseRecommend> findAll();
|
||||||
|
|
||||||
|
Flux<GroupCourseRecommend> findAll(String sortBy, String sortOrder);
|
||||||
|
|
||||||
|
Flux<GroupCourseRecommend> findAllActive();
|
||||||
|
|
||||||
|
Flux<GroupCourseRecommend> findByCourseId(Long courseId);
|
||||||
|
|
||||||
|
Mono<GroupCourseRecommend> findActiveByCourseId(Long courseId);
|
||||||
|
|
||||||
|
Mono<GroupCourseRecommend> save(GroupCourseRecommend recommend);
|
||||||
|
|
||||||
|
Mono<GroupCourseRecommend> update(GroupCourseRecommend recommend);
|
||||||
|
|
||||||
|
Mono<Void> deleteById(Long id);
|
||||||
|
|
||||||
|
Mono<Void> deleteByCourseId(Long courseId);
|
||||||
|
|
||||||
|
Mono<GroupCourseRecommend> updateActiveStatus(Long id, Boolean isActive);
|
||||||
|
}
|
||||||
+3
@@ -4,6 +4,7 @@ package cn.novalon.gym.manage.groupcourse.repository;
|
|||||||
import cn.novalon.gym.manage.common.dto.PageRequest;
|
import cn.novalon.gym.manage.common.dto.PageRequest;
|
||||||
import cn.novalon.gym.manage.common.dto.PageResponse;
|
import cn.novalon.gym.manage.common.dto.PageResponse;
|
||||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.dto.GroupCourseQueryDto;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
@@ -29,4 +30,6 @@ public interface IGroupCourseRepository {
|
|||||||
Mono<GroupCourse> updateCurrentMembers(Long id, Integer delta);
|
Mono<GroupCourse> updateCurrentMembers(Long id, Integer delta);
|
||||||
|
|
||||||
Flux<GroupCourse> findByCourseType(Long courseType);
|
Flux<GroupCourse> findByCourseType(Long courseType);
|
||||||
|
|
||||||
|
Mono<PageResponse<GroupCourse>> searchGroupCourses(GroupCourseQueryDto query);
|
||||||
}
|
}
|
||||||
|
|||||||
+136
@@ -0,0 +1,136 @@
|
|||||||
|
package cn.novalon.gym.manage.groupcourse.repository.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.dao.GroupCourseRecommendDao;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseRecommend;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.entity.GroupCourseRecommendEntity;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.repository.IGroupCourseRecommendRepository;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import reactor.core.publisher.Flux;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class GroupCourseRecommendRepository implements IGroupCourseRecommendRepository {
|
||||||
|
|
||||||
|
private final GroupCourseRecommendDao recommendDao;
|
||||||
|
private final R2dbcEntityTemplate r2dbcEntityTemplate;
|
||||||
|
|
||||||
|
public GroupCourseRecommendRepository(GroupCourseRecommendDao recommendDao,
|
||||||
|
R2dbcEntityTemplate r2dbcEntityTemplate) {
|
||||||
|
this.recommendDao = recommendDao;
|
||||||
|
this.r2dbcEntityTemplate = r2dbcEntityTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<GroupCourseRecommend> findById(Long id) {
|
||||||
|
return recommendDao.findByIdAndDeletedAtIsNull(id)
|
||||||
|
.map(this::toDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Flux<GroupCourseRecommend> findAll() {
|
||||||
|
return recommendDao.findAllByDeletedAtIsNull()
|
||||||
|
.map(this::toDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Flux<GroupCourseRecommend> findAll(String sortBy, String sortOrder) {
|
||||||
|
Sort.Direction direction = "asc".equalsIgnoreCase(sortOrder)
|
||||||
|
? Sort.Direction.ASC
|
||||||
|
: Sort.Direction.DESC;
|
||||||
|
Sort sort = Sort.by(direction, sortBy);
|
||||||
|
return recommendDao.findAllByDeletedAtIsNull(sort)
|
||||||
|
.map(this::toDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Flux<GroupCourseRecommend> findAllActive() {
|
||||||
|
return recommendDao.findByIsActiveTrueAndDeletedAtIsNull(Sort.by(Sort.Direction.DESC, "priority"))
|
||||||
|
.map(this::toDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Flux<GroupCourseRecommend> findByCourseId(Long courseId) {
|
||||||
|
return recommendDao.findByCourseIdAndDeletedAtIsNull(courseId)
|
||||||
|
.map(this::toDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<GroupCourseRecommend> findActiveByCourseId(Long courseId) {
|
||||||
|
return recommendDao.findByCourseIdAndDeletedAtIsNullAndIsActiveTrue(courseId)
|
||||||
|
.map(this::toDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<GroupCourseRecommend> save(GroupCourseRecommend recommend) {
|
||||||
|
GroupCourseRecommendEntity entity = toEntity(recommend);
|
||||||
|
entity.setCreatedAt(LocalDateTime.now());
|
||||||
|
entity.setUpdatedAt(LocalDateTime.now());
|
||||||
|
if (entity.getPriority() == null) {
|
||||||
|
entity.setPriority(0);
|
||||||
|
}
|
||||||
|
if (entity.getIsActive() == null) {
|
||||||
|
entity.setIsActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return recommendDao.save(entity)
|
||||||
|
.map(this::toDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<GroupCourseRecommend> update(GroupCourseRecommend recommend) {
|
||||||
|
GroupCourseRecommendEntity entity = toEntity(recommend);
|
||||||
|
entity.setUpdatedAt(LocalDateTime.now());
|
||||||
|
|
||||||
|
return r2dbcEntityTemplate.update(entity)
|
||||||
|
.then(findById(recommend.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<Void> deleteById(Long id) {
|
||||||
|
return recommendDao.softDelete(id, LocalDateTime.now())
|
||||||
|
.then();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<Void> deleteByCourseId(Long courseId) {
|
||||||
|
return recommendDao.softDeleteByCourseId(courseId, LocalDateTime.now())
|
||||||
|
.then();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<GroupCourseRecommend> updateActiveStatus(Long id, Boolean isActive) {
|
||||||
|
return recommendDao.updateActiveStatus(id, isActive, LocalDateTime.now())
|
||||||
|
.flatMap(updated -> {
|
||||||
|
if (updated > 0) {
|
||||||
|
return findById(id);
|
||||||
|
}
|
||||||
|
return Mono.empty();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private GroupCourseRecommend toDomain(GroupCourseRecommendEntity entity) {
|
||||||
|
if (entity == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
GroupCourseRecommend recommend = new GroupCourseRecommend();
|
||||||
|
BeanUtil.copyProperties(entity, recommend);
|
||||||
|
return recommend;
|
||||||
|
}
|
||||||
|
|
||||||
|
private GroupCourseRecommendEntity toEntity(GroupCourseRecommend domain) {
|
||||||
|
if (domain == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
GroupCourseRecommendEntity entity = new GroupCourseRecommendEntity();
|
||||||
|
BeanUtil.copyProperties(domain, entity);
|
||||||
|
if (domain.getId() != null) {
|
||||||
|
entity.markNotNew();
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
+24
@@ -6,6 +6,7 @@ import cn.novalon.gym.manage.common.dto.PageResponse;
|
|||||||
import cn.novalon.gym.manage.groupcourse.converter.GroupCourseConverter;
|
import cn.novalon.gym.manage.groupcourse.converter.GroupCourseConverter;
|
||||||
import cn.novalon.gym.manage.groupcourse.dao.GroupCourseDao;
|
import cn.novalon.gym.manage.groupcourse.dao.GroupCourseDao;
|
||||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.dto.GroupCourseQueryDto;
|
||||||
import cn.novalon.gym.manage.groupcourse.entity.GroupCourseEntity;
|
import cn.novalon.gym.manage.groupcourse.entity.GroupCourseEntity;
|
||||||
import cn.novalon.gym.manage.groupcourse.repository.IGroupCourseRepository;
|
import cn.novalon.gym.manage.groupcourse.repository.IGroupCourseRepository;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
@@ -184,4 +185,27 @@ public class GroupCourseRepository implements IGroupCourseRepository {
|
|||||||
return groupCourseDao.findByCourseTypeAndDeletedAtIsNull(courseType)
|
return groupCourseDao.findByCourseTypeAndDeletedAtIsNull(courseType)
|
||||||
.map(groupCourseConverter::toDomain);
|
.map(groupCourseConverter::toDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<PageResponse<GroupCourse>> searchGroupCourses(GroupCourseQueryDto query) {
|
||||||
|
return groupCourseDao.countSearchGroupCourses(r2dbcEntityTemplate.getDatabaseClient(), query)
|
||||||
|
.flatMap(total -> {
|
||||||
|
if (total == 0) {
|
||||||
|
return Mono.just(new PageResponse<>(
|
||||||
|
List.of(), 0, 0L,
|
||||||
|
query.getPage() != null ? query.getPage() : 0,
|
||||||
|
query.getSize() != null ? query.getSize() : 10));
|
||||||
|
}
|
||||||
|
return groupCourseDao.searchGroupCourses(r2dbcEntityTemplate.getDatabaseClient(), query)
|
||||||
|
.map(groupCourseConverter::toDomain)
|
||||||
|
.collectList()
|
||||||
|
.map(courseList -> {
|
||||||
|
int size = query.getSize() != null ? query.getSize() : 10;
|
||||||
|
int totalPages = (int) Math.ceil((double) total / size);
|
||||||
|
return new PageResponse<>(
|
||||||
|
courseList, totalPages, total,
|
||||||
|
query.getPage() != null ? query.getPage() : 0, size);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
package cn.novalon.gym.manage.groupcourse.service;
|
||||||
|
|
||||||
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseRecommend;
|
||||||
|
import reactor.core.publisher.Flux;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
public interface IGroupCourseRecommendService {
|
||||||
|
|
||||||
|
Mono<GroupCourseRecommend> findById(Long id);
|
||||||
|
|
||||||
|
Flux<GroupCourseRecommend> findAll();
|
||||||
|
|
||||||
|
Flux<GroupCourseRecommend> findAll(String sortBy, String sortOrder);
|
||||||
|
|
||||||
|
Flux<GroupCourseRecommend> findAllActive();
|
||||||
|
|
||||||
|
Flux<GroupCourseRecommend> findByCourseId(Long courseId);
|
||||||
|
|
||||||
|
Mono<GroupCourseRecommend> create(GroupCourseRecommend recommend);
|
||||||
|
|
||||||
|
Mono<GroupCourseRecommend> update(Long id, GroupCourseRecommend recommend);
|
||||||
|
|
||||||
|
Mono<Void> delete(Long id);
|
||||||
|
|
||||||
|
Mono<GroupCourseRecommend> enable(Long id);
|
||||||
|
|
||||||
|
Mono<GroupCourseRecommend> disable(Long id);
|
||||||
|
}
|
||||||
+3
@@ -5,6 +5,7 @@ import cn.novalon.gym.manage.common.dto.PageRequest;
|
|||||||
import cn.novalon.gym.manage.common.dto.PageResponse;
|
import cn.novalon.gym.manage.common.dto.PageResponse;
|
||||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
||||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseDetail;
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseDetail;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.dto.GroupCourseQueryDto;
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
@@ -25,4 +26,6 @@ public interface IGroupCourseService {
|
|||||||
Mono<GroupCourse> signIn(Long courseId, Long memberId);
|
Mono<GroupCourse> signIn(Long courseId, Long memberId);
|
||||||
|
|
||||||
Mono<Void> delete(Long id);
|
Mono<Void> delete(Long id);
|
||||||
|
|
||||||
|
Mono<PageResponse<GroupCourse>> searchGroupCourses(GroupCourseQueryDto query);
|
||||||
}
|
}
|
||||||
|
|||||||
+142
@@ -0,0 +1,142 @@
|
|||||||
|
package cn.novalon.gym.manage.groupcourse.service.impl;
|
||||||
|
|
||||||
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseRecommend;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.repository.IGroupCourseRecommendRepository;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.repository.IGroupCourseRepository;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.service.IGroupCourseRecommendService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import reactor.core.publisher.Flux;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GroupCourseRecommendService implements IGroupCourseRecommendService {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(GroupCourseRecommendService.class);
|
||||||
|
|
||||||
|
private final IGroupCourseRecommendRepository recommendRepository;
|
||||||
|
private final IGroupCourseRepository groupCourseRepository;
|
||||||
|
|
||||||
|
public GroupCourseRecommendService(IGroupCourseRecommendRepository recommendRepository,
|
||||||
|
IGroupCourseRepository groupCourseRepository) {
|
||||||
|
this.recommendRepository = recommendRepository;
|
||||||
|
this.groupCourseRepository = groupCourseRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<GroupCourseRecommend> findById(Long id) {
|
||||||
|
return recommendRepository.findById(id)
|
||||||
|
.flatMap(this::fillGroupCourseInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Flux<GroupCourseRecommend> findAll() {
|
||||||
|
return recommendRepository.findAll()
|
||||||
|
.flatMap(this::fillGroupCourseInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Flux<GroupCourseRecommend> findAll(String sortBy, String sortOrder) {
|
||||||
|
return recommendRepository.findAll(sortBy, sortOrder)
|
||||||
|
.flatMap(this::fillGroupCourseInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Flux<GroupCourseRecommend> findAllActive() {
|
||||||
|
return recommendRepository.findAllActive()
|
||||||
|
.flatMap(this::fillGroupCourseInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Flux<GroupCourseRecommend> findByCourseId(Long courseId) {
|
||||||
|
return recommendRepository.findByCourseId(courseId)
|
||||||
|
.flatMap(this::fillGroupCourseInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<GroupCourseRecommend> create(GroupCourseRecommend recommend) {
|
||||||
|
if (recommend.getCourseId() == null) {
|
||||||
|
return Mono.error(new RuntimeException("团课ID不能为空"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return groupCourseRepository.findByIdAndDeletedAtIsNull(recommend.getCourseId())
|
||||||
|
.switchIfEmpty(Mono.error(new RuntimeException("团课不存在")))
|
||||||
|
.flatMap(course -> {
|
||||||
|
return recommendRepository.save(recommend)
|
||||||
|
.doOnSuccess(r -> logger.info("团课推荐创建成功 - id={}, courseId={}", r.getId(), r.getCourseId()))
|
||||||
|
.doOnError(error -> logger.error("团课推荐创建失败 - error: {}", error.getMessage()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<GroupCourseRecommend> update(Long id, GroupCourseRecommend recommend) {
|
||||||
|
return recommendRepository.findById(id)
|
||||||
|
.switchIfEmpty(Mono.error(new RuntimeException("团课推荐不存在")))
|
||||||
|
.flatMap(existing -> {
|
||||||
|
if (recommend.getRecommendTitle() != null) {
|
||||||
|
existing.setRecommendTitle(recommend.getRecommendTitle());
|
||||||
|
}
|
||||||
|
if (recommend.getRecommendContent() != null) {
|
||||||
|
existing.setRecommendContent(recommend.getRecommendContent());
|
||||||
|
}
|
||||||
|
if (recommend.getRecommendReason() != null) {
|
||||||
|
existing.setRecommendReason(recommend.getRecommendReason());
|
||||||
|
}
|
||||||
|
if (recommend.getPriority() != null) {
|
||||||
|
existing.setPriority(recommend.getPriority());
|
||||||
|
}
|
||||||
|
if (recommend.getIsActive() != null) {
|
||||||
|
existing.setIsActive(recommend.getIsActive());
|
||||||
|
}
|
||||||
|
if (recommend.getCourseId() != null) {
|
||||||
|
existing.setCourseId(recommend.getCourseId());
|
||||||
|
}
|
||||||
|
|
||||||
|
return recommendRepository.update(existing);
|
||||||
|
})
|
||||||
|
.doOnSuccess(r -> logger.info("团课推荐更新成功 - id={}", id))
|
||||||
|
.doOnError(error -> logger.error("团课推荐更新失败 - id={}, error: {}", id, error.getMessage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<Void> delete(Long id) {
|
||||||
|
return recommendRepository.findById(id)
|
||||||
|
.switchIfEmpty(Mono.error(new RuntimeException("团课推荐不存在")))
|
||||||
|
.flatMap(recommend -> {
|
||||||
|
return recommendRepository.deleteById(id)
|
||||||
|
.doOnSuccess(v -> logger.info("团课推荐删除成功 - id={}", id))
|
||||||
|
.doOnError(error -> logger.error("团课推荐删除失败 - id={}, error: {}", id, error.getMessage()));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<GroupCourseRecommend> enable(Long id) {
|
||||||
|
return recommendRepository.updateActiveStatus(id, true)
|
||||||
|
.switchIfEmpty(Mono.error(new RuntimeException("团课推荐不存在")))
|
||||||
|
.doOnSuccess(r -> logger.info("团课推荐启用成功 - id={}", id))
|
||||||
|
.doOnError(error -> logger.error("团课推荐启用失败 - id={}, error: {}", id, error.getMessage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<GroupCourseRecommend> disable(Long id) {
|
||||||
|
return recommendRepository.updateActiveStatus(id, false)
|
||||||
|
.switchIfEmpty(Mono.error(new RuntimeException("团课推荐不存在")))
|
||||||
|
.doOnSuccess(r -> logger.info("团课推荐禁用成功 - id={}", id))
|
||||||
|
.doOnError(error -> logger.error("团课推荐禁用失败 - id={}, error: {}", id, error.getMessage()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Mono<GroupCourseRecommend> fillGroupCourseInfo(GroupCourseRecommend recommend) {
|
||||||
|
if (recommend.getCourseId() == null) {
|
||||||
|
return Mono.just(recommend);
|
||||||
|
}
|
||||||
|
|
||||||
|
return groupCourseRepository.findByIdAndDeletedAtIsNull(recommend.getCourseId())
|
||||||
|
.map(course -> {
|
||||||
|
recommend.setGroupCourse(course);
|
||||||
|
return recommend;
|
||||||
|
})
|
||||||
|
.defaultIfEmpty(recommend);
|
||||||
|
}
|
||||||
|
}
|
||||||
+95
-10
@@ -9,6 +9,7 @@ import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
|||||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseBooking;
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseBooking;
|
||||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseDetail;
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseDetail;
|
||||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseType;
|
import cn.novalon.gym.manage.groupcourse.domain.GroupCourseType;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.dto.GroupCourseQueryDto;
|
||||||
import cn.novalon.gym.manage.groupcourse.enums.CourseEvent;
|
import cn.novalon.gym.manage.groupcourse.enums.CourseEvent;
|
||||||
import cn.novalon.gym.manage.groupcourse.enums.CourseStatus;
|
import cn.novalon.gym.manage.groupcourse.enums.CourseStatus;
|
||||||
import cn.novalon.gym.manage.groupcourse.handler.GroupCourseStateMachine;
|
import cn.novalon.gym.manage.groupcourse.handler.GroupCourseStateMachine;
|
||||||
@@ -17,6 +18,7 @@ import cn.novalon.gym.manage.groupcourse.repository.IGroupCourseBookingRepositor
|
|||||||
import cn.novalon.gym.manage.groupcourse.repository.IGroupCourseRepository;
|
import cn.novalon.gym.manage.groupcourse.repository.IGroupCourseRepository;
|
||||||
import cn.novalon.gym.manage.groupcourse.repository.IGroupCourseTypeRepository;
|
import cn.novalon.gym.manage.groupcourse.repository.IGroupCourseTypeRepository;
|
||||||
import cn.novalon.gym.manage.groupcourse.service.IGroupCourseService;
|
import cn.novalon.gym.manage.groupcourse.service.IGroupCourseService;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.util.QRCodeUtil;
|
||||||
import cn.novalon.gym.manage.member.entity.MemberCard;
|
import cn.novalon.gym.manage.member.entity.MemberCard;
|
||||||
import cn.novalon.gym.manage.member.entity.MemberCardRecord;
|
import cn.novalon.gym.manage.member.entity.MemberCardRecord;
|
||||||
import cn.novalon.gym.manage.member.enums.MemberCardType;
|
import cn.novalon.gym.manage.member.enums.MemberCardType;
|
||||||
@@ -26,11 +28,14 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.r2dbc.core.DatabaseClient;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class GroupCourseService implements IGroupCourseService {
|
public class GroupCourseService implements IGroupCourseService {
|
||||||
@@ -45,6 +50,7 @@ public class GroupCourseService implements IGroupCourseService {
|
|||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
private final GroupCourseStateMachine stateMachine;
|
private final GroupCourseStateMachine stateMachine;
|
||||||
|
private final DatabaseClient databaseClient;
|
||||||
|
|
||||||
private static final String CACHE_KEY_PREFIX = "group_course:page:";
|
private static final String CACHE_KEY_PREFIX = "group_course:page:";
|
||||||
private static final String CACHE_KEY_ID_PREFIX = "group_course:id:";
|
private static final String CACHE_KEY_ID_PREFIX = "group_course:id:";
|
||||||
@@ -61,7 +67,8 @@ public class GroupCourseService implements IGroupCourseService {
|
|||||||
MemberCardRepository memberCardRepository,
|
MemberCardRepository memberCardRepository,
|
||||||
RedisUtil redisUtil,
|
RedisUtil redisUtil,
|
||||||
ObjectMapper objectMapper,
|
ObjectMapper objectMapper,
|
||||||
GroupCourseStateMachine stateMachine){
|
GroupCourseStateMachine stateMachine,
|
||||||
|
DatabaseClient databaseClient){
|
||||||
this.groupCourseRepository = groupCourseRepository;
|
this.groupCourseRepository = groupCourseRepository;
|
||||||
this.bookingRepository = bookingRepository;
|
this.bookingRepository = bookingRepository;
|
||||||
this.groupCourseTypeRepository = groupCourseTypeRepository;
|
this.groupCourseTypeRepository = groupCourseTypeRepository;
|
||||||
@@ -71,6 +78,7 @@ public class GroupCourseService implements IGroupCourseService {
|
|||||||
this.redisUtil = redisUtil;
|
this.redisUtil = redisUtil;
|
||||||
this.objectMapper = objectMapper;
|
this.objectMapper = objectMapper;
|
||||||
this.stateMachine = stateMachine;
|
this.stateMachine = stateMachine;
|
||||||
|
this.databaseClient = databaseClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -149,6 +157,7 @@ public class GroupCourseService implements IGroupCourseService {
|
|||||||
detail.setDescription(course.getDescription());
|
detail.setDescription(course.getDescription());
|
||||||
detail.setPointCardAmount(course.getPointCardAmount());
|
detail.setPointCardAmount(course.getPointCardAmount());
|
||||||
detail.setStoredValueAmount(course.getStoredValueAmount());
|
detail.setStoredValueAmount(course.getStoredValueAmount());
|
||||||
|
detail.setQrCodePath(course.getQrCodePath());
|
||||||
detail.setCreatedAt(course.getCreatedAt());
|
detail.setCreatedAt(course.getCreatedAt());
|
||||||
detail.setUpdatedAt(course.getUpdatedAt());
|
detail.setUpdatedAt(course.getUpdatedAt());
|
||||||
|
|
||||||
@@ -262,7 +271,38 @@ public class GroupCourseService implements IGroupCourseService {
|
|||||||
@Override
|
@Override
|
||||||
public Mono<GroupCourse> create(GroupCourse groupCourse) {
|
public Mono<GroupCourse> create(GroupCourse groupCourse) {
|
||||||
return groupCourseRepository.save(groupCourse)
|
return groupCourseRepository.save(groupCourse)
|
||||||
.doOnSuccess(course -> logger.info("团课创建成功 - id={}, name={}", course.getId(), course.getCourseName()))
|
.flatMap(course -> {
|
||||||
|
try {
|
||||||
|
// 生成二维码内容:团课基础信息JSON
|
||||||
|
Map<String, Object> qrCodeContent = new HashMap<>();
|
||||||
|
qrCodeContent.put("id", course.getId());
|
||||||
|
qrCodeContent.put("courseName", course.getCourseName());
|
||||||
|
qrCodeContent.put("coachId", course.getCoachId());
|
||||||
|
qrCodeContent.put("courseType", course.getCourseType());
|
||||||
|
qrCodeContent.put("startTime", course.getStartTime());
|
||||||
|
qrCodeContent.put("endTime", course.getEndTime());
|
||||||
|
qrCodeContent.put("maxMembers", course.getMaxMembers());
|
||||||
|
qrCodeContent.put("location", course.getLocation());
|
||||||
|
qrCodeContent.put("description", course.getDescription());
|
||||||
|
qrCodeContent.put("createdAt", course.getCreatedAt());
|
||||||
|
|
||||||
|
String jsonContent = objectMapper.writeValueAsString(qrCodeContent);
|
||||||
|
|
||||||
|
// 生成二维码并上传到阿里云OSS
|
||||||
|
String qrCodeUrl = QRCodeUtil.generateQRCodeAndUploadToOSS(jsonContent);
|
||||||
|
course.setQrCodePath(qrCodeUrl);
|
||||||
|
|
||||||
|
logger.info("团课二维码上传到OSS成功 - id={}, qrCodeUrl={}", course.getId(), qrCodeUrl);
|
||||||
|
|
||||||
|
// 更新团课信息,保存二维码路径
|
||||||
|
return groupCourseRepository.update(course)
|
||||||
|
.doOnSuccess(updatedCourse -> logger.info("团课创建成功 - id={}, name={}", updatedCourse.getId(), updatedCourse.getCourseName()));
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("团课二维码生成失败 - id={}, error: {}", course.getId(), e.getMessage(), e);
|
||||||
|
// 即使二维码生成失败,也返回成功创建的团课
|
||||||
|
return Mono.just(course);
|
||||||
|
}
|
||||||
|
})
|
||||||
.flatMap(course -> clearCache().thenReturn(course))
|
.flatMap(course -> clearCache().thenReturn(course))
|
||||||
.doOnError(error -> logger.error("团课创建失败 - error: {}", error.getMessage()));
|
.doOnError(error -> logger.error("团课创建失败 - error: {}", error.getMessage()));
|
||||||
}
|
}
|
||||||
@@ -308,6 +348,9 @@ public class GroupCourseService implements IGroupCourseService {
|
|||||||
if (groupCourse.getStoredValueAmount() != null) {
|
if (groupCourse.getStoredValueAmount() != null) {
|
||||||
existing.setStoredValueAmount(groupCourse.getStoredValueAmount());
|
existing.setStoredValueAmount(groupCourse.getStoredValueAmount());
|
||||||
}
|
}
|
||||||
|
if (groupCourse.getQrCodePath() != null) {
|
||||||
|
existing.setQrCodePath(groupCourse.getQrCodePath());
|
||||||
|
}
|
||||||
return groupCourseRepository.update(existing);
|
return groupCourseRepository.update(existing);
|
||||||
})
|
})
|
||||||
.doOnSuccess(course -> logger.info("团课更新成功 - id={}", id))
|
.doOnSuccess(course -> logger.info("团课更新成功 - id={}", id))
|
||||||
@@ -440,28 +483,58 @@ public class GroupCourseService implements IGroupCourseService {
|
|||||||
@Override
|
@Override
|
||||||
public Mono<GroupCourse> signIn(Long courseId, Long memberId) {
|
public Mono<GroupCourse> signIn(Long courseId, Long memberId) {
|
||||||
return groupCourseRepository.findByIdAndDeletedAtIsNull(courseId)
|
return groupCourseRepository.findByIdAndDeletedAtIsNull(courseId)
|
||||||
.switchIfEmpty(Mono.error(new RuntimeException("团课不存在")))
|
.switchIfEmpty(Mono.error(new RuntimeException("团课不存在或已删除")))
|
||||||
.flatMap(course -> {
|
.flatMap(course -> {
|
||||||
if (course.getStatus() != 0L) {
|
// 校验1:团课已取消
|
||||||
return Mono.error(new RuntimeException("课程状态不允许签到"));
|
if (course.getStatus().equals(CourseStatus.CANCELLED.getValue())) {
|
||||||
|
return Mono.error(new RuntimeException("团课已取消,无法签到"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 校验2:团课已结束
|
||||||
|
if (course.getStatus().equals(CourseStatus.ENDED.getValue())) {
|
||||||
|
return Mono.error(new RuntimeException("团课已结束,无法签到"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验3:签到时间校验(开课前2小时内才能签到)
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
LocalDateTime signInStart = course.getStartTime().minusHours(2);
|
||||||
|
if (now.isBefore(signInStart)) {
|
||||||
|
return Mono.error(new RuntimeException("未到签到时间,请在开课前2小时内签到"));
|
||||||
|
}
|
||||||
|
if (now.isAfter(course.getEndTime())) {
|
||||||
|
return Mono.error(new RuntimeException("团课已结束,无法签到"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验4:课程已满员
|
||||||
if (course.getCurrentMembers() >= course.getMaxMembers()) {
|
if (course.getCurrentMembers() >= course.getMaxMembers()) {
|
||||||
return Mono.error(new RuntimeException("课程已满员"));
|
return Mono.error(new RuntimeException("课程已满员,无法签到"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查会员是否已预约此课程
|
// 校验5:用户今日是否已到店签到(直接查询sign_in_record表)
|
||||||
|
LocalDateTime todayStart = LocalDateTime.now().toLocalDate().atStartOfDay();
|
||||||
|
LocalDateTime todayEnd = todayStart.plusDays(1);
|
||||||
|
return databaseClient.sql("SELECT sign_in_status FROM sign_in_record WHERE member_id = :memberId AND sign_in_time >= :startTime AND sign_in_time < :endTime AND is_delete = false ORDER BY sign_in_time DESC LIMIT 1")
|
||||||
|
.bind("memberId", memberId)
|
||||||
|
.bind("startTime", todayStart)
|
||||||
|
.bind("endTime", todayEnd)
|
||||||
|
.map(row -> row.get("sign_in_status", String.class))
|
||||||
|
.one()
|
||||||
|
.switchIfEmpty(Mono.error(new RuntimeException("请先完成到店签到")))
|
||||||
|
.flatMap(status -> {
|
||||||
|
if (!"SUCCESS".equals(status)) {
|
||||||
|
return Mono.error(new RuntimeException("到店签到未成功,请重新签到"));
|
||||||
|
}
|
||||||
|
// 校验6:用户已预约此课程(有效预约,状态为0-已预约)
|
||||||
return bookingRepository.findValidBooking(courseId, memberId)
|
return bookingRepository.findValidBooking(courseId, memberId)
|
||||||
.switchIfEmpty(Mono.error(new RuntimeException("会员未预约此课程")))
|
.switchIfEmpty(Mono.error(new RuntimeException("您未预约此课程,无法签到")))
|
||||||
.flatMap(booking -> {
|
.flatMap(booking -> {
|
||||||
// 更新课程当前人数
|
|
||||||
return groupCourseRepository.updateCurrentMembers(courseId, 1)
|
return groupCourseRepository.updateCurrentMembers(courseId, 1)
|
||||||
.flatMap(updatedCourse -> {
|
.flatMap(updatedCourse -> {
|
||||||
// 更新预约状态为已出席
|
|
||||||
return bookingRepository.updateStatus(booking.getId(), "2")
|
return bookingRepository.updateStatus(booking.getId(), "2")
|
||||||
.thenReturn(updatedCourse);
|
.thenReturn(updatedCourse);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.doOnSuccess(course -> logger.info("团课签到成功 - courseId={}, memberId={}", courseId, memberId))
|
.doOnSuccess(course -> logger.info("团课签到成功 - courseId={}, memberId={}", courseId, memberId))
|
||||||
.flatMap(course -> clearCache().thenReturn(course))
|
.flatMap(course -> clearCache().thenReturn(course))
|
||||||
@@ -488,6 +561,18 @@ public class GroupCourseService implements IGroupCourseService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<PageResponse<GroupCourse>> searchGroupCourses(GroupCourseQueryDto query) {
|
||||||
|
logger.info("多条件查询团课 - courseName={}, courseType={}, startDate={}, endDate={}, timePeriod={}, priceSort={}, remainingMost={}",
|
||||||
|
query.getCourseName(), query.getCourseType(), query.getStartDate(), query.getEndDate(),
|
||||||
|
query.getTimePeriod(), query.getPriceSort(), query.getRemainingMost());
|
||||||
|
|
||||||
|
return groupCourseRepository.searchGroupCourses(query)
|
||||||
|
.doOnSuccess(result -> logger.info("多条件查询结果 - total={}, page={}, size={}",
|
||||||
|
result.getTotalElements(), result.getCurrentPage(), result.getPageSize()))
|
||||||
|
.doOnError(error -> logger.error("多条件查询失败 - error: {}", error.getMessage()));
|
||||||
|
}
|
||||||
|
|
||||||
private Mono<Void> clearCache() {
|
private Mono<Void> clearCache() {
|
||||||
return redisUtil.deleteByPattern(CACHE_KEY_PREFIX + "*")
|
return redisUtil.deleteByPattern(CACHE_KEY_PREFIX + "*")
|
||||||
.then(redisUtil.deleteByPattern(CACHE_KEY_ID_PREFIX + "*"))
|
.then(redisUtil.deleteByPattern(CACHE_KEY_ID_PREFIX + "*"))
|
||||||
|
|||||||
+109
@@ -0,0 +1,109 @@
|
|||||||
|
package cn.novalon.gym.manage.groupcourse.util;
|
||||||
|
|
||||||
|
import com.aliyun.oss.OSS;
|
||||||
|
import com.aliyun.oss.OSSClientBuilder;
|
||||||
|
import com.aliyun.oss.model.PutObjectRequest;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阿里云OSS工具类
|
||||||
|
*/
|
||||||
|
public class OSSUtil {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(OSSUtil.class);
|
||||||
|
|
||||||
|
// OSS配置信息
|
||||||
|
private static final String ENDPOINT = "oss-cn-beijing.aliyuncs.com";
|
||||||
|
private static final String ACCESS_KEY_ID = "LTAI5t9TFh9Vayeahz45kZjg";
|
||||||
|
private static final String ACCESS_KEY_SECRET = "zD6NlCeH5UhjBs4vnQVqn8Ksi3CaZz";
|
||||||
|
private static final String BUCKET_NAME = "ycc-filesaver";
|
||||||
|
|
||||||
|
// OSS访问地址前缀
|
||||||
|
private static final String OSS_URL_PREFIX = "https://" + BUCKET_NAME + "." + ENDPOINT + "/";
|
||||||
|
|
||||||
|
// 文件存储目录
|
||||||
|
private static final String QRCODE_DIR = "qrcode/";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文件到阿里云OSS
|
||||||
|
*
|
||||||
|
* @param localFilePath 本地文件路径
|
||||||
|
* @param fileName 文件名(不含路径)
|
||||||
|
* @return OSS访问地址
|
||||||
|
*/
|
||||||
|
public static String uploadToOSS(String localFilePath, String fileName) {
|
||||||
|
OSS ossClient = null;
|
||||||
|
try {
|
||||||
|
// 创建OSS客户端
|
||||||
|
ossClient = new OSSClientBuilder().build(ENDPOINT, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
|
||||||
|
|
||||||
|
// 构建OSS文件路径:qrcode/2026/06/18/xxx.png
|
||||||
|
String datePath = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd"));
|
||||||
|
String ossFilePath = QRCODE_DIR + datePath + "/" + fileName;
|
||||||
|
|
||||||
|
// 创建上传请求
|
||||||
|
PutObjectRequest putObjectRequest = new PutObjectRequest(BUCKET_NAME, ossFilePath, new File(localFilePath));
|
||||||
|
|
||||||
|
// 上传文件
|
||||||
|
ossClient.putObject(putObjectRequest);
|
||||||
|
|
||||||
|
// 构建访问地址
|
||||||
|
String accessUrl = OSS_URL_PREFIX + ossFilePath;
|
||||||
|
|
||||||
|
logger.info("文件上传到OSS成功: localPath={}, ossUrl={}", localFilePath, accessUrl);
|
||||||
|
|
||||||
|
return accessUrl;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("文件上传到OSS失败 - localPath: {}, error: {}", localFilePath, e.getMessage(), e);
|
||||||
|
throw new RuntimeException("文件上传到OSS失败: " + e.getMessage(), e);
|
||||||
|
} finally {
|
||||||
|
if (ossClient != null) {
|
||||||
|
ossClient.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文件到阿里云OSS(自定义存储路径)
|
||||||
|
*
|
||||||
|
* @param localFilePath 本地文件路径
|
||||||
|
* @param ossDirectory OSS存储目录
|
||||||
|
* @param fileName 文件名(不含路径)
|
||||||
|
* @return OSS访问地址
|
||||||
|
*/
|
||||||
|
public static String uploadToOSS(String localFilePath, String ossDirectory, String fileName) {
|
||||||
|
OSS ossClient = null;
|
||||||
|
try {
|
||||||
|
// 创建OSS客户端
|
||||||
|
ossClient = new OSSClientBuilder().build(ENDPOINT, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
|
||||||
|
|
||||||
|
// 构建OSS文件路径
|
||||||
|
String ossFilePath = ossDirectory + fileName;
|
||||||
|
|
||||||
|
// 创建上传请求
|
||||||
|
PutObjectRequest putObjectRequest = new PutObjectRequest(BUCKET_NAME, ossFilePath, new File(localFilePath));
|
||||||
|
|
||||||
|
// 上传文件
|
||||||
|
ossClient.putObject(putObjectRequest);
|
||||||
|
|
||||||
|
// 构建访问地址
|
||||||
|
String accessUrl = OSS_URL_PREFIX + ossFilePath;
|
||||||
|
|
||||||
|
logger.info("文件上传到OSS成功: localPath={}, ossUrl={}", localFilePath, accessUrl);
|
||||||
|
|
||||||
|
return accessUrl;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("文件上传到OSS失败 - localPath: {}, error: {}", localFilePath, e.getMessage(), e);
|
||||||
|
throw new RuntimeException("文件上传到OSS失败: " + e.getMessage(), e);
|
||||||
|
} finally {
|
||||||
|
if (ossClient != null) {
|
||||||
|
ossClient.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+156
@@ -0,0 +1,156 @@
|
|||||||
|
package cn.novalon.gym.manage.groupcourse.util;
|
||||||
|
|
||||||
|
import com.google.zxing.BarcodeFormat;
|
||||||
|
import com.google.zxing.EncodeHintType;
|
||||||
|
import com.google.zxing.WriterException;
|
||||||
|
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 org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二维码生成工具类
|
||||||
|
*/
|
||||||
|
public class QRCodeUtil {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(QRCodeUtil.class);
|
||||||
|
|
||||||
|
// 二维码默认保存路径(本地临时路径)
|
||||||
|
private static final String DEFAULT_SAVE_PATH = "D:\\Games\\exmp\\image";
|
||||||
|
|
||||||
|
// 二维码尺寸
|
||||||
|
private static final int QR_CODE_WIDTH = 300;
|
||||||
|
private static final int QR_CODE_HEIGHT = 300;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成二维码并保存到指定路径
|
||||||
|
*
|
||||||
|
* @param content 二维码内容
|
||||||
|
* @param savePath 保存路径
|
||||||
|
* @param fileName 文件名(不含扩展名)
|
||||||
|
* @return 生成的二维码文件完整路径
|
||||||
|
*/
|
||||||
|
public static String generateQRCode(String content, String savePath, String fileName) {
|
||||||
|
try {
|
||||||
|
Path directory = Paths.get(savePath);
|
||||||
|
if (!Files.exists(directory)) {
|
||||||
|
Files.createDirectories(directory);
|
||||||
|
logger.info("创建二维码保存目录: {}", savePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<EncodeHintType, Object> 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, QR_CODE_WIDTH, QR_CODE_HEIGHT, hints);
|
||||||
|
|
||||||
|
String filePath = Paths.get(savePath, fileName + ".png").toString();
|
||||||
|
Path path = Paths.get(filePath);
|
||||||
|
|
||||||
|
MatrixToImageWriter.writeToPath(bitMatrix, "PNG", path);
|
||||||
|
logger.info("二维码生成成功: {}", filePath);
|
||||||
|
|
||||||
|
return filePath;
|
||||||
|
} catch (WriterException e) {
|
||||||
|
logger.error("二维码生成失败 - WriterException: {}", e.getMessage(), e);
|
||||||
|
throw new RuntimeException("二维码生成失败: " + e.getMessage(), e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error("二维码保存失败 - IOException: {}", e.getMessage(), e);
|
||||||
|
throw new RuntimeException("二维码保存失败: " + e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成二维码并保存到默认路径
|
||||||
|
* 文件名格式: UUID + 创建时间
|
||||||
|
*
|
||||||
|
* @param content 二维码内容
|
||||||
|
* @return 生成的二维码文件完整路径
|
||||||
|
*/
|
||||||
|
public static String generateQRCode(String content) {
|
||||||
|
String uuid = UUID.randomUUID().toString().replace("-", "");
|
||||||
|
String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||||
|
String fileName = uuid + "_" + timestamp;
|
||||||
|
|
||||||
|
return generateQRCode(content, DEFAULT_SAVE_PATH, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成二维码并保存到默认路径,使用自定义文件名
|
||||||
|
*
|
||||||
|
* @param content 二维码内容
|
||||||
|
* @param fileName 文件名(不含扩展名)
|
||||||
|
* @return 生成的二维码文件完整路径
|
||||||
|
*/
|
||||||
|
public static String generateQRCodeWithFileName(String content, String fileName) {
|
||||||
|
return generateQRCode(content, DEFAULT_SAVE_PATH, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成二维码并上传到阿里云OSS
|
||||||
|
* 文件名格式: UUID + 创建时间
|
||||||
|
*
|
||||||
|
* @param content 二维码内容
|
||||||
|
* @return 阿里云OSS访问地址
|
||||||
|
*/
|
||||||
|
public static String generateQRCodeAndUploadToOSS(String content) {
|
||||||
|
String uuid = UUID.randomUUID().toString().replace("-", "");
|
||||||
|
String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||||
|
String fileName = uuid + "_" + timestamp + ".png";
|
||||||
|
|
||||||
|
return generateQRCodeAndUploadToOSS(content, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成二维码并上传到阿里云OSS
|
||||||
|
*
|
||||||
|
* @param content 二维码内容
|
||||||
|
* @param fileName 文件名(含扩展名)
|
||||||
|
* @return 阿里云OSS访问地址
|
||||||
|
*/
|
||||||
|
public static String generateQRCodeAndUploadToOSS(String content, String fileName) {
|
||||||
|
try {
|
||||||
|
Path tempDir = Files.createTempDirectory("qrcode_temp");
|
||||||
|
String tempFilePath = tempDir.resolve(fileName).toString();
|
||||||
|
|
||||||
|
Map<EncodeHintType, Object> 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, QR_CODE_WIDTH, QR_CODE_HEIGHT, hints);
|
||||||
|
|
||||||
|
MatrixToImageWriter.writeToPath(bitMatrix, "PNG", Paths.get(tempFilePath));
|
||||||
|
logger.info("二维码临时文件生成成功: {}", tempFilePath);
|
||||||
|
|
||||||
|
String ossUrl = OSSUtil.uploadToOSS(tempFilePath, fileName);
|
||||||
|
|
||||||
|
Files.deleteIfExists(Paths.get(tempFilePath));
|
||||||
|
Files.deleteIfExists(tempDir);
|
||||||
|
logger.info("临时文件已删除: {}", tempFilePath);
|
||||||
|
|
||||||
|
return ossUrl;
|
||||||
|
} catch (WriterException e) {
|
||||||
|
logger.error("二维码生成失败 - WriterException: {}", e.getMessage(), e);
|
||||||
|
throw new RuntimeException("二维码生成失败: " + e.getMessage(), e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error("二维码处理失败 - IOException: {}", e.getMessage(), e);
|
||||||
|
throw new RuntimeException("二维码处理失败: " + e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
package cn.novalon.gym.manage.groupcourse.util;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.api.io.TempDir;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QRCodeUtil测试类
|
||||||
|
*/
|
||||||
|
class QRCodeUtilTest {
|
||||||
|
|
||||||
|
@TempDir
|
||||||
|
Path tempDir;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testGenerateQRCode() {
|
||||||
|
String content = "测试二维码内容";
|
||||||
|
String qrCodePath = QRCodeUtil.generateQRCode(content);
|
||||||
|
|
||||||
|
assertNotNull(qrCodePath, "二维码路径不应为空");
|
||||||
|
assertTrue(qrCodePath.endsWith(".png"), "二维码文件应为PNG格式");
|
||||||
|
assertTrue(qrCodePath.contains("D:\\Games\\exmp\\image"), "二维码应保存到指定路径");
|
||||||
|
|
||||||
|
System.out.println("生成的二维码路径: " + qrCodePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testGenerateQRCodeWithCustomPath() {
|
||||||
|
String content = "自定义路径测试";
|
||||||
|
String customPath = tempDir.toString();
|
||||||
|
String fileName = "test_qrcode";
|
||||||
|
|
||||||
|
String qrCodePath = QRCodeUtil.generateQRCode(content, customPath, fileName);
|
||||||
|
|
||||||
|
assertNotNull(qrCodePath, "二维码路径不应为空");
|
||||||
|
assertTrue(qrCodePath.endsWith(".png"), "二维码文件应为PNG格式");
|
||||||
|
assertTrue(qrCodePath.contains(fileName), "二维码文件名应包含指定名称");
|
||||||
|
|
||||||
|
System.out.println("生成的二维码路径: " + qrCodePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testGenerateQRCodeWithJsonContent() {
|
||||||
|
String jsonContent = "{\"id\":1,\"courseName\":\"瑜伽课\",\"coachId\":100,\"startTime\":\"2026-06-18T10:00:00\"}";
|
||||||
|
|
||||||
|
String qrCodePath = QRCodeUtil.generateQRCode(jsonContent);
|
||||||
|
|
||||||
|
assertNotNull(qrCodePath, "二维码路径不应为空");
|
||||||
|
assertTrue(qrCodePath.endsWith(".png"), "二维码文件应为PNG格式");
|
||||||
|
|
||||||
|
System.out.println("JSON内容二维码路径: " + qrCodePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testGenerateQRCodeAndUploadToOSS() {
|
||||||
|
String jsonContent = "{\"id\":1,\"courseName\":\"瑜伽课\",\"coachId\":100,\"startTime\":\"2026-06-18T10:00:00\"}";
|
||||||
|
|
||||||
|
String ossUrl = QRCodeUtil.generateQRCodeAndUploadToOSS(jsonContent);
|
||||||
|
|
||||||
|
assertNotNull(ossUrl, "OSS访问地址不应为空");
|
||||||
|
assertTrue(ossUrl.startsWith("https://"), "OSS访问地址应为HTTPS");
|
||||||
|
assertTrue(ossUrl.contains("ycc-filesaver.oss-cn-beijing.aliyuncs.com"), "OSS访问地址应包含正确的域名");
|
||||||
|
assertTrue(ossUrl.contains("/qrcode/"), "OSS访问地址应包含qrcode目录");
|
||||||
|
assertTrue(ossUrl.endsWith(".png"), "OSS访问地址应为PNG格式");
|
||||||
|
|
||||||
|
System.out.println("上传到OSS的二维码地址: " + ossUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
+387
-223
@@ -1,223 +1,387 @@
|
|||||||
2026-06-11T13:43:44.371+08:00 TRACE 9324 --- [gym-manage-api] [nio-8084-exec-2] o.s.w.s.adapter.HttpWebHandlerAdapter : [27afd417] HTTP POST "/api/groupCourse/types/1/labels", headers={masked}
|
[
|
||||||
2026-06-11T13:43:44.372+08:00 DEBUG 9324 --- [gym-manage-api] [ parallel-2] o.s.w.s.s.DefaultWebSessionManager : Created new WebSession.
|
{
|
||||||
2026-06-11T13:43:44.372+08:00 INFO 9324 --- [gym-manage-api] [ parallel-2] c.n.g.m.sys.audit.OperationLogWebFilter : WebFilter 拦截请求: POST /api/groupCourse/types/1/labels
|
"id": "3",
|
||||||
2026-06-11T13:43:44.372+08:00 INFO 9324 --- [gym-manage-api] [ parallel-2] c.n.g.m.sys.audit.OperationLogWebFilter : 未匹配到操作日志配置,跳过: POST /api/groupCourse/types/1/labels
|
"createBy": "admin",
|
||||||
2026-06-11T13:43:44.372+08:00 INFO 9324 --- [gym-manage-api] [ parallel-2] c.n.g.m.sys.audit.OperationLogWebFilter : WebFilter 拦截请求: POST /api/groupCourse/types/1/labels
|
"updateBy": null,
|
||||||
2026-06-11T13:43:44.372+08:00 INFO 9324 --- [gym-manage-api] [ parallel-2] c.n.g.m.sys.audit.OperationLogWebFilter : 未匹配到操作日志配置,跳过: POST /api/groupCourse/types/1/labels
|
"createdAt": "2026-06-15T10:00:00",
|
||||||
2026-06-11T13:43:44.372+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"updatedAt": "2026-06-15T10:00:00",
|
||||||
2026-06-11T13:43:44.372+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"deletedAt": null,
|
||||||
2026-06-11T13:43:44.372+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"courseId": "1",
|
||||||
2026-06-11T13:43:44.372+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"recommendTitle": "本周热门推荐",
|
||||||
2026-06-11T13:43:44.372+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"recommendContent": "极速燃脂单车课程,跟随音乐节奏变换阻力和速度,体验爬坡与冲刺的快感,一节课消耗800大卡!",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"recommendReason": "教练专业,课程内容丰富,深受学员喜爱,燃脂效果显著",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/dictionaries" does not match against value "/api/groupCourse/types/1/labels"
|
"priority": 20,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "PUT" does not match against value "POST"
|
"isActive": true,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "DELETE" does not match against value "POST"
|
"groupCourse": {
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"id": "1",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"createBy": "system",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"updateBy": "system",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"createdAt": "2026-06-11T13:50:25.118925",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"updatedAt": "2026-06-11T13:50:25.118925",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"deletedAt": null,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"courseName": "动感单车升级版aaaaa",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/users" does not match against value "/api/groupCourse/types/1/labels"
|
"coachId": "2",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"courseType": "2",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "PUT" does not match against value "POST"
|
"startTime": "2026-06-02T16:45:00",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "DELETE" does not match against value "POST"
|
"endTime": "2026-06-15T20:20:00",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"maxMembers": 30,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/users/{id}/action/change-password" does not match against value "/api/groupCourse/types/1/labels"
|
"currentMembers": 0,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"status": "0",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/users/{id}/action/logical-delete" does not match against value "/api/groupCourse/types/1/labels"
|
"location": "单车房",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"coverImage": "/images/spinning.jpg",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/users/logical-delete" does not match against value "/api/groupCourse/types/1/labels"
|
"description": "升级版高强度有氧运动课程",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"pointCardAmount": 2,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/users/action/restore" does not match against value "/api/groupCourse/types/1/labels"
|
"storedValueAmount": 80
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
}
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/users/{id}/action/restore" does not match against value "/api/groupCourse/types/1/labels"
|
},
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
{
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"id": "7",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/users/{id}/roles" does not match against value "/api/groupCourse/types/1/labels"
|
"createBy": "coach_li",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"updateBy": null,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"createdAt": "2026-05-25T09:15:00",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"updatedAt": "2026-05-25T09:15:00",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"deletedAt": null,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/menus" does not match against value "/api/groupCourse/types/1/labels"
|
"courseId": "6",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "PUT" does not match against value "POST"
|
"recommendTitle": "塑形热门课程",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "DELETE" does not match against value "POST"
|
"recommendContent": "蜜桃臀塑造课程,针对性训练臀部肌肉群,打造完美曲线。",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"recommendReason": "专业私教指导,动作标准,效果显著,深受女性学员喜爱",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"priority": 18,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"isActive": true,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"groupCourse": {
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"id": "6",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"createBy": "coach_li",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"updateBy": null,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/roles" does not match against value "/api/groupCourse/types/1/labels"
|
"createdAt": "2026-05-20T09:15:00",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "PUT" does not match against value "POST"
|
"updatedAt": "2026-05-20T09:15:00",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "DELETE" does not match against value "POST"
|
"deletedAt": null,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"courseName": "蜜桃臀塑造",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/roles/{id}/restore" does not match against value "/api/groupCourse/types/1/labels"
|
"coachId": "103",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"courseType": "3",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"startTime": "2026-05-30T19:00:00",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/roles/{id}/permissions" does not match against value "/api/groupCourse/types/1/labels"
|
"endTime": "2026-05-30T20:00:00",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"maxMembers": 10,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"currentMembers": 8,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"status": "2",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"location": "私教专区",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/config" does not match against value "/api/groupCourse/types/1/labels"
|
"coverImage": "/images/glute.jpg",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "PUT" does not match against value "POST"
|
"description": "针对性训练臀部肌肉群,课程已于5月30日结束,无法预约。",
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "DELETE" does not match against value "POST"
|
"pointCardAmount": 1,
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"storedValueAmount": 0
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
}
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
},
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
{
|
||||||
2026-06-11T13:43:44.373+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"id": "9",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"createBy": "coach_zhang",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"updateBy": null,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/logs/login" does not match against value "/api/groupCourse/types/1/labels"
|
"createdAt": "2026-06-15T14:00:00",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"updatedAt": "2026-06-15T14:00:00",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"deletedAt": null,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"courseId": "1",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"recommendTitle": "减脂首选课程",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"recommendContent": "想要快速减脂?极速燃脂单车是你的最佳选择!专业教练带领,科学训练计划。",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/logs/exception" does not match against value "/api/groupCourse/types/1/labels"
|
"recommendReason": "减脂效果最佳,课程强度适中,适合想要快速瘦身的学员",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"priority": 16,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"isActive": true,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"groupCourse": {
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"id": "1",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"createBy": "system",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"updateBy": "system",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/logs/operation" does not match against value "/api/groupCourse/types/1/labels"
|
"createdAt": "2026-06-11T13:50:25.118925",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"updatedAt": "2026-06-11T13:50:25.118925",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/auth/login" does not match against value "/api/groupCourse/types/1/labels"
|
"deletedAt": null,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"courseName": "动感单车升级版aaaaa",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/auth/register" does not match against value "/api/groupCourse/types/1/labels"
|
"coachId": "2",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"courseType": "2",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/auth/logout" does not match against value "/api/groupCourse/types/1/labels"
|
"startTime": "2026-06-02T16:45:00",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"endTime": "2026-06-15T20:20:00",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"maxMembers": 30,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"currentMembers": 0,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"status": "0",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"location": "单车房",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/dict/types" does not match against value "/api/groupCourse/types/1/labels"
|
"coverImage": "/images/spinning.jpg",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "PUT" does not match against value "POST"
|
"description": "升级版高强度有氧运动课程",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "DELETE" does not match against value "POST"
|
"pointCardAmount": 2,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"storedValueAmount": 80
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
}
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
},
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
{
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/dict/data" does not match against value "/api/groupCourse/types/1/labels"
|
"id": "4",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "PUT" does not match against value "POST"
|
"createBy": "admin",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "DELETE" does not match against value "POST"
|
"updateBy": null,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"createdAt": "2026-06-15T11:00:00",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"updatedAt": "2026-06-15T11:00:00",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"deletedAt": null,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"courseId": "2",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/notices" does not match against value "/api/groupCourse/types/1/labels"
|
"recommendTitle": "新手友好推荐",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "PUT" does not match against value "POST"
|
"recommendContent": "清晨流瑜伽课程,适合有一定基础的学员,通过流畅的体式连接呼吸,唤醒身体能量。",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "DELETE" does not match against value "POST"
|
"recommendReason": "适合新手入门,教练耐心指导,课程节奏适中",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"priority": 15,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"isActive": true,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"groupCourse": {
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"id": "2",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/messages" does not match against value "/api/groupCourse/types/1/labels"
|
"createBy": "admin",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "PUT" does not match against value "POST"
|
"updateBy": null,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "DELETE" does not match against value "POST"
|
"createdAt": "2026-06-01T10:00:00",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"updatedAt": "2026-06-01T10:00:00",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"deletedAt": null,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"courseName": "清晨流瑜伽",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/files/upload" does not match against value "/api/groupCourse/types/1/labels"
|
"coachId": "101",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"courseType": "1",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"startTime": "2026-06-12T09:00:00",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"endTime": "2026-06-12T10:30:00",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"maxMembers": 15,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "DELETE" does not match against value "POST"
|
"currentMembers": 5,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"status": "0",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"location": "A座3楼瑜伽教室",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"coverImage": "/images/yoga_flow.jpg",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"description": "适合有一定基础的学员,通过流畅的体式连接呼吸,唤醒身体能量。",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"pointCardAmount": 1,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"storedValueAmount": 0
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/permissions" does not match against value "/api/groupCourse/types/1/labels"
|
}
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "PUT" does not match against value "POST"
|
},
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "DELETE" does not match against value "POST"
|
{
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"id": "10",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/member/auth/miniapp/login" does not match against value "/api/groupCourse/types/1/labels"
|
"createBy": "coach_wang",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"updateBy": null,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"createdAt": "2026-06-15T15:00:00",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/member/auth/mp/callback" does not match against value "/api/groupCourse/types/1/labels"
|
"updatedAt": "2026-06-15T15:00:00",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"deletedAt": null,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "PUT" does not match against value "POST"
|
"courseId": "2",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"recommendTitle": "晨练优选",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/member/phone/bind" does not match against value "/api/groupCourse/types/1/labels"
|
"recommendContent": "清晨流瑜伽,唤醒身体能量,开启活力一天!适合晨练爱好者。",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"recommendReason": "晨练最佳选择,提升身体活力,改善精神状态",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"priority": 14,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/admin/member/{id}/phone" does not match against value "/api/groupCourse/types/1/labels"
|
"isActive": true,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"groupCourse": {
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "PUT" does not match against value "POST"
|
"id": "2",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"createBy": "admin",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"updateBy": null,
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"createdAt": "2026-06-01T10:00:00",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"updatedAt": "2026-06-01T10:00:00",
|
||||||
2026-06-11T13:43:44.375+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"deletedAt": null,
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/member-cards" does not match against value "/api/groupCourse/types/1/labels"
|
"courseName": "清晨流瑜伽",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"coachId": "101",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/member-card-records/purchase" does not match against value "/api/groupCourse/types/1/labels"
|
"courseType": "1",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"startTime": "2026-06-12T09:00:00",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/member-card-records/{recordId}/renew" does not match against value "/api/groupCourse/types/1/labels"
|
"endTime": "2026-06-12T10:30:00",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"maxMembers": 15,
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/member-card-records/{recordId}/use" does not match against value "/api/groupCourse/types/1/labels"
|
"currentMembers": 5,
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"status": "0",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/member-card-records/{recordId}/refund" does not match against value "/api/groupCourse/types/1/labels"
|
"location": "A座3楼瑜伽教室",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"coverImage": "/images/yoga_flow.jpg",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"description": "适合有一定基础的学员,通过流畅的体式连接呼吸,唤醒身体能量。",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"pointCardAmount": 1,
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/member-card-records/process-expired" does not match against value "/api/groupCourse/types/1/labels"
|
"storedValueAmount": 0
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
}
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/member-card-transactions" does not match against value "/api/groupCourse/types/1/labels"
|
},
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
{
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"id": "6",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"createBy": "coach_li",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"updateBy": null,
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"createdAt": "2026-06-15T13:00:00",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"updatedAt": "2026-06-15T13:00:00",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"deletedAt": null,
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"courseId": "4",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/groupCourse/page" does not match against value "/api/groupCourse/types/1/labels"
|
"recommendTitle": "基础瑜伽推荐",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"recommendContent": "基础哈他瑜伽课程,适合所有级别学员,通过基础体式练习提升身体柔韧性和平衡能力。",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"recommendReason": "零基础友好,适合所有健身水平,放松身心",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"priority": 12,
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"isActive": true,
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"groupCourse": {
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"id": "4",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/groupCourse/types" does not match against value "/api/groupCourse/types/1/labels"
|
"createBy": "coach_li",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "PUT" does not match against value "POST"
|
"updateBy": null,
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "DELETE" does not match against value "POST"
|
"createdAt": "2026-06-01T08:00:00",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"updatedAt": "2026-06-01T08:00:00",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"deletedAt": null,
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"courseName": "哈他瑜伽",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "GET" does not match against value "POST"
|
"coachId": "101",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"courseType": "1",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/groupCourse/labels" does not match against value "/api/groupCourse/types/1/labels"
|
"startTime": "2026-06-01T15:20:00",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "PUT" does not match against value "POST"
|
"endTime": "2026-06-01T16:50:00",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "DELETE" does not match against value "POST"
|
"maxMembers": 12,
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Method "POST" matches against value "POST"
|
"currentMembers": 3,
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.server.RequestPredicates : Pattern "/api/groupCourse/types/{typeId}/labels" matches against value "/api/groupCourse/types/1/labels"
|
"status": "0",
|
||||||
2026-06-11T13:43:44.376+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.function.server.RouterFunctions : [27afd417] Matched (POST && /api/groupCourse/types/{typeId}/labels)
|
"location": "瑜伽教室B",
|
||||||
2026-06-11T13:43:44.376+08:00 DEBUG 9324 --- [gym-manage-api] [ parallel-2] o.s.w.r.f.s.s.RouterFunctionMapping : [27afd417] Mapped to cn.novalon.gym.manage.app.config.SystemRouter$$Lambda/0x00000223a09d1920@3760f3e8
|
"coverImage": "/images/hatha_yoga.jpg",
|
||||||
2026-06-11T13:43:44.377+08:00 TRACE 9324 --- [gym-manage-api] [ parallel-2] org.springframework.web.HttpLogging : [27afd417] Decoded [{labelIds=[1, 3, 5]}]
|
"description": "基础哈他瑜伽,适合所有级别。距开始不足30分钟,已停止预约。",
|
||||||
2026-06-11T13:43:44.377+08:00 DEBUG 9324 --- [gym-manage-api] [ parallel-2] o.s.r.c.R2dbcTransactionManager : Creating new transaction with name [cn.novalon.gym.manage.groupcourse.repository.impl.CourseLabelRepository.addLabelsToType]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
|
"pointCardAmount": 1,
|
||||||
2026-06-11T13:43:44.377+08:00 DEBUG 9324 --- [gym-manage-api] [ parallel-2] o.s.r.c.R2dbcTransactionManager : Acquired Connection [PooledConnection[PostgresqlConnection{client=io.r2dbc.postgresql.client.ReactorNettyClient@c3a5202, codecs=io.r2dbc.postgresql.codec.DefaultCodecs@922d1d4}]] for R2DBC transaction
|
"storedValueAmount": 0
|
||||||
2026-06-11T13:43:44.377+08:00 DEBUG 9324 --- [gym-manage-api] [ parallel-2] o.s.r.c.R2dbcTransactionManager : Starting R2DBC transaction on Connection [PooledConnection[PostgresqlConnection{client=io.r2dbc.postgresql.client.ReactorNettyClient@c3a5202, codecs=io.r2dbc.postgresql.codec.DefaultCodecs@922d1d4}]] using [ExtendedTransactionDefinition [transactionName='cn.novalon.gym.manage.groupcourse.repository.impl.CourseLabelRepository.addLabelsToType', readOnly=false, isolationLevel=null, lockWaitTimeout=PT0S]]
|
}
|
||||||
2026-06-11T13:43:44.379+08:00 DEBUG 9324 --- [gym-manage-api] [actor-tcp-nio-6] o.s.r2dbc.core.DefaultDatabaseClient : Executing SQL statement [SELECT course_type_label.type_id, course_type_label.label_id, course_type_label.id, course_type_label.create_by, course_type_label.update_by, course_type_label.created_at, course_type_label.updated_at, course_type_label.deleted_at FROM course_type_label WHERE course_type_label.type_id = $1 AND (course_type_label.label_id = $2) AND (course_type_label.deleted_at IS NULL)]
|
},
|
||||||
2026-06-11T13:43:44.381+08:00 DEBUG 9324 --- [gym-manage-api] [actor-tcp-nio-6] o.s.r2dbc.core.DefaultDatabaseClient : Executing SQL statement [SELECT course_type_label.type_id, course_type_label.label_id, course_type_label.id, course_type_label.create_by, course_type_label.update_by, course_type_label.created_at, course_type_label.updated_at, course_type_label.deleted_at FROM course_type_label WHERE course_type_label.type_id = $1 AND (course_type_label.label_id = $2) AND (course_type_label.deleted_at IS NULL)]
|
{
|
||||||
2026-06-11T13:43:44.382+08:00 DEBUG 9324 --- [gym-manage-api] [actor-tcp-nio-6] o.s.r2dbc.core.DefaultDatabaseClient : Executing SQL statement [SELECT course_type_label.type_id, course_type_label.label_id, course_type_label.id, course_type_label.create_by, course_type_label.update_by, course_type_label.created_at, course_type_label.updated_at, course_type_label.deleted_at FROM course_type_label WHERE course_type_label.type_id = $1 AND (course_type_label.label_id = $2) AND (course_type_label.deleted_at IS NULL)]
|
"id": "11",
|
||||||
2026-06-11T13:43:44.382+08:00 DEBUG 9324 --- [gym-manage-api] [actor-tcp-nio-6] o.s.r2dbc.core.DefaultDatabaseClient : Executing SQL statement [INSERT INTO course_type_label (type_id, label_id, create_by, update_by, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6)]
|
"createBy": "coach_li",
|
||||||
2026-06-11T13:43:44.385+08:00 DEBUG 9324 --- [gym-manage-api] [actor-tcp-nio-6] o.s.r2dbc.core.DefaultDatabaseClient : Executing SQL statement [INSERT INTO course_type_label (type_id, label_id, create_by, update_by, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6)]
|
"updateBy": null,
|
||||||
2026-06-11T13:43:44.385+08:00 DEBUG 9324 --- [gym-manage-api] [actor-tcp-nio-6] o.s.r2dbc.core.DefaultDatabaseClient : Executing SQL statement [INSERT INTO course_type_label (type_id, label_id, create_by, update_by, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6)]
|
"createdAt": "2026-06-15T16:00:00",
|
||||||
2026-06-11T13:43:44.387+08:00 DEBUG 9324 --- [gym-manage-api] [actor-tcp-nio-6] o.s.r.c.R2dbcTransactionManager : Initiating transaction rollback
|
"updatedAt": "2026-06-15T16:00:00",
|
||||||
2026-06-11T13:43:44.387+08:00 DEBUG 9324 --- [gym-manage-api] [actor-tcp-nio-6] o.s.r.c.R2dbcTransactionManager : Rolling back R2DBC transaction on Connection [PooledConnection[PostgresqlConnection{client=io.r2dbc.postgresql.client.ReactorNettyClient@c3a5202, codecs=io.r2dbc.postgresql.codec.DefaultCodecs@922d1d4}]]
|
"deletedAt": null,
|
||||||
2026-06-11T13:43:44.389+08:00 DEBUG 9324 --- [gym-manage-api] [actor-tcp-nio-6] o.s.r.c.R2dbcTransactionManager : Releasing R2DBC Connection [PooledConnection[PostgresqlConnection{client=io.r2dbc.postgresql.client.ReactorNettyClient@c3a5202, codecs=io.r2dbc.postgresql.codec.DefaultCodecs@922d1d4}]] after transaction
|
"courseId": "4",
|
||||||
2026-06-11T13:43:44.389+08:00 ERROR 9324 --- [gym-manage-api] [actor-tcp-nio-6] c.n.g.m.g.s.impl.CourseLabelService : 标签添加到类型失败 - typeId=1, error: executeMany; SQL [INSERT INTO course_type_label (type_id, label_id, create_by, update_by, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6)]; 重复键违反唯一约束"course_type_label_type_id_label_id_key"
|
"recommendTitle": "身心平衡推荐",
|
||||||
2026-06-11T13:43:44.389+08:00 TRACE 9324 --- [gym-manage-api] [actor-tcp-nio-6] org.springframework.web.HttpLogging : [27afd417] Encoding [{success=false, message=executeMany; SQL [INSERT INTO course_type_label (type_id, label_id, create_by, update_by, created_at, updated_at) VALUES ($1, $2, $3, $4, $5, $6)]; 重复键违反唯一约束"course_type_label_type_id_label_id_key"}]
|
"recommendContent": "哈他瑜伽课程,通过体式练习和呼吸控制,达到身心平衡,提升整体健康水平。",
|
||||||
2026-06-11T13:43:44.390+08:00 TRACE 9324 --- [gym-manage-api] [actor-tcp-nio-6] o.s.w.s.adapter.HttpWebHandlerAdapter : [27afd417] Completed 400 BAD_REQUEST, headers={masked}
|
"recommendReason": "改善身体柔韧性,增强核心力量,提升身体协调性",
|
||||||
2026-06-11T13:43:44.390+08:00 TRACE 9324 --- [gym-manage-api] [actor-tcp-nio-6] org.springframework.web.HttpLogging : [27afd417] onComplete
|
"priority": 11,
|
||||||
|
"isActive": true,
|
||||||
|
"groupCourse": {
|
||||||
|
"id": "4",
|
||||||
|
"createBy": "coach_li",
|
||||||
|
"updateBy": null,
|
||||||
|
"createdAt": "2026-06-01T08:00:00",
|
||||||
|
"updatedAt": "2026-06-01T08:00:00",
|
||||||
|
"deletedAt": null,
|
||||||
|
"courseName": "哈他瑜伽",
|
||||||
|
"coachId": "101",
|
||||||
|
"courseType": "1",
|
||||||
|
"startTime": "2026-06-01T15:20:00",
|
||||||
|
"endTime": "2026-06-01T16:50:00",
|
||||||
|
"maxMembers": 12,
|
||||||
|
"currentMembers": 3,
|
||||||
|
"status": "0",
|
||||||
|
"location": "瑜伽教室B",
|
||||||
|
"coverImage": "/images/hatha_yoga.jpg",
|
||||||
|
"description": "基础哈他瑜伽,适合所有级别。距开始不足30分钟,已停止预约。",
|
||||||
|
"pointCardAmount": 1,
|
||||||
|
"storedValueAmount": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"createBy": "system",
|
||||||
|
"updateBy": "system",
|
||||||
|
"createdAt": "2026-06-15T16:21:20.865146",
|
||||||
|
"updatedAt": "2026-06-15T16:23:05.180219",
|
||||||
|
"deletedAt": null,
|
||||||
|
"courseId": "1",
|
||||||
|
"recommendTitle": "本周热门课程",
|
||||||
|
"recommendContent": "这是一门非常棒的课程,快来参加吧!",
|
||||||
|
"recommendReason": "教练专业,课程内容丰富",
|
||||||
|
"priority": 10,
|
||||||
|
"isActive": false,
|
||||||
|
"groupCourse": {
|
||||||
|
"id": "1",
|
||||||
|
"createBy": "system",
|
||||||
|
"updateBy": "system",
|
||||||
|
"createdAt": "2026-06-11T13:50:25.118925",
|
||||||
|
"updatedAt": "2026-06-11T13:50:25.118925",
|
||||||
|
"deletedAt": null,
|
||||||
|
"courseName": "动感单车升级版aaaaa",
|
||||||
|
"coachId": "2",
|
||||||
|
"courseType": "2",
|
||||||
|
"startTime": "2026-06-02T16:45:00",
|
||||||
|
"endTime": "2026-06-15T20:20:00",
|
||||||
|
"maxMembers": 30,
|
||||||
|
"currentMembers": 0,
|
||||||
|
"status": "0",
|
||||||
|
"location": "单车房",
|
||||||
|
"coverImage": "/images/spinning.jpg",
|
||||||
|
"description": "升级版高强度有氧运动课程",
|
||||||
|
"pointCardAmount": 2,
|
||||||
|
"storedValueAmount": 80
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "5",
|
||||||
|
"createBy": "admin",
|
||||||
|
"updateBy": null,
|
||||||
|
"createdAt": "2026-06-15T12:00:00",
|
||||||
|
"updatedAt": "2026-06-15T12:00:00",
|
||||||
|
"deletedAt": null,
|
||||||
|
"courseId": "3",
|
||||||
|
"recommendTitle": "高强度燃脂",
|
||||||
|
"recommendContent": "燃脂搏击课程,高强度间歇训练,配合音乐快速燃脂,释放压力。",
|
||||||
|
"recommendReason": "高强度训练,适合进阶学员,快速燃脂塑形",
|
||||||
|
"priority": 10,
|
||||||
|
"isActive": false,
|
||||||
|
"groupCourse": {
|
||||||
|
"id": "3",
|
||||||
|
"createBy": "coach_zhang",
|
||||||
|
"updateBy": null,
|
||||||
|
"createdAt": "2026-06-01T14:30:00",
|
||||||
|
"updatedAt": "2026-06-01T14:30:00",
|
||||||
|
"deletedAt": null,
|
||||||
|
"courseName": "燃脂搏击",
|
||||||
|
"coachId": "102",
|
||||||
|
"courseType": "2",
|
||||||
|
"startTime": "2026-06-10T18:30:00",
|
||||||
|
"endTime": "2026-06-10T19:30:00",
|
||||||
|
"maxMembers": 20,
|
||||||
|
"currentMembers": 20,
|
||||||
|
"status": "0",
|
||||||
|
"location": "综合训练区",
|
||||||
|
"coverImage": "/images/kickboxing.jpg",
|
||||||
|
"description": "高强度间歇训练,配合音乐快速燃脂,释放压力。名额已满,无法预约。",
|
||||||
|
"pointCardAmount": 1,
|
||||||
|
"storedValueAmount": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "12",
|
||||||
|
"createBy": "admin",
|
||||||
|
"updateBy": null,
|
||||||
|
"createdAt": "2026-05-25T10:00:00",
|
||||||
|
"updatedAt": "2026-05-25T10:00:00",
|
||||||
|
"deletedAt": null,
|
||||||
|
"courseId": "7",
|
||||||
|
"recommendTitle": "职场减压课程",
|
||||||
|
"recommendContent": "午间冥想放松,专为职场人士设计,快速缓解工作压力,提升工作状态。",
|
||||||
|
"recommendReason": "职场减压首选,课程时间短,效果显著",
|
||||||
|
"priority": 9,
|
||||||
|
"isActive": false,
|
||||||
|
"groupCourse": {
|
||||||
|
"id": "7",
|
||||||
|
"createBy": "admin",
|
||||||
|
"updateBy": null,
|
||||||
|
"createdAt": "2026-05-25T09:00:00",
|
||||||
|
"updatedAt": "2026-05-25T09:00:00",
|
||||||
|
"deletedAt": null,
|
||||||
|
"courseName": "午间冥想放松",
|
||||||
|
"coachId": "101",
|
||||||
|
"courseType": "1",
|
||||||
|
"startTime": "2026-05-31T12:00:00",
|
||||||
|
"endTime": "2026-05-31T13:00:00",
|
||||||
|
"maxMembers": 15,
|
||||||
|
"currentMembers": 6,
|
||||||
|
"status": "2",
|
||||||
|
"location": "冥想室",
|
||||||
|
"coverImage": "/images/meditation_noon.jpg",
|
||||||
|
"description": "午间冥想课程,已于5月31日结束。",
|
||||||
|
"pointCardAmount": 1,
|
||||||
|
"storedValueAmount": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "8",
|
||||||
|
"createBy": "admin",
|
||||||
|
"updateBy": null,
|
||||||
|
"createdAt": "2026-05-25T09:00:00",
|
||||||
|
"updatedAt": "2026-05-25T09:00:00",
|
||||||
|
"deletedAt": null,
|
||||||
|
"courseId": "7",
|
||||||
|
"recommendTitle": "午间放松推荐",
|
||||||
|
"recommendContent": "午间冥想放松课程,通过呼吸和正念冥想,深度放松身心,缓解工作压力。",
|
||||||
|
"recommendReason": "适合上班族,午间放松充电,提升下午工作效率",
|
||||||
|
"priority": 8,
|
||||||
|
"isActive": true,
|
||||||
|
"groupCourse": {
|
||||||
|
"id": "7",
|
||||||
|
"createBy": "admin",
|
||||||
|
"updateBy": null,
|
||||||
|
"createdAt": "2026-05-25T09:00:00",
|
||||||
|
"updatedAt": "2026-05-25T09:00:00",
|
||||||
|
"deletedAt": null,
|
||||||
|
"courseName": "午间冥想放松",
|
||||||
|
"coachId": "101",
|
||||||
|
"courseType": "1",
|
||||||
|
"startTime": "2026-05-31T12:00:00",
|
||||||
|
"endTime": "2026-05-31T13:00:00",
|
||||||
|
"maxMembers": 15,
|
||||||
|
"currentMembers": 6,
|
||||||
|
"status": "2",
|
||||||
|
"location": "冥想室",
|
||||||
|
"coverImage": "/images/meditation_noon.jpg",
|
||||||
|
"description": "午间冥想课程,已于5月31日结束。",
|
||||||
|
"pointCardAmount": 1,
|
||||||
|
"storedValueAmount": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
+15
-1
@@ -6,6 +6,7 @@ import cn.novalon.gym.manage.datacount.handler.DataStatisticsHandler;
|
|||||||
import cn.novalon.gym.manage.file.handler.SysFileHandler;
|
import cn.novalon.gym.manage.file.handler.SysFileHandler;
|
||||||
import cn.novalon.gym.manage.groupcourse.handler.GroupCourseBookingHandler;
|
import cn.novalon.gym.manage.groupcourse.handler.GroupCourseBookingHandler;
|
||||||
import cn.novalon.gym.manage.groupcourse.handler.GroupCourseHandler;
|
import cn.novalon.gym.manage.groupcourse.handler.GroupCourseHandler;
|
||||||
|
import cn.novalon.gym.manage.groupcourse.handler.GroupCourseRecommendHandler;
|
||||||
import cn.novalon.gym.manage.groupcourse.handler.GroupCourseTypeHandler;
|
import cn.novalon.gym.manage.groupcourse.handler.GroupCourseTypeHandler;
|
||||||
import cn.novalon.gym.manage.groupcourse.handler.CourseLabelHandler;
|
import cn.novalon.gym.manage.groupcourse.handler.CourseLabelHandler;
|
||||||
import cn.novalon.gym.manage.member.handler.MemberCardHandler;
|
import cn.novalon.gym.manage.member.handler.MemberCardHandler;
|
||||||
@@ -71,6 +72,7 @@ public class SystemRouter {
|
|||||||
MemberCardTransactionHandler memberCardTransactionHandler,
|
MemberCardTransactionHandler memberCardTransactionHandler,
|
||||||
GroupCourseHandler groupCourseHandler,
|
GroupCourseHandler groupCourseHandler,
|
||||||
GroupCourseBookingHandler groupCourseBookingHandler,
|
GroupCourseBookingHandler groupCourseBookingHandler,
|
||||||
|
GroupCourseRecommendHandler groupCourseRecommendHandler,
|
||||||
GroupCourseTypeHandler groupCourseTypeHandler,
|
GroupCourseTypeHandler groupCourseTypeHandler,
|
||||||
CourseLabelHandler courseLabelHandler,
|
CourseLabelHandler courseLabelHandler,
|
||||||
CheckInHandler checkInHandler,
|
CheckInHandler checkInHandler,
|
||||||
@@ -299,6 +301,17 @@ public class SystemRouter {
|
|||||||
.GET("/api/groupCourse/bookings/course/{courseId}", groupCourseBookingHandler::getBookingsByCourseId)
|
.GET("/api/groupCourse/bookings/course/{courseId}", groupCourseBookingHandler::getBookingsByCourseId)
|
||||||
.GET("/api/groupCourse/bookings/{bookingId}", groupCourseBookingHandler::getBookingById)
|
.GET("/api/groupCourse/bookings/{bookingId}", groupCourseBookingHandler::getBookingById)
|
||||||
|
|
||||||
|
// ===== 团课推荐管理 =====
|
||||||
|
.GET("/api/groupCourse/recommend/list", groupCourseRecommendHandler::getAllRecommendations)
|
||||||
|
.GET("/api/groupCourse/recommend/active", groupCourseRecommendHandler::getAllActiveRecommendations)
|
||||||
|
.GET("/api/groupCourse/recommend/{id}", groupCourseRecommendHandler::getRecommendationById)
|
||||||
|
.GET("/api/groupCourse/recommend/course/{courseId}", groupCourseRecommendHandler::getRecommendationsByCourseId)
|
||||||
|
.POST("/api/groupCourse/recommend", groupCourseRecommendHandler::createRecommendation)
|
||||||
|
.PUT("/api/groupCourse/recommend/{id}", groupCourseRecommendHandler::updateRecommendation)
|
||||||
|
.DELETE("/api/groupCourse/recommend/{id}", groupCourseRecommendHandler::deleteRecommendation)
|
||||||
|
.POST("/api/groupCourse/recommend/{id}/enable", groupCourseRecommendHandler::enableRecommendation)
|
||||||
|
.POST("/api/groupCourse/recommend/{id}/disable", groupCourseRecommendHandler::disableRecommendation)
|
||||||
|
|
||||||
// ===== 团课课程管理(需要放在具体路由之后)=====
|
// ===== 团课课程管理(需要放在具体路由之后)=====
|
||||||
.GET("/api/groupCourse/{id}", groupCourseHandler::getGroupCourseById)
|
.GET("/api/groupCourse/{id}", groupCourseHandler::getGroupCourseById)
|
||||||
.GET("/api/groupCourse/{id}/detail", groupCourseHandler::getGroupCourseDetailById)
|
.GET("/api/groupCourse/{id}/detail", groupCourseHandler::getGroupCourseDetailById)
|
||||||
@@ -306,7 +319,8 @@ public class SystemRouter {
|
|||||||
.PUT("/api/groupCourse/{id}", groupCourseHandler::updateGroupCourse)
|
.PUT("/api/groupCourse/{id}", groupCourseHandler::updateGroupCourse)
|
||||||
.DELETE("/api/groupCourse/{id}", groupCourseHandler::deleteGroupCourse)
|
.DELETE("/api/groupCourse/{id}", groupCourseHandler::deleteGroupCourse)
|
||||||
.POST("/api/groupCourse/{id}/cancel", groupCourseHandler::cancelGroupCourse)
|
.POST("/api/groupCourse/{id}/cancel", groupCourseHandler::cancelGroupCourse)
|
||||||
.POST("/api/groupCourse/{courseId}/signin", groupCourseHandler::signIn)
|
.POST("/api/groupCourse/signin/{memberId}", groupCourseHandler::signIn)
|
||||||
|
.POST("/api/groupCourse/search", groupCourseHandler::searchGroupCourses)
|
||||||
|
|
||||||
// ========= 签到模块路由 ==========
|
// ========= 签到模块路由 ==========
|
||||||
// ===== 签到核心功能 =====
|
// ===== 签到核心功能 =====
|
||||||
|
|||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
-- ============================================
|
||||||
|
-- 团课推荐表
|
||||||
|
-- ============================================
|
||||||
|
|
||||||
|
-- 团课推荐表
|
||||||
|
CREATE TABLE IF NOT EXISTS group_course_recommend (
|
||||||
|
id BIGSERIAL PRIMARY KEY,
|
||||||
|
course_id BIGINT NOT NULL,
|
||||||
|
recommend_title VARCHAR(200),
|
||||||
|
recommend_content TEXT,
|
||||||
|
recommend_reason VARCHAR(500),
|
||||||
|
priority INTEGER DEFAULT 0,
|
||||||
|
is_active BOOLEAN DEFAULT TRUE,
|
||||||
|
create_by VARCHAR(50),
|
||||||
|
update_by VARCHAR(50),
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
deleted_at TIMESTAMP
|
||||||
|
);
|
||||||
|
|
||||||
|
-- 创建索引
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_group_course_recommend_course_id ON group_course_recommend(course_id);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_group_course_recommend_priority ON group_course_recommend(priority);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_group_course_recommend_is_active ON group_course_recommend(is_active);
|
||||||
|
|
||||||
|
COMMENT ON TABLE group_course_recommend IS '团课推荐表';
|
||||||
|
COMMENT ON COLUMN group_course_recommend.id IS '主键ID';
|
||||||
|
COMMENT ON COLUMN group_course_recommend.course_id IS '团课ID(关联group_course.id)';
|
||||||
|
COMMENT ON COLUMN group_course_recommend.recommend_title IS '推荐标题';
|
||||||
|
COMMENT ON COLUMN group_course_recommend.recommend_content IS '推荐内容';
|
||||||
|
COMMENT ON COLUMN group_course_recommend.recommend_reason IS '推荐理由';
|
||||||
|
COMMENT ON COLUMN group_course_recommend.priority IS '优先级(数字越大优先级越高)';
|
||||||
|
COMMENT ON COLUMN group_course_recommend.is_active IS '是否启用';
|
||||||
|
COMMENT ON COLUMN group_course_recommend.create_by IS '创建人';
|
||||||
|
COMMENT ON COLUMN group_course_recommend.update_by IS '更新人';
|
||||||
|
COMMENT ON COLUMN group_course_recommend.created_at IS '创建时间';
|
||||||
|
COMMENT ON COLUMN group_course_recommend.updated_at IS '更新时间';
|
||||||
|
COMMENT ON COLUMN group_course_recommend.deleted_at IS '删除时间(软删除)';
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
-- ============================================
|
||||||
|
-- 团课推荐测试数据
|
||||||
|
-- ============================================
|
||||||
|
|
||||||
|
-- 推荐数据1: 极速燃脂单车 - 高优先级推荐(热门课程)
|
||||||
|
INSERT INTO group_course_recommend (course_id, recommend_title, recommend_content, recommend_reason, priority, is_active, create_by, created_at, updated_at) VALUES
|
||||||
|
(1, '本周热门推荐', '极速燃脂单车课程,跟随音乐节奏变换阻力和速度,体验爬坡与冲刺的快感,一节课消耗800大卡!', '教练专业,课程内容丰富,深受学员喜爱,燃脂效果显著', 20, true, 'admin', '2026-06-15 10:00:00', '2026-06-15 10:00:00');
|
||||||
|
|
||||||
|
-- 推荐数据2: 清晨流瑜伽 - 中等优先级推荐(适合新手)
|
||||||
|
INSERT INTO group_course_recommend (course_id, recommend_title, recommend_content, recommend_reason, priority, is_active, create_by, created_at, updated_at) VALUES
|
||||||
|
(2, '新手友好推荐', '清晨流瑜伽课程,适合有一定基础的学员,通过流畅的体式连接呼吸,唤醒身体能量。', '适合新手入门,教练耐心指导,课程节奏适中', 15, true, 'admin', '2026-06-15 11:00:00', '2026-06-15 11:00:00');
|
||||||
|
|
||||||
|
-- 推荐数据3: 燃脂搏击 - 低优先级推荐(满员课程,已禁用)
|
||||||
|
INSERT INTO group_course_recommend (course_id, recommend_title, recommend_content, recommend_reason, priority, is_active, create_by, created_at, updated_at) VALUES
|
||||||
|
(3, '高强度燃脂', '燃脂搏击课程,高强度间歇训练,配合音乐快速燃脂,释放压力。', '高强度训练,适合进阶学员,快速燃脂塑形', 10, false, 'admin', '2026-06-15 12:00:00', '2026-06-15 12:00:00');
|
||||||
|
|
||||||
|
-- 推荐数据4: 哈他瑜伽 - 中等优先级推荐(基础课程)
|
||||||
|
INSERT INTO group_course_recommend (course_id, recommend_title, recommend_content, recommend_reason, priority, is_active, create_by, created_at, updated_at) VALUES
|
||||||
|
(4, '基础瑜伽推荐', '基础哈他瑜伽课程,适合所有级别学员,通过基础体式练习提升身体柔韧性和平衡能力。', '零基础友好,适合所有健身水平,放松身心', 12, true, 'coach_li', '2026-06-15 13:00:00', '2026-06-15 13:00:00');
|
||||||
|
|
||||||
|
-- 推荐数据5: 蜜桃臀塑造 - 高优先级推荐(热门课程,但课程已结束)
|
||||||
|
INSERT INTO group_course_recommend (course_id, recommend_title, recommend_content, recommend_reason, priority, is_active, create_by, created_at, updated_at) VALUES
|
||||||
|
(6, '塑形热门课程', '蜜桃臀塑造课程,针对性训练臀部肌肉群,打造完美曲线。', '专业私教指导,动作标准,效果显著,深受女性学员喜爱', 18, true, 'coach_li', '2026-05-25 09:15:00', '2026-05-25 09:15:00');
|
||||||
|
|
||||||
|
-- 推荐数据6: 午间冥想放松 - 低优先级推荐(放松课程)
|
||||||
|
INSERT INTO group_course_recommend (course_id, recommend_title, recommend_content, recommend_reason, priority, is_active, create_by, created_at, updated_at) VALUES
|
||||||
|
(7, '午间放松推荐', '午间冥想放松课程,通过呼吸和正念冥想,深度放松身心,缓解工作压力。', '适合上班族,午间放松充电,提升下午工作效率', 8, true, 'admin', '2026-05-25 09:00:00', '2026-05-25 09:00:00');
|
||||||
|
|
||||||
|
-- 推荐数据7: 极速燃脂单车 - 第二个推荐(不同角度推荐)
|
||||||
|
INSERT INTO group_course_recommend (course_id, recommend_title, recommend_content, recommend_reason, priority, is_active, create_by, created_at, updated_at) VALUES
|
||||||
|
(1, '减脂首选课程', '想要快速减脂?极速燃脂单车是你的最佳选择!专业教练带领,科学训练计划。', '减脂效果最佳,课程强度适中,适合想要快速瘦身的学员', 16, true, 'coach_zhang', '2026-06-15 14:00:00', '2026-06-15 14:00:00');
|
||||||
|
|
||||||
|
-- 推荐数据8: 清晨流瑜伽 - 第二个推荐(不同角度推荐)
|
||||||
|
INSERT INTO group_course_recommend (course_id, recommend_title, recommend_content, recommend_reason, priority, is_active, create_by, created_at, updated_at) VALUES
|
||||||
|
(2, '晨练优选', '清晨流瑜伽,唤醒身体能量,开启活力一天!适合晨练爱好者。', '晨练最佳选择,提升身体活力,改善精神状态', 14, true, 'coach_wang', '2026-06-15 15:00:00', '2026-06-15 15:00:00');
|
||||||
|
|
||||||
|
-- 推荐数据9: 哈他瑜伽 - 第二个推荐(不同角度推荐)
|
||||||
|
INSERT INTO group_course_recommend (course_id, recommend_title, recommend_content, recommend_reason, priority, is_active, create_by, created_at, updated_at) VALUES
|
||||||
|
(4, '身心平衡推荐', '哈他瑜伽课程,通过体式练习和呼吸控制,达到身心平衡,提升整体健康水平。', '改善身体柔韧性,增强核心力量,提升身体协调性', 11, true, 'coach_li', '2026-06-15 16:00:00', '2026-06-15 16:00:00');
|
||||||
|
|
||||||
|
-- 推荐数据10: 午间冥想放松 - 第二个推荐(不同角度推荐,已禁用)
|
||||||
|
INSERT INTO group_course_recommend (course_id, recommend_title, recommend_content, recommend_reason, priority, is_active, create_by, created_at, updated_at) VALUES
|
||||||
|
(7, '职场减压课程', '午间冥想放松,专为职场人士设计,快速缓解工作压力,提升工作状态。', '职场减压首选,课程时间短,效果显著', 9, false, 'admin', '2026-05-25 10:00:00', '2026-05-25 10:00:00');
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
-- ============================================
|
||||||
|
-- 为团课表添加二维码路径字段
|
||||||
|
-- ============================================
|
||||||
|
|
||||||
|
-- 添加二维码路径字段
|
||||||
|
ALTER TABLE group_course ADD COLUMN qr_code_path VARCHAR(500);
|
||||||
|
|
||||||
|
-- 添加字段注释
|
||||||
|
COMMENT ON COLUMN group_course.qr_code_path IS '二维码图片路径';
|
||||||
Reference in New Issue
Block a user