Commit 7b8c79e3 by 崔彦峰

refactor(goods): 修改费用类别目标解析逻辑

- 在resolveExpenseCategoryTarget方法中添加ApprovalPublishContext参数
- 根据基础规则中的合作伙伴商户分配目标类型决定返回的商户ID
- 支持PARTNER和PARTNER2两种目标类型配置
- 统一处理合作伙伴结算资源费和服务提供商利润分成的逻辑
- 优化费用类别目标解析的条件判断流程
1 parent e9c5d7cf
......@@ -1005,7 +1005,7 @@ public class GoodsListingApprovalService {
oldExpense.setCalculateMode(expense.getCalculateMode());
oldExpense.setExpenseCategoryCalculateType(expense.getExpenseCategoryCalculateType());
oldExpense.setExpenseCategoryValue(expense.getExpenseCategoryValue());
MerchantTarget target = resolveExpenseCategoryTarget(merchantRef, expense.getExpenseCategoryId());
MerchantTarget target = resolveExpenseCategoryTarget(merchantRef, expense.getExpenseCategoryId(), context);
oldExpense.setTargetMerchantId(target.merchantId);
oldExpense.setTargetMerchantName(target.merchantName);
fillAuditFields(oldExpense, context);
......@@ -1386,12 +1386,17 @@ public class GoodsListingApprovalService {
return new MerchantTarget(merchantRef.getMerchantId(), merchantRef.getMerchantName());
}
private MerchantTarget resolveExpenseCategoryTarget(GoodsListingMerchantRef merchantRef, Integer expenseCategoryId) {
if (Objects.equals(expenseCategoryId, FeeCategoryEnum.PARTNER_SETTLE_RESOURCE_FEE.getValue())) {
return new MerchantTarget(merchantRef.getPartnerMerchantId2(), merchantRef.getPartnerMerchantName2());
}
if (Objects.equals(expenseCategoryId, FeeCategoryEnum.SERVICE_PROVIDER_PROFIT_SHARING.getValue())) {
return new MerchantTarget(merchantRef.getPartnerMerchantId(), merchantRef.getPartnerMerchantName());
private MerchantTarget resolveExpenseCategoryTarget(GoodsListingMerchantRef merchantRef, Integer expenseCategoryId, ApprovalPublishContext context) {
GoodsListingBaseRule baseRule = context.baseRule;
if (Objects.equals(expenseCategoryId, FeeCategoryEnum.PARTNER_SETTLE_RESOURCE_FEE.getValue())
|| Objects.equals(expenseCategoryId, FeeCategoryEnum.SERVICE_PROVIDER_PROFIT_SHARING.getValue())) {
if (Objects.equals(baseRule.getPartnerMerchantDivideTarget(), MerchantDistributionRuleTargetMerchantTypeEnum.PARTNER.getValue())) {
return new MerchantTarget(merchantRef.getPartnerMerchantId(), merchantRef.getPartnerMerchantName());
}
if (Objects.equals(baseRule.getPartnerMerchantDivideTarget(), MerchantDistributionRuleTargetMerchantTypeEnum.PARTNER2.getValue())) {
return new MerchantTarget(merchantRef.getPartnerMerchantId2(), merchantRef.getPartnerMerchantName2());
}
}
return new MerchantTarget(null, null);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!