|
@@ -820,10 +820,67 @@ public class ReportTableTask {
|
|
|
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
|
|
|
- ));
|
|
|
+ String dataType = attachRawData.getDataType();
|
|
|
+ String pattern = null;
|
|
|
+ if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY)) {
|
|
|
+ pattern = ConstantStr.TIME_DAY_STR;
|
|
|
+ } else if (bucketType.equals(ConstantStr.PERIOD_TIME_HOUR)) {
|
|
|
+ pattern = ConstantStr.TIME_HOUR_STR;
|
|
|
+ } else if (bucketType.equals(ConstantStr.PERIOD_TIME_MINUTE)) {
|
|
|
+ pattern = ConstantStr.TIME_MINUTE_STR;
|
|
|
+ } else if (bucketType.equals(ConstantStr.PERIOD_TIME_SECOND)) {
|
|
|
+ pattern = ConstantStr.TIME_SECOND_STR;
|
|
|
+ }
|
|
|
+ int timeLength = DateUtil.timeDifference(startTime, endTime, pattern, bucketValue);
|
|
|
+ String dataValueTime = attachRawData.getDataValueTime();
|
|
|
+ if (dataType.toLowerCase().equals("boolean")) {
|
|
|
+ List<Boolean> valueList = new ArrayList<>();
|
|
|
+ List<Boolean> orgValueList = new ArrayList<>();
|
|
|
+ List<String> valueTimeList = new ArrayList<>();
|
|
|
+ Boolean dataBoolean = JSON.parseObject(attachRawData.getDataValue(), Boolean.class);
|
|
|
+ Boolean orgBoolean = JSON.parseObject(attachRawData.getOrgDataValue(), Boolean.class);
|
|
|
+ for (int i = 0; i < timeLength; i++) {
|
|
|
+ valueList.add(dataBoolean);
|
|
|
+ orgValueList.add(orgBoolean);
|
|
|
+ valueTimeList.add(dataValueTime);
|
|
|
+ }
|
|
|
+ reportChartItemList.add(new ReportChartItem(
|
|
|
+ reportChartId, itemId, flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList),
|
|
|
+ ArrayUtil.listToStr(valueTimeList), null
|
|
|
+ ));
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ List<BigDecimal> valueList = new ArrayList<>();
|
|
|
+ List<BigDecimal> orgValueList = new ArrayList<>();
|
|
|
+ List<String> valueTimeList = new ArrayList<>();
|
|
|
+ BigDecimal dataBigDecimal = JSON.parseObject(attachRawData.getDataValue(), BigDecimal.class);
|
|
|
+ BigDecimal orgBigDecimal = JSON.parseObject(attachRawData.getOrgDataValue(), BigDecimal.class);
|
|
|
+ for (int i = 0; i < timeLength; i++) {
|
|
|
+ valueList.add(dataBigDecimal);
|
|
|
+ orgValueList.add(orgBigDecimal);
|
|
|
+ valueTimeList.add(dataValueTime);
|
|
|
+ }
|
|
|
+ reportChartItemList.add(new ReportChartItem(
|
|
|
+ reportChartId, itemId, flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList),
|
|
|
+ ArrayUtil.listToStr(valueTimeList), null
|
|
|
+ ));
|
|
|
+ } catch (Exception e) {
|
|
|
+ List<String> valueList = new ArrayList<>();
|
|
|
+ List<String> orgValueList = new ArrayList<>();
|
|
|
+ List<String> valueTimeList = new ArrayList<>();
|
|
|
+ String dataValue = attachRawData.getDataValue();
|
|
|
+ String orgDataValue = attachRawData.getOrgDataValue();
|
|
|
+ for (int i = 0; i < timeLength; i++) {
|
|
|
+ valueList.add(dataValue);
|
|
|
+ orgValueList.add(orgDataValue);
|
|
|
+ valueTimeList.add(dataValueTime);
|
|
|
+ }
|
|
|
+ reportChartItemList.add(new ReportChartItem(
|
|
|
+ reportChartId, itemId, flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList),
|
|
|
+ ArrayUtil.listToStr(valueTimeList), null
|
|
|
+ ));
|
|
|
+ }
|
|
|
+ }
|
|
|
continue;
|
|
|
}
|
|
|
String valueList = null;
|
|
@@ -974,8 +1031,8 @@ public class ReportTableTask {
|
|
|
}
|
|
|
//根据报表的cron和开始、结束时间,生成此次执行报表抓取数据的开始时间和结束时间
|
|
|
String cron = reportTable.getCron();
|
|
|
- Date startTime = CronUtil.mappingTime(cron, reportTable.getStartTime());
|
|
|
- Date endTime = CronUtil.mappingTime(cron, reportTable.getEndTime());
|
|
|
+ Date startTime = CronUtil.mappingAutoTime(cron, reportTable.getStartTime());
|
|
|
+ Date endTime = CronUtil.mappingAutoTime(cron, reportTable.getEndTime());
|
|
|
Integer id = reportTable1.getId();
|
|
|
//根据模板的取值条件获取相应的数据
|
|
|
if (Blank.isNotEmpty(tableTemplateItemList)) {
|
|
@@ -999,17 +1056,75 @@ public class ReportTableTask {
|
|
|
boolean flage = valueType.equals(ConstantStr.CALCULATED_VALUE);
|
|
|
if (itemType.equals(ConstantStr.ATTACH_ATTRIBUTES)) {
|
|
|
AttachRawData attachRawData = rawDataDao.getAttachRawData(itemGroupId, dataSourceId, itemName);
|
|
|
- reportTableDao.addReportTableItem(new ReportTableItem(
|
|
|
- id, itemId, valueType, xaxis, yaxis, standby,
|
|
|
- flage ? attachRawData.getDataValue() : attachRawData.getOrgDataValue(), attachRawData.getDataValueTime(), null
|
|
|
- ));
|
|
|
+ String dataType = attachRawData.getDataType();
|
|
|
+ String pattern = null;
|
|
|
+ if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY)) {
|
|
|
+ pattern = ConstantStr.TIME_DAY_STR;
|
|
|
+ } else if (bucketType.equals(ConstantStr.PERIOD_TIME_HOUR)) {
|
|
|
+ pattern = ConstantStr.TIME_HOUR_STR;
|
|
|
+ } else if (bucketType.equals(ConstantStr.PERIOD_TIME_MINUTE)) {
|
|
|
+ pattern = ConstantStr.TIME_MINUTE_STR;
|
|
|
+ } else if (bucketType.equals(ConstantStr.PERIOD_TIME_SECOND)) {
|
|
|
+ pattern = ConstantStr.TIME_SECOND_STR;
|
|
|
+ }
|
|
|
+ int timeLength = DateUtil.timeDifference(startTime, endTime, pattern, bucketValue);
|
|
|
+ String dataValueTime = attachRawData.getDataValueTime();
|
|
|
+ if (dataType.toLowerCase().equals("boolean")) {
|
|
|
+ List<Boolean> valueList = new ArrayList<>();
|
|
|
+ List<Boolean> orgValueList = new ArrayList<>();
|
|
|
+ List<String> valueTimeList = new ArrayList<>();
|
|
|
+ Boolean dataBoolean = JSON.parseObject(attachRawData.getDataValue(), Boolean.class);
|
|
|
+ Boolean orgBoolean = JSON.parseObject(attachRawData.getOrgDataValue(), Boolean.class);
|
|
|
+ for (int i = 0; i < timeLength; i++) {
|
|
|
+ valueList.add(dataBoolean);
|
|
|
+ orgValueList.add(orgBoolean);
|
|
|
+ valueTimeList.add(dataValueTime);
|
|
|
+ }
|
|
|
+ reportTableDao.addReportTableItem(new ReportTableItem(
|
|
|
+ id, itemId, valueType, xaxis, yaxis, standby,
|
|
|
+ flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList), ArrayUtil.listToStr(valueTimeList), null
|
|
|
+ ));
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ List<BigDecimal> valueList = new ArrayList<>();
|
|
|
+ List<BigDecimal> orgValueList = new ArrayList<>();
|
|
|
+ List<String> valueTimeList = new ArrayList<>();
|
|
|
+ BigDecimal dataBigDecimal = JSON.parseObject(attachRawData.getDataValue(), BigDecimal.class);
|
|
|
+ BigDecimal orgBigDecimal = JSON.parseObject(attachRawData.getOrgDataValue(), BigDecimal.class);
|
|
|
+ for (int i = 0; i < timeLength; i++) {
|
|
|
+ valueList.add(dataBigDecimal);
|
|
|
+ orgValueList.add(orgBigDecimal);
|
|
|
+ valueTimeList.add(dataValueTime);
|
|
|
+ }
|
|
|
+ reportTableDao.addReportTableItem(new ReportTableItem(
|
|
|
+ id, itemId, valueType, xaxis, yaxis, standby,
|
|
|
+ flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList), ArrayUtil.listToStr(valueTimeList), null
|
|
|
+ ));
|
|
|
+ } catch (Exception e) {
|
|
|
+ List<String> valueList = new ArrayList<>();
|
|
|
+ List<String> orgValueList = new ArrayList<>();
|
|
|
+ List<String> valueTimeList = new ArrayList<>();
|
|
|
+ String dataValue = attachRawData.getDataValue();
|
|
|
+ String orgDataValue = attachRawData.getOrgDataValue();
|
|
|
+ for (int i = 0; i < timeLength; i++) {
|
|
|
+ valueList.add(dataValue);
|
|
|
+ orgValueList.add(orgDataValue);
|
|
|
+ valueTimeList.add(dataValueTime);
|
|
|
+ }
|
|
|
+ reportTableDao.addReportTableItem(new ReportTableItem(
|
|
|
+ id, itemId, valueType, xaxis, yaxis, standby,
|
|
|
+ flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList), ArrayUtil.listToStr(valueTimeList), 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)) {
|
|
|
+ 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<>();
|
|
@@ -1082,10 +1197,67 @@ public class ReportTableTask {
|
|
|
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
|
|
|
- ));
|
|
|
+ String dataType = attachRawData.getDataType();
|
|
|
+ String pattern = null;
|
|
|
+ if (bucketType.equals(ConstantStr.PERIOD_TIME_DAY)) {
|
|
|
+ pattern = ConstantStr.TIME_DAY_STR;
|
|
|
+ } else if (bucketType.equals(ConstantStr.PERIOD_TIME_HOUR)) {
|
|
|
+ pattern = ConstantStr.TIME_HOUR_STR;
|
|
|
+ } else if (bucketType.equals(ConstantStr.PERIOD_TIME_MINUTE)) {
|
|
|
+ pattern = ConstantStr.TIME_MINUTE_STR;
|
|
|
+ } else if (bucketType.equals(ConstantStr.PERIOD_TIME_SECOND)) {
|
|
|
+ pattern = ConstantStr.TIME_SECOND_STR;
|
|
|
+ }
|
|
|
+ int timeLength = DateUtil.timeDifference(startTime, endTime, pattern, bucketValue);
|
|
|
+ String dataValueTime = attachRawData.getDataValueTime();
|
|
|
+ if (dataType.toLowerCase().equals("boolean")) {
|
|
|
+ List<Boolean> valueList = new ArrayList<>();
|
|
|
+ List<Boolean> orgValueList = new ArrayList<>();
|
|
|
+ List<String> valueTimeList = new ArrayList<>();
|
|
|
+ Boolean dataBoolean = JSON.parseObject(attachRawData.getDataValue(), Boolean.class);
|
|
|
+ Boolean orgBoolean = JSON.parseObject(attachRawData.getOrgDataValue(), Boolean.class);
|
|
|
+ for (int j = 0; j < timeLength; j++) {
|
|
|
+ valueList.add(dataBoolean);
|
|
|
+ orgValueList.add(orgBoolean);
|
|
|
+ valueTimeList.add(dataValueTime);
|
|
|
+ }
|
|
|
+ reportChartItemList.add(new ReportChartItem(
|
|
|
+ reportChartId, itemId, flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList),
|
|
|
+ ArrayUtil.listToStr(valueTimeList), null
|
|
|
+ ));
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ List<BigDecimal> valueList = new ArrayList<>();
|
|
|
+ List<BigDecimal> orgValueList = new ArrayList<>();
|
|
|
+ List<String> valueTimeList = new ArrayList<>();
|
|
|
+ BigDecimal dataBigDecimal = JSON.parseObject(attachRawData.getDataValue(), BigDecimal.class);
|
|
|
+ BigDecimal orgBigDecimal = JSON.parseObject(attachRawData.getOrgDataValue(), BigDecimal.class);
|
|
|
+ for (int j = 0; j < timeLength; j++) {
|
|
|
+ valueList.add(dataBigDecimal);
|
|
|
+ orgValueList.add(orgBigDecimal);
|
|
|
+ valueTimeList.add(dataValueTime);
|
|
|
+ }
|
|
|
+ reportChartItemList.add(new ReportChartItem(
|
|
|
+ reportChartId, itemId, flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList),
|
|
|
+ ArrayUtil.listToStr(valueTimeList), null
|
|
|
+ ));
|
|
|
+ } catch (Exception e) {
|
|
|
+ List<String> valueList = new ArrayList<>();
|
|
|
+ List<String> orgValueList = new ArrayList<>();
|
|
|
+ List<String> valueTimeList = new ArrayList<>();
|
|
|
+ String dataValue = attachRawData.getDataValue();
|
|
|
+ String orgDataValue = attachRawData.getOrgDataValue();
|
|
|
+ for (int j = 0; j < timeLength; j++) {
|
|
|
+ valueList.add(dataValue);
|
|
|
+ orgValueList.add(orgDataValue);
|
|
|
+ valueTimeList.add(dataValueTime);
|
|
|
+ }
|
|
|
+ reportChartItemList.add(new ReportChartItem(
|
|
|
+ reportChartId, itemId, flage ? ArrayUtil.listToStr(valueList) : ArrayUtil.listToStr(orgValueList),
|
|
|
+ ArrayUtil.listToStr(valueTimeList), null
|
|
|
+ ));
|
|
|
+ }
|
|
|
+ }
|
|
|
continue;
|
|
|
}
|
|
|
String valueList = null;
|