|
|
@@ -2,8 +2,10 @@ package com.mooctest.crowd.site.controller;
|
|
|
|
|
|
import com.mooctest.crowd.domain.exception.*;
|
|
|
import com.mooctest.crowd.site.annotation.LoginRequired;
|
|
|
+import com.mooctest.crowd.site.annotation.SysAdminRequired;
|
|
|
import com.mooctest.crowd.site.command.*;
|
|
|
import com.mooctest.crowd.site.data.dto.UserDTO;
|
|
|
+import com.mooctest.crowd.site.data.vo.EnterpriseAuthVO;
|
|
|
import com.mooctest.crowd.site.data.vo.PersonalAuthVO;
|
|
|
import com.mooctest.crowd.site.service.UserService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -60,6 +62,14 @@ public class UserController {
|
|
|
return userService.loginByMobileAndPwd(loginCommand);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 申请个人实名认证
|
|
|
+ * @param userId
|
|
|
+ * @param command
|
|
|
+ * @param result
|
|
|
+ * @param session
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@LoginRequired
|
|
|
@RequestMapping(value = "/user/{userId}/personalAuth", method = RequestMethod.POST)
|
|
|
public PersonalAuthVO applyPersonalAuthentication(@PathVariable("userId")Long userId,
|
|
|
@@ -72,13 +82,133 @@ public class UserController {
|
|
|
return userService.applyPersonalAuth(userId, command);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改个人认证信息
|
|
|
+ * @param userId
|
|
|
+ * @param command
|
|
|
+ * @param result
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@LoginRequired
|
|
|
@RequestMapping(value = "/user/{userId}/personalAuth", method = RequestMethod.PUT)
|
|
|
public PersonalAuthVO updatePersonalAuthInfo(@PathVariable("userId")Long userId,
|
|
|
@Validated @RequestBody ApplyPersonalAuthCommand command,
|
|
|
+ HttpSession session,
|
|
|
BindingResult result){
|
|
|
if (result.hasErrors())
|
|
|
throw new BaseException(result.getFieldError().getDefaultMessage());
|
|
|
return userService.updatePersonalAuthInfo(userId, command);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 个人认证:通过审核
|
|
|
+ * @param userId
|
|
|
+ * @param session
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @LoginRequired
|
|
|
+ @RequestMapping(value = "/user/{userId}/personalAuth/status/accept", method = RequestMethod.PUT)
|
|
|
+ public PersonalAuthVO passPersonalAuth(@PathVariable("userId") Long userId, HttpSession session){
|
|
|
+ Long operatorId = Long.parseLong((String)session.getAttribute("userId"));
|
|
|
+ return userService.passPersonalAuth(userId, operatorId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 个人认证:审核未通过
|
|
|
+ * @param userId
|
|
|
+ * @param session
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @LoginRequired
|
|
|
+ @RequestMapping(value = "/user/{userId}/personalAuth/status/reject", method = RequestMethod.PUT)
|
|
|
+ public PersonalAuthVO rejectPersonalAuth(@PathVariable("userId") Long userId, HttpSession session){
|
|
|
+ Long operatorId = Long.parseLong((String)session.getAttribute("userId"));
|
|
|
+ return userService.rejectPersonalAuth(userId, operatorId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查看个人认证信息
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @LoginRequired
|
|
|
+ @RequestMapping(value = "/user/{userId}/personalAuth", method = RequestMethod.GET)
|
|
|
+ public PersonalAuthVO getPersonalAuthInfo(@PathVariable("userId") Long userId){
|
|
|
+ return userService.getPersonalAuthInfo(userId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取企业认证信息
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @LoginRequired
|
|
|
+ @RequestMapping(value = "/user/{userId}/enterpriseAuth", method = RequestMethod.GET)
|
|
|
+ public EnterpriseAuthVO getEnterpriseAuthInfo(@PathVariable("userId") Long userId){
|
|
|
+ return userService.getEnterpriseAuthInfo(userId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 申请企业认证接口
|
|
|
+ * @param userId
|
|
|
+ * @param command
|
|
|
+ * @param result
|
|
|
+ * @param session
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @LoginRequired
|
|
|
+ @RequestMapping(value = "/user/{userId}/enterpriseAuth", method = RequestMethod.POST)
|
|
|
+ public EnterpriseAuthVO applyEnterpriseAuth(@PathVariable("userId")Long userId,
|
|
|
+ @Validated @RequestBody ApplyEnterpriseAuthCommand command,
|
|
|
+ BindingResult result, HttpSession session){
|
|
|
+ if (!userId.equals(Long.parseLong((String)session.getAttribute("userId"))))
|
|
|
+ throw new UnauthorizedException("没有权限对他人账号进行操作!");
|
|
|
+ if (result.hasErrors())
|
|
|
+ throw new BaseException(result.getFieldError().getDefaultMessage());
|
|
|
+ return userService.applyEnterpriseAuth(userId, command);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新企业认证信息
|
|
|
+ * @param userId
|
|
|
+ * @param command
|
|
|
+ * @param result
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @LoginRequired
|
|
|
+ @RequestMapping(value = "/user/{userId}/enterpriseAuth", method = RequestMethod.PUT)
|
|
|
+ public EnterpriseAuthVO updatePersonalAuthInfo(@PathVariable("userId")Long userId,
|
|
|
+ @Validated @RequestBody ApplyEnterpriseAuthCommand command,
|
|
|
+ BindingResult result){
|
|
|
+ if (result.hasErrors())
|
|
|
+ throw new BaseException(result.getFieldError().getDefaultMessage());
|
|
|
+ return userService.updateEnterpriseAuthInfo(userId, command);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业认证:审核通过
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @LoginRequired
|
|
|
+ @SysAdminRequired
|
|
|
+ @RequestMapping(value = "/user/{userId}/enterpriseAuth/status/accept", method = RequestMethod.PUT)
|
|
|
+ public EnterpriseAuthVO passEnterpriseAuth(@PathVariable("userId") Long userId){
|
|
|
+ return userService.passEnterpriseAuth(userId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 企业认证:审核未通过
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @LoginRequired
|
|
|
+ @RequestMapping(value = "/user/{userId}/enterpriseAuth/status/reject", method = RequestMethod.PUT)
|
|
|
+ public EnterpriseAuthVO rejectEnterpriseAuth(@PathVariable("userId") Long userId){
|
|
|
+ return userService.rejectEnterpriseAuth(userId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|