fix: prefer configured h5 pay country

This commit is contained in:
zhx 2026-06-24 12:20:22 +08:00
parent b7f70dbcb9
commit 78cf72f660

View File

@ -1,7 +1,6 @@
package com.red.circle.order.app.command.pay.web; package com.red.circle.order.app.command.pay.web;
import com.red.circle.common.business.core.amount.PayAmountArithmeticUtils; import com.red.circle.common.business.core.amount.PayAmountArithmeticUtils;
import com.red.circle.framework.mybatis.constant.PageConstant;
import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.framework.core.response.CommonErrorCode; import com.red.circle.framework.core.response.CommonErrorCode;
import com.red.circle.order.app.dto.clientobject.pay.PayCountryCO; import com.red.circle.order.app.dto.clientobject.pay.PayCountryCO;
@ -127,11 +126,24 @@ public class PayWebH5OptionsQryExe {
sysCountryCodeClient.getByCode(cmd.getCountryCode().trim().toUpperCase()) sysCountryCodeClient.getByCode(cmd.getCountryCode().trim().toUpperCase())
); );
ResponseAssert.notNull(CommonErrorCode.NOT_FOUND_RECORD_INFO, country); ResponseAssert.notNull(CommonErrorCode.NOT_FOUND_RECORD_INFO, country);
return payCountryService.query() List<PayCountry> payCountries = payCountryService.query()
.eq(PayCountry::getCountryId, country.getId()) .eq(PayCountry::getCountryId, country.getId())
.orderByDesc(PayCountry::getSort) .orderByDesc(PayCountry::getSort)
.last(PageConstant.LIMIT_ONE) .list();
.getOne(); if (CollectionUtils.isEmpty(payCountries)) {
return null;
}
// 同一个国家线上可能有多条支付国家记录优先选当前应用真正配置了商品的记录避免只按排序命中空配置
return payCountries.stream()
.filter(payCountry -> CollectionUtils.isNotEmpty(
payApplicationCommodityService.listCommodityByApplicationCountry(
cmd.getApplicationId(),
payCountry.getId(),
cmd.getType(),
null
)))
.findFirst()
.orElse(payCountries.get(0));
} }
return payCountryService.getShelfSortMax(); return payCountryService.getShelfSortMax();