Browse Source

REPORT-70857 数据集复制后独立

【问题原因】处理重复代码问题
【改动思路】处理重复代码问题
【review建议】无
final/11.0
Yvan 2 years ago
parent
commit
834044d06b
  1. 30
      designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java

30
designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java

@ -98,23 +98,32 @@ public class TableDataFollowingPasteUtils {
} }
} }
} }
// 处理存储过程名称问题,名称问题需要优先处理,否则就找不到匹配的TableData了 return dealWithTableDataMap(tempMap);
tempMap = dealWithStoreProcedure(tempMap);
// 对TableData做clone处理
tempMap = dealWithTableData4Clone(tempMap);
return tempMap;
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("transfer widget tabledata failed", e); FineLoggerFactory.getLogger().error("transfer widget tabledata failed", e);
} }
return new HashMap<>(); return new HashMap<>();
} }
/**
* 处理结果集
* @param tableDataMap
* @return
*/
private static Map<String, TableData> dealWithTableDataMap(Map<String, TableData> tableDataMap) {
// 处理存储过程名称问题,名称问题需要优先处理,否则就找不到匹配的TableData了
tableDataMap = dealWithStoreProcedure(tableDataMap);
// 对TableData做clone处理
tableDataMap = dealWithTableData4Clone(tableDataMap);
return tableDataMap;
}
/** /**
* 处理结果集将结果集中的存储过程子表替换为原本的存储过程否则跟随粘贴过去的存储过程名称有问题 * 处理结果集将结果集中的存储过程子表替换为原本的存储过程否则跟随粘贴过去的存储过程名称有问题
* *
* @param tableDataMap * @param tableDataMap
*/ */
public static Map<String, TableData> dealWithStoreProcedure(Map<String, TableData> tableDataMap) { private static Map<String, TableData> dealWithStoreProcedure(Map<String, TableData> tableDataMap) {
Map<String, TableData> resultMap = new HashMap<>(); Map<String, TableData> resultMap = new HashMap<>();
if (tableDataMap == null) { if (tableDataMap == null) {
return resultMap; return resultMap;
@ -154,8 +163,7 @@ public class TableDataFollowingPasteUtils {
for (Map.Entry<String, TableDataWrapper> dataWrapperEntry : dataWrapperMap.entrySet()) { for (Map.Entry<String, TableDataWrapper> dataWrapperEntry : dataWrapperMap.entrySet()) {
String tdName = dataWrapperEntry.getKey(); String tdName = dataWrapperEntry.getKey();
TableData td = dataWrapperEntry.getValue().getTableData(); TableData td = dataWrapperEntry.getValue().getTableData();
// 用TableData自己重写的equals方法来比较,实际上直接用"="号也行 if (td.equals(tableData)) {
if (tableData.equals(td)) {
return tdName; return tdName;
} }
} }
@ -184,11 +192,7 @@ public class TableDataFollowingPasteUtils {
collectTableDataInChartCollection(templateTableData, tempMap, widget); collectTableDataInChartCollection(templateTableData, tempMap, widget);
collectTableDataInElementCaseEditor(templateTableData, tempMap, widget); collectTableDataInElementCaseEditor(templateTableData, tempMap, widget);
} }
// 处理存储过程名称问题,名称问题需要优先处理,否则就找不到匹配的TableData了 return dealWithTableDataMap(tempMap);
tempMap = dealWithStoreProcedure(tempMap);
// 对TableData做clone处理
tempMap = dealWithTableData4Clone(tempMap);
return tempMap;
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("transfer widget tabledata failed", e); FineLoggerFactory.getLogger().error("transfer widget tabledata failed", e);
} }

Loading…
Cancel
Save