mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-13 11:49:49 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -575,19 +575,23 @@ public class SpringBootTestController {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateConfirmReverse() throws BaseAdaPayException {
|
public void testCreateConfirmReverse() throws BaseAdaPayException {
|
||||||
|
String wechatAppId = "wxbb3e0d474569481d";
|
||||||
List<String> list = Lists.newArrayList();
|
List<String> list = Lists.newArrayList();
|
||||||
list.add("0022120230803181514990533118848148987904");
|
list.add("002212023081819322010538574069880745984");
|
||||||
list.add("0022120230803181514990533118849771606016");
|
// list.add("002212023082723085610541890070281175040");
|
||||||
list.add("0022120230803181514990533118851194695680");
|
|
||||||
list.add("0022120230803181515990533118852380536832");
|
|
||||||
list.add("0022120230803181515990533118853825003520");
|
|
||||||
list.add("0022120230803181515990533118855098966016");
|
|
||||||
list.add("0022120230803181516990533118856510251008");
|
|
||||||
list.add("0022120230803181516990533118858177568768");
|
|
||||||
list.add("0022120230803181517990533118859674951680");
|
|
||||||
list.add("0022120230803181517990533118861063364608");
|
|
||||||
for (String s : list) {
|
for (String s : list) {
|
||||||
adapayService.createConfirmReverse(s);
|
// 查询支付确认id
|
||||||
|
QueryPaymentConfirmDTO dto = new QueryPaymentConfirmDTO();
|
||||||
|
dto.setPaymentId(s);
|
||||||
|
dto.setWechatAppId(wechatAppId);
|
||||||
|
QueryPaymentConfirmDetailResponse response = adapayService.queryPaymentConfirmList(dto);
|
||||||
|
if (response != null) {
|
||||||
|
List<QueryPaymentConfirmDetailResponse.PaymentConfirmInfo> confirms = response.getPaymentConfirms();
|
||||||
|
for (QueryPaymentConfirmDetailResponse.PaymentConfirmInfo confirm : confirms) {
|
||||||
|
adapayService.createConfirmReverse(confirm.getId(), wechatAppId);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import com.jsowell.adapay.common.DivMember;
|
|||||||
import com.jsowell.adapay.config.AbstractAdapayConfig;
|
import com.jsowell.adapay.config.AbstractAdapayConfig;
|
||||||
import com.jsowell.adapay.dto.*;
|
import com.jsowell.adapay.dto.*;
|
||||||
import com.jsowell.adapay.factory.AdapayConfigFactory;
|
import com.jsowell.adapay.factory.AdapayConfigFactory;
|
||||||
import com.jsowell.adapay.operation.PaymentConfirmOperation;
|
|
||||||
import com.jsowell.adapay.operation.PaymentReverseOperation;
|
import com.jsowell.adapay.operation.PaymentReverseOperation;
|
||||||
import com.jsowell.adapay.response.*;
|
import com.jsowell.adapay.response.*;
|
||||||
import com.jsowell.adapay.vo.*;
|
import com.jsowell.adapay.vo.*;
|
||||||
@@ -786,45 +785,6 @@ public class AdapayService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建交易确认请求/创建分账请求
|
|
||||||
* 这个方法只适用于给一个用户分账
|
|
||||||
*/
|
|
||||||
public PaymentConfirmResponse createPaymentConfirmRequest(PaymentConfirmOperation operation) {
|
|
||||||
// 调汇付的分账接口 确认交易
|
|
||||||
Map<String, Object> confirmParams = Maps.newHashMap();
|
|
||||||
// Adapay生成的支付对象id
|
|
||||||
confirmParams.put("payment_id", operation.getPaymentId());
|
|
||||||
// 请求订单号,只能为英文、数字或者下划线的一种或多种组合,保证在app_id下唯一
|
|
||||||
confirmParams.put("order_no", "PC" + System.currentTimeMillis());
|
|
||||||
// 确认金额,必须大于0,保留两位小数点,如0.10、100.05等。必须小于等于原支付金额-已确认金额-已撤销金额。
|
|
||||||
String amount = AdapayUtil.formatAmount(operation.getConfirmAmt());
|
|
||||||
confirmParams.put("confirm_amt", amount);
|
|
||||||
|
|
||||||
// 附加说明
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
jsonObject.put("orderCode", operation.getOrderCode());
|
|
||||||
jsonObject.put("adapayMemberId", operation.getAdapayMemberId());
|
|
||||||
confirmParams.put("description", jsonObject.toJSONString());
|
|
||||||
|
|
||||||
// 分账对象信息 一次最多7个
|
|
||||||
DivMember divMember = new DivMember();
|
|
||||||
divMember.setMember_id(operation.getAdapayMemberId());
|
|
||||||
divMember.setAmount(amount);
|
|
||||||
divMember.setFee_flag(Constants.Y);
|
|
||||||
confirmParams.put("div_members", Lists.newArrayList(divMember));
|
|
||||||
|
|
||||||
Map<String, Object> paymentConfirm = null;
|
|
||||||
try {
|
|
||||||
paymentConfirm = PaymentConfirm.create(confirmParams, operation.getMerchantKey());
|
|
||||||
} catch (BaseAdaPayException e) {
|
|
||||||
log.error("创建交易确认请求error", e);
|
|
||||||
}
|
|
||||||
String jsonString = JSON.toJSONString(paymentConfirm);
|
|
||||||
log.info("调分账接口param:{}, result:{}", JSON.toJSONString(confirmParams), jsonString);
|
|
||||||
return JSONObject.parseObject(jsonString, PaymentConfirmResponse.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建交易确认请求/创建分账请求
|
* 创建交易确认请求/创建分账请求
|
||||||
* 这个方法只适用于给一个用户分账
|
* 这个方法只适用于给一个用户分账
|
||||||
@@ -904,13 +864,13 @@ public class AdapayService {
|
|||||||
/**
|
/**
|
||||||
* 创建支付确认撤销
|
* 创建支付确认撤销
|
||||||
*/
|
*/
|
||||||
public void createConfirmReverse(String paymentConfirmId) throws BaseAdaPayException {
|
public void createConfirmReverse(String paymentConfirmId, String wechatAppId) throws BaseAdaPayException {
|
||||||
Map<String, Object> confirmReverseParams = Maps.newHashMap();
|
Map<String, Object> confirmReverseParams = Maps.newHashMap();
|
||||||
confirmReverseParams.put("adapay_func_code", "payments.confirm.reverse");
|
confirmReverseParams.put("adapay_func_code", "payments.confirm.reverse");
|
||||||
confirmReverseParams.put("payment_confirm_id", paymentConfirmId);
|
confirmReverseParams.put("payment_confirm_id", paymentConfirmId);
|
||||||
confirmReverseParams.put("reason", "支付确认撤销");
|
confirmReverseParams.put("reason", "支付确认撤销");
|
||||||
confirmReverseParams.put("order_no", IdUtils.fastSimpleUUID());
|
confirmReverseParams.put("order_no", IdUtils.fastSimpleUUID());
|
||||||
Map<String, Object> confirmReverseResult = AdapayCommon.requestAdapay(confirmReverseParams);
|
Map<String, Object> confirmReverseResult = AdapayCommon.requestAdapay(confirmReverseParams, wechatAppId);
|
||||||
log.info("创建支付确认撤销param:{}, result:{}", JSON.toJSONString(confirmReverseParams), JSON.toJSONString(confirmReverseResult));
|
log.info("创建支付确认撤销param:{}, result:{}", JSON.toJSONString(confirmReverseParams), JSON.toJSONString(confirmReverseResult));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1460,7 +1460,8 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
confirmAmt = confirmAmt.add(new BigDecimal(paymentConfirmResponse.getConfirm_amt()));
|
confirmAmt = confirmAmt.add(new BigDecimal(paymentConfirmResponse.getConfirm_amt()));
|
||||||
feeAmt = feeAmt.add(new BigDecimal(paymentConfirmResponse.getFee_amt()));
|
feeAmt = feeAmt.add(new BigDecimal(paymentConfirmResponse.getFee_amt()));
|
||||||
status = paymentConfirmResponse.getStatus();
|
status = paymentConfirmResponse.getStatus();
|
||||||
memberAdapayRecordService.updateSpendAmount(paymentId, deductionAmount);
|
// memberAdapayRecordService.updateSpendAmount(paymentId, deductionAmount);
|
||||||
|
memberAdapayRecordService.unfreezeAmountAndUpdateSpendAmount(paymentId, confirmAmt, confirmAmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user