feat:【MALL 商城】佣金提现,优化字段,以及支持更多 API 自动打款
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.pay.api.wallet;
|
||||
|
||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.PayWalletAddBalanceReqDTO;
|
||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.PayWalletRespDTO;
|
||||
|
||||
/**
|
||||
* 钱包 API 接口
|
||||
@@ -16,4 +17,13 @@ public interface PayWalletApi {
|
||||
*/
|
||||
void addWalletBalance(PayWalletAddBalanceReqDTO reqDTO);
|
||||
|
||||
/**
|
||||
* 获取钱包信息
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param userType 用户类型
|
||||
* @return 钱包信息
|
||||
*/
|
||||
PayWalletRespDTO getOrCreateWallet(Long userId, Integer userType);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.pay.api.wallet.dto;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 钱包 Response DTO
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@Data
|
||||
public class PayWalletRespDTO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户 id
|
||||
*
|
||||
* 关联 MemberUserDO 的 id 编号
|
||||
* 关联 AdminUserDO 的 id 编号
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户类型, 预留 多商户转帐可能需要用到
|
||||
*
|
||||
* 关联 {@link UserTypeEnum}
|
||||
*/
|
||||
private Integer userType;
|
||||
|
||||
/**
|
||||
* 余额,单位分
|
||||
*/
|
||||
private Integer balance;
|
||||
|
||||
/**
|
||||
* 冻结金额,单位分
|
||||
*/
|
||||
private Integer freezePrice;
|
||||
|
||||
/**
|
||||
* 累计支出,单位分
|
||||
*/
|
||||
private Integer totalExpense;
|
||||
/**
|
||||
* 累计充值,单位分
|
||||
*/
|
||||
private Integer totalRecharge;
|
||||
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package cn.iocoder.yudao.module.pay.api.wallet;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.PayWalletAddBalanceReqDTO;
|
||||
import cn.iocoder.yudao.module.pay.api.wallet.dto.PayWalletRespDTO;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
|
||||
import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
|
||||
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService;
|
||||
@@ -30,4 +32,10 @@ public class PayWalletApiImpl implements PayWalletApi {
|
||||
payWalletService.addWalletBalance(wallet.getId(), reqDTO.getBizId(), bizType, reqDTO.getPrice());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayWalletRespDTO getOrCreateWallet(Long userId, Integer userType) {
|
||||
PayWalletDO wallet = payWalletService.getOrCreateWallet(userId, userType);
|
||||
return BeanUtils.toBean(wallet, PayWalletRespDTO.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
### 请求 /pay/demo-withdraw/create 接口(支付宝) => 成功
|
||||
### 请求 /pay/demo-withdraw/create 接口(支付宝)
|
||||
POST {{baseUrl}}/pay/demo-withdraw/create
|
||||
Authorization: Bearer {{token}}
|
||||
Content-Type: application/json
|
||||
@@ -12,7 +12,7 @@ tenant-id: {{adminTenantId}}
|
||||
"userName": "oespxk7368"
|
||||
}
|
||||
|
||||
### 请求 /pay/demo-withdraw/create 接口(微信余额) => 成功
|
||||
### 请求 /pay/demo-withdraw/create 接口(微信余额)
|
||||
POST {{baseUrl}}/pay/demo-withdraw/create
|
||||
Authorization: Bearer {{token}}
|
||||
Content-Type: application/json
|
||||
@@ -26,7 +26,7 @@ tenant-id: {{adminTenantId}}
|
||||
"userName": "芋艿"
|
||||
}
|
||||
|
||||
### 请求 /pay/demo-withdraw/create 接口(钱包余额) => 成功
|
||||
### 请求 /pay/demo-withdraw/create 接口(钱包余额)
|
||||
POST {{baseUrl}}/pay/demo-withdraw/create
|
||||
Authorization: Bearer {{token}}
|
||||
Content-Type: application/json
|
||||
@@ -39,12 +39,12 @@ tenant-id: {{adminTenantId}}
|
||||
"userAccount": "1"
|
||||
}
|
||||
|
||||
### 请求 /pay/demo-withdraw/transfer 接口(发起转账) => 成功
|
||||
### 请求 /pay/demo-withdraw/transfer 接口(发起转账)
|
||||
POST {{baseUrl}}/pay/demo-withdraw/transfer?id=1
|
||||
Authorization: Bearer {{token}}
|
||||
tenant-id: {{adminTenantId}}
|
||||
|
||||
### 请求 /pay/demo-withdraw/page 接口(查询分页) => 成功
|
||||
### 请求 /pay/demo-withdraw/page 接口(查询分页)
|
||||
GET {{baseUrl}}/pay/demo-withdraw/page?pageNo=1&pageSize=10
|
||||
Authorization: Bearer {{token}}
|
||||
tenant-id: {{adminTenantId}}
|
||||
@@ -51,11 +51,11 @@ public class PayDemoWithdrawController {
|
||||
return success(BeanUtils.toBean(pageResult, PayDemoWithdrawRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/update-status")
|
||||
@PostMapping("/update-transferred")
|
||||
@Operation(summary = "更新示例提现单的转账状态") // 由 pay-module 转账服务,进行回调
|
||||
@PermitAll // 无需登录,安全由 PayDemoTransferService 内部校验实现
|
||||
public CommonResult<Boolean> updateDemoWithdrawStatus(@RequestBody PayTransferNotifyReqDTO notifyReqDTO) {
|
||||
demoWithdrawService.updateDemoWithdrawStatus(Long.valueOf(notifyReqDTO.getMerchantOrderId()),
|
||||
public CommonResult<Boolean> updateDemoWithdrawTransferred(@RequestBody PayTransferNotifyReqDTO notifyReqDTO) {
|
||||
demoWithdrawService.updateDemoWithdrawTransferred(Long.valueOf(notifyReqDTO.getMerchantOrderId()),
|
||||
notifyReqDTO.getPayTransferId());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class PayDemoTransferServiceImpl implements PayDemoWithdrawService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDemoWithdrawStatus(Long id, Long payTransferId) {
|
||||
public void updateDemoWithdrawTransferred(Long id, Long payTransferId) {
|
||||
// 1.1 校验转账单是否存在
|
||||
PayDemoWithdrawDO withdraw = demoTransferMapper.selectById(id);
|
||||
if (withdraw == null) {
|
||||
|
||||
@@ -43,6 +43,6 @@ public interface PayDemoWithdrawService {
|
||||
* @param id 编号
|
||||
* @param payTransferId 转账单编号
|
||||
*/
|
||||
void updateDemoWithdrawStatus(Long id, Long payTransferId);
|
||||
void updateDemoWithdrawTransferred(Long id, Long payTransferId);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user