|
@@ -168,6 +168,61 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
return monitorDataChartReportDeviceDtos;
|
|
|
}
|
|
|
@Override
|
|
|
+ public List<MonitorDataChartReportDeviceDto> monitorWaterPowerConsumptionReport(Integer type, List<Long> sceneIds, Integer year, Integer month , Integer day, Integer sceneType) {
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = null;
|
|
|
+ if (type != null && type == 3){
|
|
|
+ monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataEnergyReportByDay(sceneType,sceneIds,year,month,day,
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
+ } else if(type != null && type == 2){
|
|
|
+ monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataEnergyReportByMonth(sceneType,sceneIds,year,month,
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
+ } else if(type != null && type == 1){
|
|
|
+ monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataEnergyReportByYear(sceneType,sceneIds,year,
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
+ }
|
|
|
+ if (monitorDataChartReportDeviceDtos != null) {
|
|
|
+ FillLoseData(monitorDataChartReportDeviceDtos,type,year,month,day);
|
|
|
+ }
|
|
|
+ for (MonitorDataChartReportDeviceDto water: monitorDataChartReportDeviceDtos) {
|
|
|
+ List<MonitorDataChartReportAttributeDto> newAttrDataList = new ArrayList();
|
|
|
+ MonitorDataChartReportAttributeDto newAttrData = new MonitorDataChartReportAttributeDto();
|
|
|
+ List<MonitorDataChartReportAttributeDto> attributeDtos = water.getAttributeData();
|
|
|
+ newAttrData.setAttributeName("水电耗");
|
|
|
+ newAttrData.setUnit("kwh/㎡");
|
|
|
+ if (attributeDtos.size() == 2) {
|
|
|
+ MonitorDataChartReportAttributeDto attributeDto1 = attributeDtos.get(0);
|
|
|
+ MonitorDataChartReportAttributeDto attributeDto2 = attributeDtos.get(1);
|
|
|
+ Map<Integer,MonitorDataChartReportValueDto> map1 = attributeDto1.getMonitorDataChartReportValue().stream().collect(Collectors.toMap(MonitorDataChartReportValueDto::getDateLabel, a -> a,(k1, k2)->k1));
|
|
|
+ Map<Integer,MonitorDataChartReportValueDto> map2 = attributeDto2.getMonitorDataChartReportValue().stream().collect(Collectors.toMap(MonitorDataChartReportValueDto::getDateLabel, a -> a,(k1, k2)->k1));
|
|
|
+ // 耗电量
|
|
|
+ if ("5".equals(attributeDto1.getAttributeType())) {
|
|
|
+ calculation(attributeDto1, map2);
|
|
|
+ newAttrData.setMonitorDataChartReportValue(attributeDto1.getMonitorDataChartReportValue());
|
|
|
+ } else {
|
|
|
+ calculation(attributeDto2, map1);
|
|
|
+ newAttrData.setMonitorDataChartReportValue(attributeDto2.getMonitorDataChartReportValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ newAttrDataList.add(newAttrData);
|
|
|
+ water.setAttributeData(newAttrDataList);
|
|
|
+ }
|
|
|
+ return monitorDataChartReportDeviceDtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void calculation(MonitorDataChartReportAttributeDto attributeDto, Map<Integer,MonitorDataChartReportValueDto> map){
|
|
|
+ for (MonitorDataChartReportValueDto valueDto : attributeDto.getMonitorDataChartReportValue()) {
|
|
|
+ BigDecimal b1 = new BigDecimal(valueDto.getData());
|
|
|
+ BigDecimal b2 = new BigDecimal(map.get(valueDto.getDateLabel()).getData());
|
|
|
+ valueDto.setMonitorData("");
|
|
|
+ if (b1.compareTo(new BigDecimal(0)) == 0 || b2.compareTo(new BigDecimal(0)) == 0) {
|
|
|
+ valueDto.setData(0d);
|
|
|
+ } else {
|
|
|
+ valueDto.setData(b1.divide(b2, 5, RoundingMode.HALF_UP).multiply(new BigDecimal(100)).doubleValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @Override
|
|
|
public List<DeviceEntity> getDeviceBySceneTypeName(String sceneTypeName){
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
return monitorDataReportMapper.getDeviceBySceneTypeName(sceneTypeName,loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
@@ -980,11 +1035,11 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
value.stream().forEach(waterSupplyData -> {
|
|
|
Period period = Period.between(LocalDate.of(waterSupplyData.getYear(), waterSupplyData.getMonth(), waterSupplyData.getDay()), LocalDate.now());
|
|
|
waterSupplyChart.setSort(period.getDays());
|
|
|
- if (waterSupplyData.getParmType() == 3) { //供水
|
|
|
- waterSupplyChart.setWaterData(waterSupplyData.getAmount().divide(BigDecimal.valueOf(10000),3, RoundingMode.HALF_UP));
|
|
|
- } else if (waterSupplyData.getParmType() == 5) {//电耗
|
|
|
- waterSupplyChart.setPowerData(waterSupplyData.getAmount().divide(BigDecimal.valueOf(10000),3, RoundingMode.HALF_UP));
|
|
|
- } else if (waterSupplyData.getParmType() == 6) {//药耗
|
|
|
+ if (waterSupplyData.getParmType() == 3 && waterSupplyData.getAmount() != null) { //供水
|
|
|
+ waterSupplyChart.setWaterData(waterSupplyData.getAmount().divide(BigDecimal.valueOf(10000), 3, RoundingMode.HALF_UP));
|
|
|
+ } else if (waterSupplyData.getParmType() == 5 && waterSupplyData.getAmount() != null) {//电耗
|
|
|
+ waterSupplyChart.setPowerData(waterSupplyData.getAmount().divide(BigDecimal.valueOf(10000), 3, RoundingMode.HALF_UP));
|
|
|
+ } else if (waterSupplyData.getParmType() == 6 && waterSupplyData.getAmount() != null) {//药耗
|
|
|
waterSupplyChart.setDrugData(waterSupplyData.getAmount());
|
|
|
}
|
|
|
});
|
|
@@ -994,13 +1049,13 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
waterSupplyCharts.sort(Comparator.comparing(WaterSupplyChart::getSort));
|
|
|
waterSupplyCharts.sort(Comparator.comparing(WaterSupplyChart::getSort).reversed());
|
|
|
//获取当日水量
|
|
|
- BigDecimal waterDataAmountCountMonth = getAmountCount(null,sceneId.intValue(), sceneTypeName, 3,1 );
|
|
|
+ BigDecimal waterDataAmountCountMonth = getAmountCount(null, sceneId.intValue(), sceneTypeName, 3, 1);
|
|
|
//获取当日电耗
|
|
|
- BigDecimal powerDataAmountCountMonth = getAmountCount(null,sceneId.intValue(), sceneTypeName, 5,1 );
|
|
|
- WaterSupplyChart waterSupplyChart= new WaterSupplyChart();
|
|
|
- waterSupplyChart.setDate(LocalDate.now().getYear()+"-"+LocalDate.now().getMonthValue()+"-"+LocalDate.now().getDayOfMonth());
|
|
|
- waterSupplyChart.setWaterData(waterDataAmountCountMonth.divide(BigDecimal.valueOf(10000),3, RoundingMode.HALF_UP));
|
|
|
- waterSupplyChart.setPowerData(powerDataAmountCountMonth.divide(BigDecimal.valueOf(10000),3, RoundingMode.HALF_UP));
|
|
|
+ BigDecimal powerDataAmountCountMonth = getAmountCount(null, sceneId.intValue(), sceneTypeName, 5, 1);
|
|
|
+ WaterSupplyChart waterSupplyChart = new WaterSupplyChart();
|
|
|
+ waterSupplyChart.setDate(LocalDate.now().getYear() + "-" + LocalDate.now().getMonthValue() + "-" + LocalDate.now().getDayOfMonth());
|
|
|
+ waterSupplyChart.setWaterData(waterDataAmountCountMonth.divide(BigDecimal.valueOf(10000), 3, RoundingMode.HALF_UP));
|
|
|
+ waterSupplyChart.setPowerData(powerDataAmountCountMonth.divide(BigDecimal.valueOf(10000), 3, RoundingMode.HALF_UP));
|
|
|
waterSupplyChart.setSort(0);
|
|
|
waterSupplyCharts.add(waterSupplyChart);
|
|
|
return waterSupplyCharts;
|