feat 钱包

This commit is contained in:
xxm
2023-06-24 22:47:55 +08:00
parent 3b06429b42
commit beadbb685f
10 changed files with 64 additions and 45 deletions

View File

@@ -10,10 +10,10 @@ public interface AliPayCode {
// 认证类型
/** 公钥 */
int AUTH_TYPE_KEY = 1;
String AUTH_TYPE_KEY = "key";
/** 证书 */
int AUTH_TYPE_CART = 2;
String AUTH_TYPE_CART = "cart";
// 渠道枚举
/** 目前PC支付必填 */

View File

@@ -8,69 +8,62 @@ package cn.bootx.platform.daxpay.code.paymodel;
*/
public interface WalletCode {
/**
* 系统操作
*/
int OPERATION_SOURCE_SYSTEM = 1;
/* 操作类型 */
/** 系统操作 */
String OPERATION_SOURCE_SYSTEM = "1";
/**
* 管理员操作
*/
int OPERATION_SOURCE_ADMIN = 2;
/** 管理员操作 */
String OPERATION_SOURCE_ADMIN = "";
/**
* 用户操作
*/
int OPERATION_SOURCE_USER = 3;
/** 用户操作 */
String OPERATION_SOURCE_USER = "3";
/**
* 钱包状态-正常
*/
int STATUS_NORMAL = 1;
/* 钱包状态 */
/** 钱包状态-正常 */
String STATUS_NORMAL = "";
/**
* 钱包状态-禁用
*/
int STATUS_FORBIDDEN = 2;
/** 钱包状态-禁用 */
String STATUS_FORBIDDEN = "";
/* 日志类型 */
/**
* 钱包日志-开通
*/
int LOG_ACTIVE = 1;
String LOG_ACTIVE = "";
/**
* 钱包日志-主动充值
*/
int LOG_RECHARGE = 2;
String LOG_RECHARGE = "";
/**
* 钱包日志-自动充值
*/
int LOG_AUTO_RECHARGE = 3;
String LOG_AUTO_RECHARGE = "";
/**
* 钱包日志-Admin余额变动
*/
int LOG_ADMIN_CHANGER = 4;
String LOG_ADMIN_CHANGER = "";
/**
* 钱包日志-支付
*/
int LOG_PAY = 5;
String LOG_PAY = "";
/**
* 钱包日志-系统扣除余额的日志
*/
int LOG_SYSTEM_REDUCE_BALANCE = 6;
String LOG_SYSTEM_REDUCE_BALANCE = "";
/**
* 钱包日志-退款
*/
int LOG_REFUND = 7;
String LOG_REFUND = "";
/**
* 钱包日志-取消支付返还
*/
int LOG_PAY_CLOSE = 8;
String LOG_PAY_CLOSE = "";
}

View File

@@ -73,7 +73,7 @@ public class AlipayConfig extends MpBaseEntity implements EntityBaseFunction<Ali
* @see AliPayCode#AUTH_TYPE_KEY
*/
@DbColumn(comment = "认证类型")
private Integer authType;
private String authType;
/** 签名类型 RSA/RSA2 */
@DbColumn(comment = "签名类型 RSA/RSA2")

View File

@@ -69,7 +69,7 @@ public class WalletManager extends BaseManager<WalletMapper, Wallet> {
/**
* 更新钱包状态
*/
public void setUpStatus(Long walletId, int status) {
public void setUpStatus(Long walletId, String status) {
lambdaUpdate().eq(Wallet::getId, walletId).set(Wallet::getStatus, status).update();
}

View File

@@ -1,5 +1,7 @@
package cn.bootx.platform.daxpay.core.channel.wallet.entity;
import cn.bootx.mybatis.table.modify.annotation.DbColumn;
import cn.bootx.mybatis.table.modify.annotation.DbTable;
import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
import cn.bootx.platform.daxpay.core.channel.wallet.convert.WalletConvert;
@@ -19,18 +21,25 @@ import java.math.BigDecimal;
*/
@EqualsAndHashCode(callSuper = true)
@Data
@DbTable(comment = "钱包")
@Accessors(chain = true)
@TableName("pay_wallet")
public class Wallet extends MpBaseEntity implements EntityBaseFunction<WalletDto> {
/** 关联用户id */
@DbColumn(comment = "关联用户id")
private Long userId;
/** 余额 */
@DbColumn(comment = "余额")
private BigDecimal balance;
/** 预冻结额度 */
@DbColumn(comment = "预冻结额度")
private BigDecimal freezeQuota;
/** 状态 */
private Integer status;
private String status;
@Override
public WalletDto toDto() {

View File

@@ -1,5 +1,7 @@
package cn.bootx.platform.daxpay.core.channel.wallet.entity;
import cn.bootx.mybatis.table.modify.annotation.DbColumn;
import cn.bootx.mybatis.table.modify.annotation.DbTable;
import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
import cn.bootx.platform.daxpay.core.channel.wallet.convert.WalletConvert;
@@ -12,41 +14,54 @@ import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* 钱包日志
* 钱包日志
*
* @author xxm
* @date 2020/12/8
*/
@EqualsAndHashCode(callSuper = true)
@Data
@DbTable(comment = "钱包日志")
@Accessors(chain = true)
@TableName("pay_wallet_log")
public class WalletLog extends MpBaseEntity implements EntityBaseFunction<WalletLogDto> {
/** 钱包id */
@DbColumn(comment = "钱包id")
private Long walletId;
/** 用户id */
@DbColumn(comment = "用户id")
private Long userId;
/** 类型 */
private Integer type;
@DbColumn(comment = "类型")
private String type;
/** 交易记录ID */
@DbColumn(comment = "交易记录ID")
private Long paymentId;
/** 备注 */
private String remark;
/** 业务ID */
@DbColumn(comment = "业务ID")
private String businessId;
/** 操作类型 */
private int operationSource;
/**
* 操作类型
* @see
*/
@DbColumn(comment = "操作类型")
private String operationSource;
/** 金额 */
@DbColumn(comment = "金额")
private BigDecimal amount;
/** 备注 */
@DbColumn(comment = "备注")
private String remark;
@Override
public WalletLogDto toDto() {
return WalletConvert.CONVERT.convert(this);

View File

@@ -1,5 +1,6 @@
package cn.bootx.platform.daxpay.core.channel.wallet.entity;
import cn.bootx.mybatis.table.modify.annotation.DbTable;
import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.daxpay.core.channel.base.entity.BasePayment;
import cn.bootx.platform.daxpay.core.channel.wallet.convert.WalletConvert;
@@ -17,6 +18,7 @@ import lombok.experimental.Accessors;
*/
@EqualsAndHashCode(callSuper = true)
@Data
@DbTable(comment = "钱包交易记录")
@Accessors(chain = true)
@TableName("pay_wallet_payment")
public class WalletPayment extends BasePayment implements EntityBaseFunction<WalletPaymentDto> {

View File

@@ -133,7 +133,7 @@ public class WalletService {
}
// 充值类型
List<Integer> chargeLogType = Lists.newArrayList(WalletCode.LOG_RECHARGE, WalletCode.LOG_AUTO_RECHARGE,
List<String> chargeLogType = Lists.newArrayList(WalletCode.LOG_RECHARGE, WalletCode.LOG_AUTO_RECHARGE,
WalletCode.LOG_ADMIN_CHANGER);
// 保证是充值类型 且充值金额大于0

View File

@@ -33,7 +33,7 @@ public class WalletLogDto extends BaseDto implements Serializable {
* @see WalletCode
*/
@Schema(description = "类型")
private Integer type;
private String type;
@Schema(description = "交易记录ID")
private Long paymentId;
@@ -45,10 +45,10 @@ public class WalletLogDto extends BaseDto implements Serializable {
private String businessId;
/**
* @see WalletCode
* @see WalletCode#OPERATION_SOURCE_SYSTEM
*/
@Schema(description = " 1 系统操作 2管理员操作 3用户操作")
private Integer operationSource;
private String operationSource;
@Schema(description = "金额")
private BigDecimal amount;

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.11</version>
<version>2.7.13</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>