Commit 09724adb8d8ee0c009c5a27a378865a90bd252ca
1 parent
b4612262
✨ PAY:增加充值日志分页
Showing
17 changed files
with
199 additions
and
23 deletions
yudao-module-pay/yudao-module-pay-biz/pom.xml
| ... | ... | @@ -78,6 +78,10 @@ |
| 78 | 78 | <groupId>cn.iocoder.boot</groupId> |
| 79 | 79 | <artifactId>yudao-spring-boot-starter-excel</artifactId> |
| 80 | 80 | </dependency> |
| 81 | + <dependency> | |
| 82 | + <groupId>cn.iocoder.boot</groupId> | |
| 83 | + <artifactId>yudao-spring-boot-starter-biz-dict</artifactId> | |
| 84 | + </dependency> | |
| 81 | 85 | |
| 82 | 86 | </dependencies> |
| 83 | 87 | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletRechargePackageController.java
| ... | ... | @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.Wa |
| 6 | 6 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackagePageReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageRespVO; |
| 8 | 8 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageUpdateReqVO; |
| 9 | -import cn.iocoder.yudao.module.pay.convert.wallet.WalletRechargePackageConvert; | |
| 9 | +import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargePackageConvert; | |
| 10 | 10 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; |
| 11 | 11 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargePackageService; |
| 12 | 12 | import io.swagger.v3.oas.annotations.Operation; |
| ... | ... | @@ -61,7 +61,7 @@ public class PayWalletRechargePackageController { |
| 61 | 61 | @PreAuthorize("@ss.hasPermission('pay:wallet-recharge-package:query')") |
| 62 | 62 | public CommonResult<WalletRechargePackageRespVO> getWalletRechargePackage(@RequestParam("id") Long id) { |
| 63 | 63 | PayWalletRechargePackageDO walletRechargePackage = walletRechargePackageService.getWalletRechargePackage(id); |
| 64 | - return success(WalletRechargePackageConvert.INSTANCE.convert(walletRechargePackage)); | |
| 64 | + return success(PayWalletRechargePackageConvert.INSTANCE.convert(walletRechargePackage)); | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | @GetMapping("/page") |
| ... | ... | @@ -69,7 +69,7 @@ public class PayWalletRechargePackageController { |
| 69 | 69 | @PreAuthorize("@ss.hasPermission('pay:wallet-recharge-package:query')") |
| 70 | 70 | public CommonResult<PageResult<WalletRechargePackageRespVO>> getWalletRechargePackagePage(@Valid WalletRechargePackagePageReqVO pageVO) { |
| 71 | 71 | PageResult<PayWalletRechargePackageDO> pageResult = walletRechargePackageService.getWalletRechargePackagePage(pageVO); |
| 72 | - return success(WalletRechargePackageConvert.INSTANCE.convertPage(pageResult)); | |
| 72 | + return success(PayWalletRechargePackageConvert.INSTANCE.convertPage(pageResult)); | |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletRechargeController.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.controller.app.wallet; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | |
| 3 | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | 8 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO; |
| 5 | 9 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateRespVO; |
| 10 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeRespVO; | |
| 11 | +import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert; | |
| 6 | 12 | import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargeConvert; |
| 13 | +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; | |
| 7 | 14 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; |
| 15 | +import cn.iocoder.yudao.module.pay.service.order.PayOrderService; | |
| 8 | 16 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargeService; |
| 17 | +import com.google.common.collect.Lists; | |
| 9 | 18 | import io.swagger.v3.oas.annotations.Operation; |
| 10 | 19 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 11 | 20 | import lombok.extern.slf4j.Slf4j; |
| 12 | 21 | import org.springframework.validation.annotation.Validated; |
| 13 | -import org.springframework.web.bind.annotation.PostMapping; | |
| 14 | -import org.springframework.web.bind.annotation.RequestBody; | |
| 15 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 16 | -import org.springframework.web.bind.annotation.RestController; | |
| 22 | +import org.springframework.web.bind.annotation.*; | |
| 17 | 23 | |
| 18 | 24 | import jakarta.annotation.Resource; |
| 19 | 25 | import jakarta.validation.Valid; |
| 20 | 26 | |
| 27 | +import java.time.LocalDateTime; | |
| 28 | +import java.util.Arrays; | |
| 29 | +import java.util.List; | |
| 30 | + | |
| 21 | 31 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 32 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 22 | 33 | import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP; |
| 23 | 34 | import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId; |
| 24 | 35 | import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserType; |
| ... | ... | @@ -32,14 +43,30 @@ public class AppPayWalletRechargeController { |
| 32 | 43 | |
| 33 | 44 | @Resource |
| 34 | 45 | private PayWalletRechargeService walletRechargeService; |
| 46 | + @Resource | |
| 47 | + private PayOrderService payOrderService; | |
| 35 | 48 | |
| 36 | 49 | @PostMapping("/create") |
| 37 | 50 | @Operation(summary = "创建钱包充值记录(发起充值)") |
| 38 | 51 | public CommonResult<AppPayWalletRechargeCreateRespVO> createWalletRecharge( |
| 39 | - @Valid @RequestBody AppPayWalletRechargeCreateReqVO reqVO) { | |
| 52 | + @Valid @RequestBody AppPayWalletRechargeCreateReqVO reqVO) { | |
| 40 | 53 | PayWalletRechargeDO walletRecharge = walletRechargeService.createWalletRecharge( |
| 41 | 54 | getLoginUserId(), getLoginUserType(), getClientIP(), reqVO); |
| 42 | 55 | return success(PayWalletRechargeConvert.INSTANCE.convert(walletRecharge)); |
| 43 | 56 | } |
| 44 | 57 | |
| 58 | + @GetMapping("/page") | |
| 59 | + @Operation(summary = "获得钱包充值记录分页") | |
| 60 | + public CommonResult<PageResult<AppPayWalletRechargeRespVO>> getWalletRechargePage(@Valid PageParam pageReqVO) { | |
| 61 | + PageResult<PayWalletRechargeDO> pageResult = walletRechargeService.getWalletRechargePackagePage( | |
| 62 | + getLoginUserId(), UserTypeEnum.MEMBER.getValue(), pageReqVO, true); | |
| 63 | + if (CollUtil.isEmpty(pageResult.getList())) { | |
| 64 | + return success(PageResult.empty(pageResult.getTotal())); | |
| 65 | + } | |
| 66 | + // 拼接数据 | |
| 67 | + List<PayOrderDO> payOrderList = payOrderService.getOrderList( | |
| 68 | + convertList(pageResult.getList(), PayWalletRechargeDO::getPayOrderId)); | |
| 69 | + return success(PayWalletRechargeConvert.INSTANCE.convertPage(pageResult, payOrderList)); | |
| 70 | + } | |
| 71 | + | |
| 45 | 72 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/AppPayWalletRechargePackageController.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.controller.app.wallet; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 4 | 6 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletPackageRespVO; |
| 7 | +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; | |
| 8 | +import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargePackageService; | |
| 5 | 9 | import io.swagger.v3.oas.annotations.Operation; |
| 6 | 10 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 11 | +import jakarta.annotation.Resource; | |
| 7 | 12 | import lombok.extern.slf4j.Slf4j; |
| 8 | 13 | import org.springframework.validation.annotation.Validated; |
| 9 | 14 | import org.springframework.web.bind.annotation.GetMapping; |
| 10 | 15 | import org.springframework.web.bind.annotation.RequestMapping; |
| 11 | 16 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 17 | |
| 13 | -import java.util.ArrayList; | |
| 18 | +import java.util.Comparator; | |
| 14 | 19 | import java.util.List; |
| 15 | 20 | |
| 16 | 21 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| ... | ... | @@ -22,14 +27,16 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 22 | 27 | @Slf4j |
| 23 | 28 | public class AppPayWalletRechargePackageController { |
| 24 | 29 | |
| 30 | + @Resource | |
| 31 | + private PayWalletRechargePackageService walletRechargePackageService; | |
| 32 | + | |
| 25 | 33 | @GetMapping("/list") |
| 26 | 34 | @Operation(summary = "获得钱包充值套餐列表") |
| 27 | 35 | public CommonResult<List<AppPayWalletPackageRespVO>> getWalletRechargePackageList() { |
| 28 | - // 只查询开启;需要按照 payPrice 排序; | |
| 29 | - List<AppPayWalletPackageRespVO> list = new ArrayList<>(); | |
| 30 | - list.add(new AppPayWalletPackageRespVO().setId(1L).setName("土豆").setPayPrice(10).setBonusPrice(2)); | |
| 31 | - list.add(new AppPayWalletPackageRespVO().setId(2L).setName("番茄").setPayPrice(20).setBonusPrice(5)); | |
| 32 | - return success(list); | |
| 36 | + List<PayWalletRechargePackageDO> list = walletRechargePackageService.getWalletRechargePackageList( | |
| 37 | + CommonStatusEnum.ENABLE.getStatus()); | |
| 38 | + list.sort(Comparator.comparingInt(PayWalletRechargePackageDO::getPayPrice)); | |
| 39 | + return success(BeanUtils.toBean(list, AppPayWalletPackageRespVO.class)); | |
| 33 | 40 | } |
| 34 | 41 | |
| 35 | 42 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/recharge/AppPayWalletRechargeCreateReqVO.java
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/recharge/AppPayWalletRechargeRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge; | |
| 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 - 钱包充值记录 Resp VO") | |
| 9 | +@Data | |
| 10 | +public class AppPayWalletRechargeRespVO { | |
| 11 | + | |
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "用户实际到账余额", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | |
| 16 | + private Integer totalPrice; | |
| 17 | + | |
| 18 | + @Schema(description = "实际支付金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "20") | |
| 19 | + private Integer payPrice; | |
| 20 | + | |
| 21 | + @Schema(description = "钱包赠送金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "80") | |
| 22 | + private Integer bonusPrice; | |
| 23 | + | |
| 24 | + @Schema(description = "支付成功的支付渠道", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 25 | + private String payChannelCode; | |
| 26 | + | |
| 27 | + @Schema(description = "支付渠道名", example = "微信小程序支付") | |
| 28 | + private String payChannelName; | |
| 29 | + | |
| 30 | + @Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 31 | + private Long payOrderId; | |
| 32 | + | |
| 33 | + @Schema(description = "支付成功的外部订单号", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 34 | + private String payOrderChannelOrderNo; // 从 PayOrderDO 的 channelOrderNo 字段 | |
| 35 | + | |
| 36 | + @Schema(description = "订单支付时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 37 | + private LocalDateTime payTime; | |
| 38 | + | |
| 39 | + @Schema(description = "退款状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | |
| 40 | + private Integer refundStatus; | |
| 41 | + | |
| 42 | +} | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletRechargeConvert.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.convert.wallet; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 6 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 8 | +import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils; | |
| 3 | 9 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateRespVO; |
| 10 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeRespVO; | |
| 11 | +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; | |
| 4 | 12 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; |
| 13 | +import cn.iocoder.yudao.module.pay.enums.DictTypeConstants; | |
| 5 | 14 | import org.mapstruct.Mapper; |
| 6 | 15 | import org.mapstruct.Mapping; |
| 7 | 16 | import org.mapstruct.factory.Mappers; |
| 8 | 17 | |
| 18 | +import java.util.List; | |
| 19 | +import java.util.Map; | |
| 20 | + | |
| 9 | 21 | @Mapper |
| 10 | 22 | public interface PayWalletRechargeConvert { |
| 11 | 23 | |
| ... | ... | @@ -16,4 +28,17 @@ public interface PayWalletRechargeConvert { |
| 16 | 28 | |
| 17 | 29 | AppPayWalletRechargeCreateRespVO convert(PayWalletRechargeDO bean); |
| 18 | 30 | |
| 31 | + default PageResult<AppPayWalletRechargeRespVO> convertPage(PageResult<PayWalletRechargeDO> pageResult, | |
| 32 | + List<PayOrderDO> payOrderList) { | |
| 33 | + PageResult<AppPayWalletRechargeRespVO> voPageResult = BeanUtils.toBean(pageResult, AppPayWalletRechargeRespVO.class); | |
| 34 | + Map<Long, PayOrderDO> payOrderMap = CollectionUtils.convertMap(payOrderList, PayOrderDO::getId); | |
| 35 | + voPageResult.getList().forEach(recharge -> { | |
| 36 | + recharge.setPayChannelName(DictFrameworkUtils.getDictDataLabel( | |
| 37 | + DictTypeConstants.CHANNEL_CODE, recharge.getPayChannelCode())); | |
| 38 | + MapUtils.findAndThen(payOrderMap, recharge.getPayOrderId(), | |
| 39 | + order -> recharge.setPayOrderChannelOrderNo(order.getChannelOrderNo())); | |
| 40 | + }); | |
| 41 | + return voPageResult; | |
| 42 | + } | |
| 43 | + | |
| 19 | 44 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/WalletRechargePackageConvert.java renamed to yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletRechargePackageConvert.java
| ... | ... | @@ -12,9 +12,9 @@ import org.mapstruct.Mapper; |
| 12 | 12 | import org.mapstruct.factory.Mappers; |
| 13 | 13 | |
| 14 | 14 | @Mapper |
| 15 | -public interface WalletRechargePackageConvert { | |
| 15 | +public interface PayWalletRechargePackageConvert { | |
| 16 | 16 | |
| 17 | - WalletRechargePackageConvert INSTANCE = Mappers.getMapper(WalletRechargePackageConvert.class); | |
| 17 | + PayWalletRechargePackageConvert INSTANCE = Mappers.getMapper(PayWalletRechargePackageConvert.class); | |
| 18 | 18 | |
| 19 | 19 | PayWalletRechargePackageDO convert(WalletRechargePackageCreateReqVO bean); |
| 20 | 20 | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletRechargeMapper.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.dal.mysql.wallet; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 3 | 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 4 | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 5 | 7 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; |
| 8 | +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; | |
| 6 | 9 | import org.apache.ibatis.annotations.Mapper; |
| 7 | 10 | |
| 8 | 11 | @Mapper |
| ... | ... | @@ -18,4 +21,10 @@ public interface PayWalletRechargeMapper extends BaseMapperX<PayWalletRechargeDO |
| 18 | 21 | .eq(PayWalletRechargeDO::getId, id).eq(PayWalletRechargeDO::getRefundStatus, whereRefundStatus)); |
| 19 | 22 | } |
| 20 | 23 | |
| 24 | + default PageResult<PayWalletRechargeDO> selectPage(PageParam pageReqVO, Long walletId, Boolean payStatus) { | |
| 25 | + return selectPage(pageReqVO, new LambdaQueryWrapperX<PayWalletRechargeDO>() | |
| 26 | + .eq(PayWalletRechargeDO::getWalletId, walletId) | |
| 27 | + .eq(PayWalletRechargeDO::getPayStatus, payStatus)); | |
| 28 | + } | |
| 29 | + | |
| 21 | 30 | } |
| 22 | 31 | \ No newline at end of file | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletRechargePackageMapper.java
| ... | ... | @@ -8,6 +8,8 @@ import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.Wa |
| 8 | 8 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; |
| 9 | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 11 | 13 | @Mapper |
| 12 | 14 | public interface PayWalletRechargePackageMapper extends BaseMapperX<PayWalletRechargePackageDO> { |
| 13 | 15 | |
| ... | ... | @@ -19,9 +21,12 @@ public interface PayWalletRechargePackageMapper extends BaseMapperX<PayWalletRec |
| 19 | 21 | .orderByDesc(PayWalletRechargePackageDO::getPayPrice)); |
| 20 | 22 | } |
| 21 | 23 | |
| 22 | - // TODO @jason:这里要有空格哈;String name) { | |
| 23 | - default PayWalletRechargePackageDO selectByName(String name){ | |
| 24 | + default PayWalletRechargePackageDO selectByName(String name) { | |
| 24 | 25 | return selectOne(PayWalletRechargePackageDO::getName, name); |
| 25 | 26 | } |
| 26 | 27 | |
| 28 | + default List<PayWalletRechargePackageDO> selectListByStatus(Integer status) { | |
| 29 | + return selectList(PayWalletRechargePackageDO::getStatus, status); | |
| 30 | + } | |
| 31 | + | |
| 27 | 32 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderService.java
| ... | ... | @@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; |
| 13 | 13 | import jakarta.validation.Valid; |
| 14 | 14 | import jakarta.validation.constraints.NotEmpty; |
| 15 | 15 | import java.time.LocalDateTime; |
| 16 | +import java.util.Collection; | |
| 16 | 17 | import java.util.List; |
| 17 | 18 | |
| 18 | 19 | /** |
| ... | ... | @@ -40,6 +41,14 @@ public interface PayOrderService { |
| 40 | 41 | PayOrderDO getOrder(Long appId, String merchantOrderId); |
| 41 | 42 | |
| 42 | 43 | /** |
| 44 | + * 获得支付订单列表 | |
| 45 | + * | |
| 46 | + * @param ids 编号数组 | |
| 47 | + * @return 支付订单列表 | |
| 48 | + */ | |
| 49 | + List<PayOrderDO> getOrderList(Collection<Long> ids); | |
| 50 | + | |
| 51 | + /** | |
| 43 | 52 | * 获得指定应用的订单数量 |
| 44 | 53 | * |
| 45 | 54 | * @param appId 应用编号 | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java
| ... | ... | @@ -39,6 +39,8 @@ import org.springframework.validation.annotation.Validated; |
| 39 | 39 | |
| 40 | 40 | import jakarta.annotation.Resource; |
| 41 | 41 | import java.time.LocalDateTime; |
| 42 | +import java.util.Collection; | |
| 43 | +import java.util.Collections; | |
| 42 | 44 | import java.util.List; |
| 43 | 45 | import java.util.Objects; |
| 44 | 46 | |
| ... | ... | @@ -84,6 +86,14 @@ public class PayOrderServiceImpl implements PayOrderService { |
| 84 | 86 | } |
| 85 | 87 | |
| 86 | 88 | @Override |
| 89 | + public List<PayOrderDO> getOrderList(Collection<Long> ids) { | |
| 90 | + if (CollUtil.isEmpty(ids)) { | |
| 91 | + return Collections.emptyList(); | |
| 92 | + } | |
| 93 | + return orderMapper.selectBatchIds(ids); | |
| 94 | + } | |
| 95 | + | |
| 96 | + @Override | |
| 87 | 97 | public Long getOrderCountByAppId(Long appId) { |
| 88 | 98 | return orderMapper.selectCountByAppId(appId); |
| 89 | 99 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageService.java
| ... | ... | @@ -60,4 +60,12 @@ public interface PayWalletRechargePackageService { |
| 60 | 60 | */ |
| 61 | 61 | PageResult<PayWalletRechargePackageDO> getWalletRechargePackagePage(WalletRechargePackagePageReqVO pageReqVO); |
| 62 | 62 | |
| 63 | + /** | |
| 64 | + * 获得充值套餐列表 | |
| 65 | + * | |
| 66 | + * @param status 状态 | |
| 67 | + * @return 充值套餐列表 | |
| 68 | + */ | |
| 69 | + List<PayWalletRechargePackageDO> getWalletRechargePackageList(Integer status); | |
| 70 | + | |
| 63 | 71 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargePackageServiceImpl.java
| ... | ... | @@ -6,13 +6,15 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 6 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageCreateReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackagePageReqVO; |
| 8 | 8 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageUpdateReqVO; |
| 9 | -import cn.iocoder.yudao.module.pay.convert.wallet.WalletRechargePackageConvert; | |
| 9 | +import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargePackageConvert; | |
| 10 | 10 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; |
| 11 | 11 | import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletRechargePackageMapper; |
| 12 | 12 | import org.springframework.stereotype.Service; |
| 13 | 13 | |
| 14 | 14 | import jakarta.annotation.Resource; |
| 15 | 15 | |
| 16 | +import java.util.List; | |
| 17 | + | |
| 16 | 18 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 17 | 19 | import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; |
| 18 | 20 | |
| ... | ... | @@ -50,7 +52,7 @@ public class PayWalletRechargePackageServiceImpl implements PayWalletRechargePac |
| 50 | 52 | validateRechargePackageNameUnique(null, createReqVO.getName()); |
| 51 | 53 | |
| 52 | 54 | // 插入 |
| 53 | - PayWalletRechargePackageDO walletRechargePackage = WalletRechargePackageConvert.INSTANCE.convert(createReqVO); | |
| 55 | + PayWalletRechargePackageDO walletRechargePackage = PayWalletRechargePackageConvert.INSTANCE.convert(createReqVO); | |
| 54 | 56 | walletRechargePackageMapper.insert(walletRechargePackage); |
| 55 | 57 | // 返回 |
| 56 | 58 | return walletRechargePackage.getId(); |
| ... | ... | @@ -64,7 +66,7 @@ public class PayWalletRechargePackageServiceImpl implements PayWalletRechargePac |
| 64 | 66 | validateRechargePackageNameUnique(updateReqVO.getId(), updateReqVO.getName()); |
| 65 | 67 | |
| 66 | 68 | // 更新 |
| 67 | - PayWalletRechargePackageDO updateObj = WalletRechargePackageConvert.INSTANCE.convert(updateReqVO); | |
| 69 | + PayWalletRechargePackageDO updateObj = PayWalletRechargePackageConvert.INSTANCE.convert(updateReqVO); | |
| 68 | 70 | walletRechargePackageMapper.updateById(updateObj); |
| 69 | 71 | } |
| 70 | 72 | |
| ... | ... | @@ -103,4 +105,9 @@ public class PayWalletRechargePackageServiceImpl implements PayWalletRechargePac |
| 103 | 105 | return walletRechargePackageMapper.selectPage(pageReqVO); |
| 104 | 106 | } |
| 105 | 107 | |
| 108 | + @Override | |
| 109 | + public List<PayWalletRechargePackageDO> getWalletRechargePackageList(Integer status) { | |
| 110 | + return walletRechargePackageMapper.selectListByStatus(status); | |
| 111 | + } | |
| 112 | + | |
| 106 | 113 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeService.java
| 1 | 1 | package cn.iocoder.yudao.module.pay.service.wallet; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 3 | 5 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO; |
| 4 | 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; |
| 7 | +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; | |
| 5 | 8 | |
| 6 | 9 | /** |
| 7 | 10 | * 钱包充值 Service 接口 |
| ... | ... | @@ -23,6 +26,18 @@ public interface PayWalletRechargeService { |
| 23 | 26 | AppPayWalletRechargeCreateReqVO createReqVO); |
| 24 | 27 | |
| 25 | 28 | /** |
| 29 | + * 获得钱包充值记录分页 | |
| 30 | + * | |
| 31 | + * @param userId 用户编号 | |
| 32 | + * @param userType 用户类型 | |
| 33 | + * @param pageReqVO 分页请求 | |
| 34 | + * @param payStatus 是否支付 | |
| 35 | + * @return 钱包充值记录分页 | |
| 36 | + */ | |
| 37 | + PageResult<PayWalletRechargeDO> getWalletRechargePackagePage(Long userId, Integer userType, | |
| 38 | + PageParam pageReqVO, Boolean payStatus); | |
| 39 | + | |
| 40 | + /** | |
| 26 | 41 | * 更新钱包充值成功 |
| 27 | 42 | * |
| 28 | 43 | * @param id 钱包充值记录 id | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.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.PageParam; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | 6 | import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum; |
| 5 | 7 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; |
| 6 | 8 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; |
| ... | ... | @@ -64,7 +66,6 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { |
| 64 | 66 | @Transactional(rollbackFor = Exception.class) |
| 65 | 67 | public PayWalletRechargeDO createWalletRecharge(Long userId, Integer userType, String userIp, |
| 66 | 68 | AppPayWalletRechargeCreateReqVO reqVO) { |
| 67 | - | |
| 68 | 69 | // 1.1 计算充值金额 |
| 69 | 70 | int payPrice; |
| 70 | 71 | int bonusPrice = 0; |
| ... | ... | @@ -94,6 +95,13 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { |
| 94 | 95 | } |
| 95 | 96 | |
| 96 | 97 | @Override |
| 98 | + public PageResult<PayWalletRechargeDO> getWalletRechargePackagePage(Long userId, Integer userType, | |
| 99 | + PageParam pageReqVO, Boolean payStatus) { | |
| 100 | + PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType); | |
| 101 | + return walletRechargeMapper.selectPage(pageReqVO, wallet.getId(), payStatus); | |
| 102 | + } | |
| 103 | + | |
| 104 | + @Override | |
| 97 | 105 | @Transactional(rollbackFor = Exception.class) |
| 98 | 106 | public void updateWalletRechargerPaid(Long id, Long payOrderId) { |
| 99 | 107 | // 1.1 获取钱包充值记录 | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java