Commit 4f7c7f56193cf2f49c5cf937bb766ccbce740fd0

Authored by jason
1 parent 7cb8f8fa

wallet - 管理端 钱包余额流水查询

Showing 17 changed files with 118 additions and 21 deletions
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java
... ... @@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.pay.controller.admin.wallet;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
4 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5   -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletPageReqVO;
6   -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletRespVO;
7   -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletUserReqVO;
  5 +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO;
  6 +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO;
  7 +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletUserReqVO;
8 8 import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert;
9 9 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
10 10 import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletTransactionController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.pay.controller.admin.wallet;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  5 +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO;
  6 +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionRespVO;
  7 +import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert;
  8 +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
  9 +import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService;
  10 +import io.swagger.v3.oas.annotations.Operation;
  11 +import io.swagger.v3.oas.annotations.tags.Tag;
  12 +import lombok.extern.slf4j.Slf4j;
  13 +import org.springframework.validation.annotation.Validated;
  14 +import org.springframework.web.bind.annotation.GetMapping;
  15 +import org.springframework.web.bind.annotation.RequestMapping;
  16 +import org.springframework.web.bind.annotation.RestController;
  17 +
  18 +import javax.annotation.Resource;
  19 +import javax.validation.Valid;
  20 +
  21 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  22 +
  23 +@Tag(name = "管理后台 - 钱包余额明细")
  24 +@RestController
  25 +@RequestMapping("/pay/wallet-transaction")
  26 +@Validated
  27 +@Slf4j
  28 +public class PayWalletTransactionController {
  29 +
  30 + @Resource
  31 + private PayWalletTransactionService payWalletTransactionService;
  32 +
  33 + @GetMapping("/page")
  34 + @Operation(summary = "获得钱包流水分页")
  35 + public CommonResult<PageResult<PayWalletTransactionRespVO>> getWalletTransactionPage(
  36 + @Valid PayWalletTransactionPageReqVO pageReqVO) {
  37 + PageResult<PayWalletTransactionDO> result = payWalletTransactionService.getWalletTransactionPage(pageReqVO);
  38 + return success(PayWalletTransactionConvert.INSTANCE.convertPage2(result));
  39 + }
  40 +}
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/transaction/PayWalletTransactionPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  4 +import io.swagger.v3.oas.annotations.media.Schema;
  5 +import lombok.Data;
  6 +
  7 +@Schema(description = "管理后台 - 钱包流水分页 Request VO")
  8 +@Data
  9 +public class PayWalletTransactionPageReqVO extends PageParam {
  10 +
  11 + @Schema(description = "钱包编号", example = "1")
  12 + private Long walletId;
  13 +}
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/transaction/PayWalletTransactionRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.Data;
  5 +
  6 +import java.time.LocalDateTime;
  7 +
  8 +@Schema(description = "用户 APP - 钱包流水分页 Response VO")
  9 +@Data
  10 +public class PayWalletTransactionRespVO {
  11 +
  12 + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  13 + private Long id;
  14 +
  15 + @Schema(description = "钱包编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
  16 + private Long walletId;
  17 +
  18 + @Schema(description = "业务分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
  19 + private Integer bizType;
  20 +
  21 + @Schema(description = "交易金额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
  22 + private Long price;
  23 +
  24 + @Schema(description = "流水标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "土豆土豆")
  25 + private String title;
  26 +
  27 + @Schema(description = "交易时间", requiredMode = Schema.RequiredMode.REQUIRED)
  28 + private LocalDateTime createTime;
  29 +}
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletBaseVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletBaseVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4 import lombok.Data;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletPageReqVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletPageReqVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet;
2 2  
3 3 import lombok.*;
4 4 import io.swagger.v3.oas.annotations.media.Schema;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletRespVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletRespVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet;
2 2  
3 3 import io.swagger.v3.oas.annotations.media.Schema;
4 4 import lombok.Data;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletUserReqVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserReqVO.java
1   -package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance;
  1 +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet;
2 2  
3 3 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
4 4 import cn.iocoder.yudao.framework.common.validation.InEnum;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionRespVO.java
... ... @@ -9,9 +9,6 @@ import java.time.LocalDateTime;
9 9 @Data
10 10 public class AppPayWalletTransactionRespVO {
11 11  
12   - @Schema(description = "交易金额, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
13   - private Integer amount;
14   -
15 12 @Schema(description = "业务分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
16 13 private Integer bizType;
17 14  
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java
1 1 package cn.iocoder.yudao.module.pay.convert.wallet;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4   -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletRespVO;
  4 +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO;
5 5 import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO;
6 6 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
7 7 import org.mapstruct.Mapper;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletTransactionConvert.java
1 1 package cn.iocoder.yudao.module.pay.convert.wallet;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionRespVO;
4 5 import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO;
5 6 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
6 7 import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO;
... ... @@ -14,6 +15,8 @@ public interface PayWalletTransactionConvert {
14 15  
15 16 PageResult<AppPayWalletTransactionRespVO> convertPage(PageResult<PayWalletTransactionDO> page);
16 17  
  18 + PageResult<PayWalletTransactionRespVO> convertPage2(PageResult<PayWalletTransactionDO> page);
  19 +
17 20 PayWalletTransactionDO convert(WalletTransactionCreateReqBO bean);
18 21  
19 22 }
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java
... ... @@ -4,7 +4,7 @@ package cn.iocoder.yudao.module.pay.dal.mysql.wallet;
4 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 5 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
6 6 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
7   -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletPageReqVO;
  7 +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO;
8 8 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
9 9 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
10 10 import org.apache.ibatis.annotations.Mapper;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletTransactionMapper.java
1 1 package cn.iocoder.yudao.module.pay.dal.mysql.wallet;
2 2  
3 3  
  4 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
4 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 6 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
6 7 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
... ... @@ -13,17 +14,17 @@ import java.util.Objects;
13 14 @Mapper
14 15 public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> {
15 16  
16   - default PageResult<PayWalletTransactionDO> selectPage(Long walletId,
17   - AppPayWalletTransactionPageReqVO pageReqVO) {
  17 + default PageResult<PayWalletTransactionDO> selectPage(Long walletId, Integer type,
  18 + PageParam pageParam) {
18 19 LambdaQueryWrapperX<PayWalletTransactionDO> query = new LambdaQueryWrapperX<PayWalletTransactionDO>()
19   - .eq(PayWalletTransactionDO::getWalletId, walletId);
20   - if (Objects.equals(pageReqVO.getType(), AppPayWalletTransactionPageReqVO.TYPE_INCOME)) {
  20 + .eqIfPresent(PayWalletTransactionDO::getWalletId, walletId);
  21 + if (Objects.equals(type, AppPayWalletTransactionPageReqVO.TYPE_INCOME)) {
21 22 query.gt(PayWalletTransactionDO::getPrice, 0);
22   - } else if (Objects.equals(pageReqVO.getType(), AppPayWalletTransactionPageReqVO.TYPE_EXPENSE)) {
  23 + } else if (Objects.equals(type, AppPayWalletTransactionPageReqVO.TYPE_EXPENSE)) {
23 24 query.lt(PayWalletTransactionDO::getPrice, 0);
24 25 }
25 26 query.orderByDesc(PayWalletTransactionDO::getId);
26   - return selectPage(pageReqVO, query);
  27 + return selectPage(pageParam, query);
27 28 }
28 29  
29 30 default PayWalletTransactionDO selectByNo(String no) {
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java
1 1 package cn.iocoder.yudao.module.pay.service.wallet;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4   -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletPageReqVO;
  4 +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO;
5 5 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
6 6 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
7 7 import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
... ... @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.pay.service.wallet;
2 2  
3 3 import cn.hutool.core.lang.Assert;
4 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5   -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance.PayWalletPageReqVO;
  5 +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO;
6 6 import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO;
7 7 import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
8 8 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java
1 1 package cn.iocoder.yudao.module.pay.service.wallet;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO;
4 5 import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
5 6 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
6 7 import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum;
... ... @@ -26,6 +27,13 @@ public interface PayWalletTransactionService {
26 27 AppPayWalletTransactionPageReqVO pageVO);
27 28  
28 29 /**
  30 + * 查询钱包余额流水分页
  31 + *
  32 + * @param pageVO 分页查询参数
  33 + */
  34 + PageResult<PayWalletTransactionDO> getWalletTransactionPage(PayWalletTransactionPageReqVO pageVO);
  35 +
  36 + /**
29 37 * 新增钱包余额流水
30 38 *
31 39 * @param bo 创建钱包流水 bo
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java
1 1 package cn.iocoder.yudao.module.pay.service.wallet;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO;
4 5 import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
5 6 import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert;
6 7 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
... ... @@ -39,7 +40,12 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ
39 40 public PageResult<PayWalletTransactionDO> getWalletTransactionPage(Long userId, Integer userType,
40 41 AppPayWalletTransactionPageReqVO pageVO) {
41 42 PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType);
42   - return payWalletTransactionMapper.selectPage(wallet.getId(), pageVO);
  43 + return payWalletTransactionMapper.selectPage(wallet.getId(), pageVO.getType(), pageVO);
  44 + }
  45 +
  46 + @Override
  47 + public PageResult<PayWalletTransactionDO> getWalletTransactionPage(PayWalletTransactionPageReqVO pageVO) {
  48 + return payWalletTransactionMapper.selectPage(pageVO.getWalletId(), null, pageVO);
43 49 }
44 50  
45 51 @Override
... ...