管理员控制器 @author Administrator
| 25 | * |
| 26 | */ |
| 27 | @RestController |
| 28 | public class AdminController { |
| 29 | private static final Logger logger = LogManager.getLogger(AdminController.class); |
| 30 | |
| 31 | @Resource AdminService adminService; |
| 32 | @Resource JsonComponent jsonComponent; |
| 33 | |
| 34 | /** |
| 35 | * 员工登录页面显示 |
| 36 | * @param username 员工账号 |
| 37 | * @return |
| 38 | * @throws Exception |
| 39 | */ |
| 40 | @RequestMapping(value="/admin/login",method=RequestMethod.GET) |
| 41 | public RequestResult loginUI(String username){ |
| 42 | Map<String, Object> returnValue = adminService.getLoginViewModel(username); |
| 43 | |
| 44 | return new RequestResult(ResultCode.SUCCESS, returnValue); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * 员工登录 |
| 49 | * @param username 账号 |
| 50 | * @param password 密码 |
| 51 | * @param captchaKey 验证码编号 |
| 52 | * @param captchaValue 验证码值 |
| 53 | * @param request 请求信息 |
| 54 | * @return |
| 55 | */ |
| 56 | @RequestMapping(value="/admin/login",method=RequestMethod.POST) |
| 57 | public RequestResult login(String username,String password,String captchaKey,String captchaValue, |
| 58 | HttpServletRequest request){ |
| 59 | String ip = IpAddress.getClientIpAddress(request); |
| 60 | AdminAuthorization adminAuthorization = adminService.login(username,password, captchaKey, captchaValue, ip); |
| 61 | |
| 62 | return new RequestResult(ResultCode.SUCCESS, adminAuthorization); |
| 63 | } |
| 64 | |
| 65 | |
| 66 | |
| 67 | /** |
| 68 | * 刷新令牌 |
| 69 | * @param refresh_token 刷新令牌 |
| 70 | * @return |
| 71 | */ |
| 72 | @RequestMapping(value="/admin/refreshToken",method=RequestMethod.POST) |
| 73 | public RequestResult refreshToken(String refresh_token){ |
| 74 | |
| 75 | AdminAuthorization authorization = adminService.refreshAccessToken(refresh_token); |
| 76 | return new RequestResult(ResultCode.SUCCESS,authorization); |
| 77 | } |
| 78 | |
| 79 | |
| 80 | /** |
| 81 | * 员工退出 |
| 82 | * @param authorization 授权令牌 |
| 83 | * @return |
| 84 | */ |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…