Commit ce418dbc by 崔彦峰

refactor(goods): 更新商品上架审批服务中的分销目标解析逻辑

- 修改resolveDistributionTarget方法签名,添加ApprovalPublishContext参数
- 使用context.baseRule.getRealityShopLevel()替换distribution.getTargetMerchantLevel()
- 调整费用类别目标解析逻辑,分离服务商利润分成和服务商
1 parent 7e962b35
...@@ -1094,7 +1094,7 @@ public class GoodsListingApprovalService { ...@@ -1094,7 +1094,7 @@ public class GoodsListingApprovalService {
oldDistribution.setTargetMerchantLevel(distribution.getTargetMerchantLevel()); oldDistribution.setTargetMerchantLevel(distribution.getTargetMerchantLevel());
oldDistribution.setExpenseCategoryId(distribution.getExpenseCategoryId()); oldDistribution.setExpenseCategoryId(distribution.getExpenseCategoryId());
oldDistribution.setExpenseCategoryName(distribution.getExpenseCategoryName()); oldDistribution.setExpenseCategoryName(distribution.getExpenseCategoryName());
MerchantTarget target = resolveDistributionTarget(merchantRef, distribution); MerchantTarget target = resolveDistributionTarget(merchantRef, distribution, context);
oldDistribution.setMerchantId(target.merchantId); oldDistribution.setMerchantId(target.merchantId);
oldDistribution.setMerchantName(target.merchantName); oldDistribution.setMerchantName(target.merchantName);
fillAuditFields(oldDistribution, context); fillAuditFields(oldDistribution, context);
...@@ -1366,7 +1366,7 @@ public class GoodsListingApprovalService { ...@@ -1366,7 +1366,7 @@ public class GoodsListingApprovalService {
return StringUtils.defaultIfBlank(code, relation.getPackageCode()); return StringUtils.defaultIfBlank(code, relation.getPackageCode());
} }
private MerchantTarget resolveDistributionTarget(GoodsListingMerchantRef merchantRef, GoodsListingDistributionRule distribution) { private MerchantTarget resolveDistributionTarget(GoodsListingMerchantRef merchantRef, GoodsListingDistributionRule distribution,ApprovalPublishContext context) {
Byte targetMerchantType = distribution.getTargetMerchantType(); Byte targetMerchantType = distribution.getTargetMerchantType();
if (Objects.equals(targetMerchantType, MerchantDistributionRuleTargetMerchantTypeEnum.PLATFORM.getValue())) { if (Objects.equals(targetMerchantType, MerchantDistributionRuleTargetMerchantTypeEnum.PLATFORM.getValue())) {
return new MerchantTarget(merchantRef.getContractingMerchantId(), merchantRef.getContractingMerchantName()); return new MerchantTarget(merchantRef.getContractingMerchantId(), merchantRef.getContractingMerchantName());
...@@ -1378,7 +1378,7 @@ public class GoodsListingApprovalService { ...@@ -1378,7 +1378,7 @@ public class GoodsListingApprovalService {
return new MerchantTarget(merchantRef.getPartnerMerchantId(), merchantRef.getPartnerMerchantName()); return new MerchantTarget(merchantRef.getPartnerMerchantId(), merchantRef.getPartnerMerchantName());
} }
if (Objects.equals(targetMerchantType, MerchantDistributionRuleTargetMerchantTypeEnum.SHOP4S.getValue())) { if (Objects.equals(targetMerchantType, MerchantDistributionRuleTargetMerchantTypeEnum.SHOP4S.getValue())) {
if (Objects.equals(distribution.getTargetMerchantLevel(), TargetMerchantLevelEnum.SUPERIOR.getValue())) { if (Objects.equals(context.baseRule.getRealityShopLevel(), TargetMerchantLevelEnum.SUPERIOR.getValue())) {
return new MerchantTarget(merchantRef.getParentMerchantId(), merchantRef.getParentMerchantName()); return new MerchantTarget(merchantRef.getParentMerchantId(), merchantRef.getParentMerchantName());
} }
return new MerchantTarget(merchantRef.getMerchantId(), merchantRef.getMerchantName()); return new MerchantTarget(merchantRef.getMerchantId(), merchantRef.getMerchantName());
...@@ -1388,8 +1388,7 @@ public class GoodsListingApprovalService { ...@@ -1388,8 +1388,7 @@ public class GoodsListingApprovalService {
private MerchantTarget resolveExpenseCategoryTarget(GoodsListingMerchantRef merchantRef, Integer expenseCategoryId, ApprovalPublishContext context) { private MerchantTarget resolveExpenseCategoryTarget(GoodsListingMerchantRef merchantRef, Integer expenseCategoryId, ApprovalPublishContext context) {
GoodsListingBaseRule baseRule = context.baseRule; GoodsListingBaseRule baseRule = context.baseRule;
if (Objects.equals(expenseCategoryId, FeeCategoryEnum.PARTNER_SETTLE_RESOURCE_FEE.getValue()) if (Objects.equals(expenseCategoryId, FeeCategoryEnum.SERVICE_PROVIDER_PROFIT_SHARING.getValue())) {
|| Objects.equals(expenseCategoryId, FeeCategoryEnum.SERVICE_PROVIDER_PROFIT_SHARING.getValue())) {
if (Objects.equals(baseRule.getPartnerMerchantDivideTarget(), MerchantDistributionRuleTargetMerchantTypeEnum.PARTNER.getValue())) { if (Objects.equals(baseRule.getPartnerMerchantDivideTarget(), MerchantDistributionRuleTargetMerchantTypeEnum.PARTNER.getValue())) {
return new MerchantTarget(merchantRef.getPartnerMerchantId(), merchantRef.getPartnerMerchantName()); return new MerchantTarget(merchantRef.getPartnerMerchantId(), merchantRef.getPartnerMerchantName());
} }
...@@ -1398,6 +1397,15 @@ public class GoodsListingApprovalService { ...@@ -1398,6 +1397,15 @@ public class GoodsListingApprovalService {
} }
} }
if (Objects.equals(expenseCategoryId, FeeCategoryEnum.PARTNER_SETTLE_RESOURCE_FEE.getValue())) {
if (Objects.equals(baseRule.getPartnerMerchant2DivideTarget(), MerchantDistributionRuleTargetMerchantTypeEnum.PARTNER.getValue())) {
return new MerchantTarget(merchantRef.getPartnerMerchantId(), merchantRef.getPartnerMerchantName());
}
if (Objects.equals(baseRule.getPartnerMerchant2DivideTarget(), MerchantDistributionRuleTargetMerchantTypeEnum.PARTNER2.getValue())) {
return new MerchantTarget(merchantRef.getPartnerMerchantId2(), merchantRef.getPartnerMerchantName2());
}
}
return new MerchantTarget(null, null); return new MerchantTarget(null, null);
} }
......
...@@ -3719,15 +3719,15 @@ public class GoodsListingSubmitService { ...@@ -3719,15 +3719,15 @@ public class GoodsListingSubmitService {
if (value.contains("平台")) { if (value.contains("平台")) {
return (byte) 1; return (byte) 1;
} }
if (value.contains("服务商2")) {
return (byte) 5;
}
if (value.contains("服务商")) { if (value.contains("服务商")) {
return (byte) 2; return (byte) 2;
} }
if (value.contains("流量") || value.contains("门店") || value.contains("4S")) { if (value.contains("流量") || value.contains("门店") || value.contains("4S")) {
return (byte) 3; return (byte) 3;
} }
if (value.contains("服务商2")) {
return (byte) 5;
}
return null; return null;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!