【代码代码】PAY:移除对 member 的依赖

pull/126/MERGE
YunaiV 2024-07-21 11:52:07 +08:00
parent 2ba141a5c4
commit 468d4cc6f6
154 changed files with 1910 additions and 1424 deletions

View File

@ -33,6 +33,6 @@ public interface PayWalletStatisticsMapper extends BaseMapperX {
@Param("endTime") LocalDateTime endTime, @Param("endTime") LocalDateTime endTime,
@Param("payStatus") Boolean payStatus); @Param("payStatus") Boolean payStatus);
Integer selectRechargePriceSummary(@Param("payStatus") Integer payStatus); Integer selectRechargePriceSummary(@Param("payStatus") Boolean payStatus);
} }

View File

@ -1,15 +1,14 @@
package cn.iocoder.yudao.module.statistics.service.pay; package cn.iocoder.yudao.module.statistics.service.pay;
import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum;
import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
import cn.iocoder.yudao.module.statistics.dal.mysql.pay.PayWalletStatisticsMapper; import cn.iocoder.yudao.module.statistics.dal.mysql.pay.PayWalletStatisticsMapper;
import cn.iocoder.yudao.module.statistics.service.pay.bo.RechargeSummaryRespBO; import cn.iocoder.yudao.module.statistics.service.pay.bo.RechargeSummaryRespBO;
import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO; import cn.iocoder.yudao.module.statistics.service.trade.bo.WalletSummaryRespBO;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import jakarta.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/** /**
@ -46,7 +45,7 @@ public class PayWalletStatisticsServiceImpl implements PayWalletStatisticsServic
@Override @Override
public Integer getRechargePriceSummary() { public Integer getRechargePriceSummary() {
return payWalletStatisticsMapper.selectRechargePriceSummary(PayOrderStatusEnum.SUCCESS.getStatus()); return payWalletStatisticsMapper.selectRechargePriceSummary(Boolean.TRUE);
} }
} }

View File

@ -1,26 +1,32 @@
package cn.iocoder.yudao.module.pay.api.notify.dto; package cn.iocoder.yudao.module.pay.api.notify.dto;
import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import jakarta.validation.constraints.NotEmpty; /**
import jakarta.validation.constraints.NotNull; * Request DTO
*
@Schema(description = "RPC 服务 - 支付单的通知 Request DTO") * @author
*/
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class PayOrderNotifyReqDTO { public class PayOrderNotifyReqDTO {
@Schema(description = "商户订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "M101") /**
*
*/
@NotEmpty(message = "商户订单号不能为空") @NotEmpty(message = "商户订单号不能为空")
private String merchantOrderId; private String merchantOrderId;
@Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "P202") /**
*
*/
@NotNull(message = "支付订单编号不能为空") @NotNull(message = "支付订单编号不能为空")
private Long payOrderId; private Long payOrderId;

View File

@ -1,26 +1,32 @@
package cn.iocoder.yudao.module.pay.api.notify.dto; package cn.iocoder.yudao.module.pay.api.notify.dto;
import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import jakarta.validation.constraints.NotEmpty; /**
import jakarta.validation.constraints.NotNull; * 退 Request DTO
*
@Schema(description = "RPC 服务 - 退款单的通知 Request DTO") * @author
*/
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class PayRefundNotifyReqDTO { public class PayRefundNotifyReqDTO {
@Schema(description = "商户退款单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "MR101") /**
* 退
*/
@NotEmpty(message = "商户退款单编号不能为空") @NotEmpty(message = "商户退款单编号不能为空")
private String merchantOrderId; private String merchantOrderId;
@Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "R303") /**
* 退
*/
@NotNull(message = "支付退款编号不能为空") @NotNull(message = "支付退款编号不能为空")
private Long payRefundId; private Long payRefundId;

View File

@ -0,0 +1,26 @@
package cn.iocoder.yudao.module.pay.api.notify.dto;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
* Request DTO
*
* @author jason
*/
@Data
public class PayTransferNotifyReqDTO {
/**
*
*/
@NotEmpty(message = "商户转账单号不能为空")
private String merchantTransferId;
/**
*
*/
@NotNull(message = "转账订单编号不能为空")
private Long payTransferId;
}

View File

@ -1,52 +1,64 @@
package cn.iocoder.yudao.module.pay.api.order.dto; package cn.iocoder.yudao.module.pay.api.order.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import jakarta.validation.constraints.DecimalMin; import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Schema(description = "RPC 服务 - 支付单创建 Request DTO") /**
* Request DTO
*/
@Data @Data
public class PayOrderCreateReqDTO implements Serializable { public class PayOrderCreateReqDTO implements Serializable {
public static final int SUBJECT_MAX_LENGTH = 32; public static final int SUBJECT_MAX_LENGTH = 32;
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") /**
*
*/
@NotNull(message = "应用编号不能为空") @NotNull(message = "应用编号不能为空")
private Long appId; private Long appId;
/**
@Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1") * IP
*/
@NotEmpty(message = "用户 IP 不能为空") @NotEmpty(message = "用户 IP 不能为空")
private String userIp; private String userIp;
// ========== 商户相关字段 ========== // ========== 商户相关字段 ==========
@Schema(description = "商户订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "M101") // 例如说,内部系统 A 的订单号。需要保证每个 PayMerchantDO 唯一 /**
*
*/
@NotEmpty(message = "商户订单编号不能为空") @NotEmpty(message = "商户订单编号不能为空")
private String merchantOrderId; private String merchantOrderId;
/**
@Schema(description = "商品标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是标题") *
*/
@NotEmpty(message = "商品标题不能为空") @NotEmpty(message = "商品标题不能为空")
@Length(max = 32, message = "商品标题不能超过 32") @Length(max = SUBJECT_MAX_LENGTH, message = "商品标题不能超过 32")
private String subject; private String subject;
/**
@Schema(description = "商品描述", example = "我是描述") *
*/
@Length(max = 128, message = "商品描述信息长度不能超过128") @Length(max = 128, message = "商品描述信息长度不能超过128")
private String body; private String body;
// ========== 订单相关字段 ========== // ========== 订单相关字段 ==========
@Schema(description = "支付金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "80") /**
*
*/
@NotNull(message = "支付金额不能为空") @NotNull(message = "支付金额不能为空")
@DecimalMin(value = "0", inclusive = false, message = "支付金额必须大于零") @DecimalMin(value = "0", inclusive = false, message = "支付金额必须大于零")
private Integer price; private Integer price;
@Schema(description = "支付过期时间", requiredMode = Schema.RequiredMode.REQUIRED) /**
*
*/
@NotNull(message = "支付过期时间不能为空") @NotNull(message = "支付过期时间不能为空")
private LocalDateTime expireTime; private LocalDateTime expireTime;

View File

@ -1,29 +1,44 @@
package cn.iocoder.yudao.module.pay.api.order.dto; package cn.iocoder.yudao.module.pay.api.order.dto;
import io.swagger.v3.oas.annotations.media.Schema; import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
import lombok.Data; import lombok.Data;
@Schema(description = "RPC 服务 - 支付单信息 Response DTO") /**
* Response DTO
*
* @author
*/
@Data @Data
public class PayOrderRespDTO { public class PayOrderRespDTO {
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") /**
*
*/
private Long id; private Long id;
/**
@Schema(description = "渠道编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "wx_pub") // PayChannelEnum 枚举 *
*
* PayChannelEnum
*/
private String channelCode; private String channelCode;
// ========== 商户相关字段 ========== // ========== 商户相关字段 ==========
/**
@Schema(description = "商户订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "M101") // 例如说,内部系统 A 的订单号。需要保证每个 PayMerchantDO 唯一 *
* A PayMerchantDO
*/
private String merchantOrderId; private String merchantOrderId;
// ========== 订单相关字段 ========== // ========== 订单相关字段 ==========
/**
@Schema(description = "支付金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "101") *
*/
private Integer price; private Integer price;
/**
@Schema(description = "支付状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") // PayOrderStatusEnum 枚举 *
*
* {@link PayOrderStatusEnum}
*/
private Integer status; private Integer status;
// ========== 渠道相关字段 ========== // ========== 渠道相关字段 ==========

View File

@ -1,43 +1,55 @@
package cn.iocoder.yudao.module.pay.api.refund.dto; package cn.iocoder.yudao.module.pay.api.refund.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import jakarta.validation.constraints.Min; import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
@Schema(description = "RPC 服务 - 退款单创建 Request DTO") /**
* 退 Request DTO
*
* @author
*/
@Data @Data
public class PayRefundCreateReqDTO { public class PayRefundCreateReqDTO {
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") /**
*
*/
@NotNull(message = "应用编号不能为空") @NotNull(message = "应用编号不能为空")
private Long appId; private Long appId;
/**
@Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1") * IP
*/
@NotEmpty(message = "用户 IP 不能为空") @NotEmpty(message = "用户 IP 不能为空")
private String userIp; private String userIp;
// ========== 商户相关字段 ========== // ========== 商户相关字段 ==========
/**
@Schema(description = "商户订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "M101") // 例如说,内部系统 A 的订单号。需要保证每个 PayMerchantDO 唯一 *
*/
@NotEmpty(message = "商户订单编号不能为空") @NotEmpty(message = "商户订单编号不能为空")
private String merchantOrderId; private String merchantOrderId;
@Schema(description = "商户退款编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "MR101") /**
* 退
*/
@NotEmpty(message = "商户退款编号不能为空") @NotEmpty(message = "商户退款编号不能为空")
private String merchantRefundId; private String merchantRefundId;
@Schema(description = "退款描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是退款描述") /**
* 退
*/
@NotEmpty(message = "退款描述不能为空") @NotEmpty(message = "退款描述不能为空")
@Length(max = 128, message = "退款描述长度不能超过 128") @Length(max = 128, message = "退款描述长度不能超过 128")
private String reason; private String reason;
// ========== 订单相关字段 ========== // ========== 订单相关字段 ==========
@Schema(description = "退款金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "60") /**
* 退
*/
@NotNull(message = "退款金额不能为空") @NotNull(message = "退款金额不能为空")
@Min(value = 1, message = "退款金额必须大于零") @Min(value = 1, message = "退款金额必须大于零")
private Integer price; private Integer price;

View File

@ -1,31 +1,43 @@
package cn.iocoder.yudao.module.pay.api.refund.dto; package cn.iocoder.yudao.module.pay.api.refund.dto;
import io.swagger.v3.oas.annotations.media.Schema; import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Schema(description = "RPC 服务 - 退款单信息 Response DTO") /**
* 退 Response DTO
*
* @author
*/
@Data @Data
public class PayRefundRespDTO { public class PayRefundRespDTO {
@Schema(description = "退款单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") /**
* 退
*/
private Long id; private Long id;
// ========== 退款相关字段 ========== // ========== 退款相关字段 ==========
/**
@Schema(description = "退款状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") // PayRefundStatusEnum 枚举 * 退
*
* {@link PayRefundStatusEnum}
*/
private Integer status; private Integer status;
/**
@Schema(description = "退款金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "101") * 退
*/
private Integer refundPrice; private Integer refundPrice;
// ========== 商户相关字段 ========== // ========== 商户相关字段 ==========
/**
@Schema(description = "商户订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "M101") // 例如说,内部系统 A 的订单号。需要保证每个 PayMerchantDO 唯一 *
*/
private String merchantOrderId; private String merchantOrderId;
/**
@Schema(description = "退款成功时间", requiredMode = Schema.RequiredMode.REQUIRED) * 退
*/
private LocalDateTime successTime; private LocalDateTime successTime;
} }

View File

@ -2,42 +2,76 @@ package cn.iocoder.yudao.module.pay.api.transfer.dto;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum; import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.Min; import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.util.Map; import java.util.Map;
@Schema(description = "RPC 服务 - 转账单创建 Request DTO") /**
* Request DTO
*
* @author jason
*/
@Data @Data
public class PayTransferCreateReqDTO { public class PayTransferCreateReqDTO {
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") /**
*
*/
@NotNull(message = "应用编号不能为空") @NotNull(message = "应用编号不能为空")
private Long appId; private Long appId;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @NotEmpty(message = "转账渠道不能为空")
private String channelCode;
/**
*
*/
private Map<String, String> channelExtras;
@NotEmpty(message = "用户 IP 不能为空")
private String userIp;
/**
*
*/
@NotNull(message = "转账类型不能为空") @NotNull(message = "转账类型不能为空")
@InEnum(PayTransferTypeEnum.class) @InEnum(PayTransferTypeEnum.class)
private Integer type; private Integer type;
@Schema(description = "商户订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "M101") // 例如说,内部系统 A 的订单号。需要保证每个 PayMerchantDO 唯一
@NotEmpty(message = "商户订单编号不能为空")
private String merchantOrderId;
@Schema(description = "转账金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "80") /**
*
*/
@NotEmpty(message = "商户转账单编号能为空")
private String merchantTransferId;
/**
*
*/
@Min(value = 1, message = "转账金额必须大于零") @Min(value = 1, message = "转账金额必须大于零")
@NotNull(message = "转账金额不能为空") @NotNull(message = "转账金额不能为空")
private Integer price; private Integer price;
@Schema(description = "转账标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "我是标题") /**
*
*/
@NotEmpty(message = "转账标题不能为空") @NotEmpty(message = "转账标题不能为空")
private String title; private String subject;
@Schema(description = "收款方信息", requiredMode = Schema.RequiredMode.REQUIRED) /**
@NotEmpty(message = "收款方信息不能为空") *
private Map<String, String> payeeInfo; */
@NotBlank(message = "收款人姓名不能为空", groups = {PayTransferTypeEnum.Alipay.class})
private String userName;
@NotBlank(message = "支付宝登录号不能为空", groups = {PayTransferTypeEnum.Alipay.class})
private String alipayLogonId;
// ========== 微信转账相关字段 ==========
@NotBlank(message = "微信 openId 不能为空", groups = {PayTransferTypeEnum.WxPay.class})
private String openid;
} }

View File

@ -59,22 +59,18 @@ public interface ErrorCodeConstants {
ErrorCode WALLET_RECHARGE_REFUND_FAIL_REFUND_ORDER_ID_ERROR = new ErrorCode(1_007_008_008, "钱包退款更新失败,钱包退款单编号不匹配"); ErrorCode WALLET_RECHARGE_REFUND_FAIL_REFUND_ORDER_ID_ERROR = new ErrorCode(1_007_008_008, "钱包退款更新失败,钱包退款单编号不匹配");
ErrorCode WALLET_RECHARGE_REFUND_FAIL_REFUND_NOT_FOUND = new ErrorCode(1_007_008_009, "钱包退款更新失败,退款订单不存在"); ErrorCode WALLET_RECHARGE_REFUND_FAIL_REFUND_NOT_FOUND = new ErrorCode(1_007_008_009, "钱包退款更新失败,退款订单不存在");
ErrorCode WALLET_RECHARGE_REFUND_FAIL_REFUND_PRICE_NOT_MATCH = new ErrorCode(1_007_008_010, "钱包退款更新失败,退款单金额不匹配"); ErrorCode WALLET_RECHARGE_REFUND_FAIL_REFUND_PRICE_NOT_MATCH = new ErrorCode(1_007_008_010, "钱包退款更新失败,退款单金额不匹配");
ErrorCode WALLET_RECHARGE_PACKAGE_AND_PRICE_IS_EMPTY = new ErrorCode(1_007_008_011, "充值金额和充钱套餐不能同时为空"); ErrorCode WALLET_RECHARGE_PACKAGE_NOT_FOUND = new ErrorCode(1_007_008_011, "钱包充值套餐不存在");
ErrorCode WALLET_RECHARGE_PACKAGE_NOT_FOUND = new ErrorCode(1_007_008_012, "钱包充值套餐不存在"); ErrorCode WALLET_RECHARGE_PACKAGE_IS_DISABLE = new ErrorCode(1_007_008_012, "钱包充值套餐已禁用");
ErrorCode WALLET_RECHARGE_PACKAGE_IS_DISABLE = new ErrorCode(1_007_008_013, "钱包充值套餐已禁用"); ErrorCode WALLET_RECHARGE_PACKAGE_NAME_EXISTS = new ErrorCode(1_007_008_013, "钱包充值套餐名称已存在");
ErrorCode WALLET_RECHARGE_PACKAGE_NAME_EXISTS = new ErrorCode(1_007_008_014, "钱包充值套餐名称已存在");
// ========== 转账模块 1-007-009-000 ========== // ========== 转账模块 1-007-009-000 ==========
ErrorCode PAY_TRANSFER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1_007_009_000, "发起转账报错,错误码:{},错误提示:{}"); ErrorCode PAY_TRANSFER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1_007_009_000, "发起转账报错,错误码:{},错误提示:{}");
ErrorCode PAY_TRANSFER_ALIPAY_LOGIN_ID_IS_EMPTY = new ErrorCode(1_007_009_001, "支付宝登录 ID 不能为空"); ErrorCode PAY_TRANSFER_NOT_FOUND = new ErrorCode(1_007_009_001, "转账单不存在");
ErrorCode PAY_TRANSFER_ALIPAY_ACCOUNT_NAME_IS_EMPTY = new ErrorCode(1_007_009_002, "支付宝账号名称不能为空"); ErrorCode PAY_SAME_MERCHANT_TRANSFER_TYPE_NOT_MATCH = new ErrorCode(1_007_009_002, "两次相同转账请求的类型不匹配");
ErrorCode PAY_TRANSFER_NOT_FOUND = new ErrorCode(1_007_009_003, "转账交易单不存在"); ErrorCode PAY_SAME_MERCHANT_TRANSFER_PRICE_NOT_MATCH = new ErrorCode(1_007_009_003, "两次相同转账请求的金额不匹配");
ErrorCode PAY_TRANSFER_STATUS_IS_SUCCESS = new ErrorCode(1_007_009_004, "转账单已成功转账"); ErrorCode PAY_MERCHANT_TRANSFER_EXISTS = new ErrorCode(1_007_009_004, "该笔业务的转账已经发起,请查询转账订单相关状态");
ErrorCode PAY_TRANSFER_STATUS_IS_NOT_WAITING = new ErrorCode(1_007_009_005, "转账单不处于待转账"); ErrorCode PAY_TRANSFER_STATUS_IS_NOT_WAITING = new ErrorCode(1_007_009_005, "转账单不处于待转账");
ErrorCode PAY_TRANSFER_STATUS_IS_NOT_PENDING = new ErrorCode(1_007_009_006, "转账单不处于待转账或转账中"); ErrorCode PAY_TRANSFER_STATUS_IS_NOT_PENDING = new ErrorCode(1_007_009_006, "转账单不处于待转账或转账中");
ErrorCode PAY_TRANSFER_EXTENSION_NOT_FOUND = new ErrorCode(1_007_009_007, "转账交易拓展单不存在");
ErrorCode PAY_TRANSFER_TYPE_AND_CHANNEL_NOT_MATCH = new ErrorCode(1_007_009_008, "转账类型和转账渠道不匹配");
ErrorCode PAY_TRANSFER_EXTENSION_STATUS_IS_NOT_PENDING = new ErrorCode(1_007_009_009, "转账拓展单不处于待转账或转账中");
// ========== 示例订单 1-007-900-000 ========== // ========== 示例订单 1-007-900-000 ==========
ErrorCode DEMO_ORDER_NOT_FOUND = new ErrorCode(1_007_900_000, "示例订单不存在"); ErrorCode DEMO_ORDER_NOT_FOUND = new ErrorCode(1_007_900_000, "示例订单不存在");
@ -89,4 +85,8 @@ public interface ErrorCodeConstants {
ErrorCode DEMO_ORDER_REFUND_FAIL_REFUND_ORDER_ID_ERROR = new ErrorCode(1_007_900_009, "发起退款失败,退款单编号不匹配"); ErrorCode DEMO_ORDER_REFUND_FAIL_REFUND_ORDER_ID_ERROR = new ErrorCode(1_007_900_009, "发起退款失败,退款单编号不匹配");
ErrorCode DEMO_ORDER_REFUND_FAIL_REFUND_PRICE_NOT_MATCH = new ErrorCode(1_007_900_010, "发起退款失败,退款单金额不匹配"); ErrorCode DEMO_ORDER_REFUND_FAIL_REFUND_PRICE_NOT_MATCH = new ErrorCode(1_007_900_010, "发起退款失败,退款单金额不匹配");
// ========== 示例转账订单 1-007-901-001 ==========
ErrorCode DEMO_TRANSFER_NOT_FOUND = new ErrorCode(1_007_901_001, "示例转账单不存在");
ErrorCode DEMO_TRANSFER_FAIL_TRANSFER_ID_ERROR = new ErrorCode(1_007_901_002, "转账失败,转账单编号不匹配");
ErrorCode DEMO_TRANSFER_FAIL_PRICE_NOT_MATCH = new ErrorCode(1_007_901_003, "转账失败,转账单金额不匹配");
} }

View File

@ -14,6 +14,7 @@ public enum PayNotifyTypeEnum {
ORDER(1, "支付单"), ORDER(1, "支付单"),
REFUND(2, "退款单"), REFUND(2, "退款单"),
TRANSFER(3, "转账单")
; ;
/** /**

View File

@ -12,7 +12,7 @@ import java.util.Objects;
@AllArgsConstructor @AllArgsConstructor
public enum PayTransferStatusEnum { public enum PayTransferStatusEnum {
WAITING(0, "待转账"), WAITING(0, "待转账"),
/** /**
* TODO . T+0 T+1 * TODO . T+0 T+1
*/ */
@ -20,7 +20,7 @@ public enum PayTransferStatusEnum {
SUCCESS(20, "转账成功"), SUCCESS(20, "转账成功"),
/** /**
* () * () // TODO 改成 转账失败状态
*/ */
CLOSED(30, "转账关闭"); CLOSED(30, "转账关闭");
@ -40,16 +40,20 @@ public enum PayTransferStatusEnum {
public static boolean isClosed(Integer status) { public static boolean isClosed(Integer status) {
return Objects.equals(status, CLOSED.getStatus()); return Objects.equals(status, CLOSED.getStatus());
} }
public static boolean isWaiting(Integer status) { public static boolean isWaiting(Integer status) {
return Objects.equals(status, WAITING.getStatus()); return Objects.equals(status, WAITING.getStatus());
} }
public static boolean isInProgress(Integer status) {
return Objects.equals(status, IN_PROGRESS.getStatus());
}
/** /**
* *
* @param status * @param status
*/ */
public static boolean isPendingStatus(Integer status) { public static boolean isPendingStatus(Integer status) {
return Objects.equals(status, WAITING.getStatus()) || Objects.equals(status, IN_PROGRESS.status); return Objects.equals(status, WAITING.getStatus()) || Objects.equals(status, IN_PROGRESS.getStatus());
} }
} }

View File

@ -21,8 +21,11 @@ public enum PayTransferTypeEnum implements IntArrayValuable {
BANK_CARD(3, "银行卡"), BANK_CARD(3, "银行卡"),
WALLET_BALANCE(4, "钱包余额"); WALLET_BALANCE(4, "钱包余额");
public static final String ALIPAY_LOGON_ID = "ALIPAY_LOGON_ID"; public interface WxPay {
public static final String ALIPAY_ACCOUNT_NAME = "ALIPAY_ACCOUNT_NAME"; }
public interface Alipay {
}
private final Integer type; private final Integer type;
private final String name; private final String name;

View File

@ -30,11 +30,6 @@
<artifactId>yudao-module-pay-api</artifactId> <artifactId>yudao-module-pay-api</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-module-member-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 --> <!-- 业务组件 -->
<dependency> <dependency>

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.pay.controller.admin.app; package cn.iocoder.yudao.module.pay.controller.admin.app;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.*; import cn.iocoder.yudao.module.pay.controller.admin.app.vo.*;
@ -12,14 +13,14 @@ import cn.iocoder.yudao.module.pay.service.channel.PayChannelService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource; import java.util.List;
import jakarta.validation.Valid;
import java.util.*;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
@ -87,9 +88,10 @@ public class PayAppController {
return success(PageResult.empty()); return success(PageResult.empty());
} }
// 得到所有的应用编号,查出所有的渠道 // 得到所有的应用编号,查出所有的渠道,并移除未启用的渠道
Collection<Long> appIds = convertList(pageResult.getList(), PayAppDO::getId); List<PayChannelDO> channels = channelService.getChannelListByAppIds(
List<PayChannelDO> channels = channelService.getChannelListByAppIds(appIds); convertList(pageResult.getList(), PayAppDO::getId));
channels.removeIf(channel -> !CommonStatusEnum.ENABLE.getStatus().equals(channel.getStatus()));
// 拼接后返回 // 拼接后返回
return success(PayAppConvert.INSTANCE.convertPage(pageResult, channels)); return success(PayAppConvert.INSTANCE.convertPage(pageResult, channels));

View File

@ -1,12 +1,12 @@
package cn.iocoder.yudao.module.pay.controller.admin.app.vo; package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.URL; import org.hibernate.validator.constraints.URL;
import jakarta.validation.constraints.*;
/** /**
* Base VO VO 使 * Base VO VO 使
* VO Swagger * VO Swagger

View File

@ -1,6 +1,9 @@
package cn.iocoder.yudao.module.pay.controller.admin.app.vo; package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 支付应用信息创建 Request VO") @Schema(description = "管理后台 - 支付应用信息创建 Request VO")
@Data @Data

View File

@ -1,6 +1,9 @@
package cn.iocoder.yudao.module.pay.controller.admin.app.vo; package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.time.LocalDateTime; import java.time.LocalDateTime;

View File

@ -1,7 +1,10 @@
package cn.iocoder.yudao.module.pay.controller.admin.app.vo; package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.*; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 支付应用信息更新 Request VO") @Schema(description = "管理后台 - 支付应用信息更新 Request VO")
@Data @Data

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.pay.controller.admin.app.vo; package cn.iocoder.yudao.module.pay.controller.admin.app.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(description = "管理后台 - 应用更新状态 Request VO") @Schema(description = "管理后台 - 应用更新状态 Request VO")
@Data @Data

View File

@ -10,12 +10,12 @@ import cn.iocoder.yudao.module.pay.service.channel.PayChannelService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;

View File

@ -1,9 +1,10 @@
package cn.iocoder.yudao.module.pay.controller.admin.channel.vo; package cn.iocoder.yudao.module.pay.controller.admin.channel.vo;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.*; import lombok.Data;
/** /**
* Base VO VO 使 * Base VO VO 使

View File

@ -1,13 +1,12 @@
package cn.iocoder.yudao.module.pay.controller.admin.channel.vo; package cn.iocoder.yudao.module.pay.controller.admin.channel.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 支付渠道 创建 Request VO") @Schema(description = "管理后台 - 支付渠道 创建 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -1,6 +1,9 @@
package cn.iocoder.yudao.module.pay.controller.admin.channel.vo; package cn.iocoder.yudao.module.pay.controller.admin.channel.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.time.LocalDateTime; import java.time.LocalDateTime;

View File

@ -1,7 +1,11 @@
package cn.iocoder.yudao.module.pay.controller.admin.channel.vo; package cn.iocoder.yudao.module.pay.controller.admin.channel.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 支付渠道 更新 Request VO") @Schema(description = "管理后台 - 支付渠道 更新 Request VO")
@Data @Data

View File

@ -5,20 +5,19 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO; import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO;
import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO; import cn.iocoder.yudao.module.pay.api.notify.dto.PayRefundNotifyReqDTO;
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderCreateReqVO; import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order.PayDemoOrderCreateReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderRespVO; import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order.PayDemoOrderRespVO;
import cn.iocoder.yudao.module.pay.convert.demo.PayDemoOrderConvert; import cn.iocoder.yudao.module.pay.convert.demo.PayDemoOrderConvert;
import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO; import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO;
import cn.iocoder.yudao.module.pay.service.demo.PayDemoOrderService; import cn.iocoder.yudao.module.pay.service.demo.PayDemoOrderService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll; import jakarta.annotation.security.PermitAll;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP; import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;

View File

@ -1,21 +1,23 @@
package cn.iocoder.yudao.module.pay.controller.admin.demo; package cn.iocoder.yudao.module.pay.controller.admin.demo;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.api.notify.dto.PayTransferNotifyReqDTO;
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferCreateReqVO; import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferCreateReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferRespVO;
import cn.iocoder.yudao.module.pay.convert.demo.PayDemoTransferConvert;
import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoTransferDO;
import cn.iocoder.yudao.module.pay.service.demo.PayDemoTransferService; import cn.iocoder.yudao.module.pay.service.demo.PayDemoTransferService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Tag(name = "管理后台 - 示例转账单") @Tag(name = "管理后台 - 示例转账单")
@RestController @RestController
@ -27,7 +29,23 @@ public class PayDemoTransferController {
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建示例转账订单") @Operation(summary = "创建示例转账订单")
public CommonResult<Long> createDemoOrder(@Valid @RequestBody PayDemoTransferCreateReqVO createReqVO) { public CommonResult<Long> createDemoTransfer(@Valid @RequestBody PayDemoTransferCreateReqVO createReqVO) {
return success(demoTransferService.createDemoTransfer(getLoginUserId(), createReqVO)); return success(demoTransferService.createDemoTransfer(createReqVO));
}
@GetMapping("/page")
@Operation(summary = "获得示例转账订单分页")
public CommonResult<PageResult<PayDemoTransferRespVO>> getDemoTransferPage(@Valid PageParam pageVO) {
PageResult<PayDemoTransferDO> pageResult = demoTransferService.getDemoTransferPage(pageVO);
return success(PayDemoTransferConvert.INSTANCE.convertPage(pageResult));
}
@PostMapping("/update-status")
@Operation(summary = "更新示例转账订单的转账状态") // 由 pay-module 转账服务,进行回调
@PermitAll // 无需登录,安全由 PayDemoTransferService 内部校验实现
public CommonResult<Boolean> updateDemoTransferStatus(@RequestBody PayTransferNotifyReqDTO notifyReqDTO) {
demoTransferService.updateDemoTransferStatus(Long.valueOf(notifyReqDTO.getMerchantTransferId()),
notifyReqDTO.getPayTransferId());
return success(true);
} }
} }

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.pay.controller.admin.demo.vo; package cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(description = "管理后台 - 示例订单创建 Request VO") @Schema(description = "管理后台 - 示例订单创建 Request VO")
@Data @Data

View File

@ -1,7 +1,7 @@
package cn.iocoder.yudao.module.pay.controller.admin.demo.vo; package cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;

View File

@ -1,14 +1,17 @@
package cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer; package cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer;
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum; import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Validator;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import jakarta.validation.constraints.Min; import static cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum.Alipay;
import jakarta.validation.constraints.NotEmpty; import static cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum.WxPay;
import jakarta.validation.constraints.NotNull;
import java.util.Map;
/** /**
* @author jason * @author jason
@ -22,13 +25,43 @@ public class PayDemoTransferCreateReqVO {
@InEnum(PayTransferTypeEnum.class) @InEnum(PayTransferTypeEnum.class)
private Integer type; private Integer type;
@Schema(description = "转账金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
@NotNull(message = "转账金额不能为空") @NotNull(message = "转账金额不能为空")
@Min(value = 1, message = "转账金额必须大于零") @Min(value = 1, message = "转账金额必须大于零")
private Integer price; private Integer price;
// TODO @jason感觉这个动态字段晚点改可能要讨论下怎么搞好 @Schema(description = "收款人姓名", example = "test1")
@Schema(description = "收款方信息", requiredMode = Schema.RequiredMode.REQUIRED, example = "{'ALIPAY_LOGON_ID':'xxxx'}") @NotBlank(message = "收款人姓名不能为空", groups = {Alipay.class})
@NotEmpty(message = "收款方信息不能为空") private String userName;
private Map<String, String> payeeInfo;
// ========== 支付宝转账相关字段 ==========
@Schema(description = "支付宝登录号,支持邮箱和手机号格式", example = "test1@@sandbox.com")
@NotBlank(message = "支付宝登录号不能为空", groups = {Alipay.class})
private String alipayLogonId;
// ========== 微信转账相关字段 ==========
@Schema(description = "微信 openId", example = "oLefc4g5Gxx")
@NotBlank(message = "微信 openId 不能为空", groups = {WxPay.class})
private String openid;
// ========== 转账到银行卡和钱包相关字段 待补充 ==========
public void validate(Validator validator) {
PayTransferTypeEnum transferType = PayTransferTypeEnum.typeOf(type);
switch (transferType) {
case ALIPAY_BALANCE: {
ValidationUtils.validate(validator, this, Alipay.class);
break;
}
case WX_BALANCE: {
ValidationUtils.validate(validator, this, WxPay.class);
break;
}
default: {
throw new UnsupportedOperationException("待实现");
}
}
}
} }

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* Base VO VO 使
* VO Swagger
*/
@Data
public class PayDemoTransferRespVO {
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long appId;
@Schema(description = "转账金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "22338")
private Integer price;
@Schema(description = "转账类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer type;
@Schema(description = "收款人姓名", example = "test")
private String userName;
@Schema(description = "支付宝登录号", example = "32167")
private String alipayLogonId;
@Schema(description = "微信 openId", example = "31139")
private String openid;
@Schema(description = "转账状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer transferStatus;
@Schema(description = "转账订单编号", example = "23695")
private Long payTransferId;
@Schema(description = "转账支付成功渠道")
private String payChannelCode;
@Schema(description = "转账支付时间")
private LocalDateTime transferTime;
}

View File

@ -21,14 +21,14 @@ import cn.iocoder.yudao.module.pay.service.refund.PayRefundService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll;
import jakarta.validation.Valid;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@ -1,7 +1,10 @@
package cn.iocoder.yudao.module.pay.controller.admin.notify.vo; package cn.iocoder.yudao.module.pay.controller.admin.notify.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Schema(description = "管理后台 - 回调通知 Response VO") @Schema(description = "管理后台 - 回调通知 Response VO")

View File

@ -1,9 +1,10 @@
package cn.iocoder.yudao.module.pay.controller.admin.order.vo; package cn.iocoder.yudao.module.pay.controller.admin.order.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

View File

@ -1,11 +1,11 @@
package cn.iocoder.yudao.module.pay.controller.admin.order.vo; package cn.iocoder.yudao.module.pay.controller.admin.order.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.URL; import org.hibernate.validator.constraints.URL;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import java.util.Map; import java.util.Map;
@Schema(description = "管理后台 - 支付订单提交 Request VO") @Schema(description = "管理后台 - 支付订单提交 Request VO")

View File

@ -1,19 +1,18 @@
package cn.iocoder.yudao.module.pay.controller.admin.transfer; package cn.iocoder.yudao.module.pay.controller.admin.transfer;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferSubmitReqVO; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferSubmitRespVO; import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.*;
import cn.iocoder.yudao.module.pay.convert.transfer.PayTransferConvert;
import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferDO;
import cn.iocoder.yudao.module.pay.service.transfer.PayTransferService; import cn.iocoder.yudao.module.pay.service.transfer.PayTransferService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP; import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
@ -27,12 +26,26 @@ public class PayTransferController {
@Resource @Resource
private PayTransferService payTransferService; private PayTransferService payTransferService;
@PostMapping("/submit") @PostMapping("/create")
@Operation(summary = "提交转账订单") @Operation(summary = "创建转账单,发起转账")
// TODO @jason权限的设置 管理后台页面加的时候加一下 @PreAuthorize("@ss.hasPermission('pay:transfer:create')")
public CommonResult<PayTransferSubmitRespVO> submitPayTransfer(@Valid @RequestBody PayTransferSubmitReqVO reqVO) { public CommonResult<PayTransferCreateRespVO> createPayTransfer(@Valid @RequestBody PayTransferCreateReqVO reqVO) {
PayTransferSubmitRespVO respVO = payTransferService.submitTransfer(reqVO, getClientIP()); PayTransferDO payTransfer = payTransferService.createTransfer(reqVO, getClientIP());
return success(respVO); return success(new PayTransferCreateRespVO().setId(payTransfer.getId()).setStatus(payTransfer.getStatus()));
} }
@GetMapping("/get")
@Operation(summary = "获得转账订单")
@PreAuthorize("@ss.hasPermission('pay:transfer:query')")
public CommonResult<PayTransferRespVO> getTransfer(@RequestParam("id") Long id) {
return success(PayTransferConvert.INSTANCE.convert(payTransferService.getTransfer(id)));
}
@GetMapping("/page")
@Operation(summary = "获得转账订单分页")
@PreAuthorize("@ss.hasPermission('pay:transfer:query')")
public CommonResult<PageResult<PayTransferPageItemRespVO>> getTransferPage(@Valid PayTransferPageReqVO pageVO) {
PageResult<PayTransferDO> pageResult = payTransferService.getTransferPage(pageVO);
return success(PayTransferConvert.INSTANCE.convertPage(pageResult));
}
} }

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo;
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Validator;
import jakarta.validation.constraints.*;
import lombok.Data;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.NOT_IMPLEMENTED;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum.*;
@Schema(description = "管理后台 - 发起转账 Request VO")
@Data
public class PayTransferCreateReqVO {
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "应用编号不能为空")
private Long appId;
@Schema(description = "商户转账单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "商户转账单编号不能为空")
private String merchantTransferId;
@Schema(description = "转账类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "转账类型不能为空")
@InEnum(PayTransferTypeEnum.class)
private Integer type;
@Schema(description = "转账渠道", requiredMode = Schema.RequiredMode.REQUIRED, example = "alipay_pc")
@NotEmpty(message = "转账渠道不能为空")
private String channelCode;
@Min(value = 1, message = "转账金额必须大于零")
@NotNull(message = "转账金额不能为空")
private Integer price;
@Schema(description = "转账标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "示例转账")
@NotEmpty(message = "转账标题不能为空")
private String subject;
@Schema(description = "收款人姓名", example = "test1")
@NotBlank(message = "收款人姓名不能为空", groups = {Alipay.class})
private String userName;
@Schema(description = "支付宝登录号", example = "test1@sandbox.com")
@NotBlank(message = "支付宝登录号不能为空", groups = {Alipay.class})
private String alipayLogonId;
@Schema(description = "微信 openId", example = "oLefc4g5Gxx")
@NotBlank(message = "微信 openId 不能为空", groups = {WxPay.class})
private String openid;
@Schema(description = "转账渠道的额外参数")
private Map<String, String> channelExtras;
public void validate(Validator validator) {
PayTransferTypeEnum transferType = typeOf(type);
switch (transferType) {
case ALIPAY_BALANCE: {
ValidationUtils.validate(validator, this, Alipay.class);
break;
}
case WX_BALANCE: {
ValidationUtils.validate(validator, this, WxPay.class);
break;
}
default: {
throw new UnsupportedOperationException("待实现");
}
}
}
@AssertTrue(message = "转账类型和转账渠道不匹配")
public boolean isValidChannelCode() {
PayTransferTypeEnum transferType = typeOf(type);
switch (transferType) {
case ALIPAY_BALANCE: {
return PayChannelEnum.isAlipay(channelCode);
}
case WX_BALANCE:
case BANK_CARD:
case WALLET_BALANCE: {
throw exception(NOT_IMPLEMENTED);
}
}
return Boolean.FALSE;
}
}

View File

@ -3,9 +3,12 @@ package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
@Schema(description = "管理后台 - 转账单提交 Response VO") @Schema(description = "管理后台 - 发起转账 Response VO")
@Data @Data
public class PayTransferSubmitRespVO { public class PayTransferCreateRespVO {
@Schema(description = "转账单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long id;
@Schema(description = "转账状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") // 参见 PayTransferStatusEnum 枚举 @Schema(description = "转账状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") // 参见 PayTransferStatusEnum 枚举
private Integer status; private Integer status;

View File

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author jason
*/
@Schema(description = "管理后台 - 转账单分页项 Response VO")
@Data
public class PayTransferPageItemRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2931")
private Long id;
@Schema(description = "转账单号", requiredMode = Schema.RequiredMode.REQUIRED)
private String no;
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12831")
private Long appId;
@Schema(description = "转账渠道编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24833")
private Long channelId;
@Schema(description = "转账渠道编码", requiredMode = Schema.RequiredMode.REQUIRED)
private String channelCode;
@Schema(description = "商户转账单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17481")
private String merchantTransferId;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer type;
@Schema(description = "转账状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer status;
@Schema(description = "转账成功时间")
private LocalDateTime successTime;
@Schema(description = "转账金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "964")
private Integer price;
@Schema(description = "转账标题", requiredMode = Schema.RequiredMode.REQUIRED)
private String subject;
@Schema(description = "收款人姓名", example = "王五")
private String userName;
@Schema(description = "支付宝登录号", example = "29245")
private String alipayLogonId;
@Schema(description = "微信 openId", example = "26589")
private String openid;
@Schema(description = "渠道转账单号")
private String channelTransferNo;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
}

View File

@ -0,0 +1,48 @@
package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 转账单分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PayTransferPageReqVO extends PageParam {
@Schema(description = "转账单号")
private String no;
@Schema(description = "应用编号", example = "12831")
private Long appId;
@Schema(description = "渠道编码", example = "wx_app")
private String channelCode;
@Schema(description = "商户转账单编号", example = "17481")
private String merchantTransferId;
@Schema(description = "类型", example = "2")
private Integer type;
@Schema(description = "转账状态", example = "2")
private Integer status;
@Schema(description = "收款人姓名", example = "王五")
private String userName;
@Schema(description = "渠道转账单号")
private String channelTransferNo;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,79 @@
package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Map;
@Schema(description = "管理后台 - 转账单 Response VO")
@Data
public class PayTransferRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2931")
private Long id;
@Schema(description = "转账单号", requiredMode = Schema.RequiredMode.REQUIRED)
private String no;
@Schema(description = "应用编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "12831")
private Long appId;
@Schema(description = "转账渠道编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "24833")
private Long channelId;
@Schema(description = "转账渠道编码", requiredMode = Schema.RequiredMode.REQUIRED)
private String channelCode;
@Schema(description = "商户转账单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17481")
private String merchantTransferId;
@Schema(description = "类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer type;
@Schema(description = "转账状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
private Integer status;
@Schema(description = "转账成功时间")
private LocalDateTime successTime;
@Schema(description = "转账金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "964")
private Integer price;
@Schema(description = "转账标题", requiredMode = Schema.RequiredMode.REQUIRED)
private String subject;
@Schema(description = "收款人姓名", example = "王五")
private String userName;
@Schema(description = "支付宝登录号", example = "29245")
private String alipayLogonId;
@Schema(description = "微信 openId", example = "26589")
private String openid;
@Schema(description = "异步通知商户地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
private String notifyUrl;
@Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED)
private String userIp;
@Schema(description = "渠道的额外参数")
private Map<String, String> channelExtras;
@Schema(description = "渠道转账单号")
private String channelTransferNo;
@Schema(description = "调用渠道的错误码")
private String channelErrorCode;
@Schema(description = "调用渠道的错误提示")
private String channelErrorMsg;
@Schema(description = "渠道的同步/异步通知的内容")
private String channelNotifyData;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
}

View File

@ -1,25 +0,0 @@
package cn.iocoder.yudao.module.pay.controller.admin.transfer.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import java.util.Map;
@Schema(description = "管理后台 - 转账单提交 Request VO")
@Data
public class PayTransferSubmitReqVO {
@Schema(description = "转账单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "转账单编号不能为空")
private Long id;
@Schema(description = "转账渠道", requiredMode = Schema.RequiredMode.REQUIRED, example = "alipay_transfer")
@NotEmpty(message = "转账渠道不能为空")
private String channelCode;
@Schema(description = "转账渠道的额外参数")
private Map<String, String> channelExtras;
}

View File

@ -1,11 +1,7 @@
package cn.iocoder.yudao.module.pay.controller.admin.wallet; package cn.iocoder.yudao.module.pay.controller.admin.wallet;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletUserReqVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletUserReqVO;
@ -14,6 +10,8 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -21,14 +19,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.enums.UserTypeEnum.MEMBER; import static cn.iocoder.yudao.framework.common.enums.UserTypeEnum.MEMBER;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
@Tag(name = "管理后台 - 用户钱包") @Tag(name = "管理后台 - 用户钱包")
@RestController @RestController
@ -39,38 +31,21 @@ public class PayWalletController {
@Resource @Resource
private PayWalletService payWalletService; private PayWalletService payWalletService;
@Resource
private MemberUserApi memberUserApi;
@GetMapping("/get") @GetMapping("/get")
@PreAuthorize("@ss.hasPermission('pay:wallet:query')") @PreAuthorize("@ss.hasPermission('pay:wallet:query')")
@Operation(summary = "获得用户钱包明细") @Operation(summary = "获得用户钱包明细")
public CommonResult<PayWalletRespVO> getWallet(PayWalletUserReqVO reqVO) { public CommonResult<PayWalletRespVO> getWallet(PayWalletUserReqVO reqVO) {
PayWalletDO wallet = payWalletService.getOrCreateWallet(reqVO.getUserId(), MEMBER.getValue()); PayWalletDO wallet = payWalletService.getOrCreateWallet(reqVO.getUserId(), MEMBER.getValue());
// TODO jason如果为空返回给前端只要 null 就可以了 return success(PayWalletConvert.INSTANCE.convert02(wallet));
MemberUserRespDTO memberUser = memberUserApi.getUser(reqVO.getUserId()).getCheckedData();
String nickname = memberUser == null ? "" : memberUser.getNickname();
String avatar = memberUser == null ? "" : memberUser.getAvatar();
return success(PayWalletConvert.INSTANCE.convert02(nickname, avatar, wallet));
} }
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得会员钱包分页") @Operation(summary = "获得会员钱包分页")
@PreAuthorize("@ss.hasPermission('pay:wallet:query')") @PreAuthorize("@ss.hasPermission('pay:wallet:query')")
public CommonResult<PageResult<PayWalletRespVO>> getWalletPage(@Valid PayWalletPageReqVO pageVO) { public CommonResult<PageResult<PayWalletRespVO>> getWalletPage(@Valid PayWalletPageReqVO pageVO) {
if (StrUtil.isNotEmpty(pageVO.getNickname())) { PageResult<PayWalletDO> pageResult = payWalletService.getWalletPage(pageVO);
List<MemberUserRespDTO> users = memberUserApi.getUserListByNickname(pageVO.getNickname()).getCheckedData(); return success(PayWalletConvert.INSTANCE.convertPage(pageResult));
pageVO.setUserIds(convertSet(users, MemberUserRespDTO::getId));
}
// TODO @jason管理员也可以先查询下。。
// 暂时支持查询 userType 会员类型。管理员类型还不知道使用场景
PageResult<PayWalletDO> pageResult = payWalletService.getWalletPage(MEMBER.getValue(),pageVO);
if (CollectionUtil.isEmpty(pageResult.getList())) {
return success(new PageResult<>(pageResult.getTotal()));
}
List<MemberUserRespDTO> users = memberUserApi.getUserList(convertList(pageResult.getList(), PayWalletDO::getUserId)).getCheckedData();
Map<Long, MemberUserRespDTO> userMap = convertMap(users, MemberUserRespDTO::getId);
return success(PayWalletConvert.INSTANCE.convertPage(pageResult, userMap));
} }
} }

View File

@ -7,13 +7,12 @@ import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargeService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.annotation.security.PermitAll; import jakarta.annotation.security.PermitAll;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP; import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;

View File

@ -6,19 +6,18 @@ import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.Wa
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackagePageReqVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackagePageReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageRespVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageRespVO;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageUpdateReqVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.WalletRechargePackageUpdateReqVO;
import cn.iocoder.yudao.module.pay.convert.wallet.WalletRechargePackageConvert; import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargePackageConvert;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO;
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargePackageService; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargePackageService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -61,7 +60,7 @@ public class PayWalletRechargePackageController {
@PreAuthorize("@ss.hasPermission('pay:wallet-recharge-package:query')") @PreAuthorize("@ss.hasPermission('pay:wallet-recharge-package:query')")
public CommonResult<WalletRechargePackageRespVO> getWalletRechargePackage(@RequestParam("id") Long id) { public CommonResult<WalletRechargePackageRespVO> getWalletRechargePackage(@RequestParam("id") Long id) {
PayWalletRechargePackageDO walletRechargePackage = walletRechargePackageService.getWalletRechargePackage(id); PayWalletRechargePackageDO walletRechargePackage = walletRechargePackageService.getWalletRechargePackage(id);
return success(WalletRechargePackageConvert.INSTANCE.convert(walletRechargePackage)); return success(PayWalletRechargePackageConvert.INSTANCE.convert(walletRechargePackage));
} }
@GetMapping("/page") @GetMapping("/page")
@ -69,7 +68,7 @@ public class PayWalletRechargePackageController {
@PreAuthorize("@ss.hasPermission('pay:wallet-recharge-package:query')") @PreAuthorize("@ss.hasPermission('pay:wallet-recharge-package:query')")
public CommonResult<PageResult<WalletRechargePackageRespVO>> getWalletRechargePackagePage(@Valid WalletRechargePackagePageReqVO pageVO) { public CommonResult<PageResult<WalletRechargePackageRespVO>> getWalletRechargePackagePage(@Valid WalletRechargePackagePageReqVO pageVO) {
PageResult<PayWalletRechargePackageDO> pageResult = walletRechargePackageService.getWalletRechargePackagePage(pageVO); PageResult<PayWalletRechargePackageDO> pageResult = walletRechargePackageService.getWalletRechargePackagePage(pageVO);
return success(WalletRechargePackageConvert.INSTANCE.convertPage(pageResult)); return success(PayWalletRechargePackageConvert.INSTANCE.convertPage(pageResult));
} }
} }

View File

@ -9,6 +9,8 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -16,9 +18,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 钱包余额明细") @Tag(name = "管理后台 - 钱包余额明细")

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage; package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
/** /**
* Base VO VO 使 * Base VO VO 使

View File

@ -1,12 +1,11 @@
package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage; package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
import jakarta.validation.constraints.NotNull;
@Schema(description = "管理后台 - 充值套餐更新 Request VO") @Schema(description = "管理后台 - 充值套餐更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet; package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
/** /**
* Base VO VO 使 * Base VO VO 使

View File

@ -1,6 +1,8 @@
package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet; package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -8,7 +10,6 @@ import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collection;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -18,11 +19,12 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ToString(callSuper = true) @ToString(callSuper = true)
public class PayWalletPageReqVO extends PageParam { public class PayWalletPageReqVO extends PageParam {
@Schema(description = "用户昵称", example = "李四") @Schema(description = "用户编号", example = "1024")
private String nickname; private Long userId;
@Schema(description = "用户编号", example = "[1,2]") @Schema(description = "用户类型", example = "1")
private Collection<Long> userIds; @InEnum(value = UserTypeEnum.class)
private Integer userType;
@Schema(description = "创建时间") @Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)

View File

@ -19,9 +19,4 @@ public class PayWalletRespVO extends PayWalletBaseVO {
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime; private LocalDateTime createTime;
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王**")
private String nickname;
@Schema(description = "用户头像", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/xxx.jpg")
private String avatar;
} }

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet; package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(description = "管理后台 - 用户钱包明细 Request VO") @Schema(description = "管理后台 - 用户钱包明细 Request VO")
@Data @Data

View File

@ -6,13 +6,13 @@ import cn.iocoder.yudao.module.pay.service.channel.PayChannelService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;

View File

@ -13,12 +13,11 @@ import com.google.common.collect.Maps;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;

View File

@ -2,11 +2,7 @@ package cn.iocoder.yudao.module.pay.controller.app.order.vo;
import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderSubmitRespVO; import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderSubmitRespVO;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Schema(description = "用户 APP - 支付订单提交 Response VO") @Schema(description = "用户 APP - 支付订单提交 Response VO")
@Data @Data

View File

@ -9,14 +9,13 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;

View File

@ -1,24 +1,30 @@
package cn.iocoder.yudao.module.pay.controller.app.wallet; package cn.iocoder.yudao.module.pay.controller.app.wallet;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateReqVO;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateRespVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateRespVO;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeRespVO;
import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargeConvert; import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletRechargeConvert;
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO;
import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargeService; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargeService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP; import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserType; import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserType;
@ -32,6 +38,8 @@ public class AppPayWalletRechargeController {
@Resource @Resource
private PayWalletRechargeService walletRechargeService; private PayWalletRechargeService walletRechargeService;
@Resource
private PayOrderService payOrderService;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建钱包充值记录(发起充值)") @Operation(summary = "创建钱包充值记录(发起充值)")
@ -42,4 +50,18 @@ public class AppPayWalletRechargeController {
return success(PayWalletRechargeConvert.INSTANCE.convert(walletRecharge)); return success(PayWalletRechargeConvert.INSTANCE.convert(walletRecharge));
} }
@GetMapping("/page")
@Operation(summary = "获得钱包充值记录分页")
public CommonResult<PageResult<AppPayWalletRechargeRespVO>> getWalletRechargePage(@Valid PageParam pageReqVO) {
PageResult<PayWalletRechargeDO> pageResult = walletRechargeService.getWalletRechargePackagePage(
getLoginUserId(), UserTypeEnum.MEMBER.getValue(), pageReqVO, true);
if (CollUtil.isEmpty(pageResult.getList())) {
return success(PageResult.empty(pageResult.getTotal()));
}
// 拼接数据
List<PayOrderDO> payOrderList = payOrderService.getOrderList(
convertList(pageResult.getList(), PayWalletRechargeDO::getPayOrderId));
return success(PayWalletRechargeConvert.INSTANCE.convertPage(pageResult, payOrderList));
}
} }

View File

@ -1,16 +1,21 @@
package cn.iocoder.yudao.module.pay.controller.app.wallet; package cn.iocoder.yudao.module.pay.controller.app.wallet;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletPackageRespVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletPackageRespVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO;
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletRechargePackageService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.Comparator;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -22,14 +27,16 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Slf4j @Slf4j
public class AppPayWalletRechargePackageController { public class AppPayWalletRechargePackageController {
@Resource
private PayWalletRechargePackageService walletRechargePackageService;
@GetMapping("/list") @GetMapping("/list")
@Operation(summary = "获得钱包充值套餐列表") @Operation(summary = "获得钱包充值套餐列表")
public CommonResult<List<AppPayWalletPackageRespVO>> getWalletRechargePackageList() { public CommonResult<List<AppPayWalletPackageRespVO>> getWalletRechargePackageList() {
// 只查询开启;需要按照 payPrice 排序; List<PayWalletRechargePackageDO> list = walletRechargePackageService.getWalletRechargePackageList(
List<AppPayWalletPackageRespVO> list = new ArrayList<>(); CommonStatusEnum.ENABLE.getStatus());
list.add(new AppPayWalletPackageRespVO().setId(1L).setName("土豆").setPayPrice(10).setBonusPrice(2)); list.sort(Comparator.comparingInt(PayWalletRechargePackageDO::getPayPrice));
list.add(new AppPayWalletPackageRespVO().setId(2L).setName("番茄").setPayPrice(20).setBonusPrice(5)); return success(BeanUtils.toBean(list, AppPayWalletPackageRespVO.class));
return success(list);
} }
} }

View File

@ -3,24 +3,29 @@ package cn.iocoder.yudao.module.pay.controller.app.wallet;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO;
import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletTransactionConvert; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionSummaryRespVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService; import cn.iocoder.yudao.module.pay.service.wallet.PayWalletTransactionService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Tag(name = "用户 APP - 钱包余额明细") @Tag(name = "用户 APP - 钱包余额明细")
@ -37,16 +42,19 @@ public class AppPayWalletTransactionController {
@Operation(summary = "获得钱包流水分页") @Operation(summary = "获得钱包流水分页")
public CommonResult<PageResult<AppPayWalletTransactionRespVO>> getWalletTransactionPage( public CommonResult<PageResult<AppPayWalletTransactionRespVO>> getWalletTransactionPage(
@Valid AppPayWalletTransactionPageReqVO pageReqVO) { @Valid AppPayWalletTransactionPageReqVO pageReqVO) {
if (true) { PageResult<PayWalletTransactionDO> pageResult = payWalletTransactionService.getWalletTransactionPage(
PageResult<AppPayWalletTransactionRespVO> result = new PageResult<>(10L); getLoginUserId(), UserTypeEnum.MEMBER.getValue(), pageReqVO);
result.getList().add(new AppPayWalletTransactionRespVO().setPrice(1L) return success(BeanUtils.toBean(pageResult, AppPayWalletTransactionRespVO.class));
.setTitle("测试").setCreateTime(LocalDateTime.now()));
result.getList().add(new AppPayWalletTransactionRespVO().setPrice(-1L)
.setTitle("测试2").setCreateTime(LocalDateTime.now()));
return success(result);
} }
PageResult<PayWalletTransactionDO> result = payWalletTransactionService.getWalletTransactionPage(getLoginUserId(),
UserTypeEnum.MEMBER.getValue(), pageReqVO); @GetMapping("/get-summary")
return success(PayWalletTransactionConvert.INSTANCE.convertPage(result)); @Operation(summary = "获得钱包流水统计")
@Parameter(name = "times", description = "时间段", required = true)
public CommonResult<AppPayWalletTransactionSummaryRespVO> getWalletTransactionSummary(
@RequestParam("createTime") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) LocalDateTime[] createTime) {
AppPayWalletTransactionSummaryRespVO summary = payWalletTransactionService.getWalletTransactionSummary(
getLoginUserId(), UserTypeEnum.MEMBER.getValue(), createTime);
return success(summary);
} }
} }

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge; package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import jakarta.validation.constraints.AssertTrue; import jakarta.validation.constraints.AssertTrue;
import jakarta.validation.constraints.Min; import jakarta.validation.constraints.Min;
import lombok.Data;
import java.util.Objects; import java.util.Objects;
@Schema(description = "用户 APP - 创建钱包充值 Request VO") @Schema(description = "用户 APP - 创建钱包充值 Request VO")
@ -19,7 +19,8 @@ public class AppPayWalletRechargeCreateReqVO {
private Long packageId; private Long packageId;
@AssertTrue(message = "充值金额和充钱套餐不能同时为空") @AssertTrue(message = "充值金额和充钱套餐不能同时为空")
public boolean validatePayPriceAndPackageId() { public boolean isValidPayPriceAndPackageId() {
return Objects.nonNull(payPrice) || Objects.nonNull(packageId); return Objects.nonNull(payPrice) || Objects.nonNull(packageId);
} }
} }

View File

@ -0,0 +1,42 @@
package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "用户 APP - 钱包充值记录 Resp VO")
@Data
public class AppPayWalletRechargeRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long id;
@Schema(description = "用户实际到账余额", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
private Integer totalPrice;
@Schema(description = "实际支付金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "20")
private Integer payPrice;
@Schema(description = "钱包赠送金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "80")
private Integer bonusPrice;
@Schema(description = "支付成功的支付渠道", requiredMode = Schema.RequiredMode.REQUIRED)
private String payChannelCode;
@Schema(description = "支付渠道名", example = "微信小程序支付")
private String payChannelName;
@Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
private Long payOrderId;
@Schema(description = "支付成功的外部订单号", requiredMode = Schema.RequiredMode.REQUIRED)
private String payOrderChannelOrderNo; // 从 PayOrderDO 的 channelOrderNo 字段
@Schema(description = "订单支付时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime payTime;
@Schema(description = "退款状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
private Integer refundStatus;
}

View File

@ -1,8 +1,12 @@
package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction; package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "用户 APP - 钱包流水分页 Request VO") @Schema(description = "用户 APP - 钱包流水分页 Request VO")
@Data @Data
@ -20,4 +24,8 @@ public class AppPayWalletTransactionPageReqVO extends PageParam {
@Schema(description = "类型", example = "1") @Schema(description = "类型", example = "1")
private Integer type; private Integer type;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
} }

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "用户 APP - 钱包流水统计 Request VO")
@Data
public class AppPayWalletTransactionSummaryRespVO {
@Schema(description = "累计支出,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
private Integer totalExpense;
@Schema(description = "累计收入,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000")
private Integer totalIncome;
}

View File

@ -7,13 +7,13 @@ import lombok.Data;
@Data @Data
public class AppPayWalletRespVO { public class AppPayWalletRespVO {
@Schema(description = "钱包余额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") @Schema(description = "钱包余额单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100")
private Integer balance; private Integer balance;
@Schema(description = "累计支出, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000") @Schema(description = "累计支出单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
private Integer totalExpense; private Integer totalExpense;
@Schema(description = "累计充值, 单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000") @Schema(description = "累计充值单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000")
private Integer totalRecharge; private Integer totalRecharge;
} }

View File

@ -14,7 +14,6 @@ import org.mapstruct.factory.Mappers;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.function.Consumer;
/** /**
* Convert * Convert

View File

@ -1,8 +1,8 @@
package cn.iocoder.yudao.module.pay.convert.demo; package cn.iocoder.yudao.module.pay.convert.demo;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderCreateReqVO; import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order.PayDemoOrderCreateReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderRespVO; import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order.PayDemoOrderRespVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO; import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;

View File

@ -0,0 +1,21 @@
package cn.iocoder.yudao.module.pay.convert.demo;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferCreateReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferRespVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoTransferDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* @author jason
*/
@Mapper
public interface PayDemoTransferConvert {
PayDemoTransferConvert INSTANCE = Mappers.getMapper(PayDemoTransferConvert.class);
PayDemoTransferDO convert(PayDemoTransferCreateReqVO bean);
PageResult<PayDemoTransferRespVO> convertPage(PageResult<PayDemoTransferDO> pageResult);
}

View File

@ -1,10 +1,14 @@
package cn.iocoder.yudao.module.pay.convert.transfer; package cn.iocoder.yudao.module.pay.convert.transfer;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO;
import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateReqDTO; import cn.iocoder.yudao.module.pay.api.transfer.dto.PayTransferCreateReqDTO;
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferCreateReqVO; import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.transfer.PayDemoTransferCreateReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferCreateReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferPageItemRespVO;
import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferRespVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferDO; import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferDO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
@Mapper @Mapper
@ -12,9 +16,15 @@ public interface PayTransferConvert {
PayTransferConvert INSTANCE = Mappers.getMapper(PayTransferConvert.class); PayTransferConvert INSTANCE = Mappers.getMapper(PayTransferConvert.class);
@Mapping(source = "title", target = "subject") // TODO @jason是不是都改成 subject 完事呀?
PayTransferDO convert(PayTransferCreateReqDTO dto); PayTransferDO convert(PayTransferCreateReqDTO dto);
PayTransferUnifiedReqDTO convert2(PayTransferDO dto);
PayTransferCreateReqDTO convert(PayTransferCreateReqVO vo);
PayTransferCreateReqDTO convert(PayDemoTransferCreateReqVO vo); PayTransferCreateReqDTO convert(PayDemoTransferCreateReqVO vo);
PayTransferRespVO convert(PayTransferDO bean);
PageResult<PayTransferPageItemRespVO> convertPage(PageResult<PayTransferDO> pageResult);
} }

View File

@ -1,16 +1,12 @@
package cn.iocoder.yudao.module.pay.convert.wallet; package cn.iocoder.yudao.module.pay.convert.wallet;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.wallet.AppPayWalletRespVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.Map;
@Mapper @Mapper
public interface PayWalletConvert { public interface PayWalletConvert {
@ -18,19 +14,8 @@ public interface PayWalletConvert {
AppPayWalletRespVO convert(PayWalletDO bean); AppPayWalletRespVO convert(PayWalletDO bean);
PayWalletRespVO convert02(String nickname,String avatar, PayWalletDO bean); PayWalletRespVO convert02(PayWalletDO bean);
PageResult<PayWalletRespVO> convertPage(PageResult<PayWalletDO> page); PageResult<PayWalletRespVO> convertPage(PageResult<PayWalletDO> page);
default PageResult<PayWalletRespVO> convertPage(PageResult<PayWalletDO> page, Map<Long, MemberUserRespDTO> userMap){
PageResult<PayWalletRespVO> pageResult = convertPage(page);
pageResult.getList().forEach( wallet -> MapUtils.findAndThen(userMap, wallet.getUserId(),
user -> {
// TODO @jason可以链式调用哈
wallet.setNickname(user.getNickname());
wallet.setAvatar(user.getAvatar());
}));
return pageResult;
}
} }

View File

@ -1,11 +1,22 @@
package cn.iocoder.yudao.module.pay.convert.wallet; package cn.iocoder.yudao.module.pay.convert.wallet;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateRespVO; import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeCreateRespVO;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.recharge.AppPayWalletRechargeRespVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO;
import cn.iocoder.yudao.module.pay.enums.DictTypeConstants;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.Mapping; import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface PayWalletRechargeConvert { public interface PayWalletRechargeConvert {
@ -16,4 +27,17 @@ public interface PayWalletRechargeConvert {
AppPayWalletRechargeCreateRespVO convert(PayWalletRechargeDO bean); AppPayWalletRechargeCreateRespVO convert(PayWalletRechargeDO bean);
default PageResult<AppPayWalletRechargeRespVO> convertPage(PageResult<PayWalletRechargeDO> pageResult,
List<PayOrderDO> payOrderList) {
PageResult<AppPayWalletRechargeRespVO> voPageResult = BeanUtils.toBean(pageResult, AppPayWalletRechargeRespVO.class);
Map<Long, PayOrderDO> payOrderMap = CollectionUtils.convertMap(payOrderList, PayOrderDO::getId);
voPageResult.getList().forEach(recharge -> {
recharge.setPayChannelName(DictFrameworkUtils.getDictDataLabel(
DictTypeConstants.CHANNEL_CODE, recharge.getPayChannelCode()));
MapUtils.findAndThen(payOrderMap, recharge.getPayOrderId(),
order -> recharge.setPayOrderChannelOrderNo(order.getChannelOrderNo()));
});
return voPageResult;
}
} }

View File

@ -11,9 +11,9 @@ import org.mapstruct.factory.Mappers;
import java.util.List; import java.util.List;
@Mapper @Mapper
public interface WalletRechargePackageConvert { public interface PayWalletRechargePackageConvert {
WalletRechargePackageConvert INSTANCE = Mappers.getMapper(WalletRechargePackageConvert.class); PayWalletRechargePackageConvert INSTANCE = Mappers.getMapper(PayWalletRechargePackageConvert.class);
PayWalletRechargePackageDO convert(WalletRechargePackageCreateReqVO bean); PayWalletRechargePackageDO convert(WalletRechargePackageCreateReqVO bean);

View File

@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.pay.convert.wallet;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionRespVO; import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.transaction.PayWalletTransactionRespVO;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionRespVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO; import cn.iocoder.yudao.module.pay.service.wallet.bo.WalletTransactionCreateReqBO;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@ -13,8 +12,6 @@ public interface PayWalletTransactionConvert {
PayWalletTransactionConvert INSTANCE = Mappers.getMapper(PayWalletTransactionConvert.class); PayWalletTransactionConvert INSTANCE = Mappers.getMapper(PayWalletTransactionConvert.class);
PageResult<AppPayWalletTransactionRespVO> convertPage(PageResult<PayWalletTransactionDO> page);
PageResult<PayWalletTransactionRespVO> convertPage2(PageResult<PayWalletTransactionDO> page); PageResult<PayWalletTransactionRespVO> convertPage2(PageResult<PayWalletTransactionDO> page);
PayWalletTransactionDO convert(WalletTransactionCreateReqBO bean); PayWalletTransactionDO convert(WalletTransactionCreateReqBO bean);

View File

@ -54,4 +54,9 @@ public class PayAppDO extends BaseDO {
*/ */
private String refundNotifyUrl; private String refundNotifyUrl;
/**
*
*/
private String transferNotifyUrl;
} }

View File

@ -1,16 +1,16 @@
package cn.iocoder.yudao.module.pay.dal.dataobject.demo; package cn.iocoder.yudao.module.pay.dal.dataobject.demo;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum;
import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Map;
// TODO 芋艿:需要详细 review
/** /**
* *
* *
@ -28,9 +28,18 @@ public class PayDemoTransferDO extends BaseDO {
private Long id; private Long id;
/** /**
* *
*
* {@link PayAppDO#getId()}
*/ */
private Long userId; private Long appId;
/**
*
* <p>
* {@link PayTransferTypeEnum}
*/
private Integer type;
/** /**
* *
@ -38,16 +47,19 @@ public class PayDemoTransferDO extends BaseDO {
private Integer price; private Integer price;
/** /**
* *
*/ */
private Integer type; private String userName;
// TODO @jason要不字段还是弄成正确的平铺开
/** /**
* *
*/ */
@TableField(typeHandler = JacksonTypeHandler.class) private String alipayLogonId;
private Map<String, String> payeeInfo;
/**
* openId
*/
private String openid;
/** /**
* *
@ -55,7 +67,7 @@ public class PayDemoTransferDO extends BaseDO {
private Integer transferStatus; private Integer transferStatus;
/** /**
* *
*/ */
private Long payTransferId; private Long payTransferId;

View File

@ -1,7 +1,7 @@
package cn.iocoder.yudao.module.pay.dal.dataobject.notify; package cn.iocoder.yudao.module.pay.dal.dataobject.notify;
import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyStatusEnum;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyStatusEnum;
import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*; import lombok.*;

View File

@ -66,6 +66,10 @@ public class PayNotifyTaskDO extends TenantBaseDO {
* *
*/ */
private String merchantOrderId; private String merchantOrderId;
/**
*
*/
private String merchantTransferId;
/** /**
* *
* *

View File

@ -1,9 +1,9 @@
package cn.iocoder.yudao.module.pay.dal.dataobject.order; package cn.iocoder.yudao.module.pay.dal.dataobject.order;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;

View File

@ -16,6 +16,7 @@ import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Map; import java.util.Map;
// TODO 芋艿:需要详细 review
/** /**
* DO * DO
* *
@ -31,24 +32,44 @@ public class PayTransferDO extends BaseDO {
*/ */
@TableId @TableId
private Long id; private Long id;
/**
*
*
*/
private String no;
/** /**
* *
* *
* {@link PayAppDO#getId()} * {@link PayAppDO#getId()}
*/ */
private Long appId; private Long appId;
/** /**
* *
* *
* {@link PayChannelDO#getId()} * {@link PayChannelDO#getId()}
*/ */
private Long channelId; private Long channelId;
/** /**
* *
* *
* {@link PayChannelEnum} * {@link PayChannelEnum}
*/ */
private String channelCode; private String channelCode;
// ========== 商户相关字段 ==========
/**
*
*
* A PayAppDO
*/
private String merchantTransferId;
// ========== 转账相关字段 ==========
/** /**
* *
* *
@ -56,51 +77,82 @@ public class PayTransferDO extends BaseDO {
*/ */
private Integer type; private Integer type;
// ========== 商户相关字段 ==========
/**
*
*
* A PayAppDO
*/
private String merchantOrderId;
/** /**
* *
*/ */
private String subject; private String subject;
// ========== 转账相关字段 ==========
/** /**
* *
*/ */
private Integer price; private Integer price;
/**
*
*/
private String userName;
/** /**
* *
* *
* {@link PayTransferStatusRespEnum} * {@link PayTransferStatusRespEnum}
*/ */
private Integer status; private Integer status;
/** /**
* *
*/ */
private LocalDateTime successTime; private LocalDateTime successTime;
// ========== 支付宝转账相关字段 ==========
/** /**
* *
*
* {@link PayTransferExtensionDO#getId()}
*/ */
private Long extensionId; private String alipayLogonId;
// ========== 微信转账相关字段 ==========
/** /**
* * openId
*
* {@link PayTransferExtensionDO#getNo()}
*/ */
private String no; private String openid;
// ========== 其它字段 ==========
/** /**
* *
*/
private String notifyUrl;
/**
* IP
*/
private String userIp;
/**
*
*/ */
@TableField(typeHandler = JacksonTypeHandler.class) @TableField(typeHandler = JacksonTypeHandler.class)
private Map<String, String> payeeInfo; private Map<String, String> channelExtras;
/**
*
*/
private String channelTransferNo;
/**
*
*/
private String channelErrorCode;
/**
*
*/
private String channelErrorMsg;
/**
* /
*
*/
private String channelNotifyData;
} }

View File

@ -1,68 +0,0 @@
package cn.iocoder.yudao.module.pay.dal.dataobject.transfer;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import java.util.Map;
// TODO @jason转账是不是类似 refund不用拓展单呀支付做拓展单的原因是因为它存在不确定性可以切换多种转账和退款都是明确方式的
// @芋艿 转账是不是也存在多种方式。 例如转账到银行卡。 可以使用微信,也可以使用支付宝。 支付宝账号余额不够,可以切换到微信;
// TODO @jason发起了就不允许调整了类似退款哈
/**
* DO
*
* @author jason
*/
@TableName(value ="pay_transfer_extension",autoResultMap = true)
@KeySequence("pay_transfer_extension_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
public class PayTransferExtensionDO extends BaseDO {
/**
*
*/
@TableId
private Long id;
/**
*
*/
private String no;
/**
*
*/
private Long transferId;
/**
*
*/
private Long channelId;
/**
*
*/
private String channelCode;
/**
*
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private Map<String, String> channelExtras;
/**
*
*/
private Integer status;
/**
*
*/
private String channelNotifyData;
}

View File

@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.pay.dal.mysql.app;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppPageReqVO; import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppPageReqVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;

View File

@ -1,10 +1,17 @@
package cn.iocoder.yudao.module.pay.dal.mysql.demo; package cn.iocoder.yudao.module.pay.dal.mysql.demo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoTransferDO; import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoTransferDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface PayDemoTransferMapper extends BaseMapperX<PayDemoTransferDO> { public interface PayDemoTransferMapper extends BaseMapperX<PayDemoTransferDO> {
default PageResult<PayDemoTransferDO> selectPage(PageParam pageParam){
return selectPage(pageParam, new LambdaQueryWrapperX<PayDemoTransferDO>()
.orderByDesc(PayDemoTransferDO::getId));
}
} }

View File

@ -1,7 +1,7 @@
package cn.iocoder.yudao.module.pay.dal.mysql.notify; package cn.iocoder.yudao.module.pay.dal.mysql.notify;
import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyLogDO;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.pay.dal.dataobject.notify.PayNotifyLogDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;

View File

@ -1,26 +0,0 @@
package cn.iocoder.yudao.module.pay.dal.mysql.transfer;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferExtensionDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface PayTransferExtensionMapper extends BaseMapperX<PayTransferExtensionDO> {
default PayTransferExtensionDO selectByNo(String no){
return selectOne(PayTransferExtensionDO::getNo, no);
}
default int updateByIdAndStatus(Long id, List<Integer> whereStatuses, PayTransferExtensionDO updateObj) {
return update(updateObj, new LambdaQueryWrapper<PayTransferExtensionDO>()
.eq(PayTransferExtensionDO::getId, id).in(PayTransferExtensionDO::getStatus, whereStatuses));
}
}

View File

@ -1,6 +1,9 @@
package cn.iocoder.yudao.module.pay.dal.mysql.transfer; package cn.iocoder.yudao.module.pay.dal.mysql.transfer;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.pay.controller.admin.transfer.vo.PayTransferPageReqVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferDO; import cn.iocoder.yudao.module.pay.dal.dataobject.transfer.PayTransferDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -15,6 +18,32 @@ public interface PayTransferMapper extends BaseMapperX<PayTransferDO> {
.eq(PayTransferDO::getId, id).in(PayTransferDO::getStatus, status)); .eq(PayTransferDO::getId, id).in(PayTransferDO::getStatus, status));
} }
default PayTransferDO selectByAppIdAndMerchantTransferId(Long appId, String merchantTransferId){
return selectOne(PayTransferDO::getAppId, appId,
PayTransferDO::getMerchantTransferId, merchantTransferId);
}
default PayTransferDO selectByNo(String no){
return selectOne(PayTransferDO::getNo, no);
}
default PageResult<PayTransferDO> selectPage(PayTransferPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<PayTransferDO>()
.eqIfPresent(PayTransferDO::getNo, reqVO.getNo())
.eqIfPresent(PayTransferDO::getAppId, reqVO.getAppId())
.eqIfPresent(PayTransferDO::getChannelCode, reqVO.getChannelCode())
.eqIfPresent(PayTransferDO::getMerchantTransferId, reqVO.getMerchantTransferId())
.eqIfPresent(PayTransferDO::getType, reqVO.getType())
.eqIfPresent(PayTransferDO::getStatus, reqVO.getStatus())
.likeIfPresent(PayTransferDO::getUserName, reqVO.getUserName())
.eqIfPresent(PayTransferDO::getChannelTransferNo, reqVO.getChannelTransferNo())
.betweenIfPresent(PayTransferDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(PayTransferDO::getId));
}
default List<PayTransferDO> selectListByStatus(Integer status){
return selectList(PayTransferDO::getStatus, status);
}
} }

View File

@ -17,10 +17,10 @@ public interface PayWalletMapper extends BaseMapperX<PayWalletDO> {
PayWalletDO::getUserType, userType); PayWalletDO::getUserType, userType);
} }
default PageResult<PayWalletDO> selectPage(Integer userType, PayWalletPageReqVO reqVO) { default PageResult<PayWalletDO> selectPage(PayWalletPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<PayWalletDO>() return selectPage(reqVO, new LambdaQueryWrapperX<PayWalletDO>()
.inIfPresent(PayWalletDO::getUserId, reqVO.getUserIds()) .eqIfPresent(PayWalletDO::getUserId, reqVO.getUserId())
.eqIfPresent(PayWalletDO::getUserType, userType) .eqIfPresent(PayWalletDO::getUserType, reqVO.getUserType())
.betweenIfPresent(PayWalletDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(PayWalletDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(PayWalletDO::getId)); .orderByDesc(PayWalletDO::getId));
} }

View File

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.pay.dal.mysql.wallet; package cn.iocoder.yudao.module.pay.dal.mysql.wallet;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargeDO;
@ -18,4 +20,11 @@ public interface PayWalletRechargeMapper extends BaseMapperX<PayWalletRechargeDO
.eq(PayWalletRechargeDO::getId, id).eq(PayWalletRechargeDO::getRefundStatus, whereRefundStatus)); .eq(PayWalletRechargeDO::getId, id).eq(PayWalletRechargeDO::getRefundStatus, whereRefundStatus));
} }
default PageResult<PayWalletRechargeDO> selectPage(PageParam pageReqVO, Long walletId, Boolean payStatus) {
return selectPage(pageReqVO, new LambdaQueryWrapperX<PayWalletRechargeDO>()
.eq(PayWalletRechargeDO::getWalletId, walletId)
.eq(PayWalletRechargeDO::getPayStatus, payStatus)
.orderByDesc(PayWalletRechargeDO::getId));
}
} }

View File

@ -8,6 +8,8 @@ import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.rechargepackage.Wa
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletRechargePackageDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper @Mapper
public interface PayWalletRechargePackageMapper extends BaseMapperX<PayWalletRechargePackageDO> { public interface PayWalletRechargePackageMapper extends BaseMapperX<PayWalletRechargePackageDO> {
@ -19,9 +21,12 @@ public interface PayWalletRechargePackageMapper extends BaseMapperX<PayWalletRec
.orderByDesc(PayWalletRechargePackageDO::getPayPrice)); .orderByDesc(PayWalletRechargePackageDO::getPayPrice));
} }
// TODO @jason这里要有空格哈String name) {
default PayWalletRechargePackageDO selectByName(String name) { default PayWalletRechargePackageDO selectByName(String name) {
return selectOne(PayWalletRechargePackageDO::getName, name); return selectOne(PayWalletRechargePackageDO::getName, name);
} }
default List<PayWalletRechargePackageDO> selectListByStatus(Integer status) {
return selectList(PayWalletRechargePackageDO::getStatus, status);
}
} }

View File

@ -1,32 +1,54 @@
package cn.iocoder.yudao.module.pay.dal.mysql.wallet; package cn.iocoder.yudao.module.pay.dal.mysql.wallet;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import static cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO.TYPE_EXPENSE;
import static cn.iocoder.yudao.module.pay.controller.app.wallet.vo.transaction.AppPayWalletTransactionPageReqVO.TYPE_INCOME;
@Mapper @Mapper
public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> { public interface PayWalletTransactionMapper extends BaseMapperX<PayWalletTransactionDO> {
default PageResult<PayWalletTransactionDO> selectPage(Long walletId, Integer type, default PageResult<PayWalletTransactionDO> selectPage(Long walletId, Integer type,
PageParam pageParam) { PageParam pageParam, LocalDateTime[] createTime) {
LambdaQueryWrapperX<PayWalletTransactionDO> query = new LambdaQueryWrapperX<PayWalletTransactionDO>() LambdaQueryWrapperX<PayWalletTransactionDO> query = new LambdaQueryWrapperX<PayWalletTransactionDO>()
.eqIfPresent(PayWalletTransactionDO::getWalletId, walletId); .eqIfPresent(PayWalletTransactionDO::getWalletId, walletId);
if (Objects.equals(type, AppPayWalletTransactionPageReqVO.TYPE_INCOME)) { if (Objects.equals(type, TYPE_INCOME)) {
query.gt(PayWalletTransactionDO::getPrice, 0); query.gt(PayWalletTransactionDO::getPrice, 0);
} else if (Objects.equals(type, AppPayWalletTransactionPageReqVO.TYPE_EXPENSE)) { } else if (Objects.equals(type, TYPE_EXPENSE)) {
query.lt(PayWalletTransactionDO::getPrice, 0); query.lt(PayWalletTransactionDO::getPrice, 0);
} }
query.betweenIfPresent(PayWalletTransactionDO::getCreateTime, createTime);
query.orderByDesc(PayWalletTransactionDO::getId); query.orderByDesc(PayWalletTransactionDO::getId);
return selectPage(pageParam, query); return selectPage(pageParam, query);
} }
default Integer selectPriceSum(Long walletId, Integer type, LocalDateTime[] createTime) {
// SQL sum 查询
List<Map<String, Object>> result = selectMaps(new QueryWrapperX<PayWalletTransactionDO>()
.select("SUM(price) AS priceSum")
.gt(Objects.equals(type, TYPE_INCOME), "price", 0) // 收入
.lt(Objects.equals(type, TYPE_EXPENSE), "price", 0) // 支出
.eq("wallet_id", walletId)
.between("create_time", createTime[0], createTime[1]));
// 获得 sum 结果
Map<String, Object> first = CollUtil.getFirst(result);
return MapUtil.getInt(first, "priceSum", 0);
}
default PayWalletTransactionDO selectByNo(String no) { default PayWalletTransactionDO selectByNo(String no) {
return selectOne(PayWalletTransactionDO::getNo, no); return selectOne(PayWalletTransactionDO::getNo, no);
} }

View File

@ -1,11 +1,12 @@
package cn.iocoder.yudao.module.pay.dal.redis.no; package cn.iocoder.yudao.module.pay.dal.redis.no;
import cn.hutool.core.date.DatePattern;import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.iocoder.yudao.module.pay.dal.redis.RedisKeyConstants; import cn.iocoder.yudao.module.pay.dal.redis.RedisKeyConstants;
import jakarta.annotation.Resource;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import jakarta.annotation.Resource;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDateTime; import java.time.LocalDateTime;

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.module.pay.dal.redis.notify; package cn.iocoder.yudao.module.pay.dal.redis.notify;
import jakarta.annotation.Resource;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import jakarta.annotation.Resource;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static cn.iocoder.yudao.module.pay.dal.redis.RedisKeyConstants.PAY_NOTIFY_LOCK; import static cn.iocoder.yudao.module.pay.dal.redis.RedisKeyConstants.PAY_NOTIFY_LOCK;

View File

@ -14,6 +14,7 @@ import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
import cn.iocoder.yudao.framework.pay.core.client.impl.NonePayClientConfig; import cn.iocoder.yudao.framework.pay.core.client.impl.NonePayClientConfig;
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum; import cn.iocoder.yudao.framework.pay.core.enums.refund.PayRefundStatusRespEnum;
import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum;
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO; import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO;
import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO; import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO; import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
@ -181,4 +182,9 @@ public class WalletPayClient extends AbstractPayClient<NonePayClientConfig> {
throw new UnsupportedOperationException("待实现"); throw new UnsupportedOperationException("待实现");
} }
@Override
protected PayTransferRespDTO doGetTransfer(String outTradeNo, PayTransferTypeEnum type) {
throw new UnsupportedOperationException("待实现");
}
} }

View File

@ -1,10 +1,7 @@
package cn.iocoder.yudao.module.pay.framework.rpc.config; package cn.iocoder.yudao.module.pay.framework.rpc.config;
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@EnableFeignClients(clients = MemberUserApi.class)
public class RpcConfiguration { public class RpcConfiguration {
} }

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.pay.job.transfer;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.pay.service.transfer.PayTransferService;
import com.xxl.job.core.handler.annotation.XxlJob;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* Job
*
*
*
* @author jason
*/
@Component
@Slf4j
public class PayTransferSyncJob {
@Resource
private PayTransferService transferService;
@XxlJob("payTransferSyncJob")
@TenantJob // 多租户
public void execute(String param) {
int count = transferService.syncTransfer();
log.info("[execute][同步转账订单 ({}) 个]", count);
}
}

View File

@ -7,8 +7,8 @@ import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppCreateReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppPageReqVO; import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppPageReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppUpdateReqVO; import cn.iocoder.yudao.module.pay.controller.admin.app.vo.PayAppUpdateReqVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO; import cn.iocoder.yudao.module.pay.dal.dataobject.app.PayAppDO;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@ -11,11 +11,11 @@ import cn.iocoder.yudao.module.pay.dal.mysql.app.PayAppMapper;
import cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants; import cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants;
import cn.iocoder.yudao.module.pay.service.order.PayOrderService; import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; import cn.iocoder.yudao.module.pay.service.refund.PayRefundService;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import jakarta.annotation.Resource;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;

View File

@ -5,8 +5,8 @@ import cn.iocoder.yudao.framework.pay.core.client.PayClient;
import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelCreateReqVO; import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelCreateReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateReqVO; import cn.iocoder.yudao.module.pay.controller.admin.channel.vo.PayChannelUpdateReqVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO; import cn.iocoder.yudao.module.pay.dal.dataobject.channel.PayChannelDO;
import jakarta.validation.Valid; import jakarta.validation.Valid;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;

View File

@ -16,14 +16,14 @@ import cn.iocoder.yudao.module.pay.dal.mysql.channel.PayChannelMapper;
import cn.iocoder.yudao.module.pay.framework.pay.core.WalletPayClient; import cn.iocoder.yudao.module.pay.framework.pay.core.WalletPayClient;
import com.google.common.cache.CacheLoader; import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache; import com.google.common.cache.LoadingCache;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import jakarta.validation.Validator;
import lombok.Getter; import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import jakarta.validation.Validator;
import java.time.Duration; import java.time.Duration;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;

View File

@ -2,9 +2,8 @@ package cn.iocoder.yudao.module.pay.service.demo;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderCreateReqVO; import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order.PayDemoOrderCreateReqVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO; import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO;
import jakarta.validation.Valid; import jakarta.validation.Valid;
/** /**

View File

@ -9,16 +9,16 @@ import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO;
import cn.iocoder.yudao.module.pay.api.refund.PayRefundApi; import cn.iocoder.yudao.module.pay.api.refund.PayRefundApi;
import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO;
import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundRespDTO; import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundRespDTO;
import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.PayDemoOrderCreateReqVO; import cn.iocoder.yudao.module.pay.controller.admin.demo.vo.order.PayDemoOrderCreateReqVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO; import cn.iocoder.yudao.module.pay.dal.dataobject.demo.PayDemoOrderDO;
import cn.iocoder.yudao.module.pay.dal.mysql.demo.PayDemoOrderMapper; import cn.iocoder.yudao.module.pay.dal.mysql.demo.PayDemoOrderMapper;
import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum; import cn.iocoder.yudao.module.pay.enums.order.PayOrderStatusEnum;
import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum; import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import jakarta.annotation.Resource;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.HashMap; import java.util.HashMap;
@ -232,7 +232,7 @@ public class PayDemoOrderServiceImpl implements PayDemoOrderService {
throw exception(DEMO_ORDER_NOT_FOUND); throw exception(DEMO_ORDER_NOT_FOUND);
} }
// 1.2 校验退款订单匹配 // 1.2 校验退款订单匹配
if (Objects.equals(order.getPayOrderId(), payRefundId)) { if (Objects.equals(order.getPayRefundId(), payRefundId)) {
log.error("[validateDemoOrderCanRefunded][order({}) 退款单不匹配({})请进行处理order 数据是:{}]", log.error("[validateDemoOrderCanRefunded][order({}) 退款单不匹配({})请进行处理order 数据是:{}]",
id, payRefundId, toJsonString(order)); id, payRefundId, toJsonString(order));
throw exception(DEMO_ORDER_REFUND_FAIL_REFUND_ORDER_ID_ERROR); throw exception(DEMO_ORDER_REFUND_FAIL_REFUND_ORDER_ID_ERROR);

Some files were not shown because too many files have changed in this diff Show More