¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.api.system; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | 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.dao.system.dto.LoginDTO; |
| | | import com.doumee.dao.system.dto.UpdatePwdDto; |
| | | import com.doumee.service.system.SystemLoginService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.subject.Subject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * @author Eva.Caesar Liu |
| | | * @date 2023/03/21 14:49 |
| | | */ |
| | | @Api(tags = "ç³»ç»åè½") |
| | | @Trace(exclude = true) |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/system") |
| | | public class SystemController extends BaseController { |
| | | |
| | | @Autowired |
| | | private SystemUserBiz systemUserBiz; |
| | | |
| | | @Autowired |
| | | private SystemLoginService systemLoginService; |
| | | |
| | | @PreventRepeat(limit = 10, lockTime = 10000) |
| | | @ApiOperation("ç»å½") |
| | | @PostMapping("/login") |
| | | public ApiResponse<String> login (@Validated @RequestBody LoginDTO dto, HttpServletRequest request) { |
| | | return ApiResponse.success(systemLoginService.loginByPassword(dto, request)); |
| | | } |
| | | |
| | | @ApiOperation("éåºç»å½") |
| | | @PostMapping("/logout") |
| | | public ApiResponse logout () { |
| | | Subject subject = SecurityUtils.getSubject(); |
| | | subject.logout(); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @Trace(withRequestParameters = false) |
| | | @ApiOperation("ä¿®æ¹å½åç¨æ·å¯ç ") |
| | | @PostMapping("/updatePwd") |
| | | public ApiResponse updatePwd (@Validated @RequestBody UpdatePwdDto dto) { |
| | | dto.setUserId(this.getLoginUser().getId()); |
| | | systemUserBiz.updatePwd(dto); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("è·åå½åç»å½çç¨æ·ä¿¡æ¯") |
| | | @GetMapping("/getUserInfo") |
| | | public ApiResponse<LoginUserInfo> getUserInfo () { |
| | | return ApiResponse.success(this.getLoginUser()); |
| | | } |
| | | } |