Commit dee76380 authored by yaobaizheng's avatar yaobaizheng

用户服务个人中心信息返回

parent b03cdeb3
...@@ -54,4 +54,17 @@ public class SysUserController { ...@@ -54,4 +54,17 @@ public class SysUserController {
public boolean update(@RequestBody @Validated ForgetVo forgetVo) { public boolean update(@RequestBody @Validated ForgetVo forgetVo) {
return this.sysUserInfoService.forget(forgetVo, SendMsgTypeEnum.UPDATE_PASSWORD.getCode()); return this.sysUserInfoService.forget(forgetVo, SendMsgTypeEnum.UPDATE_PASSWORD.getCode());
} }
/**
* @description: 获取用户信息
* @date: 2023/11/23 10:21
* @param: [token]
* @return: String
**/
@PostMapping("/get")
@ApiOperation(value = "获取用户信息")
public String get(HttpServletRequest request) {
return this.sysUserInfoService.get(request.getHeader(Constants.TOKEN_HEADER));
}
} }
...@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.lyy.user.moudle.user.entity.SysUserInfo; import com.lyy.user.moudle.user.entity.SysUserInfo;
import com.lyy.user.moudle.user.vo.*; import com.lyy.user.moudle.user.vo.*;
import javax.servlet.http.HttpServletRequest;
/** /**
* @author 26996 * @author 26996
* @description 针对表【sys_user_info(用户信息表)】的数据库操作Service * @description 针对表【sys_user_info(用户信息表)】的数据库操作Service
...@@ -57,4 +59,12 @@ public interface SysUserInfoService extends IService<SysUserInfo> { ...@@ -57,4 +59,12 @@ public interface SysUserInfoService extends IService<SysUserInfo> {
* @return: boolean * @return: boolean
**/ **/
boolean forget(ForgetVo forgetVo,Integer code); boolean forget(ForgetVo forgetVo,Integer code);
/**
* @description: 获取用户信息
* @date: 2023/11/23 10:21
* @param: [token]
* @return: String
**/
String get(String token);
} }
...@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lyy.user.config.LyyConfig; import com.lyy.user.config.LyyConfig;
import com.lyy.user.config.exception.ServiceException; import com.lyy.user.config.exception.ServiceException;
import com.lyy.user.constant.Constants; import com.lyy.user.constant.Constants;
import com.lyy.user.domain.JwtInfo;
import com.lyy.user.enums.SendMsgTypeEnum; import com.lyy.user.enums.SendMsgTypeEnum;
import com.lyy.user.moudle.login.vo.SmsVo; import com.lyy.user.moudle.login.vo.SmsVo;
import com.lyy.user.moudle.smslog.entity.SysSmsLogEntity; import com.lyy.user.moudle.smslog.entity.SysSmsLogEntity;
...@@ -36,6 +37,7 @@ import org.springframework.util.ObjectUtils; ...@@ -36,6 +37,7 @@ import org.springframework.util.ObjectUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
...@@ -270,6 +272,12 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs ...@@ -270,6 +272,12 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
return this.updateById(sysUserInfo); return this.updateById(sysUserInfo);
} }
@Override
public String get(String token) {
JwtInfo jwtUser = JwtTokenUtil.getJwtUser(token);
return StringUtils.overlay(jwtUser.getPhone(), "****", 3, 7);
}
private void check(String phone) { private void check(String phone) {
if (StringUtils.isEmpty(phone)) { if (StringUtils.isEmpty(phone)) {
throw new ServiceException("手机号不能为空"); throw new ServiceException("手机号不能为空");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment