Sfoglia il codice sorgente

add: 更新个人认证信息接口

xuexiaobo 6 anni fa
parent
commit
402215f316

+ 24 - 2
site/src/main/java/com/mooctest/crowd/site/controller/AgencyController.java

@@ -1,5 +1,6 @@
 package com.mooctest.crowd.site.controller;
 
+import com.alibaba.druid.sql.visitor.functions.Bin;
 import com.mooctest.crowd.domain.exception.BaseException;
 import com.mooctest.crowd.site.annotation.LoginRequired;
 import com.mooctest.crowd.site.command.AgencyResourceAbilityUpdateCommand;
@@ -44,20 +45,36 @@ public class AgencyController {
     }
 
     /**
-     * 申请认证为机构
+     * 申请机构认证
      * @param userId
      * @param command
+     * @param result
      * @return
      */
     @LoginRequired
     @RequestMapping(value = "/user/{userId}/agency", method = RequestMethod.POST)
-    public UserDTO authAgency(@PathVariable("userId") Long userId, @RequestBody @Validated ApplyAgencyAuthCommand command, BindingResult result){
+    public UserDTO applyAgencyAuth(@PathVariable("userId") Long userId, @RequestBody @Validated ApplyAgencyAuthCommand command, BindingResult result){
         if (result.hasErrors())
             throw new BaseException(result.getFieldError().getDefaultMessage());
         return agencyService.applyAgency(userId, command);
     }
 
     /**
+     * 更新机构认证信息
+     * @param userId
+     * @param command
+     * @param result
+     * @return
+     */
+    @LoginRequired
+    @RequestMapping(value = "/user/{userId}/agency", method = RequestMethod.PUT)
+    public AgencyVO updateAgencyInfo(@PathVariable("userId") Long userId, @RequestBody @Validated ApplyAgencyAuthCommand command, BindingResult result){
+        if (result.hasErrors())
+            throw new BaseException(result.getFieldError().getDefaultMessage());
+        return agencyService.updateAgencyInfo(userId, command);
+    }
+
+    /**
      * 审核认证请求(修改认证申请的状态)
      * @param userId
      * @param status
@@ -99,6 +116,11 @@ public class AgencyController {
         return agencyService.upadteResourceAndAbility(userId, command);
     }
 
+    /**
+     * 获取机构认证信息
+     * @param userId
+     * @return
+     */
     @LoginRequired
     @RequestMapping(value = "/user/{userId}/agency", method = RequestMethod.GET)
     public AgencyVO getAgencyInfo(@PathVariable("userId") Long userId){

+ 10 - 0
site/src/main/java/com/mooctest/crowd/site/controller/UserController.java

@@ -71,4 +71,14 @@ public class UserController {
             throw new BaseException(result.getFieldError().getDefaultMessage());
         return userService.applyPersonalAuth(userId, command);
     }
+
+    @LoginRequired
+    @RequestMapping(value = "/user/{userId}/personalAuth", method = RequestMethod.PUT)
+    public PersonalAuthVO updatePersonalAuthInfo(@PathVariable("userId")Long userId,
+                                                 @Validated @RequestBody ApplyPersonalAuthCommand command,
+                                                 BindingResult result){
+        if (result.hasErrors())
+            throw new BaseException(result.getFieldError().getDefaultMessage());
+        return userService.updatePersonalAuthInfo(userId, command);
+    }
 }

+ 1 - 1
site/src/main/java/com/mooctest/crowd/site/service/UserService.java

@@ -1 +1 @@
-package com.mooctest.crowd.site.service;

import com.mooctest.crowd.site.command.ApplyPersonalAuthCommand;
import com.mooctest.crowd.site.command.LoginCommand;
import com.mooctest.crowd.site.command.RegisterCommand;
import com.mooctest.crowd.site.data.dto.UserDTO;
import com.mooctest.crowd.domain.exception.AccountNotExistException;
import com.mooctest.crowd.domain.exception.BadRequestException;
import com.mooctest.crowd.domain.exception.PasswordErrorException;
import com.mooctest.crowd.site.data.vo.EvolutionAgencyVO;
import com.mooctest.crowd.site.data.vo.PersonalAuthVO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: xuexb
 * @Date: 2019.7.22 16:52
 */
public interface UserService {
    UserDTO register(RegisterCommand registerCommand) throws AccountNotExistException;

    UserDTO loginByMobileAndPwd(LoginCommand loginCommand) throws PasswordErrorException, AccountNotExistException, BadRequestException;

    List<EvolutionAgencyVO> getAgencies();

    UserDTO getUser(Long userId);

    PersonalAuthVO applyPersonalAuth(Long userId, ApplyPersonalAuthCommand command);
}
+package com.mooctest.crowd.site.service;

import com.mooctest.crowd.site.command.ApplyPersonalAuthCommand;
import com.mooctest.crowd.site.command.LoginCommand;
import com.mooctest.crowd.site.command.RegisterCommand;
import com.mooctest.crowd.site.data.dto.UserDTO;
import com.mooctest.crowd.domain.exception.AccountNotExistException;
import com.mooctest.crowd.domain.exception.BadRequestException;
import com.mooctest.crowd.domain.exception.PasswordErrorException;
import com.mooctest.crowd.site.data.vo.EvolutionAgencyVO;
import com.mooctest.crowd.site.data.vo.PersonalAuthVO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: xuexb
 * @Date: 2019.7.22 16:52
 */
public interface UserService {
    UserDTO register(RegisterCommand registerCommand) throws AccountNotExistException;

    UserDTO loginByMobileAndPwd(LoginCommand loginCommand) throws PasswordErrorException, AccountNotExistException, BadRequestException;

    List<EvolutionAgencyVO> getAgencies();

    UserDTO getUser(Long userId);

    PersonalAuthVO applyPersonalAuth(Long userId, ApplyPersonalAuthCommand command);

    PersonalAuthVO updatePersonalAuthInfo(Long userId, ApplyPersonalAuthCommand command);
}

File diff suppressed because it is too large
+ 0 - 0
site/src/main/java/com/mooctest/crowd/site/service/impl/UserServiceImpl.java


Some files were not shown because too many files changed in this diff