Browse Source

REPORT-141350 【FVS数据集替换】表格-单元格-条件属性-条件是数据列,无法识别,看下这里要不要支持

final/11.0^2
Destiny.Lin 24 hours ago
parent
commit
66bb13ad46
  1. 38
      designer-realize/src/main/java/com/fr/design/actions/replace/utils/ReplaceUtils.java

38
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.CommonCondition;
import com.fr.data.condition.JoinCondition; import com.fr.data.condition.JoinCondition;
import com.fr.data.condition.ListCondition; import com.fr.data.condition.ListCondition;
import com.fr.data.condition.ObjectCondition;
import com.fr.data.core.Compare; import com.fr.data.core.Compare;
import com.fr.data.impl.NameTableData; import com.fr.data.impl.NameTableData;
import com.fr.data.impl.TableDataDictionary; import com.fr.data.impl.TableDataDictionary;
@ -338,6 +339,7 @@ public class ReplaceUtils {
private static void replaceHighlight(Highlight highlight, List<TableReplacementEntity> entities) { private static void replaceHighlight(Highlight highlight, List<TableReplacementEntity> entities) {
if (highlight instanceof DefaultHighlight) { if (highlight instanceof DefaultHighlight) {
DefaultHighlight defaultHighlight = (DefaultHighlight) highlight; DefaultHighlight defaultHighlight = (DefaultHighlight) highlight;
replaceCondition(defaultHighlight.getCondition(), entities);
for (int i = 0 ; i < defaultHighlight.actionCount() ; i++) { for (int i = 0 ; i < defaultHighlight.actionCount() ; i++) {
if (defaultHighlight.getHighlightAction(i) instanceof PresentHighlightAction) { if (defaultHighlight.getHighlightAction(i) instanceof PresentHighlightAction) {
PresentHighlightAction action = (PresentHighlightAction) defaultHighlight.getHighlightAction(i); PresentHighlightAction action = (PresentHighlightAction) defaultHighlight.getHighlightAction(i);
@ -497,35 +499,45 @@ public class ReplaceUtils {
//公式条件不需要修改,里面不会涉及到,有问题再加 //公式条件不需要修改,里面不会涉及到,有问题再加
//普通条件 //普通条件
//1条条件 //1条条件
if (condition instanceof CommonCondition) { replaceSingleCondition(condition, entity);
dealWithTableDataNameChange((CommonCondition) condition, entity);
}
//N条条件 //N条条件
if (condition instanceof ListCondition) { if (condition instanceof ListCondition) {
for (int k = 0; k < ((ListCondition) condition).getJoinConditionCount(); k++) { for (int k = 0; k < ((ListCondition) condition).getJoinConditionCount(); k++) {
JoinCondition joinCondition = ((ListCondition) condition).getJoinCondition(k); JoinCondition joinCondition = ((ListCondition) condition).getJoinCondition(k);
Condition obCondition = joinCondition.getCondition(); Condition obCondition = joinCondition.getCondition();
if (obCondition != null) { if (obCondition != null) {
if (obCondition instanceof CommonCondition) { replaceSingleCondition(obCondition, entity);
dealWithTableDataNameChange((CommonCondition) obCondition, entity);
}
} }
} }
} }
} }
} }
private static void replaceSingleCondition(Condition condition, List<TableReplacementEntity> 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<TableReplacementEntity> entities) { private static void dealWithTableDataNameChange(CommonCondition condition, List<TableReplacementEntity> entities) {
Compare compare = condition.getCompare(); Compare compare = condition.getCompare();
Object ob = compare.getValue(); dealWithCompare(compare, entities);
if (ob instanceof SimpleDSColumn) { }
for (TableReplacementEntity entity : entities) {
if (ComparatorUtils.equals(((SimpleDSColumn) ob).getDsName(), entity.getOldName())) { private static void dealWithCompare(Compare compare, List<TableReplacementEntity> entities) {
((SimpleDSColumn) ob).setDsName(entity.getNewName()); if (compare != null) {
((SimpleDSColumn) ob).setColumn(TableDataColumn.createColumn(entity.getTargetField(TableDataColumn.getColumnName(((SimpleDSColumn) ob).getColumn())))); 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()))));
}
} }
} }
} }
} }

Loading…
Cancel
Save