init
This commit is contained in:
@@ -38,6 +38,15 @@ public class User implements Serializable {
|
|||||||
* 用户类型: 0普通用户 1 内部用户
|
* 用户类型: 0普通用户 1 内部用户
|
||||||
*/
|
*/
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
/**
|
||||||
|
* 是否为VIP
|
||||||
|
*/
|
||||||
|
private Boolean openVip;
|
||||||
|
/**
|
||||||
|
* @see com.ruoyi.xq.enums.vip.VipTypeEnum
|
||||||
|
*/
|
||||||
|
@Schema(description = "开通的VIP类型")
|
||||||
|
private Integer vipType;
|
||||||
/**
|
/**
|
||||||
* 密码
|
* 密码
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -75,11 +75,11 @@ public class CurrentUserInfoVo {
|
|||||||
|
|
||||||
@Schema(description = "是否开通VIP")
|
@Schema(description = "是否开通VIP")
|
||||||
private Boolean openVip = false;
|
private Boolean openVip = false;
|
||||||
@Schema(description = "vip等级")
|
/**
|
||||||
|
* 还没有实现 TODO
|
||||||
|
*/
|
||||||
|
@Schema(description = "vip等级",hidden = true)
|
||||||
private Integer vipType;
|
private Integer vipType;
|
||||||
@Schema(description = "vip到期时间")
|
|
||||||
private LocalDateTime vipTimeout;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收益的余额
|
* 收益的余额
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ public enum VipStatusEnum {
|
|||||||
NORMAL(1,"正常"),
|
NORMAL(1,"正常"),
|
||||||
TIMEOUT(2,"已过期"),
|
TIMEOUT(2,"已过期"),
|
||||||
CLOSE(3,"已取消"),
|
CLOSE(3,"已取消"),
|
||||||
|
|
||||||
;
|
;
|
||||||
private final Integer code;
|
private final Integer code;
|
||||||
private final String text;
|
private final String text;
|
||||||
|
|||||||
@@ -116,11 +116,9 @@ public class CurrentUserManager {
|
|||||||
vo.setAlreadyAuthNum(userAuth.getAlreadyAuthNum());
|
vo.setAlreadyAuthNum(userAuth.getAlreadyAuthNum());
|
||||||
List<UserPictures> userPictures = userPicturesService.listByUserIdAuditingAndSuccess(user.getId());
|
List<UserPictures> userPictures = userPicturesService.listByUserIdAuditingAndSuccess(user.getId());
|
||||||
vo.setUserPicturesList(BeanConvertUtil.convertListTo(userPictures, UserPicturesDTO::new));
|
vo.setUserPicturesList(BeanConvertUtil.convertListTo(userPictures, UserPicturesDTO::new));
|
||||||
UserVip userVip = userVipService.getByUserVipMaster(userId);
|
if(user.getOpenVip() != null){
|
||||||
if(userVip != null){
|
vo.setOpenVip(user.getOpenVip());
|
||||||
vo.setOpenVip(true);
|
// vo.setVipType();
|
||||||
vo.setVipType(userVip.getVipType());
|
|
||||||
vo.setVipTimeout(userVip.getVipTimeout());
|
|
||||||
}
|
}
|
||||||
UserExtend userExtend = userExtendService.getByUserId(userId);
|
UserExtend userExtend = userExtendService.getByUserId(userId);
|
||||||
vo.setIncomeCoin(userExtend.getIncomeCoin());
|
vo.setIncomeCoin(userExtend.getIncomeCoin());
|
||||||
|
|||||||
@@ -75,8 +75,7 @@ public class ImManager {
|
|||||||
throw new ServiceException("不能给自己发送哦!");
|
throw new ServiceException("不能给自己发送哦!");
|
||||||
}
|
}
|
||||||
// 判断VIP 只有VIP才可以发送消息
|
// 判断VIP 只有VIP才可以发送消息
|
||||||
UserVip userVip = userVipService.getByUserVipMaster(fromUserId);
|
if(!fromUser.getOpenVip()){
|
||||||
if(userVip == null){
|
|
||||||
throw new ServiceException(ErrorEnum.VIP_AUTH);
|
throw new ServiceException(ErrorEnum.VIP_AUTH);
|
||||||
}
|
}
|
||||||
// 检查拉黑
|
// 检查拉黑
|
||||||
|
|||||||
@@ -33,4 +33,6 @@ public interface UserVipService extends IService<UserVip> {
|
|||||||
Page<UserVipAdminVo> pageAdmin(PageQuery pageQuery, UserVipAdminVo bo);
|
Page<UserVipAdminVo> pageAdmin(PageQuery pageQuery, UserVipAdminVo bo);
|
||||||
|
|
||||||
void removeVip(Long id);
|
void removeVip(Long id);
|
||||||
|
|
||||||
|
void checkUserVip(Long userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,11 +119,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
|
|||||||
BeanConvertUtil.copyProperties(user,result);
|
BeanConvertUtil.copyProperties(user,result);
|
||||||
List<UserPictures> userPicturesList = userPicturesService.listByUserIdSuccess(userId);
|
List<UserPictures> userPicturesList = userPicturesService.listByUserIdSuccess(userId);
|
||||||
result.setUserPictureList(userPicturesList.stream().map(UserPictures::getPicture).collect(Collectors.toList()));
|
result.setUserPictureList(userPicturesList.stream().map(UserPictures::getPicture).collect(Collectors.toList()));
|
||||||
UserVip userVip = userVipService.getByUserVipMaster(user.getId());
|
result.setOpenVip(user.getOpenVip());
|
||||||
if(userVip != null){
|
result.setVipType(user.getVipType());
|
||||||
result.setOpenVip(true);
|
|
||||||
result.setVipType(userVip.getVipType());
|
|
||||||
}
|
|
||||||
Long currentUserId = LoginHelper.getUserId();
|
Long currentUserId = LoginHelper.getUserId();
|
||||||
if(userId.equals(currentUserId)){
|
if(userId.equals(currentUserId)){
|
||||||
return result;
|
return result;
|
||||||
@@ -218,8 +215,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
|
|||||||
return ShowAvatarUtil.showAvatar(false,false,avatar);
|
return ShowAvatarUtil.showAvatar(false,false,avatar);
|
||||||
}
|
}
|
||||||
UserAuth userAuth = userAuthService.getByUserId(userId);
|
UserAuth userAuth = userAuthService.getByUserId(userId);
|
||||||
UserVip userVip = userVipService.getByUserVipMaster(userId);
|
User user = this.getById(userId);
|
||||||
return ShowAvatarUtil.showAvatar(userAuth.getCarAuth()==1,userVip!=null, avatar);
|
return ShowAvatarUtil.showAvatar(user.getOpenVip(),userAuth.getCarAuth()==1, avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -228,12 +225,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
|
|||||||
boolean vip = false; // 是否为VIP
|
boolean vip = false; // 是否为VIP
|
||||||
boolean card = false; // 是否实名认证
|
boolean card = false; // 是否实名认证
|
||||||
Long userId = LoginHelper.getUserId();
|
Long userId = LoginHelper.getUserId();
|
||||||
UserVip userVip = null;
|
|
||||||
if(userId != null){
|
if(userId != null){
|
||||||
UserAuth userAuth = userAuthService.getByUserId(userId);
|
UserAuth userAuth = userAuthService.getByUserId(userId);
|
||||||
card = userAuth != null && userAuth.getCarAuth() == 1;
|
card = userAuth != null && userAuth.getCarAuth() == 1;
|
||||||
userVip = userVipService.getByUserVipMaster(userId);
|
User user = this.getById(userId);
|
||||||
vip = userVip != null;
|
vip = user.getOpenVip();
|
||||||
}
|
}
|
||||||
if(vipQuery != null){
|
if(vipQuery != null){
|
||||||
if(StringUtils.isNotEmpty(vipQuery.getProfession()) ||
|
if(StringUtils.isNotEmpty(vipQuery.getProfession()) ||
|
||||||
@@ -243,16 +239,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
|
|||||||
if(userId == null){
|
if(userId == null){
|
||||||
throw new ServiceException(ErrorEnum.VIP_AUTH);
|
throw new ServiceException(ErrorEnum.VIP_AUTH);
|
||||||
}
|
}
|
||||||
if(userVip == null){
|
if(!vip){
|
||||||
throw new ServiceException(ErrorEnum.VIP_AUTH);
|
throw new ServiceException(ErrorEnum.VIP_AUTH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Page<HomeUserListVo> page = baseMapper.homePageApp(params.build(), params);
|
Page<HomeUserListVo> page = baseMapper.homePageApp(params.build(), params);
|
||||||
List<HomeUserListVo> records = page.getRecords();
|
List<HomeUserListVo> records = page.getRecords();
|
||||||
List<Long> userIdArray = new ArrayList<>();
|
|
||||||
for (HomeUserListVo record : records) {
|
for (HomeUserListVo record : records) {
|
||||||
userIdArray.add(record.getUserId());
|
|
||||||
record.setBirthdayStr(BirthdayUtil.getMinBirthday(record.getBirthday()));
|
record.setBirthdayStr(BirthdayUtil.getMinBirthday(record.getBirthday()));
|
||||||
record.setAge(BirthdayUtil.getAge(record.getBirthday()));
|
record.setAge(BirthdayUtil.getAge(record.getBirthday()));
|
||||||
boolean showAvatarBool = ShowAvatarUtil.showAvatar(vip, card, record.getShowAvatar());
|
boolean showAvatarBool = ShowAvatarUtil.showAvatar(vip, card, record.getShowAvatar());
|
||||||
@@ -261,15 +255,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper,User> implements Use
|
|||||||
record.setAvatar(null);
|
record.setAvatar(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<UserVip> vips = userVipService.listUserVipMaster(userIdArray);
|
|
||||||
Map<Long, UserVip> userVipMap = vips.stream().collect(Collectors.toMap(UserVip::getUserId, Function.identity()));
|
|
||||||
for (HomeUserListVo record : records) {
|
|
||||||
UserVip userVipNode = userVipMap.get(record.getUserId());
|
|
||||||
if(userVip != null){
|
|
||||||
record.setOpenVip(true);
|
|
||||||
record.setVipType(userVipNode.getVipType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.xq.domain.User;
|
||||||
import com.ruoyi.xq.domain.UserStatus;
|
import com.ruoyi.xq.domain.UserStatus;
|
||||||
import com.ruoyi.xq.domain.UserVip;
|
import com.ruoyi.xq.domain.UserVip;
|
||||||
import com.ruoyi.xq.dto.admin.userstatus.UserStatusAdminVo;
|
import com.ruoyi.xq.dto.admin.userstatus.UserStatusAdminVo;
|
||||||
@@ -14,6 +15,7 @@ import com.ruoyi.xq.enums.ErrorEnum;
|
|||||||
import com.ruoyi.xq.enums.userstatus.PersonalsStatusEnum;
|
import com.ruoyi.xq.enums.userstatus.PersonalsStatusEnum;
|
||||||
import com.ruoyi.xq.enums.userstatus.ShowAvatarEnum;
|
import com.ruoyi.xq.enums.userstatus.ShowAvatarEnum;
|
||||||
import com.ruoyi.xq.mapper.UserStatusMapper;
|
import com.ruoyi.xq.mapper.UserStatusMapper;
|
||||||
|
import com.ruoyi.xq.service.UserService;
|
||||||
import com.ruoyi.xq.service.UserStatusService;
|
import com.ruoyi.xq.service.UserStatusService;
|
||||||
import com.ruoyi.xq.service.UserVipService;
|
import com.ruoyi.xq.service.UserVipService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -31,6 +33,8 @@ import java.time.LocalDateTime;
|
|||||||
public class UserStatusServiceImpl extends ServiceImpl<UserStatusMapper,UserStatus> implements UserStatusService {
|
public class UserStatusServiceImpl extends ServiceImpl<UserStatusMapper,UserStatus> implements UserStatusService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserVipService userVipService;
|
private UserVipService userVipService;
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserStatus getByUserId(Long userId) {
|
public UserStatus getByUserId(Long userId) {
|
||||||
@@ -41,8 +45,8 @@ public class UserStatusServiceImpl extends ServiceImpl<UserStatusMapper,UserStat
|
|||||||
public void updateStatus(UserStatusUpdateAppReq req) {
|
public void updateStatus(UserStatusUpdateAppReq req) {
|
||||||
UserStatus userStatus = this.getByUserId(req.getUserId());
|
UserStatus userStatus = this.getByUserId(req.getUserId());
|
||||||
if(req.getShowAvatar() != null && !req.getShowAvatar().equals(ShowAvatarEnum.ALL.getCode())){
|
if(req.getShowAvatar() != null && !req.getShowAvatar().equals(ShowAvatarEnum.ALL.getCode())){
|
||||||
UserVip userVip = userVipService.getByUserVipMaster(req.getUserId());
|
User user = userService.getById(req.getUserId());
|
||||||
if(userVip == null){
|
if(!user.getOpenVip()){
|
||||||
throw new ServiceException(ErrorEnum.VIP_AUTH.getText());
|
throw new ServiceException(ErrorEnum.VIP_AUTH.getText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,8 +55,8 @@ public class UserStatusServiceImpl extends ServiceImpl<UserStatusMapper,UserStat
|
|||||||
update.setAllowTransMobile(req.getAllowTransMobile());
|
update.setAllowTransMobile(req.getAllowTransMobile());
|
||||||
update.setAllowTransWx(req.getAllowTransWx());
|
update.setAllowTransWx(req.getAllowTransWx());
|
||||||
if(req.getPushVip() != null && req.getPushVip() == 1){
|
if(req.getPushVip() != null && req.getPushVip() == 1){
|
||||||
UserVip userVip = userVipService.getByUserVipMaster(req.getUserId());
|
User user = userService.getById(req.getUserId());
|
||||||
if(userVip == null){
|
if(!user.getOpenVip()){
|
||||||
throw new ServiceException(ErrorEnum.VIP_AUTH.getText());
|
throw new ServiceException(ErrorEnum.VIP_AUTH.getText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.ruoyi.common.core.domain.PageQuery;
|
|||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.helper.LoginHelper;
|
import com.ruoyi.common.helper.LoginHelper;
|
||||||
import com.ruoyi.xq.domain.User;
|
import com.ruoyi.xq.domain.User;
|
||||||
|
import com.ruoyi.xq.domain.UserStatus;
|
||||||
import com.ruoyi.xq.domain.UserVip;
|
import com.ruoyi.xq.domain.UserVip;
|
||||||
import com.ruoyi.xq.domain.VipOrder;
|
import com.ruoyi.xq.domain.VipOrder;
|
||||||
import com.ruoyi.xq.dto.admin.user.UserVipAdminVo;
|
import com.ruoyi.xq.dto.admin.user.UserVipAdminVo;
|
||||||
@@ -20,6 +21,8 @@ import com.ruoyi.xq.enums.vip.VipStatusEnum;
|
|||||||
import com.ruoyi.xq.enums.vip.VipTypeEnum;
|
import com.ruoyi.xq.enums.vip.VipTypeEnum;
|
||||||
import com.ruoyi.xq.manager.OrderNoUtil;
|
import com.ruoyi.xq.manager.OrderNoUtil;
|
||||||
import com.ruoyi.xq.mapper.UserVipMapper;
|
import com.ruoyi.xq.mapper.UserVipMapper;
|
||||||
|
import com.ruoyi.xq.service.UserService;
|
||||||
|
import com.ruoyi.xq.service.UserStatusService;
|
||||||
import com.ruoyi.xq.service.UserVipService;
|
import com.ruoyi.xq.service.UserVipService;
|
||||||
import com.ruoyi.xq.service.VipOrderService;
|
import com.ruoyi.xq.service.VipOrderService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -44,6 +47,10 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipMapper,UserVip> imple
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private VipOrderService vipOrderService;
|
private VipOrderService vipOrderService;
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
@Autowired
|
||||||
|
private UserStatusService userStatusService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserVip getUserVip(Long userId, Integer vipType){
|
public UserVip getUserVip(Long userId, Integer vipType){
|
||||||
@@ -132,6 +139,9 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipMapper,UserVip> imple
|
|||||||
userVip.setVipTimeout(userVip.getVipTimeout().plusMonths(vipMonth));
|
userVip.setVipTimeout(userVip.getVipTimeout().plusMonths(vipMonth));
|
||||||
this.saveOrUpdate(userVip);
|
this.saveOrUpdate(userVip);
|
||||||
}
|
}
|
||||||
|
userService.update(Wrappers.lambdaUpdate(User.class)
|
||||||
|
.eq(User::getId, user.getId())
|
||||||
|
.set(User::getOpenVip, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -140,10 +150,27 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipMapper,UserVip> imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void removeVip(Long id) {
|
public void removeVip(Long id) {
|
||||||
this.update(Wrappers.lambdaUpdate(UserVip.class)
|
this.update(Wrappers.lambdaUpdate(UserVip.class)
|
||||||
.eq(UserVip::getId,id)
|
.eq(UserVip::getId,id)
|
||||||
.set(UserVip::getVipStatus, VipStatusEnum.CLOSE.getCode()));
|
.set(UserVip::getVipStatus, VipStatusEnum.CLOSE.getCode()));
|
||||||
|
UserVip userVip = this.getById(id);
|
||||||
|
UserVipService service = SpringUtil.getBean(UserVipService.class);
|
||||||
|
service.checkUserVip(userVip.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkUserVip(Long userId){
|
||||||
|
UserVip vip = this.getByUserVipMaster(userId);
|
||||||
|
userService.update(Wrappers.lambdaUpdate(User.class)
|
||||||
|
.eq(User::getId, userId)
|
||||||
|
.set(User::getOpenVip, vip!=null));
|
||||||
|
if(vip == null){
|
||||||
|
userStatusService.update(Wrappers.lambdaUpdate(UserStatus.class)
|
||||||
|
.eq(UserStatus::getUserId, userId)
|
||||||
|
.set(UserStatus::getPushVip, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
order by t1.id desc
|
order by t1.id desc
|
||||||
</select>
|
</select>
|
||||||
<select id="homePageApp" resultType="com.ruoyi.xq.dto.app.user.vo.HomeUserListVo">
|
<select id="homePageApp" resultType="com.ruoyi.xq.dto.app.user.vo.HomeUserListVo">
|
||||||
select t1.id as user_id, t1.avatar, t1.gender, t1.nickname, t1.birthday, t1.residence_city_name,
|
select t1.id as user_id, t1.avatar, t1.gender, t1.nickname, t1.birthday, t1.residence_city_name,t1.open_vip,t1.vip_type,
|
||||||
t1.education, t1.profession, if(t2.card_num_auth = 1, 1, 0) as cardNumAuthBool,t4.show_avatar
|
t1.education, t1.profession, if(t2.card_num_auth = 1, 1, 0) as cardNumAuthBool,t4.show_avatar
|
||||||
from xq_user t1
|
from xq_user t1
|
||||||
join xq_user_auth t2 on t1.id = t2.user_id
|
join xq_user_auth t2 on t1.id = t2.user_id
|
||||||
|
|||||||
Reference in New Issue
Block a user