mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-07 21:17:42 +00:00
ref 与多商户使用同架构实现
This commit is contained in:
61
daxpay-single/daxpay-single-service/pom.xml
Normal file
61
daxpay-single/daxpay-single-service/pom.xml
Normal file
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.dromara.daxpay</groupId>
|
||||
<artifactId>daxpay-single</artifactId>
|
||||
<version>3.0.0.beta1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>daxpay-single-service</artifactId>
|
||||
<description>支付服务实现模块</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- web框架 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 类型转换 -->
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 支付核心包 -->
|
||||
<dependency>
|
||||
<groupId>org.dromara.daxpay</groupId>
|
||||
<artifactId>daxpay-single-core</artifactId>
|
||||
<version>${daxpay.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 临时依赖, 后期会重新整理 -->
|
||||
|
||||
<!-- 延时任务 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<artifactId>starter-delay-queue</artifactId>
|
||||
<version>${bootx-platform.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<artifactId>common-swagger</artifactId>
|
||||
<version>${bootx-platform.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 认证服务 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<artifactId>service-iam</artifactId>
|
||||
<version>${bootx-platform.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@@ -0,0 +1,17 @@
|
||||
package org.dromara.daxpay.service;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
/**
|
||||
* 业务实现层
|
||||
* @author xxm
|
||||
* @since 2024/5/23
|
||||
*/
|
||||
@ConfigurationPropertiesScan
|
||||
@MapperScan(annotationClass = Mapper.class)
|
||||
@ComponentScan
|
||||
public class DaxpaySingleServiceApp {
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
package org.dromara.daxpay.service.bo.reconcile;
|
||||
|
||||
import org.dromara.daxpay.core.enums.TradeStatusEnum;
|
||||
import org.dromara.daxpay.core.enums.TradeTypeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 支付通道交易对账单
|
||||
* @author xxm
|
||||
* @since 2024/8/6
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ChannelReconcileTradeBo {
|
||||
|
||||
/**
|
||||
* 交易类型
|
||||
* @see TradeTypeEnum
|
||||
*/
|
||||
private String tradeType;
|
||||
|
||||
/**
|
||||
* 交易状态
|
||||
* @see TradeStatusEnum
|
||||
*/
|
||||
private String tradeStatus;
|
||||
|
||||
/** 平台交易号 */
|
||||
private String outTradeNo;
|
||||
|
||||
/** 通道交易号 */
|
||||
private String tradeNo;
|
||||
|
||||
/** 交易金额 */
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 交易时间 */
|
||||
private LocalDateTime tradeTime;
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
package org.dromara.daxpay.service.bo.reconcile;
|
||||
|
||||
import org.dromara.daxpay.core.enums.TradeStatusEnum;
|
||||
import org.dromara.daxpay.core.enums.TradeTypeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 平台通用交易对象对象,用于与网关进行对账
|
||||
* @author xxm
|
||||
* @since 2024/3/1
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PlatformReconcileTradeBo {
|
||||
|
||||
/**
|
||||
* 交易类型
|
||||
* @see TradeTypeEnum
|
||||
*/
|
||||
private String tradeType;
|
||||
|
||||
/** 金额 */
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 交易状态
|
||||
* @see TradeStatusEnum
|
||||
*/
|
||||
private String tradeStatus;
|
||||
|
||||
/** 平台交易号 */
|
||||
private String tradeNo;
|
||||
|
||||
/** 商户交易号 */
|
||||
private String bizTradeNo;
|
||||
|
||||
/** 通道交易号 */
|
||||
private String outTradeNo;
|
||||
|
||||
/** 完成时间 */
|
||||
private LocalDateTime tradeTime;
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
package org.dromara.daxpay.service.bo.reconcile;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 对账文件解析记录
|
||||
* @author xxm
|
||||
* @since 2024/8/6
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ReconcileResolveResultBo {
|
||||
|
||||
/**
|
||||
* 通道交易明细
|
||||
*/
|
||||
private List<ChannelReconcileTradeBo> channelTrades;
|
||||
|
||||
/**
|
||||
* 原始对账文件URL
|
||||
*/
|
||||
private String originalFileUrl;
|
||||
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package org.dromara.daxpay.service.bo.reconcile;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 对账单汇总导出对象
|
||||
* @author xxm
|
||||
* @since 2024/8/13
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ReconcileTotalExcel {
|
||||
|
||||
/** 对账日期 */
|
||||
private String reconcileDate;
|
||||
|
||||
/** 生成时间 */
|
||||
private String createTime;
|
||||
|
||||
/** 通道 */
|
||||
private String channel;
|
||||
|
||||
/** 对账结果 */
|
||||
private String result;
|
||||
|
||||
/* 平台交易概览 */
|
||||
/** 交易支付汇总 */
|
||||
private String tradeAmount;
|
||||
|
||||
/** 交易支付次数 */
|
||||
private Integer tradeCount;
|
||||
|
||||
/** 交易退款汇总 */
|
||||
private String refundAmount;
|
||||
|
||||
/** 退款次数 */
|
||||
private Integer refundCount;
|
||||
|
||||
/* 通道交易概览 */
|
||||
/** 交易支付汇总 */
|
||||
private String channelTradeAmount;
|
||||
|
||||
/** 交易支付次数 */
|
||||
private Integer channelTradeCount;
|
||||
|
||||
/** 交易退款汇总 */
|
||||
private String channelRefundAmount;
|
||||
|
||||
/** 退款次数 */
|
||||
private Integer channelRefundCount;
|
||||
|
||||
}
|
@@ -0,0 +1,60 @@
|
||||
package org.dromara.daxpay.service.bo.reconcile;
|
||||
|
||||
import org.dromara.daxpay.service.enums.ReconcileDiscrepancyTypeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 对账明细导出类
|
||||
* @author xxm
|
||||
* @since 2024/8/13
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ReconcileTradeExcel {
|
||||
|
||||
/** 平台交易号 */
|
||||
private String tradeNo;
|
||||
|
||||
/** 商户订单号 */
|
||||
private String bizTradeNo;
|
||||
|
||||
/** 通道交易号 */
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* 对账结果
|
||||
* @see ReconcileDiscrepancyTypeEnum 和 一致
|
||||
*/
|
||||
private String result;
|
||||
|
||||
/* 平台侧信息 */
|
||||
|
||||
/** 交易类型 */
|
||||
private String tradeType;
|
||||
|
||||
/** 交易金额 */
|
||||
private String tradeAmount;
|
||||
|
||||
/** 交易状态 */
|
||||
private String tradeStatus;
|
||||
|
||||
/** 交易时间 */
|
||||
private String tradeTime;
|
||||
|
||||
/* 通道侧信息 */
|
||||
/** 通道交易号 */
|
||||
private String channelTradeNo;
|
||||
|
||||
/** 交易类型 */
|
||||
private String channelTradeType;
|
||||
|
||||
/** 通道交易金额 */
|
||||
private String channelTradeAmount;
|
||||
|
||||
/** 通道交易状态 */
|
||||
private String channelTradeStatus;
|
||||
|
||||
/** 通道交易时间 */
|
||||
private String channelTradeTime;
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
package org.dromara.daxpay.service.bo.sync;
|
||||
|
||||
import org.dromara.daxpay.core.enums.PayStatusEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/25
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PaySyncResultBo {
|
||||
|
||||
|
||||
/** 同步是否成功 */
|
||||
private boolean syncSuccess = true;
|
||||
|
||||
/**
|
||||
* 支付网关订单状态
|
||||
*/
|
||||
private PayStatusEnum payStatus;
|
||||
|
||||
/** 支付通道对应系统的交易号, 用与和本地记录关联起来 */
|
||||
private String outOrderNo;
|
||||
|
||||
/** 交易错误信息 */
|
||||
private String tradeErrorMsg;
|
||||
|
||||
/** 交易金额 */
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 支付完成时间 */
|
||||
private LocalDateTime finishTime;
|
||||
|
||||
/** 同步时网关返回的对象, 序列化为json字符串 */
|
||||
private String syncData;
|
||||
|
||||
/** 错误提示码 */
|
||||
private String syncErrorCode;
|
||||
|
||||
/** 错误提示 */
|
||||
private String syncErrorMsg;
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
package org.dromara.daxpay.service.bo.sync;
|
||||
|
||||
import org.dromara.daxpay.core.enums.RefundStatusEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 支付退款同步结果
|
||||
* @author xxm
|
||||
* @since 2024/1/25
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class RefundSyncResultBo {
|
||||
|
||||
/** 同步是否成功 */
|
||||
private boolean syncSuccess = true;
|
||||
|
||||
/** 退款状态 */
|
||||
private RefundStatusEnum refundStatus;
|
||||
|
||||
/** 外部三方支付网关生成的退款交易号, 用与将记录关联起来 */
|
||||
private String outRefundNo;
|
||||
|
||||
/** 交易错误信息 */
|
||||
private String tradeErrorMsg;
|
||||
|
||||
/** 交易金额 */
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 退款完成时间(通常用于接收网关返回的时间) */
|
||||
private LocalDateTime finishTime;
|
||||
|
||||
/** 同步时网关返回的对象, 序列化为json字符串 */
|
||||
private String syncData;
|
||||
|
||||
/** 错误提示码 */
|
||||
private String syncErrorCode;
|
||||
|
||||
/** 错误提示 */
|
||||
private String syncErrorMsg;
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
package org.dromara.daxpay.service.bo.sync;
|
||||
|
||||
import org.dromara.daxpay.core.enums.TransferStatusEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 转账同步结果
|
||||
* @author xxm
|
||||
* @since 2024/7/25
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TransferSyncResultBo {
|
||||
|
||||
/** 同步是否成功 */
|
||||
private boolean syncSuccess = true;
|
||||
|
||||
/** 转账订单状态 */
|
||||
private TransferStatusEnum transferStatus;
|
||||
|
||||
/** 支付通道生成的转账交易号, 用与将本地记录关联起来 */
|
||||
private String outTransferNo;
|
||||
|
||||
/** 交易错误信息 */
|
||||
private String tradeErrorMsg;
|
||||
|
||||
/** 交易金额 */
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 完成时间(通常用于接收网关返回的时间) */
|
||||
private LocalDateTime finishTime;
|
||||
|
||||
/** 同步时网关返回的对象, 序列化为json字符串 */
|
||||
private String syncData;
|
||||
|
||||
/** 错误提示码 */
|
||||
private String syncErrorCode;
|
||||
|
||||
/** 同步错误提示 */
|
||||
private String syncErrorMsg;
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
package org.dromara.daxpay.service.bo.trade;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 支付结果业务类
|
||||
* @author xxm
|
||||
* @since 2024/7/23
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PayResultBo {
|
||||
|
||||
/**
|
||||
* 第三方支付网关生成的订单号, 用与将记录关联起来
|
||||
* 1. 如付款码支付直接成功时会出现
|
||||
* 2. 部分通道创建订单是会直接返回
|
||||
*/
|
||||
private String outOrderNo;
|
||||
|
||||
/** 是否支付完成 */
|
||||
private boolean complete;
|
||||
|
||||
/** 完成时间 */
|
||||
private LocalDateTime finishTime;
|
||||
|
||||
/** 支付参数体(通常用于发起支付的参数) */
|
||||
private String payBody;
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package org.dromara.daxpay.service.bo.trade;
|
||||
|
||||
import org.dromara.daxpay.core.enums.RefundStatusEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 退款结果业务类
|
||||
* @author xxm
|
||||
* @since 2024/7/23
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class RefundResultBo {
|
||||
/**
|
||||
* 第三方支付网关生成的退款订单号, 用与将记录关联起来
|
||||
*/
|
||||
private String outRefundNo;
|
||||
|
||||
/**
|
||||
* 退款状态
|
||||
*/
|
||||
private RefundStatusEnum status;
|
||||
|
||||
/** 退款完成时间 */
|
||||
private LocalDateTime finishTime;
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package org.dromara.daxpay.service.bo.trade;
|
||||
|
||||
import org.dromara.daxpay.core.enums.TransferStatusEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 转账结果业务类
|
||||
* @author xxm
|
||||
* @since 2024/7/23
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class TransferResultBo {
|
||||
/** 通道转账订单号 */
|
||||
private String outTransferNo;
|
||||
|
||||
/** 状态 */
|
||||
private TransferStatusEnum status = TransferStatusEnum.PROGRESS;
|
||||
|
||||
/** 完成时间 */
|
||||
private LocalDateTime finishTime;
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package org.dromara.daxpay.service.code;
|
||||
|
||||
/**
|
||||
* 系统编码
|
||||
* @author xxm
|
||||
* @since 2024/8/2
|
||||
*/
|
||||
public interface DaxPayCode {
|
||||
|
||||
/**
|
||||
* 消息通知相关常量
|
||||
*/
|
||||
interface Event {
|
||||
/** 商户任务通知 */
|
||||
String MERCHANT_NOTIFY_SENDER = "MerchantNotifySender";
|
||||
|
||||
/** 商户回调通知 */
|
||||
String MERCHANT_CALLBACK_SENDER = "CallbackSender";
|
||||
|
||||
/** 支付任务超时 */
|
||||
String MERCHANT_PAY_TIMEOUT = "PayTimeout";
|
||||
|
||||
/** 退款任务同步 默认两分钟后查询 */
|
||||
String MERCHANT_REFUND_SYNC = "RefundSync";
|
||||
|
||||
/** 转账任务同步 默认两分钟后查询 */
|
||||
String MERCHANT_TRANSFER_SYNC = "TransferSync";
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package org.dromara.daxpay.service.common.anno;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 支付校验校验标识 <br/>
|
||||
* 入参出参要求:
|
||||
* <p>
|
||||
* 1. 方法至少有一个参数,并且需要签名的参数放在第一位, 并为PaymentCommonParam的子类 <br/>
|
||||
* 2. 返回对象必须为 DaxResult 格式
|
||||
* </p>
|
||||
*
|
||||
* 注解实现的功能(按先后顺序): <br/>
|
||||
* 1. 参数校验
|
||||
* 2. 商户和应用信息初始化
|
||||
* 3. 终端信息初始化
|
||||
* 4. 参数签名校验
|
||||
* 5. 参数请求时间校验
|
||||
*
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2023/12/22
|
||||
*/
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Inherited
|
||||
public @interface PaymentVerify {
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
package org.dromara.daxpay.service.common.cache;
|
||||
|
||||
import org.dromara.daxpay.core.exception.ConfigNotEnableException;
|
||||
import org.dromara.daxpay.service.dao.config.ChannelConfigManager;
|
||||
import org.dromara.daxpay.service.entity.config.ChannelConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 通道配置缓存服务
|
||||
* @author xxm
|
||||
* @since 2024/6/28
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ChannelConfigCacheService {
|
||||
|
||||
private final ChannelConfigManager channelConfigManager;
|
||||
|
||||
/**
|
||||
* 获取通道配置
|
||||
*/
|
||||
@Cacheable(value = "cache:channelConfig", key = "#appId + ':' + #channel")
|
||||
public ChannelConfig get(String appId, String channel) {
|
||||
return channelConfigManager.findByAppIdAndChannel(appId, channel)
|
||||
.orElseThrow(() -> new ConfigNotEnableException("未找到指定的支付通道配置"));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
package org.dromara.daxpay.service.common.cache;
|
||||
|
||||
import org.dromara.daxpay.core.exception.ConfigNotEnableException;
|
||||
import org.dromara.daxpay.service.dao.merchant.MchAppManager;
|
||||
import org.dromara.daxpay.service.entity.merchant.MchApp;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 商户应用缓存服务
|
||||
* @author xxm
|
||||
* @since 2024/6/29
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class MchAppCacheService {
|
||||
|
||||
private final MchAppManager mchAppManager;
|
||||
|
||||
/**
|
||||
* 获取通道配置
|
||||
*/
|
||||
@Cacheable(value = "cache:mchApp", key = "#appId")
|
||||
public MchApp get(String appId) {
|
||||
return mchAppManager.findByAppId(appId)
|
||||
.orElseThrow(() -> new ConfigNotEnableException("未找到指定的应用配置"));
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,80 @@
|
||||
package org.dromara.daxpay.service.common.context;
|
||||
|
||||
import org.dromara.daxpay.core.enums.PayStatusEnum;
|
||||
import org.dromara.daxpay.core.enums.RefundStatusEnum;
|
||||
import org.dromara.daxpay.core.enums.CallbackStatusEnum;
|
||||
import org.dromara.daxpay.core.enums.TradeTypeEnum;
|
||||
import org.dromara.daxpay.core.enums.TransferStatusEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 回调信息上下文
|
||||
* @author xxm
|
||||
* @since 2024/1/24
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class CallbackLocal {
|
||||
|
||||
|
||||
/**
|
||||
* 原始数据, 回调数据内容不存在的时候使用这个
|
||||
* 主要处理类似需要二次解密的回调, 如微信转账退款等
|
||||
*/
|
||||
private String rawData;
|
||||
|
||||
/** 回调数据内容 */
|
||||
private Map<String, ?> callbackData = new HashMap<>();
|
||||
|
||||
/** 交易号 */
|
||||
private String tradeNo;
|
||||
|
||||
/**
|
||||
* 通道交易号
|
||||
*/
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* 通道
|
||||
*/
|
||||
private String channel;
|
||||
|
||||
/** 交易类型 */
|
||||
private TradeTypeEnum callbackType;
|
||||
|
||||
/**
|
||||
* 交易状态状态
|
||||
* @see PayStatusEnum 支付状态
|
||||
* @see RefundStatusEnum 退款状态
|
||||
* @see TransferStatusEnum 转账状态
|
||||
*/
|
||||
private String tradeStatus;
|
||||
|
||||
/** 交易错误信息 */
|
||||
private String tradeErrorMsg;
|
||||
|
||||
/** 金额(元) */
|
||||
private BigDecimal amount;
|
||||
|
||||
/** 完成时间(支付/退款) */
|
||||
private LocalDateTime finishTime;
|
||||
|
||||
|
||||
/** 回调信息错误码 */
|
||||
private String callbackErrorCode;
|
||||
|
||||
/** 回调信息错误信息 */
|
||||
private String callbackErrorMsg;
|
||||
|
||||
/**
|
||||
* 回调处理状态
|
||||
* @see CallbackStatusEnum
|
||||
*/
|
||||
private CallbackStatusEnum callbackStatus = CallbackStatusEnum.SUCCESS;
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package org.dromara.daxpay.service.common.context;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 支付请求相关信息
|
||||
* @author xxm
|
||||
* @since 2023/12/25
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ClientLocal {
|
||||
|
||||
/** 客户端ip */
|
||||
private String clientIp;
|
||||
|
||||
/** 请求IP */
|
||||
private String requestIp;
|
||||
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
package org.dromara.daxpay.service.common.context;
|
||||
|
||||
import org.dromara.daxpay.core.enums.MerchantNotifyTypeEnum;
|
||||
import org.dromara.daxpay.service.enums.MchAppStautsEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 商户应用
|
||||
* @author xxm
|
||||
* @since 2024/6/27
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MchAppLocal {
|
||||
|
||||
/** 应用号 */
|
||||
private String appId;;
|
||||
|
||||
/** 签名方式 */
|
||||
private String signType;
|
||||
|
||||
/** 签名秘钥 */
|
||||
private String signSecret;
|
||||
|
||||
/** 是否对请求进行验签 */
|
||||
private Boolean reqSign;
|
||||
|
||||
/** 支付限额 */
|
||||
private BigDecimal limitAmount;
|
||||
|
||||
/** 订单默认超时时间(分钟) */
|
||||
private Integer orderTimeout;
|
||||
|
||||
/**
|
||||
* 请求有效时长(秒)
|
||||
* 如果传输的请求时间早于当前服务时间, 而且差值超过配置的时长, 将会请求失败
|
||||
* 如果传输的请求时间比服务时间大于配置的时长(超过一分钟), 将会请求失败
|
||||
*/
|
||||
private Integer reqTimeout;
|
||||
|
||||
/**
|
||||
* 应用状态
|
||||
* @see MchAppStautsEnum
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 异步消息通知类型, 当前只支持http方式
|
||||
* @see MerchantNotifyTypeEnum
|
||||
*/
|
||||
private String notifyType;
|
||||
|
||||
/**
|
||||
* 地址, http/WebSocket 需要配置
|
||||
*/
|
||||
private String notifyUrl;
|
||||
|
||||
public Boolean getReqSign() {
|
||||
return Boolean.TRUE.equals(reqSign);
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
package org.dromara.daxpay.service.common.context;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 支付上下文
|
||||
* @author xxm
|
||||
* @since 2023/12/22
|
||||
*/
|
||||
@Getter
|
||||
@Accessors(chain = true)
|
||||
public class PaymentContext {
|
||||
|
||||
/**
|
||||
* 统一支付相关接口调用时,会进行初始化
|
||||
* 接收到回调时,会进行初始化
|
||||
* 接收到消息通知时是, 会进行初始化
|
||||
*/
|
||||
private final MchAppLocal mchAppInfo = new MchAppLocal();
|
||||
|
||||
/** 请求终端信息 */
|
||||
private final ClientLocal clientInfo = new ClientLocal();
|
||||
|
||||
/** 回调相关信息 */
|
||||
private final CallbackLocal callbackInfo = new CallbackLocal();
|
||||
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package org.dromara.daxpay.service.common.entity;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
/**
|
||||
*商户基础实体类
|
||||
* @author xxm
|
||||
* @since 2024/6/1
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@FieldNameConstants(innerTypeName = "MchApp")
|
||||
public class MchAppBaseEntity extends MpBaseEntity {
|
||||
|
||||
/** 应用号 */
|
||||
@TableField(updateStrategy = FieldStrategy.NEVER, fill = FieldFill.INSERT)
|
||||
private String appId;
|
||||
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package org.dromara.daxpay.service.common.entity;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpCreateEntity;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.FieldNameConstants;
|
||||
|
||||
/**
|
||||
* 商户记录实体类, 只有创建人和时间
|
||||
* @author xxm
|
||||
* @since 2024/7/21
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@FieldNameConstants(innerTypeName = "MchRecord")
|
||||
public class MchAppRecordEntity extends MpCreateEntity {
|
||||
|
||||
/** 应用号 */
|
||||
@TableField(updateStrategy = FieldStrategy.NEVER, fill = FieldFill.INSERT)
|
||||
private String appId;
|
||||
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package org.dromara.daxpay.service.common.filter;
|
||||
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.daxpay.service.common.local.PaymentContextLocal;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 支付上下文本地过滤器
|
||||
* @author xxm
|
||||
* @since 2023/12/22
|
||||
*/
|
||||
@Order(value = Integer.MIN_VALUE)
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
|
||||
public class PaymentContextLocalFilter extends OncePerRequestFilter {
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||
try {
|
||||
filterChain.doFilter(request,response);
|
||||
} finally {
|
||||
PaymentContextLocal.clear();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package org.dromara.daxpay.service.common.local;
|
||||
|
||||
import org.dromara.daxpay.service.common.context.PaymentContext;
|
||||
import com.alibaba.ttl.TransmittableThreadLocal;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 支付上下文线程变量
|
||||
* @author xxm
|
||||
* @since 2023/12/22
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class PaymentContextLocal {
|
||||
|
||||
private static final ThreadLocal<PaymentContext> THREAD_LOCAL = new TransmittableThreadLocal<>();
|
||||
|
||||
/**
|
||||
* 获取
|
||||
*/
|
||||
public PaymentContext get(){
|
||||
PaymentContext paymentContext = THREAD_LOCAL.get();
|
||||
if (Objects.isNull(paymentContext)){
|
||||
paymentContext = new PaymentContext();
|
||||
THREAD_LOCAL.set(paymentContext);
|
||||
}
|
||||
return paymentContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除
|
||||
*/
|
||||
public static void clear() {
|
||||
THREAD_LOCAL.remove();
|
||||
}
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package org.dromara.daxpay.service.common.param;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.query.entity.SortParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 商户查询参数
|
||||
* @author xxm
|
||||
* @since 2024/8/27
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "商户查询参数")
|
||||
public class MchAppQuery extends SortParam {
|
||||
|
||||
/** 应用号 */
|
||||
@Schema(description = "应用号")
|
||||
private String appId;
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package org.dromara.daxpay.service.common.properties;
|
||||
|
||||
import org.dromara.daxpay.core.util.TradeNoGenerateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* 演示模块配置类
|
||||
* @author xxm
|
||||
* @since 2024/2/8
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigurationProperties(prefix = "dax-pay")
|
||||
public class DaxPayProperties {
|
||||
|
||||
/** 前端地址(h5) */
|
||||
private String frontH5Url;
|
||||
|
||||
/** 通常为两位内 机器码, 用于区分不同机器生成的流水号 */
|
||||
private String machineNo = "58";
|
||||
|
||||
/** 当前环境,会影响订单号的生成 */
|
||||
private String env = "";
|
||||
|
||||
public void setMachineNo(String machineNo) {
|
||||
this.machineNo = machineNo;
|
||||
TradeNoGenerateUtil.setMachineNo(machineNo);
|
||||
}
|
||||
|
||||
public void setEnv(String env) {
|
||||
this.env = env;
|
||||
TradeNoGenerateUtil.setEnv(env);
|
||||
}
|
||||
|
||||
public String getFrontH5Url() {
|
||||
return StrUtil.removeSuffix(frontH5Url, "/");
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package org.dromara.daxpay.service.common.tenant;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.function.MetaObjectFill;
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.dromara.daxpay.service.common.context.MchAppLocal;
|
||||
import org.dromara.daxpay.service.common.local.PaymentContextLocal;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 商户信息自动填充
|
||||
* @author xxm
|
||||
* @since 2024/6/26
|
||||
*/
|
||||
@Component
|
||||
public class MchAppMetaObjectHandler implements MetaObjectFill {
|
||||
|
||||
/**
|
||||
* 填充应用号
|
||||
* @param metaObject 元对象
|
||||
*/
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject, MetaObjectHandler metaObjectHandler) {
|
||||
// 应用号
|
||||
metaObjectHandler.strictInsertFill(metaObject, "appId", this::getAppId, String.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用号
|
||||
* 不是所有情况下都会获取到应用号
|
||||
*/
|
||||
public String getAppId() {
|
||||
MchAppLocal mchAppInfo = PaymentContextLocal.get().getMchAppInfo();
|
||||
return mchAppInfo.getAppId();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package org.dromara.daxpay.service.convert.config;
|
||||
|
||||
import org.dromara.daxpay.service.entity.config.ChannelCashierConfig;
|
||||
import org.dromara.daxpay.service.param.config.ChannelCashierConfigParam;
|
||||
import org.dromara.daxpay.service.result.config.ChannelCashierConfigResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 通道收银台配置
|
||||
* @author xxm
|
||||
* @since 2024/9/28
|
||||
*/
|
||||
@Mapper
|
||||
public interface ChannelCashierConfigConvert {
|
||||
ChannelCashierConfigConvert CONVERT = Mappers.getMapper(ChannelCashierConfigConvert.class);
|
||||
|
||||
ChannelCashierConfig toEntity(ChannelCashierConfigParam param);
|
||||
|
||||
ChannelCashierConfigResult toResult(ChannelCashierConfig channelCashierConfig);
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package org.dromara.daxpay.service.convert.config;
|
||||
|
||||
import org.dromara.daxpay.service.entity.config.ChannelConfig;
|
||||
import org.dromara.daxpay.service.result.config.ChannelConfigResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 通道配置
|
||||
* @author xxm
|
||||
* @since 2024/6/25
|
||||
*/
|
||||
@Mapper
|
||||
public interface ChannelConfigConvert {
|
||||
ChannelConfigConvert INSTANCE = Mappers.getMapper(ChannelConfigConvert.class);
|
||||
|
||||
ChannelConfigResult toResult(ChannelConfig in);
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package org.dromara.daxpay.service.convert.config;
|
||||
|
||||
import org.dromara.daxpay.service.entity.config.PlatformConfig;
|
||||
import org.dromara.daxpay.service.result.config.PlatformConfigResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/9/19
|
||||
*/
|
||||
@Mapper
|
||||
public interface PlatformConfigConvert {
|
||||
PlatformConfigConvert CONVERT = Mappers.getMapper(PlatformConfigConvert.class);
|
||||
|
||||
PlatformConfigResult toResult(PlatformConfig entity);
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package org.dromara.daxpay.service.convert.constant;
|
||||
|
||||
import org.dromara.daxpay.service.entity.constant.ApiConst;
|
||||
import org.dromara.daxpay.service.result.constant.ApiConstResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/14
|
||||
*/
|
||||
@Mapper
|
||||
public interface ApiConstConvert {
|
||||
ApiConstConvert CONVERT = Mappers.getMapper(ApiConstConvert.class);
|
||||
|
||||
ApiConstResult toResult(ApiConst source);
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package org.dromara.daxpay.service.convert.constant;
|
||||
|
||||
import org.dromara.daxpay.service.entity.constant.ChannelConst;
|
||||
import org.dromara.daxpay.service.result.constant.ChannelConstResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/14
|
||||
*/
|
||||
@Mapper
|
||||
public interface ChannelConstConvert {
|
||||
ChannelConstConvert CONVERT = Mappers.getMapper(ChannelConstConvert.class);
|
||||
|
||||
ChannelConstResult toResult(ChannelConst source);
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package org.dromara.daxpay.service.convert.constant;
|
||||
|
||||
import org.dromara.daxpay.service.entity.constant.MerchantNotifyConst;
|
||||
import org.dromara.daxpay.service.result.constant.MerchantNotifyConstResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/8/5
|
||||
*/
|
||||
@Mapper
|
||||
public interface MerchantNotifyConstConvert {
|
||||
MerchantNotifyConstConvert CONVERT = Mappers.getMapper(MerchantNotifyConstConvert.class);
|
||||
|
||||
MerchantNotifyConstResult toResult(MerchantNotifyConst model);
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package org.dromara.daxpay.service.convert.constant;
|
||||
|
||||
import org.dromara.daxpay.service.entity.constant.MethodConst;
|
||||
import org.dromara.daxpay.service.result.constant.MethodConstResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/14
|
||||
*/
|
||||
@Mapper
|
||||
public interface MethodConstConvert {
|
||||
MethodConstConvert CONVERT = Mappers.getMapper(MethodConstConvert.class);
|
||||
|
||||
MethodConstResult toResult(MethodConst source);
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package org.dromara.daxpay.service.convert.merchant;
|
||||
|
||||
import org.dromara.daxpay.service.entity.merchant.MchApp;
|
||||
import org.dromara.daxpay.service.param.merchant.MchAppParam;
|
||||
import org.dromara.daxpay.service.result.merchant.MchAppResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/6/24
|
||||
*/
|
||||
@Mapper
|
||||
public interface MchAppConvert {
|
||||
MchAppConvert CONVERT = Mappers.getMapper(MchAppConvert.class);
|
||||
|
||||
MchAppResult toResult(MchApp entity);
|
||||
|
||||
MchApp toEntity(MchAppParam param);
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package org.dromara.daxpay.service.convert.notice;
|
||||
|
||||
import org.dromara.daxpay.service.entity.notice.callback.MerchantCallbackRecord;
|
||||
import org.dromara.daxpay.service.entity.notice.callback.MerchantCallbackTask;
|
||||
import org.dromara.daxpay.service.result.notice.callback.MerchantCallbackRecordResult;
|
||||
import org.dromara.daxpay.service.result.notice.callback.MerchantCallbackTaskResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 商户回调消息
|
||||
* @author xxm
|
||||
* @since 2024/8/5
|
||||
*/
|
||||
@Mapper
|
||||
public interface MerchantCallbackConvert {
|
||||
|
||||
MerchantCallbackConvert CONVERT = Mappers.getMapper(MerchantCallbackConvert.class);
|
||||
|
||||
MerchantCallbackRecordResult toResult(MerchantCallbackRecord in);
|
||||
|
||||
MerchantCallbackTaskResult toResult(MerchantCallbackTask in);
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package org.dromara.daxpay.service.convert.notice;
|
||||
|
||||
import org.dromara.daxpay.service.entity.notice.notify.MerchantNotifyRecord;
|
||||
import org.dromara.daxpay.service.entity.notice.notify.MerchantNotifyTask;
|
||||
import org.dromara.daxpay.service.result.notice.notify.MerchantNotifyRecordResult;
|
||||
import org.dromara.daxpay.service.result.notice.notify.MerchantNotifyTaskResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 商户订阅通知
|
||||
* @author xxm
|
||||
* @since 2024/8/5
|
||||
*/
|
||||
@Mapper
|
||||
public interface MerchantNotifyConvert {
|
||||
|
||||
MerchantNotifyConvert CONVERT = Mappers.getMapper(MerchantNotifyConvert.class);
|
||||
|
||||
MerchantNotifyRecordResult toResult(MerchantNotifyRecord in);
|
||||
|
||||
MerchantNotifyTaskResult toResult(MerchantNotifyTask in);
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package org.dromara.daxpay.service.convert.order.pay;
|
||||
|
||||
import org.dromara.daxpay.core.result.trade.pay.PayOrderResult;
|
||||
import org.dromara.daxpay.service.entity.order.pay.PayOrder;
|
||||
import org.dromara.daxpay.service.result.order.pay.PayOrderVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 支付订单
|
||||
* @author xxm
|
||||
* @since 2024/6/27
|
||||
*/
|
||||
@Mapper
|
||||
public interface PayOrderConvert {
|
||||
PayOrderConvert CONVERT = Mappers.getMapper(PayOrderConvert.class);
|
||||
|
||||
PayOrderVo toVo(PayOrder payOrder);
|
||||
|
||||
PayOrderResult toResult(PayOrder payOrder);
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package org.dromara.daxpay.service.convert.order.refund;
|
||||
|
||||
import org.dromara.daxpay.core.result.trade.refund.RefundOrderResult;
|
||||
import org.dromara.daxpay.service.entity.order.refund.RefundOrder;
|
||||
import org.dromara.daxpay.service.result.order.refund.RefundOrderVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author xxm
|
||||
* @since 2022/3/2
|
||||
*/
|
||||
@Mapper
|
||||
public interface RefundOrderConvert {
|
||||
|
||||
RefundOrderConvert CONVERT = Mappers.getMapper(RefundOrderConvert.class);
|
||||
|
||||
RefundOrderVo toVo(RefundOrder in);
|
||||
|
||||
RefundOrderResult toResult(RefundOrder in);
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
package org.dromara.daxpay.service.convert.order.transfer;
|
||||
|
||||
import org.dromara.daxpay.core.result.trade.transfer.TransferOrderResult;
|
||||
import org.dromara.daxpay.service.entity.order.transfer.TransferOrder;
|
||||
import org.dromara.daxpay.service.result.order.transfer.TransferOrderVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/20
|
||||
*/
|
||||
@Mapper
|
||||
public interface TransferOrderConvert {
|
||||
TransferOrderConvert CONVERT = Mappers.getMapper(TransferOrderConvert.class);
|
||||
|
||||
TransferOrderVo toVo(TransferOrder in);
|
||||
|
||||
TransferOrderResult toResult(TransferOrder in);
|
||||
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
package org.dromara.daxpay.service.convert.reconcile;
|
||||
|
||||
import org.dromara.daxpay.service.bo.reconcile.ChannelReconcileTradeBo;
|
||||
import org.dromara.daxpay.service.entity.reconcile.ChannelReconcileTrade;
|
||||
import org.dromara.daxpay.service.entity.reconcile.ReconcileDiscrepancy;
|
||||
import org.dromara.daxpay.service.entity.reconcile.ReconcileStatement;
|
||||
import org.dromara.daxpay.service.result.reconcile.ReconcileDiscrepancyResult;
|
||||
import org.dromara.daxpay.service.result.reconcile.ReconcileStatementResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 对账转换类
|
||||
* @author xxm
|
||||
* @since 2024/8/6
|
||||
*/
|
||||
@Mapper
|
||||
public interface ReconcileConvert {
|
||||
ReconcileConvert CONVERT = Mappers.getMapper(ReconcileConvert.class);
|
||||
|
||||
ReconcileStatementResult toResult(ReconcileStatement in);
|
||||
|
||||
ReconcileDiscrepancyResult toResult(ReconcileDiscrepancy in);
|
||||
|
||||
ChannelReconcileTrade toEntity(ChannelReconcileTradeBo in);
|
||||
|
||||
List<ChannelReconcileTrade> toList(List<ChannelReconcileTradeBo> in);
|
||||
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package org.dromara.daxpay.service.convert.record;
|
||||
|
||||
import org.dromara.daxpay.service.entity.record.close.PayCloseRecord;
|
||||
import org.dromara.daxpay.service.result.record.close.PayCloseRecordResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/1/4
|
||||
*/
|
||||
@Mapper
|
||||
public interface PayCloseRecordConvert {
|
||||
PayCloseRecordConvert CONVERT = Mappers.getMapper(PayCloseRecordConvert.class);
|
||||
|
||||
/**
|
||||
* 转换
|
||||
*/
|
||||
PayCloseRecordResult convert(PayCloseRecord in);
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package org.dromara.daxpay.service.convert.record;
|
||||
|
||||
import org.dromara.daxpay.service.entity.record.callback.TradeCallbackRecord;
|
||||
import org.dromara.daxpay.service.result.record.callback.TradeCallbackRecordResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 回调记录
|
||||
* @author xxm
|
||||
* @since 2024/7/22
|
||||
*/
|
||||
@Mapper
|
||||
public interface TradeCallbackRecordConvert {
|
||||
TradeCallbackRecordConvert CONVERT = Mappers.getMapper(TradeCallbackRecordConvert.class);
|
||||
|
||||
TradeCallbackRecordResult convert(TradeCallbackRecord record);
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package org.dromara.daxpay.service.convert.record;
|
||||
|
||||
import org.dromara.daxpay.service.entity.record.flow.TradeFlowRecord;
|
||||
import org.dromara.daxpay.service.result.record.flow.TradeFlowRecordResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/4/21
|
||||
*/
|
||||
@Mapper
|
||||
public interface TradeFlowRecordConvert {
|
||||
TradeFlowRecordConvert CONVERT = Mappers.getMapper(TradeFlowRecordConvert.class);
|
||||
|
||||
TradeFlowRecordResult convert(TradeFlowRecord entity);
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package org.dromara.daxpay.service.convert.record;
|
||||
|
||||
import org.dromara.daxpay.service.entity.record.sync.TradeSyncRecord;
|
||||
import org.dromara.daxpay.service.result.record.sync.TradeSyncRecordResult;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 支付同步记录同步
|
||||
* @author xxm
|
||||
* @since 2023/7/14
|
||||
*/
|
||||
@Mapper
|
||||
public interface TradeSyncRecordConvert {
|
||||
TradeSyncRecordConvert CONVERT = Mappers.getMapper(TradeSyncRecordConvert.class);
|
||||
|
||||
TradeSyncRecordResult convert(TradeSyncRecord in);
|
||||
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package org.dromara.daxpay.service.dao.config;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import org.dromara.daxpay.service.common.context.MchAppLocal;
|
||||
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||
import org.dromara.daxpay.service.common.local.PaymentContextLocal;
|
||||
import org.dromara.daxpay.service.entity.config.ChannelCashierConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 通道收银台配置
|
||||
* @author xxm
|
||||
* @since 2024/9/28
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class ChannelCashierConfigManage extends BaseManager<ChannelCashierConfigMapper, ChannelCashierConfig> {
|
||||
|
||||
/**
|
||||
* 判断类型是否存在
|
||||
*/
|
||||
public boolean existsByType(String type, String appId) {
|
||||
return this.lambdaQuery()
|
||||
.eq(ChannelCashierConfig::getCashierType, type)
|
||||
.eq(MchAppBaseEntity::getAppId,appId)
|
||||
.exists();
|
||||
}
|
||||
/**
|
||||
* 判断类型是否存在
|
||||
*/
|
||||
public boolean existsByType(String type, String appId, Long id) {
|
||||
return this.lambdaQuery()
|
||||
.eq(ChannelCashierConfig::getCashierType, type)
|
||||
.eq(MchAppBaseEntity::getAppId,appId)
|
||||
.ne(ChannelCashierConfig::getId,id)
|
||||
.exists();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型查询
|
||||
*/
|
||||
public Optional<ChannelCashierConfig> findByCashierType(String cashierType) {
|
||||
MchAppLocal mchAppInfo = PaymentContextLocal.get().getMchAppInfo();
|
||||
return lambdaQuery().eq(ChannelCashierConfig::getCashierType, cashierType)
|
||||
.eq(ChannelCashierConfig::getAppId, mchAppInfo.getAppId())
|
||||
.oneOpt();
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.config;
|
||||
|
||||
import org.dromara.daxpay.service.entity.config.ChannelCashierConfig;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 通道收银台配置
|
||||
* @author xxm
|
||||
* @since 2024/9/28
|
||||
*/
|
||||
@Mapper
|
||||
public interface ChannelCashierConfigMapper extends MPJBaseMapper<ChannelCashierConfig> {
|
||||
}
|
@@ -0,0 +1,83 @@
|
||||
package org.dromara.daxpay.service.dao.config;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import org.dromara.daxpay.service.entity.config.ChannelConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 通道配置 constant
|
||||
* @author xxm
|
||||
* @since 2024/6/25
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class ChannelConfigManager extends BaseManager<ChannelConfigMapper, ChannelConfig> {
|
||||
|
||||
/**
|
||||
* 根据id进行更新
|
||||
*/
|
||||
@Override
|
||||
@CacheEvict(value = "cache:channelConfig", key = "#channelConfig.appId + ':' + #channelConfig.channel")
|
||||
public int updateById(ChannelConfig channelConfig) {
|
||||
return super.updateById(channelConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新
|
||||
*/
|
||||
@Override
|
||||
@CacheEvict(value = "cache:channelConfig", allEntries = true)
|
||||
public boolean updateAllById(Collection<ChannelConfig> entityList) {
|
||||
return super.updateAllById(entityList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用号查询
|
||||
*/
|
||||
public List<ChannelConfig> findByAppId(String appId) {
|
||||
return lambdaQuery()
|
||||
.select(this.getEntityClass (), MpUtil::excludeBigField)
|
||||
.eq(ChannelConfig::getAppId, appId)
|
||||
.list();
|
||||
}
|
||||
/**
|
||||
* 根据应用号查询启用的配置
|
||||
*/
|
||||
public List<ChannelConfig> findEnableByAppId(String appId) {
|
||||
return lambdaQuery()
|
||||
.select(this.getEntityClass (), MpUtil::excludeBigField)
|
||||
.eq(ChannelConfig::isEnable, true)
|
||||
.eq(ChannelConfig::getAppId, appId)
|
||||
.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用号和通道查询
|
||||
*/
|
||||
public Optional<ChannelConfig> findByAppIdAndChannel(String appId, String channel) {
|
||||
return lambdaQuery()
|
||||
.eq(ChannelConfig::getAppId, appId)
|
||||
.eq(ChannelConfig::getChannel, channel)
|
||||
.oneOpt();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是应用否存在指定的通道配置
|
||||
*/
|
||||
public boolean existsByAppIdAndChannel(String appId, String channel) {
|
||||
return lambdaQuery()
|
||||
.eq(ChannelConfig::getAppId, appId)
|
||||
.eq(ChannelConfig::getChannel, channel)
|
||||
.exists();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.config;
|
||||
|
||||
import org.dromara.daxpay.service.entity.config.ChannelConfig;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/6/25
|
||||
*/
|
||||
@Mapper
|
||||
public interface ChannelConfigMapper extends MPJBaseMapper<ChannelConfig> {
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package org.dromara.daxpay.service.dao.config;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import org.dromara.daxpay.service.entity.config.MerchantNotifyConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 商户应用消息通知配置
|
||||
* @author xxm
|
||||
* @since 2024/8/2
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class MerchantNotifyConfigManager extends BaseManager<MerchantNotifyConfigMapper, MerchantNotifyConfig> {
|
||||
|
||||
/**
|
||||
* 根据id进行更新
|
||||
*/
|
||||
@Override
|
||||
@CacheEvict(value = "cache:notifyConfig", key = "#merchantNotifyConfig.appId + ':' + #merchantNotifyConfig.code")
|
||||
public int updateById(MerchantNotifyConfig merchantNotifyConfig) {
|
||||
return super.updateById(merchantNotifyConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据AppId和类型查询
|
||||
*/
|
||||
public Optional<MerchantNotifyConfig> findByAppIdAndType(String appId, String notifyType) {
|
||||
return lambdaQuery()
|
||||
.eq(MerchantNotifyConfig::getAppId, appId)
|
||||
.eq(MerchantNotifyConfig::getCode, notifyType)
|
||||
.oneOpt();
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.config;
|
||||
|
||||
import org.dromara.daxpay.service.entity.config.MerchantNotifyConfig;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/8/2
|
||||
*/
|
||||
@Mapper
|
||||
public interface MerchantNotifyConfigMapper extends MPJBaseMapper<MerchantNotifyConfig> {
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package org.dromara.daxpay.service.dao.config;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import org.dromara.daxpay.service.entity.config.PlatformConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/17
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class PlatformConfigManager extends BaseManager<PlatformConfigMapper, PlatformConfig> {
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.config;
|
||||
|
||||
import org.dromara.daxpay.service.entity.config.PlatformConfig;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/17
|
||||
*/
|
||||
@Mapper
|
||||
public interface PlatformConfigMapper extends MPJBaseMapper<PlatformConfig> {
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
package org.dromara.daxpay.service.dao.constant;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.service.entity.constant.ApiConst;
|
||||
import org.dromara.daxpay.service.param.constant.ApiConstQuery;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/14
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class ApiConstManager extends BaseManager<ApiConstMapper, ApiConst> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<ApiConst> page(PageParam pageParam, ApiConstQuery query) {
|
||||
Page<ApiConst> mpPage = MpUtil.getMpPage(pageParam);
|
||||
QueryWrapper<ApiConst> wrapper = QueryGenerator.generator(query);
|
||||
return this.page(mpPage, wrapper);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.constant;
|
||||
|
||||
import org.dromara.daxpay.service.entity.constant.ApiConst;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/14
|
||||
*/
|
||||
@Mapper
|
||||
public interface ApiConstMapper extends MPJBaseMapper<ApiConst> {
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
package org.dromara.daxpay.service.dao.constant;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpIdEntity;
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.service.entity.constant.ChannelConst;
|
||||
import org.dromara.daxpay.service.param.constant.ChannelConstQuery;
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/6/25
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class ChannelConstManager extends BaseManager<ChannelConstMapper, ChannelConst> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<ChannelConst> page(PageParam pageParam, ChannelConstQuery query) {
|
||||
Page<ChannelConst> mpPage = MpUtil.getMpPage(pageParam);
|
||||
QueryWrapper<ChannelConst> wrapper = QueryGenerator.generator(query);
|
||||
return this.page(mpPage, wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部启用的通道
|
||||
*/
|
||||
public List<ChannelConst> findAllByEnable() {
|
||||
return lambdaQuery()
|
||||
.eq(ChannelConst::isEnable, true)
|
||||
.orderByAsc(MpIdEntity::getId)
|
||||
.list();
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.constant;
|
||||
|
||||
import org.dromara.daxpay.service.entity.constant.ChannelConst;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/6/25
|
||||
*/
|
||||
@Mapper
|
||||
public interface ChannelConstMapper extends MPJBaseMapper<ChannelConst> {
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
package org.dromara.daxpay.service.dao.constant;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.service.entity.constant.MerchantNotifyConst;
|
||||
import org.dromara.daxpay.service.param.constant.MerchantNotifyConstQuery;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 商户通知类型
|
||||
* @author xxm
|
||||
* @since 2024/7/30
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class MerchantNotifyConstManager extends BaseManager<MerchantNotifyConstMapper,MerchantNotifyConst> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<MerchantNotifyConst> page(PageParam pageParam, MerchantNotifyConstQuery query) {
|
||||
Page<MerchantNotifyConst> mpPage = MpUtil.getMpPage(pageParam);
|
||||
QueryWrapper<MerchantNotifyConst> wrapper = QueryGenerator.generator(query);
|
||||
return this.page(mpPage, wrapper);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.constant;
|
||||
|
||||
import org.dromara.daxpay.service.entity.constant.MerchantNotifyConst;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/30
|
||||
*/
|
||||
@Mapper
|
||||
public interface MerchantNotifyConstMapper extends MPJBaseMapper<MerchantNotifyConst> {
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
package org.dromara.daxpay.service.dao.constant;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.service.entity.constant.MethodConst;
|
||||
import org.dromara.daxpay.service.param.constant.MethodConstQuery;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/6/26
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class MethodConstManager extends BaseManager<MethodConstMapper, MethodConst> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<MethodConst> page(PageParam pageParam, MethodConstQuery query) {
|
||||
Page<MethodConst> mpPage = MpUtil.getMpPage(pageParam);
|
||||
QueryWrapper<MethodConst> wrapper = QueryGenerator.generator(query);
|
||||
return this.page(mpPage, wrapper);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.constant;
|
||||
|
||||
import org.dromara.daxpay.service.entity.constant.MethodConst;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 支付方式
|
||||
* @author xxm
|
||||
* @since 2024/6/26
|
||||
*/
|
||||
@Mapper
|
||||
public interface MethodConstMapper extends MPJBaseMapper<MethodConst> {
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
package org.dromara.daxpay.service.dao.merchant;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.service.entity.merchant.MchApp;
|
||||
import org.dromara.daxpay.service.enums.MchAppStautsEnum;
|
||||
import org.dromara.daxpay.service.param.merchant.MchAppQuery;
|
||||
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.cache.annotation.CacheEvict;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/5/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class MchAppManager extends BaseManager<MchAppMapper, MchApp> {
|
||||
|
||||
/**
|
||||
* 根据id进行更新
|
||||
*/
|
||||
@Override
|
||||
@CacheEvict(value = "cache:mchApp", key = "#mchApp.appId")
|
||||
public int updateById(MchApp mchApp) {
|
||||
return super.updateById(mchApp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新
|
||||
*/
|
||||
@Override
|
||||
@CacheEvict(value = "cache:mchApp", allEntries = true)
|
||||
public boolean updateAllById(Collection<MchApp> entityList) {
|
||||
return super.updateAllById(entityList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据应用AppId查询
|
||||
*/
|
||||
public Optional<MchApp> findByAppId(String appId) {
|
||||
return this.findByField(MchApp::getAppId, appId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<MchApp> page(PageParam pageParam, MchAppQuery query) {
|
||||
Page<MchApp> mpPage = MpUtil.getMpPage(pageParam);
|
||||
QueryWrapper<MchApp> wrapper = QueryGenerator.generator(query);
|
||||
return this.page(mpPage, wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据状态查询所有
|
||||
*/
|
||||
public List<MchApp> findAllByStatus(MchAppStautsEnum status) {
|
||||
return findAllByField(MchApp::getStatus, status.getCode());
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.merchant;
|
||||
|
||||
import org.dromara.daxpay.service.entity.merchant.MchApp;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 商户应用
|
||||
* @author xxm
|
||||
* @since 2024/5/27
|
||||
*/
|
||||
@Mapper
|
||||
public interface MchAppMapper extends MPJBaseMapper<MchApp> {
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package org.dromara.daxpay.service.dao.merchant;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import org.dromara.daxpay.service.entity.merchant.MerchantUser;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/8/22
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class MerchantUserManager extends BaseManager<MerchantUserMapper, MerchantUser> {
|
||||
|
||||
/**
|
||||
* 判断用户是否存在
|
||||
*/
|
||||
public boolean existsByUserId(Long userId){
|
||||
return existedByField(MerchantUser::getUserId, userId);
|
||||
}
|
||||
/**
|
||||
* 判断用户是否存在
|
||||
*/
|
||||
public boolean existsByUserIds(List<Long> userIds){
|
||||
Long count = lambdaQuery().in(MerchantUser::getUserId, userIds)
|
||||
.count();
|
||||
return userIds.size() == count;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.merchant;
|
||||
|
||||
import org.dromara.daxpay.service.entity.merchant.MerchantUser;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/8/22
|
||||
*/
|
||||
@Mapper
|
||||
public interface MerchantUserMapper extends MPJBaseMapper<MerchantUser> {
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package org.dromara.daxpay.service.dao.notice.callback;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.service.entity.notice.callback.MerchantCallbackRecord;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/30
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class MerchantCallbackRecordManager extends BaseManager<MerchantCallbackRecordMapper, MerchantCallbackRecord> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<MerchantCallbackRecord> page(PageParam param, Long taskId){
|
||||
var mpPage = MpUtil.getMpPage(param, MerchantCallbackRecord.class);
|
||||
return lambdaQuery().eq(MerchantCallbackRecord::getTaskId,taskId)
|
||||
.page(mpPage);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.notice.callback;
|
||||
|
||||
import org.dromara.daxpay.service.entity.notice.callback.MerchantCallbackRecord;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/30
|
||||
*/
|
||||
@Mapper
|
||||
public interface MerchantCallbackRecordMapper extends MPJBaseMapper<MerchantCallbackRecord> {
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
package org.dromara.daxpay.service.dao.notice.callback;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.annotation.IgnoreTenant;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.service.entity.notice.callback.MerchantCallbackTask;
|
||||
import org.dromara.daxpay.service.param.notice.callback.MerchantCallbackTaskQuery;
|
||||
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;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/30
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class MerchantCallbackTaskManager extends BaseManager<MerchantCallbackTaskMapper, MerchantCallbackTask> {
|
||||
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<MerchantCallbackTask> page(PageParam param, MerchantCallbackTaskQuery query){
|
||||
var mpPage = MpUtil.getMpPage(param, MerchantCallbackTask.class);
|
||||
QueryWrapper<MerchantCallbackTask> generator = QueryGenerator.generator(query);
|
||||
return this.page(mpPage, generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据, 不过滤租户
|
||||
*/
|
||||
@IgnoreTenant
|
||||
public Optional<MerchantCallbackTask> findByIdNotTenant(Long taskId) {
|
||||
return this.findById(taskId);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.notice.callback;
|
||||
|
||||
import org.dromara.daxpay.service.entity.notice.callback.MerchantCallbackTask;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/30
|
||||
*/
|
||||
@Mapper
|
||||
public interface MerchantCallbackTaskMapper extends MPJBaseMapper<MerchantCallbackTask> {
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package org.dromara.daxpay.service.dao.notice.notify;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.service.entity.notice.notify.MerchantNotifyRecord;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/30
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class MerchantNotifyRecordManager extends BaseManager<MerchantNotifyRecordMapper, MerchantNotifyRecord> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<MerchantNotifyRecord> page(PageParam param, Long taskId){
|
||||
var mpPage = MpUtil.getMpPage(param, MerchantNotifyRecord.class);
|
||||
return lambdaQuery().eq(MerchantNotifyRecord::getTaskId,taskId)
|
||||
.page(mpPage);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.notice.notify;
|
||||
|
||||
import org.dromara.daxpay.service.entity.notice.notify.MerchantNotifyRecord;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/30
|
||||
*/
|
||||
@Mapper
|
||||
public interface MerchantNotifyRecordMapper extends MPJBaseMapper<MerchantNotifyRecord> {
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package org.dromara.daxpay.service.dao.notice.notify;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.annotation.IgnoreTenant;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.service.entity.notice.notify.MerchantNotifyTask;
|
||||
import org.dromara.daxpay.service.param.notice.notify.MerchantNotifyTaskQuery;
|
||||
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;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/30
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class MerchantNotifyTaskManager extends BaseManager<MerchantNotifyTaskMapper, MerchantNotifyTask> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<MerchantNotifyTask> page(PageParam param, MerchantNotifyTaskQuery query){
|
||||
var mpPage = MpUtil.getMpPage(param, MerchantNotifyTask.class);
|
||||
QueryWrapper<MerchantNotifyTask> generator = QueryGenerator.generator(query);
|
||||
return this.page(mpPage, generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据, 不经过租户
|
||||
*/
|
||||
@IgnoreTenant
|
||||
public Optional<MerchantNotifyTask> findByIdNotTenant(Long taskId) {
|
||||
return this.findById(taskId);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.notice.notify;
|
||||
|
||||
import org.dromara.daxpay.service.entity.notice.notify.MerchantNotifyTask;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/30
|
||||
*/
|
||||
@Mapper
|
||||
public interface MerchantNotifyTaskMapper extends MPJBaseMapper<MerchantNotifyTask> {
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
package org.dromara.daxpay.service.dao.order.allocation;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import org.dromara.daxpay.service.entity.order.allocation.AllocOrderDetail;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/4/7
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class AllocOrderDetailManager extends BaseManager<AllocOrderDetailMapper, AllocOrderDetail> {
|
||||
|
||||
/**
|
||||
* 根据订单ID查询
|
||||
*/
|
||||
public List<AllocOrderDetail> findAllByOrderId(Long orderId) {
|
||||
return findAllByField(AllocOrderDetail::getAllocId, orderId);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.order.allocation;
|
||||
|
||||
import org.dromara.daxpay.service.entity.order.allocation.AllocOrderDetail;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/4/7
|
||||
*/
|
||||
@Mapper
|
||||
public interface AllocOrderDetailMapper extends MPJBaseMapper<AllocOrderDetail> {
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package org.dromara.daxpay.service.dao.order.allocation;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.core.enums.AllocOrderStatusEnum;
|
||||
import org.dromara.daxpay.service.entity.order.allocation.AllocOrder;
|
||||
import org.dromara.daxpay.service.param.order.allocation.AllocOrderQuery;
|
||||
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;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/4/7
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class AllocOrderManager extends BaseManager<AllocOrderMapper, AllocOrder> {
|
||||
|
||||
/**
|
||||
* 根据分账单号查询
|
||||
*/
|
||||
public Optional<AllocOrder> findByAllocNo(String allocNo){
|
||||
return findByField(AllocOrder::getAllocNo, allocNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商户分账号查询
|
||||
*/
|
||||
public Optional<AllocOrder> findByBizAllocNo(String bizAllocNo){
|
||||
return findByField(AllocOrder::getBizAllocNo, bizAllocNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<AllocOrder> page(PageParam pageParam, AllocOrderQuery param){
|
||||
Page<AllocOrder> mpPage = MpUtil.getMpPage(pageParam);
|
||||
QueryWrapper<AllocOrder> generator = QueryGenerator.generator(param);
|
||||
return this.page(mpPage, generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询待同步的分账单
|
||||
*/
|
||||
public List<AllocOrder> findSyncOrder(){
|
||||
List<String> statusList = List.of(AllocOrderStatusEnum.ALLOCATION_PROCESSING.getCode(), AllocOrderStatusEnum.ALLOCATION_END.getCode());
|
||||
return lambdaQuery()
|
||||
.in(AllocOrder::getStatus, statusList)
|
||||
.list();
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.order.allocation;
|
||||
|
||||
import org.dromara.daxpay.service.entity.order.allocation.AllocOrder;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/4/7
|
||||
*/
|
||||
@Mapper
|
||||
public interface AllocOrderMapper extends MPJBaseMapper<AllocOrder> {
|
||||
}
|
@@ -0,0 +1,107 @@
|
||||
package org.dromara.daxpay.service.dao.order.pay;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.annotation.IgnoreTenant;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.core.enums.PayAllocStatusEnum;
|
||||
import org.dromara.daxpay.core.enums.PayStatusEnum;
|
||||
import org.dromara.daxpay.service.entity.order.pay.PayOrder;
|
||||
import org.dromara.daxpay.service.param.order.pay.PayOrderQuery;
|
||||
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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/6/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class PayOrderManager extends BaseManager<PayOrderMapper, PayOrder> {
|
||||
|
||||
/**
|
||||
* 根据订单号查询
|
||||
*/
|
||||
public Optional<PayOrder> findByOrderNo(String orderNo) {
|
||||
return findByField(PayOrder::getOrderNo,orderNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商户订单号查询
|
||||
*/
|
||||
public Optional<PayOrder> findByBizOrderNo(String bizOrderNo) {
|
||||
return findByField(PayOrder::getBizOrderNo,bizOrderNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<PayOrder> page(PageParam pageParam, PayOrderQuery query){
|
||||
Page<PayOrder> mpPage = MpUtil.getMpPage(pageParam);
|
||||
QueryWrapper<PayOrder> generator = QueryGenerator.generator(query);
|
||||
return page(mpPage, generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询对账用订单记录(指定时间和状态的订单)
|
||||
*/
|
||||
public List<PayOrder> findReconcile(String channel, LocalDateTime startTime, LocalDateTime endTime) {
|
||||
return this.lambdaQuery()
|
||||
.eq(PayOrder::getChannel, channel)
|
||||
.between(PayOrder::getPayTime, startTime, endTime)
|
||||
.eq(PayOrder::getStatus, PayStatusEnum.SUCCESS.getCode())
|
||||
.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自动分账的订单记录(指定时间和状态的订单)
|
||||
*/
|
||||
public List<PayOrder> findAutoAllocation() {
|
||||
return this.lambdaQuery()
|
||||
.eq(PayOrder::getAllocation, true)
|
||||
.eq(PayOrder::getAutoAllocation, true)
|
||||
.eq(PayOrder::getAllocStatus, PayAllocStatusEnum.WAITING.getCode())
|
||||
.eq(PayOrder::getStatus, PayStatusEnum.SUCCESS.getCode())
|
||||
.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询汇总金额
|
||||
*/
|
||||
public BigDecimal getTotalAmount(PayOrderQuery query){
|
||||
QueryWrapper<PayOrder> generator = QueryGenerator.generator(query);
|
||||
// 商户和应用AppId
|
||||
generator.eq(MpUtil.getColumnName(PayOrder::getStatus), PayStatusEnum.SUCCESS.getCode());
|
||||
return baseMapper.getTotalAmount(generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前超时的未支付订单
|
||||
*/
|
||||
@IgnoreTenant
|
||||
public List<PayOrder> queryExpiredOrderNotTenant() {
|
||||
return lambdaQuery()
|
||||
.eq(PayOrder::getStatus, PayStatusEnum.PROGRESS.getCode())
|
||||
.lt(PayOrder::getExpiredTime, LocalDateTime.now())
|
||||
.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单, 不过滤租户
|
||||
*/
|
||||
@IgnoreTenant
|
||||
public Optional<PayOrder> findByIdNotTenant(Long id) {
|
||||
return this.findById(id);
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package org.dromara.daxpay.service.dao.order.pay;
|
||||
|
||||
import org.dromara.daxpay.service.entity.order.pay.PayOrder;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/6/27
|
||||
*/
|
||||
@Mapper
|
||||
public interface PayOrderMapper extends MPJBaseMapper<PayOrder> {
|
||||
|
||||
|
||||
@Select("select sum(amount) from pay_order ${ew.customSqlSegment}")
|
||||
BigDecimal getTotalAmount(@Param(Constants.WRAPPER) QueryWrapper<PayOrder> param);
|
||||
}
|
@@ -0,0 +1,103 @@
|
||||
package org.dromara.daxpay.service.dao.order.refund;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpCreateEntity;
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.annotation.IgnoreTenant;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.core.enums.RefundStatusEnum;
|
||||
import org.dromara.daxpay.service.entity.order.refund.RefundOrder;
|
||||
import org.dromara.daxpay.service.param.order.refund.RefundOrderQuery;
|
||||
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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/6/27
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class RefundOrderManager extends BaseManager<RefundOrderMapper, RefundOrder> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<RefundOrder> page(PageParam pageParam, RefundOrderQuery query) {
|
||||
Page<RefundOrder> mpPage = MpUtil.getMpPage(pageParam);
|
||||
QueryWrapper<RefundOrder> generator = QueryGenerator.generator(query);
|
||||
return page(mpPage,generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据退款号查询
|
||||
*/
|
||||
public Optional<RefundOrder> findByRefundNo(String refundNo) {
|
||||
return findByField(RefundOrder::getRefundNo, refundNo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据商户退款号查询
|
||||
*/
|
||||
public Optional<RefundOrder> findByBizRefundNo(String bizRefundNo) {
|
||||
return findByField(RefundOrder::getBizRefundNo, bizRefundNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支付号是否重复
|
||||
*/
|
||||
public boolean existsByRefundNo(String refundNo){
|
||||
return this.existedByField(RefundOrder::getRefundNo,refundNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询一分钟之前的退款中的支付订单
|
||||
*/
|
||||
@IgnoreTenant
|
||||
public List<RefundOrder> findAllByProgress() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
return lambdaQuery()
|
||||
.eq(RefundOrder::getStatus, RefundStatusEnum.PROGRESS.getCode())
|
||||
.le(MpCreateEntity::getCreateTime, now.plusMinutes(-1L))
|
||||
.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询对账用订单记录(指定时间和状态的订单)
|
||||
*/
|
||||
public List<RefundOrder> findSuccessReconcile(String channel, LocalDateTime startTime, LocalDateTime endTime) {
|
||||
return this.lambdaQuery()
|
||||
.eq(RefundOrder::getChannel, channel)
|
||||
.between(RefundOrder::getFinishTime, startTime, endTime)
|
||||
.eq(RefundOrder::getStatus, RefundStatusEnum.SUCCESS)
|
||||
.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询汇总金额
|
||||
*/
|
||||
public BigDecimal getTotalAmount(RefundOrderQuery query){
|
||||
QueryWrapper<RefundOrder> generator = QueryGenerator.generator(query);
|
||||
generator.eq(MpUtil.getColumnName(RefundOrder::getStatus), RefundStatusEnum.SUCCESS.getCode());
|
||||
return baseMapper.getTotalAmount(generator);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询订单, 不过滤租户
|
||||
*/
|
||||
public Optional<RefundOrder> findByIdNotTenant(Long id) {
|
||||
return findById(id);
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package org.dromara.daxpay.service.dao.order.refund;
|
||||
|
||||
import org.dromara.daxpay.service.entity.order.refund.RefundOrder;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/6/27
|
||||
*/
|
||||
@Mapper
|
||||
public interface RefundOrderMapper extends MPJBaseMapper<RefundOrder> {
|
||||
|
||||
|
||||
@Select("select sum(amount) from pay_refund_order ${ew.customSqlSegment}")
|
||||
BigDecimal getTotalAmount(@Param(Constants.WRAPPER) QueryWrapper<RefundOrder> generator);
|
||||
}
|
@@ -0,0 +1,84 @@
|
||||
package org.dromara.daxpay.service.dao.order.transfer;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpCreateEntity;
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.annotation.IgnoreTenant;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.core.enums.TransferStatusEnum;
|
||||
import org.dromara.daxpay.service.entity.order.transfer.TransferOrder;
|
||||
import org.dromara.daxpay.service.param.order.transfer.TransferOrderQuery;
|
||||
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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/3/21
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class TransferOrderManager extends BaseManager<TransferOrderMapper, TransferOrder> {
|
||||
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<TransferOrder> page(PageParam pageParam, TransferOrderQuery query) {
|
||||
Page<TransferOrder> mpPage = MpUtil.getMpPage(pageParam, TransferOrder.class);
|
||||
QueryWrapper<TransferOrder> generator = QueryGenerator.generator(query);
|
||||
return page(mpPage,generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询一分钟前转账中的订单
|
||||
*/
|
||||
@IgnoreTenant
|
||||
public List<TransferOrder> findAllByProgress() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
return lambdaQuery()
|
||||
.eq(TransferOrder::getStatus, TransferStatusEnum.PROGRESS.getCode())
|
||||
.le(MpCreateEntity::getCreateTime, now.plusMinutes(1L))
|
||||
.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据转账号查询
|
||||
*/
|
||||
public Optional<TransferOrder> findByTransferNo(String transferNo) {
|
||||
return findByField(TransferOrder::getTransferNo, transferNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商户转账号查询
|
||||
*/
|
||||
public Optional<TransferOrder> findByBizTransferNo(String bizTransferNo) {
|
||||
return findByField(TransferOrder::getBizTransferNo, bizTransferNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询汇总金额
|
||||
*/
|
||||
public BigDecimal getTotalAmount(TransferOrderQuery query){
|
||||
QueryWrapper<TransferOrderQuery> generator = QueryGenerator.generator(query);
|
||||
generator.eq(MpUtil.getColumnName(TransferOrder::getStatus), TransferStatusEnum.SUCCESS.getCode());
|
||||
return baseMapper.getTotalAmount(generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单, 不过滤租户
|
||||
*/
|
||||
public Optional<TransferOrder> findByIdNotTenant(Long id) {
|
||||
return findById(id);
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
package org.dromara.daxpay.service.dao.order.transfer;
|
||||
|
||||
import org.dromara.daxpay.service.entity.order.transfer.TransferOrder;
|
||||
import org.dromara.daxpay.service.param.order.transfer.TransferOrderQuery;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/3/21
|
||||
*/
|
||||
@Mapper
|
||||
public interface TransferOrderMapper extends MPJBaseMapper<TransferOrder> {
|
||||
|
||||
/**
|
||||
* 查询转账总金额
|
||||
*/
|
||||
@Select("select sum(amount) from pay_transfer_order ${ew.customSqlSegment}")
|
||||
BigDecimal getTotalAmount(@Param(Constants.WRAPPER) QueryWrapper<TransferOrderQuery> generator);
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
package org.dromara.daxpay.service.dao.reconcile;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import org.dromara.daxpay.service.entity.reconcile.ChannelReconcileTrade;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/8/6
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class ChannelReconcileTradeManage extends BaseManager<ChannelReconcileTradeMapper, ChannelReconcileTrade> {
|
||||
|
||||
/**
|
||||
* 根据订单id查询
|
||||
*/
|
||||
public List<ChannelReconcileTrade> findAllByReconcileId(Long reconcileId){
|
||||
return this.findAllByField(ChannelReconcileTrade::getReconcileId, reconcileId);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.reconcile;
|
||||
|
||||
import org.dromara.daxpay.service.entity.reconcile.ChannelReconcileTrade;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/8/6
|
||||
*/
|
||||
@Mapper
|
||||
public interface ChannelReconcileTradeMapper extends MPJBaseMapper<ChannelReconcileTrade> {
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
package org.dromara.daxpay.service.dao.reconcile;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.service.entity.reconcile.ReconcileDiscrepancy;
|
||||
import org.dromara.daxpay.service.param.reconcile.ReconcileDiscrepancyQuery;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/8/5
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class ReconcileDiscrepancyManager extends BaseManager<ReconcileDiscrepancyMapper, ReconcileDiscrepancy> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<ReconcileDiscrepancy> page(PageParam pageParam, ReconcileDiscrepancyQuery query){
|
||||
Page<ReconcileDiscrepancy> mpPage = MpUtil.getMpPage(pageParam, ReconcileDiscrepancy.class);
|
||||
QueryWrapper<ReconcileDiscrepancy> generator = QueryGenerator.generator(query);
|
||||
return this.page(mpPage,generator);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.reconcile;
|
||||
|
||||
import org.dromara.daxpay.service.entity.reconcile.ReconcileDiscrepancy;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/8/5
|
||||
*/
|
||||
@Mapper
|
||||
public interface ReconcileDiscrepancyMapper extends MPJBaseMapper<ReconcileDiscrepancy> {
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
package org.dromara.daxpay.service.dao.reconcile;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.service.entity.reconcile.ReconcileStatement;
|
||||
import org.dromara.daxpay.service.param.reconcile.ReconcileStatementQuery;
|
||||
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;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/8/5
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class ReconcileStatementManager extends BaseManager<ReconcileStatementMapper, ReconcileStatement> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<ReconcileStatement> page(PageParam pageParam, ReconcileStatementQuery query){
|
||||
Page<ReconcileStatement> mpPage = MpUtil.getMpPage(pageParam, ReconcileStatement.class);
|
||||
QueryWrapper<ReconcileStatement> generator = QueryGenerator.generator(query);
|
||||
return this.page(mpPage,generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据日期查询
|
||||
*/
|
||||
public List<ReconcileStatement> findByChannelAndData(String channel, LocalDate date){
|
||||
return this.lambdaQuery()
|
||||
.eq(ReconcileStatement::getDate,date)
|
||||
.eq(ReconcileStatement::getChannel,channel)
|
||||
.list();
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.reconcile;
|
||||
|
||||
import org.dromara.daxpay.service.entity.reconcile.ReconcileStatement;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/8/5
|
||||
*/
|
||||
@Mapper
|
||||
public interface ReconcileStatementMapper extends MPJBaseMapper<ReconcileStatement> {
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
package org.dromara.daxpay.service.dao.record.callback;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.service.entity.record.callback.TradeCallbackRecord;
|
||||
import org.dromara.daxpay.service.param.record.TradeCallbackRecordQuery;
|
||||
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.Service;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/22
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TradeCallbackRecordManager extends BaseManager<TradeCallbackRecordMapper, TradeCallbackRecord> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<TradeCallbackRecord> page(PageParam pageParam, TradeCallbackRecordQuery query){
|
||||
Page<TradeCallbackRecord> mpPage = MpUtil.getMpPage(pageParam, TradeCallbackRecord.class);
|
||||
QueryWrapper<TradeCallbackRecord> generator = QueryGenerator.generator(query);
|
||||
return page(mpPage, generator);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.record.callback;
|
||||
|
||||
import org.dromara.daxpay.service.entity.record.callback.TradeCallbackRecord;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/7/22
|
||||
*/
|
||||
@Mapper
|
||||
public interface TradeCallbackRecordMapper extends MPJBaseMapper<TradeCallbackRecord> {
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
package org.dromara.daxpay.service.dao.record.close;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.service.entity.record.close.PayCloseRecord;
|
||||
import org.dromara.daxpay.service.param.record.PayCloseRecordQuery;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/1/4
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class PayCloseRecordManager extends BaseManager<PayCloseRecordMapper, PayCloseRecord> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<PayCloseRecord> page(PageParam pageParam, PayCloseRecordQuery param){
|
||||
Page<PayCloseRecord> mpPage = MpUtil.getMpPage(pageParam, PayCloseRecord.class);
|
||||
QueryWrapper<PayCloseRecord> generator = QueryGenerator.generator(param);
|
||||
return page(mpPage, generator);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.record.close;
|
||||
|
||||
import org.dromara.daxpay.service.entity.record.close.PayCloseRecord;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/1/4
|
||||
*/
|
||||
@Mapper
|
||||
public interface PayCloseRecordMapper extends MPJBaseMapper<PayCloseRecord> {
|
||||
}
|
@@ -0,0 +1,46 @@
|
||||
package org.dromara.daxpay.service.dao.record.flow;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.core.enums.TradeTypeEnum;
|
||||
import org.dromara.daxpay.service.entity.record.flow.TradeFlowRecord;
|
||||
import org.dromara.daxpay.service.param.record.TradeFlowRecordQuery;
|
||||
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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 交易流水
|
||||
* @author xxm
|
||||
* @since 2024/6/30
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class TradeFlowRecordManager extends BaseManager<TradeFlowRecordMapper, TradeFlowRecord> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<TradeFlowRecord> page(PageParam pageParam, TradeFlowRecordQuery param){
|
||||
Page<TradeFlowRecord> mpPage = MpUtil.getMpPage(pageParam, TradeFlowRecord.class);
|
||||
QueryWrapper<TradeFlowRecord> generator = QueryGenerator.generator(param);
|
||||
return page(mpPage, generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询汇总金额
|
||||
*/
|
||||
public BigDecimal getTotalAmount(TradeFlowRecordQuery query, TradeTypeEnum tradeTypeEnum){
|
||||
QueryWrapper<TradeFlowRecord> generator = QueryGenerator.generator(query);
|
||||
generator.eq(MpUtil.getColumnName(TradeFlowRecord::getType), tradeTypeEnum.getCode());
|
||||
return baseMapper.getTotalAmount(generator);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package org.dromara.daxpay.service.dao.record.flow;
|
||||
|
||||
import org.dromara.daxpay.service.entity.record.flow.TradeFlowRecord;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 交易流水
|
||||
* @author xxm
|
||||
* @since 2024/6/30
|
||||
*/
|
||||
@Mapper
|
||||
public interface TradeFlowRecordMapper extends MPJBaseMapper<TradeFlowRecord> {
|
||||
|
||||
@Select("select sum(amount) from pay_trade_flow_record ${ew.customSqlSegment}")
|
||||
BigDecimal getTotalAmount(@Param(Constants.WRAPPER) QueryWrapper<TradeFlowRecord> generator);
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
package org.dromara.daxpay.service.dao.record.sync;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.core.rest.param.PageParam;
|
||||
import org.dromara.daxpay.service.entity.record.sync.TradeSyncRecord;
|
||||
import org.dromara.daxpay.service.param.record.TradeSyncRecordQuery;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2023/7/14
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class TradeSyncRecordManager extends BaseManager<TradeSyncRecordMapper, TradeSyncRecord> {
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
public Page<TradeSyncRecord> page(PageParam pageParam, TradeSyncRecordQuery query) {
|
||||
Page<TradeSyncRecord> mpPage = MpUtil.getMpPage(pageParam, TradeSyncRecord.class);
|
||||
QueryWrapper<TradeSyncRecord> generator = QueryGenerator.generator(query);
|
||||
return page(mpPage, generator);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package org.dromara.daxpay.service.dao.record.sync;
|
||||
|
||||
import org.dromara.daxpay.service.entity.record.sync.TradeSyncRecord;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 支付同步记录
|
||||
* @author xxm
|
||||
* @since 2023/7/14
|
||||
*/
|
||||
@Mapper
|
||||
public interface TradeSyncRecordMapper extends MPJBaseMapper<TradeSyncRecord> {
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package org.dromara.daxpay.service.entity.allocation.receiver;
|
||||
|
||||
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 分账组
|
||||
* @author xxm
|
||||
* @since 2024/6/4
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AllocGroup extends MchAppBaseEntity {
|
||||
|
||||
/** 分账组编码 */
|
||||
private String groupNo;
|
||||
|
||||
/** 名称 */
|
||||
private String name;
|
||||
|
||||
/** 通道 */
|
||||
@TableField(updateStrategy = FieldStrategy.NEVER)
|
||||
private String channel;
|
||||
|
||||
/** 是否为默认分账组 */
|
||||
private boolean defaultGroup;
|
||||
|
||||
/** 总分账比例(百分之多少) */
|
||||
private BigDecimal totalRate;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
package org.dromara.daxpay.service.entity.allocation.receiver;
|
||||
|
||||
import org.dromara.daxpay.service.common.entity.MchAppBaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 分账组和接收者关系
|
||||
* @author xxm
|
||||
* @since 2024/6/4
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AllocGroupReceiver extends MchAppBaseEntity {
|
||||
|
||||
/** 分账组ID */
|
||||
private Long groupId;
|
||||
|
||||
/** 接收者ID */
|
||||
private Long receiverId;
|
||||
|
||||
/** 分账比例(百分之多少) */
|
||||
private BigDecimal rate;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user