优化
This commit is contained in:
+2
-2
@@ -23,7 +23,7 @@ import java.util.Locale;
|
||||
public class PlatformPartnerQueryService {
|
||||
private static final long PUBLIC_TENANT_ID = 0L;
|
||||
private static final Set<String> ALLOWED_QUERY_TYPES = Set.of(
|
||||
"CUSTOMER", "CARRIER", "SHIPPER", "CONSIGNEE");
|
||||
"CARRIER", "SHIPPER", "CONSIGNEE");
|
||||
@Resource
|
||||
private PartnerRepository repository;
|
||||
|
||||
@@ -148,7 +148,7 @@ public class PlatformPartnerQueryService {
|
||||
}
|
||||
if (normalized.isEmpty()) throw new BizException(ResultCode.BAD_REQUEST, "请至少选择一个单位类型");
|
||||
if (normalized.stream().anyMatch(type -> !ALLOWED_QUERY_TYPES.contains(type))) {
|
||||
throw new BizException(ResultCode.VALIDATION_FAILED, "往来单位仅支持 CUSTOMER、CARRIER、SHIPPER、CONSIGNEE");
|
||||
throw new BizException(ResultCode.VALIDATION_FAILED, "往来单位仅支持 CARRIER、SHIPPER、CONSIGNEE");
|
||||
}
|
||||
return List.copyOf(normalized);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user