forked from dyf/fys-Multi-tenant
解决冲突
This commit is contained in:
@ -110,15 +110,6 @@ public class AppAuthController {
|
|||||||
return R.ok("退出成功");
|
return R.ok("退出成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户注销
|
|
||||||
*/
|
|
||||||
@PostMapping("/cancelAccount")
|
|
||||||
public R<Void> cancelAccount() {
|
|
||||||
loginService.cancelAccount();
|
|
||||||
return R.ok("用户注销成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户注册
|
* 用户注册
|
||||||
*/
|
*/
|
||||||
|
@ -3,8 +3,15 @@ package com.fuyuanshen.app.service.impl;
|
|||||||
import cn.dev33.satoken.exception.NotLoginException;
|
import cn.dev33.satoken.exception.NotLoginException;
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.fuyuanshen.app.domain.dto.APPForgotPasswordDTO;
|
||||||
|
import com.fuyuanshen.app.domain.dto.APPForgotPasswordSmsDTO;
|
||||||
|
import com.fuyuanshen.app.domain.dto.APPUpdateUserDTO;
|
||||||
|
import com.fuyuanshen.app.domain.vo.APPUserInfoVo;
|
||||||
import com.fuyuanshen.common.core.constant.Constants;
|
import com.fuyuanshen.common.core.constant.Constants;
|
||||||
|
import com.fuyuanshen.common.core.constant.GlobalConstants;
|
||||||
import com.fuyuanshen.common.core.domain.model.AppLoginUser;
|
import com.fuyuanshen.common.core.domain.model.AppLoginUser;
|
||||||
|
import com.fuyuanshen.common.core.exception.BadRequestException;
|
||||||
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||||
import com.fuyuanshen.common.core.utils.StringUtils;
|
import com.fuyuanshen.common.core.utils.StringUtils;
|
||||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||||
@ -12,9 +19,12 @@ import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.fuyuanshen.common.redis.utils.RedisUtils;
|
||||||
import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
|
import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
|
||||||
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
import com.fuyuanshen.common.satoken.utils.LoginHelper;
|
||||||
import com.fuyuanshen.common.tenant.helper.TenantHelper;
|
import com.fuyuanshen.common.tenant.helper.TenantHelper;
|
||||||
|
import com.fuyuanshen.system.domain.vo.SysOssVo;
|
||||||
|
import com.fuyuanshen.system.service.ISysOssService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -42,6 +52,7 @@ public class AppUserServiceImpl implements IAppUserService {
|
|||||||
|
|
||||||
private final AppUserMapper baseMapper;
|
private final AppUserMapper baseMapper;
|
||||||
|
|
||||||
|
private final ISysOssService sysOssService;
|
||||||
/**
|
/**
|
||||||
* 查询APP用户信息
|
* 查询APP用户信息
|
||||||
*
|
*
|
||||||
@ -148,4 +159,75 @@ public class AppUserServiceImpl implements IAppUserService {
|
|||||||
}
|
}
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public APPUserInfoVo getUserInfo() {
|
||||||
|
String username = AppLoginHelper.getUsername();
|
||||||
|
QueryWrapper<AppUser> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("user_name", username);
|
||||||
|
List<AppUser> appUsers = baseMapper.selectList(queryWrapper);
|
||||||
|
if(appUsers.isEmpty()){
|
||||||
|
throw new BadRequestException("用户不存在");
|
||||||
|
}
|
||||||
|
AppUser user = appUsers.get(0);
|
||||||
|
// AppUserVo user = baseMapper.selectVoById(userId);
|
||||||
|
|
||||||
|
APPUserInfoVo appUserVo = new APPUserInfoVo();
|
||||||
|
appUserVo.setId(user.getUserId());
|
||||||
|
appUserVo.setNickName(user.getNickName());
|
||||||
|
appUserVo.setGender(user.getSex());
|
||||||
|
appUserVo.setPhone(user.getPhonenumber());
|
||||||
|
appUserVo.setRegion(user.getRegion());
|
||||||
|
if(user.getAvatar() != null){
|
||||||
|
SysOssVo oss = sysOssService.getById(user.getAvatar());
|
||||||
|
if(oss != null){
|
||||||
|
appUserVo.setAvatarPath(oss.getUrl());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return appUserVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateUser(APPUpdateUserDTO bo) {
|
||||||
|
AppLoginUser appUser = AppLoginHelper.getLoginUser();
|
||||||
|
AppUserVo appUserVo = baseMapper.selectVoById(appUser.getUserId());
|
||||||
|
if(appUserVo == null){
|
||||||
|
throw new BadRequestException("用户不存在");
|
||||||
|
}
|
||||||
|
AppUser updUser= new AppUser();
|
||||||
|
updUser.setUserId(appUser.getUserId());
|
||||||
|
updUser.setNickName(bo.getNickName());
|
||||||
|
if(bo.getFile() != null){
|
||||||
|
SysOssVo oss = sysOssService.upload(bo.getFile());
|
||||||
|
updUser.setAvatar(oss.getOssId());
|
||||||
|
}
|
||||||
|
|
||||||
|
updUser.setRegion(bo.getRegion());
|
||||||
|
updUser.setSex(bo.getGender());
|
||||||
|
return baseMapper.update(updUser, new LambdaQueryWrapper<AppUser>().eq(AppUser::getUserId, appUser.getUserId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int forgotPassword(APPForgotPasswordDTO bo) {
|
||||||
|
AppUser appUser = baseMapper.appFindByUsername(bo.getPhoneNumber());
|
||||||
|
if (appUser == null) {
|
||||||
|
throw new BadRequestException("手机号不存在");
|
||||||
|
}
|
||||||
|
String verificationCode = RedisUtils.getCacheObject(GlobalConstants.APP_FORGOT_PASSWORD_SMS_KEY + bo.getPhoneNumber());
|
||||||
|
if (verificationCode == null) {
|
||||||
|
throw new BadRequestException("验证码已过期");
|
||||||
|
}
|
||||||
|
if(!bo.getVerificationCode().equals(verificationCode)){
|
||||||
|
throw new BadRequestException("验证码错误");
|
||||||
|
}
|
||||||
|
appUser.setPassword(bo.getPassword());
|
||||||
|
baseMapper.updateById(appUser);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int sendForgotPasswordSms(APPForgotPasswordSmsDTO dto) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user