From 9144acea1ad8f6222ca2db17cf8ef7ffb18e7428 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期三, 14 六月 2023 16:17:46 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- cloud-server-account/src/main/java/com/dsh/account/entity/TAppUser.java | 14 cloud-server-course/src/main/java/com/dsh/course/feignclient/model/StuCourseResp.java | 25 + cloud-server-course/pom.xml | 20 - cloud-server-account/src/main/java/com/dsh/account/entity/TStudent.java | 14 cloud-server-course/src/main/java/com/dsh/course/service/TCourseService.java | 2 cloud-server-account/src/main/java/com/dsh/account/feignclient/course/model/TCoursePackagePayment.java | 92 ++++++ cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java | 56 ++++ cloud-server-other/src/main/java/com/dsh/other/mapper/TImgConfigMapper.java | 1 cloud-server-other/pom.xml | 10 cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackageType.java | 16 cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageService.java | 2 cloud-server-account/src/main/java/com/dsh/account/service/TStudentService.java | 5 cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java | 27 + cloud-server-other/src/main/java/com/dsh/other/service/TImgConfigService.java | 1 cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackagePaymentService.java | 2 cloud-server-course/src/main/java/com/dsh/course/feignclient/CoursePaymentClient.java | 16 + cloud-server-course/src/main/java/com/dsh/course/servs/CoursePackagePaymentRepository.java | 25 + cloud-server-course/src/main/java/com/dsh/course/entity/TCourse.java | 16 cloud-server-other/src/main/java/com/dsh/other/entity/TImgConfig.java | 11 cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/classInsVo/StuDetailsReq.java | 4 cloud-server-account/src/main/java/com/dsh/account/mapper/TStudentMapper.java | 3 cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageMapper.java | 2 cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java | 2 cloud-server-course/src/main/java/com/dsh/course/service/impl/TCourseServiceImpl.java | 2 cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackagePaymentMapper.java | 2 cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageDiscountMapper.java | 2 cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageTypeMapper.java | 2 cloud-server-account/src/main/java/com/dsh/account/controller/ClassDetailsController.java | 140 ++++++--- cloud-server-account/src/main/java/com/dsh/account/feignclient/course/model/StuCourseResp.java | 25 + cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackagePayment.java | 17 cloud-server-account/pom.xml | 16 - cloud-server-account/src/main/java/com/dsh/account/mapper/TAppUserMapper.java | 3 cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/classInsVo/ClassInfoVo.java | 3 cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackageDiscount.java | 14 cloud-server-account/src/main/java/com/dsh/account/feignclient/course/CoursePaymentClient.java | 15 + /dev/null | 88 ------ cloud-server-course/src/main/java/com/dsh/course/mapper/TCourseMapper.java | 3 cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageDiscountService.java | 3 cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageTypeServiceImpl.java | 2 cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackage.java | 17 cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageTypeService.java | 2 cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java | 60 +++ cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java | 2 cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageDiscountServiceImpl.java | 2 cloud-server-account/src/main/java/com/dsh/account/feignclient/other/model/TImgConfig.java | 14 cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java | 4 46 files changed, 502 insertions(+), 302 deletions(-) diff --git a/cloud-server-account/pom.xml b/cloud-server-account/pom.xml index f138c5d..28c5a25 100644 --- a/cloud-server-account/pom.xml +++ b/cloud-server-account/pom.xml @@ -79,22 +79,6 @@ <!-- mybatis generertor--> <dependency> - <groupId>com.baomidou</groupId> - <artifactId>mybatisplus-spring-boot-starter</artifactId> - <version>1.0.5</version> - </dependency> - - <dependency> - <groupId>com.baomidou</groupId> - <artifactId>mybatis-plus</artifactId> - <version>3.4.1</version> - </dependency> - <dependency> - <groupId>com.baomidou</groupId> - <artifactId>mybatis-plus-generate</artifactId> - <version>2.3</version> - </dependency> - <dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity</artifactId> <version>1.7</version> diff --git a/cloud-server-account/src/main/java/com/dsh/account/controller/ClassDetailsController.java b/cloud-server-account/src/main/java/com/dsh/account/controller/ClassDetailsController.java index 4206d97..8a0c4fd 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/controller/ClassDetailsController.java +++ b/cloud-server-account/src/main/java/com/dsh/account/controller/ClassDetailsController.java @@ -1,7 +1,7 @@ package com.dsh.account.controller; -import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dsh.account.model.vo.classDetails.classInsVo.StuDetailsReq; import com.dsh.account.util.DateUtil; import com.dsh.account.entity.TStudent; @@ -10,12 +10,17 @@ import com.dsh.account.model.vo.classDetails.classInsVo.StuPhysicalVo; 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 com.dsh.account.util.ToolUtil; import io.swagger.annotations.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -29,7 +34,7 @@ @Api @CrossOrigin @RestController -@RequestMapping("/startCource") +@RequestMapping("/base/startCource") public class ClassDetailsController { private Logger logger = LoggerFactory.getLogger("business-log"); @@ -40,91 +45,122 @@ @Autowired private TAppUserService tappuService; + @Autowired + private TokenUtil tokenUtil; + @ResponseBody @PostMapping("/stu/queryStudentData") - @ApiOperation(value = "根据登录用户ID查询学员信息", tags = {"用户——学员信息"}, notes = "") + @ApiOperation(value = "根据登录用户ID查询学员信息", tags = {"APP-开始上课-用户学员信息"}, notes = "") @ApiImplicitParams({ - @ApiImplicitParam(value = "用户id", name = "id", required = true, dataType = "int"), + @ApiImplicitParam(value = "经度值", name = "longitude", required = true, dataType = "String"), + @ApiImplicitParam(value = "纬度值", name = "latitude", required = true, dataType = "String"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) - public ClassInfoVo queryCouponRecord(@RequestBody Integer id){ + public ResultUtil queryCouponRecord(String longitude,String latitude,HttpServletRequest request){ try { - return tappuService.queryUserOfStus(id); + Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(request); + if(null == userIdFormRedis){ + return ResultUtil.tokenErr(); + } + return ResultUtil.success(tappuService.queryUserOfStus(userIdFormRedis,longitude,latitude)); }catch (Exception e){ e.printStackTrace(); - return null; + return ResultUtil.runErr(ResultUtil.ERROR); } } - /** - * 获取学员测试报告 - */ + @ResponseBody @PostMapping("/stu/queryPhysical") - public StuPhysicalVo getStuPhysicalInfo(@RequestBody Integer stuID){ + @ApiOperation(value = "获取学员测试报告", tags = {"APP-开始上课-获取学员测试报告"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "学员id", name = "id", required = true, dataType = "int"), + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResultUtil<StuPhysicalVo> getStuPhysicalInfo(@RequestBody Integer stuID){ StuPhysicalVo vo = new StuPhysicalVo(); - TStudent tStudent = istuService.selectById(stuID); - vo.setBmi(tStudent.getBmi()); - vo.setUrl(tStudent.getLateralSurface()); - vo.setHeight(tStudent.getHeight()); - vo.setWeight(tStudent.getWeight()); - return vo; + TStudent tStudent = istuService.getById(stuID); + if (ToolUtil.isNotEmpty(tStudent)){ + vo.setBmi(tStudent.getBmi()); + vo.setUrl(tStudent.getLateralSurface()); + vo.setHeight(tStudent.getHeight()); + vo.setWeight(tStudent.getWeight()); + } + return ResultUtil.success(vo); } /** * 添加学员信息 */ + @ResponseBody @PostMapping("/stu/addData") - public void addStu(@RequestBody StuDetailsReq stu){ - TStudent student = new TStudent(); - student.setAppUserId(stu.getUserID()); - student.setName(stu.getName()); - student.setHeadImg(stu.getHeadImg()); - student.setPhone(stu.getPhone()); - student.setSex(stu.getSex()); - student.setIdCard(stu.getIdCard()); - student.setBirthday(new Date(stu.getBirthday())); - student.setHeight(stu.getHeight()); - student.setWeight(stu.getWeight()); - BigDecimal bigDecimal = BigDecimal.valueOf(stu.getWeight()); - BigDecimal multiply = bigDecimal.subtract(BigDecimal.valueOf(stu.getHeight())).multiply(bigDecimal.subtract(BigDecimal.valueOf(stu.getHeight()))); - multiply.setScale(2); - student.setBmi(multiply.doubleValue()); - student.setInsertTime(new Date()); - student.setState(1); - istuService.insert(student); + @ApiOperation(value = "添加学员信息", tags = {"APP-开始上课-添加学员信息"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "学员信息", name = "stu", required = true, dataType = "int"), + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + @Transactional + public ResultUtil addStu(@RequestBody StuDetailsReq stu,HttpServletRequest request){ + try { + Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(request); + if(null == userIdFormRedis){ + return ResultUtil.tokenErr(); + } + istuService.addStuOfAppUser(stu,userIdFormRedis); + return ResultUtil.success(); + }catch (Exception e){ + return ResultUtil.runErr(ResultUtil.ERROR); + } } /** * 该APP用户下的学员列表 */ + @ResponseBody @PostMapping("/stu/listOfStu") - public List<StuListVo> queryStuList(@RequestBody Integer appUserID){ - List<StuListVo> stuListVos = new ArrayList<>(); - List<TStudent> tStudents = istuService.selectList(new EntityWrapper<TStudent>() - .eq("appUserId",appUserID)); - if (tStudents.size() > 0){ - tStudents.forEach(sts -> { - StuListVo vo = new StuListVo(); - vo.setStuId(sts.getId()); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); - vo.setBirthday(simpleDateFormat.format(sts.getBirthday())); - vo.setStuName(sts.getName()); - vo.setStuAge(DateUtil.age(sts.getBirthday())); - vo.setStuHeight(sts.getHeight()); - vo.setStuWeight(sts.getWeight()); - vo.setIsNot(sts.getIsDefault()); - }); + @ApiOperation(value = "该APP用户下的学员列表", tags = {"APP-开始上课-学员列表"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResultUtil queryStuList(HttpServletRequest request){ + try { + Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(request); + if(null == userIdFormRedis){ + return ResultUtil.tokenErr(); + } + List<StuListVo> stuListVos = new ArrayList<>(); + List<TStudent> tStudents = istuService.list(new QueryWrapper<TStudent>() + .eq("appUserId",userIdFormRedis)); + if (tStudents.size() > 0){ + tStudents.forEach(sts -> { + StuListVo vo = new StuListVo(); + vo.setStuId(sts.getId()); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + vo.setBirthday(simpleDateFormat.format(sts.getBirthday())); + vo.setStuName(sts.getName()); + vo.setStuAge(DateUtil.age(sts.getBirthday())); + vo.setStuHeight(sts.getHeight()); + vo.setStuWeight(sts.getWeight()); + vo.setIsNot(sts.getIsDefault()); + }); + } + return ResultUtil.success(stuListVos); + }catch (Exception e){ + return ResultUtil.runErr(ResultUtil.ERROR); } - return stuListVos; } /** * 课时详情 */ + @ResponseBody @PostMapping("/stu/lessonDetails") + @ApiOperation(value = "该APP用户下的学员列表", tags = {"APP-开始上课-学员列表"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) public void coursePackageDetails(@RequestBody Integer lessonId){ } diff --git a/cloud-server-account/src/main/java/com/dsh/account/entity/TAppUser.java b/cloud-server-account/src/main/java/com/dsh/account/entity/TAppUser.java index f93d94c..02bdfc1 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/entity/TAppUser.java +++ b/cloud-server-account/src/main/java/com/dsh/account/entity/TAppUser.java @@ -1,12 +1,11 @@ package com.dsh.account.entity; -import com.baomidou.mybatisplus.enums.IdType; import java.util.Date; -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.activerecord.Model; -import com.baomidou.mybatisplus.annotations.TableName; import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -23,7 +22,7 @@ @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("t_app_user") -public class TAppUser extends Model<TAppUser> { +public class TAppUser{ private static final long serialVersionUID = 1L; @@ -129,10 +128,5 @@ */ private String headImg; - - @Override - protected Serializable pkVal() { - return this.id; - } } diff --git a/cloud-server-account/src/main/java/com/dsh/account/entity/TStudent.java b/cloud-server-account/src/main/java/com/dsh/account/entity/TStudent.java index 972663b..f059637 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/entity/TStudent.java +++ b/cloud-server-account/src/main/java/com/dsh/account/entity/TStudent.java @@ -1,12 +1,11 @@ package com.dsh.account.entity; -import com.baomidou.mybatisplus.enums.IdType; import java.util.Date; -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.activerecord.Model; -import com.baomidou.mybatisplus.annotations.TableName; import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -23,7 +22,7 @@ @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("t_student") -public class TStudent extends Model<TStudent> { +public class TStudent{ private static final long serialVersionUID = 1L; @@ -89,10 +88,5 @@ */ private Integer isDefault; - - @Override - protected Serializable pkVal() { - return this.id; - } } diff --git a/cloud-server-account/src/main/java/com/dsh/account/feignclient/course/CoursePaymentClient.java b/cloud-server-account/src/main/java/com/dsh/account/feignclient/course/CoursePaymentClient.java new file mode 100644 index 0000000..04747b0 --- /dev/null +++ b/cloud-server-account/src/main/java/com/dsh/account/feignclient/course/CoursePaymentClient.java @@ -0,0 +1,15 @@ +package com.dsh.account.feignclient.course; + +import com.dsh.account.feignclient.course.model.StuCourseResp; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +@FeignClient(value = "mb-cloud-course") +public interface CoursePaymentClient { + + + @PostMapping("/coursePack/queryPayment") + List<StuCourseResp> getStuCoursePayment(); +} diff --git a/cloud-server-account/src/main/java/com/dsh/account/feignclient/course/model/StuCourseResp.java b/cloud-server-account/src/main/java/com/dsh/account/feignclient/course/model/StuCourseResp.java new file mode 100644 index 0000000..b6094b5 --- /dev/null +++ b/cloud-server-account/src/main/java/com/dsh/account/feignclient/course/model/StuCourseResp.java @@ -0,0 +1,25 @@ +package com.dsh.account.feignclient.course.model; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +public class StuCourseResp { + + @ApiModelProperty(value = "课包id") + private Integer courseId; + + @ApiModelProperty(value = "课包名称") + private String courseName; + + @ApiModelProperty(value = "总课时数") + private int totalCourseNums; + + + @ApiModelProperty(value = "已扣课时数") + private int deductionNums; + + @ApiModelProperty(value = "剩余课时数") + private int residueNums; +} diff --git a/cloud-server-account/src/main/java/com/dsh/account/feignclient/course/model/TCoursePackagePayment.java b/cloud-server-account/src/main/java/com/dsh/account/feignclient/course/model/TCoursePackagePayment.java new file mode 100644 index 0000000..f0dfe8e --- /dev/null +++ b/cloud-server-account/src/main/java/com/dsh/account/feignclient/course/model/TCoursePackagePayment.java @@ -0,0 +1,92 @@ +package com.dsh.account.feignclient.course.model; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class TCoursePackagePayment { + + /** + * 主键 + */ + private Integer id; + /** + * 用户id + */ + private Integer appUserId; + /** + * 学员id + */ + private Integer studentId; + /** + * 课包id + */ + private Integer coursePackageId; + /** + * 支付方式(1=现金,2=玩湃币) + */ + private Integer payType; + /** + * 课时数 + */ + private Integer classHours; + /** + * 现金支付价格 + */ + private BigDecimal cashPayment; + /** + * 玩湃币价格 + */ + private Integer playPaiCoin; + /** + * 总课时 + */ + private Integer totalClassHours; + /** + * 剩余课时 + */ + private Integer laveClassHours; + /** + * 缺课次数 + */ + private Integer absencesNumber; + /** + * 支付用户类型(1=用户,2=管理员) + */ + private Integer payUserType; + /** + * 支付状态(1=待支付,2=已支付) + */ + private Integer payStatus; + /** + * 第三方支付流水号 + */ + private String orderNumber; + /** + * 支付用户id + */ + private Integer payUserId; + /** + * 课程状态(1=正常,2=已退课) + */ + private Integer status; + /** + * 退课时间 + */ + private Date withdrawalTime; + /** + * 退课凭证 + */ + private String certificate; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + private Integer state; + /** + * 添加时间 + */ + private Date insertTime; + +} diff --git a/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/model/TImgConfig.java b/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/model/TImgConfig.java index c71757f..b6f7507 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/model/TImgConfig.java +++ b/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/model/TImgConfig.java @@ -1,10 +1,6 @@ package com.dsh.account.feignclient.other.model; -import com.baomidou.mybatisplus.activerecord.Model; -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.enums.IdType; import lombok.Data; -import lombok.EqualsAndHashCode; import java.io.Serializable; @@ -16,16 +12,14 @@ * @author administrator * @since 2023-06-13 */ -@EqualsAndHashCode(callSuper = true) @Data -public class TImgConfig extends Model<TImgConfig> { +public class TImgConfig { private static final long serialVersionUID = 1L; /** * 主键 */ - @TableId(value = "id", type = IdType.AUTO) private Integer id; /** * 位置(1=无学员,2=成为会员,3=我的券包,4=线上商城,5=本周福利,6=今日免费) @@ -35,11 +29,5 @@ * 图片配置JSON */ private String content; - - - @Override - protected Serializable pkVal() { - return this.id; - } } diff --git a/cloud-server-account/src/main/java/com/dsh/account/mapper/TAppUserMapper.java b/cloud-server-account/src/main/java/com/dsh/account/mapper/TAppUserMapper.java index 0db7df9..d77da72 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/mapper/TAppUserMapper.java +++ b/cloud-server-account/src/main/java/com/dsh/account/mapper/TAppUserMapper.java @@ -1,7 +1,8 @@ package com.dsh.account.mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dsh.account.entity.TAppUser; -import com.baomidou.mybatisplus.mapper.BaseMapper; + /** * <p> diff --git a/cloud-server-account/src/main/java/com/dsh/account/mapper/TStudentMapper.java b/cloud-server-account/src/main/java/com/dsh/account/mapper/TStudentMapper.java index bb28ded..fda3fc3 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/mapper/TStudentMapper.java +++ b/cloud-server-account/src/main/java/com/dsh/account/mapper/TStudentMapper.java @@ -1,7 +1,8 @@ package com.dsh.account.mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dsh.account.entity.TStudent; -import com.baomidou.mybatisplus.mapper.BaseMapper; + /** * <p> diff --git a/cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/classInsVo/ClassInfoVo.java b/cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/classInsVo/ClassInfoVo.java index 27360aa..49cc40b 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/classInsVo/ClassInfoVo.java +++ b/cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/classInsVo/ClassInfoVo.java @@ -18,6 +18,9 @@ @ApiModelProperty(value = "没有学员信息 对应的banner图") private String imgs; + @ApiModelProperty(value = "学员id") + private String stuId; + @ApiModelProperty(value = "学员头像") private String stuImg; diff --git a/cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/classInsVo/StuDetailsReq.java b/cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/classInsVo/StuDetailsReq.java index 78f8fdf..d20ed76 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/classInsVo/StuDetailsReq.java +++ b/cloud-server-account/src/main/java/com/dsh/account/model/vo/classDetails/classInsVo/StuDetailsReq.java @@ -29,8 +29,4 @@ @ApiModelProperty(value = "身份证号码") private String idCard; - - @ApiModelProperty(value = "用户id") - private Integer userID; - } diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java b/cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java index 1232e65..f4407f6 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/TAppUserService.java @@ -1,9 +1,9 @@ package com.dsh.account.service; import com.dsh.account.entity.TAppUser; -import com.baomidou.mybatisplus.service.IService; import com.dsh.account.model.vo.classDetails.classInsVo.ClassInfoVo; import com.dsh.account.util.ResultUtil; +import com.baomidou.mybatisplus.extension.service.IService; /** * <p> @@ -15,7 +15,7 @@ */ public interface TAppUserService extends IService<TAppUser> { - ClassInfoVo queryUserOfStus(Integer id); + ClassInfoVo queryUserOfStus(Integer id,String longitude,String latitude); /** diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/TStudentService.java b/cloud-server-account/src/main/java/com/dsh/account/service/TStudentService.java index e8c837b..981ed67 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/TStudentService.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/TStudentService.java @@ -1,7 +1,8 @@ package com.dsh.account.service; +import com.baomidou.mybatisplus.extension.service.IService; import com.dsh.account.entity.TStudent; -import com.baomidou.mybatisplus.service.IService; +import com.dsh.account.model.vo.classDetails.classInsVo.StuDetailsReq; /** * <p> @@ -13,4 +14,6 @@ */ public interface TStudentService extends IService<TStudent> { + void addStuOfAppUser(StuDetailsReq stu,Integer appUserId); + } diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java index 88c8ab8..a146320 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java @@ -1,14 +1,22 @@ package com.dsh.account.service.impl; -import com.baomidou.mybatisplus.mapper.EntityWrapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.dsh.account.feignclient.course.CoursePaymentClient; +import com.dsh.account.feignclient.course.model.StuCourseResp; +import com.dsh.account.feignclient.course.model.TCoursePackagePayment; import com.dsh.account.mapper.TStudentMapper; import com.dsh.account.feignclient.other.ImgConfigClient; import com.dsh.account.feignclient.other.model.TImgConfig; +import com.dsh.account.model.vo.classDetails.RegisteredCourse; import com.dsh.account.service.TAppUserService; import com.dsh.account.entity.TAppUser; import com.dsh.account.entity.TStudent; import com.dsh.account.mapper.TAppUserMapper; import com.dsh.account.model.vo.classDetails.classInsVo.ClassInfoVo; + +import com.dsh.account.util.DateUtil; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.dsh.account.util.ResultUtil; import com.dsh.account.util.ToolUtil; @@ -16,6 +24,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; /** @@ -29,22 +38,62 @@ @Service public class TAppUserServiceImpl extends ServiceImpl<TAppUserMapper, TAppUser> implements TAppUserService { + @Autowired private TStudentMapper tsmapper; @Resource private ImgConfigClient configClient; + @Resource + private CoursePaymentClient paymentClient; @Override - public ClassInfoVo queryUserOfStus(Integer id) { + public ClassInfoVo queryUserOfStus(Integer id,String longitude,String latitude) { TAppUser tAppUser = this.baseMapper.selectById(id); if (ToolUtil.isNotEmpty(tAppUser)){ - List<TStudent> tStudents = tsmapper.selectList(new EntityWrapper<TStudent>() + List<TStudent> tStudents = tsmapper.selectList(new QueryWrapper<TStudent>() .eq("appUserId",tAppUser.getId()) - .eq("state",1)); + .eq("state",1) + .eq("isDefault",1)); ClassInfoVo classInfoVo = new ClassInfoVo(); - if (null != tStudents){ + if (tStudents.size() > 0 ){ + TStudent tStudent = tStudents.get(0); + classInfoVo.setIsThere(1); + classInfoVo.setStuImg(tStudent.getHeadImg()); + classInfoVo.setStuSex(tStudent.getSex()); + classInfoVo.setStuAge(DateUtil.age(tStudent.getBirthday())); + classInfoVo.setStuName(tStudent.getName()); + classInfoVo.setHeight(tStudent.getHeight()); + classInfoVo.setWeight(tStudent.getWeight()); + classInfoVo.setBmi(tStudent.getBmi()); + List<RegisteredCourse> courseList = new ArrayList<>(); +// 总学时数 + int total = 0; +// 已扣数 + int deduct = 0; +// 剩余数 + int remain = 0; + List<StuCourseResp> stuCoursePayment = paymentClient.getStuCoursePayment(); + if (stuCoursePayment.size() > 0){ + for (StuCourseResp tCoursePackagePayment : stuCoursePayment) { + RegisteredCourse course = new RegisteredCourse(); + course.setCourseId(tCoursePackagePayment.getCourseId()); + course.setCourseName(tCoursePackagePayment.getCourseName()); + total = total + (ToolUtil.isEmpty(tCoursePackagePayment.getTotalCourseNums()) ? 0 : tCoursePackagePayment.getTotalCourseNums()); + deduct = deduct + (ToolUtil.isEmpty(tCoursePackagePayment.getDeductionNums()) ? 0 : tCoursePackagePayment.getDeductionNums()); + remain = remain + (ToolUtil.isEmpty(tCoursePackagePayment.getResidueNums())? 0 : tCoursePackagePayment.getResidueNums()); + courseList.add(course); + } + } + classInfoVo.setCourseList(courseList); + + classInfoVo.setTotalNums(total); + classInfoVo.setDeductedNums(deduct); + classInfoVo.setRemainingNums(remain); + + +// classInfoVo.setWeekCourseList(); }else { classInfoVo.setIsThere(2); List<TImgConfig> tImgConfigs = configClient.getNoneStuImgs(); @@ -57,6 +106,7 @@ } + /** * 获取短信验证码 * @param type 1:登录,2:注册,3:修改密码,4:忘记密码 diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java index dd46b96..bd7438f 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java @@ -1,10 +1,15 @@ package com.dsh.account.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.dsh.account.entity.TStudent; import com.dsh.account.mapper.TStudentMapper; +import com.dsh.account.model.vo.classDetails.classInsVo.StuDetailsReq; import com.dsh.account.service.TStudentService; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; + import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.Date; /** * <p> @@ -17,4 +22,24 @@ @Service public class TStudentServiceImpl extends ServiceImpl<TStudentMapper, TStudent> implements TStudentService { + @Override + public void addStuOfAppUser(StuDetailsReq stu,Integer appUserId) { + TStudent student = new TStudent(); + student.setAppUserId(appUserId); + student.setName(stu.getName()); + student.setHeadImg(stu.getHeadImg()); + student.setPhone(stu.getPhone()); + student.setSex(stu.getSex()); + student.setIdCard(stu.getIdCard()); + student.setBirthday(new Date(stu.getBirthday())); + student.setHeight(stu.getHeight()); + student.setWeight(stu.getWeight()); + BigDecimal bigDecimal = BigDecimal.valueOf(stu.getWeight()); + BigDecimal multiply = bigDecimal.subtract(BigDecimal.valueOf(stu.getHeight())).multiply(bigDecimal.subtract(BigDecimal.valueOf(stu.getHeight()))); + multiply.setScale(2); + student.setBmi(multiply.doubleValue()); + student.setInsertTime(new Date()); + student.setState(1); + this.baseMapper.insert(student); + } } diff --git a/cloud-server-account/src/main/java/com/dsh/account/util/CodeGeneration.java b/cloud-server-account/src/main/java/com/dsh/account/util/CodeGeneration.java deleted file mode 100644 index 9ab5dc2..0000000 --- a/cloud-server-account/src/main/java/com/dsh/account/util/CodeGeneration.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.dsh.account.util; - -import com.baomidou.mybatisplus.enums.IdType; -import com.baomidou.mybatisplus.generator.AutoGenerator; -import com.baomidou.mybatisplus.generator.config.*; -import com.baomidou.mybatisplus.generator.config.rules.DbType; -import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; - -public class CodeGeneration { - - public static void gen(String tableName){ - - //C:\Users\linla\Desktop\project02\guns-admin - //项目目录 - ///Users/java/IdeaProjects/PlayPai_demo/cloud-server-account/src/main/java/com/dsh/app - String projectPath = "/Users/java/IdeaProjects/PlayPai_demo/cloud-server-account/src/main/java/"; //System.getProperty("user.dir"); - //String projectPath =System.getProperty("user.dir"); - AutoGenerator mpg = new AutoGenerator(); - //全局配置 - GlobalConfig gc = new GlobalConfig(); - gc.setOutputDir(projectPath ); - gc.setFileOverride(true); - gc.setActiveRecord(true);//不需要ActiveRecord特性的请改为false - gc.setEnableCache(false);//XML二级缓存 - gc.setBaseResultMap(true);//XML ResultMap - gc.setBaseColumnList(false);//XML columList - gc.setIdType(IdType.UUID); - gc.setAuthor("administrator");//作者 - gc.setOpen(false);//生成完成不打开文件夹 - - //自定义文件命名,注意%s 会自动填充表实体属性 - gc.setServiceName("%sService"); - gc.setServiceImplName("%sServiceImpl"); - gc.setMapperName("%sMapper"); - gc.setXmlName("%sMapper"); - gc.setControllerName("%sController"); - mpg.setGlobalConfig(gc); - - //数据源配置 - DataSourceConfig dsc = new DataSourceConfig(); - dsc.setDbType(DbType.MYSQL); -// dsc.setUrl("jdbc:mysql://192.168.110.80:3306/playpai_account?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8"); - dsc.setUrl("jdbc:mysql://127.0.0.1:3306/playpai_account?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8"); - dsc.setDriverName("com.mysql.cj.jdbc.Driver"); - dsc.setUsername("root"); - dsc.setPassword("earl9096"); - mpg.setDataSource(dsc); - - //数据库表配置 - StrategyConfig strategy = new StrategyConfig(); - strategy.setTablePrefix(new String[]{});//此处可以修改您的表前缀 - strategy.setNaming(NamingStrategy.underline_to_camel);//表名生成策略 - strategy.setInclude(new String[]{tableName});//需要生成的表 - strategy.setRestControllerStyle(true); - strategy.setEntityLombokModel(true); - strategy.setSuperServiceClass(null); - strategy.setSuperServiceImplClass(null); - strategy.setSuperMapperClass(null); - mpg.setStrategy(strategy); - - //模板配置 - TemplateConfig template=new TemplateConfig(); - //不生成controller - template.setController(null); - //不生成xml文件 - //template.setXml(null); - mpg.setTemplate(template); - //包配置 - PackageConfig pc = new PackageConfig(); - pc.setParent("com.dsh.app"); - pc.setEntity("entity"); - pc.setService("service"); - pc.setServiceImpl("service.impl"); - pc.setMapper("mapper"); - - pc.setXml("mapper.xml"); - -// pc.setController("controller.member"); - mpg.setPackageInfo(pc); - - //执行生成 - mpg.execute(); - } - - public static void main(String[] args) { - gen("t_app_user"); - } -} diff --git a/cloud-server-course/pom.xml b/cloud-server-course/pom.xml index 95aae90..583402e 100644 --- a/cloud-server-course/pom.xml +++ b/cloud-server-course/pom.xml @@ -55,26 +55,14 @@ <!-- mybatis generertor--> <dependency> - <groupId>com.baomidou</groupId> - <artifactId>mybatisplus-spring-boot-starter</artifactId> - <version>1.0.5</version> - </dependency> - - <dependency> - <groupId>com.baomidou</groupId> - <artifactId>mybatis-plus</artifactId> - <version>3.4.1</version> - </dependency> - <dependency> - <groupId>com.baomidou</groupId> - <artifactId>mybatis-plus-generate</artifactId> - <version>2.3</version> - </dependency> - <dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity</artifactId> <version>1.7</version> </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + </dependency> <dependency> <groupId>org.freemarker</groupId> diff --git a/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java b/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java new file mode 100644 index 0000000..38fcd54 --- /dev/null +++ b/cloud-server-course/src/main/java/com/dsh/course/controller/CoursePackagePaymentController.java @@ -0,0 +1,56 @@ +package com.dsh.course.controller; + + +import com.dsh.course.entity.TCoursePackage; +import com.dsh.course.entity.TCoursePackagePayment; +import com.dsh.course.feignclient.model.StuCourseResp; +import com.dsh.course.service.TCoursePackageService; +import com.dsh.course.servs.CoursePackagePaymentRepository; +import io.swagger.annotations.Api; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; + +@Api +@CrossOrigin +@RestController +@RequestMapping("") +public class CoursePackagePaymentController { + + private Logger logger = LoggerFactory.getLogger("business-log"); + + @Autowired + private CoursePackagePaymentRepository coursePackagePaymentRepository; + + @Autowired + private TCoursePackageService tcpService; + + /** + * 获取 没有学员信息的图片配置 + */ + @PostMapping("/coursePack/queryPayment") + public List<StuCourseResp> getStuCoursePackagePayment(Integer stuId){ + List<StuCourseResp> resps = new ArrayList<>(); + List<TCoursePackagePayment> byUserId = coursePackagePaymentRepository.findByUserId(stuId); + if (byUserId.size() > 0 ){ + for (TCoursePackagePayment tCoursePackagePayment : byUserId) { + TCoursePackage tCoursePackage = tcpService.getById(tCoursePackagePayment.getCoursePackageId()); + StuCourseResp resp = new StuCourseResp(); + resp.setCourseId(tCoursePackage.getId()); + resp.setCourseName(tCoursePackage.getName()); + resp.setTotalCourseNums(tCoursePackagePayment.getTotalClassHours()); + resp.setResidueNums(tCoursePackagePayment.getLaveClassHours()); + resp.setDeductionNums(tCoursePackagePayment.getTotalClassHours()-tCoursePackagePayment.getLaveClassHours()); + } + } + return resps; + } + +} diff --git a/cloud-server-course/src/main/java/com/dsh/course/entity/TCourse.java b/cloud-server-course/src/main/java/com/dsh/course/entity/TCourse.java index 031cf04..2b85182 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/entity/TCourse.java +++ b/cloud-server-course/src/main/java/com/dsh/course/entity/TCourse.java @@ -1,12 +1,12 @@ package com.dsh.course.entity; -import com.baomidou.mybatisplus.enums.IdType; + import java.util.Date; -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.activerecord.Model; -import com.baomidou.mybatisplus.annotations.TableName; import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -23,9 +23,8 @@ @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("t_course") -public class TCourse extends Model<TCourse> { +public class TCourse { - private static final long serialVersionUID = 1L; /** * 主键 @@ -65,10 +64,5 @@ */ private Date insertTime; - - @Override - protected Serializable pkVal() { - return this.id; - } } diff --git a/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackage.java b/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackage.java index f1c59a5..e1cc65b 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackage.java +++ b/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackage.java @@ -1,12 +1,12 @@ package com.dsh.course.entity; -import com.baomidou.mybatisplus.enums.IdType; import java.util.Date; -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.activerecord.Model; -import com.baomidou.mybatisplus.annotations.TableName; + import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -23,9 +23,8 @@ @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("t_course_package") -public class TCoursePackage extends Model<TCoursePackage> { +public class TCoursePackage { - private static final long serialVersionUID = 1L; /** * 主键 @@ -144,11 +143,5 @@ * 添加时间 */ private Date insertTime; - - - @Override - protected Serializable pkVal() { - return this.id; - } } diff --git a/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackageDiscount.java b/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackageDiscount.java index 84b0fb4..3542754 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackageDiscount.java +++ b/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackageDiscount.java @@ -1,12 +1,11 @@ package com.dsh.course.entity; -import com.baomidou.mybatisplus.enums.IdType; import java.util.Date; -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.activerecord.Model; -import com.baomidou.mybatisplus.annotations.TableName; import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -23,7 +22,7 @@ @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("t_course_package_discount") -public class TCoursePackageDiscount extends Model<TCoursePackageDiscount> { +public class TCoursePackageDiscount { private static final long serialVersionUID = 1L; @@ -61,10 +60,5 @@ */ private Date insertTime; - - @Override - protected Serializable pkVal() { - return this.id; - } } diff --git a/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackagePayment.java b/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackagePayment.java index 9b3f327..ce1e4c1 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackagePayment.java +++ b/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackagePayment.java @@ -1,13 +1,11 @@ package com.dsh.course.entity; -import com.baomidou.mybatisplus.enums.IdType; import java.math.BigDecimal; import java.util.Date; -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.activerecord.Model; -import com.baomidou.mybatisplus.annotations.TableName; -import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -24,9 +22,8 @@ @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("t_course_package_payment") -public class TCoursePackagePayment extends Model<TCoursePackagePayment> { +public class TCoursePackagePayment { - private static final long serialVersionUID = 1L; /** * 主键 @@ -109,11 +106,5 @@ * 添加时间 */ private Date insertTime; - - - @Override - protected Serializable pkVal() { - return this.id; - } } diff --git a/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackageType.java b/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackageType.java index d52d1d8..e30b3e2 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackageType.java +++ b/cloud-server-course/src/main/java/com/dsh/course/entity/TCoursePackageType.java @@ -1,12 +1,12 @@ package com.dsh.course.entity; -import com.baomidou.mybatisplus.enums.IdType; + import java.util.Date; -import com.baomidou.mybatisplus.annotations.TableId; -import com.baomidou.mybatisplus.activerecord.Model; -import com.baomidou.mybatisplus.annotations.TableName; import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -23,7 +23,7 @@ @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("t_course_package_type") -public class TCoursePackageType extends Model<TCoursePackageType> { +public class TCoursePackageType { private static final long serialVersionUID = 1L; @@ -44,11 +44,5 @@ * 添加时间 */ private Date insertTime; - - - @Override - protected Serializable pkVal() { - return this.id; - } } diff --git a/cloud-server-course/src/main/java/com/dsh/course/feignclient/CoursePaymentClient.java b/cloud-server-course/src/main/java/com/dsh/course/feignclient/CoursePaymentClient.java new file mode 100644 index 0000000..a166f5a --- /dev/null +++ b/cloud-server-course/src/main/java/com/dsh/course/feignclient/CoursePaymentClient.java @@ -0,0 +1,16 @@ +package com.dsh.course.feignclient; + + +import com.dsh.course.feignclient.model.StuCourseResp; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +@FeignClient(value = "mb-cloud-course") +public interface CoursePaymentClient { + + + @PostMapping("/coursePack/queryPayment") + List<StuCourseResp> getStuCoursePayment(); +} diff --git a/cloud-server-course/src/main/java/com/dsh/course/feignclient/model/StuCourseResp.java b/cloud-server-course/src/main/java/com/dsh/course/feignclient/model/StuCourseResp.java new file mode 100644 index 0000000..6af2ebc --- /dev/null +++ b/cloud-server-course/src/main/java/com/dsh/course/feignclient/model/StuCourseResp.java @@ -0,0 +1,25 @@ +package com.dsh.course.feignclient.model; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +public class StuCourseResp { + + @ApiModelProperty(value = "课包id") + private Integer courseId; + + @ApiModelProperty(value = "课包名称") + private String courseName; + + @ApiModelProperty(value = "总课时数") + private int totalCourseNums; + + + @ApiModelProperty(value = "已扣课时数") + private int deductionNums; + + @ApiModelProperty(value = "剩余课时数") + private int residueNums; +} diff --git a/cloud-server-course/src/main/java/com/dsh/course/mapper/TCourseMapper.java b/cloud-server-course/src/main/java/com/dsh/course/mapper/TCourseMapper.java index 4bc95bb..0bd1f06 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/mapper/TCourseMapper.java +++ b/cloud-server-course/src/main/java/com/dsh/course/mapper/TCourseMapper.java @@ -1,7 +1,8 @@ package com.dsh.course.mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dsh.course.entity.TCourse; -import com.baomidou.mybatisplus.mapper.BaseMapper; + /** * <p> diff --git a/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageDiscountMapper.java b/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageDiscountMapper.java index 8604b7c..38b7057 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageDiscountMapper.java +++ b/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageDiscountMapper.java @@ -1,7 +1,7 @@ package com.dsh.course.mapper; import com.dsh.course.entity.TCoursePackageDiscount; -import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * <p> diff --git a/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageMapper.java b/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageMapper.java index 842b4e8..1a353bd 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageMapper.java +++ b/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageMapper.java @@ -1,7 +1,7 @@ package com.dsh.course.mapper; import com.dsh.course.entity.TCoursePackage; -import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * <p> diff --git a/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackagePaymentMapper.java b/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackagePaymentMapper.java index db38a06..903c27a 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackagePaymentMapper.java +++ b/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackagePaymentMapper.java @@ -1,7 +1,7 @@ package com.dsh.course.mapper; import com.dsh.course.entity.TCoursePackagePayment; -import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * <p> diff --git a/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageTypeMapper.java b/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageTypeMapper.java index aed0157..7c83a06 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageTypeMapper.java +++ b/cloud-server-course/src/main/java/com/dsh/course/mapper/TCoursePackageTypeMapper.java @@ -1,7 +1,7 @@ package com.dsh.course.mapper; import com.dsh.course.entity.TCoursePackageType; -import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * <p> diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageDiscountService.java b/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageDiscountService.java index 6a5b13b..bb3d830 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageDiscountService.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageDiscountService.java @@ -1,7 +1,8 @@ package com.dsh.course.service; +import com.baomidou.mybatisplus.extension.service.IService; import com.dsh.course.entity.TCoursePackageDiscount; -import com.baomidou.mybatisplus.service.IService; + /** * <p> diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackagePaymentService.java b/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackagePaymentService.java index 5055f10..3448e78 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackagePaymentService.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackagePaymentService.java @@ -1,7 +1,7 @@ package com.dsh.course.service; import com.dsh.course.entity.TCoursePackagePayment; -import com.baomidou.mybatisplus.service.IService; +import com.baomidou.mybatisplus.extension.service.IService; /** * <p> diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageService.java b/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageService.java index f0a0936..95fce81 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageService.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageService.java @@ -1,7 +1,7 @@ package com.dsh.course.service; import com.dsh.course.entity.TCoursePackage; -import com.baomidou.mybatisplus.service.IService; +import com.baomidou.mybatisplus.extension.service.IService; /** * <p> diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageTypeService.java b/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageTypeService.java index 054509e..f7c6e8e 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageTypeService.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/TCoursePackageTypeService.java @@ -1,7 +1,7 @@ package com.dsh.course.service; import com.dsh.course.entity.TCoursePackageType; -import com.baomidou.mybatisplus.service.IService; +import com.baomidou.mybatisplus.extension.service.IService; /** * <p> diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/TCourseService.java b/cloud-server-course/src/main/java/com/dsh/course/service/TCourseService.java index 2a4063a..01edbae 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/TCourseService.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/TCourseService.java @@ -1,7 +1,7 @@ package com.dsh.course.service; import com.dsh.course.entity.TCourse; -import com.baomidou.mybatisplus.service.IService; +import com.baomidou.mybatisplus.extension.service.IService; /** * <p> diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageDiscountServiceImpl.java b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageDiscountServiceImpl.java index 4a0c06b..112efa9 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageDiscountServiceImpl.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageDiscountServiceImpl.java @@ -1,9 +1,9 @@ package com.dsh.course.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.dsh.course.entity.TCoursePackageDiscount; import com.dsh.course.mapper.TCoursePackageDiscountMapper; import com.dsh.course.service.TCoursePackageDiscountService; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java index 6718064..9347dc8 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java @@ -3,7 +3,7 @@ import com.dsh.course.entity.TCoursePackagePayment; import com.dsh.course.mapper.TCoursePackagePaymentMapper; import com.dsh.course.service.TCoursePackagePaymentService; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java index a5cc0a2..dbeac6f 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java @@ -3,7 +3,7 @@ import com.dsh.course.entity.TCoursePackage; import com.dsh.course.mapper.TCoursePackageMapper; import com.dsh.course.service.TCoursePackageService; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageTypeServiceImpl.java b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageTypeServiceImpl.java index d3ffb0d..5278390 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageTypeServiceImpl.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageTypeServiceImpl.java @@ -3,7 +3,7 @@ import com.dsh.course.entity.TCoursePackageType; import com.dsh.course.mapper.TCoursePackageTypeMapper; import com.dsh.course.service.TCoursePackageTypeService; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** diff --git a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCourseServiceImpl.java b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCourseServiceImpl.java index b89c647..4d41125 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCourseServiceImpl.java +++ b/cloud-server-course/src/main/java/com/dsh/course/service/impl/TCourseServiceImpl.java @@ -3,7 +3,7 @@ import com.dsh.course.entity.TCourse; import com.dsh.course.mapper.TCourseMapper; import com.dsh.course.service.TCourseService; -import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** diff --git a/cloud-server-course/src/main/java/com/dsh/course/servs/CoursePackagePaymentRepository.java b/cloud-server-course/src/main/java/com/dsh/course/servs/CoursePackagePaymentRepository.java new file mode 100644 index 0000000..6f52911 --- /dev/null +++ b/cloud-server-course/src/main/java/com/dsh/course/servs/CoursePackagePaymentRepository.java @@ -0,0 +1,25 @@ +package com.dsh.course.servs; + + +import com.dsh.course.entity.TCoursePackagePayment; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; + +import java.util.List; + +public interface CoursePackagePaymentRepository extends JpaRepository<TCoursePackagePayment, Long> { + @Query(value = "SELECT * FROM t_course_package_payment " + + "UNION ALL " + + "SELECT * FROM t_course_package_payment1 " + + "UNION ALL " + + "SELECT * FROM t_course_package_payment2 " + + "UNION ALL " + + "SELECT * FROM t_course_package_payment3 " + + "UNION ALL " + + "SELECT * FROM t_course_package_payment4 " + + "UNION ALL " + + "SELECT * FROM t_course_package_payment5 " + + "WHERE user_id = :userId", nativeQuery = true) + List<TCoursePackagePayment> findByUserId(@Param ("userId") Integer userId); +} \ No newline at end of file diff --git a/cloud-server-course/src/main/java/com/dsh/course/util/CodeGeneration.java b/cloud-server-course/src/main/java/com/dsh/course/util/CodeGeneration.java deleted file mode 100644 index 67d4f03..0000000 --- a/cloud-server-course/src/main/java/com/dsh/course/util/CodeGeneration.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.dsh.course.util; - -import com.baomidou.mybatisplus.enums.IdType; -import com.baomidou.mybatisplus.generator.AutoGenerator; -import com.baomidou.mybatisplus.generator.config.*; -import com.baomidou.mybatisplus.generator.config.rules.DbType; -import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; - -public class CodeGeneration { - - public static void gen(String tableName){ - - //C:\Users\linla\Desktop\project02\guns-admin - //项目目录 - ///Users/java/IdeaProjects/PlayPai_demo/cloud-server-account/src/main/java/com/dsh/app - String projectPath = "/Users/java/IdeaProjects/PlayPai_demo/cloud-server-course/src/main/java/"; //System.getProperty("user.dir"); - //String projectPath =System.getProperty("user.dir"); - AutoGenerator mpg = new AutoGenerator(); - //全局配置 - GlobalConfig gc = new GlobalConfig(); - gc.setOutputDir(projectPath ); - gc.setFileOverride(true); - gc.setActiveRecord(true);//不需要ActiveRecord特性的请改为false - gc.setEnableCache(false);//XML二级缓存 - gc.setBaseResultMap(true);//XML ResultMap - gc.setBaseColumnList(false);//XML columList - gc.setIdType(IdType.UUID); - gc.setAuthor("administrator");//作者 - gc.setOpen(false);//生成完成不打开文件夹 - - //自定义文件命名,注意%s 会自动填充表实体属性 - gc.setServiceName("%sService"); - gc.setServiceImplName("%sServiceImpl"); - gc.setMapperName("%sMapper"); - gc.setXmlName("%sMapper"); - gc.setControllerName("%sController"); - mpg.setGlobalConfig(gc); - - //数据源配置 - DataSourceConfig dsc = new DataSourceConfig(); - dsc.setDbType(DbType.MYSQL); -// dsc.setUrl("jdbc:mysql://192.168.110.80:3306/playpai_account?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8"); - dsc.setUrl("jdbc:mysql://127.0.0.1:3306/playpai_course?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8"); - dsc.setDriverName("com.mysql.cj.jdbc.Driver"); - dsc.setUsername("root"); - dsc.setPassword("earl9096"); - mpg.setDataSource(dsc); - - //数据库表配置 - StrategyConfig strategy = new StrategyConfig(); - strategy.setTablePrefix(new String[]{});//此处可以修改您的表前缀 - strategy.setNaming(NamingStrategy.underline_to_camel);//表名生成策略 - strategy.setInclude(new String[]{tableName});//需要生成的表 - strategy.setRestControllerStyle(true); - strategy.setEntityLombokModel(true); - strategy.setSuperServiceClass(null); - strategy.setSuperServiceImplClass(null); - strategy.setSuperMapperClass(null); - mpg.setStrategy(strategy); - - //模板配置 - TemplateConfig template=new TemplateConfig(); - //不生成controller - template.setController(null); - //不生成xml文件 - //template.setXml(null); - mpg.setTemplate(template); - //包配置 - PackageConfig pc = new PackageConfig(); - pc.setParent("com.dsh.app"); - pc.setEntity("entity"); - pc.setService("service"); - pc.setServiceImpl("service.impl"); - pc.setMapper("mapper"); - - pc.setXml("mapper.xml"); - -// pc.setController("controller.member"); - mpg.setPackageInfo(pc); - - //执行生成 - mpg.execute(); - } - - public static void main(String[] args) { - gen("t_course_package_discount"); - } -} diff --git a/cloud-server-other/pom.xml b/cloud-server-other/pom.xml index 31d2638..7a62058 100644 --- a/cloud-server-other/pom.xml +++ b/cloud-server-other/pom.xml @@ -75,6 +75,16 @@ <artifactId>swagger-models</artifactId> <version>1.5.22</version> </dependency> + + + <!-- mybatis generertor--> + + <dependency> + <groupId>org.apache.velocity</groupId> + <artifactId>velocity</artifactId> + <version>1.7</version> + </dependency> + <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</artifactId> diff --git a/cloud-server-other/src/main/java/com/dsh/other/entity/TImgConfig.java b/cloud-server-other/src/main/java/com/dsh/other/entity/TImgConfig.java index 10e7b88..998f043 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/entity/TImgConfig.java +++ b/cloud-server-other/src/main/java/com/dsh/other/entity/TImgConfig.java @@ -1,11 +1,9 @@ package com.dsh.other.entity; -import java.io.Serializable; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -22,9 +20,8 @@ @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("t_img_config") -public class TImgConfig extends Model<TImgConfig> { +public class TImgConfig { - private static final long serialVersionUID = 1L; /** * 主键 @@ -39,11 +36,5 @@ * 图片配置JSON */ private String content; - - - @Override - protected Serializable pkVal() { - return this.id; - } } diff --git a/cloud-server-other/src/main/java/com/dsh/other/mapper/TImgConfigMapper.java b/cloud-server-other/src/main/java/com/dsh/other/mapper/TImgConfigMapper.java index eaffc00..a690e64 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/mapper/TImgConfigMapper.java +++ b/cloud-server-other/src/main/java/com/dsh/other/mapper/TImgConfigMapper.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dsh.other.entity.TImgConfig; + /** * <p> * 图片配置 Mapper 接口 diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/TImgConfigService.java b/cloud-server-other/src/main/java/com/dsh/other/service/TImgConfigService.java index f460813..d78a535 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/service/TImgConfigService.java +++ b/cloud-server-other/src/main/java/com/dsh/other/service/TImgConfigService.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.dsh.other.entity.TImgConfig; + /** * <p> * 图片配置 服务类 -- Gitblit v1.7.1