|  |  |  | 
|---|
|  |  |  | import com.doumee.core.annotation.trace.Trace; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.model.LoginUserInfo; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.LoginDTO; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.UpdatePwdDto; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.WebLoginDTO; | 
|---|
|  |  |  | 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.BeanUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.context.annotation.Bean; | 
|---|
|  |  |  | import org.springframework.validation.annotation.Validated; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | private SystemLoginService systemLoginService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreventRepeat(limit = 10, lockTime = 10000) | 
|---|
|  |  |  | @ApiOperation("登录") | 
|---|
|  |  |  | @ApiOperation("登录 - 后端") | 
|---|
|  |  |  | @PostMapping("/login") | 
|---|
|  |  |  | public ApiResponse<String> login (@Validated @RequestBody LoginDTO dto, HttpServletRequest request) { | 
|---|
|  |  |  | return ApiResponse.success(systemLoginService.loginByPassword(dto, request)); | 
|---|
|  |  |  | return ApiResponse.success(systemLoginService.loginByPassword(dto, Constants.ONE, request)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreventRepeat(limit = 10, lockTime = 10000) | 
|---|
|  |  |  | @ApiOperation("登录 - H5") | 
|---|
|  |  |  | @PostMapping("/loginH5") | 
|---|
|  |  |  | public ApiResponse<String> loginH5 (@Validated @RequestBody WebLoginDTO dto, HttpServletRequest request) { | 
|---|
|  |  |  | LoginDTO loginDTO = new LoginDTO(); | 
|---|
|  |  |  | BeanUtils.copyProperties(dto,loginDTO); | 
|---|
|  |  |  | return ApiResponse.success(systemLoginService.loginByPassword(loginDTO, Constants.TWO, request)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("退出登录") | 
|---|
|  |  |  | 
|---|
|  |  |  | subject.logout(); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Trace(withRequestParameters = false) | 
|---|
|  |  |  | @ApiOperation("修改当前用户密码") | 
|---|
|  |  |  | @PostMapping("/updatePwd") | 
|---|
|  |  |  | 
|---|
|  |  |  | systemUserBiz.updatePwd(dto); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("获取当前登录的用户信息") | 
|---|
|  |  |  | @GetMapping("/getUserInfo") | 
|---|
|  |  |  | public ApiResponse<LoginUserInfo> getUserInfo () { | 
|---|