|
|
@@ -121,10 +121,15 @@ public class IrsManage { |
|
|
|
return responseBody; |
|
|
|
} |
|
|
|
|
|
|
|
private static String retryAndGetResponseBody(String responseBody, HttpRequest request) { |
|
|
|
private String retryAndGetResponseBody(String responseBody, HttpRequest request) { |
|
|
|
if (responseBody.contains("Read timed out")){ |
|
|
|
int retries = 3; |
|
|
|
for (int i = 0; i < retries; i++) { |
|
|
|
// 重新设置签名和时间戳 |
|
|
|
long timestamp = System.currentTimeMillis(); |
|
|
|
String sign = MD5.create().digestHex(appKey + appSecret + timestamp); |
|
|
|
request.header("requestTime", String.valueOf(timestamp)); |
|
|
|
request.header("sign", sign); |
|
|
|
responseBody = request.execute().body(); |
|
|
|
ParserConfig config = new ParserConfig(); |
|
|
|
config.propertyNamingStrategy = PropertyNamingStrategy.PascalCase; |
|
|
@@ -138,6 +143,12 @@ public class IrsManage { |
|
|
|
if (i == retries - 1){ |
|
|
|
throw BizException.wrap("事项基本信息列表接口调用失败!"); |
|
|
|
} |
|
|
|
// 等待一段时间后再次尝试 |
|
|
|
try { |
|
|
|
Thread.sleep(2000); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return responseBody; |
|
|
|