|
@@ -108,7 +108,7 @@ public class MonthReportService extends ServiceImpl<MonthReportMapper, MonthRepo
|
|
|
calcUsage(item, reportDtos);
|
|
|
//动态参数项
|
|
|
List<ReportAttributeDto> reportAttributeDtos = monthReportMapper.findAttributeList(item);
|
|
|
- // item.setDataValues(reportAttributeDtos);
|
|
|
+ // item.setDataValues(reportAttributeDtos);
|
|
|
Map<String, ReportAttributeDto> mapData = new LinkedHashMap<>();
|
|
|
for (ReportAttributeDto itemData : reportAttributeDtos) {
|
|
|
if (!mapData.containsKey(itemData.getAttributeName()))
|
|
@@ -118,11 +118,11 @@ public class MonthReportService extends ServiceImpl<MonthReportMapper, MonthRepo
|
|
|
for (String key : mapsTitle.keySet()) {
|
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
|
map.put("attributeName", mapData.get(key) == null ? key : mapData.get(key).getAttributeName());
|
|
|
- map.put("minValue" + mapsTitle.get(key), mapData.get(key) == null||mapData.get(key).getMinValue()==null ? "-" : (double)Math.round(mapData.get(key).getMinValue()*1000)/1000);
|
|
|
- map.put("maxValue" + mapsTitle.get(key), mapData.get(key) == null||mapData.get(key).getMaxValue()==null ? "-" : (double)Math.round(mapData.get(key).getMaxValue()*1000)/1000);
|
|
|
- map.put("avgValue" + mapsTitle.get(key), mapData.get(key) == null||mapData.get(key).getAvgValue()==null ? "-" : (double)Math.round(mapData.get(key).getAvgValue()*1000)/1000);
|
|
|
- map.put("sumValue" + mapsTitle.get(key), mapData.get(key) == null||mapData.get(key).getSumValue()==null ? "-" : (double)Math.round(mapData.get(key).getSumValue()*1000)/1000);
|
|
|
- map.put("latestValue" + mapsTitle.get(key), mapData.get(key) == null||mapData.get(key).getLatestValue()==null ? "-" : (double)Math.round(mapData.get(key).getLatestValue()*1000)/1000);
|
|
|
+ map.put("minValue" + mapsTitle.get(key), mapData.get(key) == null || mapData.get(key).getMinValue() == null ? "-" : (double) Math.round(mapData.get(key).getMinValue() * 1000) / 1000);
|
|
|
+ map.put("maxValue" + mapsTitle.get(key), mapData.get(key) == null || mapData.get(key).getMaxValue() == null ? "-" : (double) Math.round(mapData.get(key).getMaxValue() * 1000) / 1000);
|
|
|
+ map.put("avgValue" + mapsTitle.get(key), mapData.get(key) == null || mapData.get(key).getAvgValue() == null ? "-" : (double) Math.round(mapData.get(key).getAvgValue() * 1000) / 1000);
|
|
|
+ map.put("sumValue" + mapsTitle.get(key), mapData.get(key) == null || mapData.get(key).getSumValue() == null ? "-" : (double) Math.round(mapData.get(key).getSumValue() * 1000) / 1000);
|
|
|
+ map.put("latestValue" + mapsTitle.get(key), mapData.get(key) == null || mapData.get(key).getLatestValue() == null ? "-" : (double) Math.round(mapData.get(key).getLatestValue() * 1000) / 1000);
|
|
|
maps.add(map);
|
|
|
}
|
|
|
item.setDataMapValues(maps);
|
|
@@ -133,7 +133,7 @@ public class MonthReportService extends ServiceImpl<MonthReportMapper, MonthRepo
|
|
|
|
|
|
//计算固定的参数项
|
|
|
private void calcUsage(ReportDto item, List<ReportDto> reportDtos) {
|
|
|
- if(item==null||reportDtos.size()==0)
|
|
|
+ if (item == null || reportDtos.size() == 0)
|
|
|
return;
|
|
|
//固定参数项
|
|
|
int index = -1;
|
|
@@ -141,10 +141,10 @@ public class MonthReportService extends ServiceImpl<MonthReportMapper, MonthRepo
|
|
|
if (reportDtos.get(i).getDay().equals(item.getDay()))
|
|
|
index = i;
|
|
|
}
|
|
|
- item.setYieldWaterUsage(reportDtos!=null&&reportDtos.get(index)!=null? reportDtos.get(index).getYieldWaterUsage():0);
|
|
|
- item.setIntakeWaterUsage(reportDtos!=null&&reportDtos.get(index)!=null?reportDtos.get(index).getIntakeWaterUsage():0);
|
|
|
- item.setPowerUsage(reportDtos!=null&&reportDtos.get(index)!=null?reportDtos.get(index).getPowerUsage():0);
|
|
|
- item.setDrugUsage(reportDtos!=null&&reportDtos.get(index)!=null?reportDtos.get(index).getDrugUsage():0);
|
|
|
+ item.setYieldWaterUsage(reportDtos != null && reportDtos.get(index) != null ? reportDtos.get(index).getYieldWaterUsage() : 0);
|
|
|
+ item.setIntakeWaterUsage(reportDtos != null && reportDtos.get(index) != null ? reportDtos.get(index).getIntakeWaterUsage() : 0);
|
|
|
+ item.setPowerUsage(reportDtos != null && reportDtos.get(index) != null ? reportDtos.get(index).getPowerUsage() : 0);
|
|
|
+ item.setDrugUsage(reportDtos != null && reportDtos.get(index) != null ? reportDtos.get(index).getDrugUsage() : 0);
|
|
|
// if (index != -1) {
|
|
|
// if ((index + 2) <= reportDtos.size()) {
|
|
|
// item.setYieldWaterUsage(reportDtos.get(index).getYieldWaterUsage() - reportDtos.get(index + 1).getYieldWaterUsage());
|
|
@@ -160,7 +160,7 @@ public class MonthReportService extends ServiceImpl<MonthReportMapper, MonthRepo
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
- public Page<DevicePressReportAttributeDto> findDevicePressPage(IPage<DevicePressReportAttributeDto> page, Long[] ids, Integer year, Integer month, Integer day,Integer type) {
|
|
|
+ public Page<DevicePressReportAttributeDto> findDevicePressPage(IPage<DevicePressReportAttributeDto> page, Long[] ids, Integer year, Integer month, Integer day, Integer type) {
|
|
|
LoginUser currentUser = UserUtil.getCurrentUser();
|
|
|
Page<DevicePressReportAttributeDto> reportPage = new Page<>();
|
|
|
//查询场景下的所有设备信息
|
|
@@ -206,10 +206,16 @@ public class MonthReportService extends ServiceImpl<MonthReportMapper, MonthRepo
|
|
|
}
|
|
|
return reportPage;
|
|
|
}
|
|
|
- public List<MonthReportEntity> findAmountBySceneIds(MonthReportEntity monthReportEntity) {
|
|
|
+
|
|
|
+ public List<MonthReportEntity> findAmountBySceneIds(MonthReportEntity monthReportEntity) {
|
|
|
return monthReportMapper.findAmountBySceneIds(monthReportEntity);
|
|
|
}
|
|
|
- public List<MonthReportEntity> findAmountTotalBySceneIds(MonthReportEntity monthReportEntity) {
|
|
|
- return monthReportMapper.findAmountTotalBySceneIds(monthReportEntity);
|
|
|
- }
|
|
|
+
|
|
|
+ public List<MonthReportEntity> findAmountTotalBySceneIds(MonthReportEntity monthReportEntity) {
|
|
|
+ return monthReportMapper.findAmountTotalBySceneIds(monthReportEntity);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ReportAttributeDto> findAttributeListForMonth(ReportDto reportDto) {
|
|
|
+ return monthReportMapper.findAttributeListForMonth(reportDto);
|
|
|
+ }
|
|
|
}
|