优化
This commit is contained in:
@@ -44,7 +44,7 @@ public class OverseasStorageFeeService {
|
||||
public OverseasStorageFeeDtos.View detailByTenant(long tenantId) {
|
||||
OverseasStorageFeeRuleEntity rule = repository.page(new OverseasStorageFeeDtos.PageQuery(1, 1, tenantId, null))
|
||||
.records().stream().findFirst().orElseThrow(() -> new BizException(ResultCode.NOT_FOUND, "海外仓费用不存在"));
|
||||
return detail(rule.getId());
|
||||
return view(rule, repository.findTiers(List.of(rule.getId())));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
||||
+13
@@ -83,6 +83,19 @@ class OverseasStorageFeeServiceTest {
|
||||
.isEqualTo(new BigDecimal("0.8"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void loadsCustomerDetailFromPagedRuleWithoutSecondRuleLookup() {
|
||||
OverseasStorageFeeRuleEntity rule = rule();
|
||||
OverseasStorageFeeDtos.PageQuery query = new OverseasStorageFeeDtos.PageQuery(1, 1, 10001L, null);
|
||||
when(repository.page(query)).thenReturn(new PageResult<>(List.of(rule), 1, 1, 1, 1));
|
||||
when(repository.findTiers(List.of(10L))).thenReturn(List.of());
|
||||
|
||||
var result = service.detailByTenant(10001L);
|
||||
|
||||
assertThat(result.customerId()).isEqualTo(10001L);
|
||||
verify(repository, never()).find(10L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void detectsStaleUpdate() {
|
||||
OverseasStorageFeeRuleEntity rule = rule();
|
||||
|
||||
Reference in New Issue
Block a user