This commit is contained in:
Guoqs
2024-12-26 10:04:39 +08:00
parent d96060da9a
commit df90509fc6
9 changed files with 134 additions and 92 deletions

View File

@@ -8,11 +8,10 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.huifu.adapay.model.CorpMember;
import com.huifu.adapay.model.SettleAccount;
import com.huifu.adapay.model.*;
import com.jsowell.adapay.common.AdaPayment;
import com.jsowell.adapay.common.CreateAdaPaymentParam;
import com.jsowell.adapay.common.DivMember;
import com.jsowell.adapay.common.RefundInfo;
import com.jsowell.adapay.common.*;
import com.jsowell.adapay.config.AbstractAdapayConfig;
import com.jsowell.adapay.dto.*;
import com.jsowell.adapay.factory.AdapayConfigFactory;
@@ -51,7 +50,10 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.math.BigDecimal;
import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -1225,11 +1227,11 @@ public class AdapayService {
QueryPaymentConfirmDetailResponse response = null;
// 查缓存
String redisKey = CacheConstants.PAYMENT_CONFIRM_LIST + dto.getPaymentId();
String redisResult = redisCache.getCacheObject(redisKey);
if (StringUtils.isNotBlank(redisResult)) {
response = JSONObject.parseObject(redisResult, QueryPaymentConfirmDetailResponse.class);
return response;
}
// String redisResult = redisCache.getCacheObject(redisKey);
// if (StringUtils.isNotBlank(redisResult)) {
// response = JSONObject.parseObject(redisResult, QueryPaymentConfirmDetailResponse.class);
// return response;
// }
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(dto.getWechatAppId());
if (config == null) {
@@ -1243,7 +1245,7 @@ public class AdapayService {
Map<String, Object> map = PaymentConfirm.queryList(param, config.getWechatAppId());
response = JSON.parseObject(JSON.toJSONString(map), QueryPaymentConfirmDetailResponse.class);
// log.info("queryPaymentConfirmDetailResponse:{}", JSON.toJSONString(queryPaymentConfirmDetailResponse));
redisCache.setCacheObject(redisKey, JSON.toJSONString(response), CacheConstants.cache_expire_time_12h);
redisCache.setCacheObject(redisKey, JSON.toJSONString(response), CacheConstants.cache_expire_time_10m);
} catch (BaseAdaPayException e) {
log.error("查询支付确认对象列表error", e);
}
@@ -1253,7 +1255,7 @@ public class AdapayService {
/**
* 查询支付确认对象详情
*/
public QueryPaymentConfirmDetailResponse.PaymentConfirmInfo queryPaymentConfirmDetail(QueryPaymentConfirmDTO dto) {
public PaymentConfirmInfo queryPaymentConfirmDetail(QueryPaymentConfirmDTO dto) {
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(dto.getWechatAppId());
if (config == null) {
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_CONFIG_IS_NULL_ERROR);
@@ -1261,10 +1263,11 @@ public class AdapayService {
Map<String, Object> confirmParams = Maps.newHashMap();
confirmParams.put("payment_confirm_id", dto.getPaymentConfirmId());
QueryPaymentConfirmDetailResponse.PaymentConfirmInfo result = null;
PaymentConfirmInfo result = null;
try {
Map<String, Object> paymentConfirm = PaymentConfirm.query(confirmParams, config.getWechatAppId());
result = JSON.parseObject(JSON.toJSONString(paymentConfirm), QueryPaymentConfirmDetailResponse.PaymentConfirmInfo.class);
log.info("查询支付确认对象详情:{}", JSON.toJSONString(paymentConfirm));
result = JSON.parseObject(JSON.toJSONString(paymentConfirm), PaymentConfirmInfo.class);
} catch (BaseAdaPayException e) {
throw new RuntimeException(e);
}