|  |  |  | 
|---|
|  |  |  | import com.doumee.biz.system.SystemUserBiz; | 
|---|
|  |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
|---|
|  |  |  | import com.doumee.core.annotation.trace.Trace; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.model.LoginUserInfo; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.LoginUserInfo; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.LoginDTO; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.UpdatePwdDto; | 
|---|
|  |  |  | import com.doumee.service.system.SystemLoginService; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemLoginService systemLoginService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreventRepeat(limit = 10, lockTime = 10000) | 
|---|
|  |  |  | @ApiOperation("登录") | 
|---|
|  |  |  | @PostMapping("/login") | 
|---|
|  |  |  | public ApiResponse<String> login (@Validated @RequestBody LoginDTO dto, HttpServletRequest request) { | 
|---|
|  |  |  | dto.setCheckCode(true); | 
|---|
|  |  |  | return ApiResponse.success(systemLoginService.loginByPassword(dto, request)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Trace(withRequestParameters = false) | 
|---|
|  |  |  | @ApiOperation("修改当前用户密码") | 
|---|
|  |  |  | @PostMapping("/updatePwd") | 
|---|
|  |  |  | public ApiResponse updatePwd (@Validated @RequestBody UpdatePwdDto dto) { | 
|---|
|  |  |  | dto.setUserId(this.getLoginUser().getId()); | 
|---|
|  |  |  | dto.setUserId(this.getLoginUser(null).getId()); | 
|---|
|  |  |  | systemUserBiz.updatePwd(dto); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("获取当前登录的用户信息") | 
|---|
|  |  |  | @GetMapping("/getUserInfo") | 
|---|
|  |  |  | public ApiResponse<LoginUserInfo> getUserInfo () { | 
|---|
|  |  |  | return ApiResponse.success(this.getLoginUser()); | 
|---|
|  |  |  | return ApiResponse.success(this.getLoginUser(null)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|