Commit 7cb8f8fab9a6ead6bd752701b9507356f9a6e84b
1 parent
e06f61ef
wallet - 管理端 钱包余额查询
Showing
9 changed files
with
77 additions
and
7 deletions
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.controller.admin.wallet; |
| 2 | 2 | |
| 3 | 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.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; | |
| 6 | 8 | import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert; |
| 7 | 9 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| 8 | 10 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; |
| ... | ... | @@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; |
| 16 | 18 | import org.springframework.web.bind.annotation.RestController; |
| 17 | 19 | |
| 18 | 20 | import javax.annotation.Resource; |
| 21 | +import javax.validation.Valid; | |
| 19 | 22 | |
| 20 | 23 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 21 | 24 | |
| ... | ... | @@ -37,4 +40,12 @@ public class PayWalletController { |
| 37 | 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/vo/PayWalletBaseVO.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletBaseVO.java
| 1 | -package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo; | |
| 1 | +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance; | |
| 2 | 2 | |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 4 | import lombok.Data; |
| ... | ... | @@ -18,7 +18,7 @@ public class PayWalletBaseVO { |
| 18 | 18 | |
| 19 | 19 | @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 20 | 20 | @NotNull(message = "用户类型不能为空") |
| 21 | - private Byte userType; | |
| 21 | + private Integer userType; | |
| 22 | 22 | |
| 23 | 23 | @Schema(description = "余额,单位分", requiredMode = Schema.RequiredMode.REQUIRED) |
| 24 | 24 | @NotNull(message = "余额,单位分不能为空") | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/balance/PayWalletPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.balance; | |
| 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/balance/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/balance/PayWalletUserReqVO.java
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 | -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.balance.PayWalletRespVO; | |
| 4 | 5 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO; |
| 5 | 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| 6 | 7 | import org.mapstruct.Mapper; |
| ... | ... | @@ -14,4 +15,6 @@ public interface PayWalletConvert { |
| 14 | 15 | AppPayWalletRespVO convert(PayWalletDO bean); |
| 15 | 16 | |
| 16 | 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/dal/mysql/wallet/PayWalletMapper.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.dal.mysql.wallet; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | 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.balance.PayWalletPageReqVO; | |
| 5 | 8 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| 6 | 9 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 7 | 10 | import org.apache.ibatis.annotations.Mapper; |
| ... | ... | @@ -14,6 +17,14 @@ public interface PayWalletMapper extends BaseMapperX<PayWalletDO> { |
| 14 | 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/service/wallet/PayWalletService.java
| 1 | 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.balance.PayWalletPageReqVO; | |
| 3 | 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| 4 | 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; |
| 5 | 7 | import cn.iocoder.yudao.module.pay.enums.member.PayWalletBizTypeEnum; |
| ... | ... | @@ -28,6 +30,15 @@ public interface PayWalletService { |
| 28 | 30 | */ |
| 29 | 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 | 1 | package cn.iocoder.yudao.module.pay.service.wallet; |
| 2 | 2 | |
| 3 | 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.balance.PayWalletPageReqVO; | |
| 4 | 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; |
| 5 | 7 | import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; |
| 6 | 8 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; |
| ... | ... | @@ -61,6 +63,11 @@ public class PayWalletServiceImpl implements PayWalletService { |
| 61 | 63 | } |
| 62 | 64 | |
| 63 | 65 | @Override |
| 66 | + public PageResult<PayWalletDO> getWalletPage(PayWalletPageReqVO pageReqVO) { | |
| 67 | + return walletMapper.selectPage(pageReqVO); | |
| 68 | + } | |
| 69 | + | |
| 70 | + @Override | |
| 64 | 71 | @Transactional(rollbackFor = Exception.class) |
| 65 | 72 | public PayWalletTransactionDO orderPay(Long userId, Integer userType, String outTradeNo, Integer price) { |
| 66 | 73 | // 1. 判断支付交易拓展单是否存 | ... | ... |