mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-03 19:16:21 +00:00
ref 对账功能完善
This commit is contained in:
@@ -10,7 +10,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AllocationDetailResultEnum {
|
||||
public enum AllocDetailResultEnum {
|
||||
|
||||
PENDING("pending", "待分账"),
|
||||
SUCCESS("success", "分账成功"),
|
@@ -10,7 +10,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AllocationOrderResultEnum {
|
||||
public enum AllocOrderResultEnum {
|
||||
|
||||
ALL_PENDING("all_pending", "全部成功"),
|
||||
ALL_SUCCESS("all_success", "全部成功"),
|
@@ -10,7 +10,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AllocationOrderStatusEnum {
|
||||
public enum AllocOrderStatusEnum {
|
||||
|
||||
ALLOCATION_PROCESSING("allocation_processing", "分账处理中"),
|
||||
ALLOCATION_END("allocation_end", "分账完成"),
|
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AllocationReceiverTypeEnum {
|
||||
public enum AllocReceiverTypeEnum {
|
||||
/** 个人 */
|
||||
WX_PERSONAL("wx_personal","PERSONAL_OPENID", "个人"),
|
||||
/** 商户 */
|
||||
@@ -37,16 +37,16 @@ public enum AllocationReceiverTypeEnum {
|
||||
/**
|
||||
* 根据编码查找
|
||||
*/
|
||||
public static AllocationReceiverTypeEnum findByCode(String code) {
|
||||
return Arrays.stream(AllocationReceiverTypeEnum.values())
|
||||
public static AllocReceiverTypeEnum findByCode(String code) {
|
||||
return Arrays.stream(AllocReceiverTypeEnum.values())
|
||||
.filter(e -> e.getCode().equals(code))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalArgumentException("未找到对应的分账接收方类型"));
|
||||
}
|
||||
|
||||
/** 微信支持类型 */
|
||||
public static final List<AllocationReceiverTypeEnum> WECHAT_LIST = Collections.unmodifiableList(Arrays.asList(WX_PERSONAL, WX_MERCHANT));
|
||||
public static final List<AllocReceiverTypeEnum> WECHAT_LIST = Collections.unmodifiableList(Arrays.asList(WX_PERSONAL, WX_MERCHANT));
|
||||
/** 支付宝支持类型 */
|
||||
public static final List<AllocationReceiverTypeEnum> ALI_LIST = Collections.unmodifiableList(Arrays.asList(ALI_OPEN_ID, ALI_USER_ID, ALI_LOGIN_NAME));
|
||||
public static final List<AllocReceiverTypeEnum> ALI_LIST = Collections.unmodifiableList(Arrays.asList(ALI_OPEN_ID, ALI_USER_ID, ALI_LOGIN_NAME));
|
||||
|
||||
}
|
@@ -10,7 +10,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AllocationRelationTypeEnum {
|
||||
public enum AllocRelationTypeEnum {
|
||||
SERVICE_PROVIDER("SERVICE_PROVIDER","服务商"),
|
||||
STORE("STORE","门店"),
|
||||
STAFF("STAFF","员工"),
|
@@ -10,7 +10,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PayOrderAllocationStatusEnum {
|
||||
public enum PayOrderAllocStatusEnum {
|
||||
WAITING("waiting", "待分账"),
|
||||
ALLOCATION("allocation", "已分账"),
|
||||
;
|
@@ -9,12 +9,8 @@ public interface PaymentApiCode {
|
||||
|
||||
String PAY = "pay";
|
||||
|
||||
String SIMPLE_PAY = "simplePay";
|
||||
|
||||
String REFUND = "refund";
|
||||
|
||||
String SIMPLE_REFUND = "simpleRefund";
|
||||
|
||||
String CLOSE = "close";
|
||||
|
||||
String ALLOCATION = "allocation";
|
||||
|
@@ -13,11 +13,11 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Schema(title = "支付订单查询参数")
|
||||
public class QueryAllocationOrderParam extends PaymentCommonParam {
|
||||
|
||||
@Schema(description = "分账订单ID")
|
||||
private Long orderId;
|
||||
public class QueryAllocOrderParam extends PaymentCommonParam {
|
||||
|
||||
@Schema(description = "分账单号")
|
||||
private String allocationNo;
|
||||
|
||||
@Schema(description = "商户分账单号")
|
||||
private String bizAllocationNo;
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
package cn.bootx.platform.daxpay.result.pay;
|
||||
|
||||
import cn.bootx.platform.daxpay.code.AllocationOrderStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocOrderStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.RefundSyncStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.PaySyncStatusEnum;
|
||||
import cn.bootx.platform.daxpay.result.PaymentCommonResult;
|
||||
@@ -26,10 +26,10 @@ public class SyncResult extends PaymentCommonResult {
|
||||
* 支付网关同步状态
|
||||
* @see PaySyncStatusEnum
|
||||
* @see RefundSyncStatusEnum
|
||||
* @see AllocationOrderStatusEnum
|
||||
* @see AllocOrderStatusEnum
|
||||
*/
|
||||
@Schema(description = "支付网关同步状态")
|
||||
private String gatewayStatus = FAIL.getCode();
|
||||
private String status = FAIL.getCode();
|
||||
|
||||
@Schema(description = "是否进行了修复")
|
||||
private Boolean repair;
|
||||
|
@@ -33,6 +33,11 @@
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
</dependency>
|
||||
<!-- 文件上传 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx.platform</groupId>
|
||||
<artifactId>common-starter-file</artifactId>
|
||||
</dependency>
|
||||
<!-- 自动建表 -->
|
||||
<dependency>
|
||||
<groupId>cn.bootx</groupId>
|
||||
|
@@ -4,19 +4,18 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 支付宝流水记录类型
|
||||
* 对账单文件
|
||||
* @author xxm
|
||||
* @since 2024/2/20
|
||||
* @since 2024/5/4
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
@Deprecated
|
||||
public enum AliPayRecordTypeEnum {
|
||||
public enum ReconcileFileTypeEnum {
|
||||
|
||||
/** 支付 */
|
||||
PAY("pay", "支付"),
|
||||
/** 退款 */
|
||||
REFUND("refund", "退款");
|
||||
TOTAL("total", "汇总"),
|
||||
DETAIL("detail", "明细"),
|
||||
ZIP("zip", "压缩包"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
@@ -0,0 +1,23 @@
|
||||
package cn.bootx.platform.daxpay.service.code;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 对账结果
|
||||
* @author xxm
|
||||
* @since 2024/5/3
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ReconcileResultEnum {
|
||||
|
||||
/** 一致 */
|
||||
CONSISTENT("consistent","一致"),
|
||||
|
||||
/** 不一致 */
|
||||
INCONSISTENT("inconsistent","不一致");
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
package cn.bootx.platform.daxpay.service.core.channel.alipay.service;
|
||||
|
||||
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
|
||||
import cn.bootx.platform.daxpay.service.code.AliPayCode;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.allocation.entity.AllocationReceiver;
|
||||
@@ -22,7 +22,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum.*;
|
||||
import static cn.bootx.platform.daxpay.code.AllocReceiverTypeEnum.*;
|
||||
|
||||
/**
|
||||
* 支付宝分账
|
||||
@@ -52,7 +52,7 @@ public class AliPayAllocationReceiverService {
|
||||
model.setOutRequestNo(String.valueOf(allocationReceiver.getId()));
|
||||
|
||||
RoyaltyEntity entity = new RoyaltyEntity();
|
||||
AllocationReceiverTypeEnum receiverTypeEnum = AllocationReceiverTypeEnum.findByCode(allocationReceiver.getReceiverType());
|
||||
AllocReceiverTypeEnum receiverTypeEnum = AllocReceiverTypeEnum.findByCode(allocationReceiver.getReceiverType());
|
||||
entity.setType(receiverTypeEnum.getOutCode());
|
||||
entity.setAccount(allocationReceiver.getReceiverAccount());
|
||||
entity.setName(allocationReceiver.getReceiverName());
|
||||
@@ -73,7 +73,7 @@ public class AliPayAllocationReceiverService {
|
||||
model.setOutRequestNo(String.valueOf(allocationReceiver.getId()));
|
||||
|
||||
RoyaltyEntity entity = new RoyaltyEntity();
|
||||
AllocationReceiverTypeEnum receiverTypeEnum = findByCode(allocationReceiver.getReceiverType());
|
||||
AllocReceiverTypeEnum receiverTypeEnum = findByCode(allocationReceiver.getReceiverType());
|
||||
entity.setType(receiverTypeEnum.getOutCode());
|
||||
entity.setAccount(allocationReceiver.getReceiverAccount());
|
||||
|
||||
|
@@ -2,7 +2,7 @@ package cn.bootx.platform.daxpay.service.core.channel.alipay.service;
|
||||
|
||||
import cn.bootx.platform.common.core.function.CollectorsFunction;
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpIdEntity;
|
||||
import cn.bootx.platform.daxpay.code.AllocationDetailResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocDetailResultEnum;
|
||||
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
|
||||
import cn.bootx.platform.daxpay.service.code.AliPayCode;
|
||||
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
|
||||
@@ -123,7 +123,7 @@ public class AliPayAllocationService {
|
||||
detail.setErrorCode(receiver.getErrorCode());
|
||||
detail.setErrorMsg(receiver.getErrorDesc());
|
||||
// 如果是完成, 更新时间
|
||||
if (AllocationDetailResultEnum.SUCCESS.getCode().equals(detail.getResult())){
|
||||
if (AllocDetailResultEnum.SUCCESS.getCode().equals(detail.getResult())){
|
||||
LocalDateTime finishTime = LocalDateTimeUtil.of(receiver.getExecuteDt());
|
||||
detail.setFinishTime(finishTime);
|
||||
}
|
||||
@@ -148,16 +148,16 @@ public class AliPayAllocationService {
|
||||
/**
|
||||
* 转换支付宝分账类型到系统中统一的
|
||||
*/
|
||||
private AllocationDetailResultEnum getDetailResultEnum (String result){
|
||||
private AllocDetailResultEnum getDetailResultEnum (String result){
|
||||
// 进行中
|
||||
if(Objects.equals(AliPayCode.ALLOC_PROCESSING, result)){
|
||||
return AllocationDetailResultEnum.PENDING;
|
||||
return AllocDetailResultEnum.PENDING;
|
||||
}
|
||||
// 成功
|
||||
if(Objects.equals(AliPayCode.ALLOC_SUCCESS, result)){
|
||||
return AllocationDetailResultEnum.SUCCESS;
|
||||
return AllocDetailResultEnum.SUCCESS;
|
||||
}
|
||||
// 失败
|
||||
return AllocationDetailResultEnum.FAIL;
|
||||
return AllocDetailResultEnum.FAIL;
|
||||
}
|
||||
}
|
||||
|
@@ -4,12 +4,16 @@ import cn.bootx.platform.common.core.util.LocalDateTimeUtil;
|
||||
import cn.bootx.platform.daxpay.code.ReconcileTradeEnum;
|
||||
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
|
||||
import cn.bootx.platform.daxpay.service.code.AliPayCode;
|
||||
import cn.bootx.platform.daxpay.service.code.ReconcileFileTypeEnum;
|
||||
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.alipay.dao.AliReconcileBillDetailManager;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.alipay.dao.AliReconcileBillTotalManager;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliReconcileBillDetail;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliReconcileBillTotal;
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.dao.ReconcileFileManager;
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.entity.ReconcileDetail;
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.entity.ReconcileFile;
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.entity.ReconcileOrder;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.text.csv.CsvReader;
|
||||
@@ -25,6 +29,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import lombok.val;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
|
||||
import org.dromara.x.file.storage.core.FileInfo;
|
||||
import org.dromara.x.file.storage.core.FileStorageService;
|
||||
import org.dromara.x.file.storage.core.UploadPretreatment;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -51,14 +58,20 @@ public class AliPayReconcileService {
|
||||
|
||||
private final AliReconcileBillTotalManager reconcileBillTotalManager;
|
||||
|
||||
private final ReconcileFileManager reconcileFileManager;
|
||||
|
||||
private final FileStorageService fileStorageService;
|
||||
|
||||
|
||||
/**
|
||||
* 下载对账单, 并进行解析进行保存
|
||||
*
|
||||
* @param date 对账日期 yyyy-MM-dd 格式
|
||||
* @param date 对账日期 yyyy-MM-dd 格式
|
||||
* @param recordOrder 对账单对象
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void downAndSave(String date){
|
||||
public void downAndSave(String date, ReconcileOrder recordOrder){
|
||||
|
||||
try {
|
||||
AlipayDataDataserviceBillDownloadurlQueryModel model = new AlipayDataDataserviceBillDownloadurlQueryModel();
|
||||
@@ -93,6 +106,8 @@ public class AliPayReconcileService {
|
||||
}
|
||||
// 保存原始对账记录
|
||||
this.save(billDetails, billTotals);
|
||||
// 保存文件
|
||||
this.saveOriginalFile(recordOrder, bytes);
|
||||
|
||||
// 将原始交易明细对账记录转换通用结构并保存到上下文中
|
||||
this.convertAndSave(billDetails);
|
||||
@@ -219,4 +234,22 @@ public class AliPayReconcileService {
|
||||
return reader.read(billTotal, AliReconcileBillTotal.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存下载的原始对账文件
|
||||
*/
|
||||
private void saveOriginalFile(ReconcileOrder reconcileOrder, byte[] bytes) {
|
||||
// 将原始文件进行保存
|
||||
String fileName = "";
|
||||
UploadPretreatment uploadPretreatment = fileStorageService.of(bytes);
|
||||
if (StrUtil.isNotBlank(fileName)) {
|
||||
uploadPretreatment.setOriginalFilename(fileName);
|
||||
}
|
||||
FileInfo upload = uploadPretreatment.upload();
|
||||
String fileId = upload.getId();
|
||||
ReconcileFile reconcileFile = new ReconcileFile().setFileId(Long.valueOf(fileId))
|
||||
.setReconcileId(reconcileOrder.getId())
|
||||
.setType(ReconcileFileTypeEnum.ZIP.getCode());
|
||||
reconcileFileManager.save(reconcileFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package cn.bootx.platform.daxpay.service.core.channel.wechat.service;
|
||||
|
||||
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
|
||||
import cn.bootx.platform.daxpay.service.code.WeChatPayCode;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConfig;
|
||||
@@ -20,7 +20,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum.WX_MERCHANT;
|
||||
import static cn.bootx.platform.daxpay.code.AllocReceiverTypeEnum.WX_MERCHANT;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -45,7 +45,7 @@ public class WeChatPayAllocationReceiverService {
|
||||
* 绑定
|
||||
*/
|
||||
public void bind(AllocationReceiver allocationReceiver, WeChatPayConfig weChatPayConfig){
|
||||
AllocationReceiverTypeEnum receiverTypeEnum = AllocationReceiverTypeEnum.findByCode(allocationReceiver.getReceiverType());
|
||||
AllocReceiverTypeEnum receiverTypeEnum = AllocReceiverTypeEnum.findByCode(allocationReceiver.getReceiverType());
|
||||
// 接收者参数
|
||||
ReceiverModel receiver = ReceiverModel.builder()
|
||||
.type(receiverTypeEnum.getOutCode())
|
||||
@@ -72,7 +72,7 @@ public class WeChatPayAllocationReceiverService {
|
||||
* 解除绑定
|
||||
*/
|
||||
public void unbind(AllocationReceiver allocationReceiver, WeChatPayConfig weChatPayConfig){
|
||||
AllocationReceiverTypeEnum receiverTypeEnum = AllocationReceiverTypeEnum.findByCode(allocationReceiver.getReceiverType());
|
||||
AllocReceiverTypeEnum receiverTypeEnum = AllocReceiverTypeEnum.findByCode(allocationReceiver.getReceiverType());
|
||||
// 原始参数
|
||||
ReceiverModel receiver = ReceiverModel.builder()
|
||||
.type(receiverTypeEnum.getOutCode())
|
||||
|
@@ -2,8 +2,8 @@ package cn.bootx.platform.daxpay.service.core.channel.wechat.service;
|
||||
|
||||
import cn.bootx.platform.common.core.function.CollectorsFunction;
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpIdEntity;
|
||||
import cn.bootx.platform.daxpay.code.AllocationDetailResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocDetailResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
|
||||
import cn.bootx.platform.daxpay.service.code.WeChatPayCode;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConfig;
|
||||
@@ -58,7 +58,7 @@ public class WeChatPayAllocationService {
|
||||
String finalDescription = description;
|
||||
orderDetails.sort(Comparator.comparing(MpIdEntity::getId));
|
||||
List<ReceiverModel> list = orderDetails.stream().map(o->{
|
||||
AllocationReceiverTypeEnum receiverTypeEnum = AllocationReceiverTypeEnum.findByCode(o.getReceiverType());
|
||||
AllocReceiverTypeEnum receiverTypeEnum = AllocReceiverTypeEnum.findByCode(o.getReceiverType());
|
||||
return ReceiverModel.builder()
|
||||
.type(receiverTypeEnum.getOutCode())
|
||||
.account(o.getReceiverAccount())
|
||||
@@ -131,7 +131,7 @@ public class WeChatPayAllocationService {
|
||||
detail.setResult(this.getDetailResultEnum(receiver.getResult()).getCode());
|
||||
detail.setErrorMsg(receiver.getFailReason());
|
||||
// 如果是完成, 更新时间
|
||||
if (AllocationDetailResultEnum.SUCCESS.getCode().equals(detail.getResult())){
|
||||
if (AllocDetailResultEnum.SUCCESS.getCode().equals(detail.getResult())){
|
||||
LocalDateTime finishTime = LocalDateTimeUtil.parse(receiver.getFinishTime(), DatePattern.PURE_DATETIME_PATTERN);
|
||||
detail.setFinishTime(finishTime);
|
||||
}
|
||||
@@ -159,16 +159,16 @@ public class WeChatPayAllocationService {
|
||||
/**
|
||||
* 转换微信分账类型到系统中统一的
|
||||
*/
|
||||
private AllocationDetailResultEnum getDetailResultEnum (String result){
|
||||
private AllocDetailResultEnum getDetailResultEnum (String result){
|
||||
// 进行中
|
||||
if(Objects.equals("PENDING", result)){
|
||||
return AllocationDetailResultEnum.PENDING;
|
||||
return AllocDetailResultEnum.PENDING;
|
||||
}
|
||||
// 成功
|
||||
if(Objects.equals("SUCCESS", result)){
|
||||
return AllocationDetailResultEnum.SUCCESS;
|
||||
return AllocDetailResultEnum.SUCCESS;
|
||||
}
|
||||
// 失败
|
||||
return AllocationDetailResultEnum.FAIL;
|
||||
return AllocDetailResultEnum.FAIL;
|
||||
}
|
||||
}
|
||||
|
@@ -277,7 +277,7 @@ public class WeChatPayService {
|
||||
public void rotationSync(PayOrder payOrder) {
|
||||
SyncResult syncResult = paySyncService.syncPayOrder(payOrder);
|
||||
// 不为支付中状态后, 调用系统同步更新状态, 支付状态则继续重试
|
||||
if (Objects.equals(PROGRESS.getCode(), syncResult.getGatewayStatus())) {
|
||||
if (Objects.equals(PROGRESS.getCode(), syncResult.getStatus())) {
|
||||
throw new RetryableException();
|
||||
}
|
||||
}
|
||||
|
@@ -2,8 +2,8 @@ package cn.bootx.platform.daxpay.service.core.order.allocation.entity;
|
||||
|
||||
import cn.bootx.platform.common.core.function.EntityBaseFunction;
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
|
||||
import cn.bootx.platform.daxpay.code.AllocationOrderResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocationOrderStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocOrderResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocOrderStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.service.core.order.allocation.convert.AllocationConvert;
|
||||
import cn.bootx.platform.daxpay.service.dto.order.allocation.AllocationOrderDto;
|
||||
@@ -99,14 +99,14 @@ public class AllocationOrder extends MpBaseEntity implements EntityBaseFunction<
|
||||
|
||||
/**
|
||||
* 状态
|
||||
* @see AllocationOrderStatusEnum
|
||||
* @see AllocOrderStatusEnum
|
||||
*/
|
||||
@DbColumn(comment = "状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 分账处理结果
|
||||
* @see AllocationOrderResultEnum
|
||||
* @see AllocOrderResultEnum
|
||||
*/
|
||||
@DbColumn(comment = "分账处理结果")
|
||||
private String result;
|
||||
|
@@ -3,8 +3,8 @@ package cn.bootx.platform.daxpay.service.core.order.allocation.entity;
|
||||
import cn.bootx.platform.common.core.annotation.EncryptionField;
|
||||
import cn.bootx.platform.common.core.function.EntityBaseFunction;
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
|
||||
import cn.bootx.platform.daxpay.code.AllocationDetailResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocDetailResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.service.core.order.allocation.convert.AllocationConvert;
|
||||
import cn.bootx.platform.daxpay.service.dto.order.allocation.AllocationOrderDetailDto;
|
||||
import cn.bootx.table.modify.annotation.DbColumn;
|
||||
@@ -46,7 +46,7 @@ public class AllocationOrderDetail extends MpBaseEntity implements EntityBaseFun
|
||||
|
||||
/**
|
||||
* 分账接收方类型
|
||||
* @see AllocationReceiverTypeEnum
|
||||
* @see AllocReceiverTypeEnum
|
||||
*/
|
||||
@DbColumn(comment = "分账接收方类型")
|
||||
private String receiverType;
|
||||
@@ -62,7 +62,7 @@ public class AllocationOrderDetail extends MpBaseEntity implements EntityBaseFun
|
||||
|
||||
/**
|
||||
* 分账结果
|
||||
* @see AllocationDetailResultEnum
|
||||
* @see AllocDetailResultEnum
|
||||
*/
|
||||
@DbColumn(comment = "分账结果")
|
||||
private String result;
|
||||
|
@@ -6,10 +6,10 @@ import cn.bootx.platform.common.core.rest.dto.LabelValue;
|
||||
import cn.bootx.platform.common.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.common.core.util.ResultConvertUtil;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.daxpay.code.AllocationDetailResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocationOrderStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocDetailResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocOrderStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayOrderAllocationStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayOrderAllocStatusEnum;
|
||||
import cn.bootx.platform.daxpay.param.payment.allocation.AllocationStartParam;
|
||||
import cn.bootx.platform.daxpay.service.core.order.allocation.dao.AllocationOrderDetailManager;
|
||||
import cn.bootx.platform.daxpay.service.core.order.allocation.dao.AllocationOrderManager;
|
||||
@@ -106,7 +106,7 @@ public class AllocationOrderService {
|
||||
detail.setAllocationId(orderId)
|
||||
.setReceiverId(o.getId())
|
||||
.setAmount(amount)
|
||||
.setResult(AllocationDetailResultEnum.PENDING.getCode())
|
||||
.setResult(AllocDetailResultEnum.PENDING.getCode())
|
||||
.setRate(rate)
|
||||
.setReceiverType(o.getReceiverType())
|
||||
.setReceiverName(o.getReceiverName())
|
||||
@@ -129,11 +129,11 @@ public class AllocationOrderService {
|
||||
.setBizAllocationNo(param.getBizAllocationNo())
|
||||
.setChannel(payOrder.getChannel())
|
||||
.setDescription(param.getDescription())
|
||||
.setStatus(AllocationOrderStatusEnum.ALLOCATION_PROCESSING.getCode())
|
||||
.setStatus(AllocOrderStatusEnum.ALLOCATION_PROCESSING.getCode())
|
||||
.setAmount(sumAmount);
|
||||
allocationOrder.setId(orderId);
|
||||
// 更新支付订单分账状态
|
||||
payOrder.setAllocationStatus(PayOrderAllocationStatusEnum.ALLOCATION.getCode());
|
||||
payOrder.setAllocationStatus(PayOrderAllocStatusEnum.ALLOCATION.getCode());
|
||||
payOrderManager.updateById(payOrder);
|
||||
// 因为加密后字段值会发生变更, 所以在保存前备份一下
|
||||
List<AllocationOrderDetail> detailsBack = details.stream()
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package cn.bootx.platform.daxpay.service.core.order.pay.builder;
|
||||
|
||||
import cn.bootx.platform.daxpay.code.PayOrderAllocationStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayOrderAllocStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayStatusEnum;
|
||||
import cn.bootx.platform.daxpay.param.payment.pay.PayParam;
|
||||
import cn.bootx.platform.daxpay.service.common.context.NoticeLocal;
|
||||
@@ -46,7 +46,7 @@ public class PayBuilder {
|
||||
.setRefundableBalance(payParam.getAmount());
|
||||
// 如果支持分账, 设置分账状态为代分账
|
||||
if (payOrder.getAllocation()) {
|
||||
payOrder.setAllocationStatus(PayOrderAllocationStatusEnum.WAITING.getCode());
|
||||
payOrder.setAllocationStatus(PayOrderAllocStatusEnum.WAITING.getCode());
|
||||
}
|
||||
return payOrder;
|
||||
}
|
||||
|
@@ -57,11 +57,12 @@ public class PayOrderManager extends BaseManager<PayOrderMapper, PayOrder> {
|
||||
/**
|
||||
* 查询对账用订单记录(指定时间和状态的订单)
|
||||
*/
|
||||
public List<PayOrder> findReconcile(LocalDateTime startTime, LocalDateTime endTime, PayStatusEnum...statusEnum) {
|
||||
public List<PayOrder> findReconcile(String channel, LocalDateTime startTime, LocalDateTime endTime, PayStatusEnum...statusEnum) {
|
||||
List<String> status = Arrays.stream(statusEnum)
|
||||
.map(PayStatusEnum::getCode)
|
||||
.collect(Collectors.toList());
|
||||
return this.lambdaQuery()
|
||||
.eq(PayOrder::getChannel, channel)
|
||||
.between(PayOrder::getPayTime, startTime, endTime)
|
||||
.in(PayOrder::getStatus, status)
|
||||
.list();
|
||||
|
@@ -2,7 +2,7 @@ package cn.bootx.platform.daxpay.service.core.order.pay.entity;
|
||||
|
||||
import cn.bootx.platform.common.core.function.EntityBaseFunction;
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
|
||||
import cn.bootx.platform.daxpay.code.PayOrderAllocationStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayOrderAllocStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayStatusEnum;
|
||||
import cn.bootx.platform.daxpay.service.core.order.pay.convert.PayOrderConvert;
|
||||
@@ -88,7 +88,7 @@ public class PayOrder extends MpBaseEntity implements EntityBaseFunction<PayOrde
|
||||
|
||||
/**
|
||||
* 分账状态
|
||||
* @see PayOrderAllocationStatusEnum
|
||||
* @see PayOrderAllocStatusEnum
|
||||
*/
|
||||
@DbColumn(comment = "分账状态")
|
||||
private String allocationStatus;
|
||||
|
@@ -0,0 +1,16 @@
|
||||
package cn.bootx.platform.daxpay.service.core.order.reconcile.dao;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.entity.ReconcileFile;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/5/4
|
||||
*/
|
||||
@Slf4j
|
||||
@Repository
|
||||
public class ReconcileFileManager extends BaseManager<ReconcileFileMapper, ReconcileFile> {
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package cn.bootx.platform.daxpay.service.core.order.reconcile.dao;
|
||||
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.entity.ReconcileFile;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/5/4
|
||||
*/
|
||||
@Mapper
|
||||
public interface ReconcileFileMapper extends BaseMapper<ReconcileFile> {
|
||||
}
|
@@ -46,7 +46,7 @@ public class ReconcileDetail extends MpCreateEntity implements EntityBaseFunctio
|
||||
private String type;
|
||||
|
||||
/** 本地交易号 */
|
||||
@DbColumn(comment = "本地订单ID")
|
||||
@DbColumn(comment = "本地交易号")
|
||||
private String tradeNo;
|
||||
|
||||
/** 外部交易号 - 支付宝/微信的订单号 */
|
||||
|
@@ -35,7 +35,7 @@ public class ReconcileDiffRecord extends MpBaseEntity implements EntityBaseFunct
|
||||
|
||||
/** 对账单ID */
|
||||
@DbColumn(comment = "对账单ID")
|
||||
private Long ReconcileId;
|
||||
private Long reconcileId;
|
||||
|
||||
/** 对账单明细ID */
|
||||
@DbColumn(comment = "对账单明细ID")
|
||||
@@ -57,6 +57,15 @@ public class ReconcileDiffRecord extends MpBaseEntity implements EntityBaseFunct
|
||||
@DbColumn(comment = "订单标题")
|
||||
private String title;
|
||||
|
||||
/** 本地交易金额 */
|
||||
@DbColumn(comment = "本地交易金额")
|
||||
private Integer amount;
|
||||
|
||||
|
||||
/** 外部交易金额 */
|
||||
@DbColumn(comment = "外部交易金额")
|
||||
private Integer outAmount;
|
||||
|
||||
/**
|
||||
* 订单类型
|
||||
* @see ReconcileTradeEnum
|
||||
@@ -81,11 +90,6 @@ public class ReconcileDiffRecord extends MpBaseEntity implements EntityBaseFunct
|
||||
@DbMySqlFieldType(MySqlFieldTypeEnum.LONGTEXT)
|
||||
private List<ReconcileDiff> diffs;
|
||||
|
||||
/** 交易金额 */
|
||||
@DbColumn(comment = "交易金额")
|
||||
private Integer amount;
|
||||
|
||||
|
||||
@Override
|
||||
public ReconcileDiffRecordDto toDto() {
|
||||
return ReconcileConvert.CONVERT.convert(this);
|
||||
|
@@ -0,0 +1,36 @@
|
||||
package cn.bootx.platform.daxpay.service.core.order.reconcile.entity;
|
||||
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpIdEntity;
|
||||
import cn.bootx.platform.daxpay.service.code.ReconcileFileTypeEnum;
|
||||
import cn.bootx.table.modify.annotation.DbColumn;
|
||||
import cn.bootx.table.modify.annotation.DbTable;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xxm
|
||||
* @since 2024/5/3
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@DbTable(comment = "对账单文件")
|
||||
@TableName("pay_reconcile_file")
|
||||
public class ReconcileFile extends MpIdEntity {
|
||||
|
||||
@DbColumn(comment = "对账单ID")
|
||||
private Long reconcileId;
|
||||
|
||||
/**
|
||||
* 明细/汇总
|
||||
* @see ReconcileFileTypeEnum
|
||||
*/
|
||||
@DbColumn(comment = "类型")
|
||||
private String type;
|
||||
|
||||
@DbColumn(comment = "对账单文件")
|
||||
private Long fileId;
|
||||
}
|
@@ -2,6 +2,7 @@ package cn.bootx.platform.daxpay.service.core.order.reconcile.entity;
|
||||
|
||||
import cn.bootx.platform.common.core.function.EntityBaseFunction;
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpCreateEntity;
|
||||
import cn.bootx.platform.daxpay.service.code.ReconcileResultEnum;
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.conver.ReconcileConvert;
|
||||
import cn.bootx.platform.daxpay.service.dto.order.reconcile.ReconcileOrderDto;
|
||||
import cn.bootx.table.modify.annotation.DbColumn;
|
||||
@@ -24,12 +25,10 @@ import java.time.LocalDate;
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@DbTable(comment = "支付对账单订单")
|
||||
@TableName("pay_reconcile_order")
|
||||
@TableName(value = "pay_reconcile_order")
|
||||
public class ReconcileOrder extends MpCreateEntity implements EntityBaseFunction<ReconcileOrderDto> {
|
||||
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
/** 对账号 */
|
||||
@DbColumn(comment = "对账号")
|
||||
private String reconcileNo;
|
||||
|
||||
@@ -49,8 +48,11 @@ public class ReconcileOrder extends MpCreateEntity implements EntityBaseFunction
|
||||
@DbColumn(comment = "是否比对完成")
|
||||
private boolean compare;
|
||||
|
||||
/** 比对结果 */
|
||||
@DbColumn(comment = "比对结果")
|
||||
/**
|
||||
* 对账结果
|
||||
* @see ReconcileResultEnum
|
||||
*/
|
||||
@DbColumn(comment = "对账结果")
|
||||
private String result;
|
||||
|
||||
/** 错误码 */
|
||||
|
@@ -4,7 +4,6 @@ import cn.bootx.platform.common.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.common.mybatisplus.impl.BaseManager;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.common.query.generator.QueryGenerator;
|
||||
import cn.bootx.platform.daxpay.code.PayStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.RefundStatusEnum;
|
||||
import cn.bootx.platform.daxpay.service.core.order.refund.entity.RefundOrder;
|
||||
import cn.bootx.platform.daxpay.service.param.order.RefundOrderQuery;
|
||||
@@ -76,11 +75,12 @@ public class RefundOrderManager extends BaseManager<RefundOrderMapper, RefundOrd
|
||||
/**
|
||||
* 查询对账用订单记录(指定时间和状态的订单)
|
||||
*/
|
||||
public List<RefundOrder> findReconcile(LocalDateTime startTime, LocalDateTime endTime, PayStatusEnum...statusEnum) {
|
||||
public List<RefundOrder> findReconcile(String channel, LocalDateTime startTime, LocalDateTime endTime, RefundStatusEnum...statusEnum) {
|
||||
List<String> status = Arrays.stream(statusEnum)
|
||||
.map(PayStatusEnum::getCode)
|
||||
.map(RefundStatusEnum::getCode)
|
||||
.collect(Collectors.toList());
|
||||
return this.lambdaQuery()
|
||||
.eq(RefundOrder::getChannel, channel)
|
||||
.between(RefundOrder::getFinishTime, startTime, endTime)
|
||||
.in(RefundOrder::getStatus, status)
|
||||
.list();
|
||||
|
@@ -3,8 +3,8 @@ package cn.bootx.platform.daxpay.service.core.payment.allocation.entity;
|
||||
import cn.bootx.platform.common.core.annotation.EncryptionField;
|
||||
import cn.bootx.platform.common.core.function.EntityBaseFunction;
|
||||
import cn.bootx.platform.common.mybatisplus.base.MpBaseEntity;
|
||||
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocationRelationTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocRelationTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.allocation.convert.AllocationReceiverConvert;
|
||||
import cn.bootx.platform.daxpay.service.dto.allocation.AllocationReceiverDto;
|
||||
@@ -41,7 +41,7 @@ public class AllocationReceiver extends MpBaseEntity implements EntityBaseFuncti
|
||||
|
||||
/**
|
||||
* 分账接收方类型
|
||||
* @see AllocationReceiverTypeEnum
|
||||
* @see AllocReceiverTypeEnum
|
||||
*/
|
||||
@DbColumn(comment = "分账接收方类型")
|
||||
private String receiverType;
|
||||
@@ -58,7 +58,7 @@ public class AllocationReceiver extends MpBaseEntity implements EntityBaseFuncti
|
||||
|
||||
/**
|
||||
* 分账关系类型
|
||||
* @see AllocationRelationTypeEnum
|
||||
* @see AllocRelationTypeEnum
|
||||
*/
|
||||
@DbColumn(comment = "分账关系类型")
|
||||
private String relationType;
|
||||
|
@@ -6,7 +6,7 @@ import cn.bootx.platform.common.core.rest.PageResult;
|
||||
import cn.bootx.platform.common.core.rest.dto.LabelValue;
|
||||
import cn.bootx.platform.common.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.common.mybatisplus.util.MpUtil;
|
||||
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.allocation.convert.AllocationReceiverConvert;
|
||||
@@ -71,11 +71,11 @@ public class AllocationReceiverService {
|
||||
*/
|
||||
public List<LabelValue> findReceiverTypeByChannel(String channel){
|
||||
PayChannelEnum channelEnum = PayChannelEnum.findByCode(channel);
|
||||
List<AllocationReceiverTypeEnum> list;
|
||||
List<AllocReceiverTypeEnum> list;
|
||||
if (channelEnum == PayChannelEnum.ALI){
|
||||
list = AllocationReceiverTypeEnum.ALI_LIST;
|
||||
list = AllocReceiverTypeEnum.ALI_LIST;
|
||||
} else if (channelEnum == PayChannelEnum.WECHAT){
|
||||
list = AllocationReceiverTypeEnum.WECHAT_LIST;
|
||||
list = AllocReceiverTypeEnum.WECHAT_LIST;
|
||||
} else {
|
||||
throw new BizException("非法的分账通道类型");
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package cn.bootx.platform.daxpay.service.core.payment.allocation.service;
|
||||
|
||||
import cn.bootx.platform.common.core.exception.DataNotExistException;
|
||||
import cn.bootx.platform.daxpay.code.AllocationDetailResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocationOrderResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocationOrderStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayOrderAllocationStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocDetailResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocOrderResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocOrderStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayOrderAllocStatusEnum;
|
||||
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
|
||||
import cn.bootx.platform.daxpay.param.payment.allocation.AllocationSyncParam;
|
||||
import cn.bootx.platform.daxpay.param.payment.allocation.AllocationFinishParam;
|
||||
@@ -26,7 +26,6 @@ import cn.bootx.platform.daxpay.service.core.payment.allocation.entity.Allocatio
|
||||
import cn.bootx.platform.daxpay.service.core.payment.allocation.factory.AllocationFactory;
|
||||
import cn.bootx.platform.daxpay.service.dto.allocation.AllocationGroupReceiverResult;
|
||||
import cn.bootx.platform.daxpay.service.func.AbsAllocationStrategy;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -90,12 +89,12 @@ public class AllocationService {
|
||||
// 分账处理
|
||||
allocationStrategy.allocation();
|
||||
// 执行中
|
||||
order.setStatus(AllocationOrderStatusEnum.ALLOCATION_PROCESSING.getCode())
|
||||
order.setStatus(AllocOrderStatusEnum.ALLOCATION_PROCESSING.getCode())
|
||||
.setErrorMsg(null);
|
||||
} catch (Exception e) {
|
||||
log.error("分账出现错误:", e);
|
||||
// 失败
|
||||
order.setStatus(AllocationOrderStatusEnum.ALLOCATION_FAILED.getCode())
|
||||
order.setStatus(AllocOrderStatusEnum.ALLOCATION_FAILED.getCode())
|
||||
.setErrorMsg(e.getMessage());
|
||||
}
|
||||
// 网关分账号
|
||||
@@ -123,9 +122,9 @@ public class AllocationService {
|
||||
.orElseThrow(() -> new DataNotExistException("未查询到分账单信息"));
|
||||
}
|
||||
// 需要是分账中分账中或者完成状态才能重新分账
|
||||
List<String> list = Arrays.asList(AllocationOrderStatusEnum.ALLOCATION_END.getCode(),
|
||||
AllocationOrderStatusEnum.ALLOCATION_FAILED.getCode(),
|
||||
AllocationOrderStatusEnum.ALLOCATION_PROCESSING.getCode());
|
||||
List<String> list = Arrays.asList(AllocOrderStatusEnum.ALLOCATION_END.getCode(),
|
||||
AllocOrderStatusEnum.ALLOCATION_FAILED.getCode(),
|
||||
AllocOrderStatusEnum.ALLOCATION_PROCESSING.getCode());
|
||||
if (!list.contains(allocationOrder.getStatus())){
|
||||
throw new PayFailureException("分账单状态错误");
|
||||
}
|
||||
@@ -141,13 +140,13 @@ public class AllocationService {
|
||||
try {
|
||||
// 重复分账处理
|
||||
allocationStrategy.allocation();
|
||||
allocationOrder.setStatus(AllocationOrderStatusEnum.ALLOCATION_PROCESSING.getCode())
|
||||
allocationOrder.setStatus(AllocOrderStatusEnum.ALLOCATION_PROCESSING.getCode())
|
||||
.setErrorMsg(null);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("重新分账出现错误:", e);
|
||||
// 失败
|
||||
allocationOrder.setStatus(AllocationOrderStatusEnum.ALLOCATION_FAILED.getCode())
|
||||
allocationOrder.setStatus(AllocOrderStatusEnum.ALLOCATION_FAILED.getCode())
|
||||
.setErrorMsg(e.getMessage());
|
||||
}
|
||||
allocationOrderManager.updateById(allocationOrder);
|
||||
@@ -166,7 +165,7 @@ public class AllocationService {
|
||||
.orElseThrow(() -> new DataNotExistException("未查询到分账单信息"));
|
||||
}
|
||||
// 只有分账结束后才可以完结
|
||||
if (!AllocationOrderStatusEnum.ALLOCATION_END.getCode().equals(allocationOrder.getStatus())){
|
||||
if (!AllocOrderStatusEnum.ALLOCATION_END.getCode().equals(allocationOrder.getStatus())){
|
||||
throw new PayFailureException("分账单状态错误");
|
||||
}
|
||||
|
||||
@@ -181,12 +180,12 @@ public class AllocationService {
|
||||
// 完结处理
|
||||
allocationStrategy.finish();
|
||||
// 完结状态
|
||||
allocationOrder.setStatus(AllocationOrderStatusEnum.FINISH.getCode())
|
||||
allocationOrder.setStatus(AllocOrderStatusEnum.FINISH.getCode())
|
||||
.setErrorMsg(null);
|
||||
} catch (Exception e) {
|
||||
log.error("分账完结错误:", e);
|
||||
// 失败
|
||||
allocationOrder.setStatus(AllocationOrderStatusEnum.FINISH_FAILED.getCode())
|
||||
allocationOrder.setStatus(AllocOrderStatusEnum.FINISH_FAILED.getCode())
|
||||
.setErrorMsg(e.getMessage());
|
||||
}
|
||||
allocationOrderManager.updateById(allocationOrder);
|
||||
@@ -231,35 +230,35 @@ public class AllocationService {
|
||||
// 判断明细状态. 获取成功和失败的
|
||||
long successCount = details.stream()
|
||||
.map(AllocationOrderDetail::getResult)
|
||||
.filter(AllocationDetailResultEnum.SUCCESS.getCode()::equals)
|
||||
.filter(AllocDetailResultEnum.SUCCESS.getCode()::equals)
|
||||
.count();
|
||||
long failCount = details.stream()
|
||||
.map(AllocationOrderDetail::getResult)
|
||||
.filter(AllocationDetailResultEnum.FAIL.getCode()::equals)
|
||||
.filter(AllocDetailResultEnum.FAIL.getCode()::equals)
|
||||
.count();
|
||||
|
||||
// 成功和失败都为0 进行中
|
||||
if (successCount == 0 && failCount == 0){
|
||||
allocationOrder.setStatus(AllocationOrderStatusEnum.ALLOCATION_PROCESSING.getCode())
|
||||
.setResult(AllocationOrderResultEnum.ALL_PENDING.getCode());
|
||||
allocationOrder.setStatus(AllocOrderStatusEnum.ALLOCATION_PROCESSING.getCode())
|
||||
.setResult(AllocOrderResultEnum.ALL_PENDING.getCode());
|
||||
} else if (failCount == details.size()){
|
||||
// 全部失败
|
||||
allocationOrder.setStatus(AllocationOrderStatusEnum.ALLOCATION_END.getCode())
|
||||
.setResult(AllocationOrderResultEnum.ALL_FAILED.getCode());
|
||||
allocationOrder.setStatus(AllocOrderStatusEnum.ALLOCATION_END.getCode())
|
||||
.setResult(AllocOrderResultEnum.ALL_FAILED.getCode());
|
||||
} else if (successCount == details.size()){
|
||||
// 全部成功
|
||||
allocationOrder.setStatus(AllocationOrderStatusEnum.ALLOCATION_END.getCode())
|
||||
.setResult(AllocationOrderResultEnum.ALL_SUCCESS.getCode());
|
||||
allocationOrder.setStatus(AllocOrderStatusEnum.ALLOCATION_END.getCode())
|
||||
.setResult(AllocOrderResultEnum.ALL_SUCCESS.getCode());
|
||||
} else {
|
||||
// 部分成功
|
||||
allocationOrder.setStatus(AllocationOrderStatusEnum.ALLOCATION_END.getCode())
|
||||
.setResult(AllocationOrderResultEnum.PART_SUCCESS.getCode());
|
||||
allocationOrder.setStatus(AllocOrderStatusEnum.ALLOCATION_END.getCode())
|
||||
.setResult(AllocOrderResultEnum.PART_SUCCESS.getCode());
|
||||
}
|
||||
// 如果是分账结束或失败, 状态复原
|
||||
List<String> list = Arrays.asList(AllocationOrderStatusEnum.FINISH.getCode(), AllocationOrderStatusEnum.FINISH_FAILED.getCode());
|
||||
List<String> list = Arrays.asList(AllocOrderStatusEnum.FINISH.getCode(), AllocOrderStatusEnum.FINISH_FAILED.getCode());
|
||||
if (list.contains(status)){
|
||||
allocationOrder.setStatus(AllocationOrderStatusEnum.FINISH.getCode())
|
||||
.setResult(AllocationOrderResultEnum.ALL_SUCCESS.getCode());
|
||||
allocationOrder.setStatus(AllocOrderStatusEnum.FINISH.getCode())
|
||||
.setResult(AllocOrderResultEnum.ALL_SUCCESS.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +274,7 @@ public class AllocationService {
|
||||
throw new PayFailureException("该订单不允许分账");
|
||||
}
|
||||
// 判断分账状态
|
||||
if (Objects.equals(PayOrderAllocationStatusEnum.ALLOCATION.getCode(), payOrder.getAllocationStatus())){
|
||||
if (Objects.equals(PayOrderAllocStatusEnum.ALLOCATION.getCode(), payOrder.getAllocationStatus())){
|
||||
throw new PayFailureException("该订单已分账完成");
|
||||
}
|
||||
return payOrder;
|
||||
|
@@ -2,6 +2,7 @@ package cn.bootx.platform.daxpay.service.core.payment.reconcile.domain;
|
||||
|
||||
import cn.bootx.platform.daxpay.service.code.PaymentTypeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -11,6 +12,7 @@ import java.time.LocalDateTime;
|
||||
* @since 2024/3/1
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class GeneralTradeInfo {
|
||||
/** 标题 */
|
||||
private String title;
|
||||
|
@@ -3,11 +3,17 @@ package cn.bootx.platform.daxpay.service.core.payment.reconcile.service;
|
||||
import cn.bootx.platform.common.core.exception.DataNotExistException;
|
||||
import cn.bootx.platform.common.core.function.CollectorsFunction;
|
||||
import cn.bootx.platform.common.core.util.CollUtil;
|
||||
import cn.bootx.platform.common.core.util.LocalDateTimeUtil;
|
||||
import cn.bootx.platform.daxpay.code.PayStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.ReconcileTradeEnum;
|
||||
import cn.bootx.platform.daxpay.code.RefundStatusEnum;
|
||||
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
|
||||
import cn.bootx.platform.daxpay.service.code.PaymentTypeEnum;
|
||||
import cn.bootx.platform.daxpay.service.code.ReconcileDiffTypeEnum;
|
||||
import cn.bootx.platform.daxpay.service.code.ReconcileResultEnum;
|
||||
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
|
||||
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderManager;
|
||||
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.dao.ReconcileDetailManager;
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.dao.ReconcileOrderManager;
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.entity.ReconcileDetail;
|
||||
@@ -15,6 +21,8 @@ import cn.bootx.platform.daxpay.service.core.order.reconcile.entity.ReconcileDif
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.entity.ReconcileOrder;
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.service.ReconcileDiffService;
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.service.ReconcileOrderService;
|
||||
import cn.bootx.platform.daxpay.service.core.order.refund.dao.RefundOrderManager;
|
||||
import cn.bootx.platform.daxpay.service.core.order.refund.entity.RefundOrder;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.reconcile.domain.GeneralTradeInfo;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.reconcile.domain.ReconcileDiff;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.reconcile.factory.ReconcileStrategyFactory;
|
||||
@@ -28,6 +36,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -49,8 +58,13 @@ public class ReconcileService {
|
||||
private final ReconcileDiffService reconcileDiffService;
|
||||
|
||||
private final ReconcileOrderManager reconcileOrderManager;
|
||||
|
||||
private final ReconcileDetailManager reconcileDetailManager;
|
||||
|
||||
private final PayOrderManager payOrderManager;
|
||||
|
||||
private final RefundOrderManager refundOrderManager;
|
||||
|
||||
/**
|
||||
* 创建对账订单
|
||||
*/
|
||||
@@ -73,37 +87,6 @@ public class ReconcileService {
|
||||
this.downAndSave(reconcileOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动传输对账单
|
||||
* @param id 对账单ID
|
||||
* @param file 文件
|
||||
*/
|
||||
public void upload(Long id, MultipartFile file) {
|
||||
ReconcileOrder reconcileOrder = reconcileOrderService.findById(id)
|
||||
.orElseThrow(() -> new DataNotExistException("未找到对账订单"));
|
||||
// 将对账订单写入到上下文中
|
||||
PaymentContextLocal.get().getReconcileInfo().setReconcileOrder(reconcileOrder);
|
||||
AbsReconcileStrategy reconcileStrategy = ReconcileStrategyFactory.create(reconcileOrder.getChannel());
|
||||
reconcileStrategy.setRecordOrder(reconcileOrder);
|
||||
reconcileStrategy.doBeforeHandler();
|
||||
try {
|
||||
reconcileStrategy.upload(file);
|
||||
reconcileOrder.setDownOrUpload(true)
|
||||
.setErrorMsg(null);
|
||||
reconcileOrderService.update(reconcileOrder);
|
||||
} catch (Exception e) {
|
||||
log.error("上传对账单异常", e);
|
||||
reconcileOrder.setErrorMsg("原因: " + e.getMessage());
|
||||
reconcileOrderService.update(reconcileOrder);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// 保存转换后的通用结构对账单
|
||||
List<ReconcileDetail> reconcileDetails = PaymentContextLocal.get()
|
||||
.getReconcileInfo()
|
||||
.getReconcileDetails();
|
||||
reconcileDetailManager.saveAll(reconcileDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载对账单并进行保存
|
||||
*/
|
||||
@@ -137,9 +120,40 @@ public class ReconcileService {
|
||||
reconcileDetailManager.saveAll(reconcileDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动传输对账单
|
||||
* @param id 对账单ID
|
||||
* @param file 文件
|
||||
*/
|
||||
public void upload(Long id, MultipartFile file) {
|
||||
ReconcileOrder reconcileOrder = reconcileOrderService.findById(id)
|
||||
.orElseThrow(() -> new DataNotExistException("未找到对账订单"));
|
||||
// 将对账订单写入到上下文中
|
||||
PaymentContextLocal.get().getReconcileInfo().setReconcileOrder(reconcileOrder);
|
||||
AbsReconcileStrategy reconcileStrategy = ReconcileStrategyFactory.create(reconcileOrder.getChannel());
|
||||
reconcileStrategy.setRecordOrder(reconcileOrder);
|
||||
reconcileStrategy.doBeforeHandler();
|
||||
try {
|
||||
reconcileStrategy.upload(file);
|
||||
reconcileOrder.setDownOrUpload(true)
|
||||
.setErrorMsg(null);
|
||||
reconcileOrderService.update(reconcileOrder);
|
||||
} catch (Exception e) {
|
||||
log.error("上传对账单异常", e);
|
||||
reconcileOrder.setErrorMsg("原因: " + e.getMessage());
|
||||
reconcileOrderService.update(reconcileOrder);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// 保存转换后的通用结构对账单
|
||||
List<ReconcileDetail> reconcileDetails = PaymentContextLocal.get()
|
||||
.getReconcileInfo()
|
||||
.getReconcileDetails();
|
||||
reconcileDetailManager.saveAll(reconcileDetails);
|
||||
}
|
||||
/**
|
||||
* 对账单比对
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void compare(Long reconcileOrderId){
|
||||
ReconcileOrder reconcileOrder = reconcileOrderService.findById(reconcileOrderId)
|
||||
.orElseThrow(() -> new DataNotExistException("未找到对账订单"));
|
||||
@@ -158,29 +172,83 @@ public class ReconcileService {
|
||||
if (reconcileOrder.isCompare()){
|
||||
throw new PayFailureException("对账单比对已经完成");
|
||||
}
|
||||
|
||||
// 查询对账单
|
||||
List<ReconcileDetail> reconcileDetails = reconcileDetailManager.findAllByReconcileId(reconcileOrder.getId());
|
||||
// 构建对账策略
|
||||
AbsReconcileStrategy reconcileStrategy = ReconcileStrategyFactory.create(reconcileOrder.getChannel());
|
||||
// 初始化参数
|
||||
reconcileStrategy.setRecordOrder(reconcileOrder);
|
||||
reconcileStrategy.setReconcileDetails(reconcileDetails);
|
||||
|
||||
try {
|
||||
// 执行比对任务, 获取对账差异记录并保存
|
||||
List<GeneralTradeInfo> generalTradeInfo = reconcileStrategy.getGeneralReconcileRecord();
|
||||
List<GeneralTradeInfo> generalTradeInfo = this.getGeneralTradeInfoList(reconcileOrder);
|
||||
List<ReconcileDiffRecord> diffRecords = this.generateDiffRecord(reconcileOrder, generalTradeInfo,reconcileDetails);
|
||||
// 判断是否有差异
|
||||
if (CollUtil.isNotEmpty(diffRecords)){
|
||||
reconcileOrder.setResult(ReconcileResultEnum.INCONSISTENT.getCode());
|
||||
}else {
|
||||
reconcileOrder.setResult(ReconcileResultEnum.CONSISTENT.getCode());
|
||||
}
|
||||
reconcileOrder.setCompare(true);
|
||||
reconcileOrderService.update(reconcileOrder);
|
||||
reconcileDiffService.saveAll(diffRecords);
|
||||
} catch (Exception e) {
|
||||
log.error("比对对账单异常", e);
|
||||
reconcileOrder.setErrorMsg("原因: " + e.getMessage());
|
||||
reconcileOrderService.update(reconcileOrder);
|
||||
throw new RuntimeException(e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载原始对账单文件
|
||||
*/
|
||||
public void downOriginal(Long id){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载基于原始对账单数据转换的对账单文件, 例如csv, json方式
|
||||
*/
|
||||
public void downTransfer(Long id){
|
||||
ReconcileOrder reconcileOrderOriginal = reconcileOrderService.findById(id)
|
||||
.orElseThrow(() -> new DataNotExistException("未找到对账订单"));
|
||||
// 获取
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取通用对账对象, 将支付/退款订单转换为对账对象
|
||||
*/
|
||||
private List<GeneralTradeInfo> getGeneralTradeInfoList(ReconcileOrder reconcileOrder){
|
||||
List<GeneralTradeInfo> generalTradeInfoList = new ArrayList<>();
|
||||
// 查询流水
|
||||
LocalDateTime localDateTime = LocalDateTimeUtil.date2DateTime(reconcileOrder.getDate());
|
||||
LocalDateTime start = LocalDateTimeUtil.beginOfDay(localDateTime);
|
||||
LocalDateTime end = LocalDateTimeUtil.endOfDay(localDateTime);
|
||||
|
||||
// 下载支付订单
|
||||
List<PayOrder> payOrders = payOrderManager.findReconcile(reconcileOrder.getChannel(), start, end, PayStatusEnum.SUCCESS, PayStatusEnum.PARTIAL_REFUND, PayStatusEnum.REFUNDING, PayStatusEnum.REFUNDED);
|
||||
List<RefundOrder> refundOrders = refundOrderManager.findReconcile(reconcileOrder.getChannel(), start, end, RefundStatusEnum.SUCCESS);
|
||||
for (PayOrder payOrder : payOrders) {
|
||||
generalTradeInfoList.add(new GeneralTradeInfo()
|
||||
.setTitle(payOrder.getTitle())
|
||||
.setTradeNo(payOrder.getOrderNo())
|
||||
.setOutTradeNo(payOrder.getOutOrderNo())
|
||||
.setFinishTime(payOrder.getPayTime())
|
||||
.setType(PaymentTypeEnum.PAY.getCode())
|
||||
.setAmount(payOrder.getAmount())
|
||||
);
|
||||
}
|
||||
for (RefundOrder refundOrder : refundOrders) {
|
||||
generalTradeInfoList.add(new GeneralTradeInfo()
|
||||
.setTitle(refundOrder.getTitle())
|
||||
.setTradeNo(refundOrder.getOrderNo())
|
||||
.setOutTradeNo(refundOrder.getOutOrderNo())
|
||||
.setFinishTime(refundOrder.getFinishTime())
|
||||
.setType(PaymentTypeEnum.REFUND.getCode())
|
||||
.setAmount(refundOrder.getAmount()));
|
||||
}
|
||||
return generalTradeInfoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 比对生成对账差异单
|
||||
* 1. 远程有, 本地无
|
||||
@@ -220,7 +288,7 @@ public class ReconcileService {
|
||||
.setTitle(outDetail.getTitle())
|
||||
.setOrderType(outDetail.getType())
|
||||
.setOutOrderNo(outDetail.getOutTradeNo())
|
||||
.setAmount(outDetail.getAmount())
|
||||
.setOutAmount(outDetail.getAmount())
|
||||
.setTradeTime(outDetail.getTradeTime());
|
||||
diffRecords.add(diffRecord);
|
||||
continue;
|
||||
@@ -236,7 +304,8 @@ public class ReconcileService {
|
||||
.setTitle(outDetail.getTitle())
|
||||
.setOrderType(outDetail.getType())
|
||||
.setOutOrderNo(outDetail.getOutTradeNo())
|
||||
.setAmount(outDetail.getAmount())
|
||||
.setOutAmount(outDetail.getAmount())
|
||||
.setAmount(localTrade.getAmount())
|
||||
.setDiffs(reconcileDiffs)
|
||||
.setTradeTime(outDetail.getTradeTime());
|
||||
diffRecords.add(diffRecord);
|
||||
@@ -269,7 +338,7 @@ public class ReconcileService {
|
||||
* @param outDetail 下载的对账订单
|
||||
* @param localTrade 本地交易订单
|
||||
*/
|
||||
public List<ReconcileDiff> reconcileDiff(ReconcileDetail outDetail, GeneralTradeInfo localTrade){
|
||||
private List<ReconcileDiff> reconcileDiff(ReconcileDetail outDetail, GeneralTradeInfo localTrade){
|
||||
List<ReconcileDiff> diffs = new ArrayList<>();
|
||||
|
||||
// 判断类型是否相同
|
||||
|
@@ -5,7 +5,6 @@ import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.alipay.entity.AliPayConfig;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayConfigService;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.alipay.service.AliPayReconcileService;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.reconcile.domain.GeneralTradeInfo;
|
||||
import cn.bootx.platform.daxpay.service.func.AbsReconcileStrategy;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -15,9 +14,6 @@ import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE;
|
||||
|
||||
/**
|
||||
@@ -69,18 +65,6 @@ public class AlipayReconcileStrategy extends AbsReconcileStrategy {
|
||||
@Override
|
||||
public void downAndSave() {
|
||||
String date = LocalDateTimeUtil.format(this.getRecordOrder().getDate(), DatePattern.NORM_DATE_PATTERN);
|
||||
reconcileService.downAndSave(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取通用对账对象, 将流水记录转换为对账对象
|
||||
*/
|
||||
@Override
|
||||
public List<GeneralTradeInfo> getGeneralReconcileRecord() {
|
||||
// 查询流水
|
||||
LocalDateTime localDateTime = LocalDateTimeUtil.date2DateTime(this.getRecordOrder().getDate());
|
||||
LocalDateTime start = LocalDateTimeUtil.beginOfDay(localDateTime);
|
||||
LocalDateTime end = LocalDateTimeUtil.endOfDay(localDateTime);
|
||||
return null;
|
||||
reconcileService.downAndSave(date,this.getRecordOrder());
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,9 @@
|
||||
package cn.bootx.platform.daxpay.service.core.payment.reconcile.strategy;
|
||||
|
||||
import cn.bootx.platform.common.core.util.LocalDateTimeUtil;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.union.entity.UnionPayConfig;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.union.service.UnionPayConfigService;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.union.service.UnionPayReconcileService;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.reconcile.domain.GeneralTradeInfo;
|
||||
import cn.bootx.platform.daxpay.service.func.AbsReconcileStrategy;
|
||||
import cn.bootx.platform.daxpay.service.sdk.union.api.UnionPayKit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
@@ -16,9 +14,7 @@ import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE;
|
||||
|
||||
@@ -39,6 +35,14 @@ public class UnionPayReconcileStrategy extends AbsReconcileStrategy {
|
||||
|
||||
private UnionPayKit unionPayKit;
|
||||
|
||||
/**
|
||||
* 策略标识
|
||||
*/
|
||||
@Override
|
||||
public PayChannelEnum getChannel() {
|
||||
return PayChannelEnum.UNION_PAY;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对账前处理, 主要是初始化支付SDK配置
|
||||
*/
|
||||
@@ -70,23 +74,5 @@ public class UnionPayReconcileStrategy extends AbsReconcileStrategy {
|
||||
reconcileService.downAndSave(date, this.unionPayKit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取通用对账对象, 将流水记录转换为对账对象
|
||||
*/
|
||||
@Override
|
||||
public List<GeneralTradeInfo> getGeneralReconcileRecord() {
|
||||
// 查询流水
|
||||
LocalDateTime localDateTime = LocalDateTimeUtil.date2DateTime(this.getRecordOrder().getDate());
|
||||
LocalDateTime start = LocalDateTimeUtil.beginOfDay(localDateTime);
|
||||
LocalDateTime end = LocalDateTimeUtil.endOfDay(localDateTime);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 策略标识
|
||||
*/
|
||||
@Override
|
||||
public PayChannelEnum getChannel() {
|
||||
return PayChannelEnum.UNION_PAY;
|
||||
}
|
||||
}
|
||||
|
@@ -2,13 +2,10 @@ package cn.bootx.platform.daxpay.service.core.payment.reconcile.strategy;
|
||||
|
||||
import cn.bootx.platform.common.core.util.LocalDateTimeUtil;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayStatusEnum;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.wechat.entity.WeChatPayConfig;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WeChatPayConfigService;
|
||||
import cn.bootx.platform.daxpay.service.core.channel.wechat.service.WechatPayReconcileService;
|
||||
import cn.bootx.platform.daxpay.service.core.order.pay.dao.PayOrderManager;
|
||||
import cn.bootx.platform.daxpay.service.core.order.pay.entity.PayOrder;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.reconcile.domain.GeneralTradeInfo;
|
||||
import cn.bootx.platform.daxpay.service.func.AbsReconcileStrategy;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -18,9 +15,6 @@ import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE;
|
||||
|
||||
/**
|
||||
@@ -78,23 +72,4 @@ public class WechatPayReconcileStrategy extends AbsReconcileStrategy {
|
||||
reconcileService.downAndSave(format, this.config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取通用对账对象, 将流水记录转换为对账对象
|
||||
*/
|
||||
@Override
|
||||
public List<GeneralTradeInfo> getGeneralReconcileRecord() {
|
||||
// 查询流水
|
||||
LocalDateTime localDateTime = LocalDateTimeUtil.date2DateTime(this.getRecordOrder().getDate());
|
||||
LocalDateTime start = LocalDateTimeUtil.beginOfDay(localDateTime);
|
||||
LocalDateTime end = LocalDateTimeUtil.endOfDay(localDateTime);
|
||||
|
||||
// 下载支付订单
|
||||
List<PayOrder> payOrders = payOrderManager.findReconcile(start, end, PayStatusEnum.SUCCESS, PayStatusEnum.PARTIAL_REFUND, PayStatusEnum.REFUNDING, PayStatusEnum.REFUNDED);
|
||||
|
||||
// 下载退款订单
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -129,7 +129,7 @@ public class PaySyncService {
|
||||
// 同步成功记录日志
|
||||
this.saveRecord( payOrder, syncResult, !statusSync, repairResult.getRepairNo(), null);
|
||||
return new SyncResult()
|
||||
.setGatewayStatus(syncResult.getSyncStatus().getCode())
|
||||
.setStatus(syncResult.getSyncStatus().getCode())
|
||||
.setRepair(!statusSync)
|
||||
.setRepairNo(repairResult.getRepairNo());
|
||||
} finally {
|
||||
|
@@ -119,7 +119,7 @@ public class RefundSyncService {
|
||||
// 同步成功记录日志
|
||||
this.saveRecord(refundOrder, syncResult, !statusSync, repairResult.getRepairNo(), null);
|
||||
return new SyncResult()
|
||||
.setGatewayStatus(syncResult.getSyncStatus().getCode())
|
||||
.setStatus(syncResult.getSyncStatus().getCode())
|
||||
.setRepair(!statusSync)
|
||||
.setRepairNo(repairResult.getRepairNo());
|
||||
} finally {
|
||||
@@ -184,7 +184,7 @@ public class RefundSyncService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存同步记录
|
||||
* 保存同步记录, 使用新事务进行保存
|
||||
* @param refundOrder 支付单
|
||||
* @param syncResult 同步结果
|
||||
* @param repair 是否修复
|
||||
|
@@ -30,15 +30,15 @@ import lombok.experimental.Accessors;
|
||||
public class PaySyncRecord extends MpCreateEntity implements EntityBaseFunction<PaySyncRecordDto> {
|
||||
|
||||
/** 本地交易号 */
|
||||
@DbColumn(comment = "本地订单ID")
|
||||
@DbColumn(comment = "本地交易号")
|
||||
private String tradeNo;
|
||||
|
||||
/** 商户交易号 */
|
||||
@DbColumn(comment = "商户交易号")
|
||||
private String bizTradeNo;
|
||||
|
||||
/** 三方交易号 */
|
||||
@DbColumn(comment = "三方交易号")
|
||||
/** 外部交易号 */
|
||||
@DbColumn(comment = "外部交易号")
|
||||
private String outTradeNo;
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package cn.bootx.platform.daxpay.service.dto.allocation;
|
||||
|
||||
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocationRelationTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocRelationTypeEnum;
|
||||
import cn.bootx.platform.starter.data.perm.sensitive.SensitiveInfo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -31,7 +31,7 @@ public class AllocationGroupReceiverResult {
|
||||
|
||||
/**
|
||||
* 分账接收方类型
|
||||
* @see AllocationReceiverTypeEnum
|
||||
* @see AllocReceiverTypeEnum
|
||||
*/
|
||||
@Schema(description = "分账接收方类型")
|
||||
private String receiverType;
|
||||
@@ -47,7 +47,7 @@ public class AllocationGroupReceiverResult {
|
||||
|
||||
/**
|
||||
* 分账关系类型
|
||||
* @see AllocationRelationTypeEnum
|
||||
* @see AllocRelationTypeEnum
|
||||
*/
|
||||
@Schema(description = "分账关系类型")
|
||||
private String relationType;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package cn.bootx.platform.daxpay.service.dto.allocation;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.dto.BaseDto;
|
||||
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocationRelationTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocRelationTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.starter.data.perm.sensitive.SensitiveInfo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -35,7 +35,7 @@ public class AllocationReceiverDto extends BaseDto {
|
||||
|
||||
/**
|
||||
* 分账接收方类型 个人/商户
|
||||
* @see AllocationReceiverTypeEnum
|
||||
* @see AllocReceiverTypeEnum
|
||||
*/
|
||||
@Schema(description = "分账接收方类型")
|
||||
private String receiverType;
|
||||
@@ -52,7 +52,7 @@ public class AllocationReceiverDto extends BaseDto {
|
||||
|
||||
/**
|
||||
* 分账关系类型
|
||||
* @see AllocationRelationTypeEnum
|
||||
* @see AllocRelationTypeEnum
|
||||
*/
|
||||
@Schema(description = "分账关系类型")
|
||||
private String relationType;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package cn.bootx.platform.daxpay.service.dto.channel.wechat;
|
||||
|
||||
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocReceiverTypeEnum;
|
||||
import cn.hutool.core.annotation.Alias;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
@@ -23,7 +23,7 @@ public class WeChatPayAllocationReceiver {
|
||||
|
||||
/**
|
||||
* 分账接收方类型
|
||||
* @see AllocationReceiverTypeEnum
|
||||
* @see AllocReceiverTypeEnum
|
||||
*/
|
||||
private String type;
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package cn.bootx.platform.daxpay.service.dto.channel.wechat;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.dto.BaseDto;
|
||||
import cn.bootx.platform.daxpay.service.code.AliPayRecordTypeEnum;
|
||||
import cn.bootx.platform.daxpay.service.code.PaymentTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -30,7 +30,7 @@ public class WeChatPayRecordDto extends BaseDto {
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
* @see AliPayRecordTypeEnum
|
||||
* @see PaymentTypeEnum
|
||||
*/
|
||||
@Schema(description = "业务类型")
|
||||
private String type;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package cn.bootx.platform.daxpay.service.dto.order.allocation;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.dto.BaseDto;
|
||||
import cn.bootx.platform.daxpay.code.AllocationDetailResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocDetailResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocReceiverTypeEnum;
|
||||
import cn.bootx.platform.starter.data.perm.sensitive.SensitiveInfo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -41,7 +41,7 @@ public class AllocationOrderDetailDto extends BaseDto {
|
||||
|
||||
/**
|
||||
* 分账接收方类型
|
||||
* @see AllocationReceiverTypeEnum
|
||||
* @see AllocReceiverTypeEnum
|
||||
*/
|
||||
@Schema(description = "分账接收方类型")
|
||||
private String receiverType;
|
||||
@@ -57,7 +57,7 @@ public class AllocationOrderDetailDto extends BaseDto {
|
||||
|
||||
/**
|
||||
* 分账结果
|
||||
* @see AllocationDetailResultEnum
|
||||
* @see AllocDetailResultEnum
|
||||
*/
|
||||
@Schema(description = "分账结果")
|
||||
private String result;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
package cn.bootx.platform.daxpay.service.dto.order.allocation;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.dto.BaseDto;
|
||||
import cn.bootx.platform.daxpay.code.AllocationOrderResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocationOrderStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocOrderResultEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocOrderStatusEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -81,14 +81,14 @@ public class AllocationOrderDto extends BaseDto {
|
||||
|
||||
/**
|
||||
* 状态
|
||||
* @see AllocationOrderStatusEnum
|
||||
* @see AllocOrderStatusEnum
|
||||
*/
|
||||
@Schema(description = "状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 分账处理结果
|
||||
* @see AllocationOrderResultEnum
|
||||
* @see AllocOrderResultEnum
|
||||
*/
|
||||
@Schema(description = "分账处理结果")
|
||||
private String result;
|
||||
|
@@ -2,7 +2,7 @@ package cn.bootx.platform.daxpay.service.dto.order.pay;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.dto.BaseDto;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayOrderAllocationStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayOrderAllocStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayStatusEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -76,7 +76,7 @@ public class PayOrderDto extends BaseDto {
|
||||
|
||||
/**
|
||||
* 分账状态
|
||||
* @see PayOrderAllocationStatusEnum
|
||||
* @see PayOrderAllocStatusEnum
|
||||
*/
|
||||
@Schema(description = "分账状态")
|
||||
private String allocationStatus;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package cn.bootx.platform.daxpay.service.dto.order.reconcile;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.dto.BaseDto;
|
||||
import cn.bootx.platform.daxpay.service.code.PaymentTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -21,7 +22,7 @@ public class ReconcileDetailDto extends BaseDto {
|
||||
|
||||
/** 关联对账订单ID */
|
||||
@Schema(description = "关联对账订单ID")
|
||||
private Long recordOrderId;
|
||||
private Long reconcileId;
|
||||
|
||||
/** 商品名称 */
|
||||
@Schema(description = "商品名称")
|
||||
@@ -31,19 +32,22 @@ public class ReconcileDetailDto extends BaseDto {
|
||||
@Schema(description = "交易金额")
|
||||
private Integer amount;
|
||||
|
||||
/** 交易类型 pay/refund */
|
||||
/**
|
||||
* 交易类型
|
||||
* @see PaymentTypeEnum
|
||||
*/
|
||||
@Schema(description = "交易类型")
|
||||
private String type;
|
||||
|
||||
/** 本地订单ID */
|
||||
@Schema(description = "本地订单ID")
|
||||
private String orderId;
|
||||
/** 本地交易号 */
|
||||
@Schema(description = "本地交易号")
|
||||
private String tradeNo;
|
||||
|
||||
/** 网关订单号 - 支付宝/微信的订单号 */
|
||||
@Schema(description = "网关订单号")
|
||||
private String gatewayOrderNo;
|
||||
/** 外部交易号 - 支付宝/微信的订单号 */
|
||||
@Schema(description = "外部交易号")
|
||||
private String outTradeNo;
|
||||
|
||||
/** 订单时间 */
|
||||
@Schema(description = "订单时间")
|
||||
private LocalDateTime orderTime;
|
||||
/** 交易时间 */
|
||||
@Schema(description = "交易时间")
|
||||
private LocalDateTime tradeTime;
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ import cn.bootx.platform.common.core.rest.dto.BaseDto;
|
||||
import cn.bootx.platform.daxpay.code.ReconcileTradeEnum;
|
||||
import cn.bootx.platform.daxpay.service.code.ReconcileDiffTypeEnum;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.reconcile.domain.ReconcileDiff;
|
||||
import cn.bootx.table.modify.annotation.DbColumn;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -25,25 +26,41 @@ public class ReconcileDiffRecordDto extends BaseDto {
|
||||
|
||||
/** 对账单ID */
|
||||
@Schema(description = "对账单ID")
|
||||
private Long recordId;
|
||||
private Long ReconcileId;
|
||||
|
||||
/** 对账单明细ID */
|
||||
@Schema(description = "对账单明细ID")
|
||||
private Long detailId;
|
||||
|
||||
/** 本地订单id */
|
||||
@Schema(description = "本地订单id")
|
||||
private Long orderId;
|
||||
/** 本地交易号 */
|
||||
@Schema(description = "本地交易号")
|
||||
private String tradeNo;
|
||||
|
||||
/** 外部交易号 */
|
||||
@Schema(description = "外部交易号")
|
||||
private String outOrderNo;
|
||||
|
||||
/** 交易时间 */
|
||||
@Schema(description = "交易时间")
|
||||
private LocalDateTime tradeTime;
|
||||
|
||||
/** 订单标题 */
|
||||
@Schema(description = "订单标题")
|
||||
private String title;
|
||||
|
||||
/** 交易金额 */
|
||||
@Schema(description = "交易金额")
|
||||
private Integer amount;
|
||||
|
||||
/** 外部交易金额 */
|
||||
@DbColumn(comment = "外部交易金额")
|
||||
private Integer outAmount;
|
||||
|
||||
/**
|
||||
* 对账订单类型
|
||||
* 订单类型
|
||||
* @see ReconcileTradeEnum
|
||||
*/
|
||||
@Schema(description = "对账订单类型")
|
||||
@Schema(description = "订单类型")
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
@@ -60,17 +77,4 @@ public class ReconcileDiffRecordDto extends BaseDto {
|
||||
*/
|
||||
@Schema(description = "差异内容")
|
||||
private List<ReconcileDiff> diffs;
|
||||
|
||||
|
||||
/** 网关订单号 */
|
||||
@Schema(description = "网关订单号")
|
||||
private String gatewayOrderNo;
|
||||
|
||||
/** 交易金额 */
|
||||
@Schema(description = "交易金额")
|
||||
private Integer amount;
|
||||
|
||||
/** 订单时间 */
|
||||
@Schema(description = "订单时间")
|
||||
private LocalDateTime orderTime;
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package cn.bootx.platform.daxpay.service.dto.order.reconcile;
|
||||
|
||||
import cn.bootx.platform.common.core.rest.dto.BaseDto;
|
||||
import cn.bootx.platform.daxpay.service.code.ReconcileResultEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -19,21 +20,38 @@ import java.time.LocalDate;
|
||||
@Schema(title = "对账订单")
|
||||
public class ReconcileOrderDto extends BaseDto {
|
||||
|
||||
/** 对账号 */
|
||||
@Schema(description = "对账号")
|
||||
private String reconcileNo;
|
||||
|
||||
/** 日期 */
|
||||
@Schema(description = "日期")
|
||||
private LocalDate date;
|
||||
|
||||
@Schema(description = "批次号")
|
||||
private String batchNo;
|
||||
|
||||
/** 通道 */
|
||||
@Schema(description = "通道")
|
||||
private String channel;
|
||||
|
||||
@Schema(description = "是否下载成功")
|
||||
private boolean down;
|
||||
/** 是否下载成功 */
|
||||
@Schema(description = "是否下载或上传")
|
||||
private boolean downOrUpload;
|
||||
|
||||
/** 是否比对完成 */
|
||||
@Schema(description = "是否比对完成")
|
||||
private boolean compare;
|
||||
|
||||
/**
|
||||
* 对账结果
|
||||
* @see ReconcileResultEnum
|
||||
*/
|
||||
@Schema(description = "对账结果")
|
||||
private String result;
|
||||
|
||||
/** 错误码 */
|
||||
@Schema(description = "错误码")
|
||||
private String errorCode;
|
||||
|
||||
/** 错误信息 */
|
||||
@Schema(description = "错误信息")
|
||||
private String errorMsg;
|
||||
}
|
||||
|
@@ -32,8 +32,8 @@ public class PaySyncRecordDto extends BaseDto {
|
||||
@Schema(description = "商户交易号")
|
||||
private String bizTradeNo;
|
||||
|
||||
/** 三方交易号 */
|
||||
@Schema(description = "三方交易号")
|
||||
/** 外部交易号 */
|
||||
@Schema(description = "外部交易号")
|
||||
private String outTradeNo;
|
||||
|
||||
|
||||
|
@@ -1,14 +1,10 @@
|
||||
package cn.bootx.platform.daxpay.service.func;
|
||||
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.entity.ReconcileDetail;
|
||||
import cn.bootx.platform.daxpay.service.core.order.reconcile.entity.ReconcileOrder;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.reconcile.domain.GeneralTradeInfo;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 支付对账策略
|
||||
* @author xxm
|
||||
@@ -21,9 +17,6 @@ public abstract class AbsReconcileStrategy implements PayStrategy {
|
||||
/** 对账订单 */
|
||||
private ReconcileOrder recordOrder;
|
||||
|
||||
/** 对账订单明细 */
|
||||
private List<ReconcileDetail> reconcileDetails;
|
||||
|
||||
/**
|
||||
* 对账前处理, 主要是初始化支付SDK配置
|
||||
*/
|
||||
@@ -37,12 +30,9 @@ public abstract class AbsReconcileStrategy implements PayStrategy {
|
||||
|
||||
/**
|
||||
* 下载对账单到本地进行保存
|
||||
*
|
||||
* return 保存的原始对账文件ID
|
||||
*/
|
||||
public abstract void downAndSave();
|
||||
|
||||
/**
|
||||
* 获取通用对账对象, 将流水记录转换为对账对象
|
||||
*/
|
||||
public abstract List<GeneralTradeInfo> getGeneralReconcileRecord();
|
||||
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package cn.bootx.platform.daxpay.service.param.allocation.group;
|
||||
|
||||
import cn.bootx.platform.daxpay.code.AllocationReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocationRelationTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocReceiverTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocRelationTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -32,7 +32,7 @@ public class AllocationReceiverParam {
|
||||
|
||||
/**
|
||||
* 分账接收方类型 个人/商户
|
||||
* @see AllocationReceiverTypeEnum
|
||||
* @see AllocReceiverTypeEnum
|
||||
*/
|
||||
@Schema(description = "分账接收方类型")
|
||||
private String receiverType;
|
||||
@@ -47,7 +47,7 @@ public class AllocationReceiverParam {
|
||||
|
||||
/**
|
||||
* 分账关系类型
|
||||
* @see AllocationRelationTypeEnum
|
||||
* @see AllocRelationTypeEnum
|
||||
*/
|
||||
@Schema(description = "分账关系类型")
|
||||
private String relationType;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package cn.bootx.platform.daxpay.service.param.allocation.group;
|
||||
|
||||
import cn.bootx.platform.common.core.annotation.QueryParam;
|
||||
import cn.bootx.platform.daxpay.code.AllocationRelationTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.AllocRelationTypeEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
@@ -43,7 +43,7 @@ public class AllocationReceiverQuery {
|
||||
|
||||
/**
|
||||
* 分账关系类型
|
||||
* @see AllocationRelationTypeEnum
|
||||
* @see AllocRelationTypeEnum
|
||||
*/
|
||||
@Schema(description = "分账关系类型")
|
||||
private String relationType;
|
||||
|
@@ -3,7 +3,7 @@ package cn.bootx.platform.daxpay.service.param.order;
|
||||
import cn.bootx.platform.common.core.annotation.QueryParam;
|
||||
import cn.bootx.platform.common.core.rest.param.QueryOrder;
|
||||
import cn.bootx.platform.daxpay.code.PayChannelEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayOrderAllocationStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayOrderAllocStatusEnum;
|
||||
import cn.bootx.platform.daxpay.code.PayStatusEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@@ -70,7 +70,7 @@ public class PayOrderQuery extends QueryOrder {
|
||||
|
||||
/**
|
||||
* 分账状态
|
||||
* @see PayOrderAllocationStatusEnum
|
||||
* @see PayOrderAllocStatusEnum
|
||||
*/
|
||||
@Schema(description = "分账状态")
|
||||
private String allocationStatus;
|
||||
|
@@ -3,15 +3,11 @@ package cn.bootx.platform.daxpay.service.param.reconcile;
|
||||
import cn.bootx.platform.common.core.rest.param.QueryOrder;
|
||||
import cn.bootx.platform.daxpay.code.ReconcileTradeEnum;
|
||||
import cn.bootx.platform.daxpay.service.code.ReconcileDiffTypeEnum;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.reconcile.domain.ReconcileDiff;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 对账差异查询参数
|
||||
* @author xxm
|
||||
@@ -25,15 +21,19 @@ public class ReconcileDiffQuery extends QueryOrder {
|
||||
|
||||
/** 对账单ID */
|
||||
@Schema(description = "对账单ID")
|
||||
private Long recordId;
|
||||
private Long reconcileId;
|
||||
|
||||
/** 对账单明细ID */
|
||||
@Schema(description = "对账单明细ID")
|
||||
private Long detailId;
|
||||
|
||||
/** 本地订单id */
|
||||
@Schema(description = "本地订单id")
|
||||
private Long orderId;
|
||||
/** 本地交易号 */
|
||||
@Schema(description = "本地交易号")
|
||||
private String tradeNo;
|
||||
|
||||
/** 外部交易号 */
|
||||
@Schema(description = "外部交易号")
|
||||
private String outOrderNo;
|
||||
|
||||
/** 订单标题 */
|
||||
@Schema(description = "订单标题")
|
||||
@@ -53,15 +53,4 @@ public class ReconcileDiffQuery extends QueryOrder {
|
||||
@Schema(description = "差异类型")
|
||||
private String diffType;
|
||||
|
||||
/** 差异内容 */
|
||||
@Schema(description = "差异内容")
|
||||
private List<ReconcileDiff> diffs;
|
||||
|
||||
/** 网关订单号 */
|
||||
@Schema(description = "网关订单号")
|
||||
private String gatewayOrderNo;
|
||||
|
||||
/** 订单时间 */
|
||||
@Schema(description = "订单时间")
|
||||
private LocalDateTime orderTime;
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ public class PayCloseRecordQuery extends QueryOrder {
|
||||
* 关闭的支付通道
|
||||
* @see PayChannelEnum
|
||||
*/
|
||||
@DbColumn(comment = "关闭的异步支付通道")
|
||||
@DbColumn(comment = "关闭的支付通道")
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
|
@@ -29,10 +29,6 @@ public class PayRepairRecordQuery {
|
||||
@Schema(description = "修复号")
|
||||
private String repairNo;
|
||||
|
||||
/** 支付ID/退款ID */
|
||||
@Schema(description = "本地订单ID")
|
||||
private Long tradeId;
|
||||
|
||||
/**
|
||||
* 本地交易号, 支付号/退款号
|
||||
*/
|
||||
@@ -62,7 +58,7 @@ public class PayRepairRecordQuery {
|
||||
private String repairWay;
|
||||
|
||||
/** 修复的异步通道 */
|
||||
@Schema(description = "修复的异步通道")
|
||||
@Schema(description = "修复的通道")
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
|
@@ -23,24 +23,24 @@ import lombok.experimental.Accessors;
|
||||
public class PaySyncRecordQuery {
|
||||
|
||||
/** 本地交易号 */
|
||||
@Schema(description = "本地订单ID")
|
||||
@Schema(description = "本地交易号")
|
||||
private String tradeNo;
|
||||
|
||||
/** 商户交易号 */
|
||||
@Schema(description = "商户交易号")
|
||||
private String bizTradeNo;
|
||||
|
||||
/** 三方交易号 */
|
||||
@Schema(description = "三方交易号")
|
||||
/** 外部交易号 */
|
||||
@Schema(description = "外部交易号")
|
||||
private String outTradeNo;
|
||||
|
||||
|
||||
/**
|
||||
* 三方支付返回状态
|
||||
* 同步结果
|
||||
* @see PaySyncStatusEnum
|
||||
* @see RefundSyncStatusEnum
|
||||
*/
|
||||
@Schema(description = "网关返回状态")
|
||||
@Schema(description = "同步结果")
|
||||
private String outTradeStatus;
|
||||
|
||||
|
||||
@@ -58,9 +58,9 @@ public class PaySyncRecordQuery {
|
||||
@Schema(description = "同步的异步通道")
|
||||
private String channel;
|
||||
|
||||
/** 网关返回的同步消息 */
|
||||
/** 三方支付返回的消息内容 */
|
||||
@DbMySqlFieldType(MySqlFieldTypeEnum.LONGTEXT)
|
||||
@Schema(description = "同步消息")
|
||||
@Schema(description = "消息内容")
|
||||
private String syncInfo;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user