修改提交

This commit is contained in:
2026-09-04 10:13:46 +08:00
parent edadca18c6
commit 4ca5a57e6a
2 changed files with 3 additions and 4 deletions
@@ -108,8 +108,7 @@ public class InboundMeasurementService {
request.items().stream().map(InboundMeasurementRequests.ItemRequest::chargeRuleId)
.filter(java.util.Objects::nonNull).distinct().forEach(ruleId -> {
var rule = fbaMasterDataService.rule(tenantId, ruleId);
long inboundCustomerId = inbound.getCustomerId() == null ? tenantId : inbound.getCustomerId();
if (!"ACTIVE".equals(rule.getStatus()) || !java.util.Objects.equals(rule.getCustomerId(), inboundCustomerId)) {
if (!"ACTIVE".equals(rule.getStatus()) || !java.util.Objects.equals(rule.getTenantId(), tenantId)) {
throw new BizException(ResultCode.VALIDATION_FAILED, "测量明细绑定的计费规则不属于当前客户或已停用");
}
});
@@ -263,12 +263,12 @@ public class MeasurementBatchService {
}
private CustomerChargeRuleEntity requireCoefficientRule(long tenantId, Long customerId, Long ruleId) {
Long effectiveCustomerId = customerId == null || customerId <= 0 ? tenantId : customerId;
Long effectiveCustomerId = tenantId;
CustomerChargeRuleEntity rule = ruleId == null
? pricingRepository.findDefaultRule(tenantId, effectiveCustomerId)
: pricingRepository.findRule(tenantId, ruleId);
if (rule == null || !"ACTIVE".equals(rule.getStatus())
|| !effectiveCustomerId.equals(rule.getCustomerId())) {
|| !java.util.Objects.equals(rule.getTenantId(), tenantId)) {
throw new BizException(ResultCode.VALIDATION_FAILED, "计费规则不属于当前客户或已停用");
}
return rule;