|
|
@@ -106,6 +106,8 @@ public class IrsManage { |
|
|
|
throw BizException.wrap("事项基本信息列表接口调用失败!"); |
|
|
|
} |
|
|
|
log.info("content: {}", responseBody); |
|
|
|
// 如果请求是请求超时 增加重试机制 |
|
|
|
responseBody = retryAndGetResponseBody(responseBody, request); |
|
|
|
} |
|
|
|
ParserConfig config = new ParserConfig(); |
|
|
|
config.propertyNamingStrategy = PropertyNamingStrategy.PascalCase; |
|
|
@@ -119,6 +121,28 @@ public class IrsManage { |
|
|
|
return responseBody; |
|
|
|
} |
|
|
|
|
|
|
|
private static String retryAndGetResponseBody(String responseBody, HttpRequest request) { |
|
|
|
if (responseBody.contains("Read timed out")){ |
|
|
|
int retries = 3; |
|
|
|
for (int i = 0; i < retries; i++) { |
|
|
|
responseBody = request.execute().body(); |
|
|
|
ParserConfig config = new ParserConfig(); |
|
|
|
config.propertyNamingStrategy = PropertyNamingStrategy.PascalCase; |
|
|
|
JSONObject contentObj = JSONObject.parseObject(responseBody, JSONObject.class, config); |
|
|
|
JSONObject data = contentObj.getJSONObject("data"); |
|
|
|
Object object = data.get("data"); |
|
|
|
if (object instanceof JSONArray){ |
|
|
|
break; |
|
|
|
} |
|
|
|
// 如果最后一次重试仍无法获取到数据,抛出异常 |
|
|
|
if (i == retries - 1){ |
|
|
|
throw BizException.wrap("事项基本信息列表接口调用失败!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return responseBody; |
|
|
|
} |
|
|
|
|
|
|
|
public Object itemBasicInfoDetail(String rowGuid) { |
|
|
|
long timestamp = System.currentTimeMillis(); |
|
|
|
String sign = MD5.create().digestHex(appKey + appSecret + timestamp); |
|
|
@@ -143,6 +167,8 @@ public class IrsManage { |
|
|
|
throw BizException.wrap("事项基本信息列表接口调用失败!"); |
|
|
|
} |
|
|
|
log.info("content: {}", responseBody); |
|
|
|
// 如果请求是请求超时 增加重试机制 |
|
|
|
responseBody = retryAndGetResponseBody(responseBody, request); |
|
|
|
} |
|
|
|
ParserConfig config = new ParserConfig(); |
|
|
|
config.propertyNamingStrategy = PropertyNamingStrategy.PascalCase; |
|
|
|