修改自定义报表处理没有模板情况,使用默认模板
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()));
|
jsonArray = new JSONArray(new JSONTokener(fileStream, new JSONConfig()));
|
||||||
parseTemplate(jsonArray, reportTemplateDTOList, reportLimitList, terminalList);
|
parseTemplate(jsonArray, reportTemplateDTOList, reportLimitList, terminalList);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (e instanceof BusinessException) {
|
// 自定义报表防止没有默认模板,从resource目录加载默认模板
|
||||||
throw new BusinessException(e.getMessage());
|
String defaultTemplatePath = "file/default_excel_report.json";
|
||||||
} else {
|
InputStream defaultStream = getClass().getClassLoader().getResourceAsStream(defaultTemplatePath);
|
||||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
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