| | |
| | | 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; |
| | |
| | | @Api |
| | | @CrossOrigin |
| | | @RestController |
| | | @RequestMapping("/startCource") |
| | | @RequestMapping("/base/startCource") |
| | | public class ClassDetailsController { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger("business-log"); |
| | |
| | | @Autowired |
| | | private TAppUserService tappuService; |
| | | |
| | | @Autowired |
| | | private TokenUtil tokenUtil; |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/stu/queryStudentData") |
| | | @ApiOperation(value = "根据登录用户ID查询学员信息", tags = {"APP-用户学员信息"}, 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") |
| | | @ApiOperation(value = "获取学员测试报告", tags = {"APP-获取学员测试报告"}, notes = "") |
| | | @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 StuPhysicalVo getStuPhysicalInfo(@RequestBody Integer stuID){ |
| | | public ResultUtil<StuPhysicalVo> getStuPhysicalInfo(@RequestBody Integer stuID){ |
| | | StuPhysicalVo vo = new StuPhysicalVo(); |
| | | TStudent tStudent = istuService.getById(stuID); |
| | | if (ToolUtil.isNotEmpty(tStudent)){ |
| | |
| | | vo.setHeight(tStudent.getHeight()); |
| | | vo.setWeight(tStudent.getWeight()); |
| | | } |
| | | return vo; |
| | | 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.save(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){ |
| | | @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",appUserID)); |
| | | .eq("appUserId",userIdFormRedis)); |
| | | if (tStudents.size() > 0){ |
| | | tStudents.forEach(sts -> { |
| | | StuListVo vo = new StuListVo(); |
| | |
| | | vo.setIsNot(sts.getIsDefault()); |
| | | }); |
| | | } |
| | | return stuListVos; |
| | | return ResultUtil.success(stuListVos); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(ResultUtil.ERROR); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 课时详情 |
| | | */ |
| | | @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){ |
| | | |
| | | } |