diff --git a/daxpay-single-demo/pom.xml b/daxpay-single-demo/pom.xml
index 1eadf3b43..f11c54920 100644
--- a/daxpay-single-demo/pom.xml
+++ b/daxpay-single-demo/pom.xml
@@ -32,7 +32,7 @@
${bootx-platform.version}
-
+
cn.bootx.platform
daxpay-single-sdk
diff --git a/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/channel/AlipayController.java b/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/channel/AlipayController.java
new file mode 100644
index 000000000..134f23ffc
--- /dev/null
+++ b/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/channel/AlipayController.java
@@ -0,0 +1,43 @@
+package cn.bootx.platform.daxpay.admin.controller.channel;
+
+import cn.bootx.platform.common.core.rest.PageResult;
+import cn.bootx.platform.common.core.rest.Res;
+import cn.bootx.platform.common.core.rest.ResResult;
+import cn.bootx.platform.common.core.rest.param.PageParam;
+import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayRecordService;
+import cn.bootx.platform.daxpay.service.dto.channel.alipay.AliPayRecordDto;
+import cn.bootx.platform.daxpay.service.param.channel.alipay.AliPayRecordQuery;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 支付宝控制器
+ * @author xxm
+ * @since 2024/2/20
+ */
+@Tag(name = "支付宝控制器")
+@RestController
+@RequestMapping("/alipay")
+@RequiredArgsConstructor
+public class AlipayController {
+ private final AliPayRecordService aliPayRecordService;
+
+
+ @Operation(summary = "记录分页")
+ @GetMapping("/record/page")
+ public ResResult> recordPage(PageParam pageParam, AliPayRecordQuery query){
+ return Res.ok(aliPayRecordService.page(pageParam, query));
+ }
+
+
+ @Operation(summary = "查询记录详情")
+ @GetMapping("/record/findById")
+ public ResResult findById(Long id){
+ return Res.ok(aliPayRecordService.findById(id));
+ }
+
+}
diff --git a/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/channel/CashController.java b/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/channel/CashController.java
index 5d58d07af..c145a2e7d 100644
--- a/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/channel/CashController.java
+++ b/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/channel/CashController.java
@@ -39,5 +39,4 @@ public class CashController {
return Res.ok(cashRecordService.findById(id));
}
-
}
diff --git a/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/channel/WeChatPayController.java b/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/channel/WeChatPayController.java
new file mode 100644
index 000000000..a2365c671
--- /dev/null
+++ b/daxpay-single/daxpay-single-admin/src/main/java/cn/bootx/platform/daxpay/admin/controller/channel/WeChatPayController.java
@@ -0,0 +1,43 @@
+package cn.bootx.platform.daxpay.admin.controller.channel;
+
+import cn.bootx.platform.common.core.rest.PageResult;
+import cn.bootx.platform.common.core.rest.Res;
+import cn.bootx.platform.common.core.rest.ResResult;
+import cn.bootx.platform.common.core.rest.param.PageParam;
+import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayRecordService;
+import cn.bootx.platform.daxpay.service.dto.channel.wechat.WeChatPayRecordDto;
+import cn.bootx.platform.daxpay.service.param.channel.wechat.WeChatPayRecordQuery;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 微信支付控制器
+ * @author xxm
+ * @since 2024/2/20
+ */
+@Tag(name = "微信支付控制器")
+@RestController
+@RequestMapping("/wechat/pay")
+@RequiredArgsConstructor
+public class WeChatPayController {
+ private final WeChatPayRecordService weChatPayRecordService;
+
+
+ @Operation(summary = "记录分页")
+ @GetMapping("/record/page")
+ public ResResult> recordPage(PageParam pageParam, WeChatPayRecordQuery query){
+ return Res.ok(weChatPayRecordService.page(pageParam, query));
+ }
+
+
+ @Operation(summary = "查询记录详情")
+ @GetMapping("/record/findById")
+ public ResResult findById(Long id){
+ return Res.ok(weChatPayRecordService.findById(id));
+ }
+
+}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/code/AliPayRecordTypeEnum.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/code/AliPayRecordTypeEnum.java
new file mode 100644
index 000000000..45e933fbd
--- /dev/null
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/code/AliPayRecordTypeEnum.java
@@ -0,0 +1,23 @@
+package cn.bootx.platform.daxpay.service.code;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 支付宝流水记录类型
+ * @author xxm
+ * @since 2024/2/20
+ */
+@Getter
+@AllArgsConstructor
+public enum AliPayRecordTypeEnum {
+
+ /** 支付 */
+ PAY("pay", "支付")
+ ,
+ /** 退款 */
+ REFUND("refund", "退款");
+
+ private final String code;
+ private final String name;
+}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/convert/AlipayConvert.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/convert/AlipayConvert.java
index e1a9c25b5..36e070ea2 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/convert/AlipayConvert.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/convert/AlipayConvert.java
@@ -1,7 +1,9 @@
package cn.bootx.platform.daxpay.service.core.channel.alipay.convert;
import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliPayConfig;
+import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliPayRecord;
import cn.bootx.platform.daxpay.service.dto.channel.alipay.AliPayConfigDto;
+import cn.bootx.platform.daxpay.service.dto.channel.alipay.AliPayRecordDto;
import cn.bootx.platform.daxpay.service.param.channel.alipay.AliPayConfigParam;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@@ -19,6 +21,8 @@ public interface AlipayConvert {
AliPayConfig convert(AliPayConfigDto in);
+ AliPayRecordDto convert(AliPayRecord in);
+
AliPayConfig convert(AliPayConfigParam in);
AliPayConfigDto convert(AliPayConfig in);
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/dao/AliPayRecordManager.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/dao/AliPayRecordManager.java
index 8c7c7ecd8..2f8070d92 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/dao/AliPayRecordManager.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/dao/AliPayRecordManager.java
@@ -1,7 +1,13 @@
package cn.bootx.platform.daxpay.service.core.channel.alipay.dao;
+import cn.bootx.platform.common.core.rest.param.PageParam;
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
+import cn.bootx.platform.common.mybatisplus.util.MpUtil;
+import cn.bootx.platform.common.query.generator.QueryGenerator;
import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliPayRecord;
+import cn.bootx.platform.daxpay.service.param.channel.alipay.AliPayRecordQuery;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
@@ -15,4 +21,14 @@ import org.springframework.stereotype.Repository;
@Repository
@RequiredArgsConstructor
public class AliPayRecordManager extends BaseManager {
+
+
+ /**
+ * 分页
+ */
+ public Page page(PageParam pageParam, AliPayRecordQuery param){
+ Page mpPage = MpUtil.getMpPage(pageParam, AliPayRecord.class);
+ QueryWrapper generator = QueryGenerator.generator(param);
+ return this.page(mpPage, generator);
+ }
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/entity/AliPayRecord.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/entity/AliPayRecord.java
index f9f681cbb..f62519c86 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/entity/AliPayRecord.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/entity/AliPayRecord.java
@@ -1,6 +1,11 @@
package cn.bootx.platform.daxpay.service.core.channel.alipay.entity;
+import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpCreateEntity;
+import cn.bootx.platform.daxpay.service.code.AliPayRecordTypeEnum;
+import cn.bootx.platform.daxpay.service.core.channel.alipay.convert.AlipayConvert;
+import cn.bootx.platform.daxpay.service.dto.channel.alipay.AliPayRecordDto;
+import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbTable;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@@ -17,15 +22,33 @@ import lombok.experimental.Accessors;
@Accessors(chain = true)
@DbTable(comment = "支付宝流水记录")
@TableName("pay_alipay_record")
-public class AliPayRecord extends MpCreateEntity {
+public class AliPayRecord extends MpCreateEntity implements EntityBaseFunction {
/** 标题 */
+ @DbColumn(comment = "标题")
+ private String title;
/** 金额 */
+ @DbColumn(comment = "金额")
+ private Integer amount;
- /** 业务类型 */
+ /**
+ * 业务类型
+ * @see AliPayRecordTypeEnum
+ */
+ @DbColumn(comment = "业务类型")
+ private String type;
/** 本地订单号 */
+ @DbColumn(comment = "本地订单号")
+ private Long orderId;
/** 网关订单号 */
+ @DbColumn(comment = "网关订单号")
+ private String gatewayOrderNo;
+
+ @Override
+ public AliPayRecordDto toDto() {
+ return AlipayConvert.CONVERT.convert(this);
+ }
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPayRecordService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPayRecordService.java
index e53bc718a..9c2ad51dc 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPayRecordService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/alipay/service/AliPayRecordService.java
@@ -1,6 +1,18 @@
package cn.bootx.platform.daxpay.service.core.channel.alipay.service;
-
+import cn.bootx.platform.common.core.exception.DataNotExistException;
+import cn.bootx.platform.common.core.rest.PageResult;
+import cn.bootx.platform.common.core.rest.param.PageParam;
+import cn.bootx.platform.common.mybatisplus.util.MpUtil;
+import cn.bootx.platform.daxpay.service.code.AliPayRecordTypeEnum;
+import cn.bootx.platform.daxpay.service.core.channel.alipay.dao.AliPayRecordManager;
+import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliPayRecord;
+import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayChannelOrder;
+import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
+import cn.bootx.platform.daxpay.service.core.order.refund.entity.PayRefundChannelOrder;
+import cn.bootx.platform.daxpay.service.core.order.refund.entity.PayRefundOrder;
+import cn.bootx.platform.daxpay.service.dto.channel.alipay.AliPayRecordDto;
+import cn.bootx.platform.daxpay.service.param.channel.alipay.AliPayRecordQuery;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -14,4 +26,46 @@ import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class AliPayRecordService {
+
+ private final AliPayRecordManager aliPayRecordManager;
+
+ /**
+ * 支付
+ */
+ public void pay(PayOrder order, PayChannelOrder channelOrder){
+ AliPayRecord aliPayRecord = new AliPayRecord()
+ .setType(AliPayRecordTypeEnum.PAY.getCode())
+ .setTitle(order.getTitle())
+ .setOrderId(order.getId())
+ .setGatewayOrderNo(order.getGatewayOrderNo())
+ .setAmount(channelOrder.getAmount());
+ aliPayRecordManager.save(aliPayRecord);
+ }
+
+ /**
+ * 退款
+ */
+ public void refund(PayRefundOrder order, PayRefundChannelOrder channelOrder){
+ AliPayRecord aliPayRecord = new AliPayRecord()
+ .setType(AliPayRecordTypeEnum.PAY.getCode())
+ .setTitle(order.getTitle())
+ .setOrderId(order.getId())
+ .setGatewayOrderNo(order.getGatewayOrderNo())
+ .setAmount(channelOrder.getAmount());
+ aliPayRecordManager.save(aliPayRecord);
+ }
+
+ /**
+ * 分页
+ */
+ public PageResult page(PageParam pageParam, AliPayRecordQuery param){
+ return MpUtil.convert2DtoPageResult(aliPayRecordManager.page(pageParam, param));
+ }
+
+ /**
+ * 查询详情
+ */
+ public AliPayRecordDto findById(Long id){
+ return aliPayRecordManager.findById(id).map(AliPayRecord::toDto).orElseThrow(DataNotExistException::new);
+ }
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wallet/convert/WalletConvert.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wallet/convert/WalletConvert.java
index 7213a3f4d..c98127355 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wallet/convert/WalletConvert.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wallet/convert/WalletConvert.java
@@ -3,9 +3,11 @@ package cn.bootx.platform.daxpay.service.core.channel.wallet.convert;
import cn.bootx.platform.daxpay.service.core.channel.wallet.entity.Wallet;
import cn.bootx.platform.daxpay.service.core.channel.wallet.entity.WalletConfig;
import cn.bootx.platform.daxpay.service.core.channel.wallet.entity.WalletRecord;
+import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayRecord;
import cn.bootx.platform.daxpay.service.dto.channel.wallet.WalletConfigDto;
import cn.bootx.platform.daxpay.service.dto.channel.wallet.WalletDto;
import cn.bootx.platform.daxpay.service.dto.channel.wallet.WalletRecordDto;
+import cn.bootx.platform.daxpay.service.dto.channel.wechat.WeChatPayRecordDto;
import cn.bootx.platform.daxpay.service.param.channel.wechat.WalletConfigParam;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/convert/WeChatConvert.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/convert/WeChatConvert.java
index 58d3c7c15..47b335be8 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/convert/WeChatConvert.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/convert/WeChatConvert.java
@@ -1,7 +1,9 @@
package cn.bootx.platform.daxpay.service.core.channel.wechat.convert;
import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConfig;
+import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayRecord;
import cn.bootx.platform.daxpay.service.dto.channel.wechat.WeChatPayConfigDto;
+import cn.bootx.platform.daxpay.service.dto.channel.wechat.WeChatPayRecordDto;
import cn.bootx.platform.daxpay.service.param.channel.wechat.WeChatPayConfigParam;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@@ -19,6 +21,8 @@ public interface WeChatConvert {
WeChatPayConfig convert(WeChatPayConfigParam in);
+ WeChatPayRecordDto convert(WeChatPayRecord in);
+
WeChatPayConfigDto convert(WeChatPayConfig in);
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/dao/WeChatPayRecordManager.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/dao/WeChatPayRecordManager.java
index 9aea7fcdb..79cca161e 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/dao/WeChatPayRecordManager.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/dao/WeChatPayRecordManager.java
@@ -1,5 +1,13 @@
package cn.bootx.platform.daxpay.service.core.channel.wechat.dao;
+import cn.bootx.platform.common.core.rest.param.PageParam;
+import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
+import cn.bootx.platform.common.mybatisplus.util.MpUtil;
+import cn.bootx.platform.common.query.generator.QueryGenerator;
+import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayRecord;
+import cn.bootx.platform.daxpay.service.param.channel.wechat.WeChatPayRecordQuery;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
@@ -12,5 +20,14 @@ import org.springframework.stereotype.Repository;
@Slf4j
@Repository
@RequiredArgsConstructor
-public class WeChatPayRecordManager {
+public class WeChatPayRecordManager extends BaseManager {
+
+ /**
+ * 分页
+ */
+ public Page page(PageParam pageParam, WeChatPayRecordQuery param){
+ Page mpPage = MpUtil.getMpPage(pageParam, WeChatPayRecord.class);
+ QueryWrapper generator = QueryGenerator.generator(param);
+ return this.page(mpPage, generator);
+ }
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/entity/WeChatPayRecord.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/entity/WeChatPayRecord.java
index 26c1e627b..cc3c6b2b6 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/entity/WeChatPayRecord.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/entity/WeChatPayRecord.java
@@ -1,6 +1,11 @@
package cn.bootx.platform.daxpay.service.core.channel.wechat.entity;
+import cn.bootx.platform.common.core.function.EntityBaseFunction;
import cn.bootx.platform.common.mybatisplus.base.MpCreateEntity;
+import cn.bootx.platform.daxpay.service.code.AliPayRecordTypeEnum;
+import cn.bootx.platform.daxpay.service.core.channel.wechat.convert.WeChatConvert;
+import cn.bootx.platform.daxpay.service.dto.channel.wechat.WeChatPayRecordDto;
+import cn.bootx.table.modify.annotation.DbColumn;
import cn.bootx.table.modify.annotation.DbTable;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@@ -17,5 +22,33 @@ import lombok.experimental.Accessors;
@DbTable(comment = "微信支付记录")
@Accessors(chain = true)
@TableName("pay_wechat_pay_record")
-public class WeChatPayRecord extends MpCreateEntity {
+public class WeChatPayRecord extends MpCreateEntity implements EntityBaseFunction {
+
+ /** 标题 */
+ @DbColumn(comment = "标题")
+ private String title;
+
+ /** 金额 */
+ @DbColumn(comment = "金额")
+ private Integer amount;
+
+ /**
+ * 业务类型
+ * @see AliPayRecordTypeEnum
+ */
+ @DbColumn(comment = "业务类型")
+ private String type;
+
+ /** 本地订单号 */
+ @DbColumn(comment = "本地订单号")
+ private Long orderId;
+
+ /** 网关订单号 */
+ @DbColumn(comment = "网关订单号")
+ private String gatewayOrderNo;
+
+ @Override
+ public WeChatPayRecordDto toDto() {
+ return WeChatConvert.CONVERT.convert(this);
+ }
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPayRecordService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPayRecordService.java
index b6c41f214..6ab8393c2 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPayRecordService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPayRecordService.java
@@ -1,6 +1,18 @@
package cn.bootx.platform.daxpay.service.core.channel.wechat.service;
+import cn.bootx.platform.common.core.exception.DataNotExistException;
+import cn.bootx.platform.common.core.rest.PageResult;
+import cn.bootx.platform.common.core.rest.param.PageParam;
+import cn.bootx.platform.common.mybatisplus.util.MpUtil;
+import cn.bootx.platform.daxpay.service.code.AliPayRecordTypeEnum;
import cn.bootx.platform.daxpay.service.core.channel.wechat.dao.WeChatPayRecordManager;
+import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayRecord;
+import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayChannelOrder;
+import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
+import cn.bootx.platform.daxpay.service.core.order.refund.entity.PayRefundChannelOrder;
+import cn.bootx.platform.daxpay.service.core.order.refund.entity.PayRefundOrder;
+import cn.bootx.platform.daxpay.service.dto.channel.wechat.WeChatPayRecordDto;
+import cn.bootx.platform.daxpay.service.param.channel.wechat.WeChatPayRecordQuery;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -15,4 +27,46 @@ import org.springframework.stereotype.Service;
@RequiredArgsConstructor
public class WeChatPayRecordService {
private final WeChatPayRecordManager weChatPayRecordManager;
+
+ /**
+ * 支付
+ */
+ public void pay(PayOrder order, PayChannelOrder channelOrder){
+ WeChatPayRecord weChatPayRecord = new WeChatPayRecord()
+ .setType(AliPayRecordTypeEnum.PAY.getCode())
+ .setTitle(order.getTitle())
+ .setOrderId(order.getId())
+ .setGatewayOrderNo(order.getGatewayOrderNo())
+ .setAmount(channelOrder.getAmount());
+ weChatPayRecordManager.save(weChatPayRecord);
+ }
+
+ /**
+ * 退款
+ */
+ public void refund(PayRefundOrder order, PayRefundChannelOrder channelOrder){
+ WeChatPayRecord weChatPayRecord = new WeChatPayRecord()
+ .setType(AliPayRecordTypeEnum.PAY.getCode())
+ .setTitle(order.getTitle())
+ .setOrderId(order.getId())
+ .setGatewayOrderNo(order.getGatewayOrderNo())
+ .setAmount(channelOrder.getAmount());
+ weChatPayRecordManager.save(weChatPayRecord);
+ }
+
+ /**
+ * 分页
+ */
+ public PageResult page(PageParam pageParam, WeChatPayRecordQuery param){
+ return MpUtil.convert2DtoPageResult(weChatPayRecordManager.page(pageParam, param));
+ }
+
+ /**
+ * 查询详情
+ */
+ public WeChatPayRecordDto findById(Long id){
+ return weChatPayRecordManager.findById(id).map(WeChatPayRecord::toDto).orElseThrow(DataNotExistException::new);
+ }
+
+
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPayService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPayService.java
index 957ec99c8..92156541b 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPayService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/channel/wechat/service/WeChatPayService.java
@@ -201,8 +201,7 @@ public class WeChatPayService {
String errCode = result.get(WeChatPayCode.ERR_CODE);
// 支付成功处理,
if (Objects.equals(resultCode, WeChatPayCode.PAY_SUCCESS)) {
- asyncPayInfo.setGatewayOrderNo(result.get(WeChatPayCode.TRANSACTION_ID))
- .setPayComplete(true);
+ asyncPayInfo.setGatewayOrderNo(result.get(WeChatPayCode.TRANSACTION_ID)).setPayComplete(true);
return;
}
// 支付中, 发起轮训同步
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/callback/service/PayCallbackService.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/callback/service/PayCallbackService.java
index 31471915b..83581af78 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/callback/service/PayCallbackService.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/callback/service/PayCallbackService.java
@@ -77,7 +77,7 @@ public class PayCallbackService {
*/
private void success(PayOrder payOrder) {
CallbackLocal callbackInfo = PaymentContextLocal.get().getCallbackInfo();
- // 回调时间超出了支付单超时时间, 记录一下, 不做处理 TODO 这块应该把订单给当成正常结束给处理了,
+ // 回调时间超出了支付单超时时间, 记录一下, 不做处理 TODO 考虑不全, 需要做退款or人工处理
if (Objects.nonNull(payOrder.getExpiredTime())
&& LocalDateTimeUtil.ge(LocalDateTime.now(), payOrder.getExpiredTime())) {
callbackInfo.setCallbackStatus(PayCallbackStatusEnum.EXCEPTION).setMsg("回调时间超出了支付单支付有效时间");
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/strategy/AliPayStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/strategy/AliPayStrategy.java
index c881d2e51..35fc28d1d 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/strategy/AliPayStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/strategy/AliPayStrategy.java
@@ -5,8 +5,11 @@ import cn.bootx.platform.daxpay.exception.pay.PayAmountAbnormalException;
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
import cn.bootx.platform.daxpay.param.channel.AliPayParam;
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;
+import cn.bootx.platform.daxpay.service.common.context.AsyncPayLocal;
+import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliPayConfig;
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayConfigService;
+import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayRecordService;
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayService;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayChannelOrderService;
import cn.bootx.platform.daxpay.service.func.AbsPayStrategy;
@@ -38,6 +41,8 @@ public class AliPayStrategy extends AbsPayStrategy {
private final AliPayConfigService alipayConfigService;
+ private final AliPayRecordService aliRecordService;
+
private AliPayConfig alipayConfig;
private AliPayParam aliPayParam;
@@ -88,15 +93,12 @@ public class AliPayStrategy extends AbsPayStrategy {
*/
@Override
public void doSuccessHandler() {
+ AsyncPayLocal asyncPayInfo = PaymentContextLocal.get().getAsyncPayInfo();
channelOrderService.switchAsyncPayChannel(this.getOrder(), this.getPayChannelParam());
- this.getOrder().setAsyncChannel(this.getChannel().getCode());
- }
-
- /**
- * 不使用默认的生成通道支付单方法, 异步支付通道的支付订单自己管理
- */
- @Override
- public void generateChannelOrder() {
+ // 支付完成, 保存记录
+ if (asyncPayInfo.isPayComplete()) {
+ aliRecordService.pay(this.getOrder(), this.getChannelOrder());
+ }
}
/**
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/strategy/WeChatPayStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/strategy/WeChatPayStrategy.java
index a3522e3e8..63fc74128 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/strategy/WeChatPayStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/pay/strategy/WeChatPayStrategy.java
@@ -3,8 +3,11 @@ package cn.bootx.platform.daxpay.service.core.payment.pay.strategy;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.exception.pay.PayAmountAbnormalException;
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;
+import cn.bootx.platform.daxpay.service.common.context.AsyncPayLocal;
+import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConfig;
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayConfigService;
+import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayRecordService;
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayService;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayChannelOrderService;
import cn.bootx.platform.daxpay.service.func.AbsPayStrategy;
@@ -36,6 +39,8 @@ public class WeChatPayStrategy extends AbsPayStrategy {
private final WeChatPayService weChatPayService;
+ private final WeChatPayRecordService weChatPayRecordService;
+
private WeChatPayConfig weChatPayConfig;
private WeChatPayParam weChatPayParam;
@@ -87,6 +92,11 @@ public class WeChatPayStrategy extends AbsPayStrategy {
public void doSuccessHandler() {
channelOrderService.switchAsyncPayChannel(this.getOrder(), this.getPayChannelParam());
this.getOrder().setAsyncChannel(this.getChannel().getCode());
+ AsyncPayLocal asyncPayInfo = PaymentContextLocal.get().getAsyncPayInfo();
+ // 是否支付完成, 保存流水记录
+ if (asyncPayInfo.isPayComplete()){
+ weChatPayRecordService.pay(this.getOrder(), this.getChannelOrder());
+ }
}
/**
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/strategy/AliPayRefundStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/strategy/AliPayRefundStrategy.java
index 6ee7eac5b..3ad055c58 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/strategy/AliPayRefundStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/strategy/AliPayRefundStrategy.java
@@ -5,6 +5,7 @@ import cn.bootx.platform.daxpay.code.RefundStatusEnum;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliPayConfig;
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayConfigService;
+import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayRecordService;
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayRefundService;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayChannelOrderService;
import cn.bootx.platform.daxpay.service.func.AbsRefundStrategy;
@@ -12,6 +13,8 @@ import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
+import java.util.Objects;
+
import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE;
/**
@@ -26,6 +29,7 @@ public class AliPayRefundStrategy extends AbsRefundStrategy {
private final AliPayConfigService alipayConfigService;
private final AliPayRefundService aliRefundService;
+ private final AliPayRecordService aliRecordService;;
private final PayChannelOrderService payChannelOrderService;
/**
* 策略标识
@@ -68,5 +72,9 @@ public class AliPayRefundStrategy extends AbsRefundStrategy {
// 更新支付通道订单中的属性
payChannelOrderService.updateAsyncPayRefund(this.getPayChannelOrder(), this.getRefundChannelOrder());
+ // 如果退款完成, 保存流水记录
+ if (Objects.equals(RefundStatusEnum.SUCCESS.getCode(), refundStatusEnum.getCode())) {
+ aliRecordService.refund(this.getRefundOrder(), this.getRefundChannelOrder());
+ }
}
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/strategy/WeChatPayRefundStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/strategy/WeChatPayRefundStrategy.java
index d02ba2e52..0fcbe3fd1 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/strategy/WeChatPayRefundStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/refund/strategy/WeChatPayRefundStrategy.java
@@ -5,6 +5,7 @@ import cn.bootx.platform.daxpay.code.RefundStatusEnum;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConfig;
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayConfigService;
+import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayRecordService;
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WechatRefundService;
import cn.bootx.platform.daxpay.service.core.order.pay.service.PayChannelOrderService;
import cn.bootx.platform.daxpay.service.func.AbsRefundStrategy;
@@ -12,6 +13,8 @@ import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
+import java.util.Objects;
+
import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE;
/**
@@ -28,6 +31,8 @@ public class WeChatPayRefundStrategy extends AbsRefundStrategy {
private final WechatRefundService wechatRefundService;
+ private final WeChatPayRecordService weChatPayRecordService;
+
private final PayChannelOrderService payChannelOrderService;
private WeChatPayConfig weChatPayConfig;
@@ -72,5 +77,9 @@ public class WeChatPayRefundStrategy extends AbsRefundStrategy {
// 更新支付通道订单中的属性
payChannelOrderService.updateAsyncPayRefund(this.getPayChannelOrder(), this.getRefundChannelOrder());
+ // 如果退款完成, 保存流水记录
+ if (Objects.equals(RefundStatusEnum.SUCCESS.getCode(), refundStatusEnum.getCode())) {
+ weChatPayRecordService.refund(this.getRefundOrder(), this.getRefundChannelOrder());
+ }
}
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/pay/AliPayRepairStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/pay/AliPayRepairStrategy.java
index 1a3653f90..8c17db6b0 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/pay/AliPayRepairStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/pay/AliPayRepairStrategy.java
@@ -6,6 +6,7 @@ import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliPayConfig;
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayCloseService;
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayConfigService;
+import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayRecordService;
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayChannelOrderManager;
import cn.bootx.platform.daxpay.service.func.AbsPayRepairStrategy;
import lombok.RequiredArgsConstructor;
@@ -31,6 +32,8 @@ public class AliPayRepairStrategy extends AbsPayRepairStrategy {
private final AliPayConfigService aliPayConfigService;
+ private final AliPayRecordService aliRecordService;
+
private final PayChannelOrderManager payChannelOrderManager;
/**
@@ -61,6 +64,8 @@ public class AliPayRepairStrategy extends AbsPayRepairStrategy {
this.getChannelOrder().setStatus(PayStatusEnum.SUCCESS.getCode())
.setPayTime(payTime);
payChannelOrderManager.updateById(this.getChannelOrder());
+ // 支付完成, 保存记录
+ aliRecordService.pay(this.getOrder(), this.getChannelOrder());
}
/**
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/pay/WeChatPayRepairStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/pay/WeChatPayRepairStrategy.java
index 27f72fc27..b5bc6aa1b 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/pay/WeChatPayRepairStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/pay/WeChatPayRepairStrategy.java
@@ -6,6 +6,7 @@ import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConfig;
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayCloseService;
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayConfigService;
+import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayRecordService;
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayChannelOrderManager;
import cn.bootx.platform.daxpay.service.func.AbsPayRepairStrategy;
import lombok.RequiredArgsConstructor;
@@ -33,6 +34,8 @@ public class WeChatPayRepairStrategy extends AbsPayRepairStrategy {
private final PayChannelOrderManager payChannelOrderManager;
+ private final WeChatPayRecordService weChatPayRecordService;
+
private WeChatPayConfig weChatPayConfig;
/**
@@ -62,6 +65,8 @@ public class WeChatPayRepairStrategy extends AbsPayRepairStrategy {
this.getChannelOrder().setStatus(PayStatusEnum.SUCCESS.getCode())
.setPayTime(payTime);
payChannelOrderManager.updateById(this.getChannelOrder());
+ // 保存流水记录
+ weChatPayRecordService.pay(this.getOrder(), this.getChannelOrder());
}
/**
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/refund/AliRefundRepairStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/refund/AliRefundRepairStrategy.java
index 037604641..1e798a820 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/refund/AliRefundRepairStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/refund/AliRefundRepairStrategy.java
@@ -2,6 +2,7 @@ package cn.bootx.platform.daxpay.service.core.payment.repair.strategy.refund;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
+import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayRecordService;
import cn.bootx.platform.daxpay.service.func.AbsRefundRepairStrategy;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -23,6 +24,8 @@ import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROT
@RequiredArgsConstructor
public class AliRefundRepairStrategy extends AbsRefundRepairStrategy {
+ private final AliPayRecordService aliPayRecordService;
+
/**
* 策略标识
*/
@@ -43,5 +46,7 @@ public class AliRefundRepairStrategy extends AbsRefundRepairStrategy {
super.doSuccessHandler();
// 异步支付需要追加完成时间
this.getRefundChannelOrder().setRefundTime(finishTime);
+ // 记录退款成功记录
+ aliPayRecordService.refund(this.getRefundOrder(), this.getRefundChannelOrder());
}
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/refund/WeChatRefundRepairStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/refund/WeChatRefundRepairStrategy.java
index e13d7ac55..87030e4b5 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/refund/WeChatRefundRepairStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/core/payment/repair/strategy/refund/WeChatRefundRepairStrategy.java
@@ -2,6 +2,7 @@ package cn.bootx.platform.daxpay.service.core.payment.repair.strategy.refund;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
+import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayRecordService;
import cn.bootx.platform.daxpay.service.func.AbsRefundRepairStrategy;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -22,6 +23,9 @@ import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROT
@Service
@RequiredArgsConstructor
public class WeChatRefundRepairStrategy extends AbsRefundRepairStrategy {
+
+ private final WeChatPayRecordService wechatPayRecordService;
+
/**
* 策略标识
*/
@@ -42,5 +46,7 @@ public class WeChatRefundRepairStrategy extends AbsRefundRepairStrategy {
super.doSuccessHandler();
// 异步支付需要追加完成时间
this.getRefundChannelOrder().setRefundTime(finishTime);
+ // 记录退款成功记录
+ wechatPayRecordService.refund(this.getRefundOrder(), this.getRefundChannelOrder());
}
}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/channel/alipay/AliPayRecordDto.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/channel/alipay/AliPayRecordDto.java
new file mode 100644
index 000000000..9b84a16d2
--- /dev/null
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/channel/alipay/AliPayRecordDto.java
@@ -0,0 +1,44 @@
+package cn.bootx.platform.daxpay.service.dto.channel.alipay;
+
+import cn.bootx.platform.common.core.rest.dto.BaseDto;
+import cn.bootx.platform.daxpay.service.code.AliPayRecordTypeEnum;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * 微信支付记录
+ * @author xxm
+ * @since 2024/2/20
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Accessors(chain = true)
+@Schema(title = "微信支付记录")
+public class AliPayRecordDto extends BaseDto {
+
+ /** 标题 */
+ @Schema(description = "标题")
+ private String title;
+
+ /** 金额 */
+ @Schema(description = "金额")
+ private Integer amount;
+
+ /**
+ * 业务类型
+ * @see AliPayRecordTypeEnum
+ */
+ @Schema(description = "业务类型")
+ private String type;
+
+ /** 本地订单号 */
+ @Schema(description = "本地订单号")
+ private Long orderId;
+
+ /** 网关订单号 */
+ @Schema(description = "网关订单号")
+ private String gatewayOrderNo;
+
+}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/channel/wechat/WeChatPayRecordDto.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/channel/wechat/WeChatPayRecordDto.java
new file mode 100644
index 000000000..cec501147
--- /dev/null
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/dto/channel/wechat/WeChatPayRecordDto.java
@@ -0,0 +1,44 @@
+package cn.bootx.platform.daxpay.service.dto.channel.wechat;
+
+import cn.bootx.platform.common.core.rest.dto.BaseDto;
+import cn.bootx.platform.daxpay.service.code.AliPayRecordTypeEnum;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * 微信支付记录
+ * @author xxm
+ * @since 2024/2/20
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Accessors(chain = true)
+@Schema(title = "微信支付记录")
+public class WeChatPayRecordDto extends BaseDto {
+
+ /** 标题 */
+ @Schema(description = "标题")
+ private String title;
+
+ /** 金额 */
+ @Schema(description = "金额")
+ private Integer amount;
+
+ /**
+ * 业务类型
+ * @see AliPayRecordTypeEnum
+ */
+ @Schema(description = "业务类型")
+ private String type;
+
+ /** 本地订单号 */
+ @Schema(description = "本地订单号")
+ private Long orderId;
+
+ /** 网关订单号 */
+ @Schema(description = "网关订单号")
+ private String gatewayOrderNo;
+
+}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/func/AbsCallbackStrategy.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/func/AbsCallbackStrategy.java
index 2cc266c61..cb04ac8a6 100644
--- a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/func/AbsCallbackStrategy.java
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/func/AbsCallbackStrategy.java
@@ -32,7 +32,6 @@ public abstract class AbsCallbackStrategy implements PayStrategy {
/**
* 回调处理入口
- * TODO 需要处理异常情况进行保存
*/
public String callback(Map params) {
CallbackLocal callbackInfo = PaymentContextLocal.get().getCallbackInfo();
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/param/channel/alipay/AliPayRecordQuery.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/param/channel/alipay/AliPayRecordQuery.java
new file mode 100644
index 000000000..1671bda36
--- /dev/null
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/param/channel/alipay/AliPayRecordQuery.java
@@ -0,0 +1,36 @@
+package cn.bootx.platform.daxpay.service.param.channel.alipay;
+
+import cn.bootx.platform.common.core.annotation.QueryParam;
+import cn.bootx.platform.common.core.rest.param.QueryOrder;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * 支付宝支付记录查询参数
+ * @author xxm
+ * @since 2024/2/20
+ */
+@QueryParam
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Accessors(chain = true)
+@Schema(title = "支付宝支付记录查询参数")
+public class AliPayRecordQuery extends QueryOrder {
+
+ @QueryParam(type = QueryParam.CompareTypeEnum.LIKE)
+ @Schema(description = "标题")
+ private String title;
+
+ @Schema(description = "类型")
+ private String type;
+
+ @Schema(description = "本地订单ID")
+ private Long orderId;
+
+ @Schema(description = "网关订单号")
+ private String gatewayOrderNo;
+
+
+}
diff --git a/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/param/channel/wechat/WeChatPayRecordQuery.java b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/param/channel/wechat/WeChatPayRecordQuery.java
new file mode 100644
index 000000000..6f9516b48
--- /dev/null
+++ b/daxpay-single/daxpay-single-service/src/main/java/cn/bootx/platform/daxpay/service/param/channel/wechat/WeChatPayRecordQuery.java
@@ -0,0 +1,36 @@
+package cn.bootx.platform.daxpay.service.param.channel.wechat;
+
+import cn.bootx.platform.common.core.annotation.QueryParam;
+import cn.bootx.platform.common.core.rest.param.QueryOrder;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * 微信支付记录查询参数
+ * @author xxm
+ * @since 2024/2/20
+ */
+@QueryParam
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Accessors(chain = true)
+@Schema(title = "微信支付记录查询参数")
+public class WeChatPayRecordQuery extends QueryOrder {
+
+ @QueryParam(type = QueryParam.CompareTypeEnum.LIKE)
+ @Schema(description = "标题")
+ private String title;
+
+ @Schema(description = "类型")
+ private String type;
+
+ @Schema(description = "本地订单ID")
+ private Long orderId;
+
+ @Schema(description = "网关订单号")
+ private String gatewayOrderNo;
+
+
+}