|
@@ -4,18 +4,27 @@ import com.huaxu.dao.MonitorDataReportMapper;
|
|
|
import com.huaxu.dto.MonitorDataChartReportAttributeDto;
|
|
|
import com.huaxu.dto.MonitorDataChartReportDeviceDto;
|
|
|
import com.huaxu.dto.MonitorDataChartReportValueDto;
|
|
|
+import com.huaxu.dto.generalView.*;
|
|
|
import com.huaxu.entity.DeviceEntity;
|
|
|
+import com.huaxu.entity.MonitorDataEntity;
|
|
|
+import com.huaxu.entity.MonitorDataValueEntity;
|
|
|
import com.huaxu.model.LoginUser;
|
|
|
import com.huaxu.service.MonitorDataReportService;
|
|
|
+import com.huaxu.service.MonitorDataService;
|
|
|
+import com.huaxu.util.ByteArrayUtils;
|
|
|
+import com.huaxu.util.RedisUtil;
|
|
|
import com.huaxu.util.UserUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @description
|
|
@@ -28,6 +37,9 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
@Resource
|
|
|
private MonitorDataReportMapper monitorDataReportMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisUtil redisUtil;
|
|
|
+
|
|
|
@Override
|
|
|
public List<MonitorDataChartReportDeviceDto> MonitorDataChartReportByDay(Long sceneId,Integer year,Integer month ,Integer day) {
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
@@ -55,6 +67,103 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
return monitorDataChartReportDeviceDtos;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<MonitorDataChartReportDeviceDto> DeviceAlarmReport(Integer type,List<Long> sceneIds,Integer year,Integer month ,Integer day) {
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ LocalDate beginDate;
|
|
|
+ LocalDate endDate;
|
|
|
+ String dateType ;
|
|
|
+ if(type != null && type ==1){
|
|
|
+ beginDate=LocalDate.of(year,1,1);
|
|
|
+ endDate=beginDate.plusYears(1);
|
|
|
+ dateType="month";
|
|
|
+ }else
|
|
|
+ if(type != null && type ==2){
|
|
|
+ beginDate=LocalDate.of(year,month,1);
|
|
|
+ endDate=beginDate.plusMonths(1);
|
|
|
+ dateType="day";
|
|
|
+ }else
|
|
|
+ if(type != null && type ==3){
|
|
|
+ beginDate=LocalDate.of(year,month,day);
|
|
|
+ endDate=beginDate.plusDays(1);
|
|
|
+ dateType="hour";
|
|
|
+ }else{
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = monitorDataReportMapper.DeviceAlarmReport(dateType,sceneIds,beginDate,endDate,
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
+
|
|
|
+ FillLoseData(monitorDataChartReportDeviceDtos,type,year,month,day);
|
|
|
+ return monitorDataChartReportDeviceDtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<MonitorDataChartReportDeviceDto> MonitorDataQualityReport(Integer type,List<Long> sceneIds,Integer year,Integer month ,Integer day) {
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+
|
|
|
+ List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = null;
|
|
|
+ if(type != null && type == 3){
|
|
|
+ monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataQualityReportByDay(sceneIds,year,month,day,
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
+ } else if(type != null && type == 2){
|
|
|
+ monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataQualityReportByMonth(sceneIds,year,month,
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
+ } else if(type != null && type == 1){
|
|
|
+ monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataQualityReportByYear(sceneIds,year,
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
+ }
|
|
|
+ if(monitorDataChartReportDeviceDtos != null){
|
|
|
+ FillLoseData(monitorDataChartReportDeviceDtos,type,year,month,day);
|
|
|
+ }
|
|
|
+
|
|
|
+ return monitorDataChartReportDeviceDtos;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<MonitorDataChartReportDeviceDto> MonitorDataEnergyReport(Integer type,List<Long> sceneIds,Integer year,Integer month ,Integer day) {
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = null;
|
|
|
+ if(type != null && type == 3){
|
|
|
+ monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataEnergyReportByDay(sceneIds,year,month,day,
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
+ } else if(type != null && type == 2){
|
|
|
+ monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataEnergyReportByMonth(sceneIds,year,month,
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
+ } else if(type != null && type == 1){
|
|
|
+ monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataEnergyReportByYear(sceneIds,year,
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
+ }
|
|
|
+ if(monitorDataChartReportDeviceDtos != null){
|
|
|
+ FillLoseData(monitorDataChartReportDeviceDtos,type,year,month,day);
|
|
|
+ }
|
|
|
+ return monitorDataChartReportDeviceDtos;
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public List<DeviceEntity> getDeviceBySceneTypeName(String sceneTypeName){
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ return monitorDataReportMapper.getDeviceBySceneTypeName(sceneTypeName,loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public List<MonitorDataChartReportDeviceDto> MonitorDataDeviceReport(Integer type,List<Long> deviceIds, Integer searchType,Integer year,Integer month ,Integer day){
|
|
|
+
|
|
|
+ LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
+ List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = null;
|
|
|
+ if(type != null && type == 3){
|
|
|
+ monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByDay(deviceIds,searchType,year,month,day,
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
+ } else if(type != null && type == 2){
|
|
|
+ monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByMonth(deviceIds,searchType,year,month,
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
+ } else if(type != null && type == 1){
|
|
|
+ monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByYear(deviceIds,searchType,year,
|
|
|
+ loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
+ }
|
|
|
+ if(monitorDataChartReportDeviceDtos != null){
|
|
|
+ FillLoseData(monitorDataChartReportDeviceDtos,type,year,month,day);
|
|
|
+ }
|
|
|
+ return monitorDataChartReportDeviceDtos;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 补充数据里日期时间缺失的
|
|
|
*/
|
|
@@ -142,101 +251,153 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
- public List<MonitorDataChartReportDeviceDto> DeviceAlarmReport(Integer type,List<Long> sceneIds,Integer year,Integer month ,Integer day) {
|
|
|
+ public void MonitorDataGeneralView(){
|
|
|
LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
- LocalDate beginDate;
|
|
|
- LocalDate endDate;
|
|
|
- String dateType ;
|
|
|
- if(type != null && type ==1){
|
|
|
- beginDate=LocalDate.of(year,1,1);
|
|
|
- endDate=beginDate.plusYears(1);
|
|
|
- dateType="month";
|
|
|
- }else
|
|
|
- if(type != null && type ==2){
|
|
|
- beginDate=LocalDate.of(year,month,1);
|
|
|
- endDate=beginDate.plusMonths(1);
|
|
|
- dateType="day";
|
|
|
- }else
|
|
|
- if(type != null && type ==3){
|
|
|
- beginDate=LocalDate.of(year,month,day);
|
|
|
- endDate=beginDate.plusDays(1);
|
|
|
- dateType="hour";
|
|
|
- }else{
|
|
|
- return new ArrayList<>();
|
|
|
+ String tenantId = loginUser.getTenantId();
|
|
|
+ //查询设备编码
|
|
|
+ List<String> deviceCodes = monitorDataReportMapper.selectDeviceCode(tenantId);
|
|
|
+ //根据编码获取redis中的实时数据
|
|
|
+ List<MonitorDataEntity> monitorDataEntities = new ArrayList<>();
|
|
|
+ for(String deviceCode : deviceCodes){
|
|
|
+ //先取缓存里的数据
|
|
|
+ byte[] bytes = redisUtil.get(("sms_water_"+deviceCode).getBytes());
|
|
|
+ if(bytes != null && bytes.length>0){
|
|
|
+ monitorDataEntities.add ((MonitorDataEntity) ByteArrayUtils.bytesToObject(bytes).get());
|
|
|
+ }
|
|
|
}
|
|
|
- List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = monitorDataReportMapper.DeviceAlarmReport(dateType,sceneIds,beginDate,endDate,
|
|
|
- loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
- FillLoseData(monitorDataChartReportDeviceDtos,type,year,month,day);
|
|
|
- return monitorDataChartReportDeviceDtos;
|
|
|
- }
|
|
|
+ //将获取到 实时数据转换为map,方便匹配数据deviceId
|
|
|
+ Map<Integer ,MonitorDataEntity> MonitorDataMap = monitorDataEntities.stream().collect(Collectors.toMap( MonitorDataEntity::getDeviceId ,a -> a,(k1, k2)->k1));
|
|
|
|
|
|
- @Override
|
|
|
- public List<MonitorDataChartReportDeviceDto> MonitorDataQualityReport(Integer type,List<Long> sceneIds,Integer year,Integer month ,Integer day) {
|
|
|
- LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
|
|
|
- List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = null;
|
|
|
- if(type != null && type == 3){
|
|
|
- monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataQualityReportByDay(sceneIds,year,month,day,
|
|
|
- loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
- } else if(type != null && type == 2){
|
|
|
- monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataQualityReportByMonth(sceneIds,year,month,
|
|
|
- loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
- } else if(type != null && type == 1){
|
|
|
- monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataQualityReportByYear(sceneIds,year,
|
|
|
- loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
- }
|
|
|
- if(monitorDataChartReportDeviceDtos != null){
|
|
|
- FillLoseData(monitorDataChartReportDeviceDtos,type,year,month,day);
|
|
|
+ LocalDate localDate =LocalDate.now();
|
|
|
+ //水厂近30天供水量
|
|
|
+ List<DeviceWaterSupply> deviceWaterSupplies = monitorDataReportMapper.getDeviceWaterFor30Day(tenantId);
|
|
|
+ for(int i=0 ; i<30; i++){
|
|
|
+ LocalDate newLocalDate =localDate.plusDays(-i-1);
|
|
|
+ if(i < deviceWaterSupplies.size()
|
|
|
+ || !newLocalDate.isEqual(LocalDate.of(deviceWaterSupplies.get(i).getYear(),
|
|
|
+ deviceWaterSupplies.get(i).getMonth(),
|
|
|
+ deviceWaterSupplies.get(i).getDay()))){
|
|
|
+
|
|
|
+ DeviceWaterSupply deviceWaterSupply = new DeviceWaterSupply();
|
|
|
+ deviceWaterSupply.setOrderNo(i+1);
|
|
|
+ deviceWaterSupply.setAmount(BigDecimal.ZERO);
|
|
|
+ deviceWaterSupply.setYear(newLocalDate.getYear());
|
|
|
+ deviceWaterSupply.setMonth(newLocalDate.getMonthValue());
|
|
|
+ deviceWaterSupply.setDay(newLocalDate.getDayOfMonth());
|
|
|
+ deviceWaterSupply.setDate(newLocalDate);
|
|
|
+ deviceWaterSupplies.add(i,deviceWaterSupply);
|
|
|
+ }else{
|
|
|
+ deviceWaterSupplies.get(i).setOrderNo(i+1);
|
|
|
+ deviceWaterSupplies.get(i).setDate(newLocalDate);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- return monitorDataChartReportDeviceDtos;
|
|
|
- }
|
|
|
+ //供水详情数据(合计:瞬时、本天、本月、本年)
|
|
|
+ DeviceWaterAmount deviceWaterAmount= new DeviceWaterAmount();
|
|
|
+ //14瞬时流量
|
|
|
+ List<DeviceWaterDetail> deviceSupplyWaterDetailsForNow = monitorDataReportMapper.getDeviceWaterDetailForNow("水厂",14,tenantId);
|
|
|
+ List<DeviceWaterDetail> deviceIntakeWaterDetailsForNow = monitorDataReportMapper.getDeviceWaterDetailForNow("水源",14,tenantId);
|
|
|
+
|
|
|
+ //水厂获取实时流量并计算出当天流量
|
|
|
+ for(DeviceWaterDetail deviceWaterDetail : deviceSupplyWaterDetailsForNow){
|
|
|
+ MonitorDataEntity monitorDataEntity = MonitorDataMap.get(deviceWaterDetail.getDeviceId());
|
|
|
+ if(monitorDataEntity != null && monitorDataEntity.getDataValues() != null && monitorDataEntity.getDataValues().size()>0){
|
|
|
+ for( MonitorDataValueEntity monitorDataValueEntity :monitorDataEntity.getDataValues()){
|
|
|
+ if(monitorDataValueEntity.getAttributeId().equals(deviceWaterDetail.getAttributeId())){
|
|
|
+ //水厂累计瞬时流量
|
|
|
+ deviceWaterAmount.addWaterSupplyAmountForNow(new BigDecimal(monitorDataValueEntity.getDataValue()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- @Override
|
|
|
- public List<MonitorDataChartReportDeviceDto> MonitorDataEnergyReport(Integer type,List<Long> sceneIds,Integer year,Integer month ,Integer day) {
|
|
|
- LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
- List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = null;
|
|
|
- if(type != null && type == 3){
|
|
|
- monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataEnergyReportByDay(sceneIds,year,month,day,
|
|
|
- loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
- } else if(type != null && type == 2){
|
|
|
- monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataEnergyReportByMonth(sceneIds,year,month,
|
|
|
- loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
- } else if(type != null && type == 1){
|
|
|
- monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataEnergyReportByYear(sceneIds,year,
|
|
|
- loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
- }
|
|
|
- if(monitorDataChartReportDeviceDtos != null){
|
|
|
- FillLoseData(monitorDataChartReportDeviceDtos,type,year,month,day);
|
|
|
}
|
|
|
- return monitorDataChartReportDeviceDtos;
|
|
|
- }
|
|
|
+ //水源获取实时流量并计算出当天流量
|
|
|
+ for(DeviceWaterDetail deviceWaterDetail : deviceIntakeWaterDetailsForNow){
|
|
|
+ MonitorDataEntity monitorDataEntity = MonitorDataMap.get(deviceWaterDetail.getDeviceId());
|
|
|
+ if(monitorDataEntity != null && monitorDataEntity.getDataValues() != null && monitorDataEntity.getDataValues().size()>0){
|
|
|
+ for( MonitorDataValueEntity monitorDataValueEntity :monitorDataEntity.getDataValues()){
|
|
|
+ if(monitorDataValueEntity.getAttributeId().equals(deviceWaterDetail.getAttributeId())){
|
|
|
+ //水源累计瞬时流量
|
|
|
+ deviceWaterAmount.addWaterIntakeAmountForNow(new BigDecimal(monitorDataValueEntity.getDataValue()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- public List<DeviceEntity> getDeviceBySceneTypeName(String sceneTypeName){
|
|
|
- LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
- return monitorDataReportMapper.getDeviceBySceneTypeName(sceneTypeName,loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
- }
|
|
|
+ //3供水 4取水
|
|
|
+ List<DeviceWaterDetail> deviceSupplyWaterDetailsForDay = monitorDataReportMapper.getDeviceWaterDetailForDay("水厂",3,tenantId,localDate.getYear(),localDate.getMonthValue(),localDate.getDayOfMonth());
|
|
|
+ List<DeviceWaterDetail> deviceIntakeWaterDetailsForDay = monitorDataReportMapper.getDeviceWaterDetailForDay("水源",4,tenantId,localDate.getYear(),localDate.getMonthValue(),localDate.getDayOfMonth());
|
|
|
|
|
|
- public List<MonitorDataChartReportDeviceDto> MonitorDataDeviceReport(Integer type,List<Long> deviceIds, Integer searchType,Integer year,Integer month ,Integer day){
|
|
|
+ //水厂获取实时流量并计算出当天流量
|
|
|
+ for(DeviceWaterDetail deviceWaterDetail : deviceSupplyWaterDetailsForDay){
|
|
|
+ MonitorDataEntity monitorDataEntity = MonitorDataMap.get(deviceWaterDetail.getDeviceId());
|
|
|
+ if(monitorDataEntity != null && monitorDataEntity.getDataValues() != null && monitorDataEntity.getDataValues().size()>0){
|
|
|
+ for( MonitorDataValueEntity monitorDataValueEntity :monitorDataEntity.getDataValues()){
|
|
|
+ if(monitorDataValueEntity.getAttributeId().equals(deviceWaterDetail.getAttributeId())){
|
|
|
+ //累计当天流量
|
|
|
+ deviceWaterAmount.addWaterSupplyAmountForDay(new BigDecimal(monitorDataValueEntity.getDataValue()).subtract(deviceWaterDetail.getLatestValue()).add(deviceWaterDetail.getAmount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- LoginUser loginUser = UserUtil.getCurrentUser();
|
|
|
- List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = null;
|
|
|
- if(type != null && type == 3){
|
|
|
- monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByDay(deviceIds,searchType,year,month,day,
|
|
|
- loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
- } else if(type != null && type == 2){
|
|
|
- monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByMonth(deviceIds,searchType,year,month,
|
|
|
- loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
- } else if(type != null && type == 1){
|
|
|
- monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByYear(deviceIds,searchType,year,
|
|
|
- loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
}
|
|
|
- if(monitorDataChartReportDeviceDtos != null){
|
|
|
- FillLoseData(monitorDataChartReportDeviceDtos,type,year,month,day);
|
|
|
+ //水源获取实时流量并计算出当天流量
|
|
|
+ for(DeviceWaterDetail deviceWaterDetail : deviceIntakeWaterDetailsForDay){
|
|
|
+ MonitorDataEntity monitorDataEntity = MonitorDataMap.get(deviceWaterDetail.getDeviceId());
|
|
|
+ if(monitorDataEntity != null && monitorDataEntity.getDataValues() != null && monitorDataEntity.getDataValues().size()>0){
|
|
|
+ for( MonitorDataValueEntity monitorDataValueEntity :monitorDataEntity.getDataValues()){
|
|
|
+ if(monitorDataValueEntity.getAttributeId().equals(deviceWaterDetail.getAttributeId())){
|
|
|
+ //累计当天流量
|
|
|
+ deviceWaterAmount.addWaterIntakeAmountForDay(new BigDecimal(monitorDataValueEntity.getDataValue()).subtract(deviceWaterDetail.getLatestValue()).add(deviceWaterDetail.getAmount()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- return monitorDataChartReportDeviceDtos;
|
|
|
+
|
|
|
+ BigDecimal waterSupplyAmountForMonth = monitorDataReportMapper.getDeviceWaterDetailForMonth("水厂",3,tenantId,localDate.getYear(),localDate.getMonthValue());
|
|
|
+ BigDecimal waterSupplyAmountForYear = monitorDataReportMapper.getDeviceWaterDetailForYear("水厂",3,tenantId,localDate.getYear());
|
|
|
+ //水厂当月流量
|
|
|
+ deviceWaterAmount.setWaterSupplyAmountForMonth(waterSupplyAmountForMonth.add(deviceWaterAmount.getWaterSupplyAmountForDay()));
|
|
|
+ //水厂当年流量
|
|
|
+ deviceWaterAmount.setWaterSupplyAmountForYear(waterSupplyAmountForYear.add(deviceWaterAmount.getWaterSupplyAmountForMonth()));
|
|
|
+
|
|
|
+
|
|
|
+ BigDecimal waterIntakeAmountForMonth = monitorDataReportMapper.getDeviceWaterDetailForMonth("水源",4,tenantId,localDate.getYear(),localDate.getMonthValue());
|
|
|
+ BigDecimal waterIntakeAmountForYear = monitorDataReportMapper.getDeviceWaterDetailForYear("水源",4,tenantId,localDate.getYear());
|
|
|
+ //水源当月流量
|
|
|
+ deviceWaterAmount.setWaterIntakeAmountForMonth(waterIntakeAmountForMonth.add(deviceWaterAmount.getWaterIntakeAmountForDay()));
|
|
|
+ //水源当年流量
|
|
|
+ deviceWaterAmount.setWaterIntakeAmountForYear(waterIntakeAmountForYear.add(deviceWaterAmount.getWaterIntakeAmountForMonth()));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //实时报警信息
|
|
|
+ List<SceneAlarm> sceneAlarms = monitorDataReportMapper.getAlarmInfoForScene(tenantId);
|
|
|
+
|
|
|
+ //管网水质(水质 -1、8PH、10浊度、11余氯)
|
|
|
+ //水质
|
|
|
+ SceneNormalRate sceneNormalRate1 = monitorDataReportMapper.getQualificationForScene(tenantId,-1);
|
|
|
+ //PH
|
|
|
+ SceneNormalRate sceneNormalRate2 = monitorDataReportMapper.getQualificationForScene(tenantId,8);
|
|
|
+ //浊度
|
|
|
+ SceneNormalRate sceneNormalRate3 = monitorDataReportMapper.getQualificationForScene(tenantId,10);
|
|
|
+ //余氯
|
|
|
+ SceneNormalRate sceneNormalRate4 = monitorDataReportMapper.getQualificationForScene(tenantId,11);
|
|
|
+
|
|
|
+
|
|
|
+ //压力分布
|
|
|
+
|
|
|
+ //今日水厂制水量排行
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //水厂制水、药耗、电耗对比曲线
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|