|
|
|
@ -173,12 +173,18 @@ public class TableDataFormulaUtils {
|
|
|
|
|
if (subNode instanceof FunctionCall) { |
|
|
|
|
FunctionCall functionCall = (FunctionCall) subNode; |
|
|
|
|
result.addAll(TableDataFormulaUtils.fetchArgument(functionCall, functionName, argumentIndex)); |
|
|
|
|
} else if (subNode instanceof DatasetFunctionCall) { |
|
|
|
|
DatasetFunctionCall datasetFunctionCall = (DatasetFunctionCall) subNode; |
|
|
|
|
result.addAll(TableDataFormulaUtils.fetchArgument(datasetFunctionCall, functionName)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else if (node instanceof FunctionCall) { |
|
|
|
|
FunctionCall functionCall = (FunctionCall) node; |
|
|
|
|
result.addAll(TableDataFormulaUtils.fetchArgument(functionCall, functionName, argumentIndex)); |
|
|
|
|
} else if (node instanceof DatasetFunctionCall) { |
|
|
|
|
DatasetFunctionCall datasetFunctionCall = (DatasetFunctionCall) node; |
|
|
|
|
result.addAll(TableDataFormulaUtils.fetchArgument(datasetFunctionCall, functionName)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -188,6 +194,28 @@ public class TableDataFormulaUtils {
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static List<String> fetchArgument(DatasetFunctionCall datasetFunctionCall, String functionName) { |
|
|
|
|
List<String> result = new ArrayList<>(); |
|
|
|
|
Node[] subNodes = datasetFunctionCall.getArguments(); |
|
|
|
|
String sourceName = datasetFunctionCall.getSourceName(); |
|
|
|
|
if (StringUtils.isNotEmpty(functionName)) { |
|
|
|
|
result.add(sourceName); |
|
|
|
|
} |
|
|
|
|
if (subNodes != null) { |
|
|
|
|
// 遍历子公式
|
|
|
|
|
for (Object subNode : subNodes) { |
|
|
|
|
if (subNode instanceof FunctionCall) { |
|
|
|
|
for (TableDataFormulaType tableDataFormulaType : TableDataFormulaType.values()) { |
|
|
|
|
result.addAll(TableDataFormulaUtils.fetchArgument((FunctionCall) subNode, tableDataFormulaType.name(), tableDataFormulaType.getArgumentIndex())); |
|
|
|
|
} |
|
|
|
|
} else if (subNode instanceof DatasetFunctionCall) { |
|
|
|
|
result.addAll(fetchArgument((DatasetFunctionCall) subNode, functionName)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void replaceArgument4FunctionCall(FunctionCall functionCall, List<TableReplacementEntity> entities) { |
|
|
|
|
Node[] subNodes = functionCall.getArguments(); |
|
|
|
|
if (subNodes != null) { |
|
|
|
|