|
@@ -109,7 +109,7 @@ public class ReportTableTask {
|
|
|
reportTableDao.addTableTemplateChart(ttc);
|
|
|
//根据模板中的统计图生成相应的报表统计图,并添加
|
|
|
ReportChart reportChart = new ReportChart(
|
|
|
- reportTableId, ttc.getChartType(), ttc.getChartName(), ttc.getValueType(), ttc.getStandby()
|
|
|
+ reportTableId, ttc.getId(), ttc.getChartType(), ttc.getChartName(), ttc.getValueType(), ttc.getStandby()
|
|
|
);
|
|
|
reportTableDao.addReportChart(reportChart);
|
|
|
Integer reportChartId = reportChart.getId();
|
|
@@ -213,7 +213,7 @@ public class ReportTableTask {
|
|
|
reportTableDao.addTableTemplateChart(ttc);
|
|
|
//根据模板中的统计图生成相应的报表统计图,并添加
|
|
|
ReportChart reportChart = new ReportChart(
|
|
|
- reportTableId, ttc.getChartType(), ttc.getChartName(), ttc.getValueType(), ttc.getStandby()
|
|
|
+ reportTableId, ttc.getId(), ttc.getChartType(), ttc.getChartName(), ttc.getValueType(), ttc.getStandby()
|
|
|
);
|
|
|
reportTableDao.addReportChart(reportChart);
|
|
|
Integer reportChartId = reportChart.getId();
|
|
@@ -282,7 +282,7 @@ public class ReportTableTask {
|
|
|
reportTableDao.addTableTemplateChart(ttc);
|
|
|
//根据模板中的统计图生成相应的报表统计图,并添加
|
|
|
ReportChart reportChart = new ReportChart(
|
|
|
- reportTableId, ttc.getChartType(), ttc.getChartName(), ttc.getValueType(), ttc.getStandby()
|
|
|
+ reportTableId, ttc.getId(), ttc.getChartType(), ttc.getChartName(), ttc.getValueType(), ttc.getStandby()
|
|
|
);
|
|
|
reportTableDao.addReportChart(reportChart);
|
|
|
//获取模板统计图中的数据项信息
|
|
@@ -359,7 +359,7 @@ public class ReportTableTask {
|
|
|
reportTableDao.addTableTemplateChart(ttc);
|
|
|
//根据模板中的统计图生成相应的报表统计图,并添加
|
|
|
ReportChart reportChart = new ReportChart(
|
|
|
- reportTableId, ttc.getChartType(), ttc.getChartName(), ttc.getValueType(), ttc.getStandby()
|
|
|
+ reportTableId, ttc.getId(), ttc.getChartType(), ttc.getChartName(), ttc.getValueType(), ttc.getStandby()
|
|
|
);
|
|
|
reportTableDao.addReportChart(reportChart);
|
|
|
//获取模板统计图中的数据项信息
|
|
@@ -449,7 +449,7 @@ public class ReportTableTask {
|
|
|
* @param reportTable
|
|
|
* @return
|
|
|
*/
|
|
|
- public Result manualReportReal(ReportTable reportTable) {
|
|
|
+ public Result getManualReport(ReportTable reportTable) {
|
|
|
Integer reportTableId = reportTable.getId();
|
|
|
//获取手动报表相关的表格数据项信息
|
|
|
List<ReportTableItem> reportTableItemList = reportTableDao.getTableItemListById(reportTableId);
|
|
@@ -539,6 +539,196 @@ public class ReportTableTask {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 获取自动报表最新的一轮数据
|
|
|
+ *
|
|
|
+ * @param reportTable
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Result getAutoReport(ReportTable reportTable) {
|
|
|
+ Integer reportTableId = reportTable.getId();
|
|
|
+ Integer tableTemplateId = reportTable.getTableTemplateId();
|
|
|
+ if (Blank.isEmpty(tableTemplateId)) {
|
|
|
+ throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "模板不存在");
|
|
|
+ }
|
|
|
+ TableTemplate tableTemplate = reportTableDao.getTableTemplateById(tableTemplateId);
|
|
|
+ if (Blank.isEmpty(tableTemplate)) {
|
|
|
+ throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "模板不存在");
|
|
|
+ }
|
|
|
+ String cron = reportTable.getCron();
|
|
|
+ Date startTime = CronUtil.mappingTime(cron, reportTable.getStartTime());
|
|
|
+ Date endTime = CronUtil.mappingTime(cron, reportTable.getEndTime());
|
|
|
+ //获取此报表管理的报表模板,所关联的表格数据项
|
|
|
+ List<TableTemplateTableItem> tableTemplateItemList = reportTableDao.getTttiByTemplateId(tableTemplateId);
|
|
|
+ List<ReportTableItem> reportTableItemList = new ArrayList<>();
|
|
|
+ if (Blank.isNotEmpty(tableTemplateItemList)) {
|
|
|
+ //根据模板配置的取值条件,获取表格数据项的数据,并存到报表的数据项信息里面
|
|
|
+ for (TableTemplateTableItem t : tableTemplateItemList) {
|
|
|
+ Integer itemGroupId = t.getItemGroupId();
|
|
|
+ if (Blank.isEmpty(itemGroupId)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Integer remainder = itemGroupId % ConstantStr.SUB_TABLE_NUM;
|
|
|
+ Integer itemId = t.getItemId();
|
|
|
+ Integer xaxis = t.getXaxis();
|
|
|
+ Integer yaxis = t.getYaxis();
|
|
|
+ String standby = t.getStandby();
|
|
|
+ String itemName = t.getItemName();
|
|
|
+ Integer dataSourceId = t.getDataSourceId();
|
|
|
+ Integer itemType = t.getItemType();
|
|
|
+ Integer valueTakingMode = t.getValueTakingMode();
|
|
|
+ Integer valueType = t.getValueType();
|
|
|
+ Integer bucketType = t.getBucketType();
|
|
|
+ Integer bucketValue = t.getBucketValue();
|
|
|
+ boolean flage = valueType.equals(ConstantStr.CALCULATED_VALUE);
|
|
|
+ if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
|
|
|
+ AttachRawData attachRawData = rawDataDao.getAttachRawData(itemGroupId, dataSourceId, itemName);
|
|
|
+ reportTableItemList.add(new ReportTableItem(
|
|
|
+ reportTableId, itemId, valueType, xaxis, yaxis, standby,
|
|
|
+ flage ? attachRawData.getDataValue() : attachRawData.getOrgDataValue(), attachRawData.getDataValueTime(), null
|
|
|
+ ));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String valueList = null;
|
|
|
+ String valueTimeList = null;
|
|
|
+ String valueIndexList = null;
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY) || bucketType.equals(ConstantStr.PERIOD_TIME_HOUR)
|
|
|
+ || bucketType.equals(ConstantStr.PERIOD_TIME_MINUTE) || bucketType.equals(ConstantStr.PERIOD_TIME_SECOND)) {
|
|
|
+ String startBelongTime;
|
|
|
+ String endBelongTime;
|
|
|
+ List<RawData> rawDataList = new ArrayList<>();
|
|
|
+ if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY)) {
|
|
|
+ startBelongTime = DateUtil.dateChangeStrYmdhms(startTime).substring(0, ConstantStr.TIME_DAY_STR.length());
|
|
|
+ endBelongTime = DateUtil.dateChangeStrYmdhms(endTime).substring(0, ConstantStr.TIME_DAY_STR.length());
|
|
|
+ rawDataList = rawDataDao.getTableDataByDay(itemGroupId, remainder, dataSourceId, itemName, startBelongTime, endBelongTime);
|
|
|
+ } else {
|
|
|
+ startBelongTime = DateUtil.dateChangeStrYmdhms(startTime).substring(0, ConstantStr.TIME_HOUR_STR.length());
|
|
|
+ endBelongTime = DateUtil.dateChangeStrYmdhms(endTime).substring(0, ConstantStr.TIME_HOUR_STR.length());
|
|
|
+ rawDataList = rawDataDao.getTableData(itemGroupId, remainder, dataSourceId, itemName, startBelongTime, endBelongTime);
|
|
|
+ }
|
|
|
+ List<String> sqlCurrentYmdhList = rawDataDao.getCursorYmdh(itemGroupId, dataSourceId, itemName, startBelongTime, endBelongTime);
|
|
|
+ if (Blank.isNotEmpty(sqlCurrentYmdhList)) {
|
|
|
+ for (String sqlCurrentYmdh : sqlCurrentYmdhList) {
|
|
|
+ List<CursorRawData> cursorRawDataList = rawDataDao.getTableCursorData(itemGroupId, dataSourceId, itemName, sqlCurrentYmdh);
|
|
|
+ rawDataList = ReportTask.genRawAddCursor(rawDataList, cursorRawDataList, itemGroupId, dataSourceId, sqlCurrentYmdh);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Blank.isNotEmpty(rawDataList)) {
|
|
|
+ String dataType = rawDataList.get(0).getDataType();
|
|
|
+ if (dataType.equals("boolean")) {
|
|
|
+ map = ReportTask.genBoolean(rawDataList, startTime, endTime, valueTakingMode, bucketType, bucketValue);
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ map = ReportTask.genBigDecimal(rawDataList, startTime, endTime, valueTakingMode, bucketType, bucketValue);
|
|
|
+ } catch (Exception e) {
|
|
|
+ map = ReportTask.genString(rawDataList, startTime, endTime, bucketType, bucketValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "目前还未适配此种类型的取值模式");
|
|
|
+ }
|
|
|
+ valueList = map.get(flage ? "valueList" : "orgValueList");
|
|
|
+ valueTimeList = map.get("valueTimeList");
|
|
|
+ valueIndexList = map.get("valueIndexList");
|
|
|
+ reportTableItemList.add(new ReportTableItem(
|
|
|
+ reportTableId, itemId, xaxis, yaxis, standby, valueList, valueTimeList, valueIndexList
|
|
|
+ ));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Blank.isNotEmpty(reportTableItemList)) {
|
|
|
+ reportTable.setReportTableItemList(reportTableItemList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取报表的统计图信息
|
|
|
+ List<ReportChart> reportChartList = reportTableDao.getReportChartList(reportTableId);
|
|
|
+ if (Blank.isNotEmpty(reportChartList)) {
|
|
|
+ for (ReportChart reportChart : reportChartList) {
|
|
|
+ //查询相关联的模板统计图,以及统计图的数据项相关信息
|
|
|
+ Integer reportChartId = reportChart.getId();
|
|
|
+ Integer templateChartId = reportChart.getTemplateChartId();
|
|
|
+ TableTemplateChart tableTemplateChart = reportTableDao.getTtcById(templateChartId);
|
|
|
+ Integer valueTakingMode = tableTemplateChart.getValueTakingMode();
|
|
|
+ Integer valueType = tableTemplateChart.getValueType();
|
|
|
+ Integer bucketType = tableTemplateChart.getBucketType();
|
|
|
+ Integer bucketValue = tableTemplateChart.getBucketValue();
|
|
|
+ boolean flage = valueType.equals(ConstantStr.CALCULATED_VALUE);
|
|
|
+ List<TableTemplateChartItem> tableTemplateChartItems = tableTemplateChart.getTableTemplateChartItemList();
|
|
|
+ List<ReportChartItem> reportChartItemList = new ArrayList<>();
|
|
|
+ if (Blank.isNotEmpty(tableTemplateChartItems)) {
|
|
|
+ for (TableTemplateChartItem ttci : tableTemplateChartItems) {
|
|
|
+ Integer itemGroupId = ttci.getItemGroupId();
|
|
|
+ if (Blank.isEmpty(itemGroupId)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Integer remainder = itemGroupId % ConstantStr.SUB_TABLE_NUM;
|
|
|
+ Integer itemId = ttci.getItemId();
|
|
|
+ String itemName = ttci.getItemName();
|
|
|
+ Integer dataSourceId = ttci.getDataSourceId();
|
|
|
+ Integer itemType = ttci.getItemType();
|
|
|
+ if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
|
|
|
+ AttachRawData attachRawData = rawDataDao.getAttachRawData(itemGroupId, dataSourceId, itemName);
|
|
|
+ reportChartItemList.add(new ReportChartItem(
|
|
|
+ reportChartId, itemId, flage ? attachRawData.getDataValue() : attachRawData.getOrgDataValue(),
|
|
|
+ attachRawData.getDataValueTime(), null
|
|
|
+ ));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String valueList = null;
|
|
|
+ String valueTimeList = null;
|
|
|
+ String valueIndexList = null;
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY) || bucketType.equals(ConstantStr.PERIOD_TIME_HOUR)
|
|
|
+ || bucketType.equals(ConstantStr.PERIOD_TIME_MINUTE) || bucketType.equals(ConstantStr.PERIOD_TIME_SECOND)) {
|
|
|
+ String startBelongTime;
|
|
|
+ String endBelongTime;
|
|
|
+ List<RawData> rawDataList = new ArrayList<>();
|
|
|
+ if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY)) {
|
|
|
+ startBelongTime = DateUtil.dateChangeStrYmdhms(startTime).substring(0, ConstantStr.TIME_DAY_STR.length());
|
|
|
+ endBelongTime = DateUtil.dateChangeStrYmdhms(endTime).substring(0, ConstantStr.TIME_DAY_STR.length());
|
|
|
+ rawDataList = rawDataDao.getTableDataByDay(itemGroupId, remainder, dataSourceId, itemName, startBelongTime, endBelongTime);
|
|
|
+ } else {
|
|
|
+ startBelongTime = DateUtil.dateChangeStrYmdhms(startTime).substring(0, ConstantStr.TIME_HOUR_STR.length());
|
|
|
+ endBelongTime = DateUtil.dateChangeStrYmdhms(endTime).substring(0, ConstantStr.TIME_HOUR_STR.length());
|
|
|
+ rawDataList = rawDataDao.getTableData(itemGroupId, remainder, dataSourceId, itemName, startBelongTime, endBelongTime);
|
|
|
+ }
|
|
|
+ List<String> sqlCurrentYmdhList = rawDataDao.getCursorYmdh(itemGroupId, dataSourceId, itemName, startBelongTime, endBelongTime);
|
|
|
+ if (Blank.isNotEmpty(sqlCurrentYmdhList)) {
|
|
|
+ for (String sqlCurrentYmdh : sqlCurrentYmdhList) {
|
|
|
+ List<CursorRawData> cursorRawDataList = rawDataDao.getTableCursorData(itemGroupId, dataSourceId, itemName, sqlCurrentYmdh);
|
|
|
+ rawDataList = ReportTask.genRawAddCursor(rawDataList, cursorRawDataList, itemGroupId, dataSourceId, sqlCurrentYmdh);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Blank.isNotEmpty(rawDataList)) {
|
|
|
+ String dataType = rawDataList.get(0).getDataType();
|
|
|
+ if (dataType.equals("boolean")) {
|
|
|
+ map = ReportTask.genBoolean(rawDataList, startTime, endTime, valueTakingMode, bucketType, bucketValue);
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ map = ReportTask.genBigDecimal(rawDataList, startTime, endTime, valueTakingMode, bucketType, bucketValue);
|
|
|
+ } catch (Exception e) {
|
|
|
+ map = ReportTask.genString(rawDataList, startTime, endTime, bucketType, bucketValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "目前还未适配此种类型的取值模式");
|
|
|
+ }
|
|
|
+ valueList = map.get(flage ? "valueList" : "orgValueList");
|
|
|
+ valueTimeList = map.get("valueTimeList");
|
|
|
+ valueIndexList = map.get("valueIndexList");
|
|
|
+ reportChartItemList.add(new ReportChartItem(
|
|
|
+ reportChartId, itemId, valueList, valueTimeList, valueIndexList
|
|
|
+ ));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reportTable.setReportChartList(reportChartList);
|
|
|
+ }
|
|
|
+ return Result.ok(reportTable);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 读取同一个opcDa数据源下,所有项的实时数据
|
|
|
*
|
|
|
* @param dataSource
|
|
@@ -612,7 +802,10 @@ public class ReportTableTask {
|
|
|
if (Blank.isEmpty(tableTemplate)) {
|
|
|
log.info("报表模板不存在");
|
|
|
}
|
|
|
- List<TableTemplateTableItem> tableTemplateItemList = reportTableDao.getTtiByTemplateId(tableTemplateId);
|
|
|
+ //通过报表关联的模板,查询出模板对应的表格数据数据项信息
|
|
|
+ List<TableTemplateTableItem> tableTemplateItemList = reportTableDao.getTttiByTemplateId(tableTemplateId);
|
|
|
+ //通过报表关联的模板,查询出模板对应的统计图,以及统计图数据项信息
|
|
|
+ List<TableTemplateChart> tableTemplateChartList = reportTableDao.getTtcByTemplateId(tableTemplateId);
|
|
|
Date date = new Date();
|
|
|
//生成一张新的子报表,并添加相应的日志,以及用户组授权
|
|
|
ReportTable reportTable1 = new ReportTable(
|
|
@@ -646,20 +839,17 @@ public class ReportTableTask {
|
|
|
String standby = t.getStandby();
|
|
|
String itemName = t.getItemName();
|
|
|
Integer dataSourceId = t.getDataSourceId();
|
|
|
+ Integer itemType = t.getItemType();
|
|
|
Integer valueTakingMode = t.getValueTakingMode();
|
|
|
Integer valueType = t.getValueType();
|
|
|
Integer bucketType = t.getBucketType();
|
|
|
Integer bucketValue = t.getBucketValue();
|
|
|
boolean flage = valueType.equals(ConstantStr.CALCULATED_VALUE);
|
|
|
- Item item = itemGroupDao.getItemById(itemId);
|
|
|
- if (Blank.isEmpty(item)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- Integer itemType = item.getItemType();
|
|
|
if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
|
|
|
AttachRawData attachRawData = rawDataDao.getAttachRawData(itemGroupId, dataSourceId, itemName);
|
|
|
reportTableDao.addReportTableItem(new ReportTableItem(
|
|
|
- id, itemId, xaxis, yaxis, standby, flage ? attachRawData.getDataValue() : attachRawData.getOrgDataValue(), attachRawData.getDataValueTime(), null
|
|
|
+ id, itemId, xaxis, yaxis, standby,
|
|
|
+ flage ? attachRawData.getDataValue() : attachRawData.getOrgDataValue(), attachRawData.getDataValueTime(), null
|
|
|
));
|
|
|
continue;
|
|
|
}
|
|
@@ -710,6 +900,96 @@ public class ReportTableTask {
|
|
|
));
|
|
|
}
|
|
|
}
|
|
|
+ if (Blank.isNotEmpty(tableTemplateChartList)) {
|
|
|
+ for (TableTemplateChart ttc : tableTemplateChartList) {
|
|
|
+ Integer valueTakingMode = ttc.getValueTakingMode();
|
|
|
+ Integer valueType = ttc.getValueType();
|
|
|
+ Integer bucketType = ttc.getBucketType();
|
|
|
+ Integer bucketValue = ttc.getBucketValue();
|
|
|
+ boolean flage = valueType.equals(ConstantStr.CALCULATED_VALUE);
|
|
|
+ //根据模板中的统计图生成相应的报表统计图,并添加
|
|
|
+ ReportChart reportChart = new ReportChart(
|
|
|
+ id, ttc.getId(), ttc.getChartType(), ttc.getChartName(), valueType, ttc.getStandby()
|
|
|
+ );
|
|
|
+ reportTableDao.addReportChart(reportChart);
|
|
|
+ Integer reportChartId = reportChart.getId();
|
|
|
+ //获取模板统计图中的数据项信息
|
|
|
+ List<TableTemplateChartItem> ttciList = ttc.getTableTemplateChartItemList();
|
|
|
+ if (Blank.isNotEmpty(ttciList)) {
|
|
|
+ List<ReportChartItem> reportChartItemList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < ttciList.size(); i++) {
|
|
|
+ TableTemplateChartItem ttci = ttciList.get(i);
|
|
|
+ Integer itemGroupId = ttci.getItemGroupId();
|
|
|
+ if (Blank.isEmpty(itemGroupId)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Integer remainder = itemGroupId % ConstantStr.SUB_TABLE_NUM;
|
|
|
+ Integer itemId = ttci.getItemId();
|
|
|
+ String itemName = ttci.getItemName();
|
|
|
+ Integer dataSourceId = ttci.getDataSourceId();
|
|
|
+ Integer itemType = ttci.getItemType();
|
|
|
+ if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
|
|
|
+ AttachRawData attachRawData = rawDataDao.getAttachRawData(itemGroupId, dataSourceId, itemName);
|
|
|
+ reportChartItemList.add(new ReportChartItem(
|
|
|
+ reportChartId, itemId, flage ? attachRawData.getDataValue() : attachRawData.getOrgDataValue(),
|
|
|
+ attachRawData.getDataValueTime(), null
|
|
|
+ ));
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String valueList = null;
|
|
|
+ String valueTimeList = null;
|
|
|
+ String valueIndexList = null;
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY) || bucketType.equals(ConstantStr.PERIOD_TIME_HOUR)
|
|
|
+ || bucketType.equals(ConstantStr.PERIOD_TIME_MINUTE) || bucketType.equals(ConstantStr.PERIOD_TIME_SECOND)) {
|
|
|
+ String startBelongTime;
|
|
|
+ String endBelongTime;
|
|
|
+ List<RawData> rawDataList = new ArrayList<>();
|
|
|
+ if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY)) {
|
|
|
+ startBelongTime = DateUtil.dateChangeStrYmdhms(startTime).substring(0, ConstantStr.TIME_DAY_STR.length());
|
|
|
+ endBelongTime = DateUtil.dateChangeStrYmdhms(endTime).substring(0, ConstantStr.TIME_DAY_STR.length());
|
|
|
+ rawDataList = rawDataDao.getTableDataByDay(itemGroupId, remainder, dataSourceId, itemName, startBelongTime, endBelongTime);
|
|
|
+ } else {
|
|
|
+ startBelongTime = DateUtil.dateChangeStrYmdhms(startTime).substring(0, ConstantStr.TIME_HOUR_STR.length());
|
|
|
+ endBelongTime = DateUtil.dateChangeStrYmdhms(endTime).substring(0, ConstantStr.TIME_HOUR_STR.length());
|
|
|
+ rawDataList = rawDataDao.getTableData(itemGroupId, remainder, dataSourceId, itemName, startBelongTime, endBelongTime);
|
|
|
+ }
|
|
|
+ List<String> sqlCurrentYmdhList = rawDataDao.getCursorYmdh(itemGroupId, dataSourceId, itemName, startBelongTime, endBelongTime);
|
|
|
+ if (Blank.isNotEmpty(sqlCurrentYmdhList)) {
|
|
|
+ for (String sqlCurrentYmdh : sqlCurrentYmdhList) {
|
|
|
+ List<CursorRawData> cursorRawDataList = rawDataDao.getTableCursorData(itemGroupId, dataSourceId, itemName, sqlCurrentYmdh);
|
|
|
+ rawDataList = ReportTask.genRawAddCursor(rawDataList, cursorRawDataList, itemGroupId, dataSourceId, sqlCurrentYmdh);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Blank.isNotEmpty(rawDataList)) {
|
|
|
+ String dataType = rawDataList.get(0).getDataType();
|
|
|
+ if (dataType.equals("boolean")) {
|
|
|
+ map = ReportTask.genBoolean(rawDataList, startTime, endTime, valueTakingMode, bucketType, bucketValue);
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ map = ReportTask.genBigDecimal(rawDataList, startTime, endTime, valueTakingMode, bucketType, bucketValue);
|
|
|
+ } catch (Exception e) {
|
|
|
+ map = ReportTask.genString(rawDataList, startTime, endTime, bucketType, bucketValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new CustomException(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "目前还未适配此种类型的取值模式");
|
|
|
+ }
|
|
|
+ valueList = map.get(flage ? "valueList" : "orgValueList");
|
|
|
+ valueTimeList = map.get("valueTimeList");
|
|
|
+ valueIndexList = map.get("valueIndexList");
|
|
|
+ reportChartItemList.add(new ReportChartItem(
|
|
|
+ reportChartId, itemId, valueList, valueTimeList, valueIndexList
|
|
|
+ ));
|
|
|
+ }
|
|
|
+ //添加报表统计图相关的数据项
|
|
|
+ if (Blank.isNotEmpty(reportChartItemList)) {
|
|
|
+ reportTableDao.addReportChartItem(reportChartItemList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
log.info("自动报表,{},执行结束,时间为{}", reportTable, DateUtil.dateChangeStrYmdhmss(new Date()));
|
|
|
}
|
|
|
}
|