mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
撤销的分账算未分帐
This commit is contained in:
@@ -8,7 +8,6 @@ import com.huifu.adapay.model.Payment;
|
||||
import com.huifu.adapay.model.PaymentReverse;
|
||||
import com.huifu.adapay.model.Refund;
|
||||
import com.jsowell.JsowellApplication;
|
||||
import com.jsowell.adapay.common.DivMember;
|
||||
import com.jsowell.adapay.common.PaymentConfirmInfo;
|
||||
import com.jsowell.adapay.dto.PaymentConfirmParam;
|
||||
import com.jsowell.adapay.dto.QueryPaymentConfirmDTO;
|
||||
@@ -21,12 +20,9 @@ import com.jsowell.adapay.vo.AdapayCorpMemberVO;
|
||||
import com.jsowell.adapay.vo.OrderSplitResult;
|
||||
import com.jsowell.api.uniapp.customer.TempController;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
import com.jsowell.common.enums.ykc.ScenarioEnum;
|
||||
import com.jsowell.common.util.AdapayUtil;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.pile.domain.AdapayMemberAccount;
|
||||
import com.jsowell.pile.domain.OrderBasicInfo;
|
||||
import com.jsowell.pile.domain.OrderDetail;
|
||||
import com.jsowell.pile.domain.OrderUnsplitRecord;
|
||||
@@ -94,6 +90,10 @@ public class PaymentTestController {
|
||||
System.out.println("耗时:" + stopWatch.getLastTaskTimeMillis() + ", splitInfoMap:" + JSON.toJSONString(splitInfoMap));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付idList
|
||||
* @return
|
||||
*/
|
||||
public List<String> getPaymentIdList() {
|
||||
List<String> resultList = Lists.newArrayList();
|
||||
// List<String> paymentIdList1 = getPaymentIdList1();
|
||||
@@ -126,26 +126,6 @@ public class PaymentTestController {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分账参数
|
||||
*/
|
||||
public Map<String, Object> getPaymentConfirmParam() {
|
||||
Map<String, Object> paramMap = Maps.newHashMap();
|
||||
|
||||
// 待分账汇付会员id, 如需分给对应商户就填写正确的汇付会员id
|
||||
String adapayMemberId = "AM44542905";
|
||||
|
||||
// 待分账订单信息, 需要重新分账的订单信息(针对未分账的订单)
|
||||
String jsonArrayString = "[" +
|
||||
"{\"orderCode\":\"C27490025494\", \"settleAmount\":\"12.95\", \"paymentId\":\"002212025040121085510753131992504455168\"}" +
|
||||
"]";
|
||||
JSONArray jsonArray = JSONArray.parseArray(jsonArrayString);
|
||||
|
||||
paramMap.put("adapayMemberId", adapayMemberId);
|
||||
paramMap.put("paymentList", jsonArray);
|
||||
return paramMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现方法
|
||||
*
|
||||
@@ -272,68 +252,6 @@ public class PaymentTestController {
|
||||
return paramMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量执行分账
|
||||
* @deprecated 2025年8月16日15点48分弃用, 此分账方法不会保存分账记录, 应使用接口执行分账
|
||||
*/
|
||||
@Test
|
||||
public void batchCreatePaymentConfirm() {
|
||||
// 获取分账参数
|
||||
// Map<String, Object> confirmParam = getPaymentConfirmParam();
|
||||
Map<String, Object> confirmParam = getPaymentConfirmParamFromFile();
|
||||
// 分账到指定汇付会员账户中
|
||||
AdapayMemberAccount adapayMemberAccount = new AdapayMemberAccount();
|
||||
adapayMemberAccount.setAdapayMemberId((String) confirmParam.get("adapayMemberId"));
|
||||
// 分账订单信息
|
||||
JSONArray paymentList = (JSONArray) confirmParam.get("paymentList");
|
||||
|
||||
// 请求参数list
|
||||
List<PaymentConfirmParam> paramList = new ArrayList<>();
|
||||
for (int i = 0; i < paymentList.size(); i++) {
|
||||
JSONObject jsonObject = (JSONObject) paymentList.get(i);
|
||||
BigDecimal confirmAmt = jsonObject.getBigDecimal("settleAmount"); // 确认金额就是结算金额
|
||||
String paymentId = jsonObject.getString("paymentId"); // 支付id
|
||||
String orderCode = jsonObject.getString("orderCode"); // 订单编号
|
||||
System.out.println("paymentId:" + paymentId + ", orderCode:" + orderCode + ", settleAmount:" + confirmAmt);
|
||||
|
||||
DivMember divMember = new DivMember();
|
||||
divMember.setMemberId(adapayMemberAccount.getAdapayMemberId());
|
||||
divMember.setAmount(AdapayUtil.formatAmount(confirmAmt));
|
||||
divMember.setFeeFlag(Constants.Y);
|
||||
|
||||
PaymentConfirmParam param = PaymentConfirmParam.builder()
|
||||
.paymentId(paymentId)
|
||||
.divMemberList(Lists.newArrayList(divMember))
|
||||
.confirmAmt(confirmAmt)
|
||||
.orderCode(orderCode)
|
||||
.wechatAppId(wechatAppId1)
|
||||
.build();
|
||||
paramList.add(param);
|
||||
}
|
||||
|
||||
// 执行分账方法
|
||||
if (!paramList.isEmpty()) {
|
||||
for (PaymentConfirmParam paymentConfirmParam : paramList) {
|
||||
// 延时分账,使用确认交易API
|
||||
PaymentConfirmResponse paymentConfirmResponse = adapayService.createPaymentConfirmRequest(paymentConfirmParam);
|
||||
// status为failed, error_code为payment_over_time_doing, error_msg为数据正在处理中,请稍后再试, 则重试最多重试2次
|
||||
if (paymentConfirmResponse.isFailed()) {
|
||||
int count = 0;
|
||||
while (count < 2) {
|
||||
count++;
|
||||
System.out.println("第" + count + "次重试");
|
||||
paymentConfirmResponse = adapayService.createPaymentConfirmRequest(paymentConfirmParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 执行分账并处理重试
|
||||
// for (PaymentConfirmParam param : paramList) {
|
||||
// executeWithRetry(param, 0); // 初始重试次数为0
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行分账并处理重试逻辑
|
||||
* @deprecated
|
||||
|
||||
Reference in New Issue
Block a user