Browse Source

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

final/11.0^2
Destiny.Lin 12 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.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<TableReplacementEntity> 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<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) {
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<TableReplacementEntity> 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()))));
}
}
}
}
}

Loading…
Cancel
Save