Commit 022e2975 authored by neo's avatar neo

[bugfix] add log and fixed datata choose error

parent 40dce554
...@@ -81,12 +81,20 @@ public class BB extends FunctionBase implements FreeRefFunction { ...@@ -81,12 +81,20 @@ public class BB extends FunctionBase implements FreeRefFunction {
String currentProjectDb = ShardingContextHolder.getDataSourceKey(); String currentProjectDb = ShardingContextHolder.getDataSourceKey();
CellData cellData = null; CellData cellData = null;
try { if (currentProjectDb.equals(dbName)) {
ShardingContextHolder.setDataSourceKey(dbName);
cellData = agent.getCellData(cellTemplateData.getReportTemplateID(), cellData = agent.getCellData(cellTemplateData.getReportTemplateID(),
cellTemplateData.getCellTemplateID(), curPeriod.getCurPeriod()); cellTemplateData.getCellTemplateID(), curPeriod.getCurPeriod());
} finally { } else {
ShardingContextHolder.setDataSourceKey(currentProjectDb); try {
ShardingContextHolder.setDataSourceKey(dbName);
cellData = agent.getCellData(cellTemplateData.getReportTemplateID(),
cellTemplateData.getCellTemplateID(), curPeriod.getCurPeriod());
} catch (Exception e) {
LOGGER.warn("get data exception with dbName{} currentDb {}", dbName, currentProjectDb, e);
throw e;
} finally {
ShardingContextHolder.setDataSourceKey(currentProjectDb);
}
} }
nullCellDto = ReportCellDataSourceDto.extractFromGroup(bo, curPeriod, cellData, cellTemplateData); nullCellDto = ReportCellDataSourceDto.extractFromGroup(bo, curPeriod, cellData, cellTemplateData);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment