|
@@ -145,16 +145,51 @@ public abstract class AbstractReportService<M extends BaseMapper<T>, T> extends
|
|
|
ReportAttributeDto itemData2 = new ReportAttributeDto();
|
|
|
itemData2.setAttributeName(itemData.getAttributeName());
|
|
|
itemData2.setLatestValue(itemData.getDataValue());
|
|
|
+
|
|
|
mapData.put(itemData.getAttributeId().toString(), itemData2);
|
|
|
}
|
|
|
}
|
|
|
// 获取统计维度的值
|
|
|
- reportDtoTemp.setDataMapValues(getStatisticalDimensionsValue(mapsTitle, mapData, mapsAttributeTitle));
|
|
|
+ reportDtoTemp.setDataMapValues(getHistoryDataStatisticalDimensionsValue(mapsTitle, mapData, mapsAttributeTitle));
|
|
|
reportDtos.add(reportDtoTemp);
|
|
|
total++;
|
|
|
}
|
|
|
reportPage.setRecords(reportDtos);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 获取统计维度的值
|
|
|
+ * @param mapsTitle
|
|
|
+ * @param mapData
|
|
|
+ * @param mapsAttributeTitle
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Map<String, Object>> getHistoryDataStatisticalDimensionsValue( Map<String, Integer> mapsTitle, Map<String, ReportAttributeDto> mapData,
|
|
|
+ Map<String, ReportAttributeDto> mapsAttributeTitle) {
|
|
|
+ // 判断是否有需要展示的字段
|
|
|
+ boolean haveShowTitle = false;
|
|
|
+ List<Map<String, Object>> dataMapValues = new ArrayList<>();
|
|
|
+ for (String keyTilte : mapsTitle.keySet()) {
|
|
|
+ ReportAttributeDto reportAttributeDto = mapsAttributeTitle.get(keyTilte);
|
|
|
+ // 过滤掉没有开启开关的
|
|
|
+ if (reportAttributeDto == null || !reportAttributeDto.isShowOnOff()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String key = deviceParmService.selectById(Integer.valueOf(keyTilte)).getAttributeId().toString();
|
|
|
+ Map<String, Object> map = new LinkedHashMap<>();
|
|
|
+ map.put("attributeName", mapData.get(key) == null ? key : mapData.get(key).getAttributeName());
|
|
|
+ if (reportAttributeDto.isShowLatestValue()) {
|
|
|
+ map.put("latestValue" + mapsTitle.get(keyTilte), mapData.get(key) == null || mapData.get(key).getLatestValue() == null ?
|
|
|
+ "-" : doubleRoundValue(mapData.get(key).getLatestValue()));
|
|
|
+ haveShowTitle = true;
|
|
|
+ }
|
|
|
+ if (!haveShowTitle) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ haveShowTitle = false;
|
|
|
+ dataMapValues.add(map);
|
|
|
+ }
|
|
|
+ return dataMapValues;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 查询场景下的所有设备信息
|
|
@@ -276,7 +311,7 @@ public abstract class AbstractReportService<M extends BaseMapper<T>, T> extends
|
|
|
Map<String, ReportTitleDto> deviceChildrenMap = new HashMap<>();
|
|
|
List<ReportAttributeDto> reportAttributeDtos2 = new LinkedList<>();
|
|
|
if(reportType==0) {
|
|
|
- reportAttributeDtos2= deviceParmService.findAttributeNameList(reportDto);
|
|
|
+ reportAttributeDtos2 = deviceParmService.findAttributeNameList(reportDto);
|
|
|
}else {
|
|
|
reportAttributeDtos2 = deviceParmService.findHistoryDataAttributeNameList(reportDto);
|
|
|
}
|