diff --git a/src/main/java/com/gaotao/modules/sys/service/impl/InterfaceLogServiceImpl.java b/src/main/java/com/gaotao/modules/sys/service/impl/InterfaceLogServiceImpl.java index a77bf96..c4c31d5 100644 --- a/src/main/java/com/gaotao/modules/sys/service/impl/InterfaceLogServiceImpl.java +++ b/src/main/java/com/gaotao/modules/sys/service/impl/InterfaceLogServiceImpl.java @@ -529,48 +529,8 @@ public class InterfaceLogServiceImpl implements InterfaceLogService { // 4. 查询api_log_values_detail明细数据(传递interfaceName作为查询条件) List> detailList = apiLogValuesDetailDao.queryDetailList(site, buNo, requestId, requestGroupId, interfaceName); - // 5. 构造JSON请求体 - Map requestBody = new LinkedHashMap<>(); - - // 5.1 处理主表数据(orderref1-20) - if (headData != null) { - for (int i = 1; i <= 20; i++) { - String key = "orderref" + i; - Object value = headData.get(key); - if (value != null && !value.toString().trim().isEmpty()) { - // 根据字段位置映射到实际的字段名 - String fieldName = getFieldName(i, true); - requestBody.put(fieldName, value); - } - } - } - - // 5.2 处理明细数据 - if (detailList != null && !detailList.isEmpty()) { - List> detailResultList = new ArrayList<>(); - - for (Map detail : detailList) { - Map detailItem = new LinkedHashMap<>(); - - for (int i = 1; i <= 20; i++) { - String key = "orderref" + i; - Object value = detail.get(key); - if (value != null && !value.toString().trim().isEmpty()) { - // 根据字段位置映射到实际的字段名 - String fieldName = getFieldName(i, false); - detailItem.put(fieldName, value); - } - } - - if (!detailItem.isEmpty()) { - detailResultList.add(detailItem); - } - } - - if (!detailResultList.isEmpty()) { - requestBody.put("DetailList", detailResultList); - } - } + // 5. 根据接口类型构造JSON请求体(使用专用的参数构建方法) + Map requestBody = buildParamsResult(interfaceName, headData, detailList); logger.info("构造的请求体: {}", JSON.toJSONString(requestBody)); diff --git a/src/main/java/com/gaotao/modules/sys/service/impl/SystemLogServiceImpl.java b/src/main/java/com/gaotao/modules/sys/service/impl/SystemLogServiceImpl.java index 200141a..1f1749f 100644 --- a/src/main/java/com/gaotao/modules/sys/service/impl/SystemLogServiceImpl.java +++ b/src/main/java/com/gaotao/modules/sys/service/impl/SystemLogServiceImpl.java @@ -507,48 +507,8 @@ public class SystemLogServiceImpl implements SystemLogService { // 4. 查询api_log_values_detail明细数据(传递interfaceName作为查询条件) List> detailList = apiLogValuesDetailDao.queryDetailList(site, buNo, requestId, requestGroupId, interfaceName); - // 5. 构造JSON请求体 - Map requestBody = new LinkedHashMap<>(); - - // 5.1 处理主表数据(orderref1-20) - if (headData != null) { - for (int i = 1; i <= 20; i++) { - String key = "orderref" + i; - Object value = headData.get(key); - if (value != null && !value.toString().trim().isEmpty()) { - // 根据字段位置映射到实际的字段名 - String fieldName = getFieldName(i, true); - requestBody.put(fieldName, value); - } - } - } - - // 5.2 处理明细数据 - if (detailList != null && !detailList.isEmpty()) { - List> detailResultList = new ArrayList<>(); - - for (Map detail : detailList) { - Map detailItem = new LinkedHashMap<>(); - - for (int i = 1; i <= 20; i++) { - String key = "orderref" + i; - Object value = detail.get(key); - if (value != null && !value.toString().trim().isEmpty()) { - // 根据字段位置映射到实际的字段名 - String fieldName = getFieldName(i, false); - detailItem.put(fieldName, value); - } - } - - if (!detailItem.isEmpty()) { - detailResultList.add(detailItem); - } - } - - if (!detailResultList.isEmpty()) { - requestBody.put("DetailList", detailResultList); - } - } + // 5. 根据接口类型构造JSON请求体(使用专用的参数构建方法) + Map requestBody = buildParamsResult(interfaceName, headData, detailList); logger.info("构造的请求体: {}", JSON.toJSONString(requestBody));