|
@ -135,6 +135,7 @@ public class InBusinessController { |
|
|
// 获取remark信息 |
|
|
// 获取remark信息 |
|
|
String urlSuffix = ""; |
|
|
String urlSuffix = ""; |
|
|
String reqBody = ""; |
|
|
String reqBody = ""; |
|
|
|
|
|
String reqBodyType = "JSONArray"; |
|
|
JSONObject remarkJson = null; |
|
|
JSONObject remarkJson = null; |
|
|
if (StringUtils.isNotEmpty(serviceBusiness.getRemark())) { |
|
|
if (StringUtils.isNotEmpty(serviceBusiness.getRemark())) { |
|
|
try { |
|
|
try { |
|
@ -146,6 +147,14 @@ public class InBusinessController { |
|
|
if (StringUtils.isEmpty(reqBody)) { |
|
|
if (StringUtils.isEmpty(reqBody)) { |
|
|
reqBody = "recordInfo"; |
|
|
reqBody = "recordInfo"; |
|
|
} |
|
|
} |
|
|
|
|
|
if (reqBody.contains(":")) { |
|
|
|
|
|
String[] parts = reqBody.split(":"); |
|
|
|
|
|
if (parts.length == 2) { |
|
|
|
|
|
reqBody = parts[0]; |
|
|
|
|
|
reqBodyType = parts[1]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
logger.error("解析 remark 字段失败", e); |
|
|
logger.error("解析 remark 字段失败", e); |
|
|
return AjaxResult.error("解析 remark 字段失败"); |
|
|
return AjaxResult.error("解析 remark 字段失败"); |
|
@ -157,18 +166,37 @@ public class InBusinessController { |
|
|
final String finalUrlSuffix = urlSuffix; |
|
|
final String finalUrlSuffix = urlSuffix; |
|
|
// 新增final副本用于lambda |
|
|
// 新增final副本用于lambda |
|
|
final String finalReqBody = reqBody; |
|
|
final String finalReqBody = reqBody; |
|
|
// 分批处理逻辑 |
|
|
|
|
|
|
|
|
// 新增final副本用于lambda |
|
|
|
|
|
final String finalReqBodyType = reqBodyType; |
|
|
|
|
|
|
|
|
|
|
|
String[] tableParts = serviceBusiness.getTableName().split("_"); |
|
|
|
|
|
if (tableParts.length < 3) { |
|
|
|
|
|
return AjaxResult.error("表名格式不符合规范: " + serviceBusiness.getTableName()); |
|
|
|
|
|
} |
|
|
|
|
|
String ipcType = tableParts[1].toUpperCase(); // 提取中间部分并转为大写 |
|
|
|
|
|
|
|
|
|
|
|
if ("JSONObject".equals(reqBodyType)){ |
|
|
|
|
|
Map<String, Object> reqMap = new HashMap<>(); |
|
|
|
|
|
reqMap.put(finalReqBody, rowsList.get(0)); |
|
|
|
|
|
|
|
|
|
|
|
TransportRequest request = buildRequest(ipcType, reqMap, finalToken); |
|
|
|
|
|
logger.info("线程[{}] 请求报文:\n{}", Thread.currentThread().getId(), gson.toJson(request)); |
|
|
|
|
|
|
|
|
|
|
|
String responseJson = postRequest(request, finalUrlSuffix); |
|
|
|
|
|
TransportResponse response = parseResponse(responseJson); |
|
|
|
|
|
handleResponse(response, finalUrlSuffix); |
|
|
|
|
|
|
|
|
|
|
|
return success(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// JSONArray 分批处理逻辑 |
|
|
int batchSize = 50; |
|
|
int batchSize = 50; |
|
|
List<List<?>> batches = new ArrayList<>(); |
|
|
List<List<?>> batches = new ArrayList<>(); |
|
|
for (int i = 0; i < rowsList.size(); i += batchSize) { |
|
|
for (int i = 0; i < rowsList.size(); i += batchSize) { |
|
|
int end = Math.min(i + batchSize, rowsList.size()); |
|
|
int end = Math.min(i + batchSize, rowsList.size()); |
|
|
batches.add(rowsList.subList(i, end)); |
|
|
batches.add(rowsList.subList(i, end)); |
|
|
} |
|
|
} |
|
|
String[] tableParts = serviceBusiness.getTableName().split("_"); |
|
|
|
|
|
if (tableParts.length < 3) { |
|
|
|
|
|
return AjaxResult.error("表名格式不符合规范: " + serviceBusiness.getTableName()); |
|
|
|
|
|
} |
|
|
|
|
|
String ipcType = tableParts[1].toUpperCase(); // 提取中间部分并转为大写 |
|
|
|
|
|
|
|
|
|
|
|
// 替换为固定线程池(根据CPU核心数配置) |
|
|
// 替换为固定线程池(根据CPU核心数配置) |
|
|
int coreCount = Runtime.getRuntime().availableProcessors(); |
|
|
int coreCount = Runtime.getRuntime().availableProcessors(); |
|
|
ExecutorService executor = Executors.newFixedThreadPool(coreCount * 2); |
|
|
ExecutorService executor = Executors.newFixedThreadPool(coreCount * 2); |
|
|