Browse Source

2025-12-18

erp接口调整
master
fengyuan_yang 4 weeks ago
parent
commit
b4fef506a7
  1. 322
      src/main/java/com/gaotao/modules/sys/service/impl/InterfaceLogServiceImpl.java
  2. 322
      src/main/java/com/gaotao/modules/sys/service/impl/SystemLogServiceImpl.java

322
src/main/java/com/gaotao/modules/sys/service/impl/InterfaceLogServiceImpl.java

@ -69,60 +69,310 @@ public class InterfaceLogServiceImpl implements InterfaceLogService {
@Override
public R getParams(String site, String buNo, String requestId, Integer requestGroupId) {
try {
// 先获取接口名称
Map<String, Object> apiLog = interfaceLogDao.getApiLog(site, buNo, requestId, requestGroupId);
String interfaceName = apiLog != null ? (String) apiLog.get("interfaceName") : null;
// 查询主表数据
Map<String, Object> head = apiLogValuesHeadDao.queryHead(site, buNo, requestId, requestGroupId);
// 查询明细数据
List<Map<String, Object>> detailList = apiLogValuesDetailDao.queryDetailList(site, buNo, requestId, requestGroupId);
// 构造返回的JSON结构
Map<String, Object> result = new LinkedHashMap<>();
// 根据接口名称构造返回的JSON结构
Map<String, Object> result = buildParamsResult(interfaceName, head, detailList);
// 处理主表数据使用getFieldName映射字段名
if (head != null) {
for (int i = 1; i <= 20; i++) {
String key = "orderref" + i;
Object value = head.get(key);
if (value != null && !value.toString().trim().isEmpty()) {
// 使用getFieldName获取实际的字段名
String fieldName = getFieldName(i, true);
result.put(fieldName, value);
}
return R.ok().put("params", result);
} catch (Exception e) {
logger.error("查询接口参数失败", e);
return R.error("查询接口参数失败: " + e.getMessage());
}
}
/**
* 根据接口名称构造返回的JSON结构
*/
private Map<String, Object> buildParamsResult(String interfaceName, Map<String, Object> head, List<Map<String, Object>> detailList) {
Map<String, Object> result = new LinkedHashMap<>();
if ("GetSaveurchaseReturn".equals(interfaceName) || "GetSaveurchaseIn".equals(interfaceName)) {
// 采购退货/采购入库
result = buildPurchaseParams(head, detailList);
} else if ("GetSaveSalesOut".equals(interfaceName) || "GetSaveSalesReturn".equals(interfaceName)) {
// 销售出库/销售退货
result = buildSalesParams(head, detailList);
} else if ("GetSaveOthersStorageOut".equals(interfaceName) || "GetSaveOthersStorage".equals(interfaceName)) {
// 其他出库/其他入库
result = buildOthersStorageParams(head, detailList);
} else if ("GetSaveroductionIssue".equals(interfaceName) || "GetSaveroductionReturn".equals(interfaceName)) {
// 生产领料/生产退料
result = buildProductionIssueParams(head, detailList);
} else if ("GetSaveroductionIn".equals(interfaceName)) {
// 生产入库
result = buildProductionInParams(head, detailList);
} else {
// 默认格式
result = buildDefaultParams(head, detailList);
}
return result;
}
/**
* 采购退货/采购入库参数格式
*/
private Map<String, Object> buildPurchaseParams(Map<String, Object> head, List<Map<String, Object>> detailList) {
Map<String, Object> result = new LinkedHashMap<>();
if (head != null) {
result.put("MESCCode", getStringValue(head, "orderref1"));
result.put("KdType", getStringValue(head, "orderref2"));
result.put("DDate", getStringValue(head, "orderref3"));
result.put("CRdCode", getStringValue(head, "orderref4"));
result.put("CSTCode", "");
result.put("CBusType", "");
result.put("CDepCode", "");
result.put("CVenCode", "");
result.put("ITaxRate", "");
result.put("CPersonCode", "");
result.put("IExchRate", "");
result.put("Cexch_name", "");
result.put("CMemo", getStringValue(head, "orderref5"));
result.put("CWhCode", getStringValue(head, "orderref6"));
}
if (detailList != null && !detailList.isEmpty()) {
List<Map<String, Object>> detailResultList = new ArrayList<>();
for (Map<String, Object> detail : detailList) {
Map<String, Object> detailResult = new LinkedHashMap<>();
detailResult.put("MESIrowNo", getStringValue(detail, "orderref1"));
detailResult.put("OutCode", getStringValue(detail, "orderref2"));
detailResult.put("OutIrowNo", getStringValue(detail, "orderref3"));
detailResult.put("CInvCode", getStringValue(detail, "orderref4"));
detailResult.put("IQuantity", getStringValue(detail, "orderref5"));
detailResult.put("INum", "");
detailResult.put("CUnitID", "");
detailResult.put("ITaxRate", "");
detailResult.put("ITaxUnitPrice", "");
detailResult.put("CBatch", getStringValue(detail, "orderref6"));
detailResult.put("CbMemo", getStringValue(detail, "orderref7"));
detailResultList.add(detailResult);
}
result.put("DetailList", detailResultList);
}
return result;
}
/**
* 销售出库/销售退货参数格式
*/
private Map<String, Object> buildSalesParams(Map<String, Object> head, List<Map<String, Object>> detailList) {
Map<String, Object> result = new LinkedHashMap<>();
if (head != null) {
result.put("MESCCode", getStringValue(head, "orderref1"));
result.put("KdType", getStringValue(head, "orderref2"));
result.put("DDate", getStringValue(head, "orderref3"));
result.put("CBusType", "");
result.put("CDepCode", "");
result.put("CSTCode", "");
result.put("CCusCode", "");
result.put("CVenCode", "");
result.put("CPersonCode", "");
result.put("IExchRate", "");
result.put("Cexch_name", "");
result.put("Cgatheringplan", "");
result.put("CCusOAddress", "");
result.put("CMemo", "");
}
if (detailList != null && !detailList.isEmpty()) {
List<Map<String, Object>> detailResultList = new ArrayList<>();
for (Map<String, Object> detail : detailList) {
Map<String, Object> detailResult = new LinkedHashMap<>();
detailResult.put("MESIrowNo", getStringValue(detail, "orderref1"));
detailResult.put("OutCode", getStringValue(detail, "orderref2"));
detailResult.put("OutIrowNo", getStringValue(detail, "orderref3"));
detailResult.put("CInvCode", getStringValue(detail, "orderref4"));
detailResult.put("IQuantity", getStringValue(detail, "orderref5"));
detailResult.put("INum", "");
detailResult.put("CUnitID", "");
detailResult.put("ITaxRate", "");
detailResult.put("ITaxUnitPrice", "");
detailResult.put("CWhCode", getStringValue(detail, "orderref8"));
detailResult.put("CBatch", getStringValue(detail, "orderref6"));
detailResultList.add(detailResult);
}
result.put("DetailList", detailResultList);
}
return result;
}
/**
* 其他出库/其他入库参数格式
*/
private Map<String, Object> buildOthersStorageParams(Map<String, Object> head, List<Map<String, Object>> detailList) {
Map<String, Object> result = new LinkedHashMap<>();
if (head != null) {
result.put("MESCCode", getStringValue(head, "orderref1"));
result.put("KdType", getStringValue(head, "orderref2"));
result.put("DDate", getStringValue(head, "orderref3"));
result.put("CRdCode", getStringValue(head, "orderref4"));
result.put("Cmemo", getStringValue(head, "orderref5"));
result.put("CWhCode", getStringValue(head, "orderref6"));
result.put("CDepCode", getStringValue(head, "orderref8"));
}
if (detailList != null && !detailList.isEmpty()) {
List<Map<String, Object>> detailResultList = new ArrayList<>();
for (Map<String, Object> detail : detailList) {
Map<String, Object> detailResult = new LinkedHashMap<>();
detailResult.put("MESIrowNo", getStringValue(detail, "orderref1"));
detailResult.put("CInvCode", getStringValue(detail, "orderref4"));
detailResult.put("IQuantity", getStringValue(detail, "orderref5"));
detailResult.put("INum", "");
detailResult.put("CUnitID", "");
detailResult.put("CbMemo", getStringValue(detail, "orderref7"));
detailResult.put("CBatch", getStringValue(detail, "orderref6"));
detailResultList.add(detailResult);
}
result.put("DetailList", detailResultList);
}
return result;
}
/**
* 生产领料/生产退料参数格式
*/
private Map<String, Object> buildProductionIssueParams(Map<String, Object> head, List<Map<String, Object>> detailList) {
Map<String, Object> result = new LinkedHashMap<>();
if (head != null) {
result.put("MESCCode", getStringValue(head, "orderref1"));
result.put("KdType", getStringValue(head, "orderref2"));
result.put("DDate", getStringValue(head, "orderref3"));
result.put("CWhCode", getStringValue(head, "orderref6"));
result.put("CMemo", getStringValue(head, "orderref5"));
result.put("CRdCode", getStringValue(head, "orderref4"));
result.put("CDepCode", getStringValue(head, "orderref8"));
}
if (detailList != null && !detailList.isEmpty()) {
List<Map<String, Object>> detailResultList = new ArrayList<>();
for (Map<String, Object> detail : detailList) {
Map<String, Object> detailResult = new LinkedHashMap<>();
detailResult.put("MESIrowNo", getStringValue(detail, "orderref1"));
detailResult.put("CInvCode", getStringValue(detail, "orderref4"));
detailResult.put("IQuantity", getStringValue(detail, "orderref5"));
detailResult.put("CUnitID", "");
detailResult.put("INum", "");
detailResult.put("CBatch", getStringValue(detail, "orderref6"));
detailResult.put("OutMocode", getStringValue(detail, "orderref8"));
detailResult.put("OutIrowNo", getStringValue(detail, "orderref3"));
detailResult.put("OutIrowNo_zj", getStringValue(detail, "orderref10"));
detailResultList.add(detailResult);
}
result.put("DetailList", detailResultList);
}
return result;
}
/**
* 生产入库参数格式
*/
private Map<String, Object> buildProductionInParams(Map<String, Object> head, List<Map<String, Object>> detailList) {
Map<String, Object> result = new LinkedHashMap<>();
if (head != null) {
result.put("MESCCode", getStringValue(head, "orderref1"));
result.put("DDate", getStringValue(head, "orderref3"));
result.put("CDepCode", getStringValue(head, "orderref8"));
result.put("CRdCode", getStringValue(head, "orderref4"));
result.put("CMemo", getStringValue(head, "orderref5"));
result.put("CWhCode", getStringValue(head, "orderref6"));
}
if (detailList != null && !detailList.isEmpty()) {
List<Map<String, Object>> detailResultList = new ArrayList<>();
for (Map<String, Object> detail : detailList) {
Map<String, Object> detailResult = new LinkedHashMap<>();
detailResult.put("MESIrowNo", getStringValue(detail, "orderref1"));
detailResult.put("CInvCode", getStringValue(detail, "orderref4"));
detailResult.put("IQuantity", getStringValue(detail, "orderref5"));
detailResult.put("CUnitID", getStringValue(detail, "orderref13"));
detailResult.put("INum", getStringValue(detail, "orderref12"));
detailResult.put("NumberOfCases", getStringValue(detail, "orderref11"));
detailResult.put("CbMemo", getStringValue(detail, "orderref7"));
detailResult.put("CBatch", getStringValue(detail, "orderref6"));
detailResult.put("OutMocode", getStringValue(detail, "orderref8"));
detailResult.put("OutIrowNo", getStringValue(detail, "orderref3"));
detailResult.put("OutIrowNo_zj", getStringValue(detail, "orderref10"));
detailResultList.add(detailResult);
}
result.put("DetailList", detailResultList);
}
return result;
}
/**
* 默认参数格式
*/
private Map<String, Object> buildDefaultParams(Map<String, Object> head, List<Map<String, Object>> detailList) {
Map<String, Object> result = new LinkedHashMap<>();
// 处理主表数据使用getFieldName映射字段名
if (head != null) {
for (int i = 1; i <= 20; i++) {
String key = "orderref" + i;
Object value = head.get(key);
if (value != null && !value.toString().trim().isEmpty()) {
String fieldName = getFieldName(i, true);
result.put(fieldName, value);
}
}
}
// 处理明细数据
if (detailList != null && !detailList.isEmpty()) {
List<Map<String, Object>> detailResultList = new ArrayList<>();
// 处理明细数据
if (detailList != null && !detailList.isEmpty()) {
List<Map<String, Object>> detailResultList = new ArrayList<>();
for (Map<String, Object> detail : detailList) {
Map<String, Object> detailResult = new LinkedHashMap<>();
for (Map<String, Object> detail : detailList) {
Map<String, Object> detailResult = 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()) {
// 使用getFieldName获取实际的字段名
String fieldName = getFieldName(i, false);
detailResult.put(fieldName, value);
}
}
if (!detailResult.isEmpty()) {
detailResultList.add(detailResult);
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);
detailResult.put(fieldName, value);
}
}
if (!detailResultList.isEmpty()) {
result.put("DetailList", detailResultList);
if (!detailResult.isEmpty()) {
detailResultList.add(detailResult);
}
}
return R.ok().put("params", result);
} catch (Exception e) {
logger.error("查询接口参数失败", e);
return R.error("查询接口参数失败: " + e.getMessage());
if (!detailResultList.isEmpty()) {
result.put("DetailList", detailResultList);
}
}
return result;
}
/**
* 获取字符串值如果为null则返回空字符串
*/
private String getStringValue(Map<String, Object> map, String key) {
Object value = map.get(key);
return value != null ? value.toString() : "";
}
@Override

322
src/main/java/com/gaotao/modules/sys/service/impl/SystemLogServiceImpl.java

@ -69,60 +69,310 @@ public class SystemLogServiceImpl implements SystemLogService {
@Override
public R getParams(String site, String buNo, String requestId, Integer requestGroupId) {
try {
// 先获取接口名称
Map<String, Object> apiLog = systemLogDao.getApiLog(site, buNo, requestId, requestGroupId);
String interfaceName = apiLog != null ? (String) apiLog.get("interfaceName") : null;
// 查询主表数据
Map<String, Object> head = apiLogValuesHeadDao.queryHead(site, buNo, requestId, requestGroupId);
// 查询明细数据
List<Map<String, Object>> detailList = apiLogValuesDetailDao.queryDetailList(site, buNo, requestId, requestGroupId);
// 构造返回的JSON结构
Map<String, Object> result = new LinkedHashMap<>();
// 根据接口名称构造返回的JSON结构
Map<String, Object> result = buildParamsResult(interfaceName, head, detailList);
// 处理主表数据使用getFieldName映射字段名
if (head != null) {
for (int i = 1; i <= 20; i++) {
String key = "orderref" + i;
Object value = head.get(key);
if (value != null && !value.toString().trim().isEmpty()) {
// 使用getFieldName获取实际的字段名
String fieldName = getFieldName(i, true);
result.put(fieldName, value);
}
return R.ok().put("params", result);
} catch (Exception e) {
logger.error("查询系统日志参数失败", e);
return R.error("查询系统日志参数失败: " + e.getMessage());
}
}
/**
* 根据接口名称构造返回的JSON结构
*/
private Map<String, Object> buildParamsResult(String interfaceName, Map<String, Object> head, List<Map<String, Object>> detailList) {
Map<String, Object> result = new LinkedHashMap<>();
if ("GetSaveurchaseReturn".equals(interfaceName) || "GetSaveurchaseIn".equals(interfaceName)) {
// 采购退货/采购入库
result = buildPurchaseParams(head, detailList);
} else if ("GetSaveSalesOut".equals(interfaceName) || "GetSaveSalesReturn".equals(interfaceName)) {
// 销售出库/销售退货
result = buildSalesParams(head, detailList);
} else if ("GetSaveOthersStorageOut".equals(interfaceName) || "GetSaveOthersStorage".equals(interfaceName)) {
// 其他出库/其他入库
result = buildOthersStorageParams(head, detailList);
} else if ("GetSaveroductionIssue".equals(interfaceName) || "GetSaveroductionReturn".equals(interfaceName)) {
// 生产领料/生产退料
result = buildProductionIssueParams(head, detailList);
} else if ("GetSaveroductionIn".equals(interfaceName)) {
// 生产入库
result = buildProductionInParams(head, detailList);
} else {
// 默认格式
result = buildDefaultParams(head, detailList);
}
return result;
}
/**
* 采购退货/采购入库参数格式
*/
private Map<String, Object> buildPurchaseParams(Map<String, Object> head, List<Map<String, Object>> detailList) {
Map<String, Object> result = new LinkedHashMap<>();
if (head != null) {
result.put("MESCCode", getStringValue(head, "orderref1"));
result.put("KdType", getStringValue(head, "orderref2"));
result.put("DDate", getStringValue(head, "orderref3"));
result.put("CRdCode", getStringValue(head, "orderref4"));
result.put("CSTCode", "");
result.put("CBusType", "");
result.put("CDepCode", "");
result.put("CVenCode", "");
result.put("ITaxRate", "");
result.put("CPersonCode", "");
result.put("IExchRate", "");
result.put("Cexch_name", "");
result.put("CMemo", getStringValue(head, "orderref5"));
result.put("CWhCode", getStringValue(head, "orderref6"));
}
if (detailList != null && !detailList.isEmpty()) {
List<Map<String, Object>> detailResultList = new ArrayList<>();
for (Map<String, Object> detail : detailList) {
Map<String, Object> detailResult = new LinkedHashMap<>();
detailResult.put("MESIrowNo", getStringValue(detail, "orderref1"));
detailResult.put("OutCode", getStringValue(detail, "orderref2"));
detailResult.put("OutIrowNo", getStringValue(detail, "orderref3"));
detailResult.put("CInvCode", getStringValue(detail, "orderref4"));
detailResult.put("IQuantity", getStringValue(detail, "orderref5"));
detailResult.put("INum", "");
detailResult.put("CUnitID", "");
detailResult.put("ITaxRate", "");
detailResult.put("ITaxUnitPrice", "");
detailResult.put("CBatch", getStringValue(detail, "orderref6"));
detailResult.put("CbMemo", getStringValue(detail, "orderref7"));
detailResultList.add(detailResult);
}
result.put("DetailList", detailResultList);
}
return result;
}
/**
* 销售出库/销售退货参数格式
*/
private Map<String, Object> buildSalesParams(Map<String, Object> head, List<Map<String, Object>> detailList) {
Map<String, Object> result = new LinkedHashMap<>();
if (head != null) {
result.put("MESCCode", getStringValue(head, "orderref1"));
result.put("KdType", getStringValue(head, "orderref2"));
result.put("DDate", getStringValue(head, "orderref3"));
result.put("CBusType", "");
result.put("CDepCode", "");
result.put("CSTCode", "");
result.put("CCusCode", "");
result.put("CVenCode", "");
result.put("CPersonCode", "");
result.put("IExchRate", "");
result.put("Cexch_name", "");
result.put("Cgatheringplan", "");
result.put("CCusOAddress", "");
result.put("CMemo", "");
}
if (detailList != null && !detailList.isEmpty()) {
List<Map<String, Object>> detailResultList = new ArrayList<>();
for (Map<String, Object> detail : detailList) {
Map<String, Object> detailResult = new LinkedHashMap<>();
detailResult.put("MESIrowNo", getStringValue(detail, "orderref1"));
detailResult.put("OutCode", getStringValue(detail, "orderref2"));
detailResult.put("OutIrowNo", getStringValue(detail, "orderref3"));
detailResult.put("CInvCode", getStringValue(detail, "orderref4"));
detailResult.put("IQuantity", getStringValue(detail, "orderref5"));
detailResult.put("INum", "");
detailResult.put("CUnitID", "");
detailResult.put("ITaxRate", "");
detailResult.put("ITaxUnitPrice", "");
detailResult.put("CWhCode", getStringValue(detail, "orderref8"));
detailResult.put("CBatch", getStringValue(detail, "orderref6"));
detailResultList.add(detailResult);
}
result.put("DetailList", detailResultList);
}
return result;
}
/**
* 其他出库/其他入库参数格式
*/
private Map<String, Object> buildOthersStorageParams(Map<String, Object> head, List<Map<String, Object>> detailList) {
Map<String, Object> result = new LinkedHashMap<>();
if (head != null) {
result.put("MESCCode", getStringValue(head, "orderref1"));
result.put("KdType", getStringValue(head, "orderref2"));
result.put("DDate", getStringValue(head, "orderref3"));
result.put("CRdCode", getStringValue(head, "orderref4"));
result.put("Cmemo", getStringValue(head, "orderref5"));
result.put("CWhCode", getStringValue(head, "orderref6"));
result.put("CDepCode", getStringValue(head, "orderref8"));
}
if (detailList != null && !detailList.isEmpty()) {
List<Map<String, Object>> detailResultList = new ArrayList<>();
for (Map<String, Object> detail : detailList) {
Map<String, Object> detailResult = new LinkedHashMap<>();
detailResult.put("MESIrowNo", getStringValue(detail, "orderref1"));
detailResult.put("CInvCode", getStringValue(detail, "orderref4"));
detailResult.put("IQuantity", getStringValue(detail, "orderref5"));
detailResult.put("INum", "");
detailResult.put("CUnitID", "");
detailResult.put("CbMemo", getStringValue(detail, "orderref7"));
detailResult.put("CBatch", getStringValue(detail, "orderref6"));
detailResultList.add(detailResult);
}
result.put("DetailList", detailResultList);
}
return result;
}
/**
* 生产领料/生产退料参数格式
*/
private Map<String, Object> buildProductionIssueParams(Map<String, Object> head, List<Map<String, Object>> detailList) {
Map<String, Object> result = new LinkedHashMap<>();
if (head != null) {
result.put("MESCCode", getStringValue(head, "orderref1"));
result.put("KdType", getStringValue(head, "orderref2"));
result.put("DDate", getStringValue(head, "orderref3"));
result.put("CWhCode", getStringValue(head, "orderref6"));
result.put("CMemo", getStringValue(head, "orderref5"));
result.put("CRdCode", getStringValue(head, "orderref4"));
result.put("CDepCode", getStringValue(head, "orderref8"));
}
if (detailList != null && !detailList.isEmpty()) {
List<Map<String, Object>> detailResultList = new ArrayList<>();
for (Map<String, Object> detail : detailList) {
Map<String, Object> detailResult = new LinkedHashMap<>();
detailResult.put("MESIrowNo", getStringValue(detail, "orderref1"));
detailResult.put("CInvCode", getStringValue(detail, "orderref4"));
detailResult.put("IQuantity", getStringValue(detail, "orderref5"));
detailResult.put("CUnitID", "");
detailResult.put("INum", "");
detailResult.put("CBatch", getStringValue(detail, "orderref6"));
detailResult.put("OutMocode", getStringValue(detail, "orderref8"));
detailResult.put("OutIrowNo", getStringValue(detail, "orderref3"));
detailResult.put("OutIrowNo_zj", getStringValue(detail, "orderref10"));
detailResultList.add(detailResult);
}
result.put("DetailList", detailResultList);
}
return result;
}
/**
* 生产入库参数格式
*/
private Map<String, Object> buildProductionInParams(Map<String, Object> head, List<Map<String, Object>> detailList) {
Map<String, Object> result = new LinkedHashMap<>();
if (head != null) {
result.put("MESCCode", getStringValue(head, "orderref1"));
result.put("DDate", getStringValue(head, "orderref3"));
result.put("CDepCode", getStringValue(head, "orderref8"));
result.put("CRdCode", getStringValue(head, "orderref4"));
result.put("CMemo", getStringValue(head, "orderref5"));
result.put("CWhCode", getStringValue(head, "orderref6"));
}
if (detailList != null && !detailList.isEmpty()) {
List<Map<String, Object>> detailResultList = new ArrayList<>();
for (Map<String, Object> detail : detailList) {
Map<String, Object> detailResult = new LinkedHashMap<>();
detailResult.put("MESIrowNo", getStringValue(detail, "orderref1"));
detailResult.put("CInvCode", getStringValue(detail, "orderref4"));
detailResult.put("IQuantity", getStringValue(detail, "orderref5"));
detailResult.put("CUnitID", getStringValue(detail, "orderref13"));
detailResult.put("INum", getStringValue(detail, "orderref12"));
detailResult.put("NumberOfCases", getStringValue(detail, "orderref11"));
detailResult.put("CbMemo", getStringValue(detail, "orderref7"));
detailResult.put("CBatch", getStringValue(detail, "orderref6"));
detailResult.put("OutMocode", getStringValue(detail, "orderref8"));
detailResult.put("OutIrowNo", getStringValue(detail, "orderref3"));
detailResult.put("OutIrowNo_zj", getStringValue(detail, "orderref10"));
detailResultList.add(detailResult);
}
result.put("DetailList", detailResultList);
}
return result;
}
/**
* 默认参数格式
*/
private Map<String, Object> buildDefaultParams(Map<String, Object> head, List<Map<String, Object>> detailList) {
Map<String, Object> result = new LinkedHashMap<>();
// 处理主表数据使用getFieldName映射字段名
if (head != null) {
for (int i = 1; i <= 20; i++) {
String key = "orderref" + i;
Object value = head.get(key);
if (value != null && !value.toString().trim().isEmpty()) {
String fieldName = getFieldName(i, true);
result.put(fieldName, value);
}
}
}
// 处理明细数据
if (detailList != null && !detailList.isEmpty()) {
List<Map<String, Object>> detailResultList = new ArrayList<>();
// 处理明细数据
if (detailList != null && !detailList.isEmpty()) {
List<Map<String, Object>> detailResultList = new ArrayList<>();
for (Map<String, Object> detail : detailList) {
Map<String, Object> detailResult = new LinkedHashMap<>();
for (Map<String, Object> detail : detailList) {
Map<String, Object> detailResult = 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()) {
// 使用getFieldName获取实际的字段名
String fieldName = getFieldName(i, false);
detailResult.put(fieldName, value);
}
}
if (!detailResult.isEmpty()) {
detailResultList.add(detailResult);
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);
detailResult.put(fieldName, value);
}
}
if (!detailResultList.isEmpty()) {
result.put("DetailList", detailResultList);
if (!detailResult.isEmpty()) {
detailResultList.add(detailResult);
}
}
return R.ok().put("params", result);
} catch (Exception e) {
logger.error("查询系统日志参数失败", e);
return R.error("查询系统日志参数失败: " + e.getMessage());
if (!detailResultList.isEmpty()) {
result.put("DetailList", detailResultList);
}
}
return result;
}
/**
* 获取字符串值如果为null则返回空字符串
*/
private String getStringValue(Map<String, Object> map, String key) {
Object value = map.get(key);
return value != null ? value.toString() : "";
}
@Override

Loading…
Cancel
Save