forked from dyf/fys-Multi-tenant
@ -1,14 +1,13 @@
|
||||
package com.fuyuanshen.app.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fuyuanshen.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* APP用户信息对象 app_user
|
||||
@ -96,9 +95,5 @@ public class AppUser extends TenantEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 地区
|
||||
*/
|
||||
private String region;
|
||||
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
package com.fuyuanshen.app.domain.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class APPForgotPasswordDTO {
|
||||
|
||||
@NotBlank(message = "手机号不能为空")
|
||||
private String phoneNumber;
|
||||
|
||||
|
||||
@NotBlank(message = "密码不能为空")
|
||||
private String password;
|
||||
|
||||
@NotBlank(message = "验证码不能为空")
|
||||
private String verificationCode;
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.fuyuanshen.app.domain.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class APPForgotPasswordSmsDTO {
|
||||
|
||||
@NotBlank(message = "手机号不能为空")
|
||||
private String phoneNumber;
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package com.fuyuanshen.app.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* @author: 默苍璃
|
||||
* @date: 2025-06-1818:36
|
||||
*/
|
||||
@Data
|
||||
public class APPUpdateUserDTO {
|
||||
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户地区
|
||||
*/
|
||||
private String region;
|
||||
|
||||
/**
|
||||
* 用户性别
|
||||
*/
|
||||
private String gender;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private MultipartFile file;
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package com.fuyuanshen.app.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class APPUserInfoVo {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String gender;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
private String avatarPath;
|
||||
|
||||
/**
|
||||
* 地区
|
||||
*/
|
||||
private String region;
|
||||
|
||||
}
|
@ -14,5 +14,4 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface AppUserMapper extends BaseMapperPlus<AppUser, AppUserVo> {
|
||||
|
||||
AppUser appFindByUsername(String phoneNumber);
|
||||
}
|
||||
|
@ -1,13 +1,9 @@
|
||||
package com.fuyuanshen.app.service;
|
||||
|
||||
import com.fuyuanshen.app.domain.bo.AppUserBo;
|
||||
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.app.domain.vo.AppUserVo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.app.domain.bo.AppUserBo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -69,12 +65,4 @@ public interface IAppUserService {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
APPUserInfoVo getUserInfo();
|
||||
|
||||
int updateUser(APPUpdateUserDTO bo);
|
||||
|
||||
int forgotPassword(APPForgotPasswordDTO bo);
|
||||
|
||||
int sendForgotPasswordSms(APPForgotPasswordSmsDTO dto);
|
||||
}
|
||||
|
@ -1,35 +1,24 @@
|
||||
package com.fuyuanshen.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuyuanshen.app.domain.AppUser;
|
||||
import com.fuyuanshen.app.domain.bo.AppUserBo;
|
||||
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.app.domain.vo.AppUserVo;
|
||||
import com.fuyuanshen.app.mapper.AppUserMapper;
|
||||
import com.fuyuanshen.app.service.IAppUserService;
|
||||
import com.fuyuanshen.common.core.constant.GlobalConstants;
|
||||
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.StringUtils;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.common.redis.utils.RedisUtils;
|
||||
import com.fuyuanshen.common.satoken.utils.AppLoginHelper;
|
||||
import com.fuyuanshen.system.domain.vo.SysOssVo;
|
||||
import com.fuyuanshen.system.service.ISysOssService;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fuyuanshen.app.domain.bo.AppUserBo;
|
||||
import com.fuyuanshen.app.domain.vo.AppUserVo;
|
||||
import com.fuyuanshen.app.domain.AppUser;
|
||||
import com.fuyuanshen.app.mapper.AppUserMapper;
|
||||
import com.fuyuanshen.app.service.IAppUserService;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Service业务层处理
|
||||
@ -44,8 +33,6 @@ public class AppUserServiceImpl implements IAppUserService {
|
||||
|
||||
private final AppUserMapper baseMapper;
|
||||
|
||||
private final ISysOssService sysOssService;
|
||||
|
||||
/**
|
||||
* 查询APP用户信息
|
||||
*
|
||||
@ -152,57 +139,4 @@ public class AppUserServiceImpl implements IAppUserService {
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public APPUserInfoVo getUserInfo() {
|
||||
Long userId = AppLoginHelper.getUserId();
|
||||
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());
|
||||
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());
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fuyuanshen.app.mapper.AppUserMapper">
|
||||
|
||||
<select id="appFindByUsername" resultType="com.fuyuanshen.app.domain.AppUser">
|
||||
select * from app_user where user_name = #{phoneNumber}
|
||||
</select>
|
||||
</mapper>
|
||||
|
Reference in New Issue
Block a user