lisy
2023-07-04 a5d0c4da70f592c7ab338483cabc37816e11c3d9
account模块:开始上课-切换学员功能接口
3个文件已修改
99 ■■■■■ 已修改文件
cloud-server-account/src/main/java/com/dsh/account/controller/ClassDetailsController.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-account/src/main/java/com/dsh/account/service/TStudentService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-account/src/main/java/com/dsh/account/controller/ClassDetailsController.java
@@ -154,6 +154,7 @@
                    vo.setStuHeight(sts.getHeight());
                    vo.setStuWeight(sts.getWeight());
                    vo.setIsNot(sts.getIsDefault());
                    stuListVos.add(vo);
                });
            }
            return ResultUtil.success(stuListVos);
@@ -161,6 +162,32 @@
            return ResultUtil.runErr();
        }
    }
    /**
     * 切换学员
     */
    @ResponseBody
    @PostMapping("/api/startCource/switchStu")
    @ApiOperation(value = "切换学员", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
    })
    public ResultUtil<List<StuListVo>> dealSwitchStudents(@RequestBody Integer stuId){
        try {
            Integer userIdFormRedis = tokenUtil.getUserIdFormRedis();
            if(null == userIdFormRedis){
                return ResultUtil.tokenErr();
            }
            return ResultUtil.success(istuService.switchStudentActions(userIdFormRedis,stuId));
        }catch (Exception e){
            return ResultUtil.runErr();
        }
    }
    /**
     * 课时详情
@@ -285,7 +312,8 @@
    @PostMapping("/api/startCource/stuComment")
    @ApiOperation(value = "学员评语", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
    })
    public ResultUtil<List<StuCommentsVo>> queryStuComment(@RequestParam("stuId") Integer stuId){
        try {
@@ -303,7 +331,8 @@
    @PostMapping("/api/startCource/stuMedal")
    @ApiOperation(value = "学员勋章详情", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
    })
    public ResultUtil<List<StuMedalVo>> queryStuMedal(@RequestParam("stuId") Integer stuId){
        try {
@@ -325,7 +354,8 @@
    @PostMapping("/api/startCource/stuGoog")
    @ApiOperation(value = "学员勋章", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
    })
    public ResultUtil<List<GongVo>> queryStuGoog(@RequestParam("stuId") Integer stuId){
        try {
@@ -339,5 +369,30 @@
        }
    }
    /**
     * 课后视频课表
     */
    @ResponseBody
    @PostMapping("/api/startCource/afterSourceDetails")
    @ApiOperation(value = "学员勋章", tags = {"APP-开始上课"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."),
            @ApiImplicitParam(value = "学员id", name = "stuId", required = true, dataType = "int"),
    })
    public ResultUtil queryAfterSourceDetails(@RequestParam("stuId") Integer stuId){
        try {
            Integer appUserId = tokenUtil.getUserIdFormRedis();
            if(null == appUserId){
                return ResultUtil.tokenErr();
            }
            // TODO: 2023/7/4
            return ResultUtil.success();
        }catch (Exception e){
            return ResultUtil.runErr();
        }
    }
}
cloud-server-account/src/main/java/com/dsh/account/service/TStudentService.java
@@ -6,6 +6,7 @@
import com.dsh.account.feignclient.other.model.SysNotice;
import com.dsh.account.model.vo.classDetails.classInsVo.ClassDetailsInsVo;
import com.dsh.account.model.vo.classDetails.classInsVo.StuDetailsReq;
import com.dsh.account.model.vo.classDetails.classInsVo.StuListVo;
import com.dsh.account.model.vo.exploreDetail.ExploreDatasVo;
import com.dsh.account.model.vo.exploreDetail.LonLatRequest;
import com.dsh.account.model.vo.exploreDetails.QuestionDetailsVo;
@@ -63,4 +64,9 @@
     */
    ExploreDatasVo queryIndexOfExplores(LonLatRequest llrequest);
    /**
     * 切换学员
     */
    List<StuListVo> switchStudentActions(Integer appUserId, Integer stuId);
}
cloud-server-account/src/main/java/com/dsh/account/service/impl/TStudentServiceImpl.java
@@ -26,6 +26,7 @@
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.model.vo.classDetails.classInsVo.StuListVo;
import com.dsh.account.model.vo.exploreDetail.ExploreDatasVo;
import com.dsh.account.model.vo.exploreDetail.LonLatRequest;
import com.dsh.account.model.vo.exploreDetails.QuestionDetailsVo;
@@ -35,6 +36,7 @@
import com.dsh.account.model.vo.sourceDetail.RecordTimeRequest;
import com.dsh.account.service.TStudentService;
import com.dsh.account.util.DateTimeHelper;
import com.dsh.account.util.DateUtil;
import com.dsh.account.util.ToolUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -225,6 +227,36 @@
        return datasVo;
    }
    @Override
    public List<StuListVo> switchStudentActions(Integer appUserId, Integer stuId) {
        List<StuListVo> stuListVos = new ArrayList<>();
        List<TStudent> tStudents = this.baseMapper.selectList(new QueryWrapper<TStudent>()
                .eq("appUserId", appUserId)
                .eq("state",1));
        if (tStudents.size() > 0) {
            tStudents.forEach(sts -> {
                if (Objects.equals(sts.getId(), stuId)) {
                    sts.setIsDefault(1);
                } else {
                    sts.setIsDefault(2);
                }
                this.baseMapper.updateById(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());
                stuListVos.add(vo);
            });
        }
        return stuListVos;
    }
    public static List<PurchaseRecordVo> dealDataOfTime(List<PurchaseRecordVo> purchaseRecords) {
        Collections.sort(purchaseRecords, new Comparator<PurchaseRecordVo>() {