Commit a05d3bc1d1179422a86587622b46affb465a607a
Merge remote-tracking branch 'yudao/develop' into develop
Showing
28 changed files
with
316 additions
and
49 deletions
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppMemberUserController.java
| @@ -60,14 +60,14 @@ public class AppMemberUserController { | @@ -60,14 +60,14 @@ public class AppMemberUserController { | ||
| 60 | @PutMapping("/update-password") | 60 | @PutMapping("/update-password") |
| 61 | @Operation(summary = "修改用户密码", description = "用户修改密码时使用") | 61 | @Operation(summary = "修改用户密码", description = "用户修改密码时使用") |
| 62 | @PreAuthenticated | 62 | @PreAuthenticated |
| 63 | - public CommonResult<Boolean> updatePassword(@RequestBody @Valid AppMemberUserUpdatePasswordReqVO reqVO) { | 63 | + public CommonResult<Boolean> updateUserPassword(@RequestBody @Valid AppMemberUserUpdatePasswordReqVO reqVO) { |
| 64 | userService.updateUserPassword(getLoginUserId(), reqVO); | 64 | userService.updateUserPassword(getLoginUserId(), reqVO); |
| 65 | return success(true); | 65 | return success(true); |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | @PutMapping("/reset-password") | 68 | @PutMapping("/reset-password") |
| 69 | @Operation(summary = "重置密码", description = "用户忘记密码时使用") | 69 | @Operation(summary = "重置密码", description = "用户忘记密码时使用") |
| 70 | - public CommonResult<Boolean> resetPassword(@RequestBody @Valid AppMemberUserResetPasswordReqVO reqVO) { | 70 | + public CommonResult<Boolean> resetUserPassword(@RequestBody @Valid AppMemberUserResetPasswordReqVO reqVO) { |
| 71 | userService.resetUserPassword(reqVO); | 71 | userService.resetUserPassword(reqVO); |
| 72 | return success(true); | 72 | return success(true); |
| 73 | } | 73 | } |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java
| @@ -214,11 +214,17 @@ public class MemberAuthServiceImpl implements MemberAuthService { | @@ -214,11 +214,17 @@ public class MemberAuthServiceImpl implements MemberAuthService { | ||
| 214 | } | 214 | } |
| 215 | // 情况 2:如果是重置密码场景,需要校验手机号是存在的 | 215 | // 情况 2:如果是重置密码场景,需要校验手机号是存在的 |
| 216 | if (Objects.equals(reqVO.getScene(), SmsSceneEnum.MEMBER_RESET_PASSWORD.getScene())) { | 216 | if (Objects.equals(reqVO.getScene(), SmsSceneEnum.MEMBER_RESET_PASSWORD.getScene())) { |
| 217 | - MemberUserDO user= userService.getUserByMobile(reqVO.getMobile()); | 217 | + MemberUserDO user = userService.getUserByMobile(reqVO.getMobile()); |
| 218 | if (user == null) { | 218 | if (user == null) { |
| 219 | throw exception(USER_MOBILE_NOT_EXISTS); | 219 | throw exception(USER_MOBILE_NOT_EXISTS); |
| 220 | } | 220 | } |
| 221 | } | 221 | } |
| 222 | + // 情况 3:如果是修改密码场景,需要查询手机号,无需前端传递 | ||
| 223 | + if (Objects.equals(reqVO.getScene(), SmsSceneEnum.MEMBER_UPDATE_PASSWORD.getScene())) { | ||
| 224 | + MemberUserDO user = userService.getUser(userId); | ||
| 225 | + // TODO 芋艿:后续 member user 手机非强绑定,这块需要做下调整; | ||
| 226 | + reqVO.setMobile(user.getMobile()); | ||
| 227 | + } | ||
| 222 | 228 | ||
| 223 | // 执行发送 | 229 | // 执行发送 |
| 224 | smsCodeApi.sendSmsCode(AuthConvert.INSTANCE.convert(reqVO).setCreateIp(getClientIP())); | 230 | smsCodeApi.sendSmsCode(AuthConvert.INSTANCE.convert(reqVO).setCreateIp(getClientIP())); |
yudao-module-pay/yudao-module-pay-biz/pom.xml
| @@ -78,6 +78,10 @@ | @@ -78,6 +78,10 @@ | ||
| 78 | <groupId>cn.iocoder.boot</groupId> | 78 | <groupId>cn.iocoder.boot</groupId> |
| 79 | <artifactId>yudao-spring-boot-starter-excel</artifactId> | 79 | <artifactId>yudao-spring-boot-starter-excel</artifactId> |
| 80 | </dependency> | 80 | </dependency> |
| 81 | + <dependency> | ||
| 82 | + <groupId>cn.iocoder.boot</groupId> | ||
| 83 | + <artifactId>yudao-spring-boot-starter-biz-dict</artifactId> | ||
| 84 | + </dependency> | ||
| 81 | 85 | ||
| 82 | </dependencies> | 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,7 +6,7 @@ import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.Wa | ||
| 6 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackagePageReqVO; | 6 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackagePageReqVO; |
| 7 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageRespVO; | 7 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageRespVO; |
| 8 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageUpdateReqVO; | 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 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; | 10 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; |
| 11 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargePackageService; | 11 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargePackageService; |
| 12 | import io.swagger.v3.oas.annotations.Operation; | 12 | import io.swagger.v3.oas.annotations.Operation; |
| @@ -61,7 +61,7 @@ public class PayWalletRechargePackageController { | @@ -61,7 +61,7 @@ public class PayWalletRechargePackageController { | ||
| 61 | @PreAuthorize("@ss.hasPermission('pay:wallet-recharge-package:query')") | 61 | @PreAuthorize("@ss.hasPermission('pay:wallet-recharge-package:query')") |
| 62 | public CommonResult<WalletRechargePackageRespVO> getWalletRechargePackage(@RequestParam("id") Long id) { | 62 | public CommonResult<WalletRechargePackageRespVO> getWalletRechargePackage(@RequestParam("id") Long id) { |
| 63 | PayWalletRechargePackageDO walletRechargePackage = walletRechargePackageService.getWalletRechargePackage(id); | 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 | @GetMapping("/page") | 67 | @GetMapping("/page") |
| @@ -69,7 +69,7 @@ public class PayWalletRechargePackageController { | @@ -69,7 +69,7 @@ public class PayWalletRechargePackageController { | ||
| 69 | @PreAuthorize("@ss.hasPermission('pay:wallet-recharge-package:query')") | 69 | @PreAuthorize("@ss.hasPermission('pay:wallet-recharge-package:query')") |
| 70 | public CommonResult<PageResult<WalletRechargePackageRespVO>> getWalletRechargePackagePage(@Valid WalletRechargePackagePageReqVO pageVO) { | 70 | public CommonResult<PageResult<WalletRechargePackageRespVO>> getWalletRechargePackagePage(@Valid WalletRechargePackagePageReqVO pageVO) { |
| 71 | PageResult<PayWalletRechargePackageDO> pageResult = walletRechargePackageService.getWalletRechargePackagePage(pageVO); | 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 | package cn.iocoder.yudao.module.pay.controller.app.wallet; | 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 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 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 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO; | 8 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO; |
| 5 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateRespVO; | 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 | import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargeConvert; | 12 | import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargeConvert; |
| 13 | +import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO; | ||
| 7 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; | 14 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; |
| 15 | +import cn.iocoder.yudao.module.pay.service.order.PayOrderService; | ||
| 8 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargeService; | 16 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargeService; |
| 17 | +import com.google.common.collect.Lists; | ||
| 9 | import io.swagger.v3.oas.annotations.Operation; | 18 | import io.swagger.v3.oas.annotations.Operation; |
| 10 | import io.swagger.v3.oas.annotations.tags.Tag; | 19 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 11 | import lombok.extern.slf4j.Slf4j; | 20 | import lombok.extern.slf4j.Slf4j; |
| 12 | import org.springframework.validation.annotation.Validated; | 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 | import jakarta.annotation.Resource; | 24 | import jakarta.annotation.Resource; |
| 19 | import jakarta.validation.Valid; | 25 | import jakarta.validation.Valid; |
| 20 | 26 | ||
| 27 | +import java.time.LocalDateTime; | ||
| 28 | +import java.util.Arrays; | ||
| 29 | +import java.util.List; | ||
| 30 | + | ||
| 21 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 31 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 32 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | ||
| 22 | import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP; | 33 | import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP; |
| 23 | import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId; | 34 | import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId; |
| 24 | import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserType; | 35 | import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserType; |
| @@ -32,14 +43,30 @@ public class AppPayWalletRechargeController { | @@ -32,14 +43,30 @@ public class AppPayWalletRechargeController { | ||
| 32 | 43 | ||
| 33 | @Resource | 44 | @Resource |
| 34 | private PayWalletRechargeService walletRechargeService; | 45 | private PayWalletRechargeService walletRechargeService; |
| 46 | + @Resource | ||
| 47 | + private PayOrderService payOrderService; | ||
| 35 | 48 | ||
| 36 | @PostMapping("/create") | 49 | @PostMapping("/create") |
| 37 | @Operation(summary = "创建钱包充值记录(发起充值)") | 50 | @Operation(summary = "创建钱包充值记录(发起充值)") |
| 38 | public CommonResult<AppPayWalletRechargeCreateRespVO> createWalletRecharge( | 51 | public CommonResult<AppPayWalletRechargeCreateRespVO> createWalletRecharge( |
| 39 | - @Valid @RequestBody AppPayWalletRechargeCreateReqVO reqVO) { | 52 | + @Valid @RequestBody AppPayWalletRechargeCreateReqVO reqVO) { |
| 40 | PayWalletRechargeDO walletRecharge = walletRechargeService.createWalletRecharge( | 53 | PayWalletRechargeDO walletRecharge = walletRechargeService.createWalletRecharge( |
| 41 | getLoginUserId(), getLoginUserType(), getClientIP(), reqVO); | 54 | getLoginUserId(), getLoginUserType(), getClientIP(), reqVO); |
| 42 | return success(PayWalletRechargeConvert.INSTANCE.convert(walletRecharge)); | 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 | package cn.iocoder.yudao.module.pay.controller.app.wallet; | 1 | package cn.iocoder.yudao.module.pay.controller.app.wallet; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 4 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletPackageRespVO; | 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 | import io.swagger.v3.oas.annotations.Operation; | 9 | import io.swagger.v3.oas.annotations.Operation; |
| 6 | import io.swagger.v3.oas.annotations.tags.Tag; | 10 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 11 | +import jakarta.annotation.Resource; | ||
| 7 | import lombok.extern.slf4j.Slf4j; | 12 | import lombok.extern.slf4j.Slf4j; |
| 8 | import org.springframework.validation.annotation.Validated; | 13 | import org.springframework.validation.annotation.Validated; |
| 9 | import org.springframework.web.bind.annotation.GetMapping; | 14 | import org.springframework.web.bind.annotation.GetMapping; |
| 10 | import org.springframework.web.bind.annotation.RequestMapping; | 15 | import org.springframework.web.bind.annotation.RequestMapping; |
| 11 | import org.springframework.web.bind.annotation.RestController; | 16 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 17 | ||
| 13 | -import java.util.ArrayList; | 18 | +import java.util.Comparator; |
| 14 | import java.util.List; | 19 | import java.util.List; |
| 15 | 20 | ||
| 16 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 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,14 +27,16 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 22 | @Slf4j | 27 | @Slf4j |
| 23 | public class AppPayWalletRechargePackageController { | 28 | public class AppPayWalletRechargePackageController { |
| 24 | 29 | ||
| 30 | + @Resource | ||
| 31 | + private PayWalletRechargePackageService walletRechargePackageService; | ||
| 32 | + | ||
| 25 | @GetMapping("/list") | 33 | @GetMapping("/list") |
| 26 | @Operation(summary = "获得钱包充值套餐列表") | 34 | @Operation(summary = "获得钱包充值套餐列表") |
| 27 | public CommonResult<List<AppPayWalletPackageRespVO>> getWalletRechargePackageList() { | 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/AppPayWalletTransactionController.java
| @@ -3,24 +3,30 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet; | @@ -3,24 +3,30 @@ 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.framework.common.util.object.BeanUtils; | ||
| 7 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionSummaryRespVO; | ||
| 6 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; | 8 | 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; | 9 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO; |
| 8 | -import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert; | ||
| 9 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; | 10 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; |
| 10 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService; | 11 | import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService; |
| 11 | import io.swagger.v3.oas.annotations.Operation; | 12 | import io.swagger.v3.oas.annotations.Operation; |
| 13 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 12 | import io.swagger.v3.oas.annotations.tags.Tag; | 14 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 13 | import lombok.extern.slf4j.Slf4j; | 15 | import lombok.extern.slf4j.Slf4j; |
| 16 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 14 | import org.springframework.validation.annotation.Validated; | 17 | import org.springframework.validation.annotation.Validated; |
| 15 | import org.springframework.web.bind.annotation.GetMapping; | 18 | import org.springframework.web.bind.annotation.GetMapping; |
| 16 | import org.springframework.web.bind.annotation.RequestMapping; | 19 | import org.springframework.web.bind.annotation.RequestMapping; |
| 20 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 17 | import org.springframework.web.bind.annotation.RestController; | 21 | import org.springframework.web.bind.annotation.RestController; |
| 18 | 22 | ||
| 19 | import jakarta.annotation.Resource; | 23 | import jakarta.annotation.Resource; |
| 20 | import jakarta.validation.Valid; | 24 | import jakarta.validation.Valid; |
| 25 | + | ||
| 21 | import java.time.LocalDateTime; | 26 | import java.time.LocalDateTime; |
| 22 | 27 | ||
| 23 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 28 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 29 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 24 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | 30 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 25 | 31 | ||
| 26 | @Tag(name = "用户 APP - 钱包余额明细") | 32 | @Tag(name = "用户 APP - 钱包余额明细") |
| @@ -37,16 +43,19 @@ public class AppPayWalletTransactionController { | @@ -37,16 +43,19 @@ public class AppPayWalletTransactionController { | ||
| 37 | @Operation(summary = "获得钱包流水分页") | 43 | @Operation(summary = "获得钱包流水分页") |
| 38 | public CommonResult<PageResult<AppPayWalletTransactionRespVO>> getWalletTransactionPage( | 44 | public CommonResult<PageResult<AppPayWalletTransactionRespVO>> getWalletTransactionPage( |
| 39 | @Valid AppPayWalletTransactionPageReqVO pageReqVO) { | 45 | @Valid AppPayWalletTransactionPageReqVO pageReqVO) { |
| 40 | - if (true) { | ||
| 41 | - PageResult<AppPayWalletTransactionRespVO> result = new PageResult<>(10L); | ||
| 42 | - result.getList().add(new AppPayWalletTransactionRespVO().setPrice(1L) | ||
| 43 | - .setTitle("测试").setCreateTime(LocalDateTime.now())); | ||
| 44 | - result.getList().add(new AppPayWalletTransactionRespVO().setPrice(-1L) | ||
| 45 | - .setTitle("测试2").setCreateTime(LocalDateTime.now())); | ||
| 46 | - return success(result); | ||
| 47 | - } | ||
| 48 | - PageResult<PayWalletTransactionDO> result = payWalletTransactionService.getWalletTransactionPage(getLoginUserId(), | ||
| 49 | - UserTypeEnum.MEMBER.getValue(), pageReqVO); | ||
| 50 | - return success(PayWalletTransactionConvert.INSTANCE.convertPage(result)); | 46 | + PageResult<PayWalletTransactionDO> pageResult = payWalletTransactionService.getWalletTransactionPage( |
| 47 | + getLoginUserId(), UserTypeEnum.MEMBER.getValue(), pageReqVO); | ||
| 48 | + return success(BeanUtils.toBean(pageResult, AppPayWalletTransactionRespVO.class)); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @GetMapping("/get-summary") | ||
| 52 | + @Operation(summary = "获得钱包流水统计") | ||
| 53 | + @Parameter(name = "times", description = "时间段", required = true) | ||
| 54 | + public CommonResult<AppPayWalletTransactionSummaryRespVO> getWalletTransactionSummary( | ||
| 55 | + @RequestParam("createTime") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) LocalDateTime[] createTime) { | ||
| 56 | + AppPayWalletTransactionSummaryRespVO summary = payWalletTransactionService.getWalletTransactionSummary( | ||
| 57 | + getLoginUserId(), UserTypeEnum.MEMBER.getValue(), createTime); | ||
| 58 | + return success(summary); | ||
| 51 | } | 59 | } |
| 60 | + | ||
| 52 | } | 61 | } |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/recharge/AppPayWalletRechargeCreateReqVO.java
| @@ -22,4 +22,5 @@ public class AppPayWalletRechargeCreateReqVO { | @@ -22,4 +22,5 @@ public class AppPayWalletRechargeCreateReqVO { | ||
| 22 | public boolean isValidPayPriceAndPackageId() { | 22 | public boolean isValidPayPriceAndPackageId() { |
| 23 | return Objects.nonNull(payPrice) || Objects.nonNull(packageId); | 23 | return Objects.nonNull(payPrice) || Objects.nonNull(packageId); |
| 24 | } | 24 | } |
| 25 | + | ||
| 25 | } | 26 | } |
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/controller/app/wallet/vo/transaction/AppPayWalletTransactionPageReqVO.java
| 1 | package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction; | 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.util.date.DateUtils; | ||
| 4 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | import lombok.Data; | 6 | import lombok.Data; |
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | + | ||
| 9 | +import java.time.LocalDateTime; | ||
| 6 | 10 | ||
| 7 | @Schema(description = "用户 APP - 钱包流水分页 Request VO") | 11 | @Schema(description = "用户 APP - 钱包流水分页 Request VO") |
| 8 | @Data | 12 | @Data |
| @@ -20,4 +24,8 @@ public class AppPayWalletTransactionPageReqVO extends PageParam { | @@ -20,4 +24,8 @@ public class AppPayWalletTransactionPageReqVO extends PageParam { | ||
| 20 | @Schema(description = "类型", example = "1") | 24 | @Schema(description = "类型", example = "1") |
| 21 | private Integer type; | 25 | private Integer type; |
| 22 | 26 | ||
| 27 | + @Schema(description = "创建时间") | ||
| 28 | + @DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 29 | + private LocalDateTime[] createTime; | ||
| 30 | + | ||
| 23 | } | 31 | } |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/transaction/AppPayWalletTransactionSummaryRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +@Schema(description = "用户 APP - 钱包流水统计 Request VO") | ||
| 7 | +@Data | ||
| 8 | +public class AppPayWalletTransactionSummaryRespVO { | ||
| 9 | + | ||
| 10 | + @Schema(description = "累计支出,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") | ||
| 11 | + private Integer totalExpense; | ||
| 12 | + | ||
| 13 | + @Schema(description = "累计收入,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000") | ||
| 14 | + private Integer totalIncome; | ||
| 15 | + | ||
| 16 | +} |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/app/wallet/vo/wallet/AppPayWalletRespVO.java
| @@ -7,13 +7,13 @@ import lombok.Data; | @@ -7,13 +7,13 @@ import lombok.Data; | ||
| 7 | @Data | 7 | @Data |
| 8 | public class AppPayWalletRespVO { | 8 | public class AppPayWalletRespVO { |
| 9 | 9 | ||
| 10 | - @Schema(description = "钱包余额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | 10 | + @Schema(description = "钱包余额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") |
| 11 | private Integer balance; | 11 | private Integer balance; |
| 12 | 12 | ||
| 13 | - @Schema(description = "累计支出, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") | 13 | + @Schema(description = "累计支出,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") |
| 14 | private Integer totalExpense; | 14 | private Integer totalExpense; |
| 15 | 15 | ||
| 16 | - @Schema(description = "累计充值, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000") | 16 | + @Schema(description = "累计充值,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000") |
| 17 | private Integer totalRecharge; | 17 | private Integer totalRecharge; |
| 18 | 18 | ||
| 19 | } | 19 | } |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletRechargeConvert.java
| 1 | package cn.iocoder.yudao.module.pay.convert.wallet; | 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 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateRespVO; | 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 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; | 12 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; |
| 13 | +import cn.iocoder.yudao.module.pay.enums.DictTypeConstants; | ||
| 5 | import org.mapstruct.Mapper; | 14 | import org.mapstruct.Mapper; |
| 6 | import org.mapstruct.Mapping; | 15 | import org.mapstruct.Mapping; |
| 7 | import org.mapstruct.factory.Mappers; | 16 | import org.mapstruct.factory.Mappers; |
| 8 | 17 | ||
| 18 | +import java.util.List; | ||
| 19 | +import java.util.Map; | ||
| 20 | + | ||
| 9 | @Mapper | 21 | @Mapper |
| 10 | public interface PayWalletRechargeConvert { | 22 | public interface PayWalletRechargeConvert { |
| 11 | 23 | ||
| @@ -16,4 +28,17 @@ public interface PayWalletRechargeConvert { | @@ -16,4 +28,17 @@ public interface PayWalletRechargeConvert { | ||
| 16 | 28 | ||
| 17 | AppPayWalletRechargeCreateRespVO convert(PayWalletRechargeDO bean); | 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,9 +12,9 @@ import org.mapstruct.Mapper; | ||
| 12 | import org.mapstruct.factory.Mappers; | 12 | import org.mapstruct.factory.Mappers; |
| 13 | 13 | ||
| 14 | @Mapper | 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 | PayWalletRechargePackageDO convert(WalletRechargePackageCreateReqVO bean); | 19 | PayWalletRechargePackageDO convert(WalletRechargePackageCreateReqVO bean); |
| 20 | 20 |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/wallet/PayWalletTransactionConvert.java
| @@ -13,8 +13,6 @@ public interface PayWalletTransactionConvert { | @@ -13,8 +13,6 @@ public interface PayWalletTransactionConvert { | ||
| 13 | 13 | ||
| 14 | PayWalletTransactionConvert INSTANCE = Mappers.getMapper(PayWalletTransactionConvert.class); | 14 | PayWalletTransactionConvert INSTANCE = Mappers.getMapper(PayWalletTransactionConvert.class); |
| 15 | 15 | ||
| 16 | - PageResult<AppPayWalletTransactionRespVO> convertPage(PageResult<PayWalletTransactionDO> page); | ||
| 17 | - | ||
| 18 | PageResult<PayWalletTransactionRespVO> convertPage2(PageResult<PayWalletTransactionDO> page); | 16 | PageResult<PayWalletTransactionRespVO> convertPage2(PageResult<PayWalletTransactionDO> page); |
| 19 | 17 | ||
| 20 | PayWalletTransactionDO convert(WalletTransactionCreateReqBO bean); | 18 | PayWalletTransactionDO convert(WalletTransactionCreateReqBO bean); |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/mysql/wallet/PayWalletRechargeMapper.java
| 1 | package cn.iocoder.yudao.module.pay.dal.mysql.wallet; | 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 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 4 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 5 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; | 7 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; |
| 8 | +import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; | ||
| 6 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 7 | 10 | ||
| 8 | @Mapper | 11 | @Mapper |
| @@ -18,4 +21,10 @@ public interface PayWalletRechargeMapper extends BaseMapperX<PayWalletRechargeDO | @@ -18,4 +21,10 @@ public interface PayWalletRechargeMapper extends BaseMapperX<PayWalletRechargeDO | ||
| 18 | .eq(PayWalletRechargeDO::getId, id).eq(PayWalletRechargeDO::getRefundStatus, whereRefundStatus)); | 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 | \ No newline at end of file | 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,6 +8,8 @@ import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.Wa | ||
| 8 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; | 8 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; |
| 9 | import org.apache.ibatis.annotations.Mapper; | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 11 | @Mapper | 13 | @Mapper |
| 12 | public interface PayWalletRechargePackageMapper extends BaseMapperX<PayWalletRechargePackageDO> { | 14 | public interface PayWalletRechargePackageMapper extends BaseMapperX<PayWalletRechargePackageDO> { |
| 13 | 15 | ||
| @@ -19,9 +21,12 @@ public interface PayWalletRechargePackageMapper extends BaseMapperX<PayWalletRec | @@ -19,9 +21,12 @@ public interface PayWalletRechargePackageMapper extends BaseMapperX<PayWalletRec | ||
| 19 | .orderByDesc(PayWalletRechargePackageDO::getPayPrice)); | 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 | return selectOne(PayWalletRechargePackageDO::getName, name); | 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/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.hutool.core.collection.CollUtil; | ||
| 5 | +import cn.hutool.core.map.MapUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | 8 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 7 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | 9 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 10 | +import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | ||
| 8 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; | 11 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; |
| 9 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; | 12 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; |
| 13 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
| 10 | import org.apache.ibatis.annotations.Mapper; | 14 | import org.apache.ibatis.annotations.Mapper; |
| 11 | 15 | ||
| 16 | +import java.time.LocalDateTime; | ||
| 17 | +import java.util.List; | ||
| 18 | +import java.util.Map; | ||
| 12 | import java.util.Objects; | 19 | import java.util.Objects; |
| 20 | +import java.util.function.Consumer; | ||
| 21 | + | ||
| 22 | +import static cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO.*; | ||
| 13 | 23 | ||
| 14 | @Mapper | 24 | @Mapper |
| 15 | public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> { | 25 | public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> { |
| 16 | 26 | ||
| 17 | default PageResult<PayWalletTransactionDO> selectPage(Long walletId, Integer type, | 27 | default PageResult<PayWalletTransactionDO> selectPage(Long walletId, Integer type, |
| 18 | - PageParam pageParam) { | 28 | + PageParam pageParam, LocalDateTime[] createTime) { |
| 19 | LambdaQueryWrapperX<PayWalletTransactionDO> query = new LambdaQueryWrapperX<PayWalletTransactionDO>() | 29 | LambdaQueryWrapperX<PayWalletTransactionDO> query = new LambdaQueryWrapperX<PayWalletTransactionDO>() |
| 20 | .eqIfPresent(PayWalletTransactionDO::getWalletId, walletId); | 30 | .eqIfPresent(PayWalletTransactionDO::getWalletId, walletId); |
| 21 | - if (Objects.equals(type, AppPayWalletTransactionPageReqVO.TYPE_INCOME)) { | 31 | + if (Objects.equals(type, TYPE_INCOME)) { |
| 22 | query.gt(PayWalletTransactionDO::getPrice, 0); | 32 | query.gt(PayWalletTransactionDO::getPrice, 0); |
| 23 | - } else if (Objects.equals(type, AppPayWalletTransactionPageReqVO.TYPE_EXPENSE)) { | 33 | + } else if (Objects.equals(type, TYPE_EXPENSE)) { |
| 24 | query.lt(PayWalletTransactionDO::getPrice, 0); | 34 | query.lt(PayWalletTransactionDO::getPrice, 0); |
| 25 | } | 35 | } |
| 36 | + query.betweenIfPresent(PayWalletTransactionDO::getCreateTime, createTime); | ||
| 26 | query.orderByDesc(PayWalletTransactionDO::getId); | 37 | query.orderByDesc(PayWalletTransactionDO::getId); |
| 27 | return selectPage(pageParam, query); | 38 | return selectPage(pageParam, query); |
| 28 | } | 39 | } |
| 29 | 40 | ||
| 41 | + default Integer selectPriceSum(Long walletId, Integer type, LocalDateTime[] createTime) { | ||
| 42 | + // SQL sum 查询 | ||
| 43 | + List<Map<String, Object>> result = selectMaps(new QueryWrapperX<PayWalletTransactionDO>() | ||
| 44 | + .select("SUM(price) AS priceSum") | ||
| 45 | + .gt(Objects.equals(type, TYPE_INCOME), "price", 0) // 收入 | ||
| 46 | + .lt(Objects.equals(type, TYPE_EXPENSE), "price", 0) // 支出 | ||
| 47 | + .eq("wallet_id", walletId) | ||
| 48 | + .between("create_time", createTime[0], createTime[1])); | ||
| 49 | + // 获得 sum 结果 | ||
| 50 | + Map<String, Object> first = CollUtil.getFirst(result); | ||
| 51 | + return MapUtil.getInt(first, "priceSum", 0); | ||
| 52 | + } | ||
| 53 | + | ||
| 30 | default PayWalletTransactionDO selectByNo(String no) { | 54 | default PayWalletTransactionDO selectByNo(String no) { |
| 31 | return selectOne(PayWalletTransactionDO::getNo, no); | 55 | return selectOne(PayWalletTransactionDO::getNo, no); |
| 32 | } | 56 | } |
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,6 +13,7 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; | ||
| 13 | import jakarta.validation.Valid; | 13 | import jakarta.validation.Valid; |
| 14 | import jakarta.validation.constraints.NotEmpty; | 14 | import jakarta.validation.constraints.NotEmpty; |
| 15 | import java.time.LocalDateTime; | 15 | import java.time.LocalDateTime; |
| 16 | +import java.util.Collection; | ||
| 16 | import java.util.List; | 17 | import java.util.List; |
| 17 | 18 | ||
| 18 | /** | 19 | /** |
| @@ -40,6 +41,14 @@ public interface PayOrderService { | @@ -40,6 +41,14 @@ public interface PayOrderService { | ||
| 40 | PayOrderDO getOrder(Long appId, String merchantOrderId); | 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 | * @param appId 应用编号 | 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,6 +39,8 @@ import org.springframework.validation.annotation.Validated; | ||
| 39 | 39 | ||
| 40 | import jakarta.annotation.Resource; | 40 | import jakarta.annotation.Resource; |
| 41 | import java.time.LocalDateTime; | 41 | import java.time.LocalDateTime; |
| 42 | +import java.util.Collection; | ||
| 43 | +import java.util.Collections; | ||
| 42 | import java.util.List; | 44 | import java.util.List; |
| 43 | import java.util.Objects; | 45 | import java.util.Objects; |
| 44 | 46 | ||
| @@ -84,6 +86,14 @@ public class PayOrderServiceImpl implements PayOrderService { | @@ -84,6 +86,14 @@ public class PayOrderServiceImpl implements PayOrderService { | ||
| 84 | } | 86 | } |
| 85 | 87 | ||
| 86 | @Override | 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 | public Long getOrderCountByAppId(Long appId) { | 97 | public Long getOrderCountByAppId(Long appId) { |
| 88 | return orderMapper.selectCountByAppId(appId); | 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,4 +60,12 @@ public interface PayWalletRechargePackageService { | ||
| 60 | */ | 60 | */ |
| 61 | PageResult<PayWalletRechargePackageDO> getWalletRechargePackagePage(WalletRechargePackagePageReqVO pageReqVO); | 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,13 +6,15 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageCreateReqVO; | 6 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageCreateReqVO; |
| 7 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackagePageReqVO; | 7 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackagePageReqVO; |
| 8 | import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageUpdateReqVO; | 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 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; | 10 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; |
| 11 | import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletRechargePackageMapper; | 11 | import cn.iocoder.yudao.module.pay.dal.mysql.wallet.PayWalletRechargePackageMapper; |
| 12 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 13 | 13 | ||
| 14 | import jakarta.annotation.Resource; | 14 | import jakarta.annotation.Resource; |
| 15 | 15 | ||
| 16 | +import java.util.List; | ||
| 17 | + | ||
| 16 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 18 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 17 | import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; | 19 | import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.*; |
| 18 | 20 | ||
| @@ -50,7 +52,7 @@ public class PayWalletRechargePackageServiceImpl implements PayWalletRechargePac | @@ -50,7 +52,7 @@ public class PayWalletRechargePackageServiceImpl implements PayWalletRechargePac | ||
| 50 | validateRechargePackageNameUnique(null, createReqVO.getName()); | 52 | validateRechargePackageNameUnique(null, createReqVO.getName()); |
| 51 | 53 | ||
| 52 | // 插入 | 54 | // 插入 |
| 53 | - PayWalletRechargePackageDO walletRechargePackage = WalletRechargePackageConvert.INSTANCE.convert(createReqVO); | 55 | + PayWalletRechargePackageDO walletRechargePackage = PayWalletRechargePackageConvert.INSTANCE.convert(createReqVO); |
| 54 | walletRechargePackageMapper.insert(walletRechargePackage); | 56 | walletRechargePackageMapper.insert(walletRechargePackage); |
| 55 | // 返回 | 57 | // 返回 |
| 56 | return walletRechargePackage.getId(); | 58 | return walletRechargePackage.getId(); |
| @@ -64,7 +66,7 @@ public class PayWalletRechargePackageServiceImpl implements PayWalletRechargePac | @@ -64,7 +66,7 @@ public class PayWalletRechargePackageServiceImpl implements PayWalletRechargePac | ||
| 64 | validateRechargePackageNameUnique(updateReqVO.getId(), updateReqVO.getName()); | 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 | walletRechargePackageMapper.updateById(updateObj); | 70 | walletRechargePackageMapper.updateById(updateObj); |
| 69 | } | 71 | } |
| 70 | 72 | ||
| @@ -103,4 +105,9 @@ public class PayWalletRechargePackageServiceImpl implements PayWalletRechargePac | @@ -103,4 +105,9 @@ public class PayWalletRechargePackageServiceImpl implements PayWalletRechargePac | ||
| 103 | return walletRechargePackageMapper.selectPage(pageReqVO); | 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 | 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.PageParam; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 3 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO; | 5 | import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO; |
| 4 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; | 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 | * 钱包充值 Service 接口 | 10 | * 钱包充值 Service 接口 |
| @@ -23,6 +26,18 @@ public interface PayWalletRechargeService { | @@ -23,6 +26,18 @@ public interface PayWalletRechargeService { | ||
| 23 | AppPayWalletRechargeCreateReqVO createReqVO); | 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 | * @param id 钱包充值记录 id | 43 | * @param id 钱包充值记录 id |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletRechargeServiceImpl.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.PageParam; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum; | 6 | import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum; |
| 5 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; | 7 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; |
| 6 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; | 8 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; |
| @@ -64,7 +66,6 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { | @@ -64,7 +66,6 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { | ||
| 64 | @Transactional(rollbackFor = Exception.class) | 66 | @Transactional(rollbackFor = Exception.class) |
| 65 | public PayWalletRechargeDO createWalletRecharge(Long userId, Integer userType, String userIp, | 67 | public PayWalletRechargeDO createWalletRecharge(Long userId, Integer userType, String userIp, |
| 66 | AppPayWalletRechargeCreateReqVO reqVO) { | 68 | AppPayWalletRechargeCreateReqVO reqVO) { |
| 67 | - | ||
| 68 | // 1.1 计算充值金额 | 69 | // 1.1 计算充值金额 |
| 69 | int payPrice; | 70 | int payPrice; |
| 70 | int bonusPrice = 0; | 71 | int bonusPrice = 0; |
| @@ -94,6 +95,13 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { | @@ -94,6 +95,13 @@ public class PayWalletRechargeServiceImpl implements PayWalletRechargeService { | ||
| 94 | } | 95 | } |
| 95 | 96 | ||
| 96 | @Override | 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 | @Transactional(rollbackFor = Exception.class) | 105 | @Transactional(rollbackFor = Exception.class) |
| 98 | public void updateWalletRechargerPaid(Long id, Long payOrderId) { | 106 | public void updateWalletRechargerPaid(Long id, Long payOrderId) { |
| 99 | // 1.1 获取钱包充值记录 | 107 | // 1.1 获取钱包充值记录 |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionService.java
| @@ -3,12 +3,15 @@ package cn.iocoder.yudao.module.pay.service.wallet; | @@ -3,12 +3,15 @@ package cn.iocoder.yudao.module.pay.service.wallet; | ||
| 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.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO; |
| 5 | 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; |
| 6 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionSummaryRespVO; | ||
| 6 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; | 7 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; |
| 7 | import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum; | 8 | import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum; |
| 8 | import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO; | 9 | import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO; |
| 9 | 10 | ||
| 10 | import jakarta.validation.Valid; | 11 | import jakarta.validation.Valid; |
| 11 | 12 | ||
| 13 | +import java.time.LocalDateTime; | ||
| 14 | + | ||
| 12 | /** | 15 | /** |
| 13 | * 钱包余额流水 Service 接口 | 16 | * 钱包余额流水 Service 接口 |
| 14 | * | 17 | * |
| @@ -57,4 +60,15 @@ public interface PayWalletTransactionService { | @@ -57,4 +60,15 @@ public interface PayWalletTransactionService { | ||
| 57 | */ | 60 | */ |
| 58 | PayWalletTransactionDO getWalletTransaction(String bizId, PayWalletBizTypeEnum type); | 61 | PayWalletTransactionDO getWalletTransaction(String bizId, PayWalletBizTypeEnum type); |
| 59 | 62 | ||
| 63 | + /** | ||
| 64 | + * 获得钱包流水统计 | ||
| 65 | + * | ||
| 66 | + * @param userId 用户编号 | ||
| 67 | + * @param userType 用户类型 | ||
| 68 | + * @param createTime 时间段 | ||
| 69 | + * @return 钱包流水统计 | ||
| 70 | + */ | ||
| 71 | + AppPayWalletTransactionSummaryRespVO getWalletTransactionSummary(Long userId, Integer userType, | ||
| 72 | + LocalDateTime[] createTime); | ||
| 73 | + | ||
| 60 | } | 74 | } |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletTransactionServiceImpl.java
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.pay.service.wallet; | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.pay.service.wallet; | ||
| 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.admin.wallet.vo.transaction.PayWalletTransactionPageReqVO; |
| 5 | 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; |
| 6 | +import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionSummaryRespVO; | ||
| 6 | import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert; | 7 | import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert; |
| 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.dal.dataobject.wallet.PayWalletTransactionDO; | 9 | import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; |
| @@ -16,6 +17,11 @@ import org.springframework.validation.annotation.Validated; | @@ -16,6 +17,11 @@ import org.springframework.validation.annotation.Validated; | ||
| 16 | 17 | ||
| 17 | import jakarta.annotation.Resource; | 18 | import jakarta.annotation.Resource; |
| 18 | 19 | ||
| 20 | +import java.time.LocalDateTime; | ||
| 21 | + | ||
| 22 | +import static cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO.TYPE_EXPENSE; | ||
| 23 | +import static cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO.TYPE_INCOME; | ||
| 24 | + | ||
| 19 | /** | 25 | /** |
| 20 | * 钱包流水 Service 实现类 | 26 | * 钱包流水 Service 实现类 |
| 21 | * | 27 | * |
| @@ -42,12 +48,12 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ | @@ -42,12 +48,12 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ | ||
| 42 | public PageResult<PayWalletTransactionDO> getWalletTransactionPage(Long userId, Integer userType, | 48 | public PageResult<PayWalletTransactionDO> getWalletTransactionPage(Long userId, Integer userType, |
| 43 | AppPayWalletTransactionPageReqVO pageVO) { | 49 | AppPayWalletTransactionPageReqVO pageVO) { |
| 44 | PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType); | 50 | PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType); |
| 45 | - return payWalletTransactionMapper.selectPage(wallet.getId(), pageVO.getType(), pageVO); | 51 | + return payWalletTransactionMapper.selectPage(wallet.getId(), pageVO.getType(), pageVO, pageVO.getCreateTime()); |
| 46 | } | 52 | } |
| 47 | 53 | ||
| 48 | @Override | 54 | @Override |
| 49 | public PageResult<PayWalletTransactionDO> getWalletTransactionPage(PayWalletTransactionPageReqVO pageVO) { | 55 | public PageResult<PayWalletTransactionDO> getWalletTransactionPage(PayWalletTransactionPageReqVO pageVO) { |
| 50 | - return payWalletTransactionMapper.selectPage(pageVO.getWalletId(), null, pageVO); | 56 | + return payWalletTransactionMapper.selectPage(pageVO.getWalletId(), null, pageVO, null); |
| 51 | } | 57 | } |
| 52 | 58 | ||
| 53 | @Override | 59 | @Override |
| @@ -68,4 +74,14 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ | @@ -68,4 +74,14 @@ public class PayWalletTransactionServiceImpl implements PayWalletTransactionServ | ||
| 68 | return payWalletTransactionMapper.selectByBiz(bizId, type.getType()); | 74 | return payWalletTransactionMapper.selectByBiz(bizId, type.getType()); |
| 69 | } | 75 | } |
| 70 | 76 | ||
| 77 | + @Override | ||
| 78 | + public AppPayWalletTransactionSummaryRespVO getWalletTransactionSummary(Long userId, Integer userType, LocalDateTime[] createTime) { | ||
| 79 | + PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType); | ||
| 80 | + AppPayWalletTransactionSummaryRespVO summary = new AppPayWalletTransactionSummaryRespVO() | ||
| 81 | + .setTotalExpense(1).setTotalIncome(100); | ||
| 82 | + return new AppPayWalletTransactionSummaryRespVO() | ||
| 83 | + .setTotalExpense(payWalletTransactionMapper.selectPriceSum(wallet.getId(), TYPE_EXPENSE, createTime)) | ||
| 84 | + .setTotalIncome(payWalletTransactionMapper.selectPriceSum(wallet.getId(), TYPE_INCOME, createTime)); | ||
| 85 | + } | ||
| 86 | + | ||
| 71 | } | 87 | } |
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/sms/SmsSceneEnum.java
| @@ -18,7 +18,7 @@ public enum SmsSceneEnum implements IntArrayValuable { | @@ -18,7 +18,7 @@ public enum SmsSceneEnum implements IntArrayValuable { | ||
| 18 | 18 | ||
| 19 | MEMBER_LOGIN(1, "user-sms-login", "会员用户 - 手机号登陆"), | 19 | MEMBER_LOGIN(1, "user-sms-login", "会员用户 - 手机号登陆"), |
| 20 | MEMBER_UPDATE_MOBILE(2, "user-update-mobile", "会员用户 - 修改手机"), | 20 | MEMBER_UPDATE_MOBILE(2, "user-update-mobile", "会员用户 - 修改手机"), |
| 21 | - MEMBER_UPDATE_PASSWORD(3, "user-update-mobile", "会员用户 - 修改密码"), | 21 | + MEMBER_UPDATE_PASSWORD(3, "user-update-password", "会员用户 - 修改密码"), |
| 22 | MEMBER_RESET_PASSWORD(4, "user-reset-password", "会员用户 - 忘记密码"), | 22 | MEMBER_RESET_PASSWORD(4, "user-reset-password", "会员用户 - 忘记密码"), |
| 23 | 23 | ||
| 24 | ADMIN_MEMBER_LOGIN(21, "admin-sms-login", "后台用户 - 手机号登录"); | 24 | ADMIN_MEMBER_LOGIN(21, "admin-sms-login", "后台用户 - 手机号登录"); |