nnnn
This commit is contained in:
@@ -6,6 +6,31 @@ ALTER TABLE cai_recharge_order
|
|||||||
ADD COLUMN `distribution` tinyint default 0 not null comment '是否參與分銷';
|
ADD COLUMN `distribution` tinyint default 0 not null comment '是否參與分銷';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `cai_account_delete` (
|
||||||
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '子账户ID',
|
||||||
|
`user_id` bigint unsigned NOT NULL COMMENT '用户ID',
|
||||||
|
`usercode` varchar(10) NOT NULL COMMENT '用户Code',
|
||||||
|
`coin` bigint NOT NULL DEFAULT '0' COMMENT '当前彩币数量',
|
||||||
|
`income_coin` bigint NOT NULL DEFAULT '0' COMMENT '收益的彩币数量',
|
||||||
|
`total_buy_money` decimal(20,2) NOT NULL DEFAULT '0.00' COMMENT '充值总额',
|
||||||
|
`total_buy_coin` bigint NOT NULL DEFAULT '0' COMMENT '充值彩贝总额',
|
||||||
|
`total_trd_money` decimal(20,2) NOT NULL DEFAULT '0.00' COMMENT '三方充值总额',
|
||||||
|
`message_income_coin` bigint NOT NULL DEFAULT '0' COMMENT '聊天收入',
|
||||||
|
`video_income_coin` bigint NOT NULL DEFAULT '0' COMMENT '视频收入',
|
||||||
|
`gift_income_coin` bigint NOT NULL DEFAULT '0' COMMENT '礼物收入',
|
||||||
|
`guard_income_coin` bigint NOT NULL DEFAULT '0' COMMENT '守护收入',
|
||||||
|
`union_income_coin` bigint NOT NULL DEFAULT '0' COMMENT '工会收入',
|
||||||
|
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '账户锁定 0 正常 1 锁定',
|
||||||
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`anchor_total_coin` bigint DEFAULT '0' COMMENT '主播总收入',
|
||||||
|
`points` bigint NOT NULL DEFAULT '0' COMMENT '积分',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
UNIQUE KEY `user_id` (`user_id`) USING BTREE
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='用户账户备份';
|
||||||
|
|
||||||
ALTER TABLE cai_user_info
|
ALTER TABLE cai_user_info
|
||||||
ADD COLUMN point_rate decimal(7, 2) default 0.00 not null comment '积分分销比例';
|
ADD COLUMN point_rate decimal(7, 2) default 0.00 not null comment '积分分销比例';
|
||||||
ALTER TABLE cai_recharge_order
|
ALTER TABLE cai_recharge_order
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package com.ruoyi.cai.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户账户对象 cai_account
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2023-12-23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("cai_account_delete")
|
||||||
|
public class AccountDelete implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子账户ID
|
||||||
|
*/
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
private String usercode;
|
||||||
|
/**
|
||||||
|
* 当前彩币数量
|
||||||
|
*/
|
||||||
|
private Long coin;
|
||||||
|
/**
|
||||||
|
* 收益的彩币数量
|
||||||
|
*/
|
||||||
|
private Long incomeCoin;
|
||||||
|
/**
|
||||||
|
* 积分
|
||||||
|
*/
|
||||||
|
private Long points;
|
||||||
|
/**
|
||||||
|
* 充值总额
|
||||||
|
*/
|
||||||
|
private BigDecimal totalBuyMoney;
|
||||||
|
/**
|
||||||
|
* 充值彩贝总额
|
||||||
|
*/
|
||||||
|
private Long totalBuyCoin;
|
||||||
|
/**
|
||||||
|
* 第四方充值总额
|
||||||
|
*/
|
||||||
|
private BigDecimal totalTrdMoney;
|
||||||
|
/**
|
||||||
|
* 聊天收入
|
||||||
|
*/
|
||||||
|
private Long messageIncomeCoin;
|
||||||
|
/** 视频收入 */
|
||||||
|
private Long videoIncomeCoin;
|
||||||
|
/** 礼物收入 */
|
||||||
|
private Long giftIncomeCoin;
|
||||||
|
/** 守护收入 */
|
||||||
|
private Long guardIncomeCoin;
|
||||||
|
/** 工会收入 */
|
||||||
|
private Long unionIncomeCoin;
|
||||||
|
/**
|
||||||
|
* 账户锁定 0 正常 1 锁定
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.ruoyi.cai.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.cai.domain.AccountDelete;
|
||||||
|
|
||||||
|
public interface AccountDeleteMapper extends BaseMapper<AccountDelete> {
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.ruoyi.cai.service.impl;
|
package com.ruoyi.cai.service.impl;
|
||||||
|
|
||||||
import cn.dev33.satoken.secure.BCrypt;
|
import cn.dev33.satoken.secure.BCrypt;
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@@ -16,6 +15,7 @@ import com.ruoyi.cai.dto.app.vo.user.*;
|
|||||||
import com.ruoyi.cai.dto.commom.user.MinUser;
|
import com.ruoyi.cai.dto.commom.user.MinUser;
|
||||||
import com.ruoyi.cai.enums.GenderEnum;
|
import com.ruoyi.cai.enums.GenderEnum;
|
||||||
import com.ruoyi.cai.im.ImManager;
|
import com.ruoyi.cai.im.ImManager;
|
||||||
|
import com.ruoyi.cai.mapper.AccountDeleteMapper;
|
||||||
import com.ruoyi.cai.mapper.UserMapper;
|
import com.ruoyi.cai.mapper.UserMapper;
|
||||||
import com.ruoyi.cai.notice.YunxinHttpService;
|
import com.ruoyi.cai.notice.YunxinHttpService;
|
||||||
import com.ruoyi.cai.service.*;
|
import com.ruoyi.cai.service.*;
|
||||||
@@ -24,6 +24,7 @@ import com.ruoyi.cai.ws.service.RoomService;
|
|||||||
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.common.helper.LoginHelper;
|
import com.ruoyi.common.helper.LoginHelper;
|
||||||
|
import com.ruoyi.common.utils.BeanConvertUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.redisson.api.RBucket;
|
import org.redisson.api.RBucket;
|
||||||
@@ -32,7 +33,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -270,6 +273,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||||||
.set(User::getPassword,BCrypt.hashpw(password)));
|
.set(User::getPassword,BCrypt.hashpw(password)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AccountDeleteMapper accountDeleteMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean removeUser(Long id) {
|
public boolean removeUser(Long id) {
|
||||||
@@ -287,6 +293,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||||||
if(!b){
|
if(!b){
|
||||||
throw new ServiceException("用户不存在");
|
throw new ServiceException("用户不存在");
|
||||||
}
|
}
|
||||||
|
Account account = accountService.getByUserId(user.getId());
|
||||||
|
if(account != null){
|
||||||
|
AccountDelete accountDelete = BeanConvertUtil.convertTo(account, AccountDelete::new);
|
||||||
|
accountDelete.setId(null);
|
||||||
|
accountDelete.setUsercode(user.getUsercode());
|
||||||
|
accountDelete.setCreateTime(LocalDateTime.now());
|
||||||
|
accountDeleteMapper.insert(accountDelete);
|
||||||
|
}
|
||||||
this.update(Wrappers.lambdaUpdate(User.class)
|
this.update(Wrappers.lambdaUpdate(User.class)
|
||||||
.eq(User::getInviteId, user.getId())
|
.eq(User::getInviteId, user.getId())
|
||||||
.set(User::getInviteId, null));
|
.set(User::getInviteId, null));
|
||||||
@@ -306,6 +320,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||||||
userMemberService.remove(Wrappers.lambdaQuery(UserMember.class).eq(UserMember::getUserId,id));
|
userMemberService.remove(Wrappers.lambdaQuery(UserMember.class).eq(UserMember::getUserId,id));
|
||||||
userForbidService.remove(Wrappers.lambdaQuery(UserForbid.class).eq(UserForbid::getId,id));
|
userForbidService.remove(Wrappers.lambdaQuery(UserForbid.class).eq(UserForbid::getId,id));
|
||||||
anchorApplyService.remove(Wrappers.lambdaQuery(AnchorApply.class).eq(AnchorApply::getId,id));
|
anchorApplyService.remove(Wrappers.lambdaQuery(AnchorApply.class).eq(AnchorApply::getId,id));
|
||||||
|
log.info("触发删除用户 userId={};usercode={}", user.getId(), user.getUsercode());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user