Commit 1ffbd9399ebd0f04f13be28da5f3d9d90a5a11d1
1 parent
9b6f5bd5
新增获得支付钱包接口
Showing
13 changed files
with
227 additions
and
63 deletions
sql/mysql/pay_wallet.sql
0 → 100644
| 1 | +-- ---------------------------- | |
| 2 | +-- 支付-钱包表 | |
| 3 | +-- ---------------------------- | |
| 4 | +DROP TABLE IF EXISTS `pay_wallet`; | |
| 5 | +CREATE TABLE `pay_wallet` | |
| 6 | +( | |
| 7 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', | |
| 8 | + `user_id` bigint NOT NULL COMMENT '用户 id', | |
| 9 | + `user_type` tinyint NOT NULL DEFAULT 0 COMMENT '用户类型', | |
| 10 | + `balance` int NOT NULL DEFAULT 0 COMMENT '余额, 单位分', | |
| 11 | + `total_expense` bigint NOT NULL DEFAULT 0 COMMENT '累计支出, 单位分', | |
| 12 | + `total_recharge` bigint NOT NULL DEFAULT 0 COMMENT '累计充值, 单位分', | |
| 13 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | |
| 14 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 15 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | |
| 16 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 17 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | |
| 18 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | |
| 19 | + PRIMARY KEY (`id`) USING BTREE | |
| 20 | +) ENGINE=InnoDB COMMENT='支付钱包表'; | |
| 21 | + | |
| 22 | +-- ---------------------------- | |
| 23 | +-- 支付- 钱包余额明细表 | |
| 24 | +-- ---------------------------- | |
| 25 | +DROP TABLE IF EXISTS `pay_wallet_transaction`; | |
| 26 | +CREATE TABLE `pay_wallet_transaction` | |
| 27 | +( | |
| 28 | + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', | |
| 29 | + `wallet_id` bigint NOT NULL COMMENT '会员钱包 id', | |
| 30 | + `user_id` bigint NOT NULL COMMENT '用户 id', | |
| 31 | + `biz_type` tinyint NOT NULL COMMENT '关联类型', | |
| 32 | + `biz_id` bigint NOT NULL COMMENT '关联业务编号', | |
| 33 | + `no` varchar(64) NOT NULL COMMENT '流水号', | |
| 34 | + `description` varchar(255) COMMENT '操作说明', | |
| 35 | + `amount` int NOT NULL COMMENT '交易金额, 单位分', | |
| 36 | + `balance` int NOT NULL COMMENT '余额, 单位分', | |
| 37 | + `transaction_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '交易时间', | |
| 38 | + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | |
| 39 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | |
| 40 | + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 41 | + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | |
| 42 | + `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | |
| 43 | + PRIMARY KEY (`id`) USING BTREE | |
| 44 | +) ENGINE=InnoDB COMMENT='支付钱包余额明细表'; | |
| 0 | 45 | \ No newline at end of file | ... | ... |
yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletTransactionGategoryEnum.java renamed to 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; |
| 4 | 4 | import lombok.Getter; |
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | - * 钱包交易大类枚举 | |
| 7 | + * 钱包交易业务分类 | |
| 8 | 8 | * |
| 9 | 9 | * @author jason |
| 10 | 10 | */ |
| 11 | 11 | @AllArgsConstructor |
| 12 | 12 | @Getter |
| 13 | -public enum WalletTransactionGategoryEnum { | |
| 14 | - TOP_UP(1, "充值"), | |
| 15 | - SPENDING(2, "支出"); | |
| 13 | +public enum WalletBizTypeEnum { | |
| 14 | + RECHARGE(1, "充值"), | |
| 15 | + RECHARGE_REFUND(2, "充值退款"); | |
| 16 | 16 | |
| 17 | + // TODO 后续增加 | |
| 17 | 18 | /** |
| 18 | - * 分类 | |
| 19 | + * 业务分类 | |
| 19 | 20 | */ |
| 20 | - private final Integer category; | |
| 21 | + private final Integer bizType; | |
| 21 | 22 | |
| 22 | 23 | /** |
| 23 | 24 | * 说明 | ... | ... |
yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletOperateTypeEnum.java renamed to 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; |
| 4 | 4 | import lombok.Getter; |
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | - * 钱包操作类型枚举 | |
| 7 | + * 钱包交易大分类 | |
| 8 | 8 | * |
| 9 | 9 | * @author jason |
| 10 | 10 | */ |
| 11 | 11 | @AllArgsConstructor |
| 12 | 12 | @Getter |
| 13 | -public enum WalletOperateTypeEnum { | |
| 14 | - TOP_UP_INC(1, "充值增加"), | |
| 15 | - ORDER_DEC(2, "订单消费扣除"); | |
| 16 | - // TODO 其它类型 | |
| 13 | +public enum WalletTypeEnum { | |
| 14 | + RECHARGE(1, "充值"), | |
| 15 | + EXPENSE(2, "消费"); | |
| 17 | 16 | |
| 18 | 17 | private final Integer type; |
| 19 | 18 | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.controller.app.wallet; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletRespVO; | |
| 6 | +import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert; | |
| 7 | +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | |
| 8 | +import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; | |
| 9 | +import io.swagger.v3.oas.annotations.Operation; | |
| 10 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 11 | +import lombok.extern.slf4j.Slf4j; | |
| 12 | +import org.springframework.validation.annotation.Validated; | |
| 13 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 14 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 15 | +import org.springframework.web.bind.annotation.RestController; | |
| 16 | + | |
| 17 | +import javax.annotation.Resource; | |
| 18 | + | |
| 19 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 20 | +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * @author jason | |
| 24 | + */ | |
| 25 | +@Tag(name = "用户 APP - 支付钱包") | |
| 26 | +@RestController | |
| 27 | +@RequestMapping("/pay/wallet") | |
| 28 | +@Validated | |
| 29 | +@Slf4j | |
| 30 | +public class AppPayWalletController { | |
| 31 | + | |
| 32 | + @Resource | |
| 33 | + private PayWalletService payWalletService; | |
| 34 | + | |
| 35 | + @GetMapping("/get") | |
| 36 | + @Operation(summary = "获取支付钱包") | |
| 37 | + public CommonResult<AppPayWalletRespVO> getPayWallet() { | |
| 38 | + PayWalletDO payWallet = payWalletService.getPayWallet(getLoginUserId(), UserTypeEnum.MEMBER.getValue()); | |
| 39 | + return success(PayWalletConvert.INSTANCE.convert(payWallet)); | |
| 40 | + } | |
| 41 | +} | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/AppPayWalletRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.controller.app.wallet.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * @author jason | |
| 8 | + */ | |
| 9 | +@Schema(description = "用户 APP - 获取用户钱包 Response VO") | |
| 10 | +@Data | |
| 11 | +public class AppPayWalletRespVO { | |
| 12 | + | |
| 13 | + @Schema(description = "钱包余额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | |
| 14 | + private Integer balance; | |
| 15 | + | |
| 16 | + @Schema(description = "累计支出, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") | |
| 17 | + private Long totalExpense; | |
| 18 | + | |
| 19 | + @Schema(description = "累计充值, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") | |
| 20 | + private Long totalRecharge; | |
| 21 | +} | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.convert.wallet; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletRespVO; | |
| 4 | +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | |
| 5 | +import org.mapstruct.Mapper; | |
| 6 | +import org.mapstruct.factory.Mappers; | |
| 7 | + | |
| 8 | +@Mapper | |
| 9 | +public interface PayWalletConvert { | |
| 10 | + | |
| 11 | + PayWalletConvert INSTANCE = Mappers.getMapper(PayWalletConvert.class); | |
| 12 | + | |
| 13 | + AppPayWalletRespVO convert(PayWalletDO bean); | |
| 14 | +} | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/member/MemberWalletDO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/wallet/PayWalletDO.java
| 1 | -package cn.iocoder.yudao.module.pay.dal.dataobject.member; | |
| 1 | +package cn.iocoder.yudao.module.pay.dal.dataobject.wallet; | |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | |
| 3 | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | 5 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | 7 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | 8 | import lombok.Data; |
| 8 | 9 | |
| 9 | -// TODO @jason:修改 MemberWalletDO 为 PayWalletDO | |
| 10 | 10 | /** |
| 11 | 11 | * 支付 - 会员钱包 DO |
| 12 | 12 | * |
| 13 | 13 | * @author jason |
| 14 | 14 | */ |
| 15 | -@TableName(value ="pay_member_wallet") | |
| 16 | -@KeySequence("pay_member_wallet_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 15 | +@TableName(value ="pay_wallet") | |
| 16 | +@KeySequence("pay_wallet_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 17 | 17 | @Data |
| 18 | -public class MemberWalletDO extends BaseDO { | |
| 18 | +public class PayWalletDO extends BaseDO { | |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * 编号 |
| ... | ... | @@ -23,7 +23,6 @@ public class MemberWalletDO extends BaseDO { |
| 23 | 23 | @TableId |
| 24 | 24 | private Long id; |
| 25 | 25 | |
| 26 | - // TODO @jaosn:增加 userType 字段; | |
| 27 | 26 | /** |
| 28 | 27 | * 用户 id |
| 29 | 28 | * |
| ... | ... | @@ -33,6 +32,13 @@ public class MemberWalletDO extends BaseDO { |
| 33 | 32 | private Long userId; |
| 34 | 33 | |
| 35 | 34 | /** |
| 35 | + * 用户类型, 预留 多商户转帐可能需要用到 | |
| 36 | + * | |
| 37 | + * 关联 {@link UserTypeEnum} | |
| 38 | + */ | |
| 39 | + private Integer userType; | |
| 40 | + | |
| 41 | + /** | |
| 36 | 42 | * 余额, 单位分 |
| 37 | 43 | */ |
| 38 | 44 | private Integer balance; |
| ... | ... | @@ -40,10 +46,10 @@ public class MemberWalletDO extends BaseDO { |
| 40 | 46 | /** |
| 41 | 47 | * 累计支出, 单位分 |
| 42 | 48 | */ |
| 43 | - private Integer totalSpending; | |
| 49 | + private Long totalExpense; | |
| 44 | 50 | |
| 45 | 51 | /** |
| 46 | 52 | * 累计充值, 单位分 |
| 47 | 53 | */ |
| 48 | - private Integer totalTopUp; | |
| 54 | + private Long totalRecharge; | |
| 49 | 55 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/member/MemberWalletTransactionDO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/wallet/PayWalletTransactionDO.java
| 1 | -package cn.iocoder.yudao.module.pay.dal.dataobject.member; | |
| 1 | +package cn.iocoder.yudao.module.pay.dal.dataobject.wallet; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.yudao.module.pay.enums.member.WalletOperateTypeEnum; | |
| 5 | -import cn.iocoder.yudao.module.pay.enums.member.WalletTransactionGategoryEnum; | |
| 4 | +import cn.iocoder.yudao.module.pay.enums.member.WalletBizTypeEnum; | |
| 6 | 5 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 7 | 6 | import com.baomidou.mybatisplus.annotation.TableId; |
| 8 | 7 | import com.baomidou.mybatisplus.annotation.TableName; |
| ... | ... | @@ -15,10 +14,10 @@ import java.time.LocalDateTime; |
| 15 | 14 | * |
| 16 | 15 | * @author jason |
| 17 | 16 | */ |
| 18 | -@TableName(value ="pay_member_wallet_transaction") | |
| 19 | -@KeySequence("pay_member_wallet_transaction_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 17 | +@TableName(value ="pay_wallet_transaction") | |
| 18 | +@KeySequence("pay_wallet_transaction_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 20 | 19 | @Data |
| 21 | -public class MemberWalletTransactionDO extends BaseDO { | |
| 20 | +public class PayWalletTransactionDO extends BaseDO { | |
| 22 | 21 | |
| 23 | 22 | /** |
| 24 | 23 | * 编号 |
| ... | ... | @@ -29,7 +28,7 @@ public class MemberWalletTransactionDO extends BaseDO { |
| 29 | 28 | /** |
| 30 | 29 | * 会员钱包 id |
| 31 | 30 | * |
| 32 | - * 关联 {@link MemberWalletDO#getId()} | |
| 31 | + * 关联 {@link PayWalletDO#getId()} | |
| 33 | 32 | */ |
| 34 | 33 | private Long walletId; |
| 35 | 34 | |
| ... | ... | @@ -41,45 +40,39 @@ public class MemberWalletTransactionDO extends BaseDO { |
| 41 | 40 | private Long userId; |
| 42 | 41 | |
| 43 | 42 | /** |
| 44 | - * 交易单号 @芋艿 这里是关联交易单号, 还是订单号 , 退款单号! ?? | |
| 43 | + * 关联业务 | |
| 44 | + * | |
| 45 | + * 枚举 {@link WalletBizTypeEnum#getBizType()} | |
| 45 | 46 | */ |
| 46 | - private String tradeNo; | |
| 47 | + private Integer bizType; | |
| 47 | 48 | |
| 48 | 49 | /** |
| 49 | - * 交易分类 | |
| 50 | - * | |
| 51 | - * 枚举 {@link WalletTransactionGategoryEnum#getCategory()} | |
| 50 | + * 关联业务编号 | |
| 52 | 51 | */ |
| 53 | - private Integer category; | |
| 52 | + private Long bizId; | |
| 54 | 53 | |
| 55 | 54 | /** |
| 56 | - * 操作分类 | |
| 57 | - * | |
| 58 | - * 枚举 {@link WalletOperateTypeEnum#getType()} | |
| 55 | + * 流水号 | |
| 59 | 56 | */ |
| 60 | - private Integer operateType; | |
| 57 | + private String no; | |
| 61 | 58 | |
| 62 | 59 | /** |
| 63 | - * 操作详情 | |
| 60 | + * 附加说明 | |
| 64 | 61 | */ |
| 65 | - private String operateDesc; | |
| 62 | + private String description; | |
| 66 | 63 | |
| 67 | 64 | /** |
| 68 | 65 | * 交易金额, 单位分 |
| 66 | + * 正值表示余额增加,负值表示余额减少 | |
| 69 | 67 | */ |
| 70 | - private Integer price; | |
| 68 | + private Integer amount; | |
| 71 | 69 | |
| 72 | 70 | /** |
| 73 | - * 余额, 单位分 | |
| 71 | + * 交易后余额,单位分 | |
| 74 | 72 | */ |
| 75 | 73 | private Integer balance; |
| 76 | 74 | |
| 77 | 75 | /** |
| 78 | - * 备注 | |
| 79 | - */ | |
| 80 | - private String mark; | |
| 81 | - | |
| 82 | - /** | |
| 83 | 76 | * 交易时间 |
| 84 | 77 | */ |
| 85 | 78 | private LocalDateTime transactionTime; | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/member/MemberWalletTransactionMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.pay.dal.mysql.member; | |
| 2 | - | |
| 3 | - | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.module.pay.dal.dataobject.member.MemberWalletTransactionDO; | |
| 6 | -import org.apache.ibatis.annotations.Mapper; | |
| 7 | - | |
| 8 | -@Mapper | |
| 9 | -public interface MemberWalletTransactionMapper extends BaseMapperX<MemberWalletTransactionDO> { | |
| 10 | - | |
| 11 | -} | |
| 12 | - | |
| 13 | - | |
| 14 | - | |
| 15 | - |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.dal.mysql.wallet; | |
| 2 | + | |
| 3 | + | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | |
| 6 | +import org.apache.ibatis.annotations.Mapper; | |
| 7 | + | |
| 8 | +@Mapper | |
| 9 | +public interface PayWalletMapper extends BaseMapperX<PayWalletDO> { | |
| 10 | + | |
| 11 | + default PayWalletDO selectByUserIdAndType(Long userId, Integer userType) { | |
| 12 | + return selectOne(PayWalletDO::getUserId, userId, PayWalletDO::getUserType, userType); | |
| 13 | + } | |
| 14 | +} | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/member/MemberWalletMapper.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java
| 1 | -package cn.iocoder.yudao.module.pay.dal.mysql.member; | |
| 1 | +package cn.iocoder.yudao.module.pay.dal.mysql.wallet; | |
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | -import cn.iocoder.yudao.module.pay.dal.dataobject.member.MemberWalletDO; | |
| 5 | +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; | |
| 6 | 6 | import org.apache.ibatis.annotations.Mapper; |
| 7 | 7 | |
| 8 | 8 | @Mapper |
| 9 | -public interface MemberWalletMapper extends BaseMapperX<MemberWalletDO> { | |
| 9 | +public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> { | |
| 10 | 10 | |
| 11 | 11 | } |
| 12 | 12 | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.service.wallet; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 支付钱包 Service 接口 | |
| 7 | + * | |
| 8 | + * @author jason | |
| 9 | + */ | |
| 10 | +public interface PayWalletService { | |
| 11 | + | |
| 12 | + /** | |
| 13 | + * 得到用户的支付钱包 | |
| 14 | + * @param userId 用户 id | |
| 15 | + * @param userType 用户类型 | |
| 16 | + */ | |
| 17 | + PayWalletDO getPayWallet(Long userId, Integer userType); | |
| 18 | +} | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.service.wallet; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | |
| 4 | +import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletMapper; | |
| 5 | +import org.springframework.stereotype.Service; | |
| 6 | + | |
| 7 | +import javax.annotation.Resource; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 支付钱包 Service 实现类 | |
| 11 | + * | |
| 12 | + * @author jason | |
| 13 | + */ | |
| 14 | +@Service | |
| 15 | +public class PayWalletServiceImpl implements PayWalletService { | |
| 16 | + | |
| 17 | + @Resource | |
| 18 | + private PayWalletMapper payWalletMapper; | |
| 19 | + | |
| 20 | + @Override | |
| 21 | + public PayWalletDO getPayWallet(Long userId, Integer userType) { | |
| 22 | + return payWalletMapper.selectByUserIdAndType(userId, userType); | |
| 23 | + } | |
| 24 | +} | ... | ... |