完成支付、电子面单、模板消息队列等功能
This commit is contained in:
@ -17,8 +17,7 @@
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
pay 模块,我们放支付业务,提供业务的支付能力。
|
||||
例如说:商户、应用、支付、退款等等
|
||||
pay 模块
|
||||
</description>
|
||||
|
||||
|
||||
|
@ -28,6 +28,37 @@
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- DB 相关 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 消息队列相关 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-mq</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- 支付相关 -->
|
||||
<dependency>
|
||||
<groupId>com.egzosn</groupId>
|
||||
<artifactId>pay-java-wx</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.egzosn</groupId>
|
||||
<artifactId>pay-java-ali</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.egzosn</groupId>
|
||||
<artifactId>pay-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.egzosn</groupId>
|
||||
<artifactId>pay-java-web-support</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -1,34 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.api.notify.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 支付单的通知 Request DTO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PayOrderNotifyReqDTO {
|
||||
|
||||
/**
|
||||
* 商户订单编号
|
||||
*/
|
||||
@NotEmpty(message = "商户订单号不能为空")
|
||||
private String merchantOrderId;
|
||||
|
||||
/**
|
||||
* 支付订单编号
|
||||
*/
|
||||
@NotNull(message = "支付订单编号不能为空")
|
||||
private Long payOrderId;
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.api.notify.dto;
|
||||
|
||||
import co.yixiang.yshop.module.pay.enums.refund.PayRefundStatusEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 退款单的通知 Request DTO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PayRefundNotifyReqDTO {
|
||||
|
||||
/**
|
||||
* 商户退款单编号
|
||||
*/
|
||||
@NotEmpty(message = "商户退款单编号不能为空")
|
||||
private String merchantOrderId;
|
||||
|
||||
/**
|
||||
* 支付退款编号
|
||||
*/
|
||||
@NotNull(message = "支付退款编号不能为空")
|
||||
private Long payRefundId;
|
||||
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
/**
|
||||
* 占位符,无特殊作用
|
||||
*/
|
||||
package co.yixiang.yshop.module.pay.api.notify;
|
@ -1,32 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.api.order;
|
||||
|
||||
import co.yixiang.yshop.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
||||
import co.yixiang.yshop.module.pay.api.order.dto.PayOrderRespDTO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 支付单 API 接口
|
||||
*
|
||||
* @author LeeYan9
|
||||
* @since 2022-08-26
|
||||
*/
|
||||
public interface PayOrderApi {
|
||||
|
||||
/**
|
||||
* 创建支付单
|
||||
*
|
||||
* @param reqDTO 创建请求
|
||||
* @return 支付单编号
|
||||
*/
|
||||
Long createOrder(@Valid PayOrderCreateReqDTO reqDTO);
|
||||
|
||||
/**
|
||||
* 获得支付单
|
||||
*
|
||||
* @param id 支付单编号
|
||||
* @return 支付单
|
||||
*/
|
||||
PayOrderRespDTO getOrder(Long id);
|
||||
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.api.order.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.DecimalMin;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 支付单创建 Request DTO
|
||||
*/
|
||||
@Data
|
||||
public class PayOrderCreateReqDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 应用编号
|
||||
*/
|
||||
@NotNull(message = "应用编号不能为空")
|
||||
private Long appId;
|
||||
/**
|
||||
* 用户 IP
|
||||
*/
|
||||
@NotEmpty(message = "用户 IP 不能为空")
|
||||
private String userIp;
|
||||
|
||||
// ========== 商户相关字段 ==========
|
||||
|
||||
/**
|
||||
* 商户订单编号
|
||||
*/
|
||||
@NotEmpty(message = "商户订单编号不能为空")
|
||||
private String merchantOrderId;
|
||||
/**
|
||||
* 商品标题
|
||||
*/
|
||||
@NotEmpty(message = "商品标题不能为空")
|
||||
@Length(max = 32, message = "商品标题不能超过 32")
|
||||
private String subject;
|
||||
/**
|
||||
* 商品描述
|
||||
*/
|
||||
// @NotEmpty(message = "商品描述信息不能为空")
|
||||
@Length(max = 128, message = "商品描述信息长度不能超过128")
|
||||
private String body;
|
||||
|
||||
// ========== 订单相关字段 ==========
|
||||
|
||||
/**
|
||||
* 支付金额,单位:分
|
||||
*/
|
||||
@NotNull(message = "支付金额不能为空")
|
||||
@DecimalMin(value = "0", inclusive = false, message = "支付金额必须大于零")
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
* 支付过期时间
|
||||
*/
|
||||
@NotNull(message = "支付过期时间不能为空")
|
||||
private LocalDateTime expireTime;
|
||||
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.api.order.dto;
|
||||
|
||||
import co.yixiang.yshop.module.pay.enums.order.PayOrderStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 支付单信息 Response DTO
|
||||
*
|
||||
* TODO yshop:还没定好字段
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Data
|
||||
public class PayOrderRespDTO {
|
||||
|
||||
/**
|
||||
* 订单编号,数据库自增
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 渠道编码
|
||||
*
|
||||
* 枚举 PayChannelEnum
|
||||
*/
|
||||
private String channelCode;
|
||||
|
||||
// ========== 商户相关字段 ==========
|
||||
/**
|
||||
* 商户订单编号
|
||||
* 例如说,内部系统 A 的订单号。需要保证每个 PayMerchantDO 唯一
|
||||
*/
|
||||
private String merchantOrderId;
|
||||
|
||||
// ========== 订单相关字段 ==========
|
||||
/**
|
||||
* 支付金额,单位:分
|
||||
*/
|
||||
private Integer amount;
|
||||
/**
|
||||
* 支付状态
|
||||
*
|
||||
* 枚举 {@link PayOrderStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
// ========== 渠道相关字段 ==========
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.api.refund;
|
||||
|
||||
import co.yixiang.yshop.module.pay.api.refund.dto.PayRefundCreateReqDTO;
|
||||
import co.yixiang.yshop.module.pay.api.refund.dto.PayRefundRespDTO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 退款单 API 接口
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
public interface PayRefundApi {
|
||||
|
||||
/**
|
||||
* 创建退款单
|
||||
*
|
||||
* @param reqDTO 创建请求
|
||||
* @return 退款单编号
|
||||
*/
|
||||
Long createPayRefund(@Valid PayRefundCreateReqDTO reqDTO);
|
||||
|
||||
/**
|
||||
* 获得退款单
|
||||
*
|
||||
* @param id 退款单编号
|
||||
* @return 退款单
|
||||
*/
|
||||
PayRefundRespDTO getPayRefund(Long id);
|
||||
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.api.refund.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 退款单创建 Request DTO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Data
|
||||
public class PayRefundCreateReqDTO {
|
||||
|
||||
/**
|
||||
* 应用编号
|
||||
*/
|
||||
@NotNull(message = "应用编号不能为空")
|
||||
private Long appId;
|
||||
/**
|
||||
* 用户 IP
|
||||
*/
|
||||
@NotEmpty(message = "用户 IP 不能为空")
|
||||
private String userIp;
|
||||
|
||||
// ========== 商户相关字段 ==========
|
||||
|
||||
/**
|
||||
* 退款描述
|
||||
*/
|
||||
@NotEmpty(message = "退款描述不能为空")
|
||||
@Length(max = 128, message = "退款描述长度不能超过128")
|
||||
private String reason;
|
||||
|
||||
// ========== 订单相关字段 ==========
|
||||
|
||||
/**
|
||||
* 支付单号
|
||||
*/
|
||||
@NotNull(message = "支付单号不能为空")
|
||||
private Long payOrderId;
|
||||
|
||||
/**
|
||||
* 退款金额,单位:分
|
||||
*/
|
||||
@NotNull(message = "退款金额不能为空")
|
||||
@Min(value = 1, message = "退款金额必须大于零")
|
||||
private Integer amount;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.api.refund.dto;
|
||||
|
||||
import co.yixiang.yshop.module.pay.enums.refund.PayRefundStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 退款单信息 Response DTO
|
||||
*
|
||||
* TODO yshop:还没定好字段
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Data
|
||||
public class PayRefundRespDTO {
|
||||
|
||||
/**
|
||||
* 退款单编号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
// ========== 退款相关字段 ==========
|
||||
/**
|
||||
* 退款状态
|
||||
*
|
||||
* 枚举 {@link PayRefundStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 退款金额,单位:分
|
||||
*/
|
||||
private Integer refundAmount;
|
||||
|
||||
// ========== 商户相关字段 ==========
|
||||
/**
|
||||
* 商户订单编号
|
||||
*/
|
||||
private String merchantOrderId;
|
||||
/**
|
||||
* 退款成功时间
|
||||
*/
|
||||
private LocalDateTime successTime;
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package co.yixiang.yshop.module.pay.config;
|
||||
|
||||
import co.yixiang.yshop.module.pay.config.handlers.AliPayMessageHandler;
|
||||
import co.yixiang.yshop.module.pay.config.handlers.WxPayMessageHandler;
|
||||
import com.egzosn.pay.spring.boot.core.PayServiceConfigurer;
|
||||
import com.egzosn.pay.spring.boot.core.configurers.MerchantDetailsServiceConfigurer;
|
||||
import com.egzosn.pay.spring.boot.core.configurers.PayMessageConfigurer;
|
||||
import com.egzosn.pay.spring.boot.core.merchant.PaymentPlatform;
|
||||
import com.egzosn.pay.spring.boot.core.provider.merchant.platform.AliPaymentPlatform;
|
||||
import com.egzosn.pay.spring.boot.core.provider.merchant.platform.PaymentPlatforms;
|
||||
import com.egzosn.pay.spring.boot.core.provider.merchant.platform.WxPaymentPlatform;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
/**
|
||||
* 支付服务配置
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2023/7/15
|
||||
*/
|
||||
@Configuration
|
||||
public class MerchantPayServiceConfigurer implements PayServiceConfigurer {
|
||||
|
||||
@Resource
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
/**
|
||||
* 商户配置
|
||||
*
|
||||
* @param merchants 商户配置
|
||||
*/
|
||||
@Override
|
||||
public void configure(MerchantDetailsServiceConfigurer merchants) {
|
||||
merchants.jdbc()
|
||||
//是否开启缓存,默认不开启,这里开启缓存
|
||||
.cache(false)
|
||||
.template(jdbcTemplate);
|
||||
|
||||
}
|
||||
/**
|
||||
* 商户配置
|
||||
*
|
||||
* @param configurer 支付消息配置
|
||||
*/
|
||||
@Override
|
||||
public void configure(PayMessageConfigurer configurer) {
|
||||
PaymentPlatform aliPaymentPlatform = PaymentPlatforms.getPaymentPlatform(AliPaymentPlatform.PLATFORM_NAME);
|
||||
PaymentPlatform wxPaymentPlatform = PaymentPlatforms.getPaymentPlatform(WxPaymentPlatform.PLATFORM_NAME);
|
||||
configurer.addHandler(aliPaymentPlatform, new AliPayMessageHandler());
|
||||
configurer.addHandler(wxPaymentPlatform, new WxPayMessageHandler());
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package co.yixiang.yshop.module.pay.config.handlers;
|
||||
|
||||
import co.yixiang.yshop.module.pay.mq.producer.PayNoticeProducer;
|
||||
import com.egzosn.pay.ali.api.AliPayService;
|
||||
import com.egzosn.pay.ali.bean.AliPayMessage;
|
||||
import com.egzosn.pay.common.api.PayMessageHandler;
|
||||
import com.egzosn.pay.common.bean.PayOutMessage;
|
||||
import com.egzosn.pay.common.exception.PayErrorException;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 支付宝支付回调处理器
|
||||
* @author hupeng
|
||||
* @date 2023/7/15
|
||||
*/
|
||||
//@Component
|
||||
public class AliPayMessageHandler implements PayMessageHandler<AliPayMessage, AliPayService> {
|
||||
|
||||
@Resource
|
||||
private PayNoticeProducer payNoticeProducer;
|
||||
/**
|
||||
* 处理支付回调消息的处理器接口
|
||||
*
|
||||
* @param payMessage 支付消息
|
||||
* @param context 上下文,如果handler或interceptor之间有信息要传递,可以用这个
|
||||
* @param payService 支付服务
|
||||
* @return xml, text格式的消息,如果在异步规则里处理的话,可以返回null
|
||||
* @throws PayErrorException 支付错误异常
|
||||
*/
|
||||
@Override
|
||||
public PayOutMessage handle(AliPayMessage payMessage, Map<String, Object> context, AliPayService payService) throws PayErrorException {
|
||||
|
||||
Map<String, Object> message = payMessage.getPayMessage();
|
||||
//交易状态
|
||||
String trade_status = (String) message.get("trade_status");
|
||||
|
||||
//交易完成
|
||||
if ("TRADE_SUCCESS".equals(trade_status) || "TRADE_FINISHED".equals(trade_status)) {
|
||||
|
||||
String orderId = (String) payMessage.getPayMessage().get("out_trade_no");
|
||||
//消息队列处理
|
||||
payNoticeProducer.sendPayNoticeMessage(orderId,"alipay");
|
||||
|
||||
return payService.getPayOutMessage("success", "成功");
|
||||
|
||||
}
|
||||
|
||||
return payService.getPayOutMessage("fail", "失败");
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package co.yixiang.yshop.module.pay.config.handlers;
|
||||
|
||||
import co.yixiang.yshop.module.pay.mq.producer.PayNoticeProducer;
|
||||
import com.egzosn.pay.common.api.PayMessageHandler;
|
||||
import com.egzosn.pay.common.api.PayService;
|
||||
import com.egzosn.pay.common.bean.PayOutMessage;
|
||||
import com.egzosn.pay.common.exception.PayErrorException;
|
||||
import com.egzosn.pay.wx.bean.WxPayMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 微信支付回调处理器
|
||||
* @author hupeng
|
||||
* @date 2023/7/15
|
||||
*/
|
||||
@Slf4j
|
||||
public class WxPayMessageHandler implements PayMessageHandler<WxPayMessage, PayService> {
|
||||
|
||||
@Resource
|
||||
private PayNoticeProducer payNoticeProducer;
|
||||
|
||||
@Override
|
||||
public PayOutMessage handle(WxPayMessage payMessage, Map<String, Object> context, PayService payService) throws PayErrorException {
|
||||
|
||||
log.info("======pay notice ========");
|
||||
|
||||
//交易状态
|
||||
if ("SUCCESS".equals(payMessage.getPayMessage().get("result_code"))){
|
||||
String orderId = (String) payMessage.getPayMessage().get("out_trade_no");
|
||||
//消息队列处理
|
||||
payNoticeProducer.sendPayNoticeMessage(orderId,"weixin");
|
||||
|
||||
return payService.getPayOutMessage("SUCCESS", "OK");
|
||||
}
|
||||
|
||||
return payService.getPayOutMessage("FAIL", "失败");
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
|
||||
package co.yixiang.yshop.module.pay.config.interceptor;
|
||||
|
||||
import com.egzosn.pay.ali.api.AliPayService;
|
||||
import com.egzosn.pay.ali.bean.AliPayMessage;
|
||||
import com.egzosn.pay.common.api.PayMessageHandler;
|
||||
import com.egzosn.pay.common.api.PayMessageInterceptor;
|
||||
import com.egzosn.pay.common.exception.PayErrorException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 支付宝回调信息拦截器
|
||||
* @author hupeng
|
||||
* @date 2023/7/15
|
||||
*/
|
||||
//使用 自己开启
|
||||
//@Component
|
||||
public class AliPayMessageInterceptor implements PayMessageInterceptor<AliPayMessage, AliPayService> {
|
||||
|
||||
/**
|
||||
* 拦截支付消息
|
||||
*
|
||||
* @param payMessage 支付回调消息
|
||||
* @param context 上下文,如果handler或interceptor之间有信息要传递,可以用这个
|
||||
* @param payService 支付服务
|
||||
* @return true代表OK,false代表不OK并直接中断对应的支付处理器
|
||||
* @see PayMessageHandler 支付处理器
|
||||
* @throws PayErrorException PayErrorException*
|
||||
*/
|
||||
@Override
|
||||
public boolean intercept(AliPayMessage payMessage, Map<String, Object> context, AliPayService payService) throws PayErrorException {
|
||||
|
||||
//这里进行拦截器处理,自行实现
|
||||
String outTradeNo = payMessage.getOutTradeNo();
|
||||
// todo
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.enums;
|
||||
|
||||
/**
|
||||
* Pay 字典类型的枚举类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
public interface DictTypeConstants {
|
||||
|
||||
String ORDER_STATUS = "pay_order_status"; // 支付-订单-订单状态
|
||||
String ORDER_NOTIFY_STATUS = "pay_order_notify_status"; // 支付-订单-订单回调商户状态
|
||||
|
||||
String ORDER_REFUND_STATUS = "pay_order_refund_status"; // 支付-订单-订单退款状态
|
||||
String REFUND_ORDER_STATUS = "pay_refund_order_status"; // 支付-退款订单-退款状态
|
||||
String REFUND_ORDER_TYPE = "pay_refund_order_type"; // 支付-退款订单-退款类别
|
||||
|
||||
}
|
@ -1,73 +1,9 @@
|
||||
package co.yixiang.yshop.module.pay.enums;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.yshop.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* Pay 错误码 Core 枚举类
|
||||
*
|
||||
* pay 系统,使用 1-007-000-000 段
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
/**
|
||||
* ========== APP 模块 1-007-000-000 ==========
|
||||
*/
|
||||
ErrorCode PAY_APP_NOT_FOUND = new ErrorCode(1007000000, "App 不存在");
|
||||
ErrorCode PAY_APP_IS_DISABLE = new ErrorCode(1007000002, "App 已经被禁用");
|
||||
ErrorCode PAY_APP_EXIST_TRANSACTION_ORDER_CANT_DELETE = new ErrorCode(1007000003, "支付应用存在交易中的订单,无法删除");
|
||||
|
||||
/**
|
||||
* ========== CHANNEL 模块 1-007-001-000 ==========
|
||||
*/
|
||||
ErrorCode PAY_CHANNEL_NOT_FOUND = new ErrorCode(1007001000, "支付渠道的配置不存在");
|
||||
ErrorCode PAY_CHANNEL_IS_DISABLE = new ErrorCode(1007001001, "支付渠道已经禁用");
|
||||
ErrorCode PAY_CHANNEL_CLIENT_NOT_FOUND = new ErrorCode(1007001002, "支付渠道的客户端不存在");
|
||||
ErrorCode CHANNEL_NOT_EXISTS = new ErrorCode(1007001003, "支付渠道不存在");
|
||||
ErrorCode CHANNEL_EXIST_SAME_CHANNEL_ERROR = new ErrorCode(1007001005, "已存在相同的渠道");
|
||||
ErrorCode CHANNEL_WECHAT_VERSION_2_MCH_KEY_IS_NULL = new ErrorCode(1007001006,"微信渠道v2版本中商户密钥不可为空");
|
||||
ErrorCode CHANNEL_WECHAT_VERSION_3_PRIVATE_KEY_IS_NULL = new ErrorCode(1007001007,"微信渠道v3版本apiclient_key.pem不可为空");
|
||||
ErrorCode CHANNEL_WECHAT_VERSION_3_CERT_KEY_IS_NULL = new ErrorCode(1007001008,"微信渠道v3版本中apiclient_cert.pem不可为空");
|
||||
ErrorCode PAY_CHANNEL_NOTIFY_VERIFY_FAILED = new ErrorCode(1007001009, "渠道通知校验失败");
|
||||
|
||||
// ========== ORDER 模块 1-007-002-000 ==========
|
||||
|
||||
ErrorCode PAY_ORDER_NOT_FOUND = new ErrorCode(1007002000, "支付订单不存在");
|
||||
ErrorCode PAY_ORDER_STATUS_IS_NOT_WAITING = new ErrorCode(1007002001, "支付订单不处于待支付");
|
||||
ErrorCode PAY_ORDER_STATUS_IS_NOT_SUCCESS = new ErrorCode(1007002002, "支付订单不处于已支付");
|
||||
ErrorCode PAY_ORDER_ERROR_USER = new ErrorCode(1007002003, "支付订单用户不正确");
|
||||
|
||||
/**
|
||||
* ========== ORDER 模块(拓展单) 1-007-003-000 ==========
|
||||
*/
|
||||
ErrorCode PAY_ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在");
|
||||
ErrorCode PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING = new ErrorCode(1007003001, "支付交易拓展单不处于待支付");
|
||||
ErrorCode PAY_ORDER_EXTENSION_STATUS_IS_NOT_SUCCESS = new ErrorCode(1007003002, "支付订单不处于已支付");
|
||||
|
||||
// ========== 支付模块(退款) 1-007-006-000 ==========
|
||||
ErrorCode PAY_REFUND_AMOUNT_EXCEED = new ErrorCode(1007006000, "退款金额超过订单可退款金额");
|
||||
ErrorCode PAY_REFUND_ALL_REFUNDED = new ErrorCode(1007006001, "订单已经全额退款");
|
||||
ErrorCode PAY_REFUND_CHN_ORDER_NO_IS_NULL = new ErrorCode(1007006002, "该订单的渠道订单为空");
|
||||
ErrorCode PAY_REFUND_SUCCEED = new ErrorCode(1007006003, "已经退款成功");
|
||||
ErrorCode PAY_REFUND_NOT_FOUND = new ErrorCode(1007006004, "支付退款单不存在");
|
||||
|
||||
/**
|
||||
* ========== 支付商户信息 1-007-004-000 ==========
|
||||
*/
|
||||
ErrorCode PAY_MERCHANT_NOT_EXISTS = new ErrorCode(1007004000, "支付商户信息不存在");
|
||||
ErrorCode PAY_MERCHANT_EXIST_APP_CANT_DELETE = new ErrorCode(1007004001, "支付商户存在支付应用,无法删除");
|
||||
|
||||
// ========== 示例订单 1-007-900-000 ==========
|
||||
ErrorCode PAY_DEMO_ORDER_NOT_FOUND = new ErrorCode(100790000, "示例订单不存在");
|
||||
ErrorCode PAY_DEMO_ORDER_UPDATE_PAID_STATUS_NOT_UNPAID = new ErrorCode(100790001, "示例订单更新支付状态失败,订单不是【未支付】状态");
|
||||
ErrorCode PAY_DEMO_ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR = new ErrorCode(100790002, "示例订单更新支付状态失败,支付单编号不匹配");
|
||||
ErrorCode PAY_DEMO_ORDER_UPDATE_PAID_FAIL_PAY_ORDER_STATUS_NOT_SUCCESS = new ErrorCode(100790003, "示例订单更新支付状态失败,支付单状态不是【支付成功】状态");
|
||||
ErrorCode PAY_DEMO_ORDER_UPDATE_PAID_FAIL_PAY_PRICE_NOT_MATCH = new ErrorCode(100790004, "示例订单更新支付状态失败,支付单金额不匹配");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_NOT_PAID = new ErrorCode(100790005, "发起退款失败,示例订单未支付");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUNDED = new ErrorCode(100790006, "发起退款失败,示例订单已退款");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUND_NOT_FOUND = new ErrorCode(100790007, "发起退款失败,退款订单不存在");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUND_NOT_SUCCESS = new ErrorCode(100790008, "发起退款失败,退款订单未退款成功");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUND_ORDER_ID_ERROR = new ErrorCode(100790008, "发起退款失败,退款单编号不匹配");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUND_PRICE_NOT_MATCH = new ErrorCode(100790004, "发起退款失败,退款单金额不匹配");
|
||||
|
||||
// ========== 支付服务商配置 TODO 补充编号 ==========
|
||||
ErrorCode MERCHANT_DETAILS_NOT_EXISTS = new ErrorCode(1008009000, "支付服务商配置不存在");
|
||||
}
|
||||
|
||||
|
@ -1,41 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.enums.order;
|
||||
|
||||
import co.yixiang.yshop.framework.common.core.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 支付订单的状态枚举
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PayOrderStatusEnum implements IntArrayValuable {
|
||||
|
||||
WAITING(0, "未支付"),
|
||||
SUCCESS(10, "支付成功"),
|
||||
CLOSED(20, "支付关闭"), // 未付款交易超时关闭,或支付完成后全额退款 TODO yshop:需要优化下
|
||||
;
|
||||
|
||||
private final Integer status;
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否支付成功
|
||||
*
|
||||
* @param status 状态
|
||||
* @return 是否支付成功
|
||||
*/
|
||||
public static boolean isSuccess(Integer status) {
|
||||
return Objects.equals(status, SUCCESS.getStatus());
|
||||
}
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.enums.refund;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PayRefundStatusEnum {
|
||||
|
||||
CREATE(0, "退款订单生成"),
|
||||
SUCCESS(1, "退款成功"),
|
||||
FAILURE(2, "退款失败"),
|
||||
CLOSE(99, "退款关闭");
|
||||
|
||||
private final Integer status;
|
||||
private final String name;
|
||||
|
||||
public static boolean isSuccess(Integer status) {
|
||||
return Objects.equals(status, SUCCESS.getStatus());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package co.yixiang.yshop.module.pay.mq.message;
|
||||
|
||||
import co.yixiang.yshop.framework.mq.core.stream.AbstractStreamMessage;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class PayNoticeMessage extends AbstractStreamMessage {
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
@NotNull(message = "订单编号编号不能为空")
|
||||
private String orderId;
|
||||
|
||||
//支付类型
|
||||
private String payType;
|
||||
|
||||
@Override
|
||||
public String getStreamKey() {
|
||||
return "order.pay.notice";
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package co.yixiang.yshop.module.pay.mq.producer;
|
||||
|
||||
import co.yixiang.yshop.framework.mq.core.RedisMQTemplate;
|
||||
import co.yixiang.yshop.module.pay.mq.message.PayNoticeMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PayNoticeProducer {
|
||||
@Resource
|
||||
private RedisMQTemplate redisMQTemplate;
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
* @param orderId 订单编号
|
||||
*/
|
||||
public void sendPayNoticeMessage(String orderId,String payType) {
|
||||
PayNoticeMessage payNoticeMessage = new PayNoticeMessage().setOrderId(orderId).setPayType(payType);
|
||||
redisMQTemplate.send(payNoticeMessage);
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay;
|
@ -29,10 +29,6 @@
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-biz-operatelog</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-biz-pay</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-biz-tenant</artifactId>
|
||||
@ -44,22 +40,12 @@
|
||||
<artifactId>yshop-spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- DB 相关 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Job 定时任务相关 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-job</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 消息队列相关 -->
|
||||
<dependency>
|
||||
@ -80,6 +66,8 @@
|
||||
<artifactId>yshop-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -1,34 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.api.order;
|
||||
|
||||
import co.yixiang.yshop.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
||||
import co.yixiang.yshop.module.pay.api.order.dto.PayOrderRespDTO;
|
||||
import co.yixiang.yshop.module.pay.convert.order.PayOrderConvert;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.order.PayOrderDO;
|
||||
import co.yixiang.yshop.module.pay.service.order.PayOrderService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 支付单 API 实现类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Service
|
||||
public class PayOrderApiImpl implements PayOrderApi {
|
||||
|
||||
@Resource
|
||||
private PayOrderService payOrderService;
|
||||
|
||||
@Override
|
||||
public Long createOrder(PayOrderCreateReqDTO reqDTO) {
|
||||
return payOrderService.createPayOrder(reqDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayOrderRespDTO getOrder(Long id) {
|
||||
PayOrderDO order = payOrderService.getOrder(id);
|
||||
return PayOrderConvert.INSTANCE.convert2(order);
|
||||
}
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.api.refund;
|
||||
|
||||
import co.yixiang.yshop.module.pay.api.refund.dto.PayRefundCreateReqDTO;
|
||||
import co.yixiang.yshop.module.pay.api.refund.dto.PayRefundRespDTO;
|
||||
import co.yixiang.yshop.module.pay.service.refund.PayRefundService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 退款单 API 实现类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PayRefundApiImpl implements PayRefundApi {
|
||||
|
||||
@Resource
|
||||
private PayRefundService payRefundService;
|
||||
|
||||
@Override
|
||||
public Long createPayRefund(PayRefundCreateReqDTO reqDTO) {
|
||||
return payRefundService.createPayRefund(reqDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayRefundRespDTO getPayRefund(Long id) {
|
||||
// TODO yshop:暂未实现
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.demo;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import co.yixiang.yshop.module.pay.api.notify.dto.PayOrderNotifyReqDTO;
|
||||
import co.yixiang.yshop.module.pay.api.notify.dto.PayRefundNotifyReqDTO;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.demo.vo.PayDemoOrderCreateReqVO;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.demo.vo.PayDemoOrderRespVO;
|
||||
import co.yixiang.yshop.module.pay.convert.demo.PayDemoOrderConvert;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.demo.PayDemoOrderDO;
|
||||
import co.yixiang.yshop.module.pay.service.demo.PayDemoOrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
import static co.yixiang.yshop.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||
import static co.yixiang.yshop.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "管理后台 - 示例订单")
|
||||
@RestController
|
||||
@RequestMapping("/pay/demo-order")
|
||||
@Validated
|
||||
public class PayDemoOrderController {
|
||||
|
||||
@Resource
|
||||
private PayDemoOrderService payDemoOrderService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建示例订单")
|
||||
public CommonResult<Long> createDemoOrder(@Valid @RequestBody PayDemoOrderCreateReqVO createReqVO) {
|
||||
return success(payDemoOrderService.createDemoOrder(getLoginUserId(), createReqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得示例订单分页")
|
||||
public CommonResult<PageResult<PayDemoOrderRespVO>> getDemoOrderPage(@Valid PageParam pageVO) {
|
||||
PageResult<PayDemoOrderDO> pageResult = payDemoOrderService.getDemoOrderPage(pageVO);
|
||||
return success(PayDemoOrderConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@PostMapping("/update-paid")
|
||||
@Operation(summary = "更新示例订单为已支付") // 由 pay-module 支付服务,进行回调,可见 PayNotifyJob
|
||||
@PermitAll // 无需登录,安全由 PayDemoOrderService 内部校验实现
|
||||
@OperateLog(enable = false) // 禁用操作日志,因为没有操作人
|
||||
public CommonResult<Boolean> updateDemoOrderPaid(@RequestBody PayOrderNotifyReqDTO notifyReqDTO) {
|
||||
payDemoOrderService.updateDemoOrderPaid(Long.valueOf(notifyReqDTO.getMerchantOrderId()),
|
||||
notifyReqDTO.getPayOrderId());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/refund")
|
||||
@Operation(summary = "发起示例订单的退款")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<Boolean> refundDemoOrder(@RequestParam("id") Long id) {
|
||||
payDemoOrderService.refundDemoOrder(id, getClientIP());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/update-refunded")
|
||||
@Operation(summary = "更新示例订单为已退款") // 由 pay-module 支付服务,进行回调,可见 PayNotifyJob
|
||||
@PermitAll // 无需登录,安全由 PayDemoOrderService 内部校验实现
|
||||
@OperateLog(enable = false) // 禁用操作日志,因为没有操作人
|
||||
public CommonResult<Boolean> updateDemoOrderRefunded(@RequestBody PayRefundNotifyReqDTO notifyReqDTO) {
|
||||
payDemoOrderService.updateDemoOrderRefunded(Long.valueOf(notifyReqDTO.getMerchantOrderId()),
|
||||
notifyReqDTO.getPayRefundId());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.demo.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 示例订单创建 Request VO")
|
||||
@Data
|
||||
public class PayDemoOrderCreateReqVO {
|
||||
|
||||
@Schema(description = "商品编号", required = true, example = "17682")
|
||||
@NotNull(message = "商品编号不能为空")
|
||||
private Long spuId;
|
||||
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.demo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 示例订单 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class PayDemoOrderRespVO {
|
||||
|
||||
@Schema(description = "订单编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号", required = true, example = "23199")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "商品编号", required = true, example = "17682")
|
||||
private Long spuId;
|
||||
|
||||
@Schema(description = "商家备注", example = "李四")
|
||||
private String spuName;
|
||||
|
||||
@Schema(description = "价格,单位:分", required = true, example = "30381")
|
||||
private Integer price;
|
||||
|
||||
@Schema(description = "是否已支付", required = true)
|
||||
private Boolean payed;
|
||||
|
||||
@Schema(description = "支付订单编号", example = "16863")
|
||||
private Long payOrderId;
|
||||
|
||||
@Schema(description = "订单支付时间")
|
||||
private LocalDateTime payTime;
|
||||
|
||||
@Schema(description = "支付渠道", example = "alipay_qr")
|
||||
private String payChannelCode;
|
||||
|
||||
@Schema(description = "支付退款编号", example = "23366")
|
||||
private Long payRefundId;
|
||||
|
||||
@Schema(description = "退款金额,单位:分", required = true, example = "14039")
|
||||
private Integer refundPrice;
|
||||
|
||||
@Schema(description = "退款时间")
|
||||
private LocalDateTime refundTime;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,163 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.common.util.collection.CollectionUtils;
|
||||
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import co.yixiang.yshop.framework.pay.core.enums.PayChannelEnum;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchant.vo.app.*;
|
||||
import co.yixiang.yshop.module.pay.convert.app.PayAppConvert;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchant.PayAppDO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchant.PayChannelDO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
||||
import co.yixiang.yshop.module.pay.service.merchant.PayAppService;
|
||||
import co.yixiang.yshop.module.pay.service.merchant.PayChannelService;
|
||||
import co.yixiang.yshop.module.pay.service.merchant.PayMerchantService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Slf4j
|
||||
@Tag(name = "管理后台 - 支付应用信息")
|
||||
@RestController
|
||||
@RequestMapping("/pay/app")
|
||||
@Validated
|
||||
public class PayAppController {
|
||||
|
||||
@Resource
|
||||
private PayAppService appService;
|
||||
@Resource
|
||||
private PayChannelService channelService;
|
||||
@Resource
|
||||
private PayMerchantService merchantService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建支付应用信息")
|
||||
@PreAuthorize("@ss.hasPermission('pay:app:create')")
|
||||
public CommonResult<Long> createApp(@Valid @RequestBody PayAppCreateReqVO createReqVO) {
|
||||
return success(appService.createApp(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新支付应用信息")
|
||||
@PreAuthorize("@ss.hasPermission('pay:app:update')")
|
||||
public CommonResult<Boolean> updateApp(@Valid @RequestBody PayAppUpdateReqVO updateReqVO) {
|
||||
appService.updateApp(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "更新支付应用状态")
|
||||
@PreAuthorize("@ss.hasPermission('pay:app:update')")
|
||||
public CommonResult<Boolean> updateAppStatus(@Valid @RequestBody PayAppUpdateStatusReqVO updateReqVO) {
|
||||
appService.updateAppStatus(updateReqVO.getId(), updateReqVO.getStatus());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除支付应用信息")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('pay:app:delete')")
|
||||
public CommonResult<Boolean> deleteApp(@RequestParam("id") Long id) {
|
||||
appService.deleteApp(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得支付应用信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('pay:app:query')")
|
||||
public CommonResult<PayAppRespVO> getApp(@RequestParam("id") Long id) {
|
||||
PayAppDO app = appService.getApp(id);
|
||||
return success(PayAppConvert.INSTANCE.convert(app));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得支付应用信息列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('pay:app:query')")
|
||||
public CommonResult<List<PayAppRespVO>> getAppList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<PayAppDO> list = appService.getAppList(ids);
|
||||
return success(PayAppConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得支付应用信息分页")
|
||||
@PreAuthorize("@ss.hasPermission('pay:app:query')")
|
||||
public CommonResult<PageResult<PayAppPageItemRespVO>> getAppPage(@Valid PayAppPageReqVO pageVO) {
|
||||
// 得到应用分页列表
|
||||
PageResult<PayAppDO> pageResult = appService.getAppPage(pageVO);
|
||||
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||
return success(new PageResult<>(pageResult.getTotal()));
|
||||
}
|
||||
|
||||
// 得到所有的应用编号,查出所有的渠道
|
||||
Collection<Long> payAppIds = CollectionUtils.convertList(pageResult.getList(), PayAppDO::getId);
|
||||
List<PayChannelDO> channels = channelService.getChannelListByAppIds(payAppIds);
|
||||
// TODO @aquan:可以基于 appId 简历一个 multiMap。这样下面,直接 get 到之后,CollUtil buildSet 即可
|
||||
Iterator<PayChannelDO> iterator = channels.iterator();
|
||||
|
||||
// 得到所有的商户信息
|
||||
Collection<Long> merchantIds = CollectionUtils.convertList(pageResult.getList(), PayAppDO::getMerchantId);
|
||||
Map<Long, PayMerchantDO> deptMap = merchantService.getMerchantMap(merchantIds);
|
||||
|
||||
// 利用反射将渠道数据复制到返回的数据结构中去
|
||||
List<PayAppPageItemRespVO> appList = new ArrayList<>(pageResult.getList().size());
|
||||
pageResult.getList().forEach(app -> {
|
||||
// 写入应用信息的数据
|
||||
PayAppPageItemRespVO respVO = PayAppConvert.INSTANCE.pageConvert(app);
|
||||
// 写入商户的数据
|
||||
respVO.setPayMerchant(PayAppConvert.INSTANCE.convert(deptMap.get(app.getMerchantId())));
|
||||
// 写入支付渠道信息的数据
|
||||
Set<String> channelCodes = new HashSet<>(PayChannelEnum.values().length);
|
||||
while (iterator.hasNext()) {
|
||||
PayChannelDO channelDO = iterator.next();
|
||||
if (channelDO.getAppId().equals(app.getId())) {
|
||||
channelCodes.add(channelDO.getCode());
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
respVO.setChannelCodes(channelCodes);
|
||||
appList.add(respVO);
|
||||
});
|
||||
|
||||
return success(new PageResult<>(appList, pageResult.getTotal()));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出支付应用信息 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('pay:app:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportAppExcel(@Valid PayAppExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<PayAppDO> list = appService.getAppList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<PayAppExcelVO> datas = PayAppConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "支付应用信息.xls", "数据", PayAppExcelVO.class, datas);
|
||||
}
|
||||
|
||||
@GetMapping("/list-merchant-id")
|
||||
@Operation(summary = "根据商户 ID 查询支付应用信息")
|
||||
@Parameter(name = "merchantId", description = "商户ID", required = true, example = "1")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant:query')")
|
||||
public CommonResult<List<PayAppRespVO>> getMerchantListByName(@RequestParam Long merchantId) {
|
||||
List<PayAppDO> appListDO = appService.getListByMerchantId(merchantId);
|
||||
return success(PayAppConvert.INSTANCE.convertList(appListDO));
|
||||
}
|
||||
|
||||
}
|
@ -1,124 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant;
|
||||
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchant.vo.channel.*;
|
||||
import co.yixiang.yshop.module.pay.convert.channel.PayChannelConvert;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchant.PayChannelDO;
|
||||
import co.yixiang.yshop.module.pay.service.merchant.PayChannelService;
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 支付渠道")
|
||||
@RestController
|
||||
@RequestMapping("/pay/channel")
|
||||
@Validated
|
||||
public class PayChannelController {
|
||||
|
||||
@Resource
|
||||
private PayChannelService channelService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建支付渠道 ")
|
||||
@PreAuthorize("@ss.hasPermission('pay:channel:create')")
|
||||
public CommonResult<Long> createChannel(@Valid @RequestBody PayChannelCreateReqVO createReqVO) {
|
||||
return success(channelService.createChannel(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新支付渠道 ")
|
||||
@PreAuthorize("@ss.hasPermission('pay:channel:update')")
|
||||
public CommonResult<Boolean> updateChannel(@Valid @RequestBody PayChannelUpdateReqVO updateReqVO) {
|
||||
channelService.updateChannel(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除支付渠道 ")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('pay:channel:delete')")
|
||||
public CommonResult<Boolean> deleteChannel(@RequestParam("id") Long id) {
|
||||
channelService.deleteChannel(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得支付渠道 ")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('pay:channel:query')")
|
||||
public CommonResult<PayChannelRespVO> getChannel(@RequestParam("id") Long id) {
|
||||
PayChannelDO channel = channelService.getChannel(id);
|
||||
return success(PayChannelConvert.INSTANCE.convert(channel));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得支付渠道列表")
|
||||
@Parameter(name = "ids", description = "编号列表",
|
||||
required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('pay:channel:query')")
|
||||
public CommonResult<List<PayChannelRespVO>> getChannelList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<PayChannelDO> list = channelService.getChannelList(ids);
|
||||
return success(PayChannelConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得支付渠道分页")
|
||||
@PreAuthorize("@ss.hasPermission('pay:channel:query')")
|
||||
public CommonResult<PageResult<PayChannelRespVO>> getChannelPage(@Valid PayChannelPageReqVO pageVO) {
|
||||
PageResult<PayChannelDO> pageResult = channelService.getChannelPage(pageVO);
|
||||
return success(PayChannelConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出支付渠道Excel")
|
||||
@PreAuthorize("@ss.hasPermission('pay:channel:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportChannelExcel(@Valid PayChannelExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<PayChannelDO> list = channelService.getChannelList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<PayChannelExcelVO> datas = PayChannelConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "支付渠道.xls", "数据", PayChannelExcelVO.class, datas);
|
||||
}
|
||||
|
||||
@GetMapping("/get-channel")
|
||||
@Operation(summary = "根据条件查询微信支付渠道")
|
||||
@Parameters({
|
||||
@Parameter(name = "merchantId", description = "商户编号",
|
||||
required = true, example = "1"),
|
||||
@Parameter(name = "appId", description = "应用编号",
|
||||
required = true, example = "1"),
|
||||
@Parameter(name = "code", description = "支付渠道编码",
|
||||
required = true, example = "wx_pub")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('pay:channel:query')")
|
||||
public CommonResult<PayChannelRespVO> getChannel(
|
||||
@RequestParam Long merchantId, @RequestParam Long appId, @RequestParam String code) {
|
||||
// 獲取渠道
|
||||
PayChannelDO channel = channelService.getChannelByConditions(merchantId, appId, code);
|
||||
if (channel == null) {
|
||||
return success(new PayChannelRespVO());
|
||||
}
|
||||
// 拼凑数据
|
||||
PayChannelRespVO respVo = PayChannelConvert.INSTANCE.convert(channel);
|
||||
return success(respVo);
|
||||
}
|
||||
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant;
|
||||
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchant.vo.merchant.*;
|
||||
import co.yixiang.yshop.module.pay.convert.merchant.PayMerchantConvert;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
||||
import co.yixiang.yshop.module.pay.service.merchant.PayMerchantService;
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "支付商户信息")
|
||||
@RestController
|
||||
@RequestMapping("/pay/merchant")
|
||||
@Validated
|
||||
public class PayMerchantController {
|
||||
|
||||
@Resource
|
||||
private PayMerchantService merchantService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建支付商户信息")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant:create')")
|
||||
public CommonResult<Long> createMerchant(@Valid @RequestBody PayMerchantCreateReqVO createReqVO) {
|
||||
return success(merchantService.createMerchant(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新支付商户信息")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant:update')")
|
||||
public CommonResult<Boolean> updateMerchant(@Valid @RequestBody PayMerchantUpdateReqVO updateReqVO) {
|
||||
merchantService.updateMerchant(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "修改支付商户状态")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant:update')")
|
||||
public CommonResult<Boolean> updateMerchantStatus(@Valid @RequestBody PayMerchantUpdateStatusReqVO reqVO) {
|
||||
merchantService.updateMerchantStatus(reqVO.getId(), reqVO.getStatus());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除支付商户信息")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant:delete')")
|
||||
public CommonResult<Boolean> deleteMerchant(@RequestParam("id") Long id) {
|
||||
merchantService.deleteMerchant(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得支付商户信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant:query')")
|
||||
public CommonResult<PayMerchantRespVO> getMerchant(@RequestParam("id") Long id) {
|
||||
PayMerchantDO merchant = merchantService.getMerchant(id);
|
||||
return success(PayMerchantConvert.INSTANCE.convert(merchant));
|
||||
}
|
||||
|
||||
@GetMapping("/list-by-name")
|
||||
@Operation(summary = "根据商户名称获得支付商户信息列表")
|
||||
@Parameter(name = "name", description = "商户名称", example = "yshop")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant:query')")
|
||||
public CommonResult<List<PayMerchantRespVO>> getMerchantListByName(@RequestParam(required = false) String name) {
|
||||
List<PayMerchantDO> merchantListDO = merchantService.getMerchantListByName(name);
|
||||
return success(PayMerchantConvert.INSTANCE.convertList(merchantListDO));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得支付商户信息列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant:query')")
|
||||
public CommonResult<List<PayMerchantRespVO>> getMerchantList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<PayMerchantDO> list = merchantService.getMerchantList(ids);
|
||||
return success(PayMerchantConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得支付商户信息分页")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant:query')")
|
||||
public CommonResult<PageResult<PayMerchantRespVO>> getMerchantPage(@Valid PayMerchantPageReqVO pageVO) {
|
||||
PageResult<PayMerchantDO> pageResult = merchantService.getMerchantPage(pageVO);
|
||||
return success(PayMerchantConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出支付商户信息 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportMerchantExcel(@Valid PayMerchantExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<PayMerchantDO> list = merchantService.getMerchantList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<PayMerchantExcelVO> datas = PayMerchantConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "支付商户信息.xls", "数据", PayMerchantExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.app;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 支付应用信息 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class PayAppBaseVO {
|
||||
|
||||
@Schema(description = "应用名", required = true)
|
||||
@NotNull(message = "应用名不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "开启状态", required = true)
|
||||
@NotNull(message = "开启状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "支付结果的回调地址", required = true)
|
||||
@NotNull(message = "支付结果的回调地址不能为空")
|
||||
private String payNotifyUrl;
|
||||
|
||||
@Schema(description = "退款结果的回调地址", required = true)
|
||||
@NotNull(message = "退款结果的回调地址不能为空")
|
||||
private String refundNotifyUrl;
|
||||
|
||||
@Schema(description = "商户编号", required = true)
|
||||
@NotNull(message = "商户编号不能为空")
|
||||
private Long merchantId;
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.app;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@Schema(description = "管理后台 - 支付应用信息创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayAppCreateReqVO extends PayAppBaseVO {
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.app;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 支付应用信息 Excel VO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Data
|
||||
public class PayAppExcelVO {
|
||||
|
||||
@ExcelProperty("应用编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("应用名")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("开启状态")
|
||||
private Integer status;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("支付结果的回调地址")
|
||||
private String payNotifyUrl;
|
||||
|
||||
@ExcelProperty("退款结果的回调地址")
|
||||
private String refundNotifyUrl;
|
||||
|
||||
@ExcelProperty("商户编号")
|
||||
private Long merchantId;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.app;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 支付应用信息 Excel 导出 Request VO,参数和 PayAppPageReqVO 是一致的")
|
||||
@Data
|
||||
public class PayAppExportReqVO {
|
||||
|
||||
@Schema(description = "应用名")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "开启状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "支付结果的回调地址")
|
||||
private String payNotifyUrl;
|
||||
|
||||
@Schema(description = "退款结果的回调地址")
|
||||
private String refundNotifyUrl;
|
||||
|
||||
@Schema(description = "商户名称")
|
||||
private String merchantName;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.app;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "管理后台 - 支付应用信息分页查询 Response VO,相比于支付信息,还会多出应用渠道的开关信息")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayAppPageItemRespVO extends PayAppBaseVO {
|
||||
|
||||
@Schema(description = "应用编号", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 所属商户
|
||||
*/
|
||||
private PayMerchant payMerchant;
|
||||
|
||||
@Schema(description = "商户")
|
||||
@Data
|
||||
public static class PayMerchant {
|
||||
|
||||
@Schema(description = "商户编号", required = true, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "商户名称", required = true, example = "研发部")
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
||||
@Schema(description = "渠道编码集合", required = true, example = "alipay_pc,alipay_wap...")
|
||||
private Set<String> channelCodes;
|
||||
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.app;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.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 PayAppPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "应用名")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "开启状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "支付结果的回调地址")
|
||||
private String payNotifyUrl;
|
||||
|
||||
@Schema(description = "退款结果的回调地址")
|
||||
private String refundNotifyUrl;
|
||||
|
||||
@Schema(description = "商户名称")
|
||||
private String merchantName;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.app;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 支付应用信息 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayAppRespVO extends PayAppBaseVO {
|
||||
|
||||
@Schema(description = "应用编号", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.app;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 支付应用信息更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayAppUpdateReqVO extends PayAppBaseVO {
|
||||
|
||||
@Schema(description = "应用编号", required = true)
|
||||
@NotNull(message = "应用编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.app;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 应用更新状态 Request VO")
|
||||
@Data
|
||||
public class PayAppUpdateStatusReqVO {
|
||||
|
||||
@Schema(description = "商户编号", required = true, example = "1024")
|
||||
@NotNull(message = "商户编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "状态,见 SysCommonStatusEnum 枚举", required = true, example = "1")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.channel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 支付渠道 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class PayChannelBaseVO {
|
||||
|
||||
@Schema(description = "渠道编码", required = true)
|
||||
@NotNull(message = "渠道编码不能为空")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "开启状态", required = true)
|
||||
@NotNull(message = "开启状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "渠道费率,单位:百分比", required = true)
|
||||
@NotNull(message = "渠道费率,单位:百分比不能为空")
|
||||
private Double feeRate;
|
||||
|
||||
@Schema(description = "商户编号", required = true)
|
||||
@NotNull(message = "商户编号不能为空")
|
||||
private Long merchantId;
|
||||
|
||||
@Schema(description = "应用编号", required = true)
|
||||
@NotNull(message = "应用编号不能为空")
|
||||
private Long appId;
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.channel;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Schema(description = "管理后台 - 支付渠道 创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayChannelCreateReqVO extends PayChannelBaseVO {
|
||||
|
||||
@Schema(description = "渠道配置的 json 字符串")
|
||||
@NotBlank(message = "渠道配置不能为空")
|
||||
private String config;
|
||||
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.channel;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 支付渠道 Excel VO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Data
|
||||
public class PayChannelExcelVO {
|
||||
|
||||
@ExcelProperty("商户编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("渠道编码")
|
||||
private String code;
|
||||
|
||||
@ExcelProperty("开启状态")
|
||||
private Integer status;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("渠道费率,单位:百分比")
|
||||
private Double feeRate;
|
||||
|
||||
@ExcelProperty("商户编号")
|
||||
private Long merchantId;
|
||||
|
||||
@ExcelProperty("应用编号")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* todo @yshop mapStruct 存在转换问题
|
||||
* java: Can't map property "PayClientConfig payChannelDO.config" to "String payChannelExcelVO.config".
|
||||
* Consider to declare/implement a mapping method: "String map(PayClientConfig value)".
|
||||
*/
|
||||
/// @ExcelProperty("支付渠道配置")
|
||||
/// private String config;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.channel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 支付渠道 Excel 导出 Request VO,参数和 PayChannelPageReqVO 是一致的")
|
||||
@Data
|
||||
public class PayChannelExportReqVO {
|
||||
|
||||
@Schema(description = "渠道编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "开启状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "渠道费率,单位:百分比")
|
||||
private Double feeRate;
|
||||
|
||||
@Schema(description = "商户编号")
|
||||
private Long merchantId;
|
||||
|
||||
@Schema(description = "应用编号")
|
||||
private Long appId;
|
||||
|
||||
@Schema(description = "支付渠道配置")
|
||||
private String config;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.channel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.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 PayChannelPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "渠道编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "开启状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "渠道费率,单位:百分比")
|
||||
private Double feeRate;
|
||||
|
||||
@Schema(description = "商户编号")
|
||||
private Long merchantId;
|
||||
|
||||
@Schema(description = "应用编号")
|
||||
private Long appId;
|
||||
|
||||
@Schema(description = "支付渠道配置")
|
||||
private String config;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.channel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 支付渠道 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayChannelRespVO extends PayChannelBaseVO {
|
||||
|
||||
@Schema(description = "商户编号", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "配置", required = true)
|
||||
private String config;
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.channel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 支付渠道 更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayChannelUpdateReqVO extends PayChannelBaseVO {
|
||||
|
||||
@Schema(description = "商户编号", required = true)
|
||||
@NotNull(message = "商户编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "渠道配置的json字符串")
|
||||
@NotBlank(message = "渠道配置不能为空")
|
||||
private String config;
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.merchant;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 支付商户信息 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class PayMerchantBaseVO {
|
||||
|
||||
@Schema(description = "商户全称", required = true)
|
||||
@NotNull(message = "商户全称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "商户简称", required = true)
|
||||
@NotNull(message = "商户简称不能为空")
|
||||
private String shortName;
|
||||
|
||||
@Schema(description = "开启状态", required = true)
|
||||
@NotNull(message = "开启状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.merchant;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@Schema(description = "管理后台 - 支付商户信息创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayMerchantCreateReqVO extends PayMerchantBaseVO {
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.merchant;
|
||||
|
||||
import co.yixiang.yshop.framework.excel.core.annotations.DictFormat;
|
||||
import co.yixiang.yshop.framework.excel.core.convert.DictConvert;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 支付商户信息 Excel VO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Data
|
||||
public class PayMerchantExcelVO {
|
||||
|
||||
@ExcelProperty("商户编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("商户号")
|
||||
private String no;
|
||||
|
||||
@ExcelProperty("商户全称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("商户简称")
|
||||
private String shortName;
|
||||
|
||||
@ExcelProperty(value = "开启状态",converter = DictConvert.class)
|
||||
@DictFormat("sys_common_status")
|
||||
private Integer status;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.merchant;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 支付商户信息 Excel 导出 Request VO,参数和 PayMerchantPageReqVO 是一致的")
|
||||
@Data
|
||||
public class PayMerchantExportReqVO {
|
||||
|
||||
@Schema(description = "商户号")
|
||||
private String no;
|
||||
|
||||
@Schema(description = "商户全称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "商户简称")
|
||||
private String shortName;
|
||||
|
||||
@Schema(description = "开启状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.merchant;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.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 PayMerchantPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "商户号")
|
||||
private String no;
|
||||
|
||||
@Schema(description = "商户全称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "商户简称")
|
||||
private String shortName;
|
||||
|
||||
@Schema(description = "开启状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.merchant;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 支付商户信息 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayMerchantRespVO extends PayMerchantBaseVO {
|
||||
|
||||
@Schema(description = "商户编号", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "商户号", required = true, example = "M233666999")
|
||||
private String no;
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.merchant;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 支付商户信息更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayMerchantUpdateReqVO extends PayMerchantBaseVO {
|
||||
|
||||
@Schema(description = "商户编号", required = true)
|
||||
@NotNull(message = "商户编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchant.vo.merchant;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 商户更新状态 Request VO")
|
||||
@Data
|
||||
public class PayMerchantUpdateStatusReqVO {
|
||||
|
||||
@Schema(description = "商户编号", required = true, example = "1024")
|
||||
@NotNull(message = "商户编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "状态,见 SysCommonStatusEnum 枚举", required = true, example = "1")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchantdetails;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchantdetails.vo.*;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchantdetails.MerchantDetailsDO;
|
||||
import co.yixiang.yshop.module.pay.convert.merchantdetails.MerchantDetailsConvert;
|
||||
import co.yixiang.yshop.module.pay.service.merchantdetails.MerchantDetailsService;
|
||||
|
||||
@Tag(name = "管理后台 - 支付服务商配置")
|
||||
@RestController
|
||||
@RequestMapping("/pay/merchant-details")
|
||||
@Validated
|
||||
public class MerchantDetailsController {
|
||||
|
||||
@Resource
|
||||
private MerchantDetailsService merchantDetailsService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建支付服务商配置")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant-details:create')")
|
||||
public CommonResult<String> createMerchantDetails(@Valid @RequestBody MerchantDetailsCreateReqVO createReqVO) {
|
||||
return success(merchantDetailsService.createMerchantDetails(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新支付服务商配置")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant-details:update')")
|
||||
public CommonResult<Boolean> updateMerchantDetails(@Valid @RequestBody MerchantDetailsUpdateReqVO updateReqVO) {
|
||||
merchantDetailsService.updateMerchantDetails(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除支付服务商配置")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant-details:delete')")
|
||||
public CommonResult<Boolean> deleteMerchantDetails(@RequestParam("id") String id) {
|
||||
merchantDetailsService.deleteMerchantDetails(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得支付服务商配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant-details:query')")
|
||||
public CommonResult<MerchantDetailsRespVO> getMerchantDetails(@RequestParam("id") String id) {
|
||||
MerchantDetailsDO merchantDetails = merchantDetailsService.getMerchantDetails(id);
|
||||
return success(MerchantDetailsConvert.INSTANCE.convert(merchantDetails));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得支付服务商配置列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant-details:query')")
|
||||
public CommonResult<List<MerchantDetailsRespVO>> getMerchantDetailsList(@RequestParam("ids") Collection<String> ids) {
|
||||
List<MerchantDetailsDO> list = merchantDetailsService.getMerchantDetailsList(ids);
|
||||
return success(MerchantDetailsConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得支付服务商配置分页")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant-details:query')")
|
||||
public CommonResult<PageResult<MerchantDetailsRespVO>> getMerchantDetailsPage(@Valid MerchantDetailsPageReqVO pageVO) {
|
||||
PageResult<MerchantDetailsDO> pageResult = merchantDetailsService.getMerchantDetailsPage(pageVO);
|
||||
return success(MerchantDetailsConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出支付服务商配置 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('pay:merchant-details:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportMerchantDetailsExcel(@Valid MerchantDetailsExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<MerchantDetailsDO> list = merchantDetailsService.getMerchantDetailsList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<MerchantDetailsExcelVO> datas = MerchantDetailsConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "支付服务商配置.xls", "数据", MerchantDetailsExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchantdetails.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 支付服务商配置 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class MerchantDetailsBaseVO {
|
||||
|
||||
@Schema(description = "支付类型(支付渠道) 详情查看com.egzosn.pay.spring.boot.core.merchant.PaymentPlatform对应子类,aliPay 支付宝, wxPay微信..等等", required = true, example = "2")
|
||||
@NotNull(message = "支付类型(支付渠道) 详情查看com.egzosn.pay.spring.boot.core.merchant.PaymentPlatform对应子类,aliPay 支付宝, wxPay微信..等等不能为空")
|
||||
private String payType;
|
||||
|
||||
@Schema(description = "应用id", example = "1718")
|
||||
private String appid;
|
||||
|
||||
@Schema(description = "商户id,商户号,合作伙伴id等等", example = "21574")
|
||||
private String mchId;
|
||||
|
||||
@Schema(description = "当前面私钥公钥为证书类型的时候,这里必填,可选值:PATH,STR,INPUT_STREAM,CLASS_PATH,URL", example = "1")
|
||||
private String certStoreType;
|
||||
|
||||
@Schema(description = "私钥或私钥证书")
|
||||
private String keyPrivate;
|
||||
|
||||
@Schema(description = "公钥或公钥证书")
|
||||
private String keyPublic;
|
||||
|
||||
@Schema(description = "key证书,附加证书使用,如SSL证书,或者银联根级证书方面")
|
||||
private String keyCert;
|
||||
|
||||
@Schema(description = "私钥证书或key证书的密码")
|
||||
private String keyCertPwd;
|
||||
|
||||
@Schema(description = "异步回调", example = "https://www.yixiang.co")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description = "同步回调地址,大部分用于付款成功后页面转跳", example = "https://www.yixiang.co")
|
||||
private String returnUrl;
|
||||
|
||||
@Schema(description = "签名方式,目前已实现多种签名方式详情查看com.egzosn.pay.common.util.sign.encrypt。MD5,RSA等等", required = true, example = "1")
|
||||
@NotNull(message = "签名方式,目前已实现多种签名方式详情查看com.egzosn.pay.common.util.sign.encrypt。MD5,RSA等等不能为空")
|
||||
private String signType;
|
||||
|
||||
@Schema(description = "收款账号,暂时只有支付宝部分使用,可根据开发者自行使用")
|
||||
private String seller;
|
||||
|
||||
@Schema(description = "子appid", example = "13761")
|
||||
private String subAppId;
|
||||
|
||||
@Schema(description = "子商户id", example = "10127")
|
||||
private String subMchId;
|
||||
|
||||
@Schema(description = "编码类型,大部分为utf-8", required = true)
|
||||
@NotNull(message = "编码类型,大部分为utf-8不能为空")
|
||||
private String inputCharset;
|
||||
|
||||
@Schema(description = "是否为测试环境: 0 否,1 测试环境", required = true)
|
||||
@NotNull(message = "是否为测试环境: 0 否,1 测试环境不能为空")
|
||||
private Integer isTest;
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchantdetails.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@Schema(description = "管理后台 - 支付服务商配置创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MerchantDetailsCreateReqVO extends MerchantDetailsBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchantdetails.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 支付服务商配置 Excel VO
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Data
|
||||
public class MerchantDetailsExcelVO {
|
||||
|
||||
@ExcelProperty("列表id")
|
||||
private String detailsId;
|
||||
|
||||
@ExcelProperty("支付类型(支付渠道) 详情查看com.egzosn.pay.spring.boot.core.merchant.PaymentPlatform对应子类,aliPay 支付宝, wxPay微信..等等")
|
||||
private String payType;
|
||||
|
||||
@ExcelProperty("应用id")
|
||||
private String appid;
|
||||
|
||||
@ExcelProperty("商户id,商户号,合作伙伴id等等")
|
||||
private String mchId;
|
||||
|
||||
@ExcelProperty("当前面私钥公钥为证书类型的时候,这里必填,可选值:PATH,STR,INPUT_STREAM,CLASS_PATH,URL")
|
||||
private String certStoreType;
|
||||
|
||||
@ExcelProperty("私钥或私钥证书")
|
||||
private String keyPrivate;
|
||||
|
||||
@ExcelProperty("公钥或公钥证书")
|
||||
private String keyPublic;
|
||||
|
||||
@ExcelProperty("key证书,附加证书使用,如SSL证书,或者银联根级证书方面")
|
||||
private String keyCert;
|
||||
|
||||
@ExcelProperty("私钥证书或key证书的密码")
|
||||
private String keyCertPwd;
|
||||
|
||||
@ExcelProperty("异步回调")
|
||||
private String notifyUrl;
|
||||
|
||||
@ExcelProperty("同步回调地址,大部分用于付款成功后页面转跳")
|
||||
private String returnUrl;
|
||||
|
||||
@ExcelProperty("签名方式,目前已实现多种签名方式详情查看com.egzosn.pay.common.util.sign.encrypt。MD5,RSA等等")
|
||||
private String signType;
|
||||
|
||||
@ExcelProperty("收款账号,暂时只有支付宝部分使用,可根据开发者自行使用")
|
||||
private String seller;
|
||||
|
||||
@ExcelProperty("子appid")
|
||||
private String subAppId;
|
||||
|
||||
@ExcelProperty("子商户id")
|
||||
private String subMchId;
|
||||
|
||||
@ExcelProperty("编码类型,大部分为utf-8")
|
||||
private String inputCharset;
|
||||
|
||||
@ExcelProperty("是否为测试环境: 0 否,1 测试环境")
|
||||
private Integer isTest;
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchantdetails.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@Schema(description = "管理后台 - 支付服务商配置 Excel 导出 Request VO,参数和 MerchantDetailsPageReqVO 是一致的")
|
||||
@Data
|
||||
public class MerchantDetailsExportReqVO {
|
||||
|
||||
@Schema(description = "支付类型(支付渠道) 详情查看com.egzosn.pay.spring.boot.core.merchant.PaymentPlatform对应子类,aliPay 支付宝, wxPay微信..等等", example = "2")
|
||||
private String payType;
|
||||
|
||||
@Schema(description = "应用id", example = "1718")
|
||||
private String appid;
|
||||
|
||||
@Schema(description = "商户id,商户号,合作伙伴id等等", example = "21574")
|
||||
private String mchId;
|
||||
|
||||
@Schema(description = "当前面私钥公钥为证书类型的时候,这里必填,可选值:PATH,STR,INPUT_STREAM,CLASS_PATH,URL", example = "1")
|
||||
private String certStoreType;
|
||||
|
||||
@Schema(description = "私钥或私钥证书")
|
||||
private String keyPrivate;
|
||||
|
||||
@Schema(description = "公钥或公钥证书")
|
||||
private String keyPublic;
|
||||
|
||||
@Schema(description = "key证书,附加证书使用,如SSL证书,或者银联根级证书方面")
|
||||
private String keyCert;
|
||||
|
||||
@Schema(description = "私钥证书或key证书的密码")
|
||||
private String keyCertPwd;
|
||||
|
||||
@Schema(description = "异步回调", example = "https://www.yixiang.co")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description = "同步回调地址,大部分用于付款成功后页面转跳", example = "https://www.yixiang.co")
|
||||
private String returnUrl;
|
||||
|
||||
@Schema(description = "签名方式,目前已实现多种签名方式详情查看com.egzosn.pay.common.util.sign.encrypt。MD5,RSA等等", example = "1")
|
||||
private String signType;
|
||||
|
||||
@Schema(description = "收款账号,暂时只有支付宝部分使用,可根据开发者自行使用")
|
||||
private String seller;
|
||||
|
||||
@Schema(description = "子appid", example = "13761")
|
||||
private String subAppId;
|
||||
|
||||
@Schema(description = "子商户id", example = "10127")
|
||||
private String subMchId;
|
||||
|
||||
@Schema(description = "编码类型,大部分为utf-8")
|
||||
private String inputCharset;
|
||||
|
||||
@Schema(description = "是否为测试环境: 0 否,1 测试环境")
|
||||
private Boolean isTest;
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchantdetails.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
|
||||
@Schema(description = "管理后台 - 支付服务商配置分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MerchantDetailsPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "支付类型(支付渠道) 详情查看com.egzosn.pay.spring.boot.core.merchant.PaymentPlatform对应子类,aliPay 支付宝, wxPay微信..等等", example = "2")
|
||||
private String payType;
|
||||
|
||||
@Schema(description = "应用id", example = "1718")
|
||||
private String appid;
|
||||
|
||||
@Schema(description = "商户id,商户号,合作伙伴id等等", example = "21574")
|
||||
private String mchId;
|
||||
|
||||
@Schema(description = "当前面私钥公钥为证书类型的时候,这里必填,可选值:PATH,STR,INPUT_STREAM,CLASS_PATH,URL", example = "1")
|
||||
private String certStoreType;
|
||||
|
||||
@Schema(description = "私钥或私钥证书")
|
||||
private String keyPrivate;
|
||||
|
||||
@Schema(description = "公钥或公钥证书")
|
||||
private String keyPublic;
|
||||
|
||||
@Schema(description = "key证书,附加证书使用,如SSL证书,或者银联根级证书方面")
|
||||
private String keyCert;
|
||||
|
||||
@Schema(description = "私钥证书或key证书的密码")
|
||||
private String keyCertPwd;
|
||||
|
||||
@Schema(description = "异步回调", example = "https://www.yixiang.co")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description = "同步回调地址,大部分用于付款成功后页面转跳", example = "https://www.yixiang.co")
|
||||
private String returnUrl;
|
||||
|
||||
@Schema(description = "签名方式,目前已实现多种签名方式详情查看com.egzosn.pay.common.util.sign.encrypt。MD5,RSA等等", example = "1")
|
||||
private String signType;
|
||||
|
||||
@Schema(description = "收款账号,暂时只有支付宝部分使用,可根据开发者自行使用")
|
||||
private String seller;
|
||||
|
||||
@Schema(description = "子appid", example = "13761")
|
||||
private String subAppId;
|
||||
|
||||
@Schema(description = "子商户id", example = "10127")
|
||||
private String subMchId;
|
||||
|
||||
@Schema(description = "编码类型,大部分为utf-8")
|
||||
private String inputCharset;
|
||||
|
||||
@Schema(description = "是否为测试环境: 0 否,1 测试环境")
|
||||
private Boolean isTest;
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchantdetails.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@Schema(description = "管理后台 - 支付服务商配置 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MerchantDetailsRespVO extends MerchantDetailsBaseVO {
|
||||
|
||||
@Schema(description = "列表id", required = true, example = "17552")
|
||||
private String detailsId;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.merchantdetails.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 支付服务商配置更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MerchantDetailsUpdateReqVO extends MerchantDetailsBaseVO {
|
||||
|
||||
@Schema(description = "列表id", required = true, example = "17552")
|
||||
@NotNull(message = "列表id不能为空")
|
||||
private String detailsId;
|
||||
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.notify;
|
||||
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import co.yixiang.yshop.framework.pay.core.client.PayClient;
|
||||
import co.yixiang.yshop.framework.pay.core.client.PayClientFactory;
|
||||
import co.yixiang.yshop.framework.pay.core.client.dto.notify.PayNotifyReqDTO;
|
||||
import co.yixiang.yshop.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
|
||||
import co.yixiang.yshop.framework.pay.core.client.dto.notify.PayRefundNotifyRespDTO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchant.PayChannelDO;
|
||||
import co.yixiang.yshop.module.pay.service.merchant.PayChannelService;
|
||||
import co.yixiang.yshop.module.pay.service.order.PayOrderService;
|
||||
import co.yixiang.yshop.module.pay.service.refund.PayRefundService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
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 javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import java.util.Map;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static co.yixiang.yshop.framework.common.util.json.JsonUtils.toJsonString;
|
||||
import static co.yixiang.yshop.module.pay.enums.ErrorCodeConstants.PAY_CHANNEL_CLIENT_NOT_FOUND;
|
||||
|
||||
@Tag(name = "管理后台 - 支付通知")
|
||||
@RestController
|
||||
@RequestMapping("/pay/notify")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class PayNotifyController {
|
||||
|
||||
@Resource
|
||||
private PayOrderService orderService;
|
||||
@Resource
|
||||
private PayRefundService refundService;
|
||||
|
||||
@Resource
|
||||
private PayClientFactory payClientFactory;
|
||||
|
||||
/**
|
||||
* 统一的跳转页面,支付宝跳转参数说明
|
||||
*
|
||||
* <a href="https://opendocs.alipay.com/open/203/105285#前台回跳参数说明">支付宝 - 前台回跳参数说明</a>
|
||||
*
|
||||
* @param channelId 渠道编号
|
||||
* @return 返回跳转页面
|
||||
*/
|
||||
@GetMapping(value = "/return/{channelId}")
|
||||
@Operation(summary = "渠道统一的支付成功返回地址")
|
||||
@Deprecated // TODO yunai:如果是 way 的情况,应该是跳转回前端地址
|
||||
public String returnCallback(@PathVariable("channelId") Long channelId,
|
||||
@RequestParam Map<String, String> params) {
|
||||
log.info("[returnCallback][app_id({}) 跳转]", params.get("app_id"));
|
||||
return String.format("渠道[%s]支付成功", channelId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一的渠道支付回调,支付宝的退款回调
|
||||
*
|
||||
* @param channelId 渠道编号
|
||||
* @param params form 参数
|
||||
* @param body request body
|
||||
* @return 成功返回 "success"
|
||||
*/
|
||||
@PostMapping(value = "/callback/{channelId}")
|
||||
@Operation(summary = "支付渠道的统一回调接口 - 包括支付回调,退款回调")
|
||||
@PermitAll
|
||||
@OperateLog(enable = false) // 回调地址,无需记录操作日志
|
||||
public String notifyCallback(@PathVariable("channelId") Long channelId,
|
||||
@RequestParam(required = false) Map<String, String> params,
|
||||
@RequestBody(required = false) String body) {
|
||||
log.info("[notifyCallback][channelId({}) 回调数据({}/{})]", channelId, params, body);
|
||||
// 1. 校验支付渠道是否存在
|
||||
PayClient payClient = payClientFactory.getPayClient(channelId);
|
||||
if (payClient == null) {
|
||||
log.error("[notifyCallback][渠道编号({}) 找不到对应的支付客户端]", channelId);
|
||||
throw exception(PAY_CHANNEL_CLIENT_NOT_FOUND);
|
||||
}
|
||||
|
||||
// 2. 解析通知数据
|
||||
PayNotifyReqDTO rawNotify = PayNotifyReqDTO.builder().params(params).body(body).build();
|
||||
Object notify = payClient.parseNotify(rawNotify);
|
||||
|
||||
// 3. 处理通知
|
||||
// 3.1:退款通知
|
||||
if (notify instanceof PayRefundNotifyRespDTO) {
|
||||
refundService.notifyPayRefund(channelId, (PayRefundNotifyRespDTO) notify, rawNotify);
|
||||
return "success";
|
||||
}
|
||||
// 3.2:支付通知
|
||||
if (notify instanceof PayOrderNotifyRespDTO) {
|
||||
orderService.notifyPayOrder(channelId, (PayOrderNotifyRespDTO) notify, rawNotify);
|
||||
return "success";
|
||||
}
|
||||
throw new UnsupportedOperationException("未知通知:" + toJsonString(notify));
|
||||
}
|
||||
|
||||
}
|
@ -1,172 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.order;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.common.util.collection.CollectionUtils;
|
||||
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import co.yixiang.yshop.framework.pay.core.enums.PayChannelEnum;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.order.vo.*;
|
||||
import co.yixiang.yshop.module.pay.convert.order.PayOrderConvert;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchant.PayAppDO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.order.PayOrderDO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.order.PayOrderExtensionDO;
|
||||
import co.yixiang.yshop.module.pay.service.merchant.PayAppService;
|
||||
import co.yixiang.yshop.module.pay.service.merchant.PayMerchantService;
|
||||
import co.yixiang.yshop.module.pay.service.order.PayOrderExtensionService;
|
||||
import co.yixiang.yshop.module.pay.service.order.PayOrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
import static co.yixiang.yshop.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 支付订单")
|
||||
@RestController
|
||||
@RequestMapping("/pay/order")
|
||||
@Validated
|
||||
public class PayOrderController {
|
||||
|
||||
@Resource
|
||||
private PayOrderService payOrderService;
|
||||
@Resource
|
||||
private PayOrderExtensionService orderExtensionService;
|
||||
@Resource
|
||||
private PayMerchantService merchantService;
|
||||
@Resource
|
||||
private PayAppService appService;
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得支付订单")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('pay:order:query')")
|
||||
public CommonResult<PayOrderRespVO> getOrder(@RequestParam("id") Long id) {
|
||||
return success(PayOrderConvert.INSTANCE.convert(payOrderService.getOrder(id)));
|
||||
}
|
||||
|
||||
// TODO yshop:看看怎么优化下;
|
||||
@GetMapping("/get-detail")
|
||||
@Operation(summary = "获得支付订单详情")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('pay:order:query')")
|
||||
public CommonResult<PayOrderDetailsRespVO> getOrderDetail(@RequestParam("id") Long id) {
|
||||
PayOrderDO order = payOrderService.getOrder(id);
|
||||
if (ObjectUtil.isNull(order)) {
|
||||
return success(new PayOrderDetailsRespVO());
|
||||
}
|
||||
|
||||
PayMerchantDO merchantDO = merchantService.getMerchant(order.getMerchantId());
|
||||
PayAppDO appDO = appService.getApp(order.getAppId());
|
||||
PayChannelEnum channelEnum = PayChannelEnum.getByCode(order.getChannelCode());
|
||||
|
||||
// TODO @aquan:文案,都是前端 format;
|
||||
PayOrderDetailsRespVO respVO = PayOrderConvert.INSTANCE.orderDetailConvert(order);
|
||||
respVO.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
|
||||
respVO.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
||||
respVO.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
||||
|
||||
PayOrderExtensionDO extensionDO = orderExtensionService.getOrderExtension(order.getSuccessExtensionId());
|
||||
if (ObjectUtil.isNotNull(extensionDO)) {
|
||||
respVO.setPayOrderExtension(PayOrderConvert.INSTANCE.orderDetailExtensionConvert(extensionDO));
|
||||
}
|
||||
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@PostMapping("/submit")
|
||||
@Operation(summary = "提交支付订单")
|
||||
public CommonResult<PayOrderSubmitRespVO> submitPayOrder(@RequestBody PayOrderSubmitReqVO reqVO) {
|
||||
PayOrderSubmitRespVO respVO = payOrderService.submitPayOrder(reqVO, getClientIP());
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得支付订单分页")
|
||||
@PreAuthorize("@ss.hasPermission('pay:order:query')")
|
||||
public CommonResult<PageResult<PayOrderPageItemRespVO>> getOrderPage(@Valid PayOrderPageReqVO pageVO) {
|
||||
PageResult<PayOrderDO> pageResult = payOrderService.getOrderPage(pageVO);
|
||||
if (CollectionUtil.isEmpty(pageResult.getList())) {
|
||||
return success(new PageResult<>(pageResult.getTotal()));
|
||||
}
|
||||
|
||||
// 处理商户ID数据
|
||||
Map<Long, PayMerchantDO> merchantMap = merchantService.getMerchantMap(
|
||||
CollectionUtils.convertList(pageResult.getList(), PayOrderDO::getMerchantId));
|
||||
// 处理应用ID数据
|
||||
Map<Long, PayAppDO> appMap = appService.getAppMap(
|
||||
CollectionUtils.convertList(pageResult.getList(), PayOrderDO::getAppId));
|
||||
|
||||
List<PayOrderPageItemRespVO> pageList = new ArrayList<>(pageResult.getList().size());
|
||||
pageResult.getList().forEach(c -> {
|
||||
PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId());
|
||||
PayAppDO appDO = appMap.get(c.getAppId());
|
||||
PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
|
||||
|
||||
PayOrderPageItemRespVO orderItem = PayOrderConvert.INSTANCE.pageConvertItemPage(c);
|
||||
orderItem.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
|
||||
orderItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
||||
orderItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
||||
pageList.add(orderItem);
|
||||
});
|
||||
return success(new PageResult<>(pageList, pageResult.getTotal()));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出支付订单Excel")
|
||||
@PreAuthorize("@ss.hasPermission('pay:order:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportOrderExcel(@Valid PayOrderExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
|
||||
List<PayOrderDO> list = payOrderService.getOrderList(exportReqVO);
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
ExcelUtils.write(response, "支付订单.xls", "数据",
|
||||
PayOrderExcelVO.class, new ArrayList<>());
|
||||
}
|
||||
|
||||
// 处理商户ID数据
|
||||
Map<Long, PayMerchantDO> merchantMap = merchantService.getMerchantMap(
|
||||
CollectionUtils.convertList(list, PayOrderDO::getMerchantId));
|
||||
// 处理应用ID数据
|
||||
Map<Long, PayAppDO> appMap = appService.getAppMap(
|
||||
CollectionUtils.convertList(list, PayOrderDO::getAppId));
|
||||
// 处理扩展订单数据
|
||||
Map<Long, PayOrderExtensionDO> orderExtensionMap = orderExtensionService
|
||||
.getOrderExtensionMap(CollectionUtils.convertList(list, PayOrderDO::getSuccessExtensionId));
|
||||
|
||||
List<PayOrderExcelVO> excelDatum = new ArrayList<>(list.size());
|
||||
list.forEach(c -> {
|
||||
PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId());
|
||||
PayAppDO appDO = appMap.get(c.getAppId());
|
||||
PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
|
||||
PayOrderExtensionDO orderExtensionDO = orderExtensionMap.get(c.getSuccessExtensionId());
|
||||
|
||||
PayOrderExcelVO excelItem = PayOrderConvert.INSTANCE.excelConvert(c);
|
||||
excelItem.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
|
||||
excelItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
||||
excelItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
||||
excelItem.setNo(ObjectUtil.isNotNull(orderExtensionDO) ? orderExtensionDO.getNo() : "");
|
||||
excelDatum.add(excelItem);
|
||||
});
|
||||
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "支付订单.xls", "数据", PayOrderExcelVO.class, excelDatum);
|
||||
}
|
||||
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.order.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 支付订单 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*
|
||||
* @author aquan
|
||||
*/
|
||||
@Data
|
||||
public class PayOrderBaseVO {
|
||||
|
||||
@Schema(description = "商户编号", required = true)
|
||||
@NotNull(message = "商户编号不能为空")
|
||||
private Long merchantId;
|
||||
|
||||
@Schema(description = "应用编号", required = true)
|
||||
@NotNull(message = "应用编号不能为空")
|
||||
private Long appId;
|
||||
|
||||
@Schema(description = "渠道编号")
|
||||
private Long channelId;
|
||||
|
||||
@Schema(description = "渠道编码")
|
||||
private String channelCode;
|
||||
|
||||
@Schema(description = "商户订单编号", required = true)
|
||||
@NotNull(message = "商户订单编号不能为空")
|
||||
private String merchantOrderId;
|
||||
|
||||
@Schema(description = "商品标题", required = true)
|
||||
@NotNull(message = "商品标题不能为空")
|
||||
private String subject;
|
||||
|
||||
@Schema(description = "商品描述", required = true)
|
||||
@NotNull(message = "商品描述不能为空")
|
||||
private String body;
|
||||
|
||||
@Schema(description = "异步通知地址", required = true)
|
||||
@NotNull(message = "异步通知地址不能为空")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description = "通知商户支付结果的回调状态", required = true)
|
||||
@NotNull(message = "通知商户支付结果的回调状态不能为空")
|
||||
private Integer notifyStatus;
|
||||
|
||||
@Schema(description = "支付金额,单位:分", required = true)
|
||||
@NotNull(message = "支付金额,单位:分不能为空")
|
||||
private Long amount;
|
||||
|
||||
@Schema(description = "渠道手续费,单位:百分比")
|
||||
private Double channelFeeRate;
|
||||
|
||||
@Schema(description = "渠道手续金额,单位:分")
|
||||
private Long channelFeeAmount;
|
||||
|
||||
@Schema(description = "支付状态", required = true)
|
||||
@NotNull(message = "支付状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "用户 IP", required = true)
|
||||
@NotNull(message = "用户 IP不能为空")
|
||||
private String userIp;
|
||||
|
||||
@Schema(description = "订单失效时间", required = true)
|
||||
@NotNull(message = "订单失效时间不能为空")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime expireTime;
|
||||
|
||||
@Schema(description = "订单支付成功时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime successTime;
|
||||
|
||||
@Schema(description = "订单支付通知时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime notifyTime;
|
||||
|
||||
@Schema(description = "支付成功的订单拓展单编号")
|
||||
private Long successExtensionId;
|
||||
|
||||
@Schema(description = "退款状态", required = true)
|
||||
@NotNull(message = "退款状态不能为空")
|
||||
private Integer refundStatus;
|
||||
|
||||
@Schema(description = "退款次数", required = true)
|
||||
@NotNull(message = "退款次数不能为空")
|
||||
private Integer refundTimes;
|
||||
|
||||
@Schema(description = "退款总金额,单位:分", required = true)
|
||||
@NotNull(message = "退款总金额,单位:分不能为空")
|
||||
private Long refundAmount;
|
||||
|
||||
@Schema(description = "渠道用户编号")
|
||||
private String channelUserId;
|
||||
|
||||
@Schema(description = "渠道订单号")
|
||||
private String channelOrderNo;
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.order.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 支付订单详细信息 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayOrderDetailsRespVO extends PayOrderBaseVO {
|
||||
|
||||
@Schema(description = "支付订单编号")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "商户名称")
|
||||
private String merchantName;
|
||||
|
||||
@Schema(description = "应用名称")
|
||||
private String appName;
|
||||
|
||||
@Schema(description = "渠道编号名称")
|
||||
private String channelCodeName;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 支付订单扩展
|
||||
*/
|
||||
private PayOrderExtension payOrderExtension;
|
||||
|
||||
@Data
|
||||
@Schema(description = "支付订单扩展")
|
||||
public static class PayOrderExtension {
|
||||
|
||||
@Schema(description = "支付订单号")
|
||||
private String no;
|
||||
|
||||
@Schema(description = "支付异步通知的内容")
|
||||
private String channelNotifyData;
|
||||
}
|
||||
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.order.vo;
|
||||
|
||||
import co.yixiang.yshop.framework.excel.core.annotations.DictFormat;
|
||||
import co.yixiang.yshop.framework.excel.core.convert.DictConvert;
|
||||
import co.yixiang.yshop.module.pay.enums.DictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 支付订单Excel VO
|
||||
*
|
||||
* @author aquan
|
||||
*/
|
||||
@Data
|
||||
public class PayOrderExcelVO {
|
||||
|
||||
@ExcelProperty("支付订单编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty(value = "商户名称")
|
||||
private String merchantName;
|
||||
|
||||
@ExcelProperty(value = "应用名称")
|
||||
private String appName;
|
||||
|
||||
@ExcelProperty("商品标题")
|
||||
private String subject;
|
||||
|
||||
@ExcelProperty("商户订单编号")
|
||||
private String merchantOrderId;
|
||||
|
||||
@ExcelProperty("渠道订单号")
|
||||
private String channelOrderNo;
|
||||
|
||||
@ExcelProperty(value = "支付订单号")
|
||||
private String no;
|
||||
|
||||
@ExcelProperty("支付金额,单位:元")
|
||||
private String amount;
|
||||
|
||||
@ExcelProperty("渠道手续金额,单位:元")
|
||||
private String channelFeeAmount;
|
||||
|
||||
@ExcelProperty("渠道手续费,单位:百分比")
|
||||
private String channelFeeRate;
|
||||
|
||||
@DictFormat(DictTypeConstants.ORDER_STATUS)
|
||||
@ExcelProperty(value = "支付状态", converter = DictConvert.class)
|
||||
private Integer status;
|
||||
|
||||
@DictFormat(DictTypeConstants.ORDER_NOTIFY_STATUS)
|
||||
@ExcelProperty(value = "通知商户支付结果的回调状态", converter = DictConvert.class)
|
||||
private Integer notifyStatus;
|
||||
|
||||
@ExcelProperty("异步通知地址")
|
||||
private String notifyUrl;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ExcelProperty("订单支付成功时间")
|
||||
private LocalDateTime successTime;
|
||||
|
||||
@ExcelProperty("订单失效时间")
|
||||
private LocalDateTime expireTime;
|
||||
|
||||
@ExcelProperty("订单支付通知时间")
|
||||
private LocalDateTime notifyTime;
|
||||
|
||||
@ExcelProperty(value = "渠道编号名称")
|
||||
private String channelCodeName;
|
||||
|
||||
@ExcelProperty("用户 IP")
|
||||
private String userIp;
|
||||
|
||||
@DictFormat(DictTypeConstants.ORDER_REFUND_STATUS)
|
||||
@ExcelProperty(value = "退款状态", converter = DictConvert.class)
|
||||
private Integer refundStatus;
|
||||
|
||||
@ExcelProperty("退款次数")
|
||||
private Integer refundTimes;
|
||||
|
||||
@ExcelProperty("退款总金额,单位:元")
|
||||
private String refundAmount;
|
||||
|
||||
@ExcelProperty("商品描述")
|
||||
private String body;
|
||||
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.order.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 支付订单 Excel 导出 Request VO,参数和 PayOrderPageReqVO 是一致的")
|
||||
@Data
|
||||
public class PayOrderExportReqVO {
|
||||
|
||||
@Schema(description = "商户编号")
|
||||
private Long merchantId;
|
||||
|
||||
@Schema(description = "应用编号")
|
||||
private Long appId;
|
||||
|
||||
@Schema(description = "渠道编号")
|
||||
private Long channelId;
|
||||
|
||||
@Schema(description = "渠道编码")
|
||||
private String channelCode;
|
||||
|
||||
@Schema(description = "商户订单编号")
|
||||
private String merchantOrderId;
|
||||
|
||||
@Schema(description = "商品标题")
|
||||
private String subject;
|
||||
|
||||
@Schema(description = "商品描述")
|
||||
private String body;
|
||||
|
||||
@Schema(description = "异步通知地址")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description = "通知商户支付结果的回调状态")
|
||||
private Integer notifyStatus;
|
||||
|
||||
@Schema(description = "支付金额,单位:分")
|
||||
private Long amount;
|
||||
|
||||
@Schema(description = "渠道手续费,单位:百分比")
|
||||
private Double channelFeeRate;
|
||||
|
||||
@Schema(description = "渠道手续金额,单位:分")
|
||||
private Long channelFeeAmount;
|
||||
|
||||
@Schema(description = "支付状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "用户 IP")
|
||||
private String userIp;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "订单失效时间")
|
||||
private LocalDateTime[] expireTime;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "开始订单支付成功时间")
|
||||
private LocalDateTime[] successTime;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "开始订单支付通知时间")
|
||||
private LocalDateTime[] notifyTime;
|
||||
|
||||
@Schema(description = "支付成功的订单拓展单编号")
|
||||
private Long successExtensionId;
|
||||
|
||||
@Schema(description = "退款状态")
|
||||
private Integer refundStatus;
|
||||
|
||||
@Schema(description = "退款次数")
|
||||
private Integer refundTimes;
|
||||
|
||||
@Schema(description = "退款总金额,单位:分")
|
||||
private Long refundAmount;
|
||||
|
||||
@Schema(description = "渠道用户编号")
|
||||
private String channelUserId;
|
||||
|
||||
@Schema(description = "渠道订单号")
|
||||
private String channelOrderNo;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.order.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 支付订单分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayOrderPageItemRespVO extends PayOrderBaseVO {
|
||||
|
||||
@Schema(description = "支付订单编号", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "商户名称")
|
||||
private String merchantName;
|
||||
|
||||
@Schema(description = "应用名称")
|
||||
private String appName;
|
||||
|
||||
@Schema(description = "渠道名称")
|
||||
private String channelCodeName;
|
||||
|
||||
@Schema(description = "支付订单号")
|
||||
private String no;
|
||||
|
||||
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.order.vo;
|
||||
|
||||
import co.yixiang.yshop.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 co.yixiang.yshop.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 PayOrderPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "商户编号")
|
||||
private Long merchantId;
|
||||
|
||||
@Schema(description = "应用编号")
|
||||
private Long appId;
|
||||
|
||||
@Schema(description = "渠道编号")
|
||||
private Long channelId;
|
||||
|
||||
@Schema(description = "渠道编码")
|
||||
private String channelCode;
|
||||
|
||||
@Schema(description = "商户订单编号")
|
||||
private String merchantOrderId;
|
||||
|
||||
@Schema(description = "商品标题")
|
||||
private String subject;
|
||||
|
||||
@Schema(description = "商品描述")
|
||||
private String body;
|
||||
|
||||
@Schema(description = "异步通知地址")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description = "通知商户支付结果的回调状态")
|
||||
private Integer notifyStatus;
|
||||
|
||||
@Schema(description = "支付金额,单位:分")
|
||||
private Long amount;
|
||||
|
||||
@Schema(description = "渠道手续费,单位:百分比")
|
||||
private Double channelFeeRate;
|
||||
|
||||
@Schema(description = "渠道手续金额,单位:分")
|
||||
private Long channelFeeAmount;
|
||||
|
||||
@Schema(description = "支付状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "用户 IP")
|
||||
private String userIp;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "订单失效时间")
|
||||
private LocalDateTime[] expireTime;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "订单支付成功时间")
|
||||
private LocalDateTime[] successTime;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "订单支付通知时间")
|
||||
private LocalDateTime[] notifyTime;
|
||||
|
||||
@Schema(description = "支付成功的订单拓展单编号")
|
||||
private Long successExtensionId;
|
||||
|
||||
@Schema(description = "退款状态")
|
||||
private Integer refundStatus;
|
||||
|
||||
@Schema(description = "退款次数")
|
||||
private Integer refundTimes;
|
||||
|
||||
@Schema(description = "退款总金额,单位:分")
|
||||
private Long refundAmount;
|
||||
|
||||
@Schema(description = "渠道用户编号")
|
||||
private String channelUserId;
|
||||
|
||||
@Schema(description = "渠道订单号")
|
||||
private String channelOrderNo;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.order.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 支付订单 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayOrderRespVO extends PayOrderBaseVO {
|
||||
|
||||
@Schema(description = "支付订单编号", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.order.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.awt.*;
|
||||
import java.util.Map;
|
||||
|
||||
@Schema(description = "管理后台 - 支付订单提交 Request VO")
|
||||
@Data
|
||||
public class PayOrderSubmitReqVO {
|
||||
|
||||
@Schema(description = "支付单编号", required = true, example = "1024")
|
||||
@NotNull(message = "支付单编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "支付渠道", required = true, example = "wx_pub")
|
||||
@NotEmpty(message = "支付渠道不能为空")
|
||||
private String channelCode;
|
||||
|
||||
@Schema(description = "支付渠道的额外参数,例如说,微信公众号需要传递 openid 参数")
|
||||
private Map<String, String> channelExtras;
|
||||
|
||||
@Schema(description = "展示模式", example = "url") // 参见 {@link PayDisplayModeEnum} 枚举。如果不传递,则每个支付渠道使用默认的方式
|
||||
private String displayMode;
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.order.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Schema(description = "管理后台 - 支付订单提交 Response VO")
|
||||
@Data
|
||||
public class PayOrderSubmitRespVO {
|
||||
|
||||
@Schema(description = "展示模式", required = true, example = "url") // 参见 PayDisplayModeEnum 枚举
|
||||
private String displayMode;
|
||||
|
||||
@Schema(description = "展示内容", required = true)
|
||||
private String displayContent;
|
||||
|
||||
}
|
@ -1,156 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.refund;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.refund.vo.*;
|
||||
import co.yixiang.yshop.module.pay.convert.refund.PayRefundConvert;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchant.PayAppDO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.order.PayOrderDO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.refund.PayRefundDO;
|
||||
import co.yixiang.yshop.module.pay.service.merchant.PayAppService;
|
||||
import co.yixiang.yshop.module.pay.service.merchant.PayMerchantService;
|
||||
import co.yixiang.yshop.module.pay.service.order.PayOrderService;
|
||||
import co.yixiang.yshop.module.pay.service.refund.PayRefundService;
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.common.util.collection.CollectionUtils;
|
||||
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import co.yixiang.yshop.framework.pay.core.enums.PayChannelEnum;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 退款订单")
|
||||
@RestController
|
||||
@RequestMapping("/pay/refund")
|
||||
@Validated
|
||||
public class PayRefundController {
|
||||
|
||||
@Resource
|
||||
private PayRefundService refundService;
|
||||
@Resource
|
||||
private PayMerchantService merchantService;
|
||||
@Resource
|
||||
private PayAppService appService;
|
||||
@Resource
|
||||
private PayOrderService orderService;
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得退款订单")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('pay:refund:query')")
|
||||
public CommonResult<PayRefundDetailsRespVO> getRefund(@RequestParam("id") Long id) {
|
||||
PayRefundDO refund = refundService.getRefund(id);
|
||||
if (ObjectUtil.isNull(refund)) {
|
||||
return success(new PayRefundDetailsRespVO());
|
||||
}
|
||||
|
||||
PayMerchantDO merchantDO = merchantService.getMerchant(refund.getMerchantId());
|
||||
PayAppDO appDO = appService.getApp(refund.getAppId());
|
||||
PayChannelEnum channelEnum = PayChannelEnum.getByCode(refund.getChannelCode());
|
||||
PayOrderDO orderDO = orderService.getOrder(refund.getOrderId());
|
||||
|
||||
PayRefundDetailsRespVO refundDetail = PayRefundConvert.INSTANCE.refundDetailConvert(refund);
|
||||
refundDetail.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
|
||||
refundDetail.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
||||
refundDetail.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
||||
refundDetail.setSubject(orderDO.getSubject());
|
||||
|
||||
return success(refundDetail);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得退款订单分页")
|
||||
@PreAuthorize("@ss.hasPermission('pay:refund:query')")
|
||||
public CommonResult<PageResult<PayRefundPageItemRespVO>> getRefundPage(@Valid PayRefundPageReqVO pageVO) {
|
||||
PageResult<PayRefundDO> pageResult = refundService.getRefundPage(pageVO);
|
||||
if (CollectionUtil.isEmpty(pageResult.getList())) {
|
||||
return success(new PageResult<>(pageResult.getTotal()));
|
||||
}
|
||||
|
||||
// 处理商户ID数据
|
||||
Map<Long, PayMerchantDO> merchantMap = merchantService.getMerchantMap(
|
||||
CollectionUtils.convertList(pageResult.getList(), PayRefundDO::getMerchantId));
|
||||
// 处理应用ID数据
|
||||
Map<Long, PayAppDO> appMap = appService.getAppMap(
|
||||
CollectionUtils.convertList(pageResult.getList(), PayRefundDO::getAppId));
|
||||
List<PayRefundPageItemRespVO> list = new ArrayList<>(pageResult.getList().size());
|
||||
pageResult.getList().forEach(c -> {
|
||||
PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId());
|
||||
PayAppDO appDO = appMap.get(c.getAppId());
|
||||
PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
|
||||
|
||||
PayRefundPageItemRespVO item = PayRefundConvert.INSTANCE.pageItemConvert(c);
|
||||
|
||||
item.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
|
||||
item.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
||||
item.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
||||
list.add(item);
|
||||
});
|
||||
|
||||
return success(new PageResult<>(list, pageResult.getTotal()));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出退款订单 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('pay:refund:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportRefundExcel(@Valid PayRefundExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
|
||||
List<PayRefundDO> list = refundService.getRefundList(exportReqVO);
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
ExcelUtils.write(response, "退款订单.xls", "数据",
|
||||
PayRefundExcelVO.class, new ArrayList<>());
|
||||
}
|
||||
|
||||
// 处理商户ID数据
|
||||
Map<Long, PayMerchantDO> merchantMap = merchantService.getMerchantMap(
|
||||
CollectionUtils.convertList(list, PayRefundDO::getMerchantId));
|
||||
// 处理应用ID数据
|
||||
Map<Long, PayAppDO> appMap = appService.getAppMap(
|
||||
CollectionUtils.convertList(list, PayRefundDO::getAppId));
|
||||
|
||||
List<PayRefundExcelVO> excelDatum = new ArrayList<>(list.size());
|
||||
// 处理商品名称数据
|
||||
Map<Long, PayOrderDO> orderMap = orderService.getOrderSubjectMap(
|
||||
CollectionUtils.convertList(list, PayRefundDO::getOrderId));
|
||||
|
||||
list.forEach(c -> {
|
||||
PayMerchantDO merchantDO = merchantMap.get(c.getMerchantId());
|
||||
PayAppDO appDO = appMap.get(c.getAppId());
|
||||
PayChannelEnum channelEnum = PayChannelEnum.getByCode(c.getChannelCode());
|
||||
|
||||
PayRefundExcelVO excelItem = PayRefundConvert.INSTANCE.excelConvert(c);
|
||||
excelItem.setMerchantName(ObjectUtil.isNotNull(merchantDO) ? merchantDO.getName() : "未知商户");
|
||||
excelItem.setAppName(ObjectUtil.isNotNull(appDO) ? appDO.getName() : "未知应用");
|
||||
excelItem.setChannelCodeName(ObjectUtil.isNotNull(channelEnum) ? channelEnum.getName() : "未知渠道");
|
||||
excelItem.setSubject(orderMap.get(c.getOrderId()).getSubject());
|
||||
|
||||
excelDatum.add(excelItem);
|
||||
});
|
||||
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "退款订单.xls", "数据", PayRefundExcelVO.class, excelDatum);
|
||||
}
|
||||
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.refund.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 退款订单 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class PayRefundBaseVO {
|
||||
|
||||
@Schema(description = "商户编号", required = true)
|
||||
@NotNull(message = "商户编号不能为空")
|
||||
private Long merchantId;
|
||||
|
||||
@Schema(description = "应用编号", required = true)
|
||||
@NotNull(message = "应用编号不能为空")
|
||||
private Long appId;
|
||||
|
||||
@Schema(description = "渠道编号", required = true)
|
||||
@NotNull(message = "渠道编号不能为空")
|
||||
private Long channelId;
|
||||
|
||||
@Schema(description = "渠道编码", required = true)
|
||||
@NotNull(message = "渠道编码不能为空")
|
||||
private String channelCode;
|
||||
|
||||
@Schema(description = "支付订单编号 pay_order 表id", required = true)
|
||||
@NotNull(message = "支付订单编号 pay_order 表id不能为空")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "交易订单号 pay_extension 表no 字段", required = true)
|
||||
@NotNull(message = "交易订单号 pay_extension 表no 字段不能为空")
|
||||
private String tradeNo;
|
||||
|
||||
@Schema(description = "商户订单编号(商户系统生成)", required = true)
|
||||
@NotNull(message = "商户订单编号(商户系统生成)不能为空")
|
||||
private String merchantOrderId;
|
||||
|
||||
@Schema(description = "商户退款订单号(商户系统生成)", required = true)
|
||||
@NotNull(message = "商户退款订单号(商户系统生成)不能为空")
|
||||
private String merchantRefundNo;
|
||||
|
||||
@Schema(description = "异步通知商户地址", required = true)
|
||||
@NotNull(message = "异步通知商户地址不能为空")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description = "通知商户退款结果的回调状态", required = true)
|
||||
@NotNull(message = "通知商户退款结果的回调状态不能为空")
|
||||
private Integer notifyStatus;
|
||||
|
||||
@Schema(description = "退款状态", required = true)
|
||||
@NotNull(message = "退款状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "退款类型(部分退款,全部退款)", required = true)
|
||||
@NotNull(message = "退款类型(部分退款,全部退款)不能为空")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "支付金额,单位分", required = true)
|
||||
@NotNull(message = "支付金额,单位分不能为空")
|
||||
private Long payAmount;
|
||||
|
||||
@Schema(description = "退款金额,单位分", required = true)
|
||||
@NotNull(message = "退款金额,单位分不能为空")
|
||||
private Long refundAmount;
|
||||
|
||||
@Schema(description = "退款原因", required = true)
|
||||
@NotNull(message = "退款原因不能为空")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "用户 IP")
|
||||
private String userIp;
|
||||
|
||||
@Schema(description = "渠道订单号,pay_order 中的channel_order_no 对应", required = true)
|
||||
@NotNull(message = "渠道订单号,pay_order 中的channel_order_no 对应不能为空")
|
||||
private String channelOrderNo;
|
||||
|
||||
@Schema(description = "渠道退款单号,渠道返回")
|
||||
private String channelRefundNo;
|
||||
|
||||
@Schema(description = "渠道调用报错时,错误码")
|
||||
private String channelErrorCode;
|
||||
|
||||
@Schema(description = "渠道调用报错时,错误信息")
|
||||
private String channelErrorMsg;
|
||||
|
||||
@Schema(description = "支付渠道的额外参数")
|
||||
private String channelExtras;
|
||||
|
||||
@Schema(description = "退款失效时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime expireTime;
|
||||
|
||||
@Schema(description = "退款成功时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime successTime;
|
||||
|
||||
@Schema(description = "退款通知时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime notifyTime;
|
||||
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.refund.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@Schema(description = "管理后台 - 退款订单创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayRefundCreateReqVO extends PayRefundBaseVO {
|
||||
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.refund.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 退款订单详情 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayRefundDetailsRespVO extends PayRefundBaseVO {
|
||||
|
||||
@Schema(description = "支付退款编号", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "商户名称")
|
||||
private String merchantName;
|
||||
|
||||
@Schema(description = "应用名称")
|
||||
private String appName;
|
||||
|
||||
@Schema(description = "渠道编号名称")
|
||||
private String channelCodeName;
|
||||
|
||||
@NotNull(message = "商品标题不能为空")
|
||||
private String subject;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.refund.vo;
|
||||
|
||||
import co.yixiang.yshop.framework.excel.core.annotations.DictFormat;
|
||||
import co.yixiang.yshop.framework.excel.core.convert.DictConvert;
|
||||
import co.yixiang.yshop.module.pay.enums.DictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 退款订单 Excel VO
|
||||
*
|
||||
* @author aquan
|
||||
*/
|
||||
@Data
|
||||
public class PayRefundExcelVO {
|
||||
|
||||
@ExcelProperty("支付退款编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("商品名称")
|
||||
private String subject;
|
||||
|
||||
@ExcelProperty(value = "商户名称")
|
||||
private String merchantName;
|
||||
|
||||
@ExcelProperty(value = "应用名称")
|
||||
private String appName;
|
||||
|
||||
@ExcelProperty(value = "渠道编号名称")
|
||||
private String channelCodeName;
|
||||
|
||||
@ExcelProperty("交易订单号")
|
||||
private String tradeNo;
|
||||
|
||||
@ExcelProperty("商户订单编号")
|
||||
private String merchantOrderId;
|
||||
|
||||
@ExcelProperty("商户退款订单号")
|
||||
private String merchantRefundNo;
|
||||
|
||||
@ExcelProperty("异步通知商户地址")
|
||||
private String notifyUrl;
|
||||
|
||||
@DictFormat(DictTypeConstants.ORDER_NOTIFY_STATUS)
|
||||
@ExcelProperty(value = "商户退款结果回调状态", converter = DictConvert.class)
|
||||
private Integer notifyStatus;
|
||||
|
||||
@DictFormat(DictTypeConstants.REFUND_ORDER_STATUS)
|
||||
@ExcelProperty(value = "退款状态", converter = DictConvert.class)
|
||||
private Integer status;
|
||||
|
||||
@DictFormat(DictTypeConstants.REFUND_ORDER_TYPE)
|
||||
@ExcelProperty(value = "退款类型", converter = DictConvert.class)
|
||||
private Integer type;
|
||||
|
||||
@ExcelProperty("支付金额,单位:元")
|
||||
private String payAmount;
|
||||
|
||||
@ExcelProperty("退款金额,单位:元")
|
||||
private String refundAmount;
|
||||
|
||||
@ExcelProperty("退款原因")
|
||||
private String reason;
|
||||
|
||||
@ExcelProperty("用户付款 IP")
|
||||
private String userIp;
|
||||
|
||||
@ExcelProperty("渠道订单号")
|
||||
private String channelOrderNo;
|
||||
|
||||
@ExcelProperty("渠道退款单号")
|
||||
private String channelRefundNo;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ExcelProperty("退款成功时间")
|
||||
private LocalDateTime successTime;
|
||||
|
||||
@ExcelProperty("退款通知时间")
|
||||
private LocalDateTime notifyTime;
|
||||
|
||||
@ExcelProperty("退款失效时间")
|
||||
private LocalDateTime expireTime;
|
||||
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.refund.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 退款订单 Excel 导出 Request VO,参数和 PayRefundPageReqVO 是一致的")
|
||||
@Data
|
||||
public class PayRefundExportReqVO {
|
||||
|
||||
@Schema(description = "商户编号")
|
||||
private Long merchantId;
|
||||
|
||||
@Schema(description = "应用编号")
|
||||
private Long appId;
|
||||
|
||||
@Schema(description = "渠道编号")
|
||||
private Long channelId;
|
||||
|
||||
@Schema(description = "渠道编码")
|
||||
private String channelCode;
|
||||
|
||||
@Schema(description = "支付订单编号 pay_order 表id")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "交易订单号 pay_extension 表no 字段")
|
||||
private String tradeNo;
|
||||
|
||||
@Schema(description = "商户订单编号(商户系统生成)")
|
||||
private String merchantOrderId;
|
||||
|
||||
@Schema(description = "商户退款订单号(商户系统生成)")
|
||||
private String merchantRefundNo;
|
||||
|
||||
@Schema(description = "异步通知商户地址")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description = "通知商户退款结果的回调状态")
|
||||
private Integer notifyStatus;
|
||||
|
||||
@Schema(description = "退款状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "退款类型(部分退款,全部退款)")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "支付金额,单位分")
|
||||
private Long payAmount;
|
||||
|
||||
@Schema(description = "退款金额,单位分")
|
||||
private Long refundAmount;
|
||||
|
||||
@Schema(description = "退款原因")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "用户 IP")
|
||||
private String userIp;
|
||||
|
||||
@Schema(description = "渠道订单号,pay_order 中的channel_order_no 对应")
|
||||
private String channelOrderNo;
|
||||
|
||||
@Schema(description = "渠道退款单号,渠道返回")
|
||||
private String channelRefundNo;
|
||||
|
||||
@Schema(description = "渠道调用报错时,错误码")
|
||||
private String channelErrorCode;
|
||||
|
||||
@Schema(description = "渠道调用报错时,错误信息")
|
||||
private String channelErrorMsg;
|
||||
|
||||
@Schema(description = "支付渠道的额外参数")
|
||||
private String channelExtras;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "退款失效时间")
|
||||
private LocalDateTime[] expireTime;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "退款成功时间")
|
||||
private LocalDateTime[] successTime;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "退款通知时间")
|
||||
private LocalDateTime[] notifyTime;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.refund.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 退款订单分页查询 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayRefundPageItemRespVO extends PayRefundBaseVO {
|
||||
|
||||
@Schema(description = "支付订单编号", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "商户名称")
|
||||
private String merchantName;
|
||||
|
||||
@Schema(description = "应用名称")
|
||||
private String appName;
|
||||
|
||||
@Schema(description = "渠道名称")
|
||||
private String channelCodeName;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.refund.vo;
|
||||
|
||||
import co.yixiang.yshop.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 co.yixiang.yshop.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 PayRefundPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "商户编号")
|
||||
private Long merchantId;
|
||||
|
||||
@Schema(description = "应用编号")
|
||||
private Long appId;
|
||||
|
||||
@Schema(description = "渠道编号")
|
||||
private Long channelId;
|
||||
|
||||
@Schema(description = "渠道编码")
|
||||
private String channelCode;
|
||||
|
||||
@Schema(description = "支付订单编号 pay_order 表id")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "交易订单号 pay_extension 表no 字段")
|
||||
private String tradeNo;
|
||||
|
||||
@Schema(description = "商户订单编号(商户系统生成)")
|
||||
private String merchantOrderId;
|
||||
|
||||
@Schema(description = "商户退款订单号(商户系统生成)")
|
||||
private String merchantRefundNo;
|
||||
|
||||
@Schema(description = "异步通知商户地址")
|
||||
private String notifyUrl;
|
||||
|
||||
@Schema(description = "通知商户退款结果的回调状态")
|
||||
private Integer notifyStatus;
|
||||
|
||||
@Schema(description = "退款状态")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "退款类型(部分退款,全部退款)")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "支付金额,单位分")
|
||||
private Long payAmount;
|
||||
|
||||
@Schema(description = "退款金额,单位分")
|
||||
private Long refundAmount;
|
||||
|
||||
@Schema(description = "退款原因")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "用户 IP")
|
||||
private String userIp;
|
||||
|
||||
@Schema(description = "渠道订单号,pay_order 中的channel_order_no 对应")
|
||||
private String channelOrderNo;
|
||||
|
||||
@Schema(description = "渠道退款单号,渠道返回")
|
||||
private String channelRefundNo;
|
||||
|
||||
@Schema(description = "渠道调用报错时,错误码")
|
||||
private String channelErrorCode;
|
||||
|
||||
@Schema(description = "渠道调用报错时,错误信息")
|
||||
private String channelErrorMsg;
|
||||
|
||||
@Schema(description = "支付渠道的额外参数")
|
||||
private String channelExtras;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "退款失效时间")
|
||||
private LocalDateTime[] expireTime;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "退款成功时间")
|
||||
private LocalDateTime[] successTime;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "退款通知时间")
|
||||
private LocalDateTime[] notifyTime;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.refund.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 退款订单 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayRefundRespVO extends PayRefundBaseVO {
|
||||
|
||||
@Schema(description = "支付退款编号", required = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.admin.refund.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 退款订单更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PayRefundUpdateReqVO extends PayRefundBaseVO {
|
||||
|
||||
@Schema(description = "支付退款编号", required = true)
|
||||
@NotNull(message = "支付退款编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
### /pay/create 提交支付订单
|
||||
POST {{appApi}}/pay/order/submit
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{appToken}}
|
||||
tenant-id: {{appTenentId}}
|
||||
|
||||
{
|
||||
"id": 125,
|
||||
"channelCode": "alipay_qr"
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.app.order;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.order.vo.PayOrderSubmitRespVO;
|
||||
import co.yixiang.yshop.module.pay.controller.app.order.vo.AppPayOrderSubmitReqVO;
|
||||
import co.yixiang.yshop.module.pay.controller.app.order.vo.AppPayOrderSubmitRespVO;
|
||||
import co.yixiang.yshop.module.pay.convert.order.PayOrderConvert;
|
||||
import co.yixiang.yshop.module.pay.service.order.PayOrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
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 javax.annotation.Resource;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
import static co.yixiang.yshop.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||
|
||||
@Tag(name = "用户 APP - 支付订单")
|
||||
@RestController
|
||||
@RequestMapping("/pay/order")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class AppPayOrderController {
|
||||
|
||||
@Resource
|
||||
private PayOrderService orderService;
|
||||
|
||||
@PostMapping("/submit")
|
||||
@Operation(summary = "提交支付订单")
|
||||
public CommonResult<AppPayOrderSubmitRespVO> submitPayOrder(@RequestBody AppPayOrderSubmitReqVO reqVO) {
|
||||
PayOrderSubmitRespVO respVO = orderService.submitPayOrder(reqVO, getClientIP());
|
||||
return success(PayOrderConvert.INSTANCE.convert3(respVO));
|
||||
}
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.app.order.vo;
|
||||
|
||||
import co.yixiang.yshop.module.pay.controller.admin.order.vo.PayOrderSubmitReqVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Map;
|
||||
|
||||
@Schema(description = "用户 APP - 支付订单提交 Request VO")
|
||||
@Data
|
||||
public class AppPayOrderSubmitReqVO extends PayOrderSubmitReqVO {
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.controller.app.order.vo;
|
||||
|
||||
import co.yixiang.yshop.module.pay.controller.admin.order.vo.PayOrderSubmitRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Schema(description = "用户 APP - 支付订单提交 Response VO")
|
||||
@Data
|
||||
public class AppPayOrderSubmitRespVO extends PayOrderSubmitRespVO {
|
||||
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
/**
|
||||
* TODO yshop:占个位置,没啥用
|
||||
*/
|
||||
package co.yixiang.yshop.module.pay.controller.app.refund;
|
@ -1,6 +0,0 @@
|
||||
/**
|
||||
* 提供 RESTful API 给前端:
|
||||
* 1. admin 包:提供给管理后台 yshop-ui-admin 前端项目
|
||||
* 2. app 包:提供给用户 APP yshop-ui-app 前端项目,它的 Controller 和 VO 都要添加 App 前缀,用于和管理后台进行区分
|
||||
*/
|
||||
package co.yixiang.yshop.module.pay.controller;
|
@ -1,39 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.convert.app;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchant.vo.app.*;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchant.PayAppDO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 支付应用信息 Convert
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Mapper
|
||||
public interface PayAppConvert {
|
||||
|
||||
PayAppConvert INSTANCE = Mappers.getMapper(PayAppConvert.class);
|
||||
|
||||
PayAppPageItemRespVO pageConvert (PayAppDO bean);
|
||||
|
||||
PayAppPageItemRespVO.PayMerchant convert(PayMerchantDO bean);
|
||||
|
||||
PayAppDO convert(PayAppCreateReqVO bean);
|
||||
|
||||
PayAppDO convert(PayAppUpdateReqVO bean);
|
||||
|
||||
PayAppRespVO convert(PayAppDO bean);
|
||||
|
||||
List<PayAppRespVO> convertList(List<PayAppDO> list);
|
||||
|
||||
PageResult<PayAppRespVO> convertPage(PageResult<PayAppDO> page);
|
||||
|
||||
List<PayAppExcelVO> convertList02(List<PayAppDO> list);
|
||||
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.convert.channel;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchant.vo.channel.PayChannelCreateReqVO;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchant.vo.channel.PayChannelExcelVO;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchant.vo.channel.PayChannelRespVO;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchant.vo.channel.PayChannelUpdateReqVO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchant.PayChannelDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface PayChannelConvert {
|
||||
|
||||
PayChannelConvert INSTANCE = Mappers.getMapper(PayChannelConvert.class);
|
||||
|
||||
@Mapping(target = "config",ignore = true)
|
||||
PayChannelDO convert(PayChannelCreateReqVO bean);
|
||||
|
||||
@Mapping(target = "config",ignore = true)
|
||||
PayChannelDO convert(PayChannelUpdateReqVO bean);
|
||||
|
||||
@Mapping(target = "config",expression = "java(co.yixiang.yshop.framework.common.util.json.JsonUtils.toJsonString(bean.getConfig()))")
|
||||
PayChannelRespVO convert(PayChannelDO bean);
|
||||
|
||||
List<PayChannelRespVO> convertList(List<PayChannelDO> list);
|
||||
|
||||
PageResult<PayChannelRespVO> convertPage(PageResult<PayChannelDO> page);
|
||||
|
||||
List<PayChannelExcelVO> convertList02(List<PayChannelDO> list);
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.convert.demo;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.demo.vo.PayDemoOrderCreateReqVO;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.demo.vo.PayDemoOrderRespVO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.demo.PayDemoOrderDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 示例订单 Convert
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Mapper
|
||||
public interface PayDemoOrderConvert {
|
||||
|
||||
PayDemoOrderConvert INSTANCE = Mappers.getMapper(PayDemoOrderConvert.class);
|
||||
|
||||
PayDemoOrderDO convert(PayDemoOrderCreateReqVO bean);
|
||||
|
||||
PayDemoOrderRespVO convert(PayDemoOrderDO bean);
|
||||
|
||||
PageResult<PayDemoOrderRespVO> convertPage(PageResult<PayDemoOrderDO> page);
|
||||
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.convert.merchant;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchant.vo.merchant.PayMerchantCreateReqVO;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchant.vo.merchant.PayMerchantExcelVO;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchant.vo.merchant.PayMerchantRespVO;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchant.vo.merchant.PayMerchantUpdateReqVO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchant.PayMerchantDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface PayMerchantConvert {
|
||||
|
||||
PayMerchantConvert INSTANCE = Mappers.getMapper(PayMerchantConvert.class);
|
||||
|
||||
PayMerchantDO convert(PayMerchantCreateReqVO bean);
|
||||
|
||||
PayMerchantDO convert(PayMerchantUpdateReqVO bean);
|
||||
|
||||
PayMerchantRespVO convert(PayMerchantDO bean);
|
||||
|
||||
List<PayMerchantRespVO> convertList(List<PayMerchantDO> list);
|
||||
|
||||
PageResult<PayMerchantRespVO> convertPage(PageResult<PayMerchantDO> page);
|
||||
|
||||
List<PayMerchantExcelVO> convertList02(List<PayMerchantDO> list);
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package co.yixiang.yshop.module.pay.convert.merchantdetails;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.merchantdetails.vo.*;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.merchantdetails.MerchantDetailsDO;
|
||||
|
||||
/**
|
||||
* 支付服务商配置 Convert
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@Mapper
|
||||
public interface MerchantDetailsConvert {
|
||||
|
||||
MerchantDetailsConvert INSTANCE = Mappers.getMapper(MerchantDetailsConvert.class);
|
||||
|
||||
MerchantDetailsDO convert(MerchantDetailsCreateReqVO bean);
|
||||
|
||||
MerchantDetailsDO convert(MerchantDetailsUpdateReqVO bean);
|
||||
|
||||
MerchantDetailsRespVO convert(MerchantDetailsDO bean);
|
||||
|
||||
List<MerchantDetailsRespVO> convertList(List<MerchantDetailsDO> list);
|
||||
|
||||
PageResult<MerchantDetailsRespVO> convertPage(PageResult<MerchantDetailsDO> page);
|
||||
|
||||
List<MerchantDetailsExcelVO> convertList02(List<MerchantDetailsDO> list);
|
||||
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.convert.order;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||
import co.yixiang.yshop.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
|
||||
import co.yixiang.yshop.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
||||
import co.yixiang.yshop.module.pay.api.order.dto.PayOrderRespDTO;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.order.vo.*;
|
||||
import co.yixiang.yshop.module.pay.controller.app.order.vo.AppPayOrderSubmitReqVO;
|
||||
import co.yixiang.yshop.module.pay.controller.app.order.vo.AppPayOrderSubmitRespVO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.order.PayOrderDO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.order.PayOrderExtensionDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 支付订单 Convert
|
||||
*
|
||||
* @author aquan
|
||||
*/
|
||||
@Mapper
|
||||
public interface PayOrderConvert {
|
||||
|
||||
PayOrderConvert INSTANCE = Mappers.getMapper(PayOrderConvert.class);
|
||||
|
||||
PayOrderRespVO convert(PayOrderDO bean);
|
||||
|
||||
PayOrderRespDTO convert2(PayOrderDO order);
|
||||
|
||||
PayOrderDetailsRespVO orderDetailConvert(PayOrderDO bean);
|
||||
|
||||
PayOrderDetailsRespVO.PayOrderExtension orderDetailExtensionConvert(PayOrderExtensionDO bean);
|
||||
|
||||
List<PayOrderRespVO> convertList(List<PayOrderDO> list);
|
||||
|
||||
PageResult<PayOrderRespVO> convertPage(PageResult<PayOrderDO> page);
|
||||
|
||||
List<PayOrderExcelVO> convertList02(List<PayOrderDO> list);
|
||||
|
||||
/**
|
||||
* 订单 DO 转自定义分页对象
|
||||
*
|
||||
* @param bean 订单DO
|
||||
* @return 分页对象
|
||||
*/
|
||||
PayOrderPageItemRespVO pageConvertItemPage(PayOrderDO bean);
|
||||
|
||||
// TODO yshop:优化下 convert 逻辑
|
||||
default PayOrderExcelVO excelConvert(PayOrderDO bean) {
|
||||
if (bean == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PayOrderExcelVO payOrderExcelVO = new PayOrderExcelVO();
|
||||
|
||||
payOrderExcelVO.setId(bean.getId());
|
||||
payOrderExcelVO.setSubject(bean.getSubject());
|
||||
payOrderExcelVO.setMerchantOrderId(bean.getMerchantOrderId());
|
||||
payOrderExcelVO.setChannelOrderNo(bean.getChannelOrderNo());
|
||||
payOrderExcelVO.setStatus(bean.getStatus());
|
||||
payOrderExcelVO.setNotifyStatus(bean.getNotifyStatus());
|
||||
payOrderExcelVO.setNotifyUrl(bean.getNotifyUrl());
|
||||
payOrderExcelVO.setCreateTime(bean.getCreateTime());
|
||||
payOrderExcelVO.setSuccessTime(bean.getSuccessTime());
|
||||
payOrderExcelVO.setExpireTime(bean.getExpireTime());
|
||||
payOrderExcelVO.setNotifyTime(bean.getNotifyTime());
|
||||
payOrderExcelVO.setUserIp(bean.getUserIp());
|
||||
payOrderExcelVO.setRefundStatus(bean.getRefundStatus());
|
||||
payOrderExcelVO.setRefundTimes(bean.getRefundTimes());
|
||||
payOrderExcelVO.setBody(bean.getBody());
|
||||
|
||||
BigDecimal multiple = new BigDecimal(100);
|
||||
|
||||
payOrderExcelVO.setAmount(BigDecimal.valueOf(bean.getAmount())
|
||||
.divide(multiple, 2, RoundingMode.HALF_UP).toString());
|
||||
|
||||
payOrderExcelVO.setChannelFeeAmount(BigDecimal.valueOf(bean.getChannelFeeAmount())
|
||||
.divide(multiple, 2, RoundingMode.HALF_UP).toString());
|
||||
payOrderExcelVO.setChannelFeeRate(java.math.BigDecimal.valueOf(bean.getChannelFeeRate())
|
||||
.multiply(multiple).toString());
|
||||
payOrderExcelVO.setRefundAmount(BigDecimal.valueOf(bean.getRefundAmount())
|
||||
.divide(multiple, 2, RoundingMode.HALF_UP).toString());
|
||||
|
||||
return payOrderExcelVO;
|
||||
}
|
||||
|
||||
PayOrderDO convert(PayOrderCreateReqDTO bean);
|
||||
|
||||
@Mapping(target = "id", ignore = true)
|
||||
PayOrderExtensionDO convert(PayOrderSubmitReqVO bean, String userIp);
|
||||
|
||||
PayOrderUnifiedReqDTO convert2(PayOrderSubmitReqVO reqVO);
|
||||
|
||||
PayOrderSubmitRespVO convert(PayOrderUnifiedRespDTO bean);
|
||||
|
||||
AppPayOrderSubmitRespVO convert3(PayOrderSubmitRespVO bean);
|
||||
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
/**
|
||||
* 提供 POJO 类的实体转换
|
||||
*
|
||||
* 目前使用 MapStruct 框架
|
||||
*/
|
||||
package co.yixiang.yshop.module.pay.convert;
|
@ -1,96 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.convert.refund;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.module.pay.controller.admin.refund.vo.*;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.order.PayOrderDO;
|
||||
import co.yixiang.yshop.module.pay.dal.dataobject.refund.PayRefundDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PayRefundConvert {
|
||||
|
||||
PayRefundConvert INSTANCE = Mappers.getMapper(PayRefundConvert.class);
|
||||
|
||||
PayRefundDO convert(PayRefundCreateReqVO bean);
|
||||
|
||||
PayRefundDO convert(PayRefundUpdateReqVO bean);
|
||||
|
||||
PayRefundRespVO convert(PayRefundDO bean);
|
||||
|
||||
/**
|
||||
* 退款订单 DO 转 退款详情订单 VO
|
||||
*
|
||||
* @param bean 退款订单 DO
|
||||
* @return 退款详情订单 VO
|
||||
*/
|
||||
PayRefundDetailsRespVO refundDetailConvert(PayRefundDO bean);
|
||||
|
||||
/**
|
||||
* 退款订单DO 转 分页退款条目VO
|
||||
*
|
||||
* @param bean 退款订单DO
|
||||
* @return 分页退款条目VO
|
||||
*/
|
||||
PayRefundPageItemRespVO pageItemConvert(PayRefundDO bean);
|
||||
|
||||
List<PayRefundRespVO> convertList(List<PayRefundDO> list);
|
||||
|
||||
PageResult<PayRefundRespVO> convertPage(PageResult<PayRefundDO> page);
|
||||
|
||||
List<PayRefundExcelVO> convertList02(List<PayRefundDO> list);
|
||||
|
||||
/**
|
||||
* 退款订单DO 转 导出excel VO
|
||||
*
|
||||
* @param bean 退款订单DO
|
||||
* @return 导出 excel VO
|
||||
*/
|
||||
default PayRefundExcelVO excelConvert(PayRefundDO bean) {
|
||||
if (bean == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PayRefundExcelVO payRefundExcelVO = new PayRefundExcelVO();
|
||||
|
||||
payRefundExcelVO.setId(bean.getId());
|
||||
payRefundExcelVO.setTradeNo(bean.getTradeNo());
|
||||
payRefundExcelVO.setMerchantOrderId(bean.getMerchantOrderId());
|
||||
payRefundExcelVO.setMerchantRefundNo(bean.getMerchantRefundNo());
|
||||
payRefundExcelVO.setNotifyUrl(bean.getNotifyUrl());
|
||||
payRefundExcelVO.setNotifyStatus(bean.getNotifyStatus());
|
||||
payRefundExcelVO.setStatus(bean.getStatus());
|
||||
payRefundExcelVO.setType(bean.getType());
|
||||
payRefundExcelVO.setReason(bean.getReason());
|
||||
payRefundExcelVO.setUserIp(bean.getUserIp());
|
||||
payRefundExcelVO.setChannelOrderNo(bean.getChannelOrderNo());
|
||||
payRefundExcelVO.setChannelRefundNo(bean.getChannelRefundNo());
|
||||
payRefundExcelVO.setExpireTime(bean.getExpireTime());
|
||||
payRefundExcelVO.setSuccessTime(bean.getSuccessTime());
|
||||
payRefundExcelVO.setNotifyTime(bean.getNotifyTime());
|
||||
payRefundExcelVO.setCreateTime(bean.getCreateTime());
|
||||
|
||||
BigDecimal multiple = new BigDecimal(100);
|
||||
payRefundExcelVO.setPayAmount(BigDecimal.valueOf(bean.getPayAmount())
|
||||
.divide(multiple, 2, RoundingMode.HALF_UP).toString());
|
||||
payRefundExcelVO.setRefundAmount(BigDecimal.valueOf(bean.getRefundAmount())
|
||||
.divide(multiple, 2, RoundingMode.HALF_UP).toString());
|
||||
|
||||
return payRefundExcelVO;
|
||||
}
|
||||
|
||||
//TODO 太多需要处理了, 暂时不用
|
||||
@Mappings(value = {
|
||||
@Mapping(source = "amount", target = "payAmount"),
|
||||
@Mapping(source = "id", target = "orderId"),
|
||||
@Mapping(target = "status",ignore = true)
|
||||
})
|
||||
PayRefundDO convert(PayOrderDO orderDO);
|
||||
|
||||
}
|
@ -1 +0,0 @@
|
||||
<https://www.yixiang.co/Spring-Boot/MapStruct/?yshop>
|
@ -1,88 +0,0 @@
|
||||
package co.yixiang.yshop.module.pay.dal.dataobject.demo;
|
||||
|
||||
import co.yixiang.yshop.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 示例订单
|
||||
*
|
||||
* 演示业务系统的订单,如何接入 pay 系统的支付与退款
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@TableName("pay_demo_order")
|
||||
@KeySequence("pay_demo_order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PayDemoOrderDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 订单编号,自增
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 商品编号
|
||||
*/
|
||||
private Long spuId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String spuName;
|
||||
/**
|
||||
* 价格,单位:分
|
||||
*/
|
||||
private Integer price;
|
||||
|
||||
// ========== 支付相关字段 ==========
|
||||
|
||||
/**
|
||||
* 是否支付
|
||||
*/
|
||||
private Boolean payed;
|
||||
/**
|
||||
* 支付订单编号
|
||||
*
|
||||
* 对接 pay-module-biz 支付服务的支付订单编号,即 PayOrderDO 的 id 编号
|
||||
*/
|
||||
private Long payOrderId;
|
||||
/**
|
||||
* 付款时间
|
||||
*/
|
||||
private LocalDateTime payTime;
|
||||
/**
|
||||
* 支付渠道
|
||||
*
|
||||
* 对应 PayChannelEnum 枚举
|
||||
*/
|
||||
private String payChannelCode;
|
||||
|
||||
// ========== 退款相关字段 ==========
|
||||
/**
|
||||
* 支付退款单号
|
||||
*/
|
||||
private Long payRefundId;
|
||||
/**
|
||||
* 退款金额,单位:分
|
||||
*/
|
||||
private Integer refundPrice;
|
||||
/**
|
||||
* 退款完成时间
|
||||
*/
|
||||
private LocalDateTime refundTime;
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user