Commit cc71aabd3d6de1e37d2c1fe8a4f03e17c424cd32

Authored by YunaiV
1 parent ddcb3e69

钱包:钱包流水 api

Showing 14 changed files with 70 additions and 88 deletions
sql/mysql/pay_wallet.sql
@@ -5,11 +5,11 @@ DROP TABLE IF EXISTS `pay_wallet`; @@ -5,11 +5,11 @@ DROP TABLE IF EXISTS `pay_wallet`;
5 CREATE TABLE `pay_wallet` 5 CREATE TABLE `pay_wallet`
6 ( 6 (
7 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', 7 `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
8 - `user_id` bigint NOT NULL COMMENT '用户 id', 8 + `user_id` bigint NOT NULL COMMENT '用户编号',
9 `user_type` tinyint NOT NULL DEFAULT 0 COMMENT '用户类型', 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 '累计充值, 单位分', 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 '创建者', 13 `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
14 `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP 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 '更新者', 15 `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
@@ -41,4 +41,4 @@ CREATE TABLE `pay_wallet_transaction` @@ -41,4 +41,4 @@ CREATE TABLE `pay_wallet_transaction`
41 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', 41 `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
42 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', 42 `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
43 PRIMARY KEY (`id`) USING BTREE 43 PRIMARY KEY (`id`) USING BTREE
44 -) ENGINE=InnoDB COMMENT='支付钱包余额明细表';  
45 \ No newline at end of file 44 \ No newline at end of file
  45 +) ENGINE=InnoDB COMMENT='支付钱包余额明细表';
yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/member/WalletTransactionQueryTypeEnum.java deleted
1 -package cn.iocoder.yudao.module.pay.enums.member;  
2 -  
3 -import cn.hutool.core.util.ArrayUtil;  
4 -import cn.iocoder.yudao.framework.common.core.IntArrayValuable;  
5 -import lombok.AllArgsConstructor;  
6 -import lombok.Getter;  
7 -  
8 -import java.util.Arrays;  
9 -  
10 -// TODO @jason:可以简化,直接 PageVO 定义两个 Integer;  
11 -/**  
12 - * 钱包流水查询类型  
13 - *  
14 - * @author jason  
15 - */  
16 -@AllArgsConstructor  
17 -@Getter  
18 -public enum WalletTransactionQueryTypeEnum implements IntArrayValuable {  
19 -  
20 - RECHARGE(1, "充值"),  
21 - EXPENSE(2, "消费");  
22 -  
23 - /**  
24 - * 类型  
25 - */  
26 - private final Integer type;  
27 - /**  
28 - * 描述  
29 - */  
30 - private final String description;  
31 -  
32 - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(WalletTransactionQueryTypeEnum::getType).toArray();  
33 -  
34 - @Override  
35 - public int[] array() {  
36 - return ARRAYS;  
37 - }  
38 -  
39 - public static WalletTransactionQueryTypeEnum valueOf(Integer type) {  
40 - return ArrayUtil.firstMatch(o -> o.getType().equals(type), values());  
41 - }  
42 -  
43 -}  
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletController.java
@@ -2,7 +2,8 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet; @@ -2,7 +2,8 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet;
2 2
3 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; 3 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
4 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 4 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
5 -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletRespVO; 5 +import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
  6 +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO;
6 import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert; 7 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.dal.dataobject.wallet.PayWalletDO;
8 import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; 9 import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService;
@@ -34,9 +35,10 @@ public class AppPayWalletController { @@ -34,9 +35,10 @@ public class AppPayWalletController {
34 35
35 @GetMapping("/get") 36 @GetMapping("/get")
36 @Operation(summary = "获取钱包") 37 @Operation(summary = "获取钱包")
  38 + @PreAuthenticated
37 public CommonResult<AppPayWalletRespVO> getPayWallet() { 39 public CommonResult<AppPayWalletRespVO> getPayWallet() {
38 - PayWalletDO payWallet = payWalletService.getPayWallet(getLoginUserId(), UserTypeEnum.MEMBER.getValue());  
39 - return success(PayWalletConvert.INSTANCE.convert(payWallet)); 40 + PayWalletDO wallet = payWalletService.getPayWallet(getLoginUserId(), UserTypeEnum.MEMBER.getValue());
  41 + return success(PayWalletConvert.INSTANCE.convert(wallet));
40 } 42 }
41 43
42 } 44 }
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletTransactionController.java
@@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet; @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet;
3 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; 3 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
4 import cn.iocoder.yudao.framework.common.pojo.CommonResult; 4 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
5 import cn.iocoder.yudao.framework.common.pojo.PageResult; 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionPageReqVO;  
7 -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionRespVO; 6 +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
  7 +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO;
8 import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert; 8 import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert;
9 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; 9 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
10 import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService; 10 import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService;
@@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RestController; @@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RestController;
19 import javax.annotation.Resource; 19 import javax.annotation.Resource;
20 import javax.validation.Valid; 20 import javax.validation.Valid;
21 21
  22 +import java.time.LocalDateTime;
  23 +
22 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; 24 import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
23 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; 25 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
24 26
@@ -33,11 +35,19 @@ public class AppPayWalletTransactionController { @@ -33,11 +35,19 @@ public class AppPayWalletTransactionController {
33 private PayWalletTransactionService payWalletTransactionService; 35 private PayWalletTransactionService payWalletTransactionService;
34 36
35 @GetMapping("/page") 37 @GetMapping("/page")
36 - @Operation(summary = "获得钱包余额明细分页")  
37 - public CommonResult<PageResult<AppPayWalletTransactionRespVO>> pageWalletTransaction(  
38 - @Valid AppPayWalletTransactionPageReqVO pageVO) { 38 + @Operation(summary = "获得钱包流水分页")
  39 + public CommonResult<PageResult<AppPayWalletTransactionRespVO>> getWalletTransactionPage(
  40 + @Valid AppPayWalletTransactionPageReqVO pageReqVO) {
  41 + if (true) {
  42 + PageResult<AppPayWalletTransactionRespVO> result = new PageResult<>(10L);
  43 + result.getList().add(new AppPayWalletTransactionRespVO().setPrice(1L)
  44 + .setTitle("测试").setCreateTime(LocalDateTime.now()));
  45 + result.getList().add(new AppPayWalletTransactionRespVO().setPrice(-1L)
  46 + .setTitle("测试2").setCreateTime(LocalDateTime.now()));
  47 + return success(result);
  48 + }
39 PageResult<PayWalletTransactionDO> result = payWalletTransactionService.getWalletTransactionPage(getLoginUserId(), 49 PageResult<PayWalletTransactionDO> result = payWalletTransactionService.getWalletTransactionPage(getLoginUserId(),
40 - UserTypeEnum.MEMBER.getValue(), pageVO); 50 + UserTypeEnum.MEMBER.getValue(), pageReqVO);
41 return success(PayWalletTransactionConvert.INSTANCE.convertPage(result)); 51 return success(PayWalletTransactionConvert.INSTANCE.convertPage(result));
42 } 52 }
43 } 53 }
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/AppPayWalletTransactionPageReqVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionPageReqVO.java
1 -package cn.iocoder.yudao.module.pay.controller.app.wallet.vo; 1 +package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageParam; 3 import cn.iocoder.yudao.framework.common.pojo.PageParam;
4 -import cn.iocoder.yudao.framework.common.validation.InEnum;  
5 -import cn.iocoder.yudao.module.pay.enums.member.WalletTransactionQueryTypeEnum;  
6 import io.swagger.v3.oas.annotations.media.Schema; 4 import io.swagger.v3.oas.annotations.media.Schema;
7 import lombok.Data; 5 import lombok.Data;
8 6
@@ -10,8 +8,16 @@ import lombok.Data; @@ -10,8 +8,16 @@ import lombok.Data;
10 @Data 8 @Data
11 public class AppPayWalletTransactionPageReqVO extends PageParam { 9 public class AppPayWalletTransactionPageReqVO extends PageParam {
12 10
13 - @Schema(description = "流水查询分类", example = "1")  
14 - @InEnum(value = WalletTransactionQueryTypeEnum.class, message = "查询类型必须是 {value}") 11 + /**
  12 + * 类型 - 收入
  13 + */
  14 + public static final Integer TYPE_INCOME = 1;
  15 + /**
  16 + * 类型 - 支出
  17 + */
  18 + public static final Integer TYPE_EXPENSE = 2;
  19 +
  20 + @Schema(description = "类型", example = "1")
15 private Integer type; 21 private Integer type;
16 22
17 } 23 }
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/AppPayWalletTransactionRespVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionRespVO.java
1 -package cn.iocoder.yudao.module.pay.controller.app.wallet.vo; 1 +package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction;
2 2
3 import io.swagger.v3.oas.annotations.media.Schema; 3 import io.swagger.v3.oas.annotations.media.Schema;
4 import lombok.Data; 4 import lombok.Data;
@@ -8,6 +8,7 @@ import java.time.LocalDateTime; @@ -8,6 +8,7 @@ import java.time.LocalDateTime;
8 @Schema(description = "用户 APP - 钱包流水分页 Response VO") 8 @Schema(description = "用户 APP - 钱包流水分页 Response VO")
9 @Data 9 @Data
10 public class AppPayWalletTransactionRespVO { 10 public class AppPayWalletTransactionRespVO {
  11 +
11 @Schema(description = "交易金额, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") 12 @Schema(description = "交易金额, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
12 private Integer amount; 13 private Integer amount;
13 14
@@ -16,4 +17,14 @@ public class AppPayWalletTransactionRespVO { @@ -16,4 +17,14 @@ public class AppPayWalletTransactionRespVO {
16 17
17 @Schema(description = "交易时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") 18 @Schema(description = "交易时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
18 private LocalDateTime transactionTime; 19 private LocalDateTime transactionTime;
  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 +
19 } 30 }
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/AppPayWalletRespVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/wallet/AppPayWalletRespVO.java
1 -package cn.iocoder.yudao.module.pay.controller.app.wallet.vo; 1 +package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet;
2 2
3 import io.swagger.v3.oas.annotations.media.Schema; 3 import io.swagger.v3.oas.annotations.media.Schema;
4 import lombok.Data; 4 import lombok.Data;
5 5
6 -/**  
7 - * @author jason  
8 - */  
9 @Schema(description = "用户 APP - 获取用户钱包 Response VO") 6 @Schema(description = "用户 APP - 获取用户钱包 Response VO")
10 @Data 7 @Data
11 public class AppPayWalletRespVO { 8 public class AppPayWalletRespVO {
@@ -16,6 +13,7 @@ public class AppPayWalletRespVO { @@ -16,6 +13,7 @@ public class AppPayWalletRespVO {
16 @Schema(description = "累计支出, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") 13 @Schema(description = "累计支出, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
17 private Long totalExpense; 14 private Long totalExpense;
18 15
19 - @Schema(description = "累计充值, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") 16 + @Schema(description = "累计充值, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000")
20 private Long totalRecharge; 17 private Long totalRecharge;
  18 +
21 } 19 }
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletConvert.java
1 package cn.iocoder.yudao.module.pay.convert.wallet; 1 package cn.iocoder.yudao.module.pay.convert.wallet;
2 2
3 -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletRespVO; 3 +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO;
4 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; 4 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
5 import org.mapstruct.Mapper; 5 import org.mapstruct.Mapper;
6 import org.mapstruct.factory.Mappers; 6 import org.mapstruct.factory.Mappers;
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletTransactionConvert.java
1 package cn.iocoder.yudao.module.pay.convert.wallet; 1 package cn.iocoder.yudao.module.pay.convert.wallet;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionRespVO; 4 +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO;
5 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; 5 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
6 import org.mapstruct.Mapper; 6 import org.mapstruct.Mapper;
7 import org.mapstruct.factory.Mappers; 7 import org.mapstruct.factory.Mappers;
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/wallet/PayWalletTransactionDO.java
@@ -48,6 +48,7 @@ public class PayWalletTransactionDO extends BaseDO { @@ -48,6 +48,7 @@ public class PayWalletTransactionDO extends BaseDO {
48 */ 48 */
49 private Long bizId; 49 private Long bizId;
50 50
  51 + // TODO @jason:想了下,改成 title;流水标题;因为账户明细那,会看到这个;
51 /** 52 /**
52 * 附加说明 53 * 附加说明
53 */ 54 */
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletMapper.java
@@ -9,7 +9,8 @@ import org.apache.ibatis.annotations.Mapper; @@ -9,7 +9,8 @@ import org.apache.ibatis.annotations.Mapper;
9 public interface PayWalletMapper extends BaseMapperX<PayWalletDO> { 9 public interface PayWalletMapper extends BaseMapperX<PayWalletDO> {
10 10
11 default PayWalletDO selectByUserIdAndType(Long userId, Integer userType) { 11 default PayWalletDO selectByUserIdAndType(Long userId, Integer userType) {
12 - return selectOne(PayWalletDO::getUserId, userId, PayWalletDO::getUserType, userType); 12 + return selectOne(PayWalletDO::getUserId, userId,
  13 + PayWalletDO::getUserType, userType);
13 } 14 }
14 } 15 }
15 16
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.wallet; 1 package cn.iocoder.yudao.module.pay.dal.mysql.wallet;
2 2
3 3
4 -import cn.iocoder.yudao.framework.common.pojo.PageParam;  
5 import cn.iocoder.yudao.framework.common.pojo.PageResult; 4 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; 5 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
7 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; 6 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  7 +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
8 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; 8 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
9 -import cn.iocoder.yudao.module.pay.enums.member.WalletTransactionQueryTypeEnum;  
10 import org.apache.ibatis.annotations.Mapper; 9 import org.apache.ibatis.annotations.Mapper;
11 10
  11 +import java.util.Objects;
  12 +
12 @Mapper 13 @Mapper
13 public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> { 14 public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> {
14 15
15 - default PageResult<PayWalletTransactionDO> selectPageByWalletIdAndQueryType(Long walletId,  
16 - WalletTransactionQueryTypeEnum queryType,  
17 - PageParam pageParam) { 16 + default PageResult<PayWalletTransactionDO> selectPage(Long walletId,
  17 + AppPayWalletTransactionPageReqVO pageReqVO) {
18 LambdaQueryWrapperX<PayWalletTransactionDO> query = new LambdaQueryWrapperX<PayWalletTransactionDO>() 18 LambdaQueryWrapperX<PayWalletTransactionDO> query = new LambdaQueryWrapperX<PayWalletTransactionDO>()
19 .eq(PayWalletTransactionDO::getWalletId, walletId); 19 .eq(PayWalletTransactionDO::getWalletId, walletId);
20 - if (WalletTransactionQueryTypeEnum.RECHARGE == queryType ) {  
21 - query.ge(PayWalletTransactionDO::getAmount, 0);  
22 - }  
23 - if (WalletTransactionQueryTypeEnum.EXPENSE == queryType ) { 20 + if (Objects.equals(pageReqVO.getType(), AppPayWalletTransactionPageReqVO.TYPE_INCOME)) {
  21 + query.gt(PayWalletTransactionDO::getAmount, 0);
  22 + } else if (Objects.equals(pageReqVO.getType(), AppPayWalletTransactionPageReqVO.TYPE_EXPENSE)) {
24 query.lt(PayWalletTransactionDO::getAmount, 0); 23 query.lt(PayWalletTransactionDO::getAmount, 0);
25 } 24 }
26 query.orderByDesc(PayWalletTransactionDO::getId); 25 query.orderByDesc(PayWalletTransactionDO::getId);
27 - return selectPage(pageParam, query); 26 + return selectPage(pageReqVO, query);
28 } 27 }
29 28
30 default PayWalletTransactionDO selectByNo(String no) { 29 default PayWalletTransactionDO selectByNo(String no) {
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java
1 package cn.iocoder.yudao.module.pay.service.wallet; 1 package cn.iocoder.yudao.module.pay.service.wallet;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionPageReqVO; 4 +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
5 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; 5 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
6 import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; 6 import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum;
7 7
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java
1 package cn.iocoder.yudao.module.pay.service.wallet; 1 package cn.iocoder.yudao.module.pay.service.wallet;
2 2
3 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 -import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.AppPayWalletTransactionPageReqVO; 4 +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
5 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; 5 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
6 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; 6 import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
7 import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletTransactionMapper; 7 import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletTransactionMapper;
8 import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; 8 import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum;
9 -import cn.iocoder.yudao.module.pay.enums.member.WalletTransactionQueryTypeEnum;  
10 import lombok.extern.slf4j.Slf4j; 9 import lombok.extern.slf4j.Slf4j;
11 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
12 11
@@ -35,12 +34,10 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ @@ -35,12 +34,10 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ
35 AppPayWalletTransactionPageReqVO pageVO) { 34 AppPayWalletTransactionPageReqVO pageVO) {
36 PayWalletDO wallet = payWalletService.getPayWallet(userId, userType); 35 PayWalletDO wallet = payWalletService.getPayWallet(userId, userType);
37 if (wallet == null) { 36 if (wallet == null) {
38 - log.error("[pageWalletTransaction] 用户 {} 钱包不存在", userId); 37 + log.error("[getWalletTransactionPage][用户({}/{}) 钱包不存在", userId, userType);
39 throw exception(WALLET_NOT_FOUND); 38 throw exception(WALLET_NOT_FOUND);
40 } 39 }
41 - // TODO @jason:不用 WalletTransactionQueryTypeEnum.valueOf(pageVO.getType()) 哈,直接 pageVO 里面判断值比对就好啦;  
42 - return payWalletTransactionMapper.selectPageByWalletIdAndQueryType(wallet.getId(),  
43 - WalletTransactionQueryTypeEnum.valueOf(pageVO.getType()), pageVO); 40 + return payWalletTransactionMapper.selectPage(wallet.getId(), pageVO);
44 } 41 }
45 42
46 @Override 43 @Override