Commit 69268b525ab248af08c656fecf4c760fceb55117
Merge remote-tracking branch 'origin/feature/mall_product' into feature/mall_product
Showing
18 changed files
with
239 additions
and
17 deletions
sql/mysql/pay_wallet.sql
| @@ -125,3 +125,58 @@ CREATE TABLE `pay_wallet_recharge` ( | @@ -125,3 +125,58 @@ CREATE TABLE `pay_wallet_recharge` ( | ||
| 125 | `tenant_id` bigint(0) NOT NULL DEFAULT 0 COMMENT '租户编号', | 125 | `tenant_id` bigint(0) NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 126 | PRIMARY KEY (`id`) USING BTREE | 126 | PRIMARY KEY (`id`) USING BTREE |
| 127 | ) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员钱包充值' ROW_FORMAT = Dynamic; | 127 | ) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员钱包充值' ROW_FORMAT = Dynamic; |
| 128 | + | ||
| 129 | +-- 钱包充值套餐菜单脚本 | ||
| 130 | + | ||
| 131 | +INSERT INTO system_menu( | ||
| 132 | + name, permission, type, sort, parent_id, | ||
| 133 | + path, icon, component, status, component_name | ||
| 134 | +) | ||
| 135 | +VALUES ( | ||
| 136 | + '钱包管理', '', 1, 5, 1117, | ||
| 137 | + 'wallet', 'ep:caret-right', '', 0, '' | ||
| 138 | + ); | ||
| 139 | +SELECT @parentId := LAST_INSERT_ID(); | ||
| 140 | +INSERT INTO system_menu( | ||
| 141 | + name, permission, type, sort, parent_id, | ||
| 142 | + path, icon, component, status, component_name | ||
| 143 | +) | ||
| 144 | +VALUES ( | ||
| 145 | + '充值套餐', '', 2, 2, @parentId, | ||
| 146 | + 'wallet-recharge-package', 'fa:leaf', 'pay/wallet/rechargePackage/index', 0, 'WalletRechargePackage' | ||
| 147 | + ); | ||
| 148 | +SELECT @parentId := LAST_INSERT_ID(); | ||
| 149 | + | ||
| 150 | +-- 按钮 SQL | ||
| 151 | +INSERT INTO system_menu( | ||
| 152 | + name, permission, type, sort, parent_id, | ||
| 153 | + path, icon, component, status | ||
| 154 | +) | ||
| 155 | +VALUES ( | ||
| 156 | + '钱包充值套餐查询', 'pay:wallet-recharge-package:query', 3, 1, @parentId, | ||
| 157 | + '', '', '', 0 | ||
| 158 | + ); | ||
| 159 | +INSERT INTO system_menu( | ||
| 160 | + name, permission, type, sort, parent_id, | ||
| 161 | + path, icon, component, status | ||
| 162 | +) | ||
| 163 | +VALUES ( | ||
| 164 | + '钱包充值套餐创建', 'pay:wallet-recharge-package:create', 3, 2, @parentId, | ||
| 165 | + '', '', '', 0 | ||
| 166 | + ); | ||
| 167 | +INSERT INTO system_menu( | ||
| 168 | + name, permission, type, sort, parent_id, | ||
| 169 | + path, icon, component, status | ||
| 170 | +) | ||
| 171 | +VALUES ( | ||
| 172 | + '钱包充值套餐更新', 'pay:wallet-recharge-package:update', 3, 3, @parentId, | ||
| 173 | + '', '', '', 0 | ||
| 174 | + ); | ||
| 175 | +INSERT INTO system_menu( | ||
| 176 | + name, permission, type, sort, parent_id, | ||
| 177 | + path, icon, component, status | ||
| 178 | +) | ||
| 179 | +VALUES ( | ||
| 180 | + '钱包充值套餐删除', 'pay:wallet-recharge-package:delete', 3, 4, @parentId, | ||
| 181 | + '', '', '', 0 | ||
| 182 | + ); |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java
| 1 | package cn.iocoder.yudao.module.pay.controller.admin.wallet; | 1 | package cn.iocoder.yudao.module.pay.controller.admin.wallet; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.PayWalletRespVO; | ||
| 5 | -import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.PayWalletUserReqVO; | 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 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; | ||
| 6 | import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert; | 8 | import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert; |
| 7 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | 9 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| 8 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; | 10 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; |
| @@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
| 16 | import org.springframework.web.bind.annotation.RestController; | 18 | import org.springframework.web.bind.annotation.RestController; |
| 17 | 19 | ||
| 18 | import javax.annotation.Resource; | 20 | import javax.annotation.Resource; |
| 21 | +import javax.validation.Valid; | ||
| 19 | 22 | ||
| 20 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 23 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 21 | 24 | ||
| @@ -37,4 +40,12 @@ public class PayWalletController { | @@ -37,4 +40,12 @@ public class PayWalletController { | ||
| 37 | return success(PayWalletConvert.INSTANCE.convert02(wallet)); | 40 | return success(PayWalletConvert.INSTANCE.convert02(wallet)); |
| 38 | } | 41 | } |
| 39 | 42 | ||
| 43 | + @GetMapping("/page") | ||
| 44 | + @Operation(summary = "获得会员钱包分页") | ||
| 45 | + @PreAuthorize("@ss.hasPermission('pay:wallet:query')") | ||
| 46 | + public CommonResult<PageResult<PayWalletRespVO>> getWalletPage(@Valid PayWalletPageReqVO pageVO) { | ||
| 47 | + PageResult<PayWalletDO> pageResult = payWalletService.getWalletPage(pageVO); | ||
| 48 | + return success(PayWalletConvert.INSTANCE.convertPage(pageResult)); | ||
| 49 | + } | ||
| 50 | + | ||
| 40 | } | 51 | } |
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/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; | 1 | +package cn.iocoder.yudao.module.pay.controller.admin.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; |
| @@ -18,7 +18,7 @@ public class PayWalletBaseVO { | @@ -18,7 +18,7 @@ public class PayWalletBaseVO { | ||
| 18 | 18 | ||
| 19 | @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | 19 | @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 20 | @NotNull(message = "用户类型不能为空") | 20 | @NotNull(message = "用户类型不能为空") |
| 21 | - private Byte userType; | 21 | + private Integer userType; |
| 22 | 22 | ||
| 23 | @Schema(description = "余额,单位分", requiredMode = Schema.RequiredMode.REQUIRED) | 23 | @Schema(description = "余额,单位分", requiredMode = Schema.RequiredMode.REQUIRED) |
| 24 | @NotNull(message = "余额,单位分不能为空") | 24 | @NotNull(message = "余额,单位分不能为空") |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 10 | + | ||
| 11 | +@Schema(description = "管理后台 - 会员钱包分页 Request VO") | ||
| 12 | +@Data | ||
| 13 | +@EqualsAndHashCode(callSuper = true) | ||
| 14 | +@ToString(callSuper = true) | ||
| 15 | +public class PayWalletPageReqVO extends PageParam { | ||
| 16 | + | ||
| 17 | + @Schema(description = "用户编号", example = "14138") | ||
| 18 | + private Long userId; | ||
| 19 | + | ||
| 20 | + @Schema(description = "用户类型", example = "1") | ||
| 21 | + private Integer userType; | ||
| 22 | + | ||
| 23 | + @Schema(description = "创建时间") | ||
| 24 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 25 | + private LocalDateTime[] createTime; | ||
| 26 | + | ||
| 27 | +} |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/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
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/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; | 1 | +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.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.validation.InEnum; | 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 +9,6 @@ import java.time.LocalDateTime; | ||
| 9 | @Data | 9 | @Data |
| 10 | public class AppPayWalletTransactionRespVO { | 10 | public class AppPayWalletTransactionRespVO { |
| 11 | 11 | ||
| 12 | - @Schema(description = "交易金额, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | ||
| 13 | - private Integer amount; | ||
| 14 | - | ||
| 15 | @Schema(description = "业务分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | 12 | @Schema(description = "业务分类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 16 | private Integer bizType; | 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 | 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.admin.wallet.vo.PayWalletRespVO; | 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO; | ||
| 4 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO; | 5 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO; |
| 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| 6 | import org.mapstruct.Mapper; | 7 | import org.mapstruct.Mapper; |
| @@ -14,4 +15,6 @@ public interface PayWalletConvert { | @@ -14,4 +15,6 @@ public interface PayWalletConvert { | ||
| 14 | AppPayWalletRespVO convert(PayWalletDO bean); | 15 | AppPayWalletRespVO convert(PayWalletDO bean); |
| 15 | 16 | ||
| 16 | PayWalletRespVO convert02(PayWalletDO wallet); | 17 | PayWalletRespVO convert02(PayWalletDO wallet); |
| 18 | + | ||
| 19 | + PageResult<PayWalletRespVO> convertPage(PageResult<PayWalletDO> page); | ||
| 17 | } | 20 | } |
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.admin.wallet.vo.transaction.PayWalletTransactionRespVO; | ||
| 4 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO; | 5 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO; |
| 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; | 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; |
| 6 | import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO; | 7 | import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO; |
| @@ -14,6 +15,8 @@ public interface PayWalletTransactionConvert { | @@ -14,6 +15,8 @@ public interface PayWalletTransactionConvert { | ||
| 14 | 15 | ||
| 15 | PageResult<AppPayWalletTransactionRespVO> convertPage(PageResult<PayWalletTransactionDO> page); | 16 | PageResult<AppPayWalletTransactionRespVO> convertPage(PageResult<PayWalletTransactionDO> page); |
| 16 | 17 | ||
| 18 | + PageResult<PayWalletTransactionRespVO> convertPage2(PageResult<PayWalletTransactionDO> page); | ||
| 19 | + | ||
| 17 | PayWalletTransactionDO convert(WalletTransactionCreateReqBO bean); | 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
| 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.PageResult; | ||
| 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 7 | +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO; | ||
| 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | 8 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| 6 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 9 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 7 | import org.apache.ibatis.annotations.Mapper; | 10 | import org.apache.ibatis.annotations.Mapper; |
| @@ -14,6 +17,14 @@ public interface PayWalletMapper extends BaseMapperX<PayWalletDO> { | @@ -14,6 +17,14 @@ public interface PayWalletMapper extends BaseMapperX<PayWalletDO> { | ||
| 14 | PayWalletDO::getUserType, userType); | 17 | PayWalletDO::getUserType, userType); |
| 15 | } | 18 | } |
| 16 | 19 | ||
| 20 | + default PageResult<PayWalletDO> selectPage(PayWalletPageReqVO reqVO) { | ||
| 21 | + return selectPage(reqVO, new LambdaQueryWrapperX<PayWalletDO>() | ||
| 22 | + .eqIfPresent(PayWalletDO::getUserId, reqVO.getUserId()) | ||
| 23 | + .eqIfPresent(PayWalletDO::getUserType, reqVO.getUserType()) | ||
| 24 | + .betweenIfPresent(PayWalletDO::getCreateTime, reqVO.getCreateTime()) | ||
| 25 | + .orderByDesc(PayWalletDO::getId)); | ||
| 26 | + } | ||
| 27 | + | ||
| 17 | /** | 28 | /** |
| 18 | * 当消费退款时候, 更新钱包 | 29 | * 当消费退款时候, 更新钱包 |
| 19 | * | 30 | * |
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; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 6 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 7 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| @@ -13,17 +14,17 @@ import java.util.Objects; | @@ -13,17 +14,17 @@ import java.util.Objects; | ||
| 13 | @Mapper | 14 | @Mapper |
| 14 | public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> { | 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 | LambdaQueryWrapperX<PayWalletTransactionDO> query = new LambdaQueryWrapperX<PayWalletTransactionDO>() | 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 | query.gt(PayWalletTransactionDO::getPrice, 0); | 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 | query.lt(PayWalletTransactionDO::getPrice, 0); | 24 | query.lt(PayWalletTransactionDO::getPrice, 0); |
| 24 | } | 25 | } |
| 25 | query.orderByDesc(PayWalletTransactionDO::getId); | 26 | query.orderByDesc(PayWalletTransactionDO::getId); |
| 26 | - return selectPage(pageReqVO, query); | 27 | + return selectPage(pageParam, query); |
| 27 | } | 28 | } |
| 28 | 29 | ||
| 29 | default PayWalletTransactionDO selectByNo(String no) { | 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 | 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; | ||
| 4 | +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO; | ||
| 3 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| 4 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; | 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; |
| 5 | import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; | 7 | import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; |
| @@ -28,6 +30,15 @@ public interface PayWalletService { | @@ -28,6 +30,15 @@ public interface PayWalletService { | ||
| 28 | */ | 30 | */ |
| 29 | PayWalletDO getWallet(Long walletId); | 31 | PayWalletDO getWallet(Long walletId); |
| 30 | 32 | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 获得会员钱包分页 | ||
| 36 | + * | ||
| 37 | + * @param pageReqVO 分页查询 | ||
| 38 | + * @return 会员钱包分页 | ||
| 39 | + */ | ||
| 40 | + PageResult<PayWalletDO> getWalletPage(PayWalletPageReqVO pageReqVO); | ||
| 41 | + | ||
| 31 | /** | 42 | /** |
| 32 | * 钱包订单支付 | 43 | * 钱包订单支付 |
| 33 | * | 44 | * |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
| 1 | package cn.iocoder.yudao.module.pay.service.wallet; | 1 | package cn.iocoder.yudao.module.pay.service.wallet; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.lang.Assert; | 3 | import cn.hutool.core.lang.Assert; |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO; | ||
| 4 | import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; | 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; |
| 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; | 7 | import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; |
| 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | 8 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| @@ -61,6 +63,11 @@ public class PayWalletServiceImpl implements PayWalletService { | @@ -61,6 +63,11 @@ public class PayWalletServiceImpl implements PayWalletService { | ||
| 61 | } | 63 | } |
| 62 | 64 | ||
| 63 | @Override | 65 | @Override |
| 66 | + public PageResult<PayWalletDO> getWalletPage(PayWalletPageReqVO pageReqVO) { | ||
| 67 | + return walletMapper.selectPage(pageReqVO); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + @Override | ||
| 64 | @Transactional(rollbackFor = Exception.class) | 71 | @Transactional(rollbackFor = Exception.class) |
| 65 | public PayWalletTransactionDO orderPay(Long userId, Integer userType, String outTradeNo, Integer price) { | 72 | public PayWalletTransactionDO orderPay(Long userId, Integer userType, String outTradeNo, Integer price) { |
| 66 | // 1. 判断支付交易拓展单是否存 | 73 | // 1. 判断支付交易拓展单是否存 |
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.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO; | ||
| 4 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; | 5 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; |
| 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; | 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; |
| 6 | import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; | 7 | import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; |
| @@ -26,6 +27,13 @@ public interface PayWalletTransactionService { | @@ -26,6 +27,13 @@ public interface PayWalletTransactionService { | ||
| 26 | AppPayWalletTransactionPageReqVO pageVO); | 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 | * @param bo 创建钱包流水 bo | 39 | * @param bo 创建钱包流水 bo |
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.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO; | ||
| 4 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; | 5 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; |
| 5 | import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert; | 6 | import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert; |
| 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; | 7 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| @@ -39,7 +40,12 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ | @@ -39,7 +40,12 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ | ||
| 39 | public PageResult<PayWalletTransactionDO> getWalletTransactionPage(Long userId, Integer userType, | 40 | public PageResult<PayWalletTransactionDO> getWalletTransactionPage(Long userId, Integer userType, |
| 40 | AppPayWalletTransactionPageReqVO pageVO) { | 41 | AppPayWalletTransactionPageReqVO pageVO) { |
| 41 | PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType); | 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 | @Override | 51 | @Override |