puzhibing
2023-07-05 35c07cedf67346e9d79449ed185af39a567fa60b
更新部分功能接口
15个文件已修改
10个文件已添加
929 ■■■■■ 已修改文件
cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-account/src/main/java/com/dsh/account/entity/TStudent.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-account/src/main/java/com/dsh/account/model/StudentVo.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-activity/src/main/java/com/dsh/activity/feginClient/account/model/Student.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/pom.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/config/Sharding_jdbc/DatasourceModel.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/config/Sharding_jdbc/Master0DataSource.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/config/Sharding_jdbc/ShardingConfig.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/controller/CourseController.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/entity/CoursePackagePaymentConfig.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/entity/CoursePackageStudent.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackage.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackageDiscount.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackagePayment.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/feignclient/account/StudentClient.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/feignclient/account/model/Student.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/model/CoursePackageInfo.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/model/CoursePackageListVo.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/model/CoursePackagePaymentConfigVo.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/model/StudentVo.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java 341 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/resources/mapper/TCoursePackageDiscountMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/resources/sharding-jdbc.properties 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-other/src/main/java/com/dsh/other/controller/StoreController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java
@@ -2,11 +2,20 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dsh.account.entity.TStudent;
import com.dsh.account.model.StudentVo;
import com.dsh.account.service.TAppUserService;
import com.dsh.account.service.TStudentService;
import com.dsh.account.util.ResultUtil;
import com.dsh.account.util.TokenUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@@ -19,6 +28,9 @@
    @Autowired
    private TStudentService studentService;
    @Autowired
    private TokenUtil tokenUtil;
    /**
@@ -37,4 +49,51 @@
            return new ArrayList<>();
        }
    }
    @ResponseBody
    @PostMapping("/student/queryDefaultStudent")
    public TStudent queryDefaultStudent(@RequestBody Integer appUserId){
        try {
            TStudent one = studentService.getOne(new QueryWrapper<TStudent>().eq("appUserId", appUserId).eq("isDefault", 1).eq("state", 1));
            return one;
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }
    }
    @ResponseBody
    @PostMapping("/api/student/queryStudentList")
    @ApiOperation(value = "获取学员列表", tags = {"APP-课程列表"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "经度", name = "lon", dataType = "string", required = true),
            @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = true),
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<List<StudentVo>> queryStudentList(){
        try {
            Integer uid = tokenUtil.getUserIdFormRedis();
            if(null == uid){
                return ResultUtil.tokenErr();
            }
            List<TStudent> list = studentService.list(new QueryWrapper<TStudent>().eq("appUserId", uid).eq("state", 1));
            List<StudentVo> listVo = new ArrayList<>();
            for (TStudent tStudent : list) {
                StudentVo studentVo = new StudentVo();
                studentVo.setId(tStudent.getId());
                studentVo.setPhone(tStudent.getPhone());
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
                studentVo.setAge(Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday())));
                listVo.add(studentVo);
            }
            return ResultUtil.success(listVo);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
}
cloud-server-account/src/main/java/com/dsh/account/entity/TStudent.java
@@ -6,6 +6,7 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@@ -46,6 +47,7 @@
    /**
     * 生日
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date birthday;
    /**
     * 性别(1=男,2=女)
@@ -78,6 +80,7 @@
    /**
     * 添加时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date insertTime;
    /**
     * 头像
cloud-server-account/src/main/java/com/dsh/account/model/StudentVo.java
New file
@@ -0,0 +1,20 @@
package com.dsh.account.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @author zhibing.pu
 * @date 2023/7/4 10:58
 */
@Data
@ApiModel
public class StudentVo {
    @ApiModelProperty("学员id")
    private Integer id;
    @ApiModelProperty("学员电话")
    private String phone;
    @ApiModelProperty("学员年龄")
    private Integer age;
}
cloud-server-activity/src/main/java/com/dsh/activity/feginClient/account/model/Student.java
@@ -1,5 +1,6 @@
package com.dsh.activity.feginClient.account.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@@ -26,6 +27,7 @@
    /**
     * 生日
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date birthday;
    /**
     * 性别(1=男,2=女)
@@ -58,6 +60,7 @@
    /**
     * 添加时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date insertTime;
    /**
     * 头像
cloud-server-course/pom.xml
@@ -114,6 +114,11 @@
            <artifactId>geodesy</artifactId>
            <version>1.1.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.shardingsphere</groupId>
            <artifactId>shardingsphere-jdbc-core</artifactId>
            <version>5.2.0</version>
        </dependency>
    </dependencies>
    <build>
cloud-server-course/src/main/java/com/dsh/config/Sharding_jdbc/DatasourceModel.java
New file
@@ -0,0 +1,86 @@
package com.dsh.config.Sharding_jdbc;
/**
* 数据源
* @author pzb
* @Date 2022/11/21 21:13
*/
public class DatasourceModel {
    private String url;
    private String username;
    private String password;
    private String driverClassName;
    private Integer maxActive;
    private Long maxWait;
    private Integer minIdle;
    private Integer initialSize;
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getDriverClassName() {
        return driverClassName;
    }
    public void setDriverClassName(String driverClassName) {
        this.driverClassName = driverClassName;
    }
    public DatasourceModel getDatasourceModel(){
        return this;
    }
    public Integer getMaxActive() {
        return maxActive;
    }
    public void setMaxActive(Integer maxActive) {
        this.maxActive = maxActive;
    }
    public Long getMaxWait() {
        return maxWait;
    }
    public void setMaxWait(Long maxWait) {
        this.maxWait = maxWait;
    }
    public Integer getMinIdle() {
        return minIdle;
    }
    public void setMinIdle(Integer minIdle) {
        this.minIdle = minIdle;
    }
    public Integer getInitialSize() {
        return initialSize;
    }
    public void setInitialSize(Integer initialSize) {
        this.initialSize = initialSize;
    }
}
cloud-server-course/src/main/java/com/dsh/config/Sharding_jdbc/Master0DataSource.java
New file
@@ -0,0 +1,18 @@
package com.dsh.config.Sharding_jdbc;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* 数据源配置
* @author pzb
* @Date 2022/11/21 20:32
*/
@Component
@PropertySource(value = "classpath:sharding-jdbc.properties")
@ConfigurationProperties(prefix = "datasource.master0")
public class Master0DataSource extends DatasourceModel {
}
cloud-server-course/src/main/java/com/dsh/config/Sharding_jdbc/ShardingConfig.java
New file
@@ -0,0 +1,113 @@
package com.dsh.config.Sharding_jdbc;
import com.alibaba.druid.pool.DruidDataSource;
import org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration;
import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.*;
@Configuration
public class ShardingConfig {
    @Autowired
    private Master0DataSource master0DataSource;
    @Bean
    public DataSource getDataSource(){
        DataSource dataSource = null;
        try {
            Properties properties = new Properties();
            properties.setProperty("sql-show", "true");
            String databaseName = "m_0";//真实数据源名称,多个数据源用逗号区分
            dataSource = ShardingSphereDataSourceFactory.createDataSource(databaseName, createDataSourceMap(), createShardingRuleConfiguration(), properties);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return dataSource;
    }
    /**
     * 配置多数据源
     * @return
     */
    private Map<String, DataSource> createDataSourceMap() {
        Map<String, DataSource> dataSourceMap = new HashMap<>();
        // 配置第 1 个数据源
        DruidDataSource dataSource1 = new DruidDataSource();
        dataSource1.setDriverClassName(master0DataSource.getDriverClassName());
        dataSource1.setUrl(master0DataSource.getUrl());
        dataSource1.setUsername(master0DataSource.getUsername());
        dataSource1.setPassword(master0DataSource.getPassword());
        dataSource1.setMaxActive(master0DataSource.getMaxActive());
        dataSource1.setMaxWait(master0DataSource.getMaxWait());
        dataSource1.setMinIdle(master0DataSource.getMinIdle());
        dataSource1.setInitialSize(master0DataSource.getInitialSize());
        dataSourceMap.put("m_0", dataSource1);
        return dataSourceMap;
    }
    /**
     * 分片配置
     * @return
     */
    private Collection<RuleConfiguration> createShardingRuleConfiguration() {
        LinkedList<RuleConfiguration> linkedList = new LinkedList();
        //分片规则配置
        ShardingRuleConfiguration result1 = new ShardingRuleConfiguration();
        result1.getTables().add(gettCoursePackagePaymentTableRuleConfiguration());
        Properties props1 = new Properties();
        props1.setProperty("algorithm-expression", "t_course_package_payment$->{appUserId % 5 + 1}");
        result1.getShardingAlgorithms().put("t_course_package_payment-inline", new AlgorithmConfiguration("INLINE", props1));
        result1.getKeyGenerators().put("t_course_package_payment-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties()));
        //分片规则配置
        result1.getTables().add(getCoursePackageStudentTableRuleConfiguration());
        Properties props2 = new Properties();
        props2.setProperty("algorithm-expression", "t_course_package_student$->{appUserId % 5 + 1}");
        result1.getShardingAlgorithms().put("t_course_package_student-inline", new AlgorithmConfiguration("INLINE", props2));
        result1.getKeyGenerators().put("t_course_package_student-snowflake", new AlgorithmConfiguration("SNOWFLAKE", new Properties()));
        linkedList.add(result1);
        return linkedList;
    }
    /**
     * 分片算法配置
     * @return
     */
    private ShardingTableRuleConfiguration gettCoursePackagePaymentTableRuleConfiguration() {
        ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration("t_course_package_payment", "m$->{0}.t_course_package_payment$->{1..5}");//50
        result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("appUserId", "t_course_package_payment-inline"));
        result.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "t_course_package_payment-snowflake"));
        return result;
    }
    /**
     * 分片算法配置
     * @return
     */
    private ShardingTableRuleConfiguration getCoursePackageStudentTableRuleConfiguration() {
        ShardingTableRuleConfiguration result = new ShardingTableRuleConfiguration("t_course_package_student", "m$->{0}.t_course_package_student$->{1..5}");//30
        result.setTableShardingStrategy(new StandardShardingStrategyConfiguration("appUserId", "t_course_package_student-inline"));
        result.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "t_course_package_student-snowflake"));
        return result;
    }
}
cloud-server-course/src/main/java/com/dsh/course/controller/CourseController.java
@@ -6,6 +6,7 @@
import com.dsh.course.entity.TCoursePackageType;
import com.dsh.course.feignclient.model.ExerciseVideo;
import com.dsh.course.model.BaseVo;
import com.dsh.course.model.CoursePackageInfo;
import com.dsh.course.model.CoursePackageList;
import com.dsh.course.model.CoursePackageListVo;
import com.dsh.course.service.TCoursePackageService;
@@ -72,7 +73,7 @@
    @ResponseBody
    @PostMapping("/api/course/queryCoursePackageType")
    @ApiOperation(value = "获取课程类型列表", tags = {"APP-加入玩湃"})
    @ApiOperation(value = "获取课程类型列表", tags = {"APP-课程列表"})
    @ApiImplicitParams({
    })
    public ResultUtil<List<BaseVo>> queryCoursePackageType(){
@@ -97,7 +98,7 @@
    @ResponseBody
    @PostMapping("/api/course/queryCourseList")
    @ApiOperation(value = "获取课程列表", tags = {"APP-加入玩湃"})
    @ApiOperation(value = "获取课程列表", tags = {"APP-课程列表"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
@@ -117,6 +118,27 @@
    @ResponseBody
    @PostMapping("/api/course/queryCourseInfo")
    @ApiOperation(value = "获取课程详情", tags = {"APP-课程列表"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "课包id", name = "id", dataType = "int", required = true),
            @ApiImplicitParam(value = "经度", name = "lon", dataType = "string", required = true),
            @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = true),
            @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil<CoursePackageInfo> queryCourseInfo(@RequestBody Integer id, @RequestBody String lon, @RequestBody String lat){
        try {
            Integer uid = tokenUtil.getUserIdFormRedis();
            if(null == uid){
                return ResultUtil.tokenErr();
            }
            CoursePackageInfo coursePackageInfo = coursePackageService.queryCourseInfo(uid, id, lon, lat);
            return ResultUtil.success(coursePackageInfo);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
}
cloud-server-course/src/main/java/com/dsh/course/entity/CoursePackagePaymentConfig.java
@@ -24,11 +24,6 @@
    @TableField("coursePackageId")
    private Integer coursePackageId;
    /**
     * 支付方式(1=现金,2=玩湃币)
     */
    @TableField("payType")
    private Integer payType;
    /**
     * 课时数
     */
    @TableField("classHours")
cloud-server-course/src/main/java/com/dsh/course/entity/CoursePackageStudent.java
@@ -30,8 +30,8 @@
    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    @TableId(value = "id", type = IdType.INPUT)
    private Long id;
    /**
     * 用户id
     */
cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackage.java
@@ -100,7 +100,7 @@
    /**
     * 支付方式(1=现金,2=玩湃币)
     */
    private String payType;
    private Integer payType;
    /**
     * 有效天数
     */
cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackageDiscount.java
@@ -4,6 +4,7 @@
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@@ -36,6 +37,11 @@
     */
    private Integer coursePackageId;
    /**
     * 课包价格规则id
     */
    @TableField("coursePackagePaymentConfigId")
    private Integer coursePackagePaymentConfigId;
    /**
     * 折扣类型(1=会员折扣,2=续课优惠,3=限时折扣,4=赠送课时)
     */
    private Integer type;
cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackagePayment.java
@@ -28,8 +28,8 @@
    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    @TableId(value = "id", type = IdType.INPUT)
    private Long id;
    /**
     * 用户id
     */
cloud-server-course/src/main/java/com/dsh/course/feignclient/account/StudentClient.java
New file
@@ -0,0 +1,22 @@
package com.dsh.course.feignclient.account;
import com.dsh.course.feignclient.account.model.Student;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
 * @author zhibing.pu
 * @date 2023/7/4 23:38
 */
@FeignClient("mb-cloud-account")
public interface StudentClient {
    /**
     * 获取默认学员
     * @param appUserId
     * @return
     */
    @PostMapping("/student/queryDefaultStudent")
    Student queryDefaultStudent(Integer appUserId);
}
cloud-server-course/src/main/java/com/dsh/course/feignclient/account/model/Student.java
New file
@@ -0,0 +1,73 @@
package com.dsh.course.feignclient.account.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
 * @author zhibing.pu
 * @date 2023/7/4 23:39
 */
@Data
public class Student {
    private Integer id;
    /**
     * 用户id
     */
    private Integer appUserId;
    /**
     * 学员姓名
     */
    private String name;
    /**
     * 学员电话
     */
    private String phone;
    /**
     * 生日
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date birthday;
    /**
     * 性别(1=男,2=女)
     */
    private Integer sex;
    /**
     * 身高
     */
    private Double height;
    /**
     * 体重
     */
    private Double weight;
    /**
     * bmi健康值
     */
    private Double bmi;
    /**
     * 身份证号
     */
    private String idCard;
    /**
     * 体侧表
     */
    private String lateralSurface;
    /**
     * 状态(1=正常,2=冻结,3=删除)
     */
    private Integer state;
    /**
     * 添加时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date insertTime;
    /**
     * 头像
     */
    private String headImg;
    /**
     * 是否默认 1默认 2不是默认
     */
    private Integer isDefault;
}
cloud-server-course/src/main/java/com/dsh/course/model/CoursePackageInfo.java
New file
@@ -0,0 +1,46 @@
package com.dsh.course.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
 * @author zhibing.pu
 * @date 2023/7/4 10:28
 */
@Data
@ApiModel
public class CoursePackageInfo {
    @ApiModelProperty("id")
    private Integer id;
    @ApiModelProperty("封面图")
    private String coverDrawing;
    @ApiModelProperty("课程名称")
    private String name;
    @ApiModelProperty("门店名称")
    private String storeName;
    @ApiModelProperty("门店照片")
    private String storeCoverDrawing;
    @ApiModelProperty("门店地址")
    private String storeAddress;
    @ApiModelProperty("门店经度")
    private String lon;
    @ApiModelProperty("门店纬度")
    private String lat;
    @ApiModelProperty("距离")
    private Double distance;
    @ApiModelProperty("上课周")
    private List<String> weeks;
    @ApiModelProperty("上课时间")
    private String times;
    @ApiModelProperty("详情图片")
    private String detailDrawing;
    @ApiModelProperty("介绍图")
    private String introduceDrawing;
    @ApiModelProperty("课时套餐")
    private List<CoursePackagePaymentConfigVo> list;
    @ApiModelProperty("学员")
    private StudentVo student;
}
cloud-server-course/src/main/java/com/dsh/course/model/CoursePackageListVo.java
@@ -23,12 +23,16 @@
    private String classStartTime;
    @ApiModelProperty("已报名人数")
    private Integer applicantsNumber;
    @ApiModelProperty("支付方式(1=现金,2=玩湃币)")
    private Integer payType;
    @ApiModelProperty("原价")
    private Double originalPrice;
    @ApiModelProperty("会员价")
    private Double vipPrice;
    @ApiModelProperty("支付价")
    private Double paymentPrice;
    @ApiModelProperty("玩湃价")
    private Integer playPaiCoin;
    @ApiModelProperty("距离")
    private Double distance;
}
cloud-server-course/src/main/java/com/dsh/course/model/CoursePackagePaymentConfigVo.java
New file
@@ -0,0 +1,28 @@
package com.dsh.course.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @author zhibing.pu
 * @date 2023/7/4 10:44
 */
@Data
@ApiModel
public class CoursePackagePaymentConfigVo {
    @ApiModelProperty("套餐id")
    private Integer id;
    @ApiModelProperty("课时数")
    private Integer classHours;
    @ApiModelProperty("支付方式(1=现金,2=玩湃币)")
    private Integer payType;
    @ApiModelProperty("支付价")
    private Double paymentPrice;
    @ApiModelProperty("原价")
    private Double originalPrice;
    @ApiModelProperty("会员价")
    private Double vipPrice;
    @ApiModelProperty("玩湃价")
    private Integer playPaiCoin;
}
cloud-server-course/src/main/java/com/dsh/course/model/StudentVo.java
New file
@@ -0,0 +1,20 @@
package com.dsh.course.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @author zhibing.pu
 * @date 2023/7/4 10:58
 */
@Data
@ApiModel
public class StudentVo {
    @ApiModelProperty("学员id")
    private Integer id;
    @ApiModelProperty("学员电话")
    private String phone;
    @ApiModelProperty("学员年龄")
    private Integer age;
}
cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.dsh.course.entity.TCoursePackage;
import com.dsh.course.feignclient.model.CourseOfStoreVo;
import com.dsh.course.model.CoursePackageInfo;
import com.dsh.course.model.CoursePackageList;
import com.dsh.course.model.CoursePackageListVo;
@@ -29,4 +30,14 @@
     * @throws Exception
     */
    List<CoursePackageListVo> queryCourseList(Integer uid, CoursePackageList coursePackageList) throws Exception;
    /**
     * 获取课包详情
     * @param uid
     * @param id
     * @return
     * @throws Exception
     */
    CoursePackageInfo queryCourseInfo(Integer uid, Integer id, String lon, String lat) throws Exception;
}
cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java
@@ -9,13 +9,14 @@
import com.dsh.course.entity.TCoursePackage;
import com.dsh.course.entity.TCoursePackageDiscount;
import com.dsh.course.feignclient.account.AppUserClient;
import com.dsh.course.feignclient.account.StudentClient;
import com.dsh.course.feignclient.account.model.AppUser;
import com.dsh.course.feignclient.account.model.Student;
import com.dsh.course.feignclient.other.StoreClient;
import com.dsh.course.feignclient.other.model.Store;
import com.dsh.course.mapper.TCoursePackageMapper;
import com.dsh.course.feignclient.model.CourseOfStoreVo;
import com.dsh.course.model.CoursePackageList;
import com.dsh.course.model.CoursePackageListVo;
import com.dsh.course.model.*;
import com.dsh.course.service.ICoursePackagePaymentConfigService;
import com.dsh.course.service.TCoursePackageDiscountService;
import com.dsh.course.service.TCoursePackagePaymentService;
@@ -27,6 +28,8 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -59,6 +62,9 @@
    @Resource
    private AppUserClient appUserClient;
    @Resource
    private StudentClient studentClient;
@@ -106,7 +112,7 @@
            Store store = storeClient.queryStoreById(coursePackage.getStoreId());
            Integer integer = coursePackagePaymentService.queryCountNumber(coursePackage.getId());
            CoursePackagePaymentConfig coursePackagePaymentConfig = coursePackagePaymentConfigService.getOne(new QueryWrapper<CoursePackagePaymentConfig>()
                    .eq("coursePackageId", coursePackage.getId()).last(" order by if(payType = 1, cashPayment, playPaiCoin)"));
                    .eq("coursePackageId", coursePackage.getId()).orderByAsc("classHours limit 0, 1"));
            CoursePackageListVo coursePackageListVo = new CoursePackageListVo();
            coursePackageListVo.setId(coursePackage.getId());
            coursePackageListVo.setName(coursePackage.getName());
@@ -114,86 +120,113 @@
            coursePackageListVo.setCoverDrawing(coursePackage.getCoverDrawing());
            coursePackageListVo.setClassStartTime(coursePackage.getClassStartTime() + "-" + coursePackage.getClassEndTime());
            coursePackageListVo.setApplicantsNumber(integer);
            coursePackageListVo.setPayType(coursePackage.getPayType());
            coursePackageListVo.setPlayPaiCoin(coursePackageListVo.getPlayPaiCoin());
            coursePackageListVo.setOriginalPrice(coursePackagePaymentConfig.getPayType() == 1 ? coursePackagePaymentConfig.getCashPayment() : coursePackagePaymentConfig.getPlayPaiCoin().doubleValue());
            TCoursePackageDiscount coursePackageDiscount = coursePackageDiscountService.getOne(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackageId", coursePackage.getId()).eq("auditStatus", 2).eq("type", 1));
            if(1 == appUser.getIsVip() && null != coursePackageDiscount){
                //{"num1":100}
                JSONObject jsonObject = JSON.parseObject(coursePackageDiscount.getContent());
                coursePackageListVo.setVipPrice(jsonObject.getDouble("num1"));
            }
            coursePackageDiscount = coursePackageDiscountService.getOne(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackageId", coursePackage.getId()).eq("auditStatus", 2).eq("type", 3));
            if(null == coursePackageDiscount){
                coursePackageListVo.setPaymentPrice(coursePackageListVo.getOriginalPrice());
            }else{
            //会员显示原价和会员价(最低)。非会员显示会员价和支付价(最低)
            if(appUser.getIsVip() == 0){//非会员
                List<TCoursePackageDiscount> list2 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId())
                        .eq("type", 1).eq("auditStatus", 2));
                Double vipPrice = coursePackagePaymentConfig.getCashPayment();
                for (TCoursePackageDiscount coursePackageDiscount : list2) {
                    Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("num1");
                    if(vipPrice.compareTo(num1) > 0){
                        vipPrice = num1;
                    }
                }
                coursePackageListVo.setVipPrice(vipPrice);
                Double paymentPrice = coursePackagePaymentConfig.getCashPayment();
                List<TCoursePackageDiscount> list3 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId())
                        .eq("type", 3).eq("auditStatus", 2));
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                /**
                 * [{
                 *     "startDate": "2023-01-01 00:00:00",
                 *     "endDate": "2023-12-31 23:59:59",
                 *     "startTime": "02:00:00",
                 *     "endTime": "23:00:00",
                 *     "weeks": [1, 2, 7],
                 *     "cashPayment": 100
                 * }]
                 */
                JSONArray jsonArray = JSON.parseArray(coursePackageDiscount.getContent());
                for (int i = 0; i < jsonArray.size(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    String startDate = jsonObject.getString("startDate");
                    String endDate = jsonObject.getString("endDate");
                    String startTime = jsonObject.getString("startTime");
                    String endTime = jsonObject.getString("endTime");
                    List<Integer> weeks = jsonObject.getJSONArray("weeks").toJavaList(Integer.class);
                    Double cashPayment = jsonObject.getDouble("cashPayment");
                    Date startDate_date = sdf.parse(startDate);
                    Date endDate_date = sdf.parse(endDate);
                    long timeMillis = System.currentTimeMillis();
                    if(timeMillis >= startDate_date.getTime() && timeMillis < endDate_date.getTime()){
                        Date date = new Date();
                        Calendar calendar = Calendar.getInstance();
                        calendar.setTime(date);
                        int week = calendar.get(Calendar.DAY_OF_WEEK);
                        boolean isFirstSunday = (calendar.getFirstDayOfWeek() == Calendar.SUNDAY);
                        if(isFirstSunday){
                            week = week - 1;
                            if(week == 0){
                                week = 7;
                for (TCoursePackageDiscount coursePackageDiscount : list3) {
                    /**
                     * [{
                     *     "startDate": "2023-01-01 00:00:00",
                     *     "endDate": "2023-12-31 23:59:59",
                     *     "startTime": "02:00:00",
                     *     "endTime": "23:00:00",
                     *     "weeks": [1, 2, 7],
                     *     "cashPayment": 100
                     * }]
                     */
                    JSONArray jsonArray = JSON.parseArray(coursePackageDiscount.getContent());
                    for (int i = 0; i < jsonArray.size(); i++) {
                        try {
                            JSONObject jsonObject = jsonArray.getJSONObject(i);
                            String startDate = jsonObject.getString("startDate");
                            String endDate = jsonObject.getString("endDate");
                            String startTime = jsonObject.getString("startTime");
                            String endTime = jsonObject.getString("endTime");
                            List<Integer> weeks = jsonObject.getJSONArray("weeks").toJavaList(Integer.class);
                            Double cashPayment = jsonObject.getDouble("cashPayment");
                            Date startDate_date = sdf.parse(startDate);
                            Date endDate_date = sdf.parse(endDate);
                            long timeMillis = System.currentTimeMillis();
                            if(timeMillis >= startDate_date.getTime() && timeMillis < endDate_date.getTime()){
                                Date date = new Date();
                                Calendar calendar = Calendar.getInstance();
                                calendar.setTime(date);
                                int week = calendar.get(Calendar.DAY_OF_WEEK);
                                boolean isFirstSunday = (calendar.getFirstDayOfWeek() == Calendar.SUNDAY);
                                if(isFirstSunday){
                                    week = week - 1;
                                    if(week == 0){
                                        week = 7;
                                    }
                                }
                                if(!weeks.contains(week)){
                                    continue;
                                }
                                String[] split1 = startTime.split(":");
                                Integer hour1 = Integer.valueOf(split1[0]);
                                Calendar s = Calendar.getInstance();
                                s.setTime(date);
                                s.set(Calendar.HOUR_OF_DAY, hour1);
                                s.set(Calendar.MINUTE, Integer.valueOf(split1[1]));
                                s.set(Calendar.SECOND, Integer.valueOf(split1[2]));
                                String[] split2 = endTime.split(":");
                                Integer hour2 = Integer.valueOf(split2[0]);
                                Calendar e = Calendar.getInstance();
                                e.setTime(date);
                                e.set(Calendar.HOUR_OF_DAY, hour2);
                                e.set(Calendar.MINUTE, Integer.valueOf(split2[1]));
                                e.set(Calendar.SECOND, Integer.valueOf(split2[2]));
                                if(hour1 > hour2){
                                    if(s.getTimeInMillis() > date.getTime()){
                                        s.set(Calendar.DAY_OF_YEAR, s.get(Calendar.DAY_OF_YEAR) - 1);
                                    }else{
                                        e.set(Calendar.DAY_OF_YEAR, e.get(Calendar.DAY_OF_YEAR) + 1);
                                    }
                                }
                                if(timeMillis >= s.getTimeInMillis() && timeMillis < e.getTimeInMillis() && paymentPrice.compareTo(cashPayment) > 0){
                                    paymentPrice = cashPayment;
                                }
                            }
                        }
                        if(!weeks.contains(week)){
                            continue;
                        }
                        String[] split = startTime.split(":");
                        Integer hour1 = Integer.valueOf(split[0]);
                        Calendar s = Calendar.getInstance();
                        s.setTime(date);
                        s.set(Calendar.HOUR_OF_DAY, hour1);
                        s.set(Calendar.MINUTE, Integer.valueOf(split[1]));
                        s.set(Calendar.SECOND, Integer.valueOf(split[2]));
                        String[] split1 = endTime.split(":");
                        Integer hour2 = Integer.valueOf(split1[0]);
                        Calendar e = Calendar.getInstance();
                        e.setTime(date);
                        e.set(Calendar.HOUR_OF_DAY, hour2);
                        e.set(Calendar.MINUTE, Integer.valueOf(split1[1]));
                        e.set(Calendar.SECOND, Integer.valueOf(split1[2]));
                        if(hour1 > hour2){
                            if(s.getTimeInMillis() > date.getTime()){
                                s.set(Calendar.DAY_OF_YEAR, s.get(Calendar.DAY_OF_YEAR) - 1);
                            }else{
                                e.set(Calendar.DAY_OF_YEAR, e.get(Calendar.DAY_OF_YEAR) + 1);
                            }
                        }
                        if(timeMillis >= s.getTimeInMillis() && timeMillis < e.getTimeInMillis()){
                            coursePackageListVo.setPaymentPrice(cashPayment);
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                    }
                }
                coursePackageListVo.setPaymentPrice(paymentPrice);
            }else{
                List<TCoursePackageDiscount> list2 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId())
                        .eq("type", 1).eq("auditStatus", 2));
                Double vipPrice = coursePackagePaymentConfig.getCashPayment();
                for (TCoursePackageDiscount coursePackageDiscount : list2) {
                    Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("num1");
                    if(vipPrice.compareTo(num1) > 0){
                        vipPrice = num1;
                    }
                }
                coursePackageListVo.setPaymentPrice(vipPrice);
                coursePackageListVo.setOriginalPrice(coursePackagePaymentConfig.getCashPayment());
            }
            Map<String, Double> distance = GeodesyUtil.getDistance(coursePackageList.getLon() + "," + coursePackageList.getLat(), store.getLon() + "," + store.getLat());
            coursePackageListVo.setDistance(distance.get("WGS84") / 1000);
            listVos.add(coursePackageListVo);
@@ -217,4 +250,160 @@
        }
        return listVos;
    }
    /**
     * 获取课包详情
     * @param uid
     * @param id
     * @return
     * @throws Exception
     */
    @Override
    public CoursePackageInfo queryCourseInfo(Integer uid, Integer id, String lon, String lat) throws Exception {
        AppUser appUser = appUserClient.queryAppUser(uid);
        TCoursePackage coursePackage = this.getById(id);
        CoursePackageInfo coursePackageInfo = new CoursePackageInfo();
        coursePackageInfo.setId(id);
        coursePackageInfo.setCoverDrawing(coursePackage.getCoverDrawing());
        coursePackageInfo.setName(coursePackage.getName());
        Store store = storeClient.queryStoreById(coursePackage.getStoreId());
        coursePackageInfo.setStoreName(store.getName());
        coursePackageInfo.setStoreCoverDrawing(store.getCoverDrawing());
        coursePackageInfo.setStoreAddress(store.getAddress());
        coursePackageInfo.setLon(store.getLon());
        coursePackageInfo.setLat(store.getLat());
        Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat());
        double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
        coursePackageInfo.setDistance(wgs84);
        String[] split = coursePackage.getClassWeeks().split(";");
        coursePackageInfo.setWeeks(Arrays.asList(split));
        coursePackageInfo.setTimes(coursePackage.getClassStartTime() + "-" + coursePackage.getClassEndTime());
        coursePackageInfo.setDetailDrawing(coursePackage.getDetailDrawing());
        coursePackageInfo.setIntroduceDrawing(coursePackage.getIntroduceDrawing());
        List<CoursePackagePaymentConfigVo> list = new ArrayList<>();
        List<CoursePackagePaymentConfig> list1 = coursePackagePaymentConfigService.list(new QueryWrapper<CoursePackagePaymentConfig>().eq("coursePackageId", id).orderByAsc("classHours"));
        list1.forEach(coursePackagePaymentConfig -> {
            CoursePackagePaymentConfigVo coursePackagePaymentConfigVo = new CoursePackagePaymentConfigVo();
            coursePackagePaymentConfigVo.setId(coursePackagePaymentConfig.getId());
            coursePackagePaymentConfigVo.setClassHours(coursePackagePaymentConfig.getClassHours());
            coursePackagePaymentConfigVo.setPayType(coursePackage.getPayType());
            coursePackagePaymentConfigVo.setPlayPaiCoin(coursePackagePaymentConfig.getPlayPaiCoin());
            //会员显示原价和会员价(最低)。非会员显示会员价和支付价(最低)
            if(appUser.getIsVip() == 0){//非会员
                List<TCoursePackageDiscount> list2 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId())
                        .eq("type", 1).eq("auditStatus", 2));
                Double vipPrice = coursePackagePaymentConfig.getCashPayment();
                for (TCoursePackageDiscount coursePackageDiscount : list2) {
                    Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("num1");
                    if(vipPrice.compareTo(num1) > 0){
                        vipPrice = num1;
                    }
                }
                coursePackagePaymentConfigVo.setVipPrice(vipPrice);
                Double paymentPrice = coursePackagePaymentConfig.getCashPayment();
                List<TCoursePackageDiscount> list3 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId())
                        .eq("type", 3).eq("auditStatus", 2));
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                for (TCoursePackageDiscount coursePackageDiscount : list3) {
                    /**
                     * [{
                     *     "startDate": "2023-01-01 00:00:00",
                     *     "endDate": "2023-12-31 23:59:59",
                     *     "startTime": "02:00:00",
                     *     "endTime": "23:00:00",
                     *     "weeks": [1, 2, 7],
                     *     "cashPayment": 100
                     * }]
                     */
                    JSONArray jsonArray = JSON.parseArray(coursePackageDiscount.getContent());
                    for (int i = 0; i < jsonArray.size(); i++) {
                        try {
                            JSONObject jsonObject = jsonArray.getJSONObject(i);
                            String startDate = jsonObject.getString("startDate");
                            String endDate = jsonObject.getString("endDate");
                            String startTime = jsonObject.getString("startTime");
                            String endTime = jsonObject.getString("endTime");
                            List<Integer> weeks = jsonObject.getJSONArray("weeks").toJavaList(Integer.class);
                            Double cashPayment = jsonObject.getDouble("cashPayment");
                            Date startDate_date = sdf.parse(startDate);
                            Date endDate_date = sdf.parse(endDate);
                            long timeMillis = System.currentTimeMillis();
                            if(timeMillis >= startDate_date.getTime() && timeMillis < endDate_date.getTime()){
                                Date date = new Date();
                                Calendar calendar = Calendar.getInstance();
                                calendar.setTime(date);
                                int week = calendar.get(Calendar.DAY_OF_WEEK);
                                boolean isFirstSunday = (calendar.getFirstDayOfWeek() == Calendar.SUNDAY);
                                if(isFirstSunday){
                                    week = week - 1;
                                    if(week == 0){
                                        week = 7;
                                    }
                                }
                                if(!weeks.contains(week)){
                                    continue;
                                }
                                String[] split1 = startTime.split(":");
                                Integer hour1 = Integer.valueOf(split1[0]);
                                Calendar s = Calendar.getInstance();
                                s.setTime(date);
                                s.set(Calendar.HOUR_OF_DAY, hour1);
                                s.set(Calendar.MINUTE, Integer.valueOf(split1[1]));
                                s.set(Calendar.SECOND, Integer.valueOf(split1[2]));
                                String[] split2 = endTime.split(":");
                                Integer hour2 = Integer.valueOf(split2[0]);
                                Calendar e = Calendar.getInstance();
                                e.setTime(date);
                                e.set(Calendar.HOUR_OF_DAY, hour2);
                                e.set(Calendar.MINUTE, Integer.valueOf(split2[1]));
                                e.set(Calendar.SECOND, Integer.valueOf(split2[2]));
                                if(hour1 > hour2){
                                    if(s.getTimeInMillis() > date.getTime()){
                                        s.set(Calendar.DAY_OF_YEAR, s.get(Calendar.DAY_OF_YEAR) - 1);
                                    }else{
                                        e.set(Calendar.DAY_OF_YEAR, e.get(Calendar.DAY_OF_YEAR) + 1);
                                    }
                                }
                                if(timeMillis >= s.getTimeInMillis() && timeMillis < e.getTimeInMillis() && paymentPrice.compareTo(cashPayment) > 0){
                                    paymentPrice = cashPayment;
                                }
                            }
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                    }
                }
                coursePackagePaymentConfigVo.setPaymentPrice(paymentPrice);
            }else{
                List<TCoursePackageDiscount> list2 = coursePackageDiscountService.list(new QueryWrapper<TCoursePackageDiscount>().eq("coursePackagePaymentConfigId", coursePackagePaymentConfig.getId())
                        .eq("type", 1).eq("auditStatus", 2));
                Double vipPrice = coursePackagePaymentConfig.getCashPayment();
                for (TCoursePackageDiscount coursePackageDiscount : list2) {
                    Double num1 = JSON.parseObject(coursePackageDiscount.getContent()).getDouble("num1");
                    if(vipPrice.compareTo(num1) > 0){
                        vipPrice = num1;
                    }
                }
                coursePackagePaymentConfigVo.setPaymentPrice(vipPrice);
                coursePackagePaymentConfigVo.setOriginalPrice(coursePackagePaymentConfig.getCashPayment());
            }
            list.add(coursePackagePaymentConfigVo);
        });
        coursePackageInfo.setList(list);
        Student student = studentClient.queryDefaultStudent(uid);
        StudentVo studentVo = new StudentVo();
        studentVo.setId(student.getId());
        studentVo.setPhone(student.getPhone());
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
        studentVo.setAge(Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(student.getBirthday())));
        coursePackageInfo.setStudent(studentVo);
        return coursePackageInfo;
    }
}
cloud-server-course/src/main/resources/mapper/TCoursePackageDiscountMapper.xml
@@ -6,6 +6,7 @@
    <resultMap id="BaseResultMap" type="com.dsh.course.entity.TCoursePackageDiscount">
        <id column="id" property="id" />
        <result column="coursePackageId" property="coursePackageId" />
        <result column="coursePackagePaymentConfigId" property="coursePackagePaymentConfigId"/>
        <result column="type" property="type" />
        <result column="content" property="content" />
        <result column="auditStatus" property="auditStatus" />
cloud-server-course/src/main/resources/sharding-jdbc.properties
New file
@@ -0,0 +1,25 @@
datasource.names=master0
#¿ª·¢»·¾³
datasource.master0.type=com.alibaba.druid.pool.DruidDataSource
datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver
datasource.master0.url=jdbc:mysql://192.168.110.80:3306/playpai_course?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
datasource.master0.username=root
datasource.master0.password=123456
datasource.master0.maxActive=20
datasource.master0.maxWait=60000
datasource.master0.minIdle=5
datasource.master0.initialSize=2
#Éú²ú»·¾³
#datasource.master0.type=com.alibaba.druid.pool.DruidDataSource
#datasource.master0.driverClassName=com.mysql.cj.jdbc.Driver
#datasource.master0.url=jdbc:mysql://110.239.68.140:3306/playpai_course?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B7
#datasource.master0.username=root
#datasource.master0.password=G4LLlNouAGH1dijbyU&xDo$X
#datasource.master0.maxActive=200
#datasource.master0.maxWait=60000
#datasource.master0.minIdle=100
#datasource.master0.initialSize=100
cloud-server-other/src/main/java/com/dsh/other/controller/StoreController.java
@@ -136,7 +136,7 @@
    @ResponseBody
    @PostMapping("/base/store/queryStoreLists")
    @ApiOperation(value = "获取门店列表", tags = {"APP-加入玩湃"})
    @ApiOperation(value = "获取门店列表", tags = {"APP-加入玩湃", "APP-课程列表"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "经纬", name = "lon", dataType = "string", required = true),
            @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = true),