Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
YAS\29473
2025-10-16 16:27:07 +08:00
6 changed files with 113 additions and 212 deletions

View File

@@ -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
@@ -411,7 +329,8 @@ public class PaymentTestController {
@Test
public void testCreateConfirmReverse() throws BaseAdaPayException {
List<String> list = getPaymentIdList(); // 批量支付确认撤销
for (String paymentId : list) {
list.parallelStream().forEach(paymentId -> {
// 查询支付确认id
QueryPaymentConfirmDTO dto = new QueryPaymentConfirmDTO();
dto.setPaymentId(paymentId);
@@ -419,14 +338,19 @@ public class PaymentTestController {
QueryPaymentConfirmDetailResponse response = adapayService.queryPaymentConfirmList(dto);
if (response != null) {
List<PaymentConfirmInfo> confirms = response.getPaymentConfirms();
System.out.println("支付id:" + paymentId + ", 确认信息:" + JSON.toJSONString(confirms));
// System.out.println("支付id:" + paymentId + ", 确认信息:" + JSON.toJSONString(confirms));
if (CollectionUtils.isNotEmpty(confirms)) {
for (PaymentConfirmInfo confirm : confirms) {
adapayService.createConfirmReverse(confirm.getId(), wechatAppId1);
try {
adapayService.createConfirmReverse(confirm.getId(), wechatAppId1);
} catch (BaseAdaPayException e) {
throw new RuntimeException(e);
}
}
}
}
}
});
}
/**

View File

@@ -25,6 +25,7 @@ import com.jsowell.adapay.factory.AdapayConfigFactory;
import com.jsowell.adapay.operation.PaymentReverseOperation;
import com.jsowell.adapay.response.*;
import com.jsowell.adapay.service.AdapayService;
import com.jsowell.adapay.vo.AdapayAccountBalanceVO;
import com.jsowell.adapay.vo.AdapayCorpMemberVO;
import com.jsowell.adapay.vo.DrawCashDetailVO;
import com.jsowell.adapay.vo.PaymentInfo;
@@ -121,7 +122,7 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.stream.Collectors;
@ActiveProfiles("dev")
@ActiveProfiles("pre")
@SpringBootTest(classes = JsowellApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@RunWith(SpringRunner.class)
public class SpringBootTestController {
@@ -309,6 +310,12 @@ public class SpringBootTestController {
private final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(10, JsowellThreadFactory.forName("test-thread-factory"));
@Test
public void queryAdapayAccountBalanceTest() throws BaseAdaPayException {
AdapayAccountBalanceVO adapayAccountBalanceVO = adapayService.queryAdapayAccountBalance("459");
System.out.println(adapayAccountBalanceVO);
}
@Test
public void testBatteryReport() throws InterruptedException {
String orderCode = "C25787997784";

View File

@@ -1,116 +1,65 @@
002212025091323504710812966726266179584
002212025091323551610812967854542348288
002212025091323443510812965166807146496
002212025091400460010812980620632162304
002212025091320185210812913395464314880
002212025091400251110812975382261035008
002212025091401044010812985316553957376
002212025091321044610812924946841747456
002212025091401223210812989815599304704
002212025091401293010812991566205321216
002212025091322382710812948523603357696
002212025091402331310813007603441246208
002212025091403104610813017054747455488
002212025091403470510813026193569619968
002212025091403364510813023593319256064
002212025091404221510813035044029210624
002212025091404371410813038812812689408
002212025091404242510813035588512813056
002212025091405395910813054603603902464
002212025091406230510813065451386855424
002212025091401233010812990058088808448
002212025091407071710813076574286831616
002212025091407263010813081411581816832
002212025091407361210813083852087906304
002212025091407084910813076959223275520
002212025091407412710813085173478223872
002212025091408295310813097361051901952
002212025091409055210813106416067706880
002212025091409365110813114214897831936
002212025091409272910813111855262109696
002212025091409260410813111500675629056
002212025091410255910813126576514179072
002212025091409083010813107077513621504
002212025091409302010813112574920761344
002212025091410101510813122618047504384
002212025091410192110813124908439486464
002212025091410385710813129843407204352
002212025091409192310813109818684239872
002212025091410455010813131572060274688
002212025091410404310813130285528797184
002212025091410444310813131292816068608
002212025091411062110813136738331271168
002212025091410343310813128734659739648
002212025091411305910813142936145289216
002212025091411585210813149954511876096
002212025091412172910813154639293620224
002212025091412445910813161557793845248
002212025091408225810813095620038254592
002212025091412331610813158610146066432
002212025091412292110813157626892177408
002212025091412525110813163537643749376
002212025091409393410813114895717285888
002212025091413244110813171551461335040
002212025091413181710813169938273316864
002212025091413423410813176050271830016
002212025091413222710813170987423911936
002212025091414370510813189770993639424
002212025091408351410813098707633233920
002212025091412562310813164429981937664
002212025091414283810813187644049477632
002212025091414390410813190270287757312
002212025091414544410813194211247403008
002212025091414384510813190187345399808
002212025091414001410813180495349071872
002212025091414072510813182304213950464
002212025091415322510813203695797710848
002212025091414383910813190162494160896
002212025091414511810813193346000244736
002212025091415255110813202040716967936
002212025091415124610813198748830040064
002212025091415123710813198712264122368
002212025091415473310813207501956612096
002212025091415522110813208713183526912
002212025091416120910813213693135167488
002212025091416081810813212724188041216
002212025091416244110813216848996638720
002212025091417004010813225903483965440
002212025091417153010813229638322929664
002212025091417100710813228283608870912
002212025091416503010813223346745298944
002212025091417554710813239775674687488
002212025091418050310813242105556033536
002212025091417411110813236100013109248
002212025091417544010813239495444807680
002212025091418044110813242013499428864
002212025091417453210813237196660043776
002212025091418033210813241723878522880
002212025091418160310813244875486969856
002212025091418183410813245508386480128
002212025091418213310813246258814541824
002212025091418344810813249592980025344
002212025091418512510813253775414153216
002212025091419440810813267040580022272
002212025091419032110813256776832937984
002212025091419304310813263667147456512
002212025091419405810813266245151260672
002212025091419441810813267082254647296
002212025091420431010813281899749203968
002212025091420285010813278289128751104
002212025091420150210813274815905308672
002212025091420134410813274489814921216
002212025091419284510813263169380052992
002212025091421051710813287463464112128
002212025091421285010813293388618973184
002212025091421233010813292046483623936
002212025091420425110813281820279746560
002212025091421300510813293705242796032
002212025091421330710813294468501250048
002212025091422054510813302682269704192
002212025091422082910813303367019192320
002212025091422084910813303452255789056
002212025091422432510813312159203098624
002212025091422075510813303225775972352
002212025091422201410813306326205493248
002212025091422173810813305670677721088
002212025091422075710813303232398761984
002212025100100124610819132851484995584
002212025100100401110819139750871646208
002212025100100492810819142085136195584
002212025100101230110819150529255661568
002212025100101202010819149853720911872
002212025100101275810819151777551822848
002212025100101144310819148439712116736
002212025100101330610819153067002662912
002212025100102050010819161097412608000
002212025100102374310819169327337668608
002212025100103153010819178835577352192
002212025100103033410819175836608069632
002212025100104404110819200272652820480
002212025100106202910819225388761600000
002212025100106113010819223130283913216
002212025100107421910819245984283054080
002212025100108231910819256304179310592
002212025100110021110819281181049470976
002212025100110170210819284921118875648
002212025100109410010819275851116531712
002212025100110205510819285896126496768
002212025100109585410819280354930659328
002212025100110172010819284994422427648
002212025100110334110819289111299424256
002212025100111243410819301916094455808
002212025100111301910819303362621829120
002212025100111174910819300215056728064
002212025100111332410819304137389461504
002212025100111395210819305766801072128
002212025100112313210819318766979219456
002212025100112265610819317609439682560
002212025100112260910819317413640880128
002212025100112464110819322579676897280
002212025100112464010819322578251141120
002212025100112544310819324600555925504
002212025100112583010819325555036602368
002212025100113213410819331358657294336
002212025100113013510819326330555183104
002212025100113334510819334426421731328
002212025100113352010819334825002254336
002212025100113394210819335920936144896
002212025100113405810819336242014445569
002212025100114134210819344480776290304
002212025100113521610819339086192672768
002212025100114145510819344786537156608
002212025100114093910819343458142367744
002212025100114254310819347503959453696
002212025100114272110819347915676700672
002212025100114410110819351351906385920
002212025100114433710819352008998633472
002212025100115015810819356627757502464
002212025100114590710819355908099121152
002212025100115125810819359394505121792
002212025100115220510819361690144468992
002212025100115243410819362313090580480
002212025100115294210819363604818784256
002212025100115201610819361230108872704
002212025100115274410819363110792675328
002212025100116490210819383567961284608
002212025100117145910819390102061518848
002212025100117283910819393538530430976
002212025100118150210819405210569781248
002212025100118181410819406018526957568
002212025100118222810819407082739150848
002212025100118264510819408162881343488