|
@@ -26,17 +26,10 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-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.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
@@ -50,13 +43,10 @@ public class StudentController extends BaseController {
|
|
|
private StudentService studentService;
|
|
|
@Resource
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
-
|
|
|
@Resource
|
|
|
private SysUserService sysUserService;
|
|
|
-
|
|
|
@Resource
|
|
|
private SmsCodeService smsCodeService;
|
|
|
-
|
|
|
@Resource
|
|
|
private SubjectService subjectService;
|
|
|
|
|
@@ -85,19 +75,15 @@ public class StudentController extends BaseController {
|
|
|
@ApiOperation(value = "查询学员")
|
|
|
@GetMapping("/queryUser")
|
|
|
public HttpResponseResult<Student> queryUser() {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || null == user.getId()) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
- Student student = studentService.getById(user.getId());
|
|
|
+ Student student = studentService.getById(sysUserService.getUserId());
|
|
|
return succeed(student);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "查询学员基本信息")
|
|
|
@GetMapping("/queryUserInfo")
|
|
|
public HttpResponseResult<StudentHomeVo> queryUserInfo() throws Exception {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || null == user.getId() || (user.getDelFlag()!=null && user.getDelFlag())) {
|
|
|
+ SysUser user = sysUserService.getUser();
|
|
|
+ if (user.getDelFlag()!=null && user.getDelFlag()) {
|
|
|
return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
}
|
|
|
return succeed(studentService.queryUserInfo(user));
|
|
@@ -106,12 +92,7 @@ public class StudentController extends BaseController {
|
|
|
@ApiOperation(value = "设置系统默认客服")
|
|
|
@GetMapping("/updateUserCustomerService")
|
|
|
public HttpResponseResult<String> updateUserCustomerService() {
|
|
|
-
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || null == user.getId()) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
-
|
|
|
+ SysUser user = sysUserService.getUser();
|
|
|
return succeed(studentService.updateUserCustomerService(user));
|
|
|
}
|
|
|
|
|
@@ -121,22 +102,14 @@ public class StudentController extends BaseController {
|
|
|
if (StringUtil.isEmpty(subjectIds)) {
|
|
|
return failed("参数不能为空");
|
|
|
}
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || null == user.getId()) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
- return status(studentService.setSubject(user.getId(), subjectIds) > 0);
|
|
|
+ return status(studentService.setSubject(sysUserService.getUserId(), subjectIds) > 0);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "获取声部搜索下拉框")
|
|
|
@PostMapping("/querySubjectItem")
|
|
|
public HttpResponseResult<List<Subject>> querySubjectItem(
|
|
|
@ApiParam(value = "类型 PRACTICE 陪练课 LIVE 直播课 VIDEO 视频课 PIANO_ROOM 琴房 MUSIC 曲目 ") String type) {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || null == user.getId()) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
- List<Subject> subjects = studentService.querySubjectItem(user.getId(), type);
|
|
|
+ List<Subject> subjects = studentService.querySubjectItem(sysUserService.getUserId(), type);
|
|
|
subjectService.convertSubject(subjects);
|
|
|
return succeed(subjects);
|
|
|
}
|
|
@@ -144,11 +117,7 @@ public class StudentController extends BaseController {
|
|
|
@ApiOperation(value = "我的关注")
|
|
|
@PostMapping(value = "/queryMyFollow")
|
|
|
public HttpResponseResult<PageInfo<MyFollow>> queryMyFollow(@RequestBody QueryMyFollowSearch query) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null || sysUser.getId() == null) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
- query.setUserId(sysUser.getId());
|
|
|
+ query.setUserId(sysUserService.getUserId());
|
|
|
IPage<MyFollow> pages = studentService.queryMyFollow(PageUtil.getPage(query), query);
|
|
|
return succeed(PageUtil.pageInfo(pages));
|
|
|
}
|
|
@@ -157,11 +126,7 @@ public class StudentController extends BaseController {
|
|
|
@ApiOperation(value = "实名认证", notes = "传入realNameAuthDto")
|
|
|
@ResponseBody
|
|
|
public HttpResponseResult<IdcardInfoExtractor> realNameAuth(@Valid @RequestBody RealnameAuthReq realNameAuthDto) {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || null == user.getId()) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
- IdcardInfoExtractor idcardInfoExtractor = sysUserService.updateUserCard(realNameAuthDto, user,
|
|
|
+ IdcardInfoExtractor idcardInfoExtractor = sysUserService.updateUserCard(realNameAuthDto, sysUserService.getUser(),
|
|
|
ClientEnum.STUDENT);
|
|
|
return succeed(idcardInfoExtractor);
|
|
|
}
|
|
@@ -169,13 +134,10 @@ public class StudentController extends BaseController {
|
|
|
@PostMapping("/logoffAccount")
|
|
|
@ApiOperation(value = "注销学生账户")
|
|
|
public HttpResponseResult<Boolean> logoffAccount(@RequestParam("code") String code) {
|
|
|
- SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
- if (user == null || null == user.getId()) {
|
|
|
- return failed(HttpStatus.FORBIDDEN, "请登录");
|
|
|
- }
|
|
|
if (StringUtils.isEmpty(code)) {
|
|
|
return failed("验证码不能为空");
|
|
|
}
|
|
|
+ SysUser user = sysUserService.getUser();
|
|
|
boolean validCode = smsCodeService.verifyValidCode(user.getPhone(), code, "");
|
|
|
if (!validCode) {
|
|
|
return failed("验证码错误");
|
|
@@ -195,7 +157,7 @@ public class StudentController extends BaseController {
|
|
|
@PostMapping("/checkPassword")
|
|
|
@ApiOperation(value = "校验密码")
|
|
|
public Object checkPassword(@Validated @RequestBody StudentWrapper.StudentUpdatePassword updatePassword){
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ SysUser sysUser = sysUserService.getUser();
|
|
|
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
|
|
|
if(!encoder.matches(updatePassword.getPassword(),sysUser.getPassword())){
|
|
|
throw new BizException("原密码错误");
|