|
|
@@ -6,14 +6,17 @@ import com.mooctest.crowd.site.command.AgencyUpdateCommand;
|
|
|
import com.mooctest.crowd.site.command.ApplyAgencyAuthCommand;
|
|
|
import com.mooctest.crowd.site.command.GenerateAgencyCommand;
|
|
|
import com.mooctest.crowd.site.data.dto.UserDTO;
|
|
|
+import com.mooctest.crowd.site.data.vo.AgencyVO;
|
|
|
import com.mooctest.crowd.site.data.vo.EvolutionAgencyVO;
|
|
|
import com.mooctest.crowd.site.service.AgencyService;
|
|
|
+import lombok.extern.java.Log;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
+import javax.validation.constraints.Pattern;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -46,6 +49,7 @@ public class AgencyController {
|
|
|
* @param command
|
|
|
* @return
|
|
|
*/
|
|
|
+ @LoginRequired
|
|
|
@RequestMapping(value = "/user/{userId}/agency", method = RequestMethod.POST)
|
|
|
public UserDTO authAgency(@PathVariable("userId") Long userId, @RequestBody @Validated ApplyAgencyAuthCommand command, BindingResult result){
|
|
|
if (result.hasErrors())
|
|
|
@@ -59,6 +63,7 @@ public class AgencyController {
|
|
|
* @param status
|
|
|
* @return
|
|
|
*/
|
|
|
+ @LoginRequired
|
|
|
@RequestMapping(value = "/user/{userId}/agency/status/", method = RequestMethod.PUT)
|
|
|
public UserDTO checkAuth(@PathVariable("userId") Long userId, @PathVariable("status") Integer status){
|
|
|
if (status > 1 || status < -1)
|
|
|
@@ -86,6 +91,7 @@ public class AgencyController {
|
|
|
* @param command
|
|
|
* @return
|
|
|
*/
|
|
|
+ @LoginRequired
|
|
|
@RequestMapping(value = "/user/{userId}/updateAgency", method = RequestMethod.POST)
|
|
|
public UserDTO updateAgencyInfo(@PathVariable("userId") Long userId, @RequestBody @Validated AgencyUpdateCommand command, BindingResult result){
|
|
|
if (result.hasErrors())
|
|
|
@@ -93,6 +99,12 @@ public class AgencyController {
|
|
|
return agencyService.updateAgencyInfo(userId, command);
|
|
|
}
|
|
|
|
|
|
+ @LoginRequired
|
|
|
+ @RequestMapping(value = "/user/{userId}/agency", method = RequestMethod.GET)
|
|
|
+ public AgencyVO getAgencyInfo(@PathVariable("userId") Long userId){
|
|
|
+ return agencyService.getAgencyDetails(userId);
|
|
|
+ }
|
|
|
+
|
|
|
@RequestMapping(value = "/agency/list", method = RequestMethod.GET)
|
|
|
public List<EvolutionAgencyVO> getAgencyList(){
|
|
|
return agencyService.getAgencyList();
|