Browse Source

Pull request #15485: REPORT-140524 & REPORT-140678

Merge in DESIGN/design from ~DESTINY.LIN/design:release/11.0 to release/11.0

* commit 'bcf9662e52d23a9b44a83472234b1177dac91761':
  REPORT-140678 公式使用ds.select,对ds替换数据集后公式没有更新
  REPORT-140524 【FVS数据集替换】x3.0.0.1做的看板,图表数据和标题使用的模板和数据集数据,都被识别未使用
  REPORT-140524 【FVS数据集替换】x3.0.0.1做的看板,图表数据和标题使用的模板和数据集数据,都被识别未使用
release/11.0
Destiny.Lin-林锦龙 1 month ago
parent
commit
e205be2e01
  1. 24
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java
  2. 28
      designer-realize/src/main/java/com/fr/design/actions/replace/action/content/tabledata/TableDataFormulaUtils.java
  3. 4
      designer-realize/src/test/java/com/fr/design/actions/replace/action/content/tabledata/TableDataFormulaUtilsTest.java

24
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/formula/chart/SearchChartCollectionFormulaAction.java

@ -63,29 +63,33 @@ public class SearchChartCollectionFormulaAction {
public void searchChartCollectionFormula(List<FormulaInfo> formulaInfos, ITContent content, ChartCollection chartCollection) {
for (int i = 0; i < chartCollection.getChartCount(); i++) {
ITContent chartContent = ITContent.copy(content);
searchChartPatternFormula(formulaInfos, chartContent, chartCollection.getChart(i));
Chart chart = chartCollection.getChart(i);
if (chart == null) {
continue;
}
searchChartPatternFormula(formulaInfos, chartContent, chart);
if (isChangeConfigAttrValid(chartCollection.getChangeConfigAttr())) {
//图表切换属性
dealChangeConfig(formulaInfos, chartContent, chartCollection.getChart(i));
dealChangeConfig(formulaInfos, chartContent, chart);
}
//图表-交互属性-超级链接
dealChartHyperLink(formulaInfos, chartContent, chartCollection.getChart(i));
dealChartHyperLink(formulaInfos, chartContent, chart);
//数据-单元格数据-分类名&系列名&值
SearchChartDataFormulaManager searchChartDataFormulaManager = SearchChartDataFormulaManager.getInstance();
Map<String, SearchChartDataFormula> type = searchChartDataFormulaManager.getChartDataType();
if (isDefinitionValid(chartCollection.getChart(i).getFilterDefinition())) {
String name = chartCollection.getChart(i).getFilterDefinition().getClass().getSimpleName();
if (isDefinitionValid(chart.getFilterDefinition())) {
String name = chart.getFilterDefinition().getClass().getSimpleName();
SearchChartDataFormula searchChartDataFormula = type.get(name);
TopDefinitionProvider provider = chartCollection.getChart(i).getFilterDefinition();
TopDefinitionProvider provider = chart.getFilterDefinition();
ITContent dataContent = ITContent.copy(content);
dataContent.addOtherPos(chartCollection.getChart(i).getChartName(), Toolkit.i18nText("Fine-Design_Basic_Data"));
dataContent.addOtherPos(chart.getChartName(), Toolkit.i18nText("Fine-Design_Basic_Data"));
searchChartDataFormula.searchChartDataFormula(formulaInfos, dataContent, provider);
}
//数据-形态
if (chartCollection.getChart(i).getFilterDefinition() != null) {
if (chart.getFilterDefinition() != null) {
ITContent presentContent = ITContent.copy(content);
presentContent.addOtherPos(chartCollection.getChart(i).getChartName(), Toolkit.i18nText("Fine-Design_Basic_Data"));
searchFormulaFromChartPresent(formulaInfos, presentContent, chartCollection.getChart(i).getFilterDefinition());
presentContent.addOtherPos(chart.getChartName(), Toolkit.i18nText("Fine-Design_Basic_Data"));
searchFormulaFromChartPresent(formulaInfos, presentContent, chart.getFilterDefinition());
}
}
}

28
designer-realize/src/main/java/com/fr/design/actions/replace/action/content/tabledata/TableDataFormulaUtils.java

@ -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) {

4
designer-realize/src/test/java/com/fr/design/actions/replace/action/content/tabledata/TableDataFormulaUtilsTest.java

@ -42,6 +42,10 @@ public class TableDataFormulaUtilsTest extends TestCase {
Assert.assertTrue(qiantao2.contains("test-测试7"));
Assert.assertTrue(qiantao2.contains("test-测试8"));
String str3 = "TEST_TABLE.select(INNER.select(glbName,\"6\"),\"6\")";
Set<String> result = TableDataFormulaUtils.search4TableData(str3);
Assert.assertTrue(result.contains("TEST_TABLE"));
Assert.assertTrue(result.contains("INNER"));
}
public void testReplace() {

Loading…
Cancel
Save