feat(channel): 通道商户 mchName 改用 @Trans 翻译机制

This commit is contained in:
DaxPay Dev
2026-07-16 20:05:23 +08:00
parent 37defaad22
commit a8d29cc95a
2 changed files with 17 additions and 2 deletions

View File

@@ -1,19 +1,28 @@
package cn.daxpay.open.payment.merchant.result.channel;
import cn.daxpay.open.payment.common.result.MchBaseResult;
import cn.daxpay.open.platform.core.enums.channel.ChannelMerchantSourceEnum;
import cn.daxpay.open.payment.common.result.MchTradeBaseResult;
import cn.daxpay.open.payment.merchant.entity.info.MerchantInfo;
import cn.daxpay.open.platform.core.annotation.Trans;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.experimental.FieldNameConstants;
/// # 通道商户信息
///
@EqualsAndHashCode(callSuper = true)
@Data
@FieldNameConstants
@Accessors(chain = true)
@Schema(title = "通道商户信息")
public class ChannelMerchantResult extends MchTradeBaseResult {
public class ChannelMerchantResult extends MchBaseResult {
/// 商户名称(由 mchNo 翻译, 走系统 @Trans 机制)
@Trans(entity = MerchantInfo.class, source = MchBaseResult.Fields.mchNo, result = MerchantInfo.Fields.mchName)
@Schema(description = "商户名称")
private String mchName;
/// 申请单ID
@Schema(description = "申请单ID")

View File

@@ -1,6 +1,7 @@
package cn.daxpay.open.payment.merchant.service.channel;
import cn.daxpay.open.platform.common.mybatisplus.util.MpUtil;
import cn.daxpay.open.platform.common.translate.service.TransService;
import cn.daxpay.open.platform.core.exception.DataNotExistException;
import cn.daxpay.open.platform.core.rest.dto.LabelValue;
import cn.daxpay.open.platform.core.rest.param.PageParam;
@@ -33,6 +34,7 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class ChannelMerchantService {
private final ChannelMerchantManager channelMerchantManager;
private final TransService transService;
private final PayChannelService payChannelService;
private final PayProductManager payProductManager;
@@ -40,6 +42,8 @@ public class ChannelMerchantService {
public PageResult<ChannelMerchantResult> page(PageParam pageParam, ChannelMerchantQuery query){
PageResult<ChannelMerchantResult> pageResult = MpUtil.toPageResult(channelMerchantManager.page(pageParam,query));
fillEnvStatus(pageResult.getRecords());
// 翻译商户名称(mchNo -> mchName, 走系统 @Trans 机制)
transService.translate(pageResult);
return pageResult;
}
@@ -50,6 +54,8 @@ public class ChannelMerchantService {
// 通道: 通道商户不存在
.orElseThrow(() -> new DataNotExistException("error.payment.channel.channelMerchantNotExist"));
fillEnvStatus(List.of(result));
// 翻译商户名称
transService.translate(result);
return result;
}