修改自定义报表处理没有模板情况,使用默认模板
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -579,10 +579,18 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
|
||||
jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig()));
|
||||
parseTemplate(jsonArray, reportTemplateDTOList, reportLimitList, terminalList);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof BusinessException) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
} else {
|
||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
||||
// 自定义报表防止没有默认模板,从resource目录加载默认模板
|
||||
String defaultTemplatePath = "file/default_excel_report.json";
|
||||
InputStream defaultStream = getClass().getClassLoader().getResourceAsStream(defaultTemplatePath);
|
||||
if (defaultStream == null) {
|
||||
if (e instanceof BusinessException) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
} else {
|
||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
||||
}
|
||||
}else {
|
||||
jsonArray = new JSONArray(new JSONTokener(defaultStream, new JSONConfig()));
|
||||
parseTemplate(jsonArray, reportTemplateDTOList, reportLimitList, terminalList);
|
||||
}
|
||||
}
|
||||
//查询不分相别的指标
|
||||
|
||||
Reference in New Issue
Block a user