Ver a proveniência

重庆热线-请求体类型修改

dev
Cruyse há 1 semana
ascendente
cometimento
4dfa196a05
1 ficheiros alterados com 34 adições e 6 eliminações
  1. +34
    -6
      ruoyi-modules/ruoyi-system-dataexchange/src/main/java/com/ruoyi/business/controller/InBusinessController.java

+ 34
- 6
ruoyi-modules/ruoyi-system-dataexchange/src/main/java/com/ruoyi/business/controller/InBusinessController.java Ver ficheiro

@ -135,6 +135,7 @@ public class InBusinessController {
// 获取remark信息
String urlSuffix = "";
String reqBody = "";
String reqBodyType = "JSONArray";
JSONObject remarkJson = null;
if (StringUtils.isNotEmpty(serviceBusiness.getRemark())) {
try {
@ -146,6 +147,14 @@ public class InBusinessController {
if (StringUtils.isEmpty(reqBody)) {
reqBody = "recordInfo";
}
if (reqBody.contains(":")) {
String[] parts = reqBody.split(":");
if (parts.length == 2) {
reqBody = parts[0];
reqBodyType = parts[1];
}
}
} catch (Exception e) {
logger.error("解析 remark 字段失败", e);
return AjaxResult.error("解析 remark 字段失败");
@ -157,18 +166,37 @@ public class InBusinessController {
final String finalUrlSuffix = urlSuffix;
// 新增final副本用于lambda
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;
List<List<?>> batches = new ArrayList<>();
for (int i = 0; i < rowsList.size(); i += batchSize) {
int end = Math.min(i + batchSize, rowsList.size());
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核心数配置
int coreCount = Runtime.getRuntime().availableProcessors();
ExecutorService executor = Executors.newFixedThreadPool(coreCount * 2);

Carregando…
Cancelar
Guardar