| | |
| | | @ApiImplicitParam(value = "纬度值", name = "latitude", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryCouponRecord(String longitude,String latitude,HttpServletRequest request){ |
| | | public ResultUtil queryCouponRecord( @RequestBody String longitude, @RequestBody String latitude,HttpServletRequest request){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(request); |
| | | if(null == userIdFormRedis){ |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public void coursePackageDetails(@RequestBody Integer lessonId){ |
| | | public ResultUtil coursePackageDetails(@RequestBody Integer lessonId, @RequestBody Integer stuId, HttpServletRequest request){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(request); |
| | | if(null == userIdFormRedis){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | |
| | | return ResultUtil.success(istuService.querySessionDetailsDt(userIdFormRedis,lessonId,stuId)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(ResultUtil.ERROR); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.dsh.account.feignclient.competition; |
| | | |
| | | |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | |
| | | @FeignClient(value = "mb-cloud-competition") |
| | | public interface DeductionCompetitionsClient { |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.feignclient.course; |
| | | |
| | | |
| | | import com.dsh.account.feignclient.course.model.StuSessionDetailsVo; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.List; |
| | | |
| | | @FeignClient(value = "mb-cloud-course") |
| | | public interface CourseSessionNameClient { |
| | | |
| | | |
| | | @PostMapping("/coursePack/sessionNames") |
| | | List<StuSessionDetailsVo> getStuSessionList(Integer stuId, Integer appUserId); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.account.feignclient.course.model; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StuSessionDetailsVo { |
| | | |
| | | @ApiModelProperty(value = "课时id") |
| | | private Integer sessionid; |
| | | |
| | | @ApiModelProperty(value = "课时名称") |
| | | private String sessionName; |
| | | |
| | | @ApiModelProperty(value = "课时有效期") |
| | | private String periodOfValidity; |
| | | |
| | | } |
| | |
| | | @Data |
| | | public class WeekedCourse { |
| | | |
| | | @ApiModelProperty(value = "是否为当天 1 是 2 否") |
| | | private Integer isToday; |
| | | |
| | | @ApiModelProperty(value = "星期缩写") |
| | | private String weekStr; |
| | | |
| | | @ApiModelProperty(value = "星期数值") |
| | | private Integer weekNum; |
| | | |
| | | @ApiModelProperty(value = "日期") |
| | | private String dayStr; |
| | | |
| | | @ApiModelProperty(value = "课包列表") |
| | | private List<CourseVenue> details; |
New file |
| | |
| | | package com.dsh.account.model.vo.classDetails.classInsVo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | @Data |
| | | public class ClassDataDetails { |
| | | |
| | | @ApiModelProperty(value = "已扣课时数") |
| | | private Integer deductionClassHours; |
| | | |
| | | @ApiModelProperty(value = "类型变动记录") |
| | | private List<PurchaseRecordVo> recordVos; |
| | | } |
New file |
| | |
| | | package com.dsh.account.model.vo.classDetails.classInsVo; |
| | | |
| | | import com.dsh.account.feignclient.course.model.StuSessionDetailsVo; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ClassDetailsInsVo { |
| | | |
| | | @ApiModelProperty(value = "学员id") |
| | | private Integer stuId; |
| | | |
| | | @ApiModelProperty(value = "学员头像") |
| | | private String stuImage; |
| | | |
| | | @ApiModelProperty(value = "学员姓名") |
| | | private String stuName; |
| | | |
| | | @ApiModelProperty(value = "课时有效期(xxxx-xx-xx)") |
| | | private String periodOfValidity; |
| | | |
| | | @ApiModelProperty(value = "总学时数") |
| | | private Integer totalNums; |
| | | |
| | | @ApiModelProperty(value = "已扣学时数") |
| | | private Integer deductedNums; |
| | | |
| | | @ApiModelProperty(value = "剩余学时数") |
| | | private Integer remainingNums; |
| | | |
| | | @ApiModelProperty(value = "课包名称列表") |
| | | private List<StuSessionDetailsVo> sessionNames; |
| | | |
| | | @ApiModelProperty(value = "课包列表") |
| | | private List<ClassDataDetails> details; |
| | | |
| | | } |
| | |
| | | private String imgs; |
| | | |
| | | @ApiModelProperty(value = "学员id") |
| | | private String stuId; |
| | | private Integer stuId; |
| | | |
| | | @ApiModelProperty(value = "学员头像") |
| | | private String stuImg; |
New file |
| | |
| | | package com.dsh.account.model.vo.classDetails.classInsVo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 类型实体类: |
| | | * 类型:购买课包、消课、报名赛事、介绍有礼 |
| | | */ |
| | | |
| | | @Data |
| | | public class PurchaseRecordVo { |
| | | |
| | | @ApiModelProperty(value = "类型名称") |
| | | private String purchaseType; |
| | | |
| | | @ApiModelProperty(value = "类型变动时间") |
| | | private String purchaseTime; |
| | | |
| | | @ApiModelProperty(value = "类型涉及金额") |
| | | private String purchaseAmount; |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.account.entity.TStudent; |
| | | import com.dsh.account.model.vo.classDetails.classInsVo.ClassDetailsInsVo; |
| | | import com.dsh.account.model.vo.classDetails.classInsVo.StuDetailsReq; |
| | | |
| | | /** |
| | |
| | | |
| | | void addStuOfAppUser(StuDetailsReq stu,Integer appUserId); |
| | | |
| | | ClassDetailsInsVo querySessionDetailsDt(Integer userIdFormRedis, Integer lessonId, Integer stuId); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.entity.TStudent; |
| | | import com.dsh.account.enums.WeeksEnum; |
| | | import com.dsh.account.feignclient.course.CoursePaymentClient; |
| | | import com.dsh.account.feignclient.course.model.CourseOfStoreVo; |
| | | import com.dsh.account.feignclient.course.model.StuCourseResp; |
| | |
| | | .eq("isDefault",1)); |
| | | if (tStudents.size() > 0 ){ |
| | | TStudent tStudent = tStudents.get(0); |
| | | classInfoVo.setStuId(tStudent.getId()); |
| | | classInfoVo.setIsThere(1); |
| | | classInfoVo.setStuImg(tStudent.getHeadImg()); |
| | | classInfoVo.setStuSex(tStudent.getSex()); |
| | |
| | | */ |
| | | public List<WeekedCourse> dealDatas(List<CourseOfStoreVo> storeOfCourses,String longitude ,String latitude){ |
| | | List<WeekedCourse> weekedCourses = new ArrayList<>(); |
| | | int weekStr = LocalDateTimeUtils.getWeekStr(); |
| | | for (int i = 1; i < 8; i++) { |
| | | WeekedCourse weekedCourse = new WeekedCourse(); |
| | | weekedCourse.setWeekNum(i); |
| | | weekedCourse.setWeekStr(WeeksEnum.getStr(i)); |
| | | String weekOfDays = LocalDateTimeUtils.getWeekOfDays(i); |
| | | weekedCourse.setDayStr(weekOfDays); |
| | | List<CourseVenue> courseVenues = new ArrayList<>(); |
| | | if (weekStr == i) { |
| | | weekedCourse.setIsToday(1); |
| | | } else { |
| | | weekedCourse.setIsToday(2); |
| | | } |
| | | Map<Integer, List<CourseOfStoreVo>> map = storeOfCourses.stream().collect(Collectors.groupingBy(CourseOfStoreVo::getStoreId)); |
| | | for (Map.Entry<Integer, List<CourseOfStoreVo>> integerListEntry : map.entrySet()) { |
| | | List<CourseOfStoreVo> value = integerListEntry.getValue(); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.account.entity.TStudent; |
| | | import com.dsh.account.feignclient.course.CourseSessionNameClient; |
| | | import com.dsh.account.feignclient.course.model.StuSessionDetailsVo; |
| | | import com.dsh.account.mapper.TStudentMapper; |
| | | import com.dsh.account.model.vo.classDetails.classInsVo.ClassDetailsInsVo; |
| | | import com.dsh.account.model.vo.classDetails.classInsVo.StuDetailsReq; |
| | | import com.dsh.account.service.TStudentService; |
| | | |
| | | import com.dsh.account.util.ToolUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TStudentServiceImpl extends ServiceImpl<TStudentMapper, TStudent> implements TStudentService { |
| | | |
| | | @Autowired |
| | | private CourseSessionNameClient sessionNameClient; |
| | | |
| | | @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.setPhone(ToolUtil.isNotEmpty(stu.getPhone()) ? stu.getPhone() : ""); |
| | | student.setSex(stu.getSex()); |
| | | student.setIdCard(stu.getIdCard()); |
| | | student.setIdCard(ToolUtil.isNotEmpty(stu.getIdCard())?stu.getIdCard() : ""); |
| | | student.setBirthday(new Date(stu.getBirthday())); |
| | | student.setHeight(stu.getHeight()); |
| | | student.setWeight(stu.getWeight()); |
| | |
| | | student.setState(1); |
| | | this.baseMapper.insert(student); |
| | | } |
| | | |
| | | @Override |
| | | public ClassDetailsInsVo querySessionDetailsDt(Integer userIdFormRedis, Integer lessonId, Integer stuId) { |
| | | ClassDetailsInsVo insVo = new ClassDetailsInsVo(); |
| | | List<StuSessionDetailsVo> stuSessionList = sessionNameClient.getStuSessionList(stuId,userIdFormRedis); |
| | | TStudent tStudent = this.baseMapper.selectById(stuId); |
| | | if (ToolUtil.isNotEmpty(tStudent)){ |
| | | insVo.setStuId(tStudent.getId()); |
| | | insVo.setStuName(tStudent.getName()); |
| | | insVo.setStuImage(tStudent.getHeadImg()); |
| | | |
| | | insVo.setSessionNames(stuSessionList); |
| | | |
| | | } |
| | | |
| | | return insVo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.competition.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-06-26 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/competition") |
| | | public class CompetitionController { |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.dsh.competition.controller; |
| | | |
| | | |
| | | import com.dsh.competition.feignclient.model.ClassDataDetails; |
| | | import com.dsh.competition.feignclient.model.PurchaseRecordVo; |
| | | import com.dsh.competition.service.UserCompetitionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 赛事报名记录 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-06-26 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/user-competition") |
| | | public class UserCompetitionController { |
| | | |
| | | |
| | | @Autowired |
| | | private UserCompetitionService ucService; |
| | | |
| | | /** |
| | | * 获取报名赛事的课时扣减记录 |
| | | */ |
| | | @PostMapping("/deRecord") |
| | | public List<ClassDataDetails> getDeductionRecordOfRegistrationEvent(@RequestBody Integer appUserId,@RequestBody String startTime,@RequestBody String endTime){ |
| | | List<ClassDataDetails> details = new ArrayList<>(); |
| | | List<PurchaseRecordVo> recordVos = ucService.queryDeRecordDetails(appUserId,startTime,endTime); |
| | | |
| | | |
| | | return details; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.dsh.competition.entity; |
| | | |
| | | 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; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-06-26 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("t_competition") |
| | | public class Competition extends Model<Competition> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 省 |
| | | */ |
| | | private String province; |
| | | /** |
| | | * 省编号 |
| | | */ |
| | | private String provinceCode; |
| | | /** |
| | | * 市 |
| | | */ |
| | | private String city; |
| | | /** |
| | | * 市编号 |
| | | */ |
| | | private String cityCode; |
| | | /** |
| | | * 门店id |
| | | */ |
| | | private Integer storeId; |
| | | /** |
| | | * 赛事名称 |
| | | */ |
| | | private String name; |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | private Date startTime; |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | private Date endTime; |
| | | /** |
| | | * 报名结束时间 |
| | | */ |
| | | private Date registerEndTime; |
| | | /** |
| | | * 报名条件(1=全部用户,2=仅限年度会员参与,3=仅限学员参与) |
| | | */ |
| | | private Integer registerCondition; |
| | | /** |
| | | * 报名开始年龄 |
| | | */ |
| | | private Integer startAge; |
| | | /** |
| | | * 报名结束年龄 |
| | | */ |
| | | private Integer endAge; |
| | | /** |
| | | * 支付方式(1=现金,2=玩湃币支付,3=课时支付) |
| | | */ |
| | | private Integer payType; |
| | | /** |
| | | * 支付金额 |
| | | */ |
| | | private BigDecimal price; |
| | | /** |
| | | * 参加地址 |
| | | */ |
| | | private String address; |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private String longitude; |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | private String latitude; |
| | | /** |
| | | * 报名人数 |
| | | */ |
| | | private Integer applicantsNumber; |
| | | /** |
| | | * 基础人数 |
| | | */ |
| | | private Integer baseNumber; |
| | | /** |
| | | * 是否需要实名(0=否,1=是) |
| | | */ |
| | | private Integer realName; |
| | | /** |
| | | * 赛事简介 |
| | | */ |
| | | private String introduction; |
| | | /** |
| | | * 审核状态(1=待审核,2=已通过,3=已拒绝) |
| | | */ |
| | | private Integer auditStatus; |
| | | /** |
| | | * 审核人id |
| | | */ |
| | | private Integer auditUserId; |
| | | /** |
| | | * 审核备注 |
| | | */ |
| | | private String auditRemark; |
| | | /** |
| | | * 状态(1=未开始,2=已开始,3=已结束,4=已取消) |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 状态(1=正常,2=冻结,3=删除) |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | private Date insertTime; |
| | | |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.competition.entity; |
| | | |
| | | 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; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | | * 赛事报名记录 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-06-26 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @TableName("t_user_competition") |
| | | public class UserCompetition extends Model<UserCompetition> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 赛事id |
| | | */ |
| | | private Integer competitionId; |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Integer userId; |
| | | /** |
| | | * 状态(1=正常,2=取消) |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 参加时间 |
| | | */ |
| | | private Date insertTime; |
| | | |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return this.id; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.competition.feignclient; |
| | | |
| | | |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | |
| | | @FeignClient(value = "mb-cloud-competition") |
| | | public interface DeductionCompetitionsClient { |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.competition.feignclient.model; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | @Data |
| | | public class ClassDataDetails { |
| | | |
| | | @ApiModelProperty(value = "已扣课时数") |
| | | private Integer deductionClassHours; |
| | | |
| | | @ApiModelProperty(value = "类型变动记录") |
| | | private List<PurchaseRecordVo> recordVos; |
| | | } |
New file |
| | |
| | | package com.dsh.competition.feignclient.model; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 类型实体类: |
| | | * 类型:购买课包、消课、报名赛事、介绍有礼 |
| | | */ |
| | | |
| | | @Data |
| | | public class PurchaseRecordVo { |
| | | |
| | | @ApiModelProperty(value = "类型名称") |
| | | private String purchaseType; |
| | | |
| | | @ApiModelProperty(value = "类型变动时间") |
| | | private String purchaseTime; |
| | | |
| | | @ApiModelProperty(value = "类型涉及金额") |
| | | private String purchaseAmount; |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.competition.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.competition.entity.Competition; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-06-26 |
| | | */ |
| | | public interface CompetitionMapper extends BaseMapper<Competition> { |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.competition.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dsh.competition.entity.UserCompetition; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 赛事报名记录 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-06-26 |
| | | */ |
| | | public interface UserCompetitionMapper extends BaseMapper<UserCompetition> { |
| | | |
| | | List<UserCompetition> queryDeRecordDetails(Integer appUserId,List<Integer> collect,String startTime, String endTime); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.competition.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.competition.entity.Competition; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-06-26 |
| | | */ |
| | | public interface CompetitionService extends IService<Competition> { |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.competition.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.dsh.competition.entity.UserCompetition; |
| | | import com.dsh.competition.feignclient.model.PurchaseRecordVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 赛事报名记录 服务类 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-06-26 |
| | | */ |
| | | public interface UserCompetitionService extends IService<UserCompetition> { |
| | | |
| | | List<PurchaseRecordVo> queryDeRecordDetails(Integer appUserId,String startTime, String endTime); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.competition.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.competition.entity.Competition; |
| | | import com.dsh.competition.mapper.CompetitionMapper; |
| | | import com.dsh.competition.service.CompetitionService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-06-26 |
| | | */ |
| | | @Service |
| | | public class CompetitionServiceImpl extends ServiceImpl<CompetitionMapper, Competition> implements CompetitionService { |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.competition.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.competition.entity.Competition; |
| | | import com.dsh.competition.entity.UserCompetition; |
| | | import com.dsh.competition.feignclient.model.PurchaseRecordVo; |
| | | import com.dsh.competition.mapper.CompetitionMapper; |
| | | import com.dsh.competition.mapper.UserCompetitionMapper; |
| | | import com.dsh.competition.service.UserCompetitionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 赛事报名记录 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author jqs |
| | | * @since 2023-06-26 |
| | | */ |
| | | @Service |
| | | public class UserCompetitionServiceImpl extends ServiceImpl<UserCompetitionMapper, UserCompetition> implements UserCompetitionService { |
| | | |
| | | @Autowired |
| | | CompetitionMapper comMapper; |
| | | |
| | | @Override |
| | | public List<PurchaseRecordVo> queryDeRecordDetails(Integer appUserId,String startTime, String endTime) { |
| | | List<Competition> competitions = comMapper.selectList(new QueryWrapper<Competition>() |
| | | .eq("payType", 3) |
| | | .eq("auditStatus",2)); |
| | | List<Integer> collect = competitions.stream().map(Competition::getId).collect(Collectors.toList()); |
| | | List<UserCompetition> purchaseRecordVos = this.baseMapper.queryDeRecordDetails(appUserId, collect, startTime, endTime); |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dsh.competition.mapper.CompetitionMapper"> |
| | | |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.dsh.competition.mapper.UserCompetitionMapper"> |
| | | |
| | | <select id="queryDeRecordDetails" resultType="com.dsh.competition.entity.UserCompetition"> |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | package com.dsh.course.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.entity.TCoursePackagePayment; |
| | | import com.dsh.course.feignclient.model.CourseOfStoreVo; |
| | | import com.dsh.course.feignclient.model.StuCourseResp; |
| | | import com.dsh.course.feignclient.model.StuSessionDetailsVo; |
| | | import com.dsh.course.service.TCoursePackagePaymentService; |
| | | import com.dsh.course.service.TCoursePackageService; |
| | | import com.dsh.course.util.DateUtil; |
| | | import io.swagger.annotations.Api; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Api |
| | | @CrossOrigin |
| | |
| | | * @return 课包列表 |
| | | */ |
| | | @PostMapping("/coursePack/queryPayment") |
| | | public List<StuCourseResp> getStuCoursePackagePayment(@RequestBody Integer stuId){ |
| | | public List<StuCourseResp> getStuCoursePackagePayment(@RequestBody Integer stuId,@RequestBody Integer appUserId){ |
| | | List<StuCourseResp> resps = new ArrayList<>(); |
| | | List<TCoursePackagePayment> byUserId = packagePaymentService.queryAllCoursePackage(stuId); |
| | | List<TCoursePackagePayment> byUserId = packagePaymentService.queryAllCoursePackage(stuId,appUserId); |
| | | if (byUserId.size() > 0 ){ |
| | | for (TCoursePackagePayment tCoursePackagePayment : byUserId) { |
| | | TCoursePackage tCoursePackage = tcpService.getById(tCoursePackagePayment.getCoursePackageId()); |
| | |
| | | return tcpService.queryStoreOfCourse(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * 课程名称列表 |
| | | */ |
| | | @PostMapping("/coursePack/sessionNames") |
| | | public List<StuSessionDetailsVo> getStuSessionList(@RequestBody Integer stuId,@RequestBody Integer appUserId){ |
| | | List<StuSessionDetailsVo> detailsVos = new ArrayList<>(); |
| | | List<TCoursePackagePayment> byUserId = packagePaymentService.queryAllCoursePackage(stuId,appUserId); |
| | | if (byUserId.size() > 0){ |
| | | List<Integer> collect = byUserId.stream().map(TCoursePackagePayment::getCoursePackageId).collect(Collectors.toList()); |
| | | List<TCoursePackage> list = tcpService.list(new QueryWrapper<TCoursePackage>() |
| | | .in("id", collect)); |
| | | list.forEach(vo -> { |
| | | StuSessionDetailsVo detVo = new StuSessionDetailsVo(); |
| | | detVo.setSessionid(vo.getId()); |
| | | detVo.setSessionName(vo.getName()); |
| | | String afterDayDate = DateUtil.getAfterDayDate2(vo.getInsertTime(),vo.getValidDays() + ""); |
| | | detVo.setPeriodOfValidity(afterDayDate); |
| | | detailsVos.add(detVo); |
| | | }); |
| | | } |
| | | return detailsVos; |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignclient; |
| | | |
| | | |
| | | import com.dsh.course.feignclient.model.StuSessionDetailsVo; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | import java.util.List; |
| | | |
| | | @FeignClient(value = "mb-cloud-course") |
| | | public interface CourseSessionNameClient { |
| | | |
| | | |
| | | @PostMapping("/coursePack/sessionNames") |
| | | List<StuSessionDetailsVo> getStuSessionList(Integer stuId,Integer appUserId); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.feignclient.model; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StuSessionDetailsVo { |
| | | |
| | | @ApiModelProperty(value = "课时id") |
| | | private Integer sessionid; |
| | | |
| | | @ApiModelProperty(value = "课时名称") |
| | | private String sessionName; |
| | | |
| | | @ApiModelProperty(value = "课时有效期") |
| | | private String periodOfValidity; |
| | | |
| | | } |
| | |
| | | */ |
| | | public interface TCoursePackagePaymentMapper extends BaseMapper<TCoursePackagePayment> { |
| | | |
| | | List<TCoursePackagePayment> queryAllCoursePackage(@Param("stuId") Integer stuId); |
| | | List<TCoursePackagePayment> queryAllCoursePackage(@Param("stuId") Integer stuId, |
| | | @Param("appUserId") Integer appUserId); |
| | | |
| | | } |
| | |
| | | */ |
| | | public interface TCoursePackagePaymentService extends IService<TCoursePackagePayment> { |
| | | |
| | | List<TCoursePackagePayment> queryAllCoursePackage(Integer stuId); |
| | | List<TCoursePackagePayment> queryAllCoursePackage(Integer stuId,Integer appUserId); |
| | | |
| | | } |
| | |
| | | public class TCoursePackagePaymentServiceImpl extends ServiceImpl<TCoursePackagePaymentMapper, TCoursePackagePayment> implements TCoursePackagePaymentService { |
| | | |
| | | @Override |
| | | public List<TCoursePackagePayment> queryAllCoursePackage(Integer stuId) { |
| | | return this.baseMapper.queryAllCoursePackage(stuId); |
| | | public List<TCoursePackagePayment> queryAllCoursePackage(Integer stuId,Integer appUserId) { |
| | | return this.baseMapper.queryAllCoursePackage(stuId,appUserId); |
| | | } |
| | | } |
| | |
| | | return dateStr; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 得到n天之后的日期 |
| | | */ |
| | | public static String getAfterDayDate2(Date date,String days) { |
| | | int daysInt = Integer.parseInt(days); |
| | | |
| | | Calendar canlendar = Calendar.getInstance(); // java.util包 |
| | | canlendar.setTime(date); |
| | | canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动 |
| | | Date afterDate = canlendar.getTime(); |
| | | |
| | | SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String dateStr = sdfd.format(afterDate); |
| | | |
| | | return dateStr; |
| | | } |
| | | |
| | | /** |
| | | * 得到n天之后是周几 |
| | | */ |
| | |
| | | UNION ALL |
| | | SELECT * |
| | | FROM t_course_package_payment5 |
| | | WHERE user_id = #{stuId} |
| | | WHERE 1=1 |
| | | <if test=" stuId != null"> |
| | | and appUserId = #{stuId} |
| | | </if> |
| | | <if test="appUserId != null"> |
| | | and studentId = #{appUserId} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |