mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-02 10:36:57 +00:00
feat 分账更新
This commit is contained in:
@@ -7,6 +7,7 @@ import cn.bootx.platform.common.core.rest.dto.LabelValue;
|
||||
import cn.bootx.platform.common.core.rest.param.PageParam;
|
||||
import cn.bootx.platform.daxpay.param.pay.AllocationSyncParam;
|
||||
import cn.bootx.platform.daxpay.param.pay.allocation.AllocationFinishParam;
|
||||
import cn.bootx.platform.daxpay.param.pay.allocation.AllocationResetParam;
|
||||
import cn.bootx.platform.daxpay.service.core.order.allocation.service.AllocationOrderService;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.allocation.service.AllocationService;
|
||||
import cn.bootx.platform.daxpay.service.core.payment.allocation.service.AllocationSyncService;
|
||||
@@ -87,4 +88,13 @@ public class AllocationOrderController {
|
||||
allocationService.finish(param);
|
||||
return Res.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "分账重试")
|
||||
@PostMapping("/retry")
|
||||
public ResResult<Void> retryAllocation(Long id){
|
||||
AllocationResetParam param = new AllocationResetParam();
|
||||
param.setOrderId(id);
|
||||
allocationService.retryAllocation(param);
|
||||
return Res.ok();
|
||||
}
|
||||
}
|
||||
|
@@ -85,7 +85,6 @@ public class AliPayAllocationService {
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
model.setRoyaltyParameters(royaltyParameters);
|
||||
|
||||
AlipayTradeOrderSettleResponse response = AliPayApi.tradeOrderSettleToResponse(model);
|
||||
this.verifyErrorMsg(response);
|
||||
}
|
||||
@@ -104,7 +103,14 @@ public class AliPayAllocationService {
|
||||
// 验证
|
||||
this.verifyErrorMsg(response);
|
||||
List<RoyaltyDetail> royaltyDetailList = response.getRoyaltyDetailList();
|
||||
System.out.println(royaltyDetailList);
|
||||
|
||||
// 转换成通用的明细详情
|
||||
for (RoyaltyDetail royaltyDetail : royaltyDetailList) {
|
||||
System.out.println(royaltyDetail);
|
||||
System.out.println(royaltyDetail.getState());
|
||||
System.out.println(royaltyDetail.getDetailId());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -8,6 +8,7 @@ import cn.bootx.platform.daxpay.service.core.order.allocation.entity.AllocationO
|
||||
import cn.bootx.platform.daxpay.service.core.order.allocation.entity.AllocationOrderDetail;
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ijpay.core.enums.SignType;
|
||||
import com.ijpay.core.kit.WxPayKit;
|
||||
@@ -107,6 +108,7 @@ public class WeChatPayAllocationService {
|
||||
String xmlResult = WxPayApi.profitSharingQuery(params);
|
||||
Map<String, String> result = WxPayKit.xmlToMap(xmlResult);
|
||||
this.verifyErrorMsg(result);
|
||||
JSONUtil.parse(result.get("receivers"));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -61,6 +61,14 @@ public class AllocationOrderDetail extends MpBaseEntity implements EntityBaseFun
|
||||
@DbColumn(comment = "状态")
|
||||
private String status;
|
||||
|
||||
/** 错误代码 */
|
||||
@DbColumn(comment = "错误代码")
|
||||
private String errorCode;
|
||||
|
||||
/** 错误原因 */
|
||||
@DbColumn(comment = "错误原因")
|
||||
private String errorMsg;
|
||||
|
||||
/**
|
||||
* 转换
|
||||
*/
|
||||
|
@@ -7,6 +7,7 @@ import cn.bootx.platform.daxpay.param.pay.allocation.AllocationFinishParam;
|
||||
import cn.bootx.platform.daxpay.param.pay.allocation.AllocationResetParam;
|
||||
import cn.bootx.platform.daxpay.param.pay.allocation.AllocationStartParam;
|
||||
import cn.bootx.platform.daxpay.result.allocation.AllocationResult;
|
||||
import cn.bootx.platform.daxpay.service.common.local.PaymentContextLocal;
|
||||
import cn.bootx.platform.daxpay.service.core.order.allocation.dao.AllocationOrderDetailManager;
|
||||
import cn.bootx.platform.daxpay.service.core.order.allocation.dao.AllocationOrderManager;
|
||||
import cn.bootx.platform.daxpay.service.core.order.allocation.entity.AllocationOrder;
|
||||
@@ -96,6 +97,11 @@ public class AllocationService {
|
||||
order.setStatus(AllocationStatusEnum.PARTIAL_FAILED.getCode())
|
||||
.setErrorMsg(e.getMessage());
|
||||
}
|
||||
// 网关分账号
|
||||
String gatewayNo = PaymentContextLocal.get()
|
||||
.getAllocationInfo()
|
||||
.getGatewayNo();
|
||||
order.setGatewayAllocationNo(gatewayNo);
|
||||
allocationOrderManager.updateById(order);
|
||||
|
||||
return new AllocationResult().setOrderId(order.getId())
|
||||
@@ -106,7 +112,7 @@ public class AllocationService {
|
||||
/**
|
||||
* 重新分账
|
||||
*/
|
||||
public void resetAllocation(AllocationResetParam param){
|
||||
public void retryAllocation(AllocationResetParam param){
|
||||
AllocationOrder allocationOrder;
|
||||
if (Objects.nonNull(param.getOrderId())){
|
||||
allocationOrder = allocationOrderManager.findById(param.getOrderId())
|
||||
|
Reference in New Issue
Block a user