cloud-server-account/src/main/java/com/dsh/account/controller/ClassDetailsController.java
@@ -6,11 +6,13 @@ import com.dsh.account.feignclient.competition.model.PurchaseRecordVo; import com.dsh.account.model.vo.classDetails.classInsVo.*; import com.dsh.account.model.vo.commentDetail.StuCommentsVo; import com.dsh.account.model.vo.medalDetail.GongVo; import com.dsh.account.model.vo.medalDetail.StuMedalVo; import com.dsh.account.model.vo.sourceDetail.CouponStuAvailableVo; import com.dsh.account.model.vo.sourceDetail.CourseDetailsOfContinuationResp; import com.dsh.account.model.vo.sourceDetail.RecordTimeRequest; import com.dsh.account.service.EvaluateStudentService; import com.dsh.account.service.StudentHonorService; import com.dsh.account.service.TAppUserService; import com.dsh.account.service.TStudentService; import com.dsh.account.util.DateUtil; @@ -51,12 +53,15 @@ private EvaluateStudentService evalstuService; @Autowired private StudentHonorService honorService; @Autowired private TokenUtil tokenUtil; @ResponseBody @PostMapping("/base/startCource/queryStudentData") @PostMapping("/api/startCource/queryStudentData") @ApiOperation(value = "上课首页", tags = {"APP-开始上课"}) @ApiImplicitParams({ @ApiImplicitParam(value = "经度值", name = "longitude", required = true, dataType = "String"), @@ -78,7 +83,7 @@ @ResponseBody @PostMapping("/base/startCource/queryPhysical") @PostMapping("/api/startCource/queryPhysical") @ApiOperation(value = "获取学员测试报告", tags = {"APP-开始上课"}) @ApiImplicitParams({ @ApiImplicitParam(value = "学员id", name = "id", required = true, dataType = "int"), @@ -100,7 +105,7 @@ * 添加学员信息 */ @ResponseBody @PostMapping("/base/startCource/addData") @PostMapping("/api/startCource/addData") @ApiOperation(value = "添加学员信息", tags = {"APP-开始上课"}) @ApiImplicitParams({ @ApiImplicitParam(value = "学员信息", name = "stu", required = true, dataType = "int"), @@ -124,7 +129,7 @@ * 该APP用户下的学员列表 */ @ResponseBody @PostMapping("/base/startCource/listOfStu") @PostMapping("/api/startCource/listOfStu") @ApiOperation(value = "学员列表", tags = {"APP-开始上课"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") @@ -161,7 +166,7 @@ * 课时详情 */ @ResponseBody @PostMapping("/base/startCource/lessonDetails") @PostMapping("/api/startCource/lessonDetails") @ApiOperation(value = "课时详情", tags = {"APP-开始上课"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), @@ -188,7 +193,7 @@ * 课时详情-记录列表 */ @ResponseBody @PostMapping("/base/startCource/recordDetails") @PostMapping("/api/startCource/recordDetails") @ApiOperation(value = "课时详情-记录列表", tags = {"APP-开始上课"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), @@ -210,7 +215,7 @@ * 课时详情-续课课包详情 */ @ResponseBody @PostMapping("/base/startCource/renewal") @PostMapping("/api/startCource/renewal") @ApiOperation(value = "课时详情-续课课包详情", tags = {"APP-开始上课"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") @@ -233,7 +238,7 @@ * 课时详情-选择优惠券 */ @ResponseBody @PostMapping("/base/startCource/conponList") @PostMapping("/api/startCource/conponList") @ApiOperation(value = "课时详情-选择优惠券", tags = {"APP-开始上课"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") @@ -257,7 +262,7 @@ * 课时详情-支付 */ @ResponseBody @PostMapping("/base/startCource/payment") @PostMapping("/api/startCource/payment") @ApiOperation(value = "课时详情-支付", tags = {"APP-开始上课"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") @@ -277,7 +282,7 @@ * 学员评语 */ @ResponseBody @PostMapping("/base/startCource/stuComment") @PostMapping("/api/startCource/stuComment") @ApiOperation(value = "学员评语", tags = {"APP-开始上课"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") @@ -292,22 +297,43 @@ /** * 学员勋章 * 学员勋章详情 */ @ResponseBody @PostMapping("/base/startCource/stuMedal") @ApiOperation(value = "学员勋章", tags = {"APP-开始上课"}) @PostMapping("/api/startCource/stuMedal") @ApiOperation(value = "学员勋章详情", tags = {"APP-开始上课"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil<StuMedalVo> queryStuMedal(@RequestParam("stuId") Integer stuId){ public ResultUtil<List<StuMedalVo>> queryStuMedal(@RequestParam("stuId") Integer stuId){ try { Integer appUserId = tokenUtil.getUserIdFormRedis(); if(null == appUserId){ return ResultUtil.tokenErr(); } return ResultUtil.success(honorService.queryHonorDetails(stuId)); }catch (Exception e){ return ResultUtil.runErr(); } } return ResultUtil.success(); /** * 学员勋章 */ @ResponseBody @PostMapping("/api/startCource/stuGoog") @ApiOperation(value = "学员勋章", tags = {"APP-开始上课"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil<List<GongVo>> queryStuGoog(@RequestParam("stuId") Integer stuId){ try { Integer appUserId = tokenUtil.getUserIdFormRedis(); if(null == appUserId){ return ResultUtil.tokenErr(); } return ResultUtil.success(honorService.queryStuOfMedalData(stuId)); }catch (Exception e){ return ResultUtil.runErr(); } cloud-server-account/src/main/java/com/dsh/account/controller/ExploreWPController.java
@@ -28,7 +28,7 @@ private TStudentService tsService; @ResponseBody @PostMapping("/base/exploreWP/noticeList") @PostMapping("/api/exploreWP/noticeList") @ApiOperation(value = "联系客服-探索首页", tags = {"APP-探索玩湃"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") @@ -46,9 +46,6 @@ @ResponseBody @PostMapping("/base/exploreWP/noticeList") @ApiOperation(value = "联系客服-公告列表", tags = {"APP-探索玩湃"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil<List<SysNotice>> queryNoticeListDatas(){ try { return ResultUtil.success(tsService.querySystemNoticeDetails()); @@ -59,11 +56,8 @@ @ResponseBody @PostMapping("/base/exploreWP/noticeList") @PostMapping("/api/exploreWP/noticeList") @ApiOperation(value = "联系客服-公告详情", tags = {"APP-探索玩湃"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil<SysNotice> queryNotice(@RequestBody Integer noId){ try { return ResultUtil.success(tsService.queryNoticeData(noId)); @@ -76,9 +70,6 @@ @ResponseBody @PostMapping("/base/exploreWP/noticeList") @ApiOperation(value = "联系客服-常见问题列表", tags = {"APP-探索玩湃"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil<QuestionDetailsVo> queryFrequentlyAskedQuestionDetails(){ try { return ResultUtil.success(tsService.queryQuestionData()); @@ -91,9 +82,6 @@ @ResponseBody @PostMapping("/base/exploreWP/noticeList") @ApiOperation(value = "联系客服-常见问题详情", tags = {"APP-探索玩湃"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil<QuestionIns> queryQuestionData(@RequestBody Integer quesId){ try { return ResultUtil.success(tsService.queryQuestionDataInfo(quesId)); @@ -105,9 +93,6 @@ @ResponseBody @PostMapping("/base/exploreWP/noticeList") @ApiOperation(value = "联系客服-客服电话列表", tags = {"APP-探索玩湃"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil<List<String>> queryCustomerData(){ try { return ResultUtil.success(tsService.queryCustomerDetails()); cloud-server-account/src/main/java/com/dsh/account/entity/StudentHonor.java
New file @@ -0,0 +1,59 @@ package com.dsh.account.entity; 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-07-04 */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("t_student_honor") public class StudentHonor extends Model<StudentHonor> { private static final long serialVersionUID = 1L; /** * 主键 */ private Integer id; /** * 学员id */ private Integer stuId; /** * 荣耀规则id */ private Integer honorRuleId; /** * 荣耀类型 */ private Integer honorType; /** * 荣耀等级 */ private Integer honorLevel; /** * 添加时间 */ private Date insertTime; @Override protected Serializable pkVal() { return this.id; } } cloud-server-account/src/main/java/com/dsh/account/feignclient/other/HonorDeClient.java
New file @@ -0,0 +1,16 @@ package com.dsh.account.feignclient.other; import com.dsh.account.model.vo.medalDetail.StuMedalVo; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @FeignClient(value = "mb-cloud-other") public interface HonorDeClient { @PostMapping("/honor/stuHonors") public List<StuMedalVo> getStuHonors(@RequestBody List<Integer> honorIds); } cloud-server-account/src/main/java/com/dsh/account/mapper/StudentHonorMapper.java
New file @@ -0,0 +1,16 @@ package com.dsh.account.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dsh.account.entity.StudentHonor; /** * <p> * 学员-荣耀中间表 Mapper 接口 * </p> * * @author jqs * @since 2023-07-04 */ public interface StudentHonorMapper extends BaseMapper<StudentHonor> { } cloud-server-account/src/main/java/com/dsh/account/mapper/xml/StudentHonorMapper.xml
New file @@ -0,0 +1,5 @@ <?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.account.mapper.StudentHonorMapper"> </mapper> cloud-server-account/src/main/java/com/dsh/account/model/vo/medalDetail/GongVo.java
New file @@ -0,0 +1,15 @@ package com.dsh.account.model.vo.medalDetail; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data public class GongVo { @ApiModelProperty(value = "勋章类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家)") private Integer medalType; @ApiModelProperty(value = "勋章名称 例如:俱乐部之星") private String medalName; } cloud-server-account/src/main/java/com/dsh/account/model/vo/medalDetail/StuMedalVo.java
@@ -19,4 +19,10 @@ @ApiModelProperty(value = "升级条件") private String upgradeConditions; @ApiModelProperty(value = "下一等级") private Integer nextLevel; @ApiModelProperty(value = "是否顶级 1是 2不是") private Integer isTopLevel; } cloud-server-account/src/main/java/com/dsh/account/service/StudentHonorService.java
New file @@ -0,0 +1,24 @@ package com.dsh.account.service; import com.baomidou.mybatisplus.extension.service.IService; import com.dsh.account.entity.StudentHonor; import com.dsh.account.model.vo.medalDetail.GongVo; import com.dsh.account.model.vo.medalDetail.StuMedalVo; import java.util.List; /** * <p> * 学员-荣耀中间表 服务类 * </p> * * @author jqs * @since 2023-07-04 */ public interface StudentHonorService extends IService<StudentHonor> { List<GongVo> queryStuOfMedalData(Integer stuId); List<StuMedalVo> queryHonorDetails(Integer stuId); } cloud-server-account/src/main/java/com/dsh/account/service/impl/StudentHonorServiceImpl.java
New file @@ -0,0 +1,71 @@ package com.dsh.account.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.dsh.account.entity.StudentHonor; import com.dsh.account.feignclient.other.HonorDeClient; import com.dsh.account.mapper.StudentHonorMapper; import com.dsh.account.model.vo.medalDetail.GongVo; import com.dsh.account.model.vo.medalDetail.StuMedalVo; import com.dsh.account.service.StudentHonorService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; /** * <p> * 学员-荣耀中间表 服务实现类 * </p> * * @author jqs * @since 2023-07-04 */ @Service public class StudentHonorServiceImpl extends ServiceImpl<StudentHonorMapper, StudentHonor> implements StudentHonorService { @Autowired private HonorDeClient honorDeClient; @Override public List<GongVo> queryStuOfMedalData(Integer stuId) { List<GongVo> voList = new ArrayList<>(); List<StudentHonor> studentHonors = this.baseMapper.selectList(new QueryWrapper<StudentHonor>() .eq("stuId", stuId)); if (studentHonors.size() > 0){ studentHonors.forEach( stuoHo -> { GongVo vo = new GongVo(); vo.setMedalType(stuoHo.getHonorType()); switch (stuoHo.getHonorType()){ case 1: vo.setMedalName("俱乐部之星"); break; case 2: vo.setMedalName("运动达人"); break; case 3: vo.setMedalName("社区之王"); break; case 4: vo.setMedalName("深度玩家"); break; default: break; } voList.add(vo); }); } return voList; } @Override public List<StuMedalVo> queryHonorDetails(Integer stuId) { List<StudentHonor> studentHonors = this.baseMapper.selectList(new QueryWrapper<StudentHonor>() .in("stuId",stuId)); List<Integer> collect = studentHonors.stream().map(StudentHonor::getStuId).collect(Collectors.toList()); return honorDeClient.getStuHonors(collect); } } cloud-server-other/src/main/java/com/dsh/other/controller/HonorController.java
New file @@ -0,0 +1,65 @@ package com.dsh.other.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dsh.other.entity.HonorRules; import com.dsh.other.feignclient.model.StuMedalVo; import com.dsh.other.service.HonorRulesService; 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; import java.util.Objects; @RestController @RequestMapping("") public class HonorController { @Autowired private HonorRulesService hrService; @PostMapping("/honor/stuHonors") public List<StuMedalVo> getStuHonors(@RequestBody List<Integer> honorIds){ List<StuMedalVo> stuMedalVos = new ArrayList<>(); List<HonorRules> honorRules = hrService.list(new QueryWrapper<HonorRules>() .in("id", honorIds)); if (honorRules.size() > 0){ honorRules.forEach(hrs -> { StuMedalVo stuMedalVo = new StuMedalVo(); stuMedalVo.setLevelNum(Integer.getInteger(hrs.getLevel())); switch (hrs.getType()){ case 1: stuMedalVo.setMedalName("俱乐部之星"); break; case 2: stuMedalVo.setMedalName("运动达人"); break; case 3: stuMedalVo.setMedalName("社区之王"); break; case 4: stuMedalVo.setMedalName("深度玩家"); break; default: break; } if (!Objects.equals(hrs.getLevel(), "10")){ stuMedalVo.setNextLevel(Integer.parseInt(hrs.getLevel())+1); stuMedalVo.setUpgradeConditions(hrs.getCondition()); stuMedalVo.setIsTopLevel(2); }else { stuMedalVo.setIsTopLevel(1); } stuMedalVos.add(stuMedalVo); }); } return stuMedalVos; } } cloud-server-other/src/main/java/com/dsh/other/entity/HonorRules.java
New file @@ -0,0 +1,51 @@ package com.dsh.other.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; /** * <p> * 荣誉规则 * </p> * */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("t_honor_rules") public class HonorRules extends Model<HonorRules> { private static final long serialVersionUID = 1L; /** * 主键 */ @TableId(value = "id", type = IdType.AUTO) private Integer id; /** * 数据类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家) */ private Integer type; /** * 等级 */ private String level; /** * 满足条件值 */ private String condition; @Override protected Serializable pkVal() { return this.id; } } cloud-server-other/src/main/java/com/dsh/other/feignclient/HonorDeClient.java
New file @@ -0,0 +1,16 @@ package com.dsh.other.feignclient; import com.dsh.other.feignclient.model.StuMedalVo; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @FeignClient(value = "mb-cloud-other") public interface HonorDeClient { @PostMapping("/honor/stuHonors") public List<StuMedalVo> getStuHonors(@RequestBody List<Integer> honorIds); } cloud-server-other/src/main/java/com/dsh/other/feignclient/model/StuMedalVo.java
New file @@ -0,0 +1,28 @@ package com.dsh.other.feignclient.model; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data public class StuMedalVo { @ApiModelProperty(value = "勋章类型(1=俱乐部之星,2=运动达人,3=社区之王,4=深度玩家)") private Integer medalType; @ApiModelProperty(value = "勋章名称 例如:俱乐部之星") private String medalName; @ApiModelProperty(value = "当前等级") private Integer levelNum; @ApiModelProperty(value = "升级条件") private String upgradeConditions; @ApiModelProperty(value = "下一等级") private Integer nextLevel; @ApiModelProperty(value = "是否顶级 1是 2不是") private Integer isTopLevel; } cloud-server-other/src/main/java/com/dsh/other/mapper/HonorRulesMapper.java
New file @@ -0,0 +1,16 @@ package com.dsh.other.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dsh.other.entity.HonorRules; /** * <p> * 荣誉规则 Mapper 接口 * </p> * * @author jqs * @since 2023-07-04 */ public interface HonorRulesMapper extends BaseMapper<HonorRules> { } cloud-server-other/src/main/java/com/dsh/other/service/HonorRulesService.java
New file @@ -0,0 +1,16 @@ package com.dsh.other.service; import com.baomidou.mybatisplus.extension.service.IService; import com.dsh.other.entity.HonorRules; /** * <p> * 荣誉规则 服务类 * </p> * * @author jqs * @since 2023-07-04 */ public interface HonorRulesService extends IService<HonorRules> { } cloud-server-other/src/main/java/com/dsh/other/service/impl/HonorRulesServiceImpl.java
New file @@ -0,0 +1,20 @@ package com.dsh.other.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.dsh.other.entity.HonorRules; import com.dsh.other.mapper.HonorRulesMapper; import com.dsh.other.service.HonorRulesService; import org.springframework.stereotype.Service; /** * <p> * 荣誉规则 服务实现类 * </p> * * @author jqs * @since 2023-07-04 */ @Service public class HonorRulesServiceImpl extends ServiceImpl<HonorRulesMapper, HonorRules> implements HonorRulesService { } cloud-server-other/src/main/java/com/dsh/other/web/HonorRulesController.java
New file @@ -0,0 +1,21 @@ package com.dsh.other.web; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * <p> * 荣誉规则 前端控制器 * </p> * * @author jqs * @since 2023-07-04 */ @RestController @RequestMapping("/honor-rules") public class HonorRulesController { } cloud-server-other/src/main/resources/mapper/HonorRulesMapper.xml
New file @@ -0,0 +1,6 @@ <?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.other.mapper.HonorRulesMapper"> </mapper>