|  |  |  | 
|---|
|  |  |  | package com.moral.api.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.moral.api.entity.SysConfig; | 
|---|
|  |  |  | import com.moral.api.pojo.dto.login.LoginDTO; | 
|---|
|  |  |  | import com.moral.api.pojo.form.LoginForm; | 
|---|
|  |  |  | import com.moral.api.pojo.form.LogoutForm; | 
|---|
|  |  |  | import com.moral.api.pojo.form.login.LoginForm; | 
|---|
|  |  |  | import com.moral.api.pojo.form.login.LogoutForm; | 
|---|
|  |  |  | import com.moral.api.pojo.redisBean.AccountInfoDTO; | 
|---|
|  |  |  | import com.moral.api.pojo.vo.login.AccountInfoVO; | 
|---|
|  |  |  | import com.moral.api.pojo.vo.login.LoginVO; | 
|---|
|  |  |  | import com.moral.api.service.ManageAccountService; | 
|---|
|  |  |  | import com.moral.api.service.SysConfigService; | 
|---|
|  |  |  | import com.moral.constant.Constants; | 
|---|
|  |  |  | import com.moral.constant.ResponseCodeEnum; | 
|---|
|  |  |  | import com.moral.constant.ResultMessage; | 
|---|
|  |  |  | import com.moral.pojo.VerificationCode; | 
|---|
|  |  |  | import com.moral.util.KaptchaUtils; | 
|---|
|  |  |  | import com.moral.util.TokenUtils; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 
|---|
|  |  |  | **/ | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @Api(tags = {"登陆模块"}) | 
|---|
|  |  |  | @CrossOrigin(origins = "*", maxAge = 3600) | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | public class LoginController { | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | ManageAccountService accountService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | SysConfigService sysConfigService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @Description: 登陆接口 | 
|---|
|  |  |  | 
|---|
|  |  |  | LoginVO loginVO = LoginVO.convert(loginDTO); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return new ResultMessage(loginDTO.getCode(), loginDTO.getMsg(), loginVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @Description: 获取用户信息接口 | 
|---|
|  |  |  | * @Param: [] | 
|---|
|  |  |  | * @return: com.moral.constant.ResultMessage | 
|---|
|  |  |  | * @Author: 陈凯裕 | 
|---|
|  |  |  | * @Date: 2021/6/9 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping("getAccountInfo") | 
|---|
|  |  |  | public ResultMessage getAccountInfo(){ | 
|---|
|  |  |  | AccountInfoDTO dto = (AccountInfoDTO) TokenUtils.getUserInfo(); | 
|---|
|  |  |  | AccountInfoVO vo = AccountInfoVO.convert(dto); | 
|---|
|  |  |  | return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(), vo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | * @Author: 陈凯裕 | 
|---|
|  |  |  | * @Date: 2021/3/18 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping | 
|---|
|  |  |  | @GetMapping("verificationCode/config") | 
|---|
|  |  |  | public ResultMessage verifyConfig(){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | QueryWrapper<SysConfig> wrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | wrapper.eq(Constants.MANAGE_VERIFICATIONCODE_COLUMN,Constants.MANAGE_VERIFICATIONCODE_VALUE); | 
|---|
|  |  |  | SysConfig config = sysConfigService.getOne(wrapper); | 
|---|
|  |  |  | if(config.getCode().equals(Constants.VERFICATIONCODE_OPEN)) | 
|---|
|  |  |  | return new ResultMessage(ResponseCodeEnum.VERIFICATION_OPEN,null); | 
|---|
|  |  |  | return new ResultMessage(ResponseCodeEnum.VERIFICATION_CLOSE,null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|