This commit is contained in:
张良(004796)
2024-01-19 16:55:36 +08:00
parent edbae82e7d
commit a98d191bb4
17 changed files with 189 additions and 244 deletions

View File

@@ -1,51 +0,0 @@
package com.ruoyi.cai.enums;
import lombok.Getter;
@Getter
public enum AccountBusinessEnum {
/**
* 提现
*/
// WITHDRAW(AccountChangeEnum.WITHDRAW,null,null,null),
/**
* 守护
*/
GUARD(AccountChangeEnum.USER_GUARD,AccountChangeEnum.ANCHOR_GUARD,AccountChangeEnum.ONE_GUARD,AccountChangeEnum.UNION_GUARD),
/**
* 赠送礼物
*/
GIFT(AccountChangeEnum.USER_GIFT,AccountChangeEnum.ANCHOR_GIFT,AccountChangeEnum.ONE_GIFT,AccountChangeEnum.UNION_GIFT),
/**
* 视频
*/
VIDEO(AccountChangeEnum.USER_VIDEO,AccountChangeEnum.ANCHOR_VIDEO,AccountChangeEnum.ONE_VIDEO,AccountChangeEnum.UNION_VIDEO),
/**
* 充值
*/
RECHARGE(AccountChangeEnum.USER_RECHARGE,null,AccountChangeEnum.ONE_RECHARGE,null),
;
private final AccountChangeEnum sourceEnum;
private final AccountChangeEnum targetEnum;
private final AccountChangeEnum oneEnum;
private final AccountChangeEnum unionEnum;
AccountBusinessEnum(AccountChangeEnum sourceEnum, AccountChangeEnum targetEnum, AccountChangeEnum oneEnum, AccountChangeEnum unionEnum) {
this.sourceEnum = sourceEnum;
this.targetEnum = targetEnum;
this.oneEnum = oneEnum;
this.unionEnum = unionEnum;
}
public static AccountBusinessEnum getByName(String name){
AccountBusinessEnum[] values = AccountBusinessEnum.values();
for (AccountBusinessEnum value : values) {
if(value.name().equals(name)){
return value;
}
}
return null;
}
}

View File

@@ -1,57 +0,0 @@
package com.ruoyi.cai.enums;
import lombok.Getter;
@Getter
public enum AccountChangeEnum {
// 用户端
USER_RECHARGE(101,"充值","购买紫贝","RECHARGE",""),
// A2(102,"注册奖励","增加充值的紫贝"),
// A3(103,"首充奖励","增加充值的紫贝"),
USER_GIFT(104,"送出礼物","送出礼物","GIFT",""),
USER_GUARD(105,"送出守护","送出守护","GUARD",""),
USER_VIDEO(106,"视频支出","视频支出","VIDEO",""),
USER_IM(107,"聊天支出","聊天支出","IM",""),
WITHDRAW(108,"提现","提现","WITHDRAW",""),
WITHDRAW_ROLLBACK(109,"提现失败","提现失败","WITHDRAW",""),
// 主播端
ANCHOR_GIFT(201,"收到礼物","收到礼物","GIFT",""),
ANCHOR_GUARD(202,"收到守护","收到守护","GUARD",""),
ANCHOR_VIDEO(203,"视频收入","视频收入","VIDEO",""),
ANCHOR_IM(204,"聊天收入","视频收入","IM",""),
// 分销
ONE_RECHARGE(301,"充值分成","邀请奖励","RECHARGE",""),
ONE_GIFT(302,"礼物分成","邀请奖励","GIFT",""),
ONE_GUARD(303,"守护分成","邀请奖励","GUARD",""),
ONE_VIDEO(304,"视频分成","邀请奖励","VIDEO",""),
// 工会
UNION_GIFT(401,"礼物工会分成","工会提成","GIFT",""),
UNION_GUARD(402,"守护工会分成","工会提成","GUARD",""),
UNION_VIDEO(403,"视频工会分成","工会提成","VIDEO",""),
// 系统
SYSTEM_COIN_INCS(9001,"后台新增余额","系统调账","RECHARGE","后台人工调增余额"),
SYSTEM_COIN_DECR(9002,"后台减少余额","系统调账","RECHARGE","后台人工调减余额"),
SYSTEM_INCOME_COIN_INCS(9003,"后台新增收益","系统调账","RECHARGE","后台人工调增收益"),
SYSTEM_INCOME_COIN_DECR(9004,"后台减小收益","系统调账","RECHARGE","后台人工调减收益"),
;
private final Integer code;
private final String adminName;
private final String appName;
private final String traceIdLink;
private final String desc;
AccountChangeEnum(Integer code, String adminName, String appName, String traceIdLink, String desc) {
this.code = code;
this.adminName = adminName;
this.appName = appName;
this.traceIdLink = traceIdLink;
this.desc = desc;
}
}

View File

@@ -1,7 +1,8 @@
package com.ruoyi.cai.enums;
import com.ruoyi.cai.enums.account.AccountChangeCodeEnum;
import com.ruoyi.cai.enums.account.AccountTypeEnum;
import lombok.Getter;
import org.springframework.stereotype.Component;
/**
@@ -22,4 +23,76 @@ public enum ConsumeLogType {
ConsumeLogType(Integer code) {
this.code = code;
}
public static ConsumeLogType getByCode(Integer code){
ConsumeLogType[] values = ConsumeLogType.values();
for (ConsumeLogType value : values) {
if(value.getCode().equals(code)){
return value;
}
}
return null;
}
public static AccountChangeCodeEnum getTargetChange(ConsumeLogType type){
if(type == RECHARGE){ // 充值
return AccountChangeCodeEnum.RECHARGE;
}else if(type == GIFT){
return AccountChangeCodeEnum.GIFT_INCOME;
}else if(type == GUARD){
return AccountChangeCodeEnum.GUARD_INCOME;
}else if(type == VIDEO){
return AccountChangeCodeEnum.VIDEO_INCOME;
}
return null;
}
public static AccountChangeCodeEnum getSourceChange(ConsumeLogType type, AccountTypeEnum typeEnum){
if(type == GIFT){
if(typeEnum == AccountTypeEnum.COIN){
return AccountChangeCodeEnum.GIFT_COIN_OUT;
}else{
return AccountChangeCodeEnum.GIFT_INCOME_COIN_OUT;
}
}else if(type == GUARD){
if(typeEnum == AccountTypeEnum.COIN){
return AccountChangeCodeEnum.GUARD_COIN_OUT;
}else{
return AccountChangeCodeEnum.GUARD_INCOME_COIN_OUT;
}
}else if(type == VIDEO){
if(typeEnum == AccountTypeEnum.COIN){
return AccountChangeCodeEnum.VIDEO_COIN_OUT;
}else{
return AccountChangeCodeEnum.VIDEO_INCOME_COIN_OUT;
}
}
return null;
}
public static AccountChangeCodeEnum getOneInviteChange(ConsumeLogType type){
if(type == GIFT){
return AccountChangeCodeEnum.GIFT_INVITE;
}else if(type == GUARD){
return AccountChangeCodeEnum.GUARD_INVITE;
}else if(type == VIDEO){
return AccountChangeCodeEnum.VIDEO_INVITE;
}else if(type == RECHARGE){ // 充值
return AccountChangeCodeEnum.RECHARGE_INVITE;
}
return null;
}
public static AccountChangeCodeEnum getUnionChange(ConsumeLogType type){
if(type == GIFT){
return AccountChangeCodeEnum.UNION_INVITE;
}else if(type == GUARD){
return AccountChangeCodeEnum.UNION_INVITE;
}else if(type == VIDEO){
return AccountChangeCodeEnum.UNION_INVITE;
}
return null;
}
}

View File

@@ -5,41 +5,41 @@ import lombok.Getter;
@Getter
public enum AccountChangeCodeEnum {
RECHARGE(101,AccountCateEnum.RECHARGE,"余额充值",AccountTypeEnum.COIN),
RECHARGE(101,AccountCateEnum.RECHARGE,"余额充值",AccountTypeEnum.COIN,""),
WITHDRAW(201,AccountCateEnum.WITHDRAW,"提现",AccountTypeEnum.INCOME_COIN),
WITHDRAW_FAIL(202,AccountCateEnum.WITHDRAW,"提现失败",AccountTypeEnum.INCOME_COIN),
WITHDRAW(201,AccountCateEnum.WITHDRAW,"提现",AccountTypeEnum.INCOME_COIN,""),
WITHDRAW_FAIL(202,AccountCateEnum.WITHDRAW,"提现失败",AccountTypeEnum.INCOME_COIN,""),
VIDEO_INCOME(301,AccountCateEnum.VIDEO,"视频收入",AccountTypeEnum.INCOME_COIN),
VIDEO_COIN_OUT(302,AccountCateEnum.VIDEO,"视频支出",AccountTypeEnum.COIN),
VIDEO_INCOME_COIN_OUT(303,AccountCateEnum.VIDEO,"视频支出",AccountTypeEnum.INCOME_COIN),
VIDEO_INCOME(301,AccountCateEnum.VIDEO,"视频收入",AccountTypeEnum.INCOME_COIN,""),
VIDEO_COIN_OUT(302,AccountCateEnum.VIDEO,"视频支出",AccountTypeEnum.COIN,""),
VIDEO_INCOME_COIN_OUT(303,AccountCateEnum.VIDEO,"视频支出",AccountTypeEnum.INCOME_COIN,""),
GIFT_INCOME(401,AccountCateEnum.GIFT,"收到礼物",AccountTypeEnum.INCOME_COIN),
GIFT_COIN_OUT(402,AccountCateEnum.GIFT,"送出礼物",AccountTypeEnum.COIN),
GIFT_INCOME_COIN_OUT(403,AccountCateEnum.GIFT,"送出礼物",AccountTypeEnum.INCOME_COIN),
GIFT_INCOME(401,AccountCateEnum.GIFT,"收到礼物",AccountTypeEnum.INCOME_COIN,""),
GIFT_COIN_OUT(402,AccountCateEnum.GIFT,"送出礼物",AccountTypeEnum.COIN,""),
GIFT_INCOME_COIN_OUT(403,AccountCateEnum.GIFT,"送出礼物",AccountTypeEnum.INCOME_COIN,""),
FAST_WITHDRAW(501,AccountCateEnum.SYSTEM,"首冲奖励",AccountTypeEnum.INCOME_COIN),
WITHDRAW_INVITE(502,AccountCateEnum.SYSTEM,"邀请奖励(充值)",AccountTypeEnum.INCOME_COIN),
VIDEO_INVITE(503,AccountCateEnum.SYSTEM,"邀请奖励(视频)",AccountTypeEnum.INCOME_COIN),
GIFT_INVITE(504,AccountCateEnum.SYSTEM,"邀请奖励(礼物)",AccountTypeEnum.INCOME_COIN),
GUARD_INVITE(505,AccountCateEnum.SYSTEM,"邀请奖励(守护)",AccountTypeEnum.INCOME_COIN),
REGISTER_INVITE(506,AccountCateEnum.SYSTEM,"注册奖励",AccountTypeEnum.INCOME_COIN),
RAKE_INVITE(507,AccountCateEnum.SYSTEM,"排行榜奖励",AccountTypeEnum.INCOME_COIN),
FAST_WITHDRAW(501,AccountCateEnum.SYSTEM,"首冲奖励",AccountTypeEnum.INCOME_COIN,""),
RECHARGE_INVITE(502,AccountCateEnum.SYSTEM,"邀请奖励(充值)",AccountTypeEnum.INCOME_COIN,""),
VIDEO_INVITE(503,AccountCateEnum.SYSTEM,"邀请奖励(视频)",AccountTypeEnum.INCOME_COIN,""),
GIFT_INVITE(504,AccountCateEnum.SYSTEM,"邀请奖励(礼物)",AccountTypeEnum.INCOME_COIN,""),
GUARD_INVITE(505,AccountCateEnum.SYSTEM,"邀请奖励(守护)",AccountTypeEnum.INCOME_COIN,""),
REGISTER_INVITE(506,AccountCateEnum.SYSTEM,"注册奖励",AccountTypeEnum.INCOME_COIN,""),
RAKE_INVITE(507,AccountCateEnum.SYSTEM,"排行榜奖励",AccountTypeEnum.INCOME_COIN,""),
IM_INCOME(701,AccountCateEnum.IM,"收到的私信",AccountTypeEnum.INCOME_COIN),
IM_COIN_OUT(702,AccountCateEnum.IM,"送出私信",AccountTypeEnum.COIN),
IM_INCOME_COIN_OUT(703,AccountCateEnum.IM,"送出私信",AccountTypeEnum.INCOME_COIN),
IM_INCOME(701,AccountCateEnum.IM,"收到的私信",AccountTypeEnum.INCOME_COIN,""),
IM_COIN_OUT(702,AccountCateEnum.IM,"送出私信",AccountTypeEnum.COIN,""),
IM_INCOME_COIN_OUT(703,AccountCateEnum.IM,"送出私信",AccountTypeEnum.INCOME_COIN,""),
SYSTEM_COIN_INCS(801,AccountCateEnum.SYSTEM_TRANS,"系统调账",AccountTypeEnum.COIN),
SYSTEM_COIN_DECR(802,AccountCateEnum.SYSTEM_TRANS,"系统调账",AccountTypeEnum.COIN),
SYSTEM_INCOME_COIN_INCS(803,AccountCateEnum.SYSTEM_TRANS,"系统调账",AccountTypeEnum.INCOME_COIN),
SYSTEM_INCOME_COIN_DECR(804,AccountCateEnum.SYSTEM_TRANS,"系统调账",AccountTypeEnum.INCOME_COIN),
SYSTEM_COIN_INCS(801,AccountCateEnum.SYSTEM_TRANS,"系统调账",AccountTypeEnum.COIN,""),
SYSTEM_COIN_DECR(802,AccountCateEnum.SYSTEM_TRANS,"系统调账",AccountTypeEnum.COIN,""),
SYSTEM_INCOME_COIN_INCS(803,AccountCateEnum.SYSTEM_TRANS,"系统调账",AccountTypeEnum.INCOME_COIN,""),
SYSTEM_INCOME_COIN_DECR(804,AccountCateEnum.SYSTEM_TRANS,"系统调账",AccountTypeEnum.INCOME_COIN,""),
GUARD_INCOME(901,AccountCateEnum.GUARD,"收到守护",AccountTypeEnum.INCOME_COIN),
GUARD_COIN_OUT(902,AccountCateEnum.GUARD,"送出守护",AccountTypeEnum.COIN),
GUARD_INCOME_COIN_OUT(903,AccountCateEnum.GUARD,"送出守护",AccountTypeEnum.INCOME_COIN),
GUARD_INCOME(901,AccountCateEnum.GUARD,"收到守护",AccountTypeEnum.INCOME_COIN,""),
GUARD_COIN_OUT(902,AccountCateEnum.GUARD,"送出守护",AccountTypeEnum.COIN,""),
GUARD_INCOME_COIN_OUT(903,AccountCateEnum.GUARD,"送出守护",AccountTypeEnum.INCOME_COIN,""),
UNION_INVITE(1001,AccountCateEnum.UNION,"工会分成",AccountTypeEnum.INCOME_COIN),
UNION_INVITE(1001,AccountCateEnum.UNION,"工会分成",AccountTypeEnum.INCOME_COIN,""),
;
@@ -51,11 +51,13 @@ public enum AccountChangeCodeEnum {
* 2-收益
*/
private final AccountTypeEnum accountType;
private final String desc;
AccountChangeCodeEnum(Integer code, AccountCateEnum cate, String text, AccountTypeEnum accountType) {
AccountChangeCodeEnum(Integer code, AccountCateEnum cate, String text, AccountTypeEnum accountType, String desc) {
this.code = code;
this.cate = cate;
this.text = text;
this.accountType = accountType;
this.desc = desc;
}
}

View File

@@ -13,4 +13,14 @@ public enum AccountTypeEnum {
AccountTypeEnum(Integer code) {
this.code = code;
}
public static AccountTypeEnum getByCode(Integer code) {
AccountTypeEnum[] values = AccountTypeEnum.values();
for (AccountTypeEnum value : values) {
if(value.getCode().equals(code)){
return value;
}
}
return null;
}
}