| | |
| | | package com.dsh.account.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.account.entity.TStudent; |
| | | import com.dsh.account.feignclient.competition.model.PurchaseRecordVo; |
| | | import com.dsh.account.model.vo.classDetails.AppointmentRecordVo; |
| | | import com.dsh.account.model.vo.classDetails.ClasspaymentRequest; |
| | | import com.dsh.account.model.vo.classDetails.CourseVenue; |
| | | import com.dsh.account.model.vo.classDetails.*; |
| | | import com.dsh.account.model.vo.classDetails.classInsVo.*; |
| | | import com.dsh.account.model.vo.commentDetail.StuCommentsVo; |
| | | import com.dsh.account.model.vo.medalDetail.GongVo; |
| | |
| | | tStudents.forEach(sts -> { |
| | | StuListVo vo = new StuListVo(); |
| | | vo.setStuId(sts.getId()); |
| | | vo.setStuHeadImg(sts.getHeadImg()); |
| | | vo.setStuPhone(ToolUtil.isEmpty(sts.getPhone()) ? "" : sts.getPhone()); |
| | | vo.setIdCard(ToolUtil.isEmpty(sts.getIdCard()) ? "":sts.getIdCard()); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | vo.setBirthday(simpleDateFormat.format(sts.getBirthday())); |
| | | vo.setStuName(sts.getName()); |
| | |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 编辑学员详情 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/editStu") |
| | | @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<StuDetailsVo> editStudentInfo(Integer stuId){ |
| | | try { |
| | | TStudent byId = istuService.getById(stuId); |
| | | if (ToolUtil.isEmpty(byId)){ |
| | | ResultUtil.error("未查询到该学员!"); |
| | | } |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | StuDetailsVo detailsVo = new StuDetailsVo(); |
| | | detailsVo.setStuId(byId.getId()); |
| | | detailsVo.setStuHeadImg(byId.getHeadImg()); |
| | | detailsVo.setStuName(byId.getName()); |
| | | detailsVo.setBirthday(simpleDateFormat.format(byId.getBirthday())); |
| | | detailsVo.setStuHeight(byId.getHeight()); |
| | | detailsVo.setStuWeight(byId.getWeight()); |
| | | detailsVo.setIdCard(ToolUtil.isEmpty(byId.getIdCard()) ? "": byId.getIdCard()); |
| | | detailsVo.setStuPhone(ToolUtil.isEmpty(byId.getPhone()) ? "" : byId.getPhone()); |
| | | return ResultUtil.success(detailsVo); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 提交编辑学员 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/commitEditStu") |
| | | @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 commitEditStu(StuEditInfoReq stu){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(istuService.commitEditStudentInfo(stu,userIdFormRedis)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 学员设为默认 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/editDefault") |
| | | @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 editDefault(Integer stuId){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | TStudent byId = istuService.getById(stuId); |
| | | if (ToolUtil.isEmpty(byId)){ |
| | | ResultUtil.error("未查询到该学员!"); |
| | | } |
| | | byId.setIsDefault(1); |
| | | istuService.updateById(byId); |
| | | List<TStudent> list = istuService.list(new LambdaQueryWrapper<TStudent>() |
| | | .eq(TStudent::getAppUserId,userIdFormRedis) |
| | | .ne(TStudent::getId,byId.getId())); |
| | | for (TStudent tStudent : list) { |
| | | tStudent.setIsDefault(2); |
| | | istuService.updateById(tStudent); |
| | | } |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 课时详情 |
| | | */ |