修改自定义报表处理没有模板情况,使用默认模板
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -579,11 +579,19 @@ 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) {
|
||||||
|
// 自定义报表防止没有默认模板,从resource目录加载默认模板
|
||||||
|
String defaultTemplatePath = "file/default_excel_report.json";
|
||||||
|
InputStream defaultStream = getClass().getClassLoader().getResourceAsStream(defaultTemplatePath);
|
||||||
|
if (defaultStream == null) {
|
||||||
if (e instanceof BusinessException) {
|
if (e instanceof BusinessException) {
|
||||||
throw new BusinessException(e.getMessage());
|
throw new BusinessException(e.getMessage());
|
||||||
} else {
|
} else {
|
||||||
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
throw new BusinessException(HarmonicResponseEnum.CUSTOM_REPORT_JSON);
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
jsonArray = new JSONArray(new JSONTokener(defaultStream, new JSONConfig()));
|
||||||
|
parseTemplate(jsonArray, reportTemplateDTOList, reportLimitList, terminalList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//查询不分相别的指标
|
//查询不分相别的指标
|
||||||
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.EPD.getCode(), DicDataTypeEnum.CS_DATA_TYPE.getCode()).getData();
|
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.EPD.getCode(), DicDataTypeEnum.CS_DATA_TYPE.getCode()).getData();
|
||||||
|
|||||||
Reference in New Issue
Block a user