|
@@ -936,6 +936,49 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
return waterSupplyCharts;
|
|
|
}
|
|
|
|
|
|
+ //水厂制水、药耗、电耗对比曲线
|
|
|
+ @Override
|
|
|
+ public List<WaterSupplyChart> waterSupplyChartsForCurrentMonth(String sceneTypeName,Long sceneId) {
|
|
|
+
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ String tenantId = loginUser.getTenantId();
|
|
|
+ List<Long> sceneIds = sceneService.findByParentIdsLike(sceneId);
|
|
|
+ List<WaterSupplyData> waterSupplyDatas = monitorDataReportMapper.getWaterSupplyDataForCurrentMonth(tenantId, sceneTypeName, sceneIds, loginUser.getType(), loginUser.getPermissonType(), loginUser.getProgramItemList());
|
|
|
+ List<WaterSupplyChart> waterSupplyCharts = new ArrayList<>();
|
|
|
+ waterSupplyDatas.stream()
|
|
|
+ .collect(Collectors.groupingBy(item -> item.getYear() + "-" + item.getMonth() + "-" + item.getDay()))
|
|
|
+ .forEach((key, value) -> {
|
|
|
+ WaterSupplyChart waterSupplyChart = new WaterSupplyChart();
|
|
|
+ waterSupplyChart.setDate(key);
|
|
|
+ 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());
|
|
|
+ } else if (waterSupplyData.getParmType() == 5) {//电耗
|
|
|
+ waterSupplyChart.setPowerData(waterSupplyData.getAmount());
|
|
|
+ } else if (waterSupplyData.getParmType() == 6) {//药耗
|
|
|
+ waterSupplyChart.setDrugData(waterSupplyData.getAmount());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ waterSupplyCharts.add(waterSupplyChart);
|
|
|
+ });
|
|
|
+ //插入当天数据
|
|
|
+ //获取当日水量
|
|
|
+ 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);
|
|
|
+ waterSupplyChart.setPowerData(powerDataAmountCountMonth);
|
|
|
+ waterSupplyCharts.add(waterSupplyChart);
|
|
|
+
|
|
|
+ waterSupplyCharts.sort(Comparator.comparing(WaterSupplyChart::getSort));
|
|
|
+ waterSupplyCharts.sort(Comparator.comparing(WaterSupplyChart::getSort).reversed());
|
|
|
+ return waterSupplyCharts;
|
|
|
+ }
|
|
|
+
|
|
|
public ComUsageDto getYieldPowerUsage(Long companyOrgId) {
|
|
|
ComUsageDto sceneUsageDto = new ComUsageDto();
|
|
|
//查询公司下的场景
|