|
@@ -623,7 +623,7 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
List<DeviceWaterDetail> deviceSupplyWaterDetailsForNow = monitorDataReportMapper.getDeviceWaterDetailForNow("水厂", 14, tenantId,loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
List<DeviceWaterDetail> deviceIntakeWaterDetailsForNow = monitorDataReportMapper.getDeviceWaterDetailForNow("水源", 14, tenantId,loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
|
|
|
- //水厂获取实时流量并计算出当天流量
|
|
|
+ //水厂获取实时流量
|
|
|
for (DeviceWaterDetail deviceWaterDetail : deviceSupplyWaterDetailsForNow) {
|
|
|
MonitorDataEntity monitorDataEntity = MonitorDataMap.get(deviceWaterDetail.getDeviceId());
|
|
|
if (monitorDataEntity != null && monitorDataEntity.getDataValues() != null && monitorDataEntity.getDataValues().size() > 0) {
|
|
@@ -636,7 +636,7 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- //水源获取实时流量并计算出当天流量
|
|
|
+ //水源获取实时流量
|
|
|
for (DeviceWaterDetail deviceWaterDetail : deviceIntakeWaterDetailsForNow) {
|
|
|
MonitorDataEntity monitorDataEntity = MonitorDataMap.get(deviceWaterDetail.getDeviceId());
|
|
|
if (monitorDataEntity != null && monitorDataEntity.getDataValues() != null && monitorDataEntity.getDataValues().size() > 0) {
|
|
@@ -653,7 +653,7 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
List<DeviceWaterDetail> deviceSupplyWaterDetailsForDay = monitorDataReportMapper.getDeviceWaterDetailForDay(null,null,"水厂", 3, tenantId, localDate.plusDays(-1).getYear(), localDate.plusDays(-1).getMonthValue(), localDate.plusDays(-1).getDayOfMonth(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
List<DeviceWaterDetail> deviceIntakeWaterDetailsForDay = monitorDataReportMapper.getDeviceWaterDetailForDay(null,null,"水源", 4, tenantId, localDate.plusDays(-1).getYear(), localDate.plusDays(-1).getMonthValue(), localDate.plusDays(-1).getDayOfMonth(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
|
|
|
|
|
|
- //水厂获取实时流量并计算出当天流量
|
|
|
+ //水厂计算出当天流量
|
|
|
for (DeviceWaterDetail deviceWaterDetail : deviceSupplyWaterDetailsForDay) {
|
|
|
MonitorDataEntity monitorDataEntity = MonitorDataMap.get(deviceWaterDetail.getDeviceId());
|
|
|
if (monitorDataEntity != null && monitorDataEntity.getDataValues() != null && monitorDataEntity.getDataValues().size() > 0
|
|
@@ -661,13 +661,14 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
for (MonitorDataValueEntity monitorDataValueEntity : monitorDataEntity.getDataValues()) {
|
|
|
if (monitorDataValueEntity.getAttributeId().equals(deviceWaterDetail.getAttributeId())) {
|
|
|
//累计当天流量
|
|
|
- deviceWaterAmount.addWaterSupplyAmountForDay(new BigDecimal(monitorDataValueEntity.getDataValue()).subtract(deviceWaterDetail.getLatestValue()));
|
|
|
+ deviceWaterAmount.addWaterSupplyAmountForDay((new BigDecimal(monitorDataValueEntity.getDataValue()).subtract(deviceWaterDetail.getLatestValue())
|
|
|
+ ).divide(BigDecimal.valueOf(10000),3, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- //水源获取实时流量并计算出当天流量
|
|
|
+ //水源计算出当天流量
|
|
|
for (DeviceWaterDetail deviceWaterDetail : deviceIntakeWaterDetailsForDay) {
|
|
|
MonitorDataEntity monitorDataEntity = MonitorDataMap.get(deviceWaterDetail.getDeviceId());
|
|
|
if (monitorDataEntity != null && monitorDataEntity.getDataValues() != null && monitorDataEntity.getDataValues().size() > 0
|
|
@@ -675,7 +676,8 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
for (MonitorDataValueEntity monitorDataValueEntity : monitorDataEntity.getDataValues()) {
|
|
|
if (monitorDataValueEntity.getAttributeId().equals(deviceWaterDetail.getAttributeId())) {
|
|
|
//累计当天流量
|
|
|
- deviceWaterAmount.addWaterIntakeAmountForDay(new BigDecimal(monitorDataValueEntity.getDataValue()).subtract(deviceWaterDetail.getLatestValue()));
|
|
|
+ deviceWaterAmount.addWaterIntakeAmountForDay((new BigDecimal(monitorDataValueEntity.getDataValue()).subtract(deviceWaterDetail.getLatestValue())
|
|
|
+ ).divide(BigDecimal.valueOf(10000),3, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -689,6 +691,8 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
if (waterSupplyAmountForYear == null) {
|
|
|
waterSupplyAmountForYear = BigDecimal.ZERO;
|
|
|
}
|
|
|
+ waterSupplyAmountForMonth =waterSupplyAmountForMonth.divide(BigDecimal.valueOf(10000),3, RoundingMode.HALF_UP);
|
|
|
+ waterSupplyAmountForYear =waterSupplyAmountForYear.divide(BigDecimal.valueOf(10000),3, RoundingMode.HALF_UP);
|
|
|
//水厂当月流量
|
|
|
if (deviceWaterAmount.getWaterSupplyAmountForDay() == null) {
|
|
|
deviceWaterAmount.setWaterSupplyAmountForMonth(waterSupplyAmountForMonth);
|
|
@@ -711,6 +715,8 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
if (waterIntakeAmountForYear == null) {
|
|
|
waterIntakeAmountForYear = BigDecimal.ZERO;
|
|
|
}
|
|
|
+ waterIntakeAmountForMonth =waterIntakeAmountForMonth.divide(BigDecimal.valueOf(10000),3, RoundingMode.HALF_UP);
|
|
|
+ waterIntakeAmountForYear =waterIntakeAmountForYear.divide(BigDecimal.valueOf(10000),3, RoundingMode.HALF_UP);
|
|
|
//水源当月流量
|
|
|
if (deviceWaterAmount.getWaterIntakeAmountForDay() == null) {
|
|
|
deviceWaterAmount.setWaterIntakeAmountForMonth(waterIntakeAmountForMonth);
|
|
@@ -886,11 +892,12 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
|
|
|
)
|
|
|
.forEach(monitorDataValueEntity ->
|
|
|
//累计当天流量
|
|
|
- sceneWaterAmount.setWaterAmount(sceneWaterAmount.getWaterAmount().add(
|
|
|
- new BigDecimal(monitorDataValueEntity.getDataValue()).subtract(deviceWaterDetail.getLatestValue())))
|
|
|
+ sceneWaterAmount.setWaterAmount((sceneWaterAmount.getWaterAmount().add(
|
|
|
+ new BigDecimal(monitorDataValueEntity.getDataValue()).subtract(deviceWaterDetail.getLatestValue()))))
|
|
|
);
|
|
|
}
|
|
|
});
|
|
|
+ sceneWaterAmount.setWaterAmount(sceneWaterAmount.getWaterAmount().divide(BigDecimal.valueOf(10000),3, RoundingMode.HALF_UP));
|
|
|
sceneWaterAmounts.add(sceneWaterAmount);
|
|
|
});
|
|
|
//倒序排序
|