diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/tabledata/TableDataFormulaUtils.java b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/tabledata/TableDataFormulaUtils.java index 955a44005e..bf02fe15e9 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/tabledata/TableDataFormulaUtils.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/action/content/tabledata/TableDataFormulaUtils.java @@ -151,8 +151,10 @@ public class TableDataFormulaUtils { if (StringUtils.equals(parent.toString(), entity.getOldName())) { // 如果是要替换的数据集 String field = entity.getTargetField(name); - // 替换成匹配后的字段 - Reflect.on(ambiguity).set(STATEMENT, field); + if (StringUtils.isNotEmpty(field)) { + // 替换成匹配后的字段 + Reflect.on(ambiguity).set(STATEMENT, field); + } break; } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java index a9ad21fd2e..1230433459 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java @@ -10,6 +10,7 @@ import com.fr.data.TableReplacementEntity; import com.fr.data.condition.CommonCondition; import com.fr.data.condition.JoinCondition; import com.fr.data.condition.ListCondition; +import com.fr.data.condition.ObjectCondition; import com.fr.data.core.Compare; import com.fr.data.impl.NameTableData; import com.fr.data.impl.TableDataDictionary; @@ -338,6 +339,7 @@ public class ReplaceUtils { private static void replaceHighlight(Highlight highlight, List entities) { if (highlight instanceof DefaultHighlight) { DefaultHighlight defaultHighlight = (DefaultHighlight) highlight; + replaceCondition(defaultHighlight.getCondition(), entities); for (int i = 0 ; i < defaultHighlight.actionCount() ; i++) { if (defaultHighlight.getHighlightAction(i) instanceof PresentHighlightAction) { PresentHighlightAction action = (PresentHighlightAction) defaultHighlight.getHighlightAction(i); @@ -497,35 +499,45 @@ public class ReplaceUtils { //公式条件不需要修改,里面不会涉及到,有问题再加 //普通条件 //1条条件 - if (condition instanceof CommonCondition) { - dealWithTableDataNameChange((CommonCondition) condition, entity); - } + replaceSingleCondition(condition, entity); //N条条件 if (condition instanceof ListCondition) { for (int k = 0; k < ((ListCondition) condition).getJoinConditionCount(); k++) { JoinCondition joinCondition = ((ListCondition) condition).getJoinCondition(k); Condition obCondition = joinCondition.getCondition(); if (obCondition != null) { - if (obCondition instanceof CommonCondition) { - dealWithTableDataNameChange((CommonCondition) obCondition, entity); - } + replaceSingleCondition(obCondition, entity); } } } } } + private static void replaceSingleCondition(Condition condition, List entity) { + if (condition instanceof CommonCondition) { + dealWithTableDataNameChange((CommonCondition) condition, entity); + } + if (condition instanceof ObjectCondition) { + dealWithCompare(((ObjectCondition) condition).getCompare(), entity); + } + } + private static void dealWithTableDataNameChange(CommonCondition condition, List entities) { Compare compare = condition.getCompare(); - Object ob = compare.getValue(); - if (ob instanceof SimpleDSColumn) { - for (TableReplacementEntity entity : entities) { - if (ComparatorUtils.equals(((SimpleDSColumn) ob).getDsName(), entity.getOldName())) { - ((SimpleDSColumn) ob).setDsName(entity.getNewName()); - ((SimpleDSColumn) ob).setColumn(TableDataColumn.createColumn(entity.getTargetField(TableDataColumn.getColumnName(((SimpleDSColumn) ob).getColumn())))); + dealWithCompare(compare, entities); + } + + private static void dealWithCompare(Compare compare, List entities) { + if (compare != null) { + Object ob = compare.getValue(); + if (ob instanceof SimpleDSColumn) { + for (TableReplacementEntity entity : entities) { + if (ComparatorUtils.equals(((SimpleDSColumn) ob).getDsName(), entity.getOldName())) { + ((SimpleDSColumn) ob).setDsName(entity.getNewName()); + ((SimpleDSColumn) ob).setColumn(TableDataColumn.createColumn(entity.getTargetField(TableDataColumn.getColumnName(((SimpleDSColumn) ob).getColumn())))); + } } } - } } diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java index 8a2d245b54..cc444ba91e 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/utils/SearchJSUtils.java @@ -387,11 +387,14 @@ public class SearchJSUtils { if (chartCollection.getChart(i) instanceof VanChart) { VanChart chart = ((VanChart) chartCollection.getChart(i)); if (chart.getPlot() != null) { - NameJavaScriptGroup nameJavaScriptGroup = chart.getPlot().getHotHyperLink(); - if (isNameJavaScriptGroupExist(nameJavaScriptGroup)) { - for (int j = 0; j < nameJavaScriptGroup.size(); j++) { - nameJavaScriptArrayList.add(nameJavaScriptGroup.getNameHyperlink(j)); + if (chart.getPlot() instanceof VanChartCustomPlot) { + VanChartCustomPlot plot = chart.getPlot(); + for (Plot customPlot : plot.getCustomPlotList()) { + getChartJavaScriptFromGroup(customPlot.getHotHyperLink(), nameJavaScriptArrayList); } + } else { + NameJavaScriptGroup nameJavaScriptGroup = chart.getPlot().getHotHyperLink(); + getChartJavaScriptFromGroup(nameJavaScriptGroup, nameJavaScriptArrayList); } } } @@ -399,6 +402,14 @@ public class SearchJSUtils { return nameJavaScriptArrayList; } + private static void getChartJavaScriptFromGroup(NameJavaScriptGroup nameJavaScriptGroup, ArrayList nameJavaScriptArrayList) { + if (isNameJavaScriptGroupExist(nameJavaScriptGroup)) { + for (int j = 0; j < nameJavaScriptGroup.size(); j++) { + nameJavaScriptArrayList.add(nameJavaScriptGroup.getNameHyperlink(j)); + } + } + } + /** * 处理图表的交互属性(可能存在多种地图) * @param content 存储信息的数据结构