优化
This commit is contained in:
@@ -6,7 +6,6 @@ import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/** Internal Warehouse contract for a customer's default overseas storage fees. */
|
||||
@FeignClient(name = "warehouse-service", contextId = "overseasStorageFeeClient",
|
||||
@@ -20,9 +19,9 @@ public interface OverseasStorageFeeClient {
|
||||
|
||||
@DeleteMapping("/defaults")
|
||||
ApiResponse<Void> compensate(@RequestHeader("X-Internal-Service-Token") String token,
|
||||
@RequestParam long tenantId,
|
||||
@RequestParam String initializationKey);
|
||||
@RequestBody CompensationRequest request);
|
||||
|
||||
record InitializationRequest(long tenantId, long operatorId, String initializationKey) { }
|
||||
record InitializationResponse(Long configId, boolean createdByThisInitialization) { }
|
||||
record CompensationRequest(long tenantId, String initializationKey) { }
|
||||
}
|
||||
|
||||
+2
-1
@@ -72,7 +72,8 @@ public class OverseasStorageFeeInitializationService {
|
||||
RuntimeException last = null;
|
||||
for (int attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
||||
try {
|
||||
ApiResponse<Void> response = client.compensate(internalToken, tenantId, key);
|
||||
ApiResponse<Void> response = client.compensate(internalToken,
|
||||
new OverseasStorageFeeClient.CompensationRequest(tenantId, key));
|
||||
if (response != null && response.successful()) return;
|
||||
last = unavailable(response);
|
||||
} catch (RuntimeException ex) { last = ex; }
|
||||
|
||||
Reference in New Issue
Block a user