Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 493ecd3021 | |||
| 7340f02102 | |||
| 68fefae774 | |||
| ffb3f20774 |
@@ -0,0 +1,3 @@
|
||||
wrapperVersion=3.3.4
|
||||
distributionType=only-script
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.15/apache-maven-3.9.15-bin.zip
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.novalon.gym.manage</groupId>
|
||||
<artifactId>gym-manage-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<groupId>cn.novalon.gym.manage</groupId>
|
||||
<artifactId>gym-groupCourse</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<name>gym-groupCourse</name>
|
||||
<description>Group Course Management Module</description>
|
||||
<url/>
|
||||
<licenses>
|
||||
<license/>
|
||||
</licenses>
|
||||
<developers>
|
||||
<developer/>
|
||||
</developers>
|
||||
<scm>
|
||||
<connection/>
|
||||
<developerConnection/>
|
||||
<tag/>
|
||||
<url/>
|
||||
</scm>
|
||||
<properties>
|
||||
<java.version>21</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.novalon.gym.manage</groupId>
|
||||
<artifactId>manage-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.novalon.gym.manage</groupId>
|
||||
<artifactId>manage-db</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-r2dbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||
<version>2.2.43</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Redis依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
|
||||
package cn.novalon.gym.manage.groupcourse.converter;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
||||
import cn.novalon.gym.manage.groupcourse.entity.GroupCourseEntity;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class GroupCourseConverter {
|
||||
public GroupCourse toDomain(GroupCourseEntity entity){
|
||||
if(entity == null){
|
||||
return null;
|
||||
}
|
||||
GroupCourse groupCourse = new GroupCourse();
|
||||
BeanUtil.copyProperties(entity,groupCourse);
|
||||
log.info("转换bean,entity-domain:",groupCourse);
|
||||
return groupCourse;
|
||||
}
|
||||
|
||||
public GroupCourseEntity toEntity(GroupCourse domain){
|
||||
if(domain == null){
|
||||
return null;
|
||||
}
|
||||
GroupCourseEntity entity = new GroupCourseEntity();
|
||||
BeanUtil.copyProperties(domain,entity);
|
||||
log.info("转换bean,domain-entity:",entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
public List<GroupCourse> toDomainList(List<GroupCourseEntity> entities){
|
||||
if (entities == null) {
|
||||
return null;
|
||||
}
|
||||
return entities.stream()
|
||||
.map(this::toDomain)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<GroupCourseEntity> toEntityList(List<GroupCourse> domains){
|
||||
if (domains == null) {
|
||||
return null;
|
||||
}
|
||||
return domains.stream()
|
||||
.map(this::toEntity)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
|
||||
package cn.novalon.gym.manage.groupcourse.dao;
|
||||
|
||||
import cn.novalon.gym.manage.groupcourse.entity.GroupCourseEntity;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Repository
|
||||
public interface GroupCourseDao extends R2dbcRepository<GroupCourseEntity, Long> {
|
||||
|
||||
Mono<GroupCourseEntity> findByIdIsAndDeletedAtIsNull(Long id);
|
||||
|
||||
Flux<GroupCourseEntity> findAll();
|
||||
|
||||
Flux<GroupCourseEntity> findAll(Sort sort);
|
||||
|
||||
Flux<GroupCourseEntity> findAllByDeletedAtIsNull();
|
||||
|
||||
Flux<GroupCourseEntity> findAllByDeletedAtIsNull(Sort sort);
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
|
||||
package cn.novalon.gym.manage.groupcourse.domain;
|
||||
|
||||
import cn.novalon.gym.manage.sys.core.domain.BaseDomain;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class GroupCourse extends BaseDomain{
|
||||
|
||||
//课程名称
|
||||
@Schema(description = "团课名", example = "Push-up")
|
||||
private String courseName;
|
||||
|
||||
//教练id
|
||||
@Schema(description = "教练id", example = "1")
|
||||
private Long coachId;
|
||||
|
||||
//课程类型
|
||||
@Schema(description = "课程类型", example = "1")
|
||||
private Long courseType;
|
||||
|
||||
//开始时间
|
||||
@Schema(description = "开始时间", example = "2026-01-01")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
//结束时间
|
||||
@Schema(description = "结束时间", example = "2026-01-02")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
//最大参与人数
|
||||
@Schema(description = "最大参与人数", example = "20")
|
||||
private Integer maxMembers;
|
||||
|
||||
//当前参与人数
|
||||
@Schema(description = "当前参与人数", example = "2")
|
||||
private Integer currentMembers;
|
||||
|
||||
//课程状态:0-正常,1-已取消,2-已结束
|
||||
@Schema(description = "课程状态", example = "0")
|
||||
private Long status;
|
||||
|
||||
//上课地点
|
||||
@Schema(description = "上课地点", example = "龙泉驿区幸福路")
|
||||
private String location;
|
||||
|
||||
//封面图URL
|
||||
@Schema(description = "封面图URL", example = "https://12345.com")
|
||||
private String coverImage;
|
||||
|
||||
//课程描述
|
||||
@Schema(description = "课程描述", example = "从入门到入土")
|
||||
private String description;
|
||||
|
||||
public String getCourseName() {
|
||||
return courseName;
|
||||
}
|
||||
|
||||
public void setCourseName(String courseName) {
|
||||
this.courseName = courseName;
|
||||
}
|
||||
|
||||
public Long getCoachId() {
|
||||
return coachId;
|
||||
}
|
||||
|
||||
public void setCoachId(Long coachId) {
|
||||
this.coachId = coachId;
|
||||
}
|
||||
|
||||
public Long getCourseType() {
|
||||
return courseType;
|
||||
}
|
||||
|
||||
public void setCourseType(Long courseType) {
|
||||
this.courseType = courseType;
|
||||
}
|
||||
|
||||
public LocalDateTime getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(LocalDateTime startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(LocalDateTime endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public Integer getMaxMembers() {
|
||||
return maxMembers;
|
||||
}
|
||||
|
||||
public void setMaxMembers(Integer maxMembers) {
|
||||
this.maxMembers = maxMembers;
|
||||
}
|
||||
|
||||
public Integer getCurrentMembers() {
|
||||
return currentMembers;
|
||||
}
|
||||
|
||||
public void setCurrentMembers(Integer currentMembers) {
|
||||
this.currentMembers = currentMembers;
|
||||
}
|
||||
|
||||
public Long getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Long status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getCoverImage() {
|
||||
return coverImage;
|
||||
}
|
||||
|
||||
public void setCoverImage(String coverImage) {
|
||||
this.coverImage = coverImage;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
|
||||
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")
|
||||
public class GroupCourseEntity extends BaseEntity {
|
||||
|
||||
//课程名称
|
||||
@Column("course_name")
|
||||
private String courseName;
|
||||
|
||||
//教练id
|
||||
@Column("coach_id")
|
||||
private Long coachId;
|
||||
|
||||
//课程类型
|
||||
@Column("course_type")
|
||||
private Long courseType;
|
||||
|
||||
//开始时间
|
||||
@Column("start_time")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
//结束时间
|
||||
@Column("end_time")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
//最大参与人数
|
||||
@Column("max_members")
|
||||
private Integer maxMembers;
|
||||
|
||||
//当前参与人数
|
||||
@Column("current_members")
|
||||
private Integer currentMembers;
|
||||
|
||||
//课程状态:0-正常,1-已取消,2-已结束
|
||||
@Column("status")
|
||||
private Long status;
|
||||
|
||||
//上课地点
|
||||
@Column("location")
|
||||
private String location;
|
||||
|
||||
//封面图URL
|
||||
@Column("cover_image")
|
||||
private String coverImage;
|
||||
|
||||
//课程描述
|
||||
@Column("description")
|
||||
private String description;
|
||||
|
||||
public String getCourseName() {
|
||||
return courseName;
|
||||
}
|
||||
|
||||
public void setCourseName(String courseName) {
|
||||
this.courseName = courseName;
|
||||
}
|
||||
|
||||
public Long getCoachId() {
|
||||
return coachId;
|
||||
}
|
||||
|
||||
public void setCoachId(Long coachId) {
|
||||
this.coachId = coachId;
|
||||
}
|
||||
|
||||
public Long getCourseType() {
|
||||
return courseType;
|
||||
}
|
||||
|
||||
public void setCourseType(Long courseType) {
|
||||
this.courseType = courseType;
|
||||
}
|
||||
|
||||
public LocalDateTime getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(LocalDateTime startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(LocalDateTime endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public Integer getMaxMembers() {
|
||||
return maxMembers;
|
||||
}
|
||||
|
||||
public void setMaxMembers(Integer maxMembers) {
|
||||
this.maxMembers = maxMembers;
|
||||
}
|
||||
|
||||
public Integer getCurrentMembers() {
|
||||
return currentMembers;
|
||||
}
|
||||
|
||||
public void setCurrentMembers(Integer currentMembers) {
|
||||
this.currentMembers = currentMembers;
|
||||
}
|
||||
|
||||
public Long getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Long status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public String getCoverImage() {
|
||||
return coverImage;
|
||||
}
|
||||
|
||||
public void setCoverImage(String coverImage) {
|
||||
this.coverImage = coverImage;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
|
||||
package cn.novalon.gym.manage.groupcourse.handler;
|
||||
|
||||
import cn.novalon.gym.manage.common.dto.PageRequest;
|
||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
||||
import cn.novalon.gym.manage.groupcourse.service.IGroupCourseService;
|
||||
import cn.novalon.gym.manage.groupcourse.service.RedisService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Validator;
|
||||
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 GroupCourseHandler {
|
||||
private final IGroupCourseService groupCourseService;
|
||||
private final Validator validator;
|
||||
private final RedisService redisService;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public GroupCourseHandler(IGroupCourseService groupCourseService,
|
||||
Validator validator,
|
||||
RedisService redisService,
|
||||
ObjectMapper objectMapper){
|
||||
this.groupCourseService = groupCourseService;
|
||||
this.validator = validator;
|
||||
this.redisService = redisService;
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
@Operation(summary = "获取所有团课", description = "获取系统中所有团课列表")
|
||||
public Mono<ServerResponse> getAllGroupCourse(ServerRequest request){
|
||||
boolean includeDeleted = Boolean.valueOf(request.queryParam("includeDeleted").orElse("false"));
|
||||
return ServerResponse.ok()
|
||||
.body(groupCourseService.findAll(includeDeleted), GroupCourse.class);
|
||||
}
|
||||
|
||||
@Operation(summary = "分页获取团课", description = "根据分页参数获取团课列表")
|
||||
public Mono<ServerResponse> getGroupCoursesByPage(ServerRequest request) {
|
||||
return request.bodyToMono(PageRequest.class)
|
||||
.flatMap(pageRequest -> {
|
||||
boolean includeDeleted = request.queryParam("includeDeleted")
|
||||
.map(Boolean::parseBoolean)
|
||||
.orElse(false);
|
||||
|
||||
if (pageRequest.getPage() < 0) {
|
||||
pageRequest.setPage(0);
|
||||
}
|
||||
if (pageRequest.getSize() <= 0 || pageRequest.getSize() > 100) {
|
||||
pageRequest.setSize(10);
|
||||
}
|
||||
if (pageRequest.getSort() == null || pageRequest.getSort().isEmpty()) {
|
||||
pageRequest.setSort("id");
|
||||
}
|
||||
if (pageRequest.getOrder() == null || pageRequest.getOrder().isEmpty()) {
|
||||
pageRequest.setOrder("asc");
|
||||
}
|
||||
|
||||
return groupCourseService.findByPage(pageRequest, includeDeleted)
|
||||
.flatMap(response -> ServerResponse.ok().bodyValue(response));
|
||||
});
|
||||
}
|
||||
|
||||
@Operation(summary = "根据ID获取团课", description = "根据ID获取团课详情")
|
||||
public Mono<ServerResponse> getGroupCourseById(ServerRequest request){
|
||||
Long id = Long.valueOf(request.pathVariable("id"));
|
||||
return ServerResponse.ok()
|
||||
.body(groupCourseService.findById(id), GroupCourse.class);
|
||||
}
|
||||
|
||||
@Operation(summary = "测试-根据Key获取Redis缓存", description = "测试接口:根据传入的key值获取Redis中缓存的数据")
|
||||
public Mono<ServerResponse> getCacheByKey(ServerRequest request) {
|
||||
return request.bodyToMono(Map.class)
|
||||
.flatMap(body -> {
|
||||
String key = (String) body.get("key");
|
||||
|
||||
if (key == null || key.isEmpty()) {
|
||||
Map<String, Object> error = new HashMap<>();
|
||||
error.put("success", false);
|
||||
error.put("message", "key参数不能为空");
|
||||
return ServerResponse.badRequest().bodyValue(error);
|
||||
}
|
||||
|
||||
Object cachedValue = redisService.get(key);
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
if (cachedValue != null) {
|
||||
result.put("success", true);
|
||||
result.put("key", key);
|
||||
result.put("value", cachedValue);
|
||||
result.put("message", "缓存命中");
|
||||
|
||||
try {
|
||||
if (cachedValue instanceof String) {
|
||||
Object jsonObject = objectMapper.readValue((String) cachedValue, Object.class);
|
||||
result.put("parsedValue", jsonObject);
|
||||
result.put("valueType", "JSON字符串");
|
||||
} else {
|
||||
result.put("valueType", cachedValue.getClass().getSimpleName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("parsedValue", null);
|
||||
result.put("valueType", "无法解析");
|
||||
}
|
||||
} else {
|
||||
result.put("success", false);
|
||||
result.put("key", key);
|
||||
result.put("value", null);
|
||||
result.put("message", "缓存未命中");
|
||||
}
|
||||
|
||||
return ServerResponse.ok().bodyValue(result);
|
||||
})
|
||||
.onErrorResume(error -> {
|
||||
Map<String, Object> errorResponse = new HashMap<>();
|
||||
errorResponse.put("success", false);
|
||||
errorResponse.put("message", "请求处理失败: " + error.getMessage());
|
||||
return ServerResponse.status(500).bodyValue(errorResponse);
|
||||
});
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
|
||||
package cn.novalon.gym.manage.groupcourse.repository;
|
||||
|
||||
import cn.novalon.gym.manage.common.dto.PageRequest;
|
||||
import cn.novalon.gym.manage.common.dto.PageResponse;
|
||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
public interface IGroupCourseRepository {
|
||||
Mono<GroupCourse> findByIdAndDeletedAtIsNull(Long id);
|
||||
Flux<GroupCourse> findAll();
|
||||
Flux<GroupCourse> findAll(Sort sort);
|
||||
Flux<GroupCourse> findByDeletedAtIsNull();
|
||||
Flux<GroupCourse> findByDeletedAtIsNull(Sort sort);
|
||||
|
||||
Mono<PageResponse<GroupCourse>> findByPage(PageRequest pageRequest);
|
||||
Mono<PageResponse<GroupCourse>> findByPageAndNotDeleted(PageRequest pageRequest);
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
|
||||
package cn.novalon.gym.manage.groupcourse.repository.impl;
|
||||
|
||||
import cn.novalon.gym.manage.common.dto.PageRequest;
|
||||
import cn.novalon.gym.manage.common.dto.PageResponse;
|
||||
import cn.novalon.gym.manage.groupcourse.converter.GroupCourseConverter;
|
||||
import cn.novalon.gym.manage.groupcourse.dao.GroupCourseDao;
|
||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
||||
import cn.novalon.gym.manage.groupcourse.entity.GroupCourseEntity;
|
||||
import cn.novalon.gym.manage.groupcourse.repository.IGroupCourseRepository;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
|
||||
import org.springframework.data.relational.core.query.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public class GroupCourseRepository implements IGroupCourseRepository {
|
||||
private final GroupCourseDao groupCourseDao;
|
||||
private final GroupCourseConverter groupCourseConverter;
|
||||
private final R2dbcEntityTemplate r2dbcEntityTemplate;
|
||||
|
||||
public GroupCourseRepository(GroupCourseDao groupCourseDao, GroupCourseConverter groupCourseConverter,
|
||||
R2dbcEntityTemplate r2dbcEntityTemplate){
|
||||
this.groupCourseDao = groupCourseDao;
|
||||
this.groupCourseConverter = groupCourseConverter;
|
||||
this.r2dbcEntityTemplate = r2dbcEntityTemplate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<GroupCourse> findByIdAndDeletedAtIsNull(Long id) {
|
||||
return groupCourseDao.findByIdIsAndDeletedAtIsNull(id)
|
||||
.map(groupCourseConverter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<GroupCourse> findAll() {
|
||||
return groupCourseDao.findAll()
|
||||
.map(groupCourseConverter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<GroupCourse> findAll(Sort sort) {
|
||||
return groupCourseDao.findAll(sort)
|
||||
.map(groupCourseConverter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<GroupCourse> findByDeletedAtIsNull() {
|
||||
return groupCourseDao.findAllByDeletedAtIsNull()
|
||||
.map(groupCourseConverter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<GroupCourse> findByDeletedAtIsNull(Sort sort) {
|
||||
return groupCourseDao.findAllByDeletedAtIsNull(sort)
|
||||
.map(groupCourseConverter::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<PageResponse<GroupCourse>> findByPage(PageRequest pageRequest) {
|
||||
int page = pageRequest.getPage();
|
||||
int size = pageRequest.getSize();
|
||||
String sort = pageRequest.getSort();
|
||||
String order = pageRequest.getOrder();
|
||||
|
||||
Sort sortObj = Sort.unsorted();
|
||||
if (sort != null && !sort.isEmpty()) {
|
||||
sortObj = Sort.by(Sort.Direction.fromString(order), sort);
|
||||
}
|
||||
|
||||
org.springframework.data.domain.PageRequest pageable = org.springframework.data.domain.PageRequest.of(page, size, sortObj);
|
||||
|
||||
Query query = Query.empty();
|
||||
|
||||
return r2dbcEntityTemplate.select(GroupCourseEntity.class)
|
||||
.matching(query.with(pageable))
|
||||
.all()
|
||||
.collectList()
|
||||
.zipWith(r2dbcEntityTemplate.count(query, GroupCourseEntity.class))
|
||||
.map(tuple -> {
|
||||
long total = tuple.getT2();
|
||||
int totalPages = (int) Math.ceil((double) total / size);
|
||||
List<GroupCourse> courseList = tuple.getT1().stream()
|
||||
.map(groupCourseConverter::toDomain)
|
||||
.toList();
|
||||
return new PageResponse<>(courseList, totalPages, total, page, size);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<PageResponse<GroupCourse>> findByPageAndNotDeleted(PageRequest pageRequest) {
|
||||
int page = pageRequest.getPage();
|
||||
int size = pageRequest.getSize();
|
||||
String sort = pageRequest.getSort();
|
||||
String order = pageRequest.getOrder();
|
||||
|
||||
Sort sortObj = Sort.unsorted();
|
||||
if (sort != null && !sort.isEmpty()) {
|
||||
sortObj = Sort.by(Sort.Direction.fromString(order), sort);
|
||||
}
|
||||
|
||||
org.springframework.data.domain.PageRequest pageable = org.springframework.data.domain.PageRequest.of(page, size, sortObj);
|
||||
|
||||
return groupCourseDao.findAllByDeletedAtIsNull(sortObj)
|
||||
.collectList()
|
||||
.zipWith(groupCourseDao.findAllByDeletedAtIsNull().count())
|
||||
.map(tuple -> {
|
||||
List<GroupCourseEntity> allEntities = tuple.getT1();
|
||||
long total = tuple.getT2();
|
||||
|
||||
int fromIndex = page * size;
|
||||
int toIndex = Math.min(fromIndex + size, allEntities.size());
|
||||
|
||||
List<GroupCourse> courseList;
|
||||
if (fromIndex < allEntities.size()) {
|
||||
courseList = allEntities.subList(fromIndex, toIndex).stream()
|
||||
.map(groupCourseConverter::toDomain)
|
||||
.toList();
|
||||
} else {
|
||||
courseList = List.of();
|
||||
}
|
||||
|
||||
int totalPages = (int) Math.ceil((double) total / size);
|
||||
return new PageResponse<>(courseList, totalPages, total, page, size);
|
||||
});
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
|
||||
package cn.novalon.gym.manage.groupcourse.service;
|
||||
|
||||
import cn.novalon.gym.manage.common.dto.PageRequest;
|
||||
import cn.novalon.gym.manage.common.dto.PageResponse;
|
||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
public interface IGroupCourseService {
|
||||
Mono<GroupCourse> findById(Long id);
|
||||
Flux<GroupCourse> findAll();
|
||||
Flux<GroupCourse> findAll(boolean includeDeleted);
|
||||
|
||||
Mono<PageResponse<GroupCourse>> findByPage(PageRequest pageRequest, boolean includeDeleted);
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package cn.novalon.gym.manage.groupcourse.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author:liwentao
|
||||
* @date:2026/5/15-05-15-16:05
|
||||
*/
|
||||
@Service
|
||||
public class RedisService {
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
// 设置值
|
||||
public void set(String key, Object value) {
|
||||
redisTemplate.opsForValue().set(key, value);
|
||||
}
|
||||
|
||||
// 设置值并指定过期时间(秒)
|
||||
public void setWithExpire(String key, Object value, long timeout) {
|
||||
redisTemplate.opsForValue().set(key, value, timeout, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
// 获取值
|
||||
public Object get(String key) {
|
||||
return redisTemplate.opsForValue().get(key);
|
||||
}
|
||||
|
||||
// 删除key
|
||||
public Boolean delete(String key) {
|
||||
return redisTemplate.delete(key);
|
||||
}
|
||||
|
||||
// 判断key是否存在
|
||||
public Boolean hasKey(String key) {
|
||||
return redisTemplate.hasKey(key);
|
||||
}
|
||||
|
||||
// 设置过期时间
|
||||
public Boolean expire(String key, long timeout) {
|
||||
return redisTemplate.expire(key, timeout, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
// Hash操作
|
||||
public void putHash(String key, String hashKey, Object value) {
|
||||
redisTemplate.opsForHash().put(key, hashKey, value);
|
||||
}
|
||||
|
||||
public Object getHash(String key, String hashKey) {
|
||||
return redisTemplate.opsForHash().get(key, hashKey);
|
||||
}
|
||||
|
||||
// List操作
|
||||
public void leftPush(String key, Object value) {
|
||||
redisTemplate.opsForList().leftPush(key, value);
|
||||
}
|
||||
|
||||
public Object rightPop(String key) {
|
||||
return redisTemplate.opsForList().rightPop(key);
|
||||
}
|
||||
|
||||
// Set操作
|
||||
public void addToSet(String key, Object... values) {
|
||||
redisTemplate.opsForSet().add(key, values);
|
||||
}
|
||||
|
||||
public Set<Object> getSet(String key) {
|
||||
return redisTemplate.opsForSet().members(key);
|
||||
}
|
||||
}
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
|
||||
package cn.novalon.gym.manage.groupcourse.service.impl;
|
||||
|
||||
import cn.novalon.gym.manage.common.dto.PageRequest;
|
||||
import cn.novalon.gym.manage.common.dto.PageResponse;
|
||||
import cn.novalon.gym.manage.groupcourse.domain.GroupCourse;
|
||||
import cn.novalon.gym.manage.groupcourse.repository.IGroupCourseRepository;
|
||||
import cn.novalon.gym.manage.groupcourse.service.IGroupCourseService;
|
||||
import cn.novalon.gym.manage.groupcourse.service.RedisService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class GroupCourseService implements IGroupCourseService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(GroupCourseService.class);
|
||||
|
||||
private final IGroupCourseRepository groupCourseRepository;
|
||||
private final RedisService redisService;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
private static final String CACHE_KEY_PREFIX = "group_course:page:";
|
||||
private static final String CACHE_KEY_ID_PREFIX = "group_course:id:";
|
||||
private static final long CACHE_EXPIRE_SECONDS = 300;
|
||||
|
||||
public GroupCourseService(IGroupCourseRepository groupCourseRepository,
|
||||
RedisService redisService,
|
||||
ObjectMapper objectMapper){
|
||||
this.groupCourseRepository = groupCourseRepository;
|
||||
this.redisService = redisService;
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<GroupCourse> findById(Long id) {
|
||||
String cacheKey = CACHE_KEY_ID_PREFIX + id;
|
||||
|
||||
Object cachedData = redisService.get(cacheKey);
|
||||
if (cachedData != null) {
|
||||
try {
|
||||
String json;
|
||||
if (cachedData instanceof String) {
|
||||
json = (String) cachedData;
|
||||
} else {
|
||||
json = objectMapper.writeValueAsString(cachedData);
|
||||
}
|
||||
|
||||
GroupCourse groupCourse = objectMapper.readValue(json, GroupCourse.class);
|
||||
logger.info("缓存命中 - findById: id={}", id);
|
||||
return Mono.just(groupCourse);
|
||||
} catch (JsonProcessingException e) {
|
||||
logger.warn("缓存解析失败,删除缓存 - id: {}, error: {}", id, e.getMessage());
|
||||
redisService.delete(cacheKey);
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug("缓存未命中,查询数据库 - findById: id={}", id);
|
||||
return groupCourseRepository.findByIdAndDeletedAtIsNull(id)
|
||||
.doOnSuccess(groupCourse -> {
|
||||
if (groupCourse != null) {
|
||||
try {
|
||||
String jsonData = objectMapper.writeValueAsString(groupCourse);
|
||||
redisService.setWithExpire(cacheKey, jsonData, CACHE_EXPIRE_SECONDS);
|
||||
logger.debug("缓存已设置 - findById: id={}", id);
|
||||
} catch (JsonProcessingException e) {
|
||||
logger.error("缓存设置失败 - id: {}, error: {}", id, e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<GroupCourse> findAll() {
|
||||
return groupCourseRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flux<GroupCourse> findAll(boolean includeDeleted) {
|
||||
if(includeDeleted){
|
||||
return groupCourseRepository.findAll();
|
||||
}else{
|
||||
return groupCourseRepository.findByDeletedAtIsNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<PageResponse<GroupCourse>> findByPage(PageRequest pageRequest, boolean includeDeleted) {
|
||||
int page = pageRequest.getPage();
|
||||
int size = pageRequest.getSize();
|
||||
|
||||
String cacheKey = CACHE_KEY_PREFIX + page + ":" + size + ":" + includeDeleted;
|
||||
|
||||
Object cachedData = redisService.get(cacheKey);
|
||||
if (cachedData != null) {
|
||||
try {
|
||||
String json;
|
||||
if (cachedData instanceof String) {
|
||||
json = (String) cachedData;
|
||||
} else {
|
||||
json = objectMapper.writeValueAsString(cachedData);
|
||||
}
|
||||
|
||||
PageResponse<GroupCourse> pageResponse = objectMapper.readValue(json,
|
||||
objectMapper.getTypeFactory().constructParametricType(PageResponse.class, GroupCourse.class));
|
||||
logger.info("缓存命中 - findByPage: key={}", cacheKey);
|
||||
return Mono.just(pageResponse);
|
||||
} catch (JsonProcessingException e) {
|
||||
logger.warn("缓存解析失败,删除缓存 - key: {}, error: {}", cacheKey, e.getMessage());
|
||||
redisService.delete(cacheKey);
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug("缓存未命中,查询数据库 - findByPage: key={}", cacheKey);
|
||||
Mono<PageResponse<GroupCourse>> resultMono;
|
||||
if (includeDeleted) {
|
||||
resultMono = groupCourseRepository.findByPage(pageRequest);
|
||||
} else {
|
||||
resultMono = groupCourseRepository.findByPageAndNotDeleted(pageRequest);
|
||||
}
|
||||
|
||||
return resultMono.doOnSuccess(pageResponse -> {
|
||||
try {
|
||||
String jsonData = objectMapper.writeValueAsString(pageResponse);
|
||||
redisService.setWithExpire(cacheKey, jsonData, CACHE_EXPIRE_SECONDS);
|
||||
logger.debug("缓存已设置 - findByPage: key={}", cacheKey);
|
||||
} catch (JsonProcessingException e) {
|
||||
logger.error("缓存设置失败 - key: {}, error: {}", cacheKey, e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
spring:
|
||||
application:
|
||||
name: gym-groupCourse
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package cn.novalon.gym.manage.groupcourse;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class GymGroupCourseApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,6 +18,11 @@
|
||||
<description>Application module for Novalon Manage API</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.novalon.gym.manage</groupId>
|
||||
<artifactId>gym-groupCourse</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.novalon.gym.manage</groupId>
|
||||
<artifactId>manage-sys</artifactId>
|
||||
@@ -133,6 +138,12 @@
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.novalon.gym.manage</groupId>
|
||||
<artifactId>gym-groupCourse</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
+2
-2
@@ -15,10 +15,10 @@ import org.springframework.web.server.WebFilter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = "cn.novalon.gym.manage", exclude = {
|
||||
@SpringBootApplication(scanBasePackages = {"cn.novalon.gym.manage", "cn.novalon.gym.manage.groupcourse"}, exclude = {
|
||||
ReactiveUserDetailsServiceAutoConfiguration.class })
|
||||
@EnableR2dbcRepositories(basePackages = { "cn.novalon.gym.manage.db.dao",
|
||||
"cn.novalon.gym.manage.sys.audit.repository" })
|
||||
"cn.novalon.gym.manage.sys.audit.repository", "cn.novalon.gym.manage.groupcourse.dao" })
|
||||
public class ManageApplication {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ManageApplication.class);
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package cn.novalon.gym.manage.app.config;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
/**
|
||||
* @author:liwentao
|
||||
* @date:2026/5/15-05-15-16:01
|
||||
*/
|
||||
@Configuration
|
||||
public class RedisConfig {
|
||||
|
||||
@Bean
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
|
||||
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
||||
template.setConnectionFactory(factory);
|
||||
|
||||
// 创建ObjectMapper并配置
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||
om.activateDefaultTyping(om.getPolymorphicTypeValidator(), ObjectMapper.DefaultTyping.NON_FINAL);
|
||||
|
||||
// 使用GenericJackson2JsonRedisSerializer替代已弃用的方式
|
||||
GenericJackson2JsonRedisSerializer genericJackson2JsonRedisSerializer = new GenericJackson2JsonRedisSerializer(om);
|
||||
|
||||
// 使用StringRedisSerializer来序列化和反序列化redis的key值
|
||||
StringRedisSerializer stringSerializer = new StringRedisSerializer();
|
||||
template.setKeySerializer(stringSerializer);
|
||||
template.setValueSerializer(genericJackson2JsonRedisSerializer);
|
||||
template.setHashKeySerializer(stringSerializer);
|
||||
template.setHashValueSerializer(genericJackson2JsonRedisSerializer);
|
||||
|
||||
template.afterPropertiesSet();
|
||||
return template;
|
||||
}
|
||||
}
|
||||
+8
-32
@@ -1,11 +1,12 @@
|
||||
package cn.novalon.gym.manage.app.config;
|
||||
|
||||
import cn.novalon.gym.manage.groupcourse.handler.GroupCourseHandler;
|
||||
import cn.novalon.gym.manage.sys.handler.auth.SysAuthHandler;
|
||||
import cn.novalon.gym.manage.sys.handler.auth.PasswordDiagnosticHandler;
|
||||
import cn.novalon.gym.manage.sys.handler.config.SysConfigHandler;
|
||||
import cn.novalon.gym.manage.sys.handler.dictionary.DictionaryHandler;
|
||||
import cn.novalon.gym.manage.sys.handler.dict.SysDictHandler;
|
||||
import cn.novalon.gym.manage.sys.handler.gymMember.GymMemberHandler;
|
||||
|
||||
import cn.novalon.gym.manage.sys.handler.log.SysLogHandler;
|
||||
import cn.novalon.gym.manage.sys.handler.log.OperationLogHandler;
|
||||
import cn.novalon.gym.manage.sys.handler.menu.MenuHandler;
|
||||
@@ -23,21 +24,11 @@ import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
|
||||
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
|
||||
|
||||
/**
|
||||
* 系统路由配置类
|
||||
*
|
||||
* 文件定义:配置WebFlux函数式路由,将HTTP请求映射到对应的Handler方法
|
||||
* 涉及业务:用户、角色、字典、菜单、公告、文件等所有RESTful API路由
|
||||
* 算法:使用RouterFunctions.route()构建函数式路由规则
|
||||
*
|
||||
* @author 张翔
|
||||
* @date 2026-03-13
|
||||
*/
|
||||
@Configuration
|
||||
public class SystemRouter {
|
||||
|
||||
@Bean
|
||||
public RouterFunction<ServerResponse> systemRoutes(
|
||||
GroupCourseHandler groupCourseHandler,
|
||||
DictionaryHandler dictionaryHandler,
|
||||
SysUserHandler userHandler,
|
||||
MenuHandler menuHandler,
|
||||
@@ -52,14 +43,11 @@ public class SystemRouter {
|
||||
SysUserMessageHandler messageHandler,
|
||||
SysFileHandler fileHandler,
|
||||
SysPermissionHandler permissionHandler,
|
||||
PasswordDiagnosticHandler passwordDiagnosticHandler,
|
||||
GymMemberHandler gymMemberHandler) {
|
||||
PasswordDiagnosticHandler passwordDiagnosticHandler) {
|
||||
|
||||
return route()
|
||||
// ========== 诊断路由 ==========
|
||||
.GET("/api/diagnostic/password", passwordDiagnosticHandler::diagnose)
|
||||
|
||||
// ========== 字典路由 ==========
|
||||
.GET("/api/dictionaries", dictionaryHandler::getAllDictionaries)
|
||||
.GET("/api/dictionaries/{id}", dictionaryHandler::getDictionaryById)
|
||||
.GET("/api/dictionaries/type/{type}", dictionaryHandler::getDictionariesByType)
|
||||
@@ -68,7 +56,6 @@ public class SystemRouter {
|
||||
.PUT("/api/dictionaries/{id}", dictionaryHandler::updateDictionary)
|
||||
.DELETE("/api/dictionaries/{id}", dictionaryHandler::deleteDictionary)
|
||||
|
||||
// ========== 用户路由 ==========
|
||||
.GET("/api/users", userHandler::getAllUsers)
|
||||
.GET("/api/users/page", userHandler::getUsersByPage)
|
||||
.GET("/api/users/count", userHandler::getUserCount)
|
||||
@@ -87,7 +74,6 @@ public class SystemRouter {
|
||||
.GET("/api/users/{id}/roles", userHandler::getUserRoles)
|
||||
.POST("/api/users/{id}/roles", userHandler::assignRoles)
|
||||
|
||||
// ========== 菜单路由 ==========
|
||||
.GET("/api/menus", menuHandler::getAllMenus)
|
||||
.GET("/api/menus/tree", menuHandler::getMenuTree)
|
||||
.GET("/api/menus/{id}", menuHandler::getMenuById)
|
||||
@@ -95,7 +81,6 @@ public class SystemRouter {
|
||||
.PUT("/api/menus/{id}", menuHandler::updateMenu)
|
||||
.DELETE("/api/menus/{id}", menuHandler::deleteMenu)
|
||||
|
||||
// ========== 角色路由 ==========
|
||||
.GET("/api/roles", roleHandler::getAllRoles)
|
||||
.GET("/api/roles/page", roleHandler::getRolesByPage)
|
||||
.GET("/api/roles/count", roleHandler::getRoleCount)
|
||||
@@ -109,7 +94,6 @@ public class SystemRouter {
|
||||
.GET("/api/roles/{id}/permissions", permissionHandler::getPermissionsByRoleId)
|
||||
.POST("/api/roles/{id}/permissions", permissionHandler::assignPermissionsToRole)
|
||||
|
||||
// ========== 配置路由 ==========
|
||||
.GET("/api/config", configHandler::getAllConfigs)
|
||||
.GET("/api/config/{id}", configHandler::getConfigById)
|
||||
.GET("/api/config/key/{configKey}", configHandler::getConfigByKey)
|
||||
@@ -117,7 +101,6 @@ public class SystemRouter {
|
||||
.PUT("/api/config/{id}", configHandler::updateConfig)
|
||||
.DELETE("/api/config/{id}", configHandler::deleteConfig)
|
||||
|
||||
// ========== 日志路由 ==========
|
||||
.GET("/api/logs/login", logHandler::getAllLoginLogs)
|
||||
.GET("/api/logs/login/page", logHandler::getLoginLogsByPage)
|
||||
.GET("/api/logs/login/count", logHandler::getLoginLogCount)
|
||||
@@ -137,15 +120,12 @@ public class SystemRouter {
|
||||
.GET("/api/logs/operation/{id}", operationLogHandler::getOperationLogById)
|
||||
.POST("/api/logs/operation", operationLogHandler::createOperationLog)
|
||||
|
||||
// ========== 认证路由 ==========
|
||||
.POST("/api/auth/login", authHandler::login)
|
||||
.POST("/api/auth/register", authHandler::register)
|
||||
.POST("/api/auth/logout", authHandler::logout)
|
||||
|
||||
// ========== 统计路由 ==========
|
||||
.GET("/api/stats/overview", statsHandler::getOverview)
|
||||
|
||||
// ========== 数据字典路由 ==========
|
||||
.GET("/api/dict/types", dictHandler::getAllDictTypes)
|
||||
.GET("/api/dict/types/{id}", dictHandler::getDictTypeById)
|
||||
.GET("/api/dict/types/type/{dictType}", dictHandler::getDictTypeByType)
|
||||
@@ -159,7 +139,6 @@ public class SystemRouter {
|
||||
.PUT("/api/dict/data/{id}", dictHandler::updateDictData)
|
||||
.DELETE("/api/dict/data/{id}", dictHandler::deleteDictData)
|
||||
|
||||
// ========== 公告路由 ==========
|
||||
.GET("/api/notices", noticeHandler::getAllNotices)
|
||||
.GET("/api/notices/{id}", noticeHandler::getNoticeById)
|
||||
.GET("/api/notices/status/{status}", noticeHandler::getNoticesByStatus)
|
||||
@@ -167,7 +146,6 @@ public class SystemRouter {
|
||||
.PUT("/api/notices/{id}", noticeHandler::updateNotice)
|
||||
.DELETE("/api/notices/{id}", noticeHandler::deleteNotice)
|
||||
|
||||
// ========== 消息路由 ==========
|
||||
.GET("/api/messages/user/{userId}", messageHandler::getMessagesByUser)
|
||||
.GET("/api/messages/user/{userId}/unread", messageHandler::getUnreadCount)
|
||||
.GET("/api/messages/user/{userId}/unread/list", messageHandler::getUnreadList)
|
||||
@@ -175,7 +153,6 @@ public class SystemRouter {
|
||||
.PUT("/api/messages/{id}/read", messageHandler::markAsRead)
|
||||
.DELETE("/api/messages/{id}", messageHandler::deleteMessage)
|
||||
|
||||
// ========== 文件路由 ==========
|
||||
.GET("/api/files", fileHandler::getAllFiles)
|
||||
.GET("/api/files/{id}", fileHandler::getFileById)
|
||||
.POST("/api/files/upload", fileHandler::uploadFile)
|
||||
@@ -185,7 +162,6 @@ public class SystemRouter {
|
||||
.GET("/api/files/preview/{fileName}", fileHandler::previewFileByName)
|
||||
.DELETE("/api/files/{id}", fileHandler::deleteFile)
|
||||
|
||||
// ========== 权限路由 ==========
|
||||
.GET("/api/permissions", permissionHandler::getAllPermissions)
|
||||
.GET("/api/permissions/{id}", permissionHandler::getPermissionById)
|
||||
.GET("/api/permissions/code/{code}", permissionHandler::getPermissionByCode)
|
||||
@@ -195,10 +171,10 @@ public class SystemRouter {
|
||||
.PUT("/api/permissions/{id}", permissionHandler::updatePermission)
|
||||
.DELETE("/api/permissions/{id}", permissionHandler::deletePermission)
|
||||
|
||||
// ========== 顾客路由 ==========
|
||||
|
||||
.GET("/api/gymMember/{id}", gymMemberHandler::getUserById)
|
||||
.POST("/api/gymMember/{id}",gymMemberHandler::updateMemberBaseInfo)
|
||||
.GET("/api/groupCourse", groupCourseHandler::getAllGroupCourse)
|
||||
.POST("/api/groupCourse/page", groupCourseHandler::getGroupCoursesByPage)
|
||||
.POST("/api/groupCourse/cache/get", groupCourseHandler::getCacheByKey)
|
||||
.GET("/api/groupCourse/{id}", groupCourseHandler::getGroupCourseById)
|
||||
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -38,9 +38,22 @@ spring:
|
||||
user:
|
||||
name: disabled
|
||||
password: disabled
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PASSWORD:novalon123}
|
||||
timeout: 5000
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 8 # 最大连接数
|
||||
max-idle: 8 # 最大空闲连接
|
||||
min-idle: 0 # 最小空闲连接
|
||||
max-wait: -1ms # 连接等待时间
|
||||
profiles:
|
||||
active: dev
|
||||
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
|
||||
@@ -99,6 +99,8 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package cn.novalon.gym.manage.db.converter;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.novalon.gym.manage.db.entity.GymMemberEntity;
|
||||
import cn.novalon.gym.manage.sys.core.domain.GymMember;
|
||||
import cn.novalon.gym.manage.sys.core.domain.SysUser;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author:liwentao
|
||||
* @date:2026/5/4-05-04-10:34
|
||||
*/
|
||||
@Component
|
||||
public class GymMemberConverter {
|
||||
public GymMember toDomain(GymMemberEntity entity){
|
||||
if (entity == null){
|
||||
return null;
|
||||
}
|
||||
GymMember domain = new GymMember();
|
||||
BeanUtil.copyProperties(entity,domain);
|
||||
return domain;
|
||||
}
|
||||
|
||||
public GymMemberEntity toEntity(GymMember domain){
|
||||
if(domain == null){
|
||||
return null;
|
||||
}
|
||||
GymMemberEntity entity = new GymMemberEntity();
|
||||
BeanUtil.copyProperties(domain,entity);
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package cn.novalon.gym.manage.db.dao;
|
||||
|
||||
import cn.novalon.gym.manage.db.entity.GymMemberEntity;
|
||||
import org.springframework.data.r2dbc.repository.R2dbcRepository;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
public interface GymMemberDao extends R2dbcRepository<GymMemberEntity, Long> {
|
||||
Mono<GymMemberEntity> findByIdIsAndDeletedAtIsNull(Long id);
|
||||
}
|
||||
-297
@@ -1,297 +0,0 @@
|
||||
package cn.novalon.gym.manage.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 顾客体测记录表
|
||||
*
|
||||
* @author 黎文涛
|
||||
* @date 2026-05-04
|
||||
*/
|
||||
@Table("gym_body_measurement")
|
||||
public class GymBodyMeasurementEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 会员ID
|
||||
*/
|
||||
@Column("member_id")
|
||||
private Long memberId;
|
||||
|
||||
/**
|
||||
* 测量日期
|
||||
*/
|
||||
@Column("measure_date")
|
||||
private LocalDate measureDate;
|
||||
|
||||
/**
|
||||
* 身高(cm)
|
||||
*/
|
||||
@Column("height")
|
||||
private BigDecimal height;
|
||||
|
||||
/**
|
||||
* 体重(kg)
|
||||
*/
|
||||
@Column("weight")
|
||||
private BigDecimal weight;
|
||||
|
||||
/**
|
||||
* BMI指数
|
||||
*/
|
||||
@Column("bmi")
|
||||
private BigDecimal bmi;
|
||||
|
||||
/**
|
||||
* 体脂率(%)
|
||||
*/
|
||||
@Column("body_fat_percentage")
|
||||
private BigDecimal bodyFatPercentage;
|
||||
|
||||
/**
|
||||
* 肌肉量(kg)
|
||||
*/
|
||||
@Column("muscle_mass")
|
||||
private BigDecimal muscleMass;
|
||||
|
||||
/**
|
||||
* 水分量(kg)
|
||||
*/
|
||||
@Column("body_water")
|
||||
private BigDecimal bodyWater;
|
||||
|
||||
/**
|
||||
* 骨量(kg)
|
||||
*/
|
||||
@Column("bone_mass")
|
||||
private BigDecimal boneMass;
|
||||
|
||||
/**
|
||||
* 内脏脂肪等级
|
||||
*/
|
||||
@Column("visceral_fat_level")
|
||||
private Integer visceralFatLevel;
|
||||
|
||||
/**
|
||||
* 基础代谢(kcal)
|
||||
*/
|
||||
@Column("basal_metabolism")
|
||||
private BigDecimal basalMetabolism;
|
||||
|
||||
/**
|
||||
* 腰围(cm)
|
||||
*/
|
||||
@Column("waist_circumference")
|
||||
private BigDecimal waistCircumference;
|
||||
|
||||
/**
|
||||
* 臀围(cm)
|
||||
*/
|
||||
@Column("hip_circumference")
|
||||
private BigDecimal hipCircumference;
|
||||
|
||||
/**
|
||||
* 胸围(cm)
|
||||
*/
|
||||
@Column("chest_circumference")
|
||||
private BigDecimal chestCircumference;
|
||||
|
||||
/**
|
||||
* 臂围(cm)
|
||||
*/
|
||||
@Column("arm_circumference")
|
||||
private BigDecimal armCircumference;
|
||||
|
||||
/**
|
||||
* 大腿围(cm)
|
||||
*/
|
||||
@Column("thigh_circumference")
|
||||
private BigDecimal thighCircumference;
|
||||
|
||||
/**
|
||||
* 收缩压(mmHg)
|
||||
*/
|
||||
@Column("systolic_blood_pressure")
|
||||
private Integer systolicBloodPressure;
|
||||
|
||||
/**
|
||||
* 舒张压(mmHg)
|
||||
*/
|
||||
@Column("diastolic_blood_pressure")
|
||||
private Integer diastolicBloodPressure;
|
||||
|
||||
/**
|
||||
* 心率(次/分)
|
||||
*/
|
||||
@Column("heart_rate")
|
||||
private Integer heartRate;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Column("remark")
|
||||
private String remark;
|
||||
|
||||
public Long getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public void setMemberId(Long memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public LocalDate getMeasureDate() {
|
||||
return measureDate;
|
||||
}
|
||||
|
||||
public void setMeasureDate(LocalDate measureDate) {
|
||||
this.measureDate = measureDate;
|
||||
}
|
||||
|
||||
public BigDecimal getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(BigDecimal height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public BigDecimal getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(BigDecimal weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public BigDecimal getBmi() {
|
||||
return bmi;
|
||||
}
|
||||
|
||||
public void setBmi(BigDecimal bmi) {
|
||||
this.bmi = bmi;
|
||||
}
|
||||
|
||||
public BigDecimal getBodyFatPercentage() {
|
||||
return bodyFatPercentage;
|
||||
}
|
||||
|
||||
public void setBodyFatPercentage(BigDecimal bodyFatPercentage) {
|
||||
this.bodyFatPercentage = bodyFatPercentage;
|
||||
}
|
||||
|
||||
public BigDecimal getMuscleMass() {
|
||||
return muscleMass;
|
||||
}
|
||||
|
||||
public void setMuscleMass(BigDecimal muscleMass) {
|
||||
this.muscleMass = muscleMass;
|
||||
}
|
||||
|
||||
public BigDecimal getBodyWater() {
|
||||
return bodyWater;
|
||||
}
|
||||
|
||||
public void setBodyWater(BigDecimal bodyWater) {
|
||||
this.bodyWater = bodyWater;
|
||||
}
|
||||
|
||||
public BigDecimal getBoneMass() {
|
||||
return boneMass;
|
||||
}
|
||||
|
||||
public void setBoneMass(BigDecimal boneMass) {
|
||||
this.boneMass = boneMass;
|
||||
}
|
||||
|
||||
public Integer getVisceralFatLevel() {
|
||||
return visceralFatLevel;
|
||||
}
|
||||
|
||||
public void setVisceralFatLevel(Integer visceralFatLevel) {
|
||||
this.visceralFatLevel = visceralFatLevel;
|
||||
}
|
||||
|
||||
public BigDecimal getBasalMetabolism() {
|
||||
return basalMetabolism;
|
||||
}
|
||||
|
||||
public void setBasalMetabolism(BigDecimal basalMetabolism) {
|
||||
this.basalMetabolism = basalMetabolism;
|
||||
}
|
||||
|
||||
public BigDecimal getWaistCircumference() {
|
||||
return waistCircumference;
|
||||
}
|
||||
|
||||
public void setWaistCircumference(BigDecimal waistCircumference) {
|
||||
this.waistCircumference = waistCircumference;
|
||||
}
|
||||
|
||||
public BigDecimal getHipCircumference() {
|
||||
return hipCircumference;
|
||||
}
|
||||
|
||||
public void setHipCircumference(BigDecimal hipCircumference) {
|
||||
this.hipCircumference = hipCircumference;
|
||||
}
|
||||
|
||||
public BigDecimal getChestCircumference() {
|
||||
return chestCircumference;
|
||||
}
|
||||
|
||||
public void setChestCircumference(BigDecimal chestCircumference) {
|
||||
this.chestCircumference = chestCircumference;
|
||||
}
|
||||
|
||||
public BigDecimal getArmCircumference() {
|
||||
return armCircumference;
|
||||
}
|
||||
|
||||
public void setArmCircumference(BigDecimal armCircumference) {
|
||||
this.armCircumference = armCircumference;
|
||||
}
|
||||
|
||||
public BigDecimal getThighCircumference() {
|
||||
return thighCircumference;
|
||||
}
|
||||
|
||||
public void setThighCircumference(BigDecimal thighCircumference) {
|
||||
this.thighCircumference = thighCircumference;
|
||||
}
|
||||
|
||||
public Integer getSystolicBloodPressure() {
|
||||
return systolicBloodPressure;
|
||||
}
|
||||
|
||||
public void setSystolicBloodPressure(Integer systolicBloodPressure) {
|
||||
this.systolicBloodPressure = systolicBloodPressure;
|
||||
}
|
||||
|
||||
public Integer getDiastolicBloodPressure() {
|
||||
return diastolicBloodPressure;
|
||||
}
|
||||
|
||||
public void setDiastolicBloodPressure(Integer diastolicBloodPressure) {
|
||||
this.diastolicBloodPressure = diastolicBloodPressure;
|
||||
}
|
||||
|
||||
public Integer getHeartRate() {
|
||||
return heartRate;
|
||||
}
|
||||
|
||||
public void setHeartRate(Integer heartRate) {
|
||||
this.heartRate = heartRate;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
package cn.novalon.gym.manage.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 顾客签到记录表
|
||||
*
|
||||
* @author 黎文涛
|
||||
* @date 2026-05-04
|
||||
*/
|
||||
@Table("gym_check_in")
|
||||
public class GymCheckInEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 会员ID
|
||||
*/
|
||||
@Column("member_id")
|
||||
private Long memberId;
|
||||
|
||||
/**
|
||||
* 签到时间
|
||||
*/
|
||||
@Column("check_in_time")
|
||||
private LocalDateTime checkInTime;
|
||||
|
||||
/**
|
||||
* 签退时间
|
||||
*/
|
||||
@Column("check_out_time")
|
||||
private LocalDateTime checkOutTime;
|
||||
|
||||
/**
|
||||
* 签到类型(1刷卡 2扫码 3指纹 4人脸)
|
||||
*/
|
||||
@Column("check_in_type")
|
||||
private String checkInType;
|
||||
|
||||
/**
|
||||
* 刷卡卡号
|
||||
*/
|
||||
@Column("card_id")
|
||||
private String cardId;
|
||||
|
||||
/**
|
||||
* 签到设备信息
|
||||
*/
|
||||
@Column("device_info")
|
||||
private String deviceInfo;
|
||||
|
||||
public Long getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public void setMemberId(Long memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public LocalDateTime getCheckInTime() {
|
||||
return checkInTime;
|
||||
}
|
||||
|
||||
public void setCheckInTime(LocalDateTime checkInTime) {
|
||||
this.checkInTime = checkInTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getCheckOutTime() {
|
||||
return checkOutTime;
|
||||
}
|
||||
|
||||
public void setCheckOutTime(LocalDateTime checkOutTime) {
|
||||
this.checkOutTime = checkOutTime;
|
||||
}
|
||||
|
||||
public String getCheckInType() {
|
||||
return checkInType;
|
||||
}
|
||||
|
||||
public void setCheckInType(String checkInType) {
|
||||
this.checkInType = checkInType;
|
||||
}
|
||||
|
||||
public String getCardId() {
|
||||
return cardId;
|
||||
}
|
||||
|
||||
public void setCardId(String cardId) {
|
||||
this.cardId = cardId;
|
||||
}
|
||||
|
||||
public String getDeviceInfo() {
|
||||
return deviceInfo;
|
||||
}
|
||||
|
||||
public void setDeviceInfo(String deviceInfo) {
|
||||
this.deviceInfo = deviceInfo;
|
||||
}
|
||||
}
|
||||
-409
@@ -1,409 +0,0 @@
|
||||
package cn.novalon.gym.manage.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 健身房顾客用户表
|
||||
*
|
||||
* @author 黎文涛
|
||||
* @date 2026-05-04
|
||||
*/
|
||||
@Table("gym_member")
|
||||
public class GymMemberEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 会员编号(唯一)
|
||||
*/
|
||||
@Column("member_no")
|
||||
private String memberNo;
|
||||
|
||||
/**
|
||||
* 用户名(登录用)
|
||||
*/
|
||||
@Column("username")
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
@Column("real_name")
|
||||
private String realName;
|
||||
|
||||
/**
|
||||
* 性别(0男 1女 2未知)
|
||||
*/
|
||||
@Column("gender")
|
||||
private String gender;
|
||||
|
||||
/**
|
||||
* 出生日期
|
||||
*/
|
||||
@Column("birthday")
|
||||
private LocalDate birthday;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
@Column("phone")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
@Column("email")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
@Column("id_card")
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 省份
|
||||
*/
|
||||
@Column("province")
|
||||
private String province;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
@Column("city")
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 区县
|
||||
*/
|
||||
@Column("district")
|
||||
private String district;
|
||||
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
@Column("address")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 身高(cm)
|
||||
*/
|
||||
@Column("height")
|
||||
private BigDecimal height;
|
||||
|
||||
/**
|
||||
* 体重(kg)
|
||||
*/
|
||||
@Column("weight")
|
||||
private BigDecimal weight;
|
||||
|
||||
/**
|
||||
* BMI指数
|
||||
*/
|
||||
@Column("bmi")
|
||||
private BigDecimal bmi;
|
||||
|
||||
/**
|
||||
* 注册日期
|
||||
*/
|
||||
@Column("registration_date")
|
||||
private LocalDate registrationDate;
|
||||
|
||||
/**
|
||||
* 会员卡类型ID
|
||||
*/
|
||||
@Column("card_type_id")
|
||||
private Long cardTypeId;
|
||||
|
||||
/**
|
||||
* 会员卡开始日期
|
||||
*/
|
||||
@Column("card_start_date")
|
||||
private LocalDate cardStartDate;
|
||||
|
||||
/**
|
||||
* 会员卡结束日期
|
||||
*/
|
||||
@Column("card_end_date")
|
||||
private LocalDate cardEndDate;
|
||||
|
||||
/**
|
||||
* 会员卡状态(0正常 1即将到期 2已过期 3冻结)
|
||||
*/
|
||||
@Column("card_status")
|
||||
private String cardStatus;
|
||||
|
||||
/**
|
||||
* 剩余次数(次卡使用)
|
||||
*/
|
||||
@Column("remaining_times")
|
||||
private Integer remainingTimes;
|
||||
|
||||
/**
|
||||
* 私教ID
|
||||
*/
|
||||
@Column("coach_id")
|
||||
private Long coachId;
|
||||
|
||||
/**
|
||||
* 紧急联系人
|
||||
*/
|
||||
@Column("emergency_contact")
|
||||
private String emergencyContact;
|
||||
|
||||
/**
|
||||
* 紧急联系电话
|
||||
*/
|
||||
@Column("emergency_phone")
|
||||
private String emergencyPhone;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
@Column("remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 用户状态(0正常 1停用 2黑名单)
|
||||
*/
|
||||
@Column("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 客户来源(如地推、转介绍、线上广告等)
|
||||
*/
|
||||
@Column("source")
|
||||
private String source;
|
||||
|
||||
/**
|
||||
* 头像URL
|
||||
*/
|
||||
@Column("avatar_url")
|
||||
private String avatarUrl;
|
||||
|
||||
public String getMemberNo() {
|
||||
return memberNo;
|
||||
}
|
||||
|
||||
public void setMemberNo(String memberNo) {
|
||||
this.memberNo = memberNo;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getRealName() {
|
||||
return realName;
|
||||
}
|
||||
|
||||
public void setRealName(String realName) {
|
||||
this.realName = realName;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public LocalDate getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setBirthday(LocalDate birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getIdCard() {
|
||||
return idCard;
|
||||
}
|
||||
|
||||
public void setIdCard(String idCard) {
|
||||
this.idCard = idCard;
|
||||
}
|
||||
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public BigDecimal getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(BigDecimal height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public BigDecimal getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(BigDecimal weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public BigDecimal getBmi() {
|
||||
return bmi;
|
||||
}
|
||||
|
||||
public void setBmi(BigDecimal bmi) {
|
||||
this.bmi = bmi;
|
||||
}
|
||||
|
||||
public LocalDate getRegistrationDate() {
|
||||
return registrationDate;
|
||||
}
|
||||
|
||||
public void setRegistrationDate(LocalDate registrationDate) {
|
||||
this.registrationDate = registrationDate;
|
||||
}
|
||||
|
||||
public Long getCardTypeId() {
|
||||
return cardTypeId;
|
||||
}
|
||||
|
||||
public void setCardTypeId(Long cardTypeId) {
|
||||
this.cardTypeId = cardTypeId;
|
||||
}
|
||||
|
||||
public LocalDate getCardStartDate() {
|
||||
return cardStartDate;
|
||||
}
|
||||
|
||||
public void setCardStartDate(LocalDate cardStartDate) {
|
||||
this.cardStartDate = cardStartDate;
|
||||
}
|
||||
|
||||
public LocalDate getCardEndDate() {
|
||||
return cardEndDate;
|
||||
}
|
||||
|
||||
public void setCardEndDate(LocalDate cardEndDate) {
|
||||
this.cardEndDate = cardEndDate;
|
||||
}
|
||||
|
||||
public String getCardStatus() {
|
||||
return cardStatus;
|
||||
}
|
||||
|
||||
public void setCardStatus(String cardStatus) {
|
||||
this.cardStatus = cardStatus;
|
||||
}
|
||||
|
||||
public Integer getRemainingTimes() {
|
||||
return remainingTimes;
|
||||
}
|
||||
|
||||
public void setRemainingTimes(Integer remainingTimes) {
|
||||
this.remainingTimes = remainingTimes;
|
||||
}
|
||||
|
||||
public Long getCoachId() {
|
||||
return coachId;
|
||||
}
|
||||
|
||||
public void setCoachId(Long coachId) {
|
||||
this.coachId = coachId;
|
||||
}
|
||||
|
||||
public String getEmergencyContact() {
|
||||
return emergencyContact;
|
||||
}
|
||||
|
||||
public void setEmergencyContact(String emergencyContact) {
|
||||
this.emergencyContact = emergencyContact;
|
||||
}
|
||||
|
||||
public String getEmergencyPhone() {
|
||||
return emergencyPhone;
|
||||
}
|
||||
|
||||
public void setEmergencyPhone(String emergencyPhone) {
|
||||
this.emergencyPhone = emergencyPhone;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public String getAvatarUrl() {
|
||||
return avatarUrl;
|
||||
}
|
||||
|
||||
public void setAvatarUrl(String avatarUrl) {
|
||||
this.avatarUrl = avatarUrl;
|
||||
}
|
||||
}
|
||||
-116
@@ -1,116 +0,0 @@
|
||||
package cn.novalon.gym.manage.db.entity;
|
||||
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 会员卡类型表
|
||||
*
|
||||
* @author 黎文涛
|
||||
* @date 2026-05-04
|
||||
*/
|
||||
@Table("gym_membership_card_type")
|
||||
public class GymMembershipCardTypeEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 卡类型名称(如年卡、季卡、次卡)
|
||||
*/
|
||||
@Column("card_type_name")
|
||||
private String cardTypeName;
|
||||
|
||||
/**
|
||||
* 卡类型编码
|
||||
*/
|
||||
@Column("card_type_code")
|
||||
private String cardTypeCode;
|
||||
|
||||
/**
|
||||
* 有效天数
|
||||
*/
|
||||
@Column("duration_days")
|
||||
private Integer durationDays;
|
||||
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
@Column("price")
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Column("description")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@Column("sort")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
@Column("status")
|
||||
private Integer status;
|
||||
|
||||
public String getCardTypeName() {
|
||||
return cardTypeName;
|
||||
}
|
||||
|
||||
public void setCardTypeName(String cardTypeName) {
|
||||
this.cardTypeName = cardTypeName;
|
||||
}
|
||||
|
||||
public String getCardTypeCode() {
|
||||
return cardTypeCode;
|
||||
}
|
||||
|
||||
public void setCardTypeCode(String cardTypeCode) {
|
||||
this.cardTypeCode = cardTypeCode;
|
||||
}
|
||||
|
||||
public Integer getDurationDays() {
|
||||
return durationDays;
|
||||
}
|
||||
|
||||
public void setDurationDays(Integer durationDays) {
|
||||
this.durationDays = durationDays;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
package cn.novalon.gym.manage.db.repository;
|
||||
|
||||
import cn.novalon.gym.manage.db.converter.GymMemberConverter;
|
||||
import cn.novalon.gym.manage.db.dao.GymMemberDao;
|
||||
import cn.novalon.gym.manage.db.entity.GymMemberEntity;
|
||||
import cn.novalon.gym.manage.sys.audit.service.IAuditLogService;
|
||||
import cn.novalon.gym.manage.sys.core.domain.GymMember;
|
||||
import cn.novalon.gym.manage.sys.core.repository.IGymMemberRepository;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
/**
|
||||
* @author:liwentao
|
||||
* @date:2026/5/4-05-04-10:30
|
||||
*/
|
||||
@Repository
|
||||
public class GymMemberRepository implements IGymMemberRepository {
|
||||
private final GymMemberDao gymMemberDao;
|
||||
private final GymMemberConverter gymMemberConverter;
|
||||
private final R2dbcEntityTemplate r2dbcEntityTemplate;
|
||||
|
||||
public GymMemberRepository(
|
||||
GymMemberDao gymMemberDao,
|
||||
GymMemberConverter gymMemberConverter,
|
||||
R2dbcEntityTemplate r2dbcEntityTemplate
|
||||
){
|
||||
this.gymMemberConverter = gymMemberConverter;
|
||||
this.gymMemberDao = gymMemberDao;
|
||||
this.r2dbcEntityTemplate = r2dbcEntityTemplate;
|
||||
}
|
||||
@Override
|
||||
public Mono<GymMember> findById(Long id) {
|
||||
return gymMemberDao.findByIdIsAndDeletedAtIsNull(id).map(gymMemberConverter::toDomain);
|
||||
}
|
||||
|
||||
public Mono<GymMember> save(GymMember gymMember){
|
||||
GymMemberEntity entity = gymMemberConverter.toEntity(gymMember);
|
||||
if(entity.isNew()){
|
||||
return r2dbcEntityTemplate.insert(GymMemberEntity.class)
|
||||
.using(entity)
|
||||
.doOnNext(e -> e.markNotNew())
|
||||
.map(gymMemberConverter::toDomain);
|
||||
}
|
||||
return gymMemberDao.save(entity)
|
||||
.map(gymMemberConverter::toDomain);
|
||||
}
|
||||
|
||||
public Mono<GymMember> update(GymMember gymMember){
|
||||
GymMemberEntity entity = gymMemberConverter.toEntity(gymMember);
|
||||
entity.markNotNew();
|
||||
return gymMemberDao.save(entity)
|
||||
.map(gymMemberConverter::toDomain);
|
||||
}
|
||||
}
|
||||
+1
@@ -10,6 +10,7 @@ import cn.novalon.gym.manage.sys.core.query.SysUserQuery;
|
||||
import cn.novalon.gym.manage.sys.core.repository.ISysUserRepository;
|
||||
import cn.novalon.gym.manage.common.dto.PageRequest;
|
||||
import cn.novalon.gym.manage.common.dto.PageResponse;
|
||||
import cn.novalon.gym.manage.sys.dto.response.UserResponse;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
|
||||
import org.springframework.data.relational.core.query.Query;
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
-- ============================================
|
||||
-- 团课相关表
|
||||
-- ============================================
|
||||
|
||||
-- 团课课程表
|
||||
CREATE TABLE IF NOT EXISTS group_course (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
course_name VARCHAR(100) NOT NULL,
|
||||
coach_id BIGINT,
|
||||
course_type BIGINT,
|
||||
start_time TIMESTAMP NOT NULL,
|
||||
end_time TIMESTAMP NOT NULL,
|
||||
max_members INTEGER DEFAULT 20,
|
||||
current_members INTEGER DEFAULT 0,
|
||||
status VARCHAR(1) DEFAULT '0',
|
||||
location VARCHAR(255),
|
||||
cover_image VARCHAR(500),
|
||||
description TEXT,
|
||||
create_by VARCHAR(50),
|
||||
update_by VARCHAR(50),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
-- 团课预约记录表
|
||||
CREATE TABLE IF NOT EXISTS group_course_booking (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
course_id BIGINT NOT NULL,
|
||||
user_id BIGINT NOT NULL,
|
||||
booking_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
status VARCHAR(1) DEFAULT '0',
|
||||
cancel_time TIMESTAMP,
|
||||
create_by VARCHAR(50),
|
||||
update_by VARCHAR(50),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
COMMENT ON TABLE group_course IS '团课课程表';
|
||||
COMMENT ON COLUMN group_course.id IS '主键ID';
|
||||
COMMENT ON COLUMN group_course.course_name IS '课程名称';
|
||||
COMMENT ON COLUMN group_course.coach_id IS '教练ID(关联sys_user)';
|
||||
COMMENT ON COLUMN group_course.course_type IS '课程类型(如瑜伽/普拉提/动感单车)';
|
||||
COMMENT ON COLUMN group_course.start_time IS '开始时间';
|
||||
COMMENT ON COLUMN group_course.end_time IS '结束时间';
|
||||
COMMENT ON COLUMN group_course.max_members IS '最大参与人数';
|
||||
COMMENT ON COLUMN group_course.current_members IS '当前参与人数';
|
||||
COMMENT ON COLUMN group_course.status IS '状态(0正常 1已取消 2已结束)';
|
||||
COMMENT ON COLUMN group_course.location IS '上课地点';
|
||||
COMMENT ON COLUMN group_course.cover_image IS '封面图URL';
|
||||
COMMENT ON COLUMN group_course.description IS '课程描述';
|
||||
COMMENT ON COLUMN group_course.create_by IS '创建人';
|
||||
COMMENT ON COLUMN group_course.update_by IS '更新人';
|
||||
COMMENT ON COLUMN group_course.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN group_course.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN group_course.deleted_at IS '删除时间(软删除)';
|
||||
|
||||
COMMENT ON TABLE group_course_booking IS '团课预约记录表';
|
||||
COMMENT ON COLUMN group_course_booking.id IS '主键ID';
|
||||
COMMENT ON COLUMN group_course_booking.course_id IS '团课ID';
|
||||
COMMENT ON COLUMN group_course_booking.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN group_course_booking.booking_time IS '预约时间';
|
||||
COMMENT ON COLUMN group_course_booking.status IS '状态(0已预约 1已取消 2已出席 3缺席)';
|
||||
COMMENT ON COLUMN group_course_booking.cancel_time IS '取消时间';
|
||||
COMMENT ON COLUMN group_course_booking.create_by IS '创建人';
|
||||
COMMENT ON COLUMN group_course_booking.update_by IS '更新人';
|
||||
COMMENT ON COLUMN group_course_booking.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN group_course_booking.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN group_course_booking.deleted_at IS '删除时间(软删除)';
|
||||
-190
@@ -1,190 +0,0 @@
|
||||
-- ============================================
|
||||
-- 健身房管理系统 - 顾客用户表
|
||||
-- ============================================
|
||||
|
||||
-- 会员卡类型字典(如果需要独立管理)
|
||||
CREATE TABLE IF NOT EXISTS gym_membership_card_type (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
card_type_name VARCHAR(50) NOT NULL,
|
||||
card_type_code VARCHAR(50) NOT NULL UNIQUE,
|
||||
duration_days INTEGER,
|
||||
price DECIMAL(10,2),
|
||||
description VARCHAR(500),
|
||||
sort INTEGER DEFAULT 0,
|
||||
status INTEGER DEFAULT 1,
|
||||
create_by VARCHAR(50),
|
||||
update_by VARCHAR(50),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
-- 顾客用户表
|
||||
CREATE TABLE IF NOT EXISTS gym_member (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
-- 基本信息
|
||||
member_no VARCHAR(50) NOT NULL UNIQUE,
|
||||
username VARCHAR(50),
|
||||
real_name VARCHAR(100) NOT NULL,
|
||||
gender VARCHAR(1) DEFAULT '0',
|
||||
birthday DATE,
|
||||
phone VARCHAR(20),
|
||||
email VARCHAR(100),
|
||||
id_card VARCHAR(18),
|
||||
-- 地址信息
|
||||
province VARCHAR(50),
|
||||
city VARCHAR(50),
|
||||
district VARCHAR(50),
|
||||
address VARCHAR(255),
|
||||
-- 身体指标
|
||||
height DECIMAL(5,2),
|
||||
weight DECIMAL(5,2),
|
||||
bmi DECIMAL(5,2),
|
||||
-- 健身信息
|
||||
registration_date DATE,
|
||||
card_type_id BIGINT,
|
||||
card_start_date DATE,
|
||||
card_end_date DATE,
|
||||
card_status VARCHAR(1) DEFAULT '0',
|
||||
remaining_times INTEGER,
|
||||
-- 教练信息
|
||||
coach_id BIGINT,
|
||||
-- 紧急联系人
|
||||
emergency_contact VARCHAR(100),
|
||||
emergency_phone VARCHAR(20),
|
||||
-- 备注与状态
|
||||
remark TEXT,
|
||||
status INTEGER DEFAULT 1,
|
||||
-- 来源信息
|
||||
source VARCHAR(50),
|
||||
-- 照片
|
||||
avatar_url VARCHAR(255),
|
||||
-- 审计字段
|
||||
create_by VARCHAR(50),
|
||||
update_by VARCHAR(50),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
-- 顾客签到记录表
|
||||
CREATE TABLE IF NOT EXISTS gym_check_in (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
member_id BIGINT NOT NULL,
|
||||
check_in_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
check_out_time TIMESTAMP,
|
||||
check_in_type VARCHAR(1) DEFAULT '1',
|
||||
card_id VARCHAR(50),
|
||||
device_info VARCHAR(255),
|
||||
create_by VARCHAR(50),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
-- 顾客体测记录表
|
||||
CREATE TABLE IF NOT EXISTS gym_body_measurement (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
member_id BIGINT NOT NULL,
|
||||
measure_date DATE NOT NULL,
|
||||
height DECIMAL(5,2),
|
||||
weight DECIMAL(5,2),
|
||||
bmi DECIMAL(5,2),
|
||||
body_fat_percentage DECIMAL(5,2),
|
||||
muscle_mass DECIMAL(5,2),
|
||||
body_water DECIMAL(5,2),
|
||||
bone_mass DECIMAL(5,2),
|
||||
visceral_fat_level INTEGER,
|
||||
basal_metabolism DECIMAL(6,2),
|
||||
waist_circumference DECIMAL(5,2),
|
||||
hip_circumference DECIMAL(5,2),
|
||||
chest_circumference DECIMAL(5,2),
|
||||
arm_circumference DECIMAL(5,2),
|
||||
thigh_circumference DECIMAL(5,2),
|
||||
systolic_blood_pressure INTEGER,
|
||||
diastolic_blood_pressure INTEGER,
|
||||
heart_rate INTEGER,
|
||||
remark TEXT,
|
||||
create_by VARCHAR(50),
|
||||
update_by VARCHAR(50),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
-- ============================================
|
||||
-- 表注释
|
||||
-- ============================================
|
||||
|
||||
COMMENT ON TABLE gym_membership_card_type IS '会员卡类型表';
|
||||
COMMENT ON COLUMN gym_membership_card_type.id IS '主键ID';
|
||||
COMMENT ON COLUMN gym_membership_card_type.card_type_name IS '卡类型名称(如年卡、季卡、次卡)';
|
||||
COMMENT ON COLUMN gym_membership_card_type.card_type_code IS '卡类型编码';
|
||||
COMMENT ON COLUMN gym_membership_card_type.duration_days IS '有效天数';
|
||||
COMMENT ON COLUMN gym_membership_card_type.price IS '价格';
|
||||
COMMENT ON COLUMN gym_membership_card_type.description IS '描述';
|
||||
COMMENT ON COLUMN gym_membership_card_type.sort IS '排序';
|
||||
COMMENT ON COLUMN gym_membership_card_type.status IS '状态(0正常 1停用)';
|
||||
|
||||
COMMENT ON TABLE gym_member IS '健身房顾客用户表';
|
||||
COMMENT ON COLUMN gym_member.id IS '主键ID';
|
||||
COMMENT ON COLUMN gym_member.member_no IS '会员编号(唯一)';
|
||||
COMMENT ON COLUMN gym_member.username IS '用户名(登录用)';
|
||||
COMMENT ON COLUMN gym_member.real_name IS '真实姓名';
|
||||
COMMENT ON COLUMN gym_member.gender IS '性别(0男 1女 2未知)';
|
||||
COMMENT ON COLUMN gym_member.birthday IS '出生日期';
|
||||
COMMENT ON COLUMN gym_member.phone IS '手机号码';
|
||||
COMMENT ON COLUMN gym_member.email IS '邮箱';
|
||||
COMMENT ON COLUMN gym_member.id_card IS '身份证号';
|
||||
COMMENT ON COLUMN gym_member.province IS '省份';
|
||||
COMMENT ON COLUMN gym_member.city IS '城市';
|
||||
COMMENT ON COLUMN gym_member.district IS '区县';
|
||||
COMMENT ON COLUMN gym_member.address IS '详细地址';
|
||||
COMMENT ON COLUMN gym_member.height IS '身高(cm)';
|
||||
COMMENT ON COLUMN gym_member.weight IS '体重(kg)';
|
||||
COMMENT ON COLUMN gym_member.bmi IS 'BMI指数';
|
||||
COMMENT ON COLUMN gym_member.registration_date IS '注册日期';
|
||||
COMMENT ON COLUMN gym_member.card_type_id IS '会员卡类型ID';
|
||||
COMMENT ON COLUMN gym_member.card_start_date IS '会员卡开始日期';
|
||||
COMMENT ON COLUMN gym_member.card_end_date IS '会员卡结束日期';
|
||||
COMMENT ON COLUMN gym_member.card_status IS '会员卡状态(0正常 1即将到期 2已过期 3冻结)';
|
||||
COMMENT ON COLUMN gym_member.remaining_times IS '剩余次数(次卡使用)';
|
||||
COMMENT ON COLUMN gym_member.coach_id IS '私教ID';
|
||||
COMMENT ON COLUMN gym_member.emergency_contact IS '紧急联系人';
|
||||
COMMENT ON COLUMN gym_member.emergency_phone IS '紧急联系电话';
|
||||
COMMENT ON COLUMN gym_member.remark IS '备注信息';
|
||||
COMMENT ON COLUMN gym_member.status IS '用户状态(0正常 1停用 2黑名单)';
|
||||
COMMENT ON COLUMN gym_member.source IS '客户来源(如地推、转介绍、线上广告等)';
|
||||
COMMENT ON COLUMN gym_member.avatar_url IS '头像URL';
|
||||
|
||||
COMMENT ON TABLE gym_check_in IS '顾客签到记录表';
|
||||
COMMENT ON COLUMN gym_check_in.id IS '主键ID';
|
||||
COMMENT ON COLUMN gym_check_in.member_id IS '会员ID';
|
||||
COMMENT ON COLUMN gym_check_in.check_in_time IS '签到时间';
|
||||
COMMENT ON COLUMN gym_check_in.check_out_time IS '签退时间';
|
||||
COMMENT ON COLUMN gym_check_in.check_in_type IS '签到类型(1刷卡 2扫码 3指纹 4人脸)';
|
||||
COMMENT ON COLUMN gym_check_in.card_id IS '刷卡卡号';
|
||||
COMMENT ON COLUMN gym_check_in.device_info IS '签到设备信息';
|
||||
|
||||
COMMENT ON TABLE gym_body_measurement IS '顾客体测记录表';
|
||||
COMMENT ON COLUMN gym_body_measurement.id IS '主键ID';
|
||||
COMMENT ON COLUMN gym_body_measurement.member_id IS '会员ID';
|
||||
COMMENT ON COLUMN gym_body_measurement.measure_date IS '测量日期';
|
||||
COMMENT ON COLUMN gym_body_measurement.height IS '身高(cm)';
|
||||
COMMENT ON COLUMN gym_body_measurement.weight IS '体重(kg)';
|
||||
COMMENT ON COLUMN gym_body_measurement.bmi IS 'BMI指数';
|
||||
COMMENT ON COLUMN gym_body_measurement.body_fat_percentage IS '体脂率(%)';
|
||||
COMMENT ON COLUMN gym_body_measurement.muscle_mass IS '肌肉量(kg)';
|
||||
COMMENT ON COLUMN gym_body_measurement.body_water IS '水分量(kg)';
|
||||
COMMENT ON COLUMN gym_body_measurement.bone_mass IS '骨量(kg)';
|
||||
COMMENT ON COLUMN gym_body_measurement.visceral_fat_level IS '内脏脂肪等级';
|
||||
COMMENT ON COLUMN gym_body_measurement.basal_metabolism IS '基础代谢(kcal)';
|
||||
COMMENT ON COLUMN gym_body_measurement.waist_circumference IS '腰围(cm)';
|
||||
COMMENT ON COLUMN gym_body_measurement.hip_circumference IS '臀围(cm)';
|
||||
COMMENT ON COLUMN gym_body_measurement.chest_circumference IS '胸围(cm)';
|
||||
COMMENT ON COLUMN gym_body_measurement.arm_circumference IS '臂围(cm)';
|
||||
COMMENT ON COLUMN gym_body_measurement.thigh_circumference IS '大腿围(cm)';
|
||||
COMMENT ON COLUMN gym_body_measurement.systolic_blood_pressure IS '收缩压(mmHg)';
|
||||
COMMENT ON COLUMN gym_body_measurement.diastolic_blood_pressure IS '舒张压(mmHg)';
|
||||
COMMENT ON COLUMN gym_body_measurement.heart_rate IS '心率(次/分)';
|
||||
COMMENT ON COLUMN gym_body_measurement.remark IS '备注';
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
-- 测试数据1: 进行中的瑜伽课程 (已有部分学员)
|
||||
INSERT INTO group_course (course_name, coach_id, course_type, start_time, end_time, max_members, current_members, status, location, cover_image, description, create_by, created_at, updated_at) VALUES
|
||||
('清晨流瑜伽', 101, 1, '2026-05-10 09:00:00', '2026-05-10 10:30:00', 15, 8, '1', 'A座3楼瑜伽教室', '/images/yoga_flow.jpg', '适合有一定基础的学员,通过流畅的体式连接呼吸,唤醒身体能量。', 'admin', '2026-05-01 10:00:00', '2026-05-01 10:00:00');
|
||||
|
||||
-- 测试数据2: 即将开始的搏击课 (几乎满员)
|
||||
INSERT INTO group_course (course_name, coach_id, course_type, start_time, end_time, max_members, current_members, status, location, cover_image, description, create_by, created_at, updated_at) VALUES
|
||||
('燃脂搏击', 102, 2, '2026-05-12 18:30:00', '2026-05-12 19:30:00', 20, 19, '1', '综合训练区', '/images/kickboxing.jpg', '高强度间歇训练,配合音乐快速燃脂,释放压力。', 'coach_zhang', '2026-05-02 14:30:00', '2026-05-02 14:30:00');
|
||||
|
||||
-- 测试数据3: 已结束的私教小团课 (课程号已满)
|
||||
INSERT INTO group_course (course_name, coach_id, course_type, start_time, end_time, max_members, current_members, status, location, cover_image, description, create_by, created_at, updated_at) VALUES
|
||||
('蜜桃臀塑造', 103, 3, '2026-04-25 19:00:00', '2026-04-25 20:00:00', 10, 10, '2', '私教专区', '/images/glute.jpg', '针对性训练臀部肌肉群,打造完美臀线。小班教学,动作一对一纠正。', 'coach_li', '2026-04-20 09:15:00', '2026-04-20 09:15:00');
|
||||
|
||||
-- 测试数据4: 即将开始的动感单车 (名额充足,尚未有人报名)
|
||||
INSERT INTO group_course (course_name, coach_id, course_type, start_time, end_time, max_members, current_members, status, location, cover_image, description, create_by, created_at, updated_at) VALUES
|
||||
('极速燃脂单车', 104, 2, '2026-05-15 19:30:00', '2026-05-15 20:20:00', 25, 0, '0', '单车房', '/images/spinning.jpg', '跟随音乐节奏变换阻力和速度,体验爬坡与冲刺的快感,一节课消耗800大卡。', 'admin', '2026-05-06 11:00:00', '2026-05-06 11:00:00');
|
||||
|
||||
-- 测试数据5: 已删除/作废的课程 (deleted_at 不为空)
|
||||
INSERT INTO group_course (course_name, coach_id, course_type, start_time, end_time, max_members, current_members, status, location, cover_image, description, create_by, created_at, updated_at, deleted_at) VALUES
|
||||
('周末冥想修复', 101, 1, '2026-05-03 15:00:00', '2026-05-03 16:00:00', 12, 3, '3', '冥想室', '/images/meditation.jpg', '通过呼吸和正念冥想,深度放松身心,缓解一周疲劳。', 'coach_wang', '2026-04-28 08:00:00', '2026-04-28 08:00:00', '2026-04-29 16:20:00');
|
||||
-108
@@ -1,108 +0,0 @@
|
||||
-- ============================================
|
||||
-- 健身房管理系统 - 测试数据
|
||||
-- ============================================
|
||||
|
||||
-- ============================================
|
||||
-- 会员卡类型数据
|
||||
-- ============================================
|
||||
INSERT INTO gym_membership_card_type (card_type_name, card_type_code, duration_days, price, description, sort, status, create_by, created_at, updated_at) VALUES
|
||||
('年卡', 'YEAR_CARD', 365, 2999.00, '一年有效期,不限次数', 1, 0, 'admin', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
('半年卡', 'HALF_YEAR_CARD', 180, 1699.00, '半年有效期,不限次数', 2, 0, 'admin', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
('季卡', 'QUARTER_CARD', 90, 999.00, '三个月有效期,不限次数', 3, 0, 'admin', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
('月卡', 'MONTH_CARD', 30, 399.00, '一个月有效期,不限次数', 4, 0, 'admin', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
('50次卡', 'TIMES_CARD_50', 180, 1580.00, '50次有效,半年内使用', 5, 0, 'admin', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
('30次卡', 'TIMES_CARD_30', 120, 1080.00, '30次有效,四个月内使用', 6, 0, 'admin', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
|
||||
('体验周卡', 'WEEK_TRIAL', 7, 99.00, '一周体验,不限次数', 7, 0, 'admin', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
|
||||
|
||||
-- ============================================
|
||||
-- 健身房顾客数据
|
||||
-- ============================================
|
||||
INSERT INTO gym_member (member_no, username, real_name, gender, birthday, phone, email, id_card, province, city, district, address, height, weight, bmi, registration_date, card_type_id, card_start_date, card_end_date, card_status, remaining_times, coach_id, emergency_contact, emergency_phone, remark, status, source, avatar_url, create_by, update_by, created_at, updated_at) VALUES
|
||||
-- 年卡用户
|
||||
('GM20240001', 'zhangsan', '张三', '0', '1995-03-15', '13800138001', 'zhangsan@email.com', '110101199503150011', '广东省', '深圳市', '南山区', '科技园南路88号创新大厦1206', 178.50, 75.00, 23.53, '2024-01-10', 1, '2024-01-10', '2025-01-09', '0', NULL, 1, '李四', '13900139001', '增肌目标,每周训练4次', 0, '线上广告', '/avatars/member_001.jpg', 'admin', 'admin', '2024-01-10 09:30:00', '2024-06-15 14:20:00'),
|
||||
('GM20240002', 'lisi', '李四', '0', '1992-08-22', '13800138002', 'lisi@email.com', '110101199208220012', '广东省', '深圳市', '福田区', '华强北路1002号赛格广场15层', 175.00, 82.00, 26.78, '2024-01-15', 1, '2024-01-15', '2025-01-14', '0', NULL, 1, '王五', '13900139002', '减脂增肌', 0, '朋友介绍', '/avatars/member_002.jpg', 'admin', 'admin', '2024-01-15 10:00:00', '2024-07-20 16:45:00'),
|
||||
('GM20240003', 'wangwu', '王五', '1', '1990-05-18', '13800138003', 'wangwu@email.com', '110101199005180013', '广东省', '深圳市', '罗湖区', '深南东路5002号地王大厦32层', 165.00, 55.00, 20.20, '2024-02-01', 1, '2024-02-01', '2025-01-31', '0', NULL, 2, '赵六', '13900139003', '塑形训练,瑜伽爱好者', 0, '线上广告', '/avatars/member_003.jpg', 'admin', 'admin', '2024-02-01 11:15:00', '2024-08-10 09:30:00'),
|
||||
|
||||
-- 半年卡用户
|
||||
('GM20240004', 'zhaoliu', '赵六', '0', '1998-12-05', '13800138004', 'zhaoliu@email.com', '110101199812050014', '广东省', '深圳市', '宝安区', '西乡街道宝源路108号', 182.00, 90.00, 27.17, '2024-03-10', 2, '2024-03-10', '2024-09-09', '0', NULL, 3, '张三', '13900139004', '增肌为主,目标体重95kg', 0, '地推', '/avatars/member_004.jpg', 'admin', 'admin', '2024-03-10 13:00:00', '2024-06-20 10:15:00'),
|
||||
('GM20240005', 'sunqi', '孙七', '1', '1996-06-28', '13800138005', 'sunqi@email.com', '110101199606280015', '广东省', '深圳市', '龙华区', '民治街道梅龙路258号', 162.00, 50.00, 19.05, '2024-03-15', 2, '2024-03-15', '2024-09-14', '0', NULL, 2, '周八', '13900139005', '减重目标,每月减2kg', 0, '转介绍', '/avatars/member_005.jpg', 'admin', 'admin', '2024-03-15 14:30:00', '2024-08-01 11:20:00'),
|
||||
|
||||
-- 季卡用户
|
||||
('GM20240006', 'zhouba', '周八', '0', '2000-01-20', '13800138006', 'zhouba@email.com', '110101200001200016', '广东省', '深圳市', '南山区', '粤海街道滨海大道33号', 176.00, 72.00, 23.24, '2024-04-01', 3, '2024-04-01', '2024-06-30', '0', NULL, 4, '吴九', '13900139006', '学生党,暑假密集训练', 0, '校园推广', '/avatars/member_006.jpg', 'admin', 'admin', '2024-04-01 09:00:00', '2024-05-18 16:30:00'),
|
||||
('GM20240007', 'wujiu', '吴九', '1', '1994-09-14', '13800138007', 'wujiu@email.com', '110101199409140017', '广东省', '深圳市', '龙岗区', '龙城街道龙翔大道666号', 168.00, 58.00, 20.55, '2024-04-10', 3, '2024-04-10', '2024-07-09', '2', NULL, NULL, '郑十', '13900139007', '季卡已过期,需要续费提醒', 0, '线上广告', '/avatars/member_007.jpg', 'admin', 'admin', '2024-04-10 10:45:00', '2024-07-15 08:00:00'),
|
||||
|
||||
-- 次卡用户
|
||||
('GM20240008', 'zhengshi', '郑十', '0', '1993-11-30', '13800138008', 'zhengshi@email.com', '110101199311300018', '广东省', '深圳市', '南山区', '蛇口街道工业八路156号', 180.00, 85.00, 26.23, '2024-05-01', 5, '2024-05-01', '2024-10-31', '0', 35, 3, '陈十一', '13900139008', '次卡用户,已使用15次', 0, '朋友介绍', '/avatars/member_008.jpg', 'admin', 'admin', '2024-05-01 15:00:00', '2024-06-28 12:45:00'),
|
||||
('GM20240009', 'chenyi', '陈十一', '1', '1997-07-08', '13800138009', 'chenyi@email.com', '110101199707080019', '广东省', '深圳市', '福田区', '莲花街道红荔路2008号', 163.00, 52.00, 19.57, '2024-05-20', 6, '2024-05-20', '2024-09-19', '0', 22, 4, '刘十二', '13900139009', '次卡用户,已使用8次', 0, '地推', '/avatars/member_009.jpg', 'admin', 'admin', '2024-05-20 11:30:00', '2024-07-01 17:00:00'),
|
||||
|
||||
-- 即将到期用户
|
||||
('GM20240010', 'liushier', '刘十二', '0', '1991-02-14', '13800138010', 'liushier@email.com', '110101199102140010', '广东省', '深圳市', '罗湖区', '翠竹街道太宁路99号', 174.00, 78.00, 25.76, '2024-01-05', 1, '2024-01-05', '2025-01-04', '1', NULL, 5, '马十三', '13900139010', '年卡即将到期,需要续费', 0, '转介绍', '/avatars/member_010.jpg', 'admin', 'admin', '2024-01-05 08:30:00', '2024-07-10 14:00:00'),
|
||||
|
||||
-- 体验用户
|
||||
('GM20240011', 'mashisan', '马十三', '0', '1999-04-25', '13800138011', 'mashisan@email.com', '110101199904250011', '广东省', '深圳市', '宝安区', '新安街道创业一路288号', 177.00, 70.00, 22.34, '2024-06-01', 7, '2024-06-01', '2024-06-07', '2', NULL, NULL, '张三', '13900139011', '体验卡已到期,潜在客户', 0, '线上广告', '/avatars/member_011.jpg', 'admin', 'admin', '2024-06-01 13:45:00', '2024-06-08 09:00:00'),
|
||||
|
||||
-- 冻结用户
|
||||
('GM20240012', 'yangshi', '杨十四', '1', '1988-10-10', '13800138012', 'yangshi@email.com', '110101198810100012', '广东省', '深圳市', '南山区', '前海路0199号', 166.00, 54.00, 19.59, '2024-02-20', 1, '2024-02-20', '2025-02-19', '3', NULL, 1, '黄十五', '13900139012', '因伤冻结3个月', 0, '朋友介绍', '/avatars/member_012.jpg', 'admin', 'admin', '2024-02-20 10:00:00', '2024-06-01 11:30:00'),
|
||||
|
||||
-- 黑名单用户
|
||||
('GM20240013', 'huangshiwu', '黄十五', '0', '1996-09-05', '13800138013', 'huangshiwu@email.com', '110101199609050013', '广东省', '深圳市', '龙华区', '大浪街道华旺路178号', 181.00, 95.00, 29.00, '2024-03-01', 2, '2024-03-01', '2024-08-31', '1', NULL, NULL, '林十六', '13900139013', '违规使用器械,已列入黑名单', 2, '地推', '/avatars/member_013.jpg', 'admin', 'admin', '2024-03-01 16:20:00', '2024-05-15 10:30:00');
|
||||
|
||||
-- ============================================
|
||||
-- 顾客签到记录数据
|
||||
-- ============================================
|
||||
INSERT INTO gym_check_in (member_id, check_in_time, check_out_time, check_in_type, card_id, device_info, create_by, created_at) VALUES
|
||||
-- 张三最近一周签到记录
|
||||
(1, '2024-07-15 08:10:00', '2024-07-15 10:00:00', '1', 'CARD001', '门禁设备01', 'system', '2024-07-15 08:10:00'),
|
||||
(1, '2024-07-16 08:15:00', '2024-07-16 09:45:00', '1', 'CARD001', '门禁设备01', 'system', '2024-07-16 08:15:00'),
|
||||
(1, '2024-07-17 18:30:00', '2024-07-17 20:30:00', '1', 'CARD001', '门禁设备02', 'system', '2024-07-17 18:30:00'),
|
||||
(1, '2024-07-18 08:05:00', '2024-07-18 10:15:00', '2', 'CARD001', '扫码设备03', 'system', '2024-07-18 08:05:00'),
|
||||
(1, '2024-07-21 09:00:00', '2024-07-21 11:00:00', '1', 'CARD001', '门禁设备01', 'system', '2024-07-21 09:00:00'),
|
||||
|
||||
-- 李四签到记录
|
||||
(2, '2024-07-15 07:00:00', '2024-07-15 08:30:00', '1', 'CARD002', '门禁设备01', 'system', '2024-07-15 07:00:00'),
|
||||
(2, '2024-07-16 07:15:00', '2024-07-16 09:00:00', '1', 'CARD002', '门禁设备01', 'system', '2024-07-16 07:15:00'),
|
||||
(2, '2024-07-17 17:00:00', '2024-07-17 19:00:00', '1', 'CARD002', '门禁设备02', 'system', '2024-07-17 17:00:00'),
|
||||
|
||||
-- 王五签到记录
|
||||
(3, '2024-07-15 09:30:00', '2024-07-15 11:00:00', '1', 'CARD003', '门禁设备01', 'system', '2024-07-15 09:30:00'),
|
||||
(3, '2024-07-17 10:00:00', '2024-07-17 11:30:00', '3', 'FP003', '指纹设备04', 'system', '2024-07-17 10:00:00'),
|
||||
(3, '2024-07-19 14:00:00', '2024-07-19 16:00:00', '1', 'CARD003', '门禁设备01', 'system', '2024-07-19 14:00:00'),
|
||||
|
||||
-- 赵六签到记录
|
||||
(4, '2024-07-16 06:30:00', '2024-07-16 08:30:00', '1', 'CARD004', '门禁设备01', 'system', '2024-07-16 06:30:00'),
|
||||
(4, '2024-07-17 06:45:00', '2024-07-17 08:45:00', '1', 'CARD004', '门禁设备01', 'system', '2024-07-17 06:45:00'),
|
||||
(4, '2024-07-19 07:00:00', '2024-07-19 09:00:00', '4', 'FACE_004', '人脸识别05', 'system', '2024-07-19 07:00:00'),
|
||||
|
||||
-- 郑十(次卡用户)签到记录
|
||||
(8, '2024-07-16 16:00:00', '2024-07-16 18:00:00', '1', 'CARD008', '门禁设备02', 'system', '2024-07-16 16:00:00'),
|
||||
(8, '2024-07-19 16:30:00', '2024-07-19 18:30:00', '1', 'CARD008', '门禁设备02', 'system', '2024-07-19 16:30:00');
|
||||
|
||||
-- ============================================
|
||||
-- 顾客体测记录数据
|
||||
-- ============================================
|
||||
INSERT INTO gym_body_measurement (member_id, measure_date, height, weight, bmi, body_fat_percentage, muscle_mass, body_water, bone_mass, visceral_fat_level, basal_metabolism, waist_circumference, hip_circumference, chest_circumference, arm_circumference, thigh_circumference, systolic_blood_pressure, diastolic_blood_pressure, heart_rate, remark, create_by, created_at, updated_at) VALUES
|
||||
-- 张三体测记录(3次)
|
||||
(1, '2024-01-10', 178.50, 85.00, 26.67, 25.00, 60.50, 42.00, 3.80, 10, 1780.00, 92.00, 100.00, 98.00, 32.00, 55.00, 135, 85, 72, '初次体测,体脂偏高', 'coach_001', '2024-01-10 10:00:00', '2024-01-10 10:00:00'),
|
||||
(1, '2024-04-10', 178.50, 80.00, 25.10, 22.00, 62.00, 43.50, 3.85, 9, 1750.00, 88.00, 98.00, 100.00, 34.00, 56.00, 130, 82, 70, '三个月训练,体重下降5kg', 'coach_001', '2024-04-10 10:30:00', '2024-04-10 10:30:00'),
|
||||
(1, '2024-07-10', 178.50, 75.00, 23.53, 18.50, 64.00, 45.00, 3.90, 7, 1720.00, 83.00, 96.00, 102.00, 35.50, 57.00, 125, 80, 68, '目标达成!体脂降至18.5%', 'coach_001', '2024-07-10 09:00:00', '2024-07-10 09:00:00'),
|
||||
|
||||
-- 李四体测记录
|
||||
(2, '2024-01-15', 175.00, 88.00, 28.73, 28.00, 60.00, 41.00, 3.75, 12, 1820.00, 95.00, 102.00, 100.00, 33.00, 58.00, 140, 90, 75, '初次体测,需重点减脂', 'coach_001', '2024-01-15 10:00:00', '2024-01-15 10:00:00'),
|
||||
(2, '2024-07-15', 175.00, 82.00, 26.78, 23.00, 63.00, 43.80, 3.82, 9, 1780.00, 88.00, 100.00, 103.00, 35.00, 57.00, 132, 84, 72, '减脂效果明显,继续加油', 'coach_001', '2024-07-15 08:00:00', '2024-07-15 08:00:00'),
|
||||
|
||||
-- 王五体测记录
|
||||
(3, '2024-02-01', 165.00, 58.00, 21.30, 25.00, 41.00, 32.00, 2.80, 5, 1280.00, 72.00, 90.00, 88.00, 26.00, 50.00, 118, 75, 68, '基础体重偏低,增肌为主', 'coach_002', '2024-02-01 11:00:00', '2024-02-01 11:00:00'),
|
||||
(3, '2024-05-01', 165.00, 56.00, 20.57, 23.00, 42.00, 33.00, 2.85, 4, 1300.00, 70.00, 89.00, 90.00, 27.00, 51.00, 120, 78, 65, '瑜伽训练效果良好', 'coach_002', '2024-05-01 14:00:00', '2024-05-01 14:00:00'),
|
||||
(3, '2024-07-21', 165.00, 55.00, 20.20, 21.50, 43.00, 34.00, 2.90, 3, 1310.00, 68.00, 88.00, 91.00, 28.00, 52.00, 115, 72, 66, '体态明显改善', 'coach_002', '2024-07-21 10:30:00', '2024-07-21 10:30:00'),
|
||||
|
||||
-- 赵六体测记录
|
||||
(4, '2024-03-10', 182.00, 95.00, 28.68, 29.00, 64.00, 43.00, 4.10, 14, 1900.00, 98.00, 105.00, 105.00, 36.00, 62.00, 145, 92, 78, '体重超标,需严格控食', 'coach_003', '2024-03-10 13:00:00', '2024-03-10 13:00:00'),
|
||||
(4, '2024-06-25', 182.00, 90.00, 27.17, 26.00, 66.00, 45.00, 4.15, 11, 1850.00, 94.00, 103.00, 107.00, 37.00, 60.00, 140, 88, 74, '减重5kg,继续增肌', 'coach_003', '2024-06-25 16:00:00', '2024-06-25 16:00:00'),
|
||||
|
||||
-- 孙七体测记录
|
||||
(5, '2024-03-15', 162.00, 52.00, 19.81, 26.00, 38.00, 30.00, 2.60, 5, 1220.00, 74.00, 88.00, 85.00, 25.00, 48.00, 125, 80, 72, '有氧训练为主', 'coach_002', '2024-03-15 14:30:00', '2024-03-15 14:30:00'),
|
||||
(5, '2024-06-15', 162.00, 50.00, 19.05, 24.00, 39.00, 31.00, 2.65, 4, 1230.00, 71.00, 87.00, 86.00, 26.00, 49.00, 122, 78, 70, '体脂率下降2%', 'coach_002', '2024-06-15 10:00:00', '2024-06-15 10:00:00'),
|
||||
|
||||
-- 郑十体测记录
|
||||
(8, '2024-05-01', 180.00, 88.00, 27.16, 27.00, 61.00, 42.00, 3.95, 11, 1820.00, 94.00, 102.00, 102.00, 35.00, 59.00, 138, 86, 76, '初次体测', 'coach_003', '2024-05-01 15:00:00', '2024-05-01 15:00:00'),
|
||||
(8, '2024-07-01', 180.00, 85.00, 26.23, 25.50, 62.50, 43.00, 4.00, 10, 1800.00, 91.00, 101.00, 103.00, 35.50, 58.00, 135, 84, 74, '两个月训练,减重3kg', 'coach_003', '2024-07-01 16:30:00', '2024-07-01 16:30:00');
|
||||
+3
-2
@@ -50,8 +50,9 @@ public class SecurityConfig {
|
||||
spec.pathMatchers("/api/auth/**").permitAll()
|
||||
.pathMatchers("/api/public/**").permitAll()
|
||||
.pathMatchers("/ws/**").permitAll()
|
||||
.pathMatchers("/api/gymMember/**").permitAll()
|
||||
.pathMatchers("/actuator/**").permitAll();
|
||||
.pathMatchers("/actuator/**").permitAll()
|
||||
.pathMatchers("/api/groupCourse/**").permitAll();
|
||||
|
||||
|
||||
if (isDevOrTest) {
|
||||
spec.pathMatchers("/swagger-ui.html").permitAll()
|
||||
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
package cn.novalon.gym.manage.sys.core.command;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public record UpdateGymMemberCommand(
|
||||
Long id,
|
||||
String username,
|
||||
String email,
|
||||
Long gender,
|
||||
LocalDateTime birthday,
|
||||
String province,
|
||||
String city,
|
||||
String district,
|
||||
String address,
|
||||
String emergency_contact,
|
||||
String emergency_phone,
|
||||
String avatar_url,
|
||||
String remark
|
||||
) {
|
||||
public static UpdateGymMemberCommand of(
|
||||
Long id,
|
||||
String username,
|
||||
String email,
|
||||
Long gender,
|
||||
LocalDateTime birthday,
|
||||
String province,
|
||||
String city,
|
||||
String district,
|
||||
String address,
|
||||
String emergency_contact,
|
||||
String emergency_phone,
|
||||
String avatar_url,
|
||||
String remark
|
||||
){
|
||||
return new UpdateGymMemberCommand(id, username, email, gender, birthday, province, city, district, address, emergency_contact, emergency_phone, avatar_url, remark);
|
||||
}
|
||||
}
|
||||
-235
@@ -1,235 +0,0 @@
|
||||
package cn.novalon.gym.manage.sys.core.domain;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 顾客体测记录领域对象
|
||||
*
|
||||
* @author 黎文涛
|
||||
* @date 2026-05-04
|
||||
*/
|
||||
@Schema(description = "顾客体测记录实体")
|
||||
public class GymBodyMeasurement extends BaseDomain {
|
||||
|
||||
@Schema(description = "会员ID", example = "1")
|
||||
private Long memberId;
|
||||
|
||||
@Schema(description = "测量日期", example = "2024-01-15")
|
||||
private LocalDate measureDate;
|
||||
|
||||
@Schema(description = "身高(cm)", example = "175.00")
|
||||
private BigDecimal height;
|
||||
|
||||
@Schema(description = "体重(kg)", example = "70.00")
|
||||
private BigDecimal weight;
|
||||
|
||||
@Schema(description = "BMI指数", example = "22.86")
|
||||
private BigDecimal bmi;
|
||||
|
||||
@Schema(description = "体脂率(%)", example = "18.50")
|
||||
private BigDecimal bodyFatPercentage;
|
||||
|
||||
@Schema(description = "肌肉量(kg)", example = "45.00")
|
||||
private BigDecimal muscleMass;
|
||||
|
||||
@Schema(description = "水分量(kg)", example = "42.00")
|
||||
private BigDecimal bodyWater;
|
||||
|
||||
@Schema(description = "骨量(kg)", example = "3.50")
|
||||
private BigDecimal boneMass;
|
||||
|
||||
@Schema(description = "内脏脂肪等级", example = "3")
|
||||
private Integer visceralFatLevel;
|
||||
|
||||
@Schema(description = "基础代谢(kcal)", example = "1500.00")
|
||||
private BigDecimal basalMetabolism;
|
||||
|
||||
@Schema(description = "腰围(cm)", example = "80.00")
|
||||
private BigDecimal waistCircumference;
|
||||
|
||||
@Schema(description = "臀围(cm)", example = "90.00")
|
||||
private BigDecimal hipCircumference;
|
||||
|
||||
@Schema(description = "胸围(cm)", example = "95.00")
|
||||
private BigDecimal chestCircumference;
|
||||
|
||||
@Schema(description = "臂围(cm)", example = "35.00")
|
||||
private BigDecimal armCircumference;
|
||||
|
||||
@Schema(description = "大腿围(cm)", example = "55.00")
|
||||
private BigDecimal thighCircumference;
|
||||
|
||||
@Schema(description = "收缩压(mmHg)", example = "120")
|
||||
private Integer systolicBloodPressure;
|
||||
|
||||
@Schema(description = "舒张压(mmHg)", example = "80")
|
||||
private Integer diastolicBloodPressure;
|
||||
|
||||
@Schema(description = "心率(次/分)", example = "72")
|
||||
private Integer heartRate;
|
||||
|
||||
@Schema(description = "备注", example = "无")
|
||||
private String remark;
|
||||
|
||||
public Long getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public void setMemberId(Long memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public LocalDate getMeasureDate() {
|
||||
return measureDate;
|
||||
}
|
||||
|
||||
public void setMeasureDate(LocalDate measureDate) {
|
||||
this.measureDate = measureDate;
|
||||
}
|
||||
|
||||
public BigDecimal getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(BigDecimal height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public BigDecimal getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(BigDecimal weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public BigDecimal getBmi() {
|
||||
return bmi;
|
||||
}
|
||||
|
||||
public void setBmi(BigDecimal bmi) {
|
||||
this.bmi = bmi;
|
||||
}
|
||||
|
||||
public BigDecimal getBodyFatPercentage() {
|
||||
return bodyFatPercentage;
|
||||
}
|
||||
|
||||
public void setBodyFatPercentage(BigDecimal bodyFatPercentage) {
|
||||
this.bodyFatPercentage = bodyFatPercentage;
|
||||
}
|
||||
|
||||
public BigDecimal getMuscleMass() {
|
||||
return muscleMass;
|
||||
}
|
||||
|
||||
public void setMuscleMass(BigDecimal muscleMass) {
|
||||
this.muscleMass = muscleMass;
|
||||
}
|
||||
|
||||
public BigDecimal getBodyWater() {
|
||||
return bodyWater;
|
||||
}
|
||||
|
||||
public void setBodyWater(BigDecimal bodyWater) {
|
||||
this.bodyWater = bodyWater;
|
||||
}
|
||||
|
||||
public BigDecimal getBoneMass() {
|
||||
return boneMass;
|
||||
}
|
||||
|
||||
public void setBoneMass(BigDecimal boneMass) {
|
||||
this.boneMass = boneMass;
|
||||
}
|
||||
|
||||
public Integer getVisceralFatLevel() {
|
||||
return visceralFatLevel;
|
||||
}
|
||||
|
||||
public void setVisceralFatLevel(Integer visceralFatLevel) {
|
||||
this.visceralFatLevel = visceralFatLevel;
|
||||
}
|
||||
|
||||
public BigDecimal getBasalMetabolism() {
|
||||
return basalMetabolism;
|
||||
}
|
||||
|
||||
public void setBasalMetabolism(BigDecimal basalMetabolism) {
|
||||
this.basalMetabolism = basalMetabolism;
|
||||
}
|
||||
|
||||
public BigDecimal getWaistCircumference() {
|
||||
return waistCircumference;
|
||||
}
|
||||
|
||||
public void setWaistCircumference(BigDecimal waistCircumference) {
|
||||
this.waistCircumference = waistCircumference;
|
||||
}
|
||||
|
||||
public BigDecimal getHipCircumference() {
|
||||
return hipCircumference;
|
||||
}
|
||||
|
||||
public void setHipCircumference(BigDecimal hipCircumference) {
|
||||
this.hipCircumference = hipCircumference;
|
||||
}
|
||||
|
||||
public BigDecimal getChestCircumference() {
|
||||
return chestCircumference;
|
||||
}
|
||||
|
||||
public void setChestCircumference(BigDecimal chestCircumference) {
|
||||
this.chestCircumference = chestCircumference;
|
||||
}
|
||||
|
||||
public BigDecimal getArmCircumference() {
|
||||
return armCircumference;
|
||||
}
|
||||
|
||||
public void setArmCircumference(BigDecimal armCircumference) {
|
||||
this.armCircumference = armCircumference;
|
||||
}
|
||||
|
||||
public BigDecimal getThighCircumference() {
|
||||
return thighCircumference;
|
||||
}
|
||||
|
||||
public void setThighCircumference(BigDecimal thighCircumference) {
|
||||
this.thighCircumference = thighCircumference;
|
||||
}
|
||||
|
||||
public Integer getSystolicBloodPressure() {
|
||||
return systolicBloodPressure;
|
||||
}
|
||||
|
||||
public void setSystolicBloodPressure(Integer systolicBloodPressure) {
|
||||
this.systolicBloodPressure = systolicBloodPressure;
|
||||
}
|
||||
|
||||
public Integer getDiastolicBloodPressure() {
|
||||
return diastolicBloodPressure;
|
||||
}
|
||||
|
||||
public void setDiastolicBloodPressure(Integer diastolicBloodPressure) {
|
||||
this.diastolicBloodPressure = diastolicBloodPressure;
|
||||
}
|
||||
|
||||
public Integer getHeartRate() {
|
||||
return heartRate;
|
||||
}
|
||||
|
||||
public void setHeartRate(Integer heartRate) {
|
||||
this.heartRate = heartRate;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
-80
@@ -1,80 +0,0 @@
|
||||
package cn.novalon.gym.manage.sys.core.domain;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 顾客签到记录领域对象
|
||||
*
|
||||
* @author 黎文涛
|
||||
* @date 2026-05-04
|
||||
*/
|
||||
@Schema(description = "顾客签到记录实体")
|
||||
public class GymCheckIn extends BaseDomain {
|
||||
|
||||
@Schema(description = "会员ID", example = "1")
|
||||
private Long memberId;
|
||||
|
||||
@Schema(description = "签到时间", example = "2024-01-15 08:30:00")
|
||||
private LocalDateTime checkInTime;
|
||||
|
||||
@Schema(description = "签退时间", example = "2024-01-15 10:30:00")
|
||||
private LocalDateTime checkOutTime;
|
||||
|
||||
@Schema(description = "签到类型(1刷卡 2扫码 3指纹 4人脸)", example = "1")
|
||||
private String checkInType;
|
||||
|
||||
@Schema(description = "刷卡卡号", example = "CARD0001")
|
||||
private String cardId;
|
||||
|
||||
@Schema(description = "签到设备信息", example = "设备A-001")
|
||||
private String deviceInfo;
|
||||
|
||||
public Long getMemberId() {
|
||||
return memberId;
|
||||
}
|
||||
|
||||
public void setMemberId(Long memberId) {
|
||||
this.memberId = memberId;
|
||||
}
|
||||
|
||||
public LocalDateTime getCheckInTime() {
|
||||
return checkInTime;
|
||||
}
|
||||
|
||||
public void setCheckInTime(LocalDateTime checkInTime) {
|
||||
this.checkInTime = checkInTime;
|
||||
}
|
||||
|
||||
public LocalDateTime getCheckOutTime() {
|
||||
return checkOutTime;
|
||||
}
|
||||
|
||||
public void setCheckOutTime(LocalDateTime checkOutTime) {
|
||||
this.checkOutTime = checkOutTime;
|
||||
}
|
||||
|
||||
public String getCheckInType() {
|
||||
return checkInType;
|
||||
}
|
||||
|
||||
public void setCheckInType(String checkInType) {
|
||||
this.checkInType = checkInType;
|
||||
}
|
||||
|
||||
public String getCardId() {
|
||||
return cardId;
|
||||
}
|
||||
|
||||
public void setCardId(String cardId) {
|
||||
this.cardId = cardId;
|
||||
}
|
||||
|
||||
public String getDeviceInfo() {
|
||||
return deviceInfo;
|
||||
}
|
||||
|
||||
public void setDeviceInfo(String deviceInfo) {
|
||||
this.deviceInfo = deviceInfo;
|
||||
}
|
||||
}
|
||||
-324
@@ -1,324 +0,0 @@
|
||||
package cn.novalon.gym.manage.sys.core.domain;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 健身房顾客用户领域对象
|
||||
*
|
||||
* @author 黎文涛
|
||||
* @date 2026-05-04
|
||||
*/
|
||||
@Schema(description = "健身房顾客用户实体")
|
||||
public class GymMember extends BaseDomain {
|
||||
|
||||
@Schema(description = "会员编号(唯一)", example = "MEM0001")
|
||||
private String memberNo;
|
||||
|
||||
@Schema(description = "用户名(登录用)", example = "zhangsan")
|
||||
private String username;
|
||||
|
||||
@Schema(description = "真实姓名", example = "张三")
|
||||
private String realName;
|
||||
|
||||
@Schema(description = "性别(0男 1女 2未知)", example = "0")
|
||||
private Long gender;
|
||||
|
||||
@Schema(description = "出生日期", example = "1990-01-01")
|
||||
private LocalDateTime birthday;
|
||||
|
||||
@Schema(description = "手机号码", example = "13800138000")
|
||||
private String phone;
|
||||
|
||||
@Schema(description = "邮箱", example = "zhangsan@example.com")
|
||||
private String email;
|
||||
|
||||
@Schema(description = "身份证号", example = "110101199001011234")
|
||||
private String idCard;
|
||||
|
||||
@Schema(description = "省份", example = "广东省")
|
||||
private String province;
|
||||
|
||||
@Schema(description = "城市", example = "深圳市")
|
||||
private String city;
|
||||
|
||||
@Schema(description = "区县", example = "南山区")
|
||||
private String district;
|
||||
|
||||
@Schema(description = "详细地址", example = "科技园路88号")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "身高(cm)", example = "175.00")
|
||||
private BigDecimal height;
|
||||
|
||||
@Schema(description = "体重(kg)", example = "70.00")
|
||||
private BigDecimal weight;
|
||||
|
||||
@Schema(description = "BMI指数", example = "22.86")
|
||||
private BigDecimal bmi;
|
||||
|
||||
@Schema(description = "注册日期", example = "2024-01-15")
|
||||
private LocalDate registrationDate;
|
||||
|
||||
@Schema(description = "会员卡类型ID", example = "1")
|
||||
private Long cardTypeId;
|
||||
|
||||
@Schema(description = "会员卡开始日期", example = "2024-01-15")
|
||||
private LocalDate cardStartDate;
|
||||
|
||||
@Schema(description = "会员卡结束日期", example = "2025-01-14")
|
||||
private LocalDate cardEndDate;
|
||||
|
||||
@Schema(description = "会员卡状态(0正常 1即将到期 2已过期 3冻结)", example = "0")
|
||||
private String cardStatus;
|
||||
|
||||
@Schema(description = "剩余次数(次卡使用)", example = "10")
|
||||
private Integer remainingTimes;
|
||||
|
||||
@Schema(description = "私教ID", example = "1")
|
||||
private Long coachId;
|
||||
|
||||
@Schema(description = "紧急联系人", example = "李四")
|
||||
private String emergencyContact;
|
||||
|
||||
@Schema(description = "紧急联系电话", example = "13900139000")
|
||||
private String emergencyPhone;
|
||||
|
||||
@Schema(description = "备注信息", example = "无")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "用户状态(0正常 1停用 2黑名单)", example = "0")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "客户来源(如地推、转介绍、线上广告等)", example = "地推")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "头像URL", example = "https://example.com/avatar.jpg")
|
||||
private String avatarUrl;
|
||||
|
||||
public String getMemberNo() {
|
||||
return memberNo;
|
||||
}
|
||||
|
||||
public void setMemberNo(String memberNo) {
|
||||
this.memberNo = memberNo;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getRealName() {
|
||||
return realName;
|
||||
}
|
||||
|
||||
public void setRealName(String realName) {
|
||||
this.realName = realName;
|
||||
}
|
||||
|
||||
public Long getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(Long gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public LocalDateTime getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setBirthday(LocalDateTime birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getIdCard() {
|
||||
return idCard;
|
||||
}
|
||||
|
||||
public void setIdCard(String idCard) {
|
||||
this.idCard = idCard;
|
||||
}
|
||||
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public BigDecimal getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(BigDecimal height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public BigDecimal getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(BigDecimal weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public BigDecimal getBmi() {
|
||||
return bmi;
|
||||
}
|
||||
|
||||
public void setBmi(BigDecimal bmi) {
|
||||
this.bmi = bmi;
|
||||
}
|
||||
|
||||
public LocalDate getRegistrationDate() {
|
||||
return registrationDate;
|
||||
}
|
||||
|
||||
public void setRegistrationDate(LocalDate registrationDate) {
|
||||
this.registrationDate = registrationDate;
|
||||
}
|
||||
|
||||
public Long getCardTypeId() {
|
||||
return cardTypeId;
|
||||
}
|
||||
|
||||
public void setCardTypeId(Long cardTypeId) {
|
||||
this.cardTypeId = cardTypeId;
|
||||
}
|
||||
|
||||
public LocalDate getCardStartDate() {
|
||||
return cardStartDate;
|
||||
}
|
||||
|
||||
public void setCardStartDate(LocalDate cardStartDate) {
|
||||
this.cardStartDate = cardStartDate;
|
||||
}
|
||||
|
||||
public LocalDate getCardEndDate() {
|
||||
return cardEndDate;
|
||||
}
|
||||
|
||||
public void setCardEndDate(LocalDate cardEndDate) {
|
||||
this.cardEndDate = cardEndDate;
|
||||
}
|
||||
|
||||
public String getCardStatus() {
|
||||
return cardStatus;
|
||||
}
|
||||
|
||||
public void setCardStatus(String cardStatus) {
|
||||
this.cardStatus = cardStatus;
|
||||
}
|
||||
|
||||
public Integer getRemainingTimes() {
|
||||
return remainingTimes;
|
||||
}
|
||||
|
||||
public void setRemainingTimes(Integer remainingTimes) {
|
||||
this.remainingTimes = remainingTimes;
|
||||
}
|
||||
|
||||
public Long getCoachId() {
|
||||
return coachId;
|
||||
}
|
||||
|
||||
public void setCoachId(Long coachId) {
|
||||
this.coachId = coachId;
|
||||
}
|
||||
|
||||
public String getEmergencyContact() {
|
||||
return emergencyContact;
|
||||
}
|
||||
|
||||
public void setEmergencyContact(String emergencyContact) {
|
||||
this.emergencyContact = emergencyContact;
|
||||
}
|
||||
|
||||
public String getEmergencyPhone() {
|
||||
return emergencyPhone;
|
||||
}
|
||||
|
||||
public void setEmergencyPhone(String emergencyPhone) {
|
||||
this.emergencyPhone = emergencyPhone;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public String getAvatarUrl() {
|
||||
return avatarUrl;
|
||||
}
|
||||
|
||||
public void setAvatarUrl(String avatarUrl) {
|
||||
this.avatarUrl = avatarUrl;
|
||||
}
|
||||
}
|
||||
-91
@@ -1,91 +0,0 @@
|
||||
package cn.novalon.gym.manage.sys.core.domain;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 会员卡类型领域对象
|
||||
*
|
||||
* @author 黎文涛
|
||||
* @date 2026-05-04
|
||||
*/
|
||||
@Schema(description = "会员卡类型实体")
|
||||
public class GymMembershipCardType extends BaseDomain {
|
||||
|
||||
@Schema(description = "卡类型名称(如年卡、季卡、次卡)", example = "年卡")
|
||||
private String cardTypeName;
|
||||
|
||||
@Schema(description = "卡类型编码", example = "YEAR_CARD")
|
||||
private String cardTypeCode;
|
||||
|
||||
@Schema(description = "有效天数", example = "365")
|
||||
private Integer durationDays;
|
||||
|
||||
@Schema(description = "价格", example = "1999.00")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "描述", example = "全年不限次数")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "排序", example = "1")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "状态(0正常 1停用)", example = "0")
|
||||
private Integer status;
|
||||
|
||||
public String getCardTypeName() {
|
||||
return cardTypeName;
|
||||
}
|
||||
|
||||
public void setCardTypeName(String cardTypeName) {
|
||||
this.cardTypeName = cardTypeName;
|
||||
}
|
||||
|
||||
public String getCardTypeCode() {
|
||||
return cardTypeCode;
|
||||
}
|
||||
|
||||
public void setCardTypeCode(String cardTypeCode) {
|
||||
this.cardTypeCode = cardTypeCode;
|
||||
}
|
||||
|
||||
public Integer getDurationDays() {
|
||||
return durationDays;
|
||||
}
|
||||
|
||||
public void setDurationDays(Integer durationDays) {
|
||||
this.durationDays = durationDays;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(BigDecimal price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Integer getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public void setSort(Integer sort) {
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package cn.novalon.gym.manage.sys.core.repository;
|
||||
|
||||
import cn.novalon.gym.manage.sys.core.domain.GymMember;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
public interface IGymMemberRepository {
|
||||
Mono<GymMember> findById(Long id);
|
||||
Mono<GymMember> update(GymMember gymMember);
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
package cn.novalon.gym.manage.sys.core.service;
|
||||
|
||||
import cn.novalon.gym.manage.sys.core.command.UpdateGymMemberCommand;
|
||||
import cn.novalon.gym.manage.sys.core.domain.GymMember;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
public interface IGymMemberService {
|
||||
Mono<GymMember> findById(Long id);
|
||||
Mono<GymMember> updateMember(GymMember gymMember);
|
||||
Mono<GymMember> updateMember(UpdateGymMemberCommand updateGymMemberCommand);
|
||||
}
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
package cn.novalon.gym.manage.sys.core.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.novalon.gym.manage.sys.audit.AuditLogHelper;
|
||||
import cn.novalon.gym.manage.sys.audit.service.IAuditLogService;
|
||||
import cn.novalon.gym.manage.sys.core.command.UpdateGymMemberCommand;
|
||||
import cn.novalon.gym.manage.sys.core.domain.GymMember;
|
||||
import cn.novalon.gym.manage.sys.core.repository.IGymMemberRepository;
|
||||
import cn.novalon.gym.manage.sys.core.service.IGymMemberService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author:liwentao
|
||||
* @date:2026/5/4-05-04-10:27
|
||||
*/
|
||||
@Service
|
||||
public class GymMemberService implements IGymMemberService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(SysUserService.class);
|
||||
private final IGymMemberRepository gymMemberRepository;
|
||||
private final PasswordEncoder passwordEncoder;
|
||||
private final IAuditLogService auditLogService;
|
||||
|
||||
public GymMemberService(
|
||||
IGymMemberRepository gymMemberRepository,
|
||||
@Qualifier("passwordEncoder") PasswordEncoder passwordEncoder,
|
||||
@Lazy IAuditLogService auditLogService){
|
||||
this.gymMemberRepository = gymMemberRepository;
|
||||
this.passwordEncoder = passwordEncoder;
|
||||
this.auditLogService = auditLogService;
|
||||
}
|
||||
@Override
|
||||
public Mono<GymMember> findById(Long id) {
|
||||
return gymMemberRepository.findById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<GymMember> updateMember(GymMember gymMember) {
|
||||
gymMember.setUpdatedAt(LocalDateTime.now());
|
||||
return gymMemberRepository.findById(gymMember.getId())
|
||||
.flatMap(before -> gymMemberRepository.update(gymMember)
|
||||
.flatMap(saved-> AuditLogHelper.record(auditLogService,"GymMember",saved.getId(),"UPDATE",before,saved)
|
||||
.thenReturn(saved)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<GymMember> updateMember(UpdateGymMemberCommand updateGymMemberCommand) {
|
||||
return gymMemberRepository.findById(updateGymMemberCommand.id())
|
||||
.switchIfEmpty(Mono.error(new RuntimeException("User not found")))
|
||||
.flatMap( gymMember -> {
|
||||
GymMember member = new GymMember();
|
||||
BeanUtil.copyProperties(gymMember,member);
|
||||
if(updateGymMemberCommand.username() != null){
|
||||
gymMember.setUsername(updateGymMemberCommand.username());
|
||||
}
|
||||
if(updateGymMemberCommand.email() != null){
|
||||
gymMember.setEmail(updateGymMemberCommand.email());
|
||||
}
|
||||
if(updateGymMemberCommand.gender() != null){
|
||||
gymMember.setGender(updateGymMemberCommand.gender());
|
||||
}
|
||||
if(updateGymMemberCommand.birthday() != null){
|
||||
gymMember.setBirthday(updateGymMemberCommand.birthday());
|
||||
}
|
||||
if(updateGymMemberCommand.province() != null){
|
||||
gymMember.setProvince(updateGymMemberCommand.province());
|
||||
}
|
||||
if(updateGymMemberCommand.city() != null){
|
||||
gymMember.setCity(updateGymMemberCommand.city());
|
||||
}
|
||||
if(updateGymMemberCommand.district() != null){
|
||||
gymMember.setDistrict(updateGymMemberCommand.district());
|
||||
}
|
||||
if(updateGymMemberCommand.address() != null){
|
||||
gymMember.setAddress(updateGymMemberCommand.address());
|
||||
}
|
||||
if(updateGymMemberCommand.emergency_contact() != null){
|
||||
gymMember.setEmergencyContact(updateGymMemberCommand.emergency_contact());
|
||||
}
|
||||
if(updateGymMemberCommand.emergency_phone() != null){
|
||||
gymMember.setEmergencyPhone(updateGymMemberCommand.emergency_phone());
|
||||
}
|
||||
if(updateGymMemberCommand.avatar_url() != null){
|
||||
gymMember.setAvatarUrl(updateGymMemberCommand.avatar_url());
|
||||
}
|
||||
if(updateGymMemberCommand.remark() != null){
|
||||
gymMember.setRemark(updateGymMemberCommand.remark());
|
||||
}
|
||||
gymMember.setUpdatedAt(LocalDateTime.now());
|
||||
return gymMemberRepository.update(gymMember)
|
||||
.flatMap(saved -> AuditLogHelper
|
||||
.record(auditLogService,"GymMember",saved.getId(),"UPDATE",member,saved)
|
||||
.thenReturn(saved));
|
||||
});
|
||||
}
|
||||
}
|
||||
+1
@@ -15,6 +15,7 @@ import cn.novalon.gym.manage.sys.core.repository.IUserRoleRepository;
|
||||
import cn.novalon.gym.manage.sys.core.service.ISysUserService;
|
||||
import cn.novalon.gym.manage.sys.core.command.CreateUserCommand;
|
||||
import cn.novalon.gym.manage.sys.core.command.UpdateUserCommand;
|
||||
import cn.novalon.gym.manage.sys.dto.response.UserResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
-133
@@ -1,133 +0,0 @@
|
||||
package cn.novalon.gym.manage.sys.dto.request;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author:liwentao
|
||||
* @date:2026/5/4-05-04-12:14
|
||||
*/
|
||||
@Schema(description = "用户基础信息更新请求")
|
||||
public class GymUpdateRequest {
|
||||
@Schema(description = "用户名", example = "zhangsan")
|
||||
private String username;
|
||||
@Schema(description = "邮箱", example = "newemail@example.com")
|
||||
private String email;
|
||||
@Schema(description = "性别", example = "男")
|
||||
private Long gender;
|
||||
@Schema(description = "生日", example = "2005-04-17")
|
||||
private LocalDateTime birthday;
|
||||
@Schema(description = "省份", example = "四川")
|
||||
private String province;
|
||||
@Schema(description = "城市", example = "内江市")
|
||||
private String city;
|
||||
@Schema(description = "区县", example = "市中区")
|
||||
private String district;
|
||||
@Schema(description = "详细地址", example = "xxx街")
|
||||
private String address;
|
||||
@Schema(description = "紧急联系人姓名", example = "李四")
|
||||
private String emergency_contact;
|
||||
@Schema(description = "紧急联系人电话", example = "123456789")
|
||||
private String emergency_phone;
|
||||
@Schema(description = "头像URL地址", example = "无")
|
||||
private String avatar_url;
|
||||
@Schema(description = "备注", example = "无")
|
||||
private String remark;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getEmergency_contact() {
|
||||
return emergency_contact;
|
||||
}
|
||||
|
||||
public void setEmergency_contact(String emergency_contact) {
|
||||
this.emergency_contact = emergency_contact;
|
||||
}
|
||||
|
||||
public String getEmergency_phone() {
|
||||
return emergency_phone;
|
||||
}
|
||||
|
||||
public void setEmergency_phone(String emergency_phone) {
|
||||
this.emergency_phone = emergency_phone;
|
||||
}
|
||||
|
||||
public String getAvatar_url() {
|
||||
return avatar_url;
|
||||
}
|
||||
|
||||
public void setAvatar_url(String avatar_url) {
|
||||
this.avatar_url = avatar_url;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Long getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(Long gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public LocalDateTime getBirthday() {
|
||||
return birthday;
|
||||
}
|
||||
|
||||
public void setBirthday(LocalDateTime birthday) {
|
||||
this.birthday = birthday;
|
||||
}
|
||||
}
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
package cn.novalon.gym.manage.sys.handler.gymMember;
|
||||
|
||||
import cn.novalon.gym.manage.sys.core.command.UpdateGymMemberCommand;
|
||||
import cn.novalon.gym.manage.sys.core.service.IGymMemberService;
|
||||
import cn.novalon.gym.manage.sys.dto.request.GymUpdateRequest;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Validator;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author:liwentao
|
||||
* @date:2026/5/4-05-04-10:56
|
||||
*/
|
||||
@Component
|
||||
@Tag(name = "顾客管理", description = "顾客相关操作")
|
||||
public class GymMemberHandler {
|
||||
private final IGymMemberService gymMemberService;
|
||||
private final Validator validator;
|
||||
public GymMemberHandler(
|
||||
IGymMemberService gymMemberService,
|
||||
Validator validator
|
||||
){
|
||||
this.gymMemberService = gymMemberService;
|
||||
this.validator = validator;
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id查询用户", description = "获取用户信息")
|
||||
public Mono<ServerResponse> getUserById(ServerRequest request){
|
||||
Long id = Long.valueOf(request.pathVariable("id"));
|
||||
return gymMemberService.findById(id)
|
||||
.flatMap(gymMember -> ServerResponse.ok().bodyValue(gymMember))
|
||||
.switchIfEmpty(ServerResponse.notFound().build());
|
||||
}
|
||||
|
||||
public Mono<ServerResponse> updateMemberBaseInfo(ServerRequest request){
|
||||
Long id = Long.valueOf(request.pathVariable("id"));
|
||||
return request.bodyToMono(GymUpdateRequest.class)
|
||||
.map(req -> {
|
||||
return UpdateGymMemberCommand.of(
|
||||
id,
|
||||
req.getUsername(),
|
||||
req.getEmail(),
|
||||
req.getGender(),
|
||||
req.getBirthday(),
|
||||
req.getProvince(),
|
||||
req.getCity(),
|
||||
req.getDistrict(),
|
||||
req.getAddress(),
|
||||
req.getEmergency_contact(),
|
||||
req.getEmergency_phone(),
|
||||
req.getAvatar_url(),
|
||||
req.getRemark()
|
||||
);
|
||||
})
|
||||
.flatMap(gymMemberService::updateMember)
|
||||
.flatMap(gymMember -> ServerResponse.ok().bodyValue(gymMember))
|
||||
.switchIfEmpty(ServerResponse.notFound().build());
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@
|
||||
<module>manage-audit</module>
|
||||
<module>manage-notify</module>
|
||||
<module>manage-file</module>
|
||||
<module>gym-groupCourse</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
@@ -221,6 +222,8 @@
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- HuTool工具箱-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user