mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-07 04:58:28 +00:00
feat 消息通知的一些字段修正, 预留自动订单分账字段
This commit is contained in:
@@ -58,6 +58,9 @@ public class PayOrder extends MpBaseEntity implements EntityBaseFunction<PayOrde
|
||||
@DbColumn(comment = "是否需要分账")
|
||||
private Boolean allocation;
|
||||
|
||||
@DbColumn(comment = "自动分账")
|
||||
private Boolean autoAllocation;
|
||||
|
||||
/**
|
||||
* 支付通道
|
||||
* @see PayChannelEnum
|
||||
|
@@ -5,7 +5,7 @@ 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.order.reconcile.entity.ReconcileTradeDetail;
|
||||
import cn.bootx.platform.daxpay.service.param.reconcile.ReconcileDetailQuery;
|
||||
import cn.bootx.platform.daxpay.service.param.reconcile.ReconcileTradeDetailQuery;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -35,7 +35,7 @@ public class ReconcileTradeDetailManager extends BaseManager<ReconcileTradeDetai
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<ReconcileTradeDetail> page(PageParam pageParam, ReconcileDetailQuery query){
|
||||
public Page<ReconcileTradeDetail> page(PageParam pageParam, ReconcileTradeDetailQuery query){
|
||||
Page<ReconcileTradeDetail> mpPage = MpUtil.getMpPage(pageParam, ReconcileTradeDetail.class);
|
||||
QueryWrapper<ReconcileTradeDetail> generator = QueryGenerator.generator(query);
|
||||
return this.page(mpPage,generator);
|
||||
|
@@ -10,7 +10,7 @@ import cn.bootx.platform.daxpay.service.core.order.reconcile.entity.ReconcileOrd
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.entity.ReconcileTradeDetail;
|
||||
import cn.bootx.platform.daxpay.service.dto.order.reconcile.ReconcileOrderDto;
|
||||
import cn.bootx.platform.daxpay.service.dto.order.reconcile.ReconcileTradeDetailDto;
|
||||
import cn.bootx.platform.daxpay.service.param.reconcile.ReconcileDetailQuery;
|
||||
import cn.bootx.platform.daxpay.service.param.reconcile.ReconcileTradeDetailQuery;
|
||||
import cn.bootx.platform.daxpay.service.param.reconcile.ReconcileOrderQuery;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -46,7 +46,7 @@ public class ReconcileQueryService {
|
||||
/**
|
||||
* 明细分页
|
||||
*/
|
||||
public PageResult<ReconcileTradeDetailDto> pageDetail(PageParam pageParam, ReconcileDetailQuery query){
|
||||
public PageResult<ReconcileTradeDetailDto> pageDetail(PageParam pageParam, ReconcileTradeDetailQuery query){
|
||||
return MpUtil.convert2DtoPageResult(detailManager.page(pageParam, query));
|
||||
}
|
||||
|
||||
|
@@ -136,11 +136,11 @@ public class AllocationService {
|
||||
allocationOrder = allocationOrderManager.findByAllocationNo(param.getAllocationNo())
|
||||
.orElseThrow(() -> new DataNotExistException("未查询到分账单信息"));
|
||||
}
|
||||
|
||||
LockInfo lock = lockTemplate.lock("payment:allocation:" + allocationOrder.getOrderId(),10000,200);
|
||||
if (Objects.isNull(lock)){
|
||||
throw new RepetitiveOperationException("分账发起处理中,请勿重复操作");
|
||||
}
|
||||
|
||||
try {
|
||||
// 需要是分账中分账中或者完成状态才能重新分账
|
||||
List<String> list = Arrays.asList(AllocOrderStatusEnum.ALLOCATION_END.getCode(),
|
||||
@@ -172,7 +172,7 @@ public class AllocationService {
|
||||
}
|
||||
allocationOrderManager.updateById(allocationOrder);
|
||||
} finally {
|
||||
|
||||
lockTemplate.releaseLock(lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -67,7 +67,7 @@ public class ClientNoticeAssistService {
|
||||
.setSendCount(0)
|
||||
.setTradeId(order.getId())
|
||||
.setTradeNo(order.getOrderNo())
|
||||
.setOrderStatus(order.getStatus());
|
||||
.setTradeStatus(order.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,6 +77,7 @@ public class ClientNoticeAssistService {
|
||||
// 创建退款通知内容
|
||||
RefundNoticeResult payNoticeResult = new RefundNoticeResult()
|
||||
.setRefundNo(order.getRefundNo())
|
||||
.setBizRefundNo(order.getBizRefundNo())
|
||||
.setChannel(order.getChannel())
|
||||
.setAmount(order.getAmount())
|
||||
.setFinishTime(order.getFinishTime())
|
||||
@@ -94,7 +95,7 @@ public class ClientNoticeAssistService {
|
||||
.setSendCount(0)
|
||||
.setTradeId(order.getId())
|
||||
.setTradeNo(order.getRefundNo())
|
||||
.setOrderStatus(order.getStatus());
|
||||
.setTradeStatus(order.getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -106,7 +106,7 @@ public class PayAssistService {
|
||||
PlatformLocal platform = PaymentContextLocal.get()
|
||||
.getPlatformInfo();
|
||||
// 异步回调为开启状态
|
||||
if (Objects.equals(payParam.getNotNotify(), true) && apiInfo.isNotice()) {
|
||||
if (!Objects.equals(payParam.getNotNotify(), false) && apiInfo.isNotice()) {
|
||||
// 首先读取请求参数
|
||||
noticeInfo.setNotifyUrl(payParam.getNotifyUrl());
|
||||
// 读取接口配置
|
||||
|
@@ -68,7 +68,7 @@ public class PayService {
|
||||
try {
|
||||
// 查询并检查订单
|
||||
PayOrder payOrder = payAssistService.getOrderAndCheck(payParam.getBizOrderNo());
|
||||
// 初始化上下文
|
||||
// 初始化支付上下文
|
||||
payAssistService.initPayContext(payOrder, payParam);
|
||||
// 走首次下单逻辑还是重复下档逻辑
|
||||
if (Objects.isNull(payOrder)){
|
||||
|
@@ -61,7 +61,7 @@ public class RefundAssistService {
|
||||
ApiInfoLocal apiInfo = PaymentContextLocal.get().getApiInfo();
|
||||
PlatformLocal platform = PaymentContextLocal.get().getPlatformInfo();
|
||||
// 异步回调为开启状态
|
||||
if (!param.getNotNotify() && apiInfo.isNotice()){
|
||||
if (!Objects.equals(param.getNotNotify(), false) && apiInfo.isNotice()){
|
||||
// 首先读取请求参数
|
||||
noticeInfo.setNotifyUrl(param.getNotifyUrl());
|
||||
// 读取接口配置
|
||||
|
@@ -54,9 +54,11 @@ public class RefundService {
|
||||
|
||||
private final PayOrderQueryService payOrderQueryService;
|
||||
|
||||
private final LockTemplate lockTemplate;
|
||||
private final RefundOrderExtraManager refundOrderExtraManager;
|
||||
|
||||
private final LockTemplate lockTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* 分支付通道进行退款
|
||||
* 1. 创建退款订单(单独事务)
|
||||
@@ -78,6 +80,8 @@ public class RefundService {
|
||||
try {
|
||||
// 判断是否是首次发起退款
|
||||
Optional<RefundOrder> refund = refundOrderManager.findByBizRefundNo(param.getBizRefundNo());
|
||||
// 初始化退款通知上下文
|
||||
refundAssistService.initRefundContext(param);
|
||||
if (refund.isPresent()){
|
||||
return this.repeatRefund(refund.get(),param);
|
||||
} else {
|
||||
|
@@ -43,6 +43,10 @@ public class ClientNoticeRecord extends MpCreateEntity implements EntityBaseFunc
|
||||
@DbColumn(comment = "发送类型")
|
||||
private String sendType;
|
||||
|
||||
/** 错误编码 */
|
||||
@DbColumn(comment = "错误编码")
|
||||
private String errorCode;
|
||||
|
||||
/** 错误信息 */
|
||||
@DbColumn(comment = "错误信息")
|
||||
private String errorMsg;
|
||||
|
@@ -34,8 +34,8 @@ public class ClientNoticeTask extends MpBaseEntity implements EntityBaseFunction
|
||||
@DbColumn(comment = "本地交易ID")
|
||||
private Long tradeId;
|
||||
|
||||
/** 本地订单号 */
|
||||
@DbColumn(comment = "本地订单号")
|
||||
/** 本地交易号 */
|
||||
@DbColumn(comment = "本地交易号")
|
||||
private String tradeNo;
|
||||
|
||||
/**
|
||||
@@ -46,12 +46,12 @@ public class ClientNoticeTask extends MpBaseEntity implements EntityBaseFunction
|
||||
private String noticeType;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
* 交易状态
|
||||
* @see PayStatusEnum
|
||||
* @see RefundStatusEnum
|
||||
*/
|
||||
@DbColumn(comment = "订单状态")
|
||||
private String orderStatus;
|
||||
@DbColumn(comment = "交易状态")
|
||||
private String tradeStatus;
|
||||
|
||||
/** 消息内容 */
|
||||
@DbColumn(comment = "消息内容")
|
||||
|
@@ -43,6 +43,7 @@ public class AllocationGroupReceiverResult {
|
||||
|
||||
/** 接收方姓名 */
|
||||
@Schema(description = "接收方姓名")
|
||||
@SensitiveInfo(SensitiveInfo.SensitiveType.CHINESE_NAME)
|
||||
private String receiverName;
|
||||
|
||||
/**
|
||||
|
@@ -47,7 +47,7 @@ public class AllocationReceiverDto extends BaseDto {
|
||||
|
||||
/** 接收方姓名 */
|
||||
@Schema(description = "接收方姓名")
|
||||
@SensitiveInfo
|
||||
@SensitiveInfo(SensitiveInfo.SensitiveType.CHINESE_NAME)
|
||||
private String receiverName;
|
||||
|
||||
/**
|
||||
|
@@ -53,6 +53,7 @@ public class AllocationOrderDetailDto extends BaseDto {
|
||||
|
||||
/** 接收方姓名 */
|
||||
@Schema(description = "接收方姓名")
|
||||
@SensitiveInfo(SensitiveInfo.SensitiveType.CHINESE_NAME)
|
||||
private String receiverName;
|
||||
|
||||
/**
|
||||
|
@@ -46,6 +46,10 @@ public class PayOrderDto extends BaseDto {
|
||||
@Schema(description = "是否需要分账")
|
||||
private Boolean allocation;
|
||||
|
||||
/** 是否开启自动分账, 不传输为不开启 */
|
||||
@Schema(description = "是否开启自动分账")
|
||||
private Boolean autoAllocation;
|
||||
|
||||
/**
|
||||
* 支付通道
|
||||
* @see PayChannelEnum
|
||||
|
@@ -37,6 +37,10 @@ public class ClientNoticeRecordDto extends BaseDto {
|
||||
@Schema(description = "发送是否成功")
|
||||
private boolean success;
|
||||
|
||||
/** 错误编码 */
|
||||
@Schema(description = "错误编码")
|
||||
private String errorCode;
|
||||
|
||||
/** 错误信息 */
|
||||
@Schema(description = "错误信息")
|
||||
private String errorMsg;
|
||||
|
@@ -1,6 +1,8 @@
|
||||
package cn.bootx.platform.daxpay.service.dto.record.notice;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.dto.BaseDto;
|
||||
import cn.bootx.platform.daxpay.code.PayStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.RefundStatusEnum;
|
||||
import cn.bootx.platform.daxpay.service.code.ClientNoticeTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -24,8 +26,8 @@ public class ClientNoticeTaskDto extends BaseDto {
|
||||
@Schema(description = "本地交易ID")
|
||||
private Long tradeId;
|
||||
|
||||
/** 本地订单号 */
|
||||
@Schema(description = "本地订单号")
|
||||
/** 本地交易号 */
|
||||
@Schema(description = "本地交易号")
|
||||
private String tradeNo;
|
||||
|
||||
/**
|
||||
@@ -36,10 +38,12 @@ public class ClientNoticeTaskDto extends BaseDto {
|
||||
private String noticeType;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
* 交易状态
|
||||
* @see PayStatusEnum
|
||||
* @see RefundStatusEnum
|
||||
*/
|
||||
@Schema(description = "订单状态")
|
||||
private String orderStatus;
|
||||
private String tradeStatus;
|
||||
|
||||
/** 消息内容 */
|
||||
@Schema(description = "消息内容")
|
||||
|
@@ -44,6 +44,9 @@ public class PayOrderQuery extends QueryOrder {
|
||||
@Schema(description = "是否需要分账")
|
||||
private Boolean allocation;
|
||||
|
||||
@Schema(description = "是否开启自动分账")
|
||||
private Boolean autoAllocation;
|
||||
|
||||
/**
|
||||
* 支付通道
|
||||
* @see PayChannelEnum
|
||||
|
@@ -15,7 +15,7 @@ import lombok.experimental.Accessors;
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "对账详情查询")
|
||||
public class ReconcileDetailQuery {
|
||||
public class ReconcileTradeDetailQuery {
|
||||
|
||||
@Schema(description = "关联对账订单ID")
|
||||
private Long recordOrderId;
|
@@ -20,30 +20,14 @@ import lombok.experimental.Accessors;
|
||||
@Schema(title = "发送通知任务查询")
|
||||
public class ClientNoticeTaskQuery extends QueryOrder {
|
||||
|
||||
/** 本地订单ID */
|
||||
@Schema(description = "本地订单ID")
|
||||
private Long orderId;
|
||||
/** 本地交易号 */
|
||||
@Schema(description = "本地交易号")
|
||||
private String tradeNo;
|
||||
|
||||
/**
|
||||
* 通知类型
|
||||
* 回调类型
|
||||
* @see ClientNoticeTypeEnum
|
||||
*/
|
||||
@Schema(description = "通知类型")
|
||||
private String type;
|
||||
|
||||
/** 消息内容 */
|
||||
@Schema(description = "消息内容")
|
||||
private String content;
|
||||
|
||||
/** 是否发送成功 */
|
||||
@Schema(description = "是否发送成功")
|
||||
private Boolean success;
|
||||
|
||||
/** 发送次数 */
|
||||
@Schema(description = "发送次数")
|
||||
private Integer sendCount;
|
||||
|
||||
/** 发送地址 */
|
||||
@Schema(description = "发送地址")
|
||||
private String url;
|
||||
@Schema(description = "回调类型")
|
||||
private String noticeType;
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ import cn.bootx.platform.common.core.annotation.QueryParam;
|
||||
import cn.bootx.platform.common.core.rest.param.QueryOrder;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.service.code.PayCallbackStatusEnum;
|
||||
import cn.bootx.platform.daxpay.service.code.PaymentTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -21,9 +22,11 @@ import lombok.experimental.Accessors;
|
||||
@Schema(title = "支付回调信息记录")
|
||||
public class PayCallbackRecordQuery extends QueryOrder {
|
||||
|
||||
/** 本地订单ID */
|
||||
@Schema(description = "本地订单ID")
|
||||
private Long orderId;
|
||||
@Schema(description = "交易号")
|
||||
private String tradeNo;
|
||||
|
||||
@Schema(description = "通道交易号")
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* 支付通道
|
||||
@@ -32,6 +35,12 @@ public class PayCallbackRecordQuery extends QueryOrder {
|
||||
@Schema(description = "支付通道")
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
* 回调类型
|
||||
* @see PaymentTypeEnum
|
||||
*/
|
||||
@Schema(description = "回调类型")
|
||||
private String callbackType;
|
||||
|
||||
/**
|
||||
* 回调处理状态
|
||||
@@ -40,6 +49,6 @@ public class PayCallbackRecordQuery extends QueryOrder {
|
||||
@Schema(description = "回调处理状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "请求链路ID")
|
||||
private String reqId;
|
||||
@Schema(description = "修复号")
|
||||
private String repairNo;
|
||||
}
|
||||
|
Reference in New Issue
Block a user