From 1ffbd9399ebd0f04f13be28da5f3d9d90a5a11d1 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Fri, 25 Aug 2023 11:14:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=BE=97=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=92=B1=E5=8C=85=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/mysql/pay_wallet.sql | 44 ++++++++++ ...tegoryEnum.java => WalletBizTypeEnum.java} | 13 +-- ...erateTypeEnum.java => WalletTypeEnum.java} | 9 +- .../app/wallet/AppPayWalletController.java | 41 +++++++++ .../app/wallet/vo/AppPayWalletRespVO.java | 21 +++++ .../pay/convert/wallet/PayWalletConvert.java | 14 +++ .../member/MemberWalletTransactionDO.java | 86 ------------------- .../PayWalletDO.java} | 22 +++-- .../wallet/PayWalletTransactionDO.java | 79 +++++++++++++++++ .../dal/mysql/member/MemberWalletMapper.java | 15 ---- .../member/MemberWalletTransactionMapper.java | 15 ---- .../pay/dal/mysql/wallet/PayWalletMapper.java | 18 ++++ .../wallet/PayWalletTransactionMapper.java | 15 ++++ .../pay/service/wallet/PayWalletService.java | 18 ++++ .../service/wallet/PayWalletServiceImpl.java | 24 ++++++ 15 files changed, 299 insertions(+), 135 deletions(-) create mode 100644 sql/mysql/pay_wallet.sql rename yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/{WalletTransactionGategoryEnum.java => WalletBizTypeEnum.java} (54%) rename yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/{WalletOperateTypeEnum.java => WalletTypeEnum.java} (58%) create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletController.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/AppPayWalletRespVO.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/member/MemberWalletTransactionDO.java rename yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/{member/MemberWalletDO.java => wallet/PayWalletDO.java} (55%) create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/wallet/PayWalletTransactionDO.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/member/MemberWalletMapper.java delete mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/member/MemberWalletTransactionMapper.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java diff --git a/sql/mysql/pay_wallet.sql b/sql/mysql/pay_wallet.sql new file mode 100644 index 000000000..4be65ffdd --- /dev/null +++ b/sql/mysql/pay_wallet.sql @@ -0,0 +1,44 @@ +-- ---------------------------- +-- 支付-钱包表 +-- ---------------------------- +DROP TABLE IF EXISTS `pay_wallet`; +CREATE TABLE `pay_wallet` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', + `user_id` bigint NOT NULL COMMENT '用户 id', + `user_type` tinyint NOT NULL DEFAULT 0 COMMENT '用户类型', + `balance` int NOT NULL DEFAULT 0 COMMENT '余额, 单位分', + `total_expense` bigint NOT NULL DEFAULT 0 COMMENT '累计支出, 单位分', + `total_recharge` bigint NOT NULL DEFAULT 0 COMMENT '累计充值, 单位分', + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB COMMENT='支付钱包表'; + +-- ---------------------------- +-- 支付- 钱包余额明细表 +-- ---------------------------- +DROP TABLE IF EXISTS `pay_wallet_transaction`; +CREATE TABLE `pay_wallet_transaction` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', + `wallet_id` bigint NOT NULL COMMENT '会员钱包 id', + `user_id` bigint NOT NULL COMMENT '用户 id', + `biz_type` tinyint NOT NULL COMMENT '关联类型', + `biz_id` bigint NOT NULL COMMENT '关联业务编号', + `no` varchar(64) NOT NULL COMMENT '流水号', + `description` varchar(255) COMMENT '操作说明', + `amount` int NOT NULL COMMENT '交易金额, 单位分', + `balance` int NOT NULL COMMENT '余额, 单位分', + `transaction_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '交易时间', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB COMMENT='支付钱包余额明细表'; \ No newline at end of file diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletTransactionGategoryEnum.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletBizTypeEnum.java similarity index 54% rename from yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletTransactionGategoryEnum.java rename to yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletBizTypeEnum.java index fe950991d..b39ed9d09 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletTransactionGategoryEnum.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletBizTypeEnum.java @@ -4,20 +4,21 @@ import lombok.AllArgsConstructor; import lombok.Getter; /** - * 钱包交易大类枚举 + * 钱包交易业务分类 * * @author jason */ @AllArgsConstructor @Getter -public enum WalletTransactionGategoryEnum { - TOP_UP(1, "充值"), - SPENDING(2, "支出"); +public enum WalletBizTypeEnum { + RECHARGE(1, "充值"), + RECHARGE_REFUND(2, "充值退款"); + // TODO 后续增加 /** - * 分类 + * 业务分类 */ - private final Integer category; + private final Integer bizType; /** * 说明 diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletOperateTypeEnum.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletTypeEnum.java similarity index 58% rename from yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletOperateTypeEnum.java rename to yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletTypeEnum.java index 896e90ef9..87cd1b96b 100644 --- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletOperateTypeEnum.java +++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletTypeEnum.java @@ -4,16 +4,15 @@ import lombok.AllArgsConstructor; import lombok.Getter; /** - * 钱包操作类型枚举 + * 钱包交易大分类 * * @author jason */ @AllArgsConstructor @Getter -public enum WalletOperateTypeEnum { - TOP_UP_INC(1, "充值增加"), - ORDER_DEC(2, "订单消费扣除"); - // TODO 其它类型 +public enum WalletTypeEnum { + RECHARGE(1, "充值"), + EXPENSE(2, "消费"); private final Integer type; diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletController.java new file mode 100644 index 000000000..98417876b --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletController.java @@ -0,0 +1,41 @@ +package cn.iocoder.yudao.module.pay.controller.app.wallet; + +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletRespVO; +import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert; +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; +import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; + +/** + * @author jason + */ +@Tag(name = "用户 APP - 支付钱包") +@RestController +@RequestMapping("/pay/wallet") +@Validated +@Slf4j +public class AppPayWalletController { + + @Resource + private PayWalletService payWalletService; + + @GetMapping("/get") + @Operation(summary = "获取支付钱包") + public CommonResult getPayWallet() { + PayWalletDO payWallet = payWalletService.getPayWallet(getLoginUserId(), UserTypeEnum.MEMBER.getValue()); + return success(PayWalletConvert.INSTANCE.convert(payWallet)); + } +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/AppPayWalletRespVO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/AppPayWalletRespVO.java new file mode 100644 index 000000000..508c565aa --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/AppPayWalletRespVO.java @@ -0,0 +1,21 @@ +package cn.iocoder.yudao.module.pay.controller.app.wallet.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author jason + */ +@Schema(description = "用户 APP - 获取用户钱包 Response VO") +@Data +public class AppPayWalletRespVO { + + @Schema(description = "钱包余额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") + private Integer balance; + + @Schema(description = "累计支出, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") + private Long totalExpense; + + @Schema(description = "累计充值, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") + private Long totalRecharge; +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java new file mode 100644 index 000000000..49ec734be --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.pay.convert.wallet; + +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletRespVO; +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface PayWalletConvert { + + PayWalletConvert INSTANCE = Mappers.getMapper(PayWalletConvert.class); + + AppPayWalletRespVO convert(PayWalletDO bean); +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/member/MemberWalletTransactionDO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/member/MemberWalletTransactionDO.java deleted file mode 100644 index 82ede2915..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/member/MemberWalletTransactionDO.java +++ /dev/null @@ -1,86 +0,0 @@ -package cn.iocoder.yudao.module.pay.dal.dataobject.member; - -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import cn.iocoder.yudao.module.pay.enums.member.WalletOperateTypeEnum; -import cn.iocoder.yudao.module.pay.enums.member.WalletTransactionGategoryEnum; -import com.baomidou.mybatisplus.annotation.KeySequence; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; - -import java.time.LocalDateTime; - -/** - * 支付-会员钱包明细 DO - * - * @author jason - */ -@TableName(value ="pay_member_wallet_transaction") -@KeySequence("pay_member_wallet_transaction_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 -@Data -public class MemberWalletTransactionDO extends BaseDO { - - /** - * 编号 - */ - @TableId - private Long id; - - /** - * 会员钱包 id - * - * 关联 {@link MemberWalletDO#getId()} - */ - private Long walletId; - - /** - * 用户 id - * - * 关联 MemberUserDO 的 id 编号 - */ - private Long userId; - - /** - * 交易单号 @芋艿 这里是关联交易单号, 还是订单号 , 退款单号! ?? - */ - private String tradeNo; - - /** - * 交易分类 - * - * 枚举 {@link WalletTransactionGategoryEnum#getCategory()} - */ - private Integer category; - - /** - * 操作分类 - * - * 枚举 {@link WalletOperateTypeEnum#getType()} - */ - private Integer operateType; - - /** - * 操作详情 - */ - private String operateDesc; - - /** - * 交易金额, 单位分 - */ - private Integer price; - - /** - * 余额, 单位分 - */ - private Integer balance; - - /** - * 备注 - */ - private String mark; - - /** - * 交易时间 - */ - private LocalDateTime transactionTime; -} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/member/MemberWalletDO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/wallet/PayWalletDO.java similarity index 55% rename from yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/member/MemberWalletDO.java rename to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/wallet/PayWalletDO.java index e6e92bf82..d914c2f14 100644 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/member/MemberWalletDO.java +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/wallet/PayWalletDO.java @@ -1,21 +1,21 @@ -package cn.iocoder.yudao.module.pay.dal.dataobject.member; +package cn.iocoder.yudao.module.pay.dal.dataobject.wallet; +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; -// TODO @jason:修改 MemberWalletDO 为 PayWalletDO /** * 支付 - 会员钱包 DO * * @author jason */ -@TableName(value ="pay_member_wallet") -@KeySequence("pay_member_wallet_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@TableName(value ="pay_wallet") +@KeySequence("pay_wallet_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 @Data -public class MemberWalletDO extends BaseDO { +public class PayWalletDO extends BaseDO { /** * 编号 @@ -23,7 +23,6 @@ public class MemberWalletDO extends BaseDO { @TableId private Long id; - // TODO @jaosn:增加 userType 字段; /** * 用户 id * @@ -32,6 +31,13 @@ public class MemberWalletDO extends BaseDO { */ private Long userId; + /** + * 用户类型, 预留 多商户转帐可能需要用到 + * + * 关联 {@link UserTypeEnum} + */ + private Integer userType; + /** * 余额, 单位分 */ @@ -40,10 +46,10 @@ public class MemberWalletDO extends BaseDO { /** * 累计支出, 单位分 */ - private Integer totalSpending; + private Long totalExpense; /** * 累计充值, 单位分 */ - private Integer totalTopUp; + private Long totalRecharge; } diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/wallet/PayWalletTransactionDO.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/wallet/PayWalletTransactionDO.java new file mode 100644 index 000000000..c8340badc --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/wallet/PayWalletTransactionDO.java @@ -0,0 +1,79 @@ +package cn.iocoder.yudao.module.pay.dal.dataobject.wallet; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.pay.enums.member.WalletBizTypeEnum; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * 支付-会员钱包明细 DO + * + * @author jason + */ +@TableName(value ="pay_wallet_transaction") +@KeySequence("pay_wallet_transaction_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +public class PayWalletTransactionDO extends BaseDO { + + /** + * 编号 + */ + @TableId + private Long id; + + /** + * 会员钱包 id + * + * 关联 {@link PayWalletDO#getId()} + */ + private Long walletId; + + /** + * 用户 id + * + * 关联 MemberUserDO 的 id 编号 + */ + private Long userId; + + /** + * 关联业务 + * + * 枚举 {@link WalletBizTypeEnum#getBizType()} + */ + private Integer bizType; + + /** + * 关联业务编号 + */ + private Long bizId; + + /** + * 流水号 + */ + private String no; + + /** + * 附加说明 + */ + private String description; + + /** + * 交易金额, 单位分 + * 正值表示余额增加,负值表示余额减少 + */ + private Integer amount; + + /** + * 交易后余额,单位分 + */ + private Integer balance; + + /** + * 交易时间 + */ + private LocalDateTime transactionTime; +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/member/MemberWalletMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/member/MemberWalletMapper.java deleted file mode 100644 index 46e80df8e..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/member/MemberWalletMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.iocoder.yudao.module.pay.dal.mysql.member; - - -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.pay.dal.dataobject.member.MemberWalletDO; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface MemberWalletMapper extends BaseMapperX { - -} - - - - diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/member/MemberWalletTransactionMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/member/MemberWalletTransactionMapper.java deleted file mode 100644 index a6cb541d1..000000000 --- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/member/MemberWalletTransactionMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.iocoder.yudao.module.pay.dal.mysql.member; - - -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.pay.dal.dataobject.member.MemberWalletTransactionDO; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface MemberWalletTransactionMapper extends BaseMapperX { - -} - - - - diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java new file mode 100644 index 000000000..d7d00a111 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.pay.dal.mysql.wallet; + + +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface PayWalletMapper extends BaseMapperX { + + default PayWalletDO selectByUserIdAndType(Long userId, Integer userType) { + return selectOne(PayWalletDO::getUserId, userId, PayWalletDO::getUserType, userType); + } +} + + + + diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java new file mode 100644 index 000000000..5e9ab5301 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java @@ -0,0 +1,15 @@ +package cn.iocoder.yudao.module.pay.dal.mysql.wallet; + + +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface PayWalletTransactionMapper extends BaseMapperX { + +} + + + + diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java new file mode 100644 index 000000000..7db829cf1 --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.pay.service.wallet; + +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; + +/** + * 支付钱包 Service 接口 + * + * @author jason + */ +public interface PayWalletService { + + /** + * 得到用户的支付钱包 + * @param userId 用户 id + * @param userType 用户类型 + */ + PayWalletDO getPayWallet(Long userId, Integer userType); +} diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java new file mode 100644 index 000000000..34ae5613b --- /dev/null +++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.pay.service.wallet; + +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; +import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletMapper; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +/** + * 支付钱包 Service 实现类 + * + * @author jason + */ +@Service +public class PayWalletServiceImpl implements PayWalletService { + + @Resource + private PayWalletMapper payWalletMapper; + + @Override + public PayWalletDO getPayWallet(Long userId, Integer userType) { + return payWalletMapper.selectByUserIdAndType(userId, userType); + } +}