Explorar o código

修复已知BUG

lihui007 %!s(int64=3) %!d(string=hai) anos
pai
achega
6c7082bcf8

+ 1 - 1
sms_water/src/main/java/com/huaxu/controller/OnlineMonitorController.java

@@ -331,6 +331,6 @@ public class OnlineMonitorController {
     public AjaxMessage selectWaterPumpSate(
             @ApiParam(value = "一级场景id", required = true) @RequestParam Long sceneId,
             @ApiParam(value = "查询天数 1、3、7", required = true) @RequestParam Integer days){
-        return new AjaxMessage<>(ResultStatus.OK, reportWaterPumpStateService.findReportWaterPumpStateList(sceneService.findByParentIdsLike(sceneId),days));
+        return new AjaxMessage<>(ResultStatus.OK, reportWaterPumpStateService.findReportWaterPumpStateList(sceneId, sceneService.findByParentIdsLike(sceneId),days));
     }
 }

+ 8 - 4
sms_water/src/main/java/com/huaxu/dao/MonitorDataReportMapper.java

@@ -89,19 +89,23 @@ public interface MonitorDataReportMapper {
     List<MonitorDataChartReportDeviceDto> MonitorDataDeviceReportByDay(@Param("deviceIds")List<Long> deviceIds, @Param("searchType")Integer searchType,
                                                                               @Param("year")Integer year, @Param("month")Integer month, @Param("day")Integer day,
                                                                               @Param("tenantId")String tenantId,@Param("userType")String userType,@Param("permissonType")Integer permissonType,
-                                                                              @Param("programItems")List<ProgramItem> programItems);
+                                                                              @Param("programItems")List<ProgramItem> programItems,
+                                                                                @Param("sceneId")Long sceneId);
     List<MonitorDataChartReportDeviceDto> MonitorDataDeviceReportByMonth(@Param("deviceIds")List<Long> deviceIds, @Param("searchType")Integer searchType,
                                                                                @Param("year")Integer year, @Param("month")Integer month,
                                                                                @Param("tenantId")String tenantId,@Param("userType")String userType,@Param("permissonType")Integer permissonType,
-                                                                               @Param("programItems")List<ProgramItem> programItems);
+                                                                               @Param("programItems")List<ProgramItem> programItems,
+                                                                         @Param("sceneId")Long sceneId);
     List<MonitorDataChartReportDeviceDto> MonitorDataDeviceReport(@Param("deviceIds")List<Long> deviceIds, @Param("searchType")Integer searchType,
                                                                          @Param("startTime")String startTime, @Param("endTime")String endTime,
                                                                          @Param("tenantId")String tenantId,@Param("userType")String userType,@Param("permissonType")Integer permissonType,
-                                                                         @Param("programItems")List<ProgramItem> programItems);
+                                                                         @Param("programItems")List<ProgramItem> programItems,
+                                                                  @Param("sceneId")Long sceneId);
     List<MonitorDataChartReportDeviceDto> MonitorDataDeviceReportByYear(@Param("deviceIds")List<Long> deviceIds, @Param("searchType")Integer searchType,
                                                                                @Param("year")Integer year,
                                                                                @Param("tenantId")String tenantId,@Param("userType")String userType,@Param("permissonType")Integer permissonType,
-                                                                               @Param("programItems")List<ProgramItem> programItems);
+                                                                               @Param("programItems")List<ProgramItem> programItems,
+                                                                        @Param("sceneId")Long sceneId);
 
 
     List<String> selectDeviceCode(@Param("tenantId")String tenantId,@Param("userType")String userType,@Param("permissonType")Integer permissonType,

+ 16 - 1
sms_water/src/main/java/com/huaxu/dto/MonitorDataChartReportValueDto.java

@@ -1,6 +1,7 @@
 package com.huaxu.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.huaxu.common.StringUtils;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -17,7 +18,7 @@ import java.util.Date;
  */
 @Data
 @ApiModel("数据内容")
-public class MonitorDataChartReportValueDto implements Serializable {
+public class MonitorDataChartReportValueDto implements  Comparable<MonitorDataChartReportValueDto>, Serializable {
 
     private static final long serialVersionUID = 6248751275101485917L;
     @ApiModelProperty("X轴数字")
@@ -32,4 +33,18 @@ public class MonitorDataChartReportValueDto implements Serializable {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
     @ApiModelProperty("日期时间")
     private LocalDateTime date;
+
+
+    @Override
+    public int compareTo(MonitorDataChartReportValueDto o) {
+        return toInt(this.getDateStringLabel()) - toInt(o.getDateStringLabel());
+    }
+
+    private int toInt(String str ){
+        if (StringUtils.isEmpty(str)){
+            str = "0";
+        }
+        str = str.replaceAll("-", "");
+        return Integer.parseInt(str);
+    }
 }

+ 3 - 0
sms_water/src/main/java/com/huaxu/dto/watePump/ReprotWaterPumpQueryDto.java

@@ -53,6 +53,9 @@ public class ReprotWaterPumpQueryDto {
     @ApiModelProperty(value = "设备IDS")
     private List<DeviceDto> deviceIds;
 
+    @ApiModelProperty(value = "场景ID")
+    private Long sceneId;
+
     public String getMd5Query () {
         return Md5Util.hash(this.tenantId + this.deviceId + this.deviceCode + this.attributeId + this.year + this.month);
     }

+ 3 - 0
sms_water/src/main/java/com/huaxu/entity/ReportWaterPumpStateEntity.java

@@ -77,6 +77,9 @@ public class ReportWaterPumpStateEntity {
     @ApiModelProperty(value = "更新日期")
     private Date dateUpdate;
 
+    @ApiModelProperty(value = "ip机器")
+    private String ip;
+
     public String getMd5(){
         return Md5Util.hash(this.tenantId + this.deviceId + this.deviceCode + this.attributeId + this.year + this.month);
     }

+ 29 - 10
sms_water/src/main/java/com/huaxu/rabbitmq/ReportWaterPumpStateHandler.java

@@ -12,12 +12,15 @@ import com.huaxu.entity.MonitorDataValueEntity;
 import com.huaxu.entity.ReportWaterPumpStateEntity;
 import com.huaxu.util.DatesUtil;
 import com.huaxu.util.RedisUtil;
+import io.swagger.models.auth.In;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 
 import java.math.BigDecimal;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -36,6 +39,8 @@ import java.util.stream.Collectors;
 @Slf4j
 public class ReportWaterPumpStateHandler {
 
+    private static String IP;
+
     @Autowired
     private ReportWaterPumpStateMapper reportWaterPumpStateMapper;
 
@@ -44,6 +49,7 @@ public class ReportWaterPumpStateHandler {
 
     @Async
     public void handler(MonitorDataEntity monitorDataEntity, JSONObject receiveData, Date receiveDateTime){
+
         log.info("【水泵运行状态报表:{}】开始处理", monitorDataEntity.getDeviceCode());
         // 0 运行, 1停止
         int state = 0;
@@ -62,15 +68,15 @@ public class ReportWaterPumpStateHandler {
                 entity.setAttributeId(valueEntity.getAttributeId());
                 // 查找属性ID是否有设置运行、停止状态
                 List<DeviceAttributeSpecsEntity> list = deviceAttributeSpecsMapper.findList(entity);
-                if (list == null ) {
+                if (CollectionUtil.isEmpty(list)) {
                     continue;
                 }
-                Map<String,DeviceAttributeSpecsEntity> map = toMap(list);
-                if ((map.get("运行1") == null || map.get("停止1") == null)){
+                List<String> listSate = toList(list);
+                if (CollectionUtil.isEmpty(listSate)) {
                     continue;
                 }
                 BigDecimal stateValue  = new BigDecimal(receiveData.getDouble(valueEntity.getIdentifier()));
-                state = stateValue.toString().equals(map.get("运行1").getSpecsValue()) ? 0 : 1;
+                state = listSate.contains(stateValue.toString()) ? 0 : 1;
                 queryDto.setAttributeId(valueEntity.getAttributeId());
                 addOrUpdate(queryDto.getMd5Query(), monitorDataEntity, valueEntity, insertList, state, receiveDateTime);
             }
@@ -82,14 +88,15 @@ public class ReportWaterPumpStateHandler {
         log.info("【水泵运行状态报表:{}】结束处理,新增:{}", monitorDataEntity.getDeviceCode(),insertList.size());
     }
 
-    private Map<String,DeviceAttributeSpecsEntity> toMap(List<DeviceAttributeSpecsEntity> list){
-         String key = null;
-         Map<String,DeviceAttributeSpecsEntity> map = new HashMap<>();
+    private List<String> toList(List<DeviceAttributeSpecsEntity> list){
+         List<String> result = new ArrayList<>();
          for (DeviceAttributeSpecsEntity deviceAttributeSpecsEntity: list) {
-            key = deviceAttributeSpecsEntity.getSpecsName() + deviceAttributeSpecsEntity.getStatus();
-            map.put(key, deviceAttributeSpecsEntity);
+            if (deviceAttributeSpecsEntity.getSpecsName() != null &&
+                    deviceAttributeSpecsEntity.getSpecsName().indexOf("运行") != -1) {
+                result.add(deviceAttributeSpecsEntity.getSpecsValue());
+            }
          }
-         return map;
+         return result;
     }
 
     /**
@@ -162,6 +169,7 @@ public class ReportWaterPumpStateHandler {
         entity.setDateCreate(nowTime);
         entity.setDateUpdate(nowTime);
         entity.setMd5Query(entity.getMd5());
+        entity.setIp(getIp());
         return entity;
     }
 
@@ -173,4 +181,15 @@ public class ReportWaterPumpStateHandler {
         return DatesUtil.parseDate(DatesUtil.formatDate(date, "yyyy-MM-dd") + " " + appendTo,
                 "yyyy-MM-dd HH:mm:ss");
     }
+
+    public String getIp(){
+        try {
+            if (IP == null) {
+                IP =  InetAddress.getLocalHost().getHostAddress();
+            }
+        } catch (UnknownHostException e) {
+            e.printStackTrace();
+        }
+        return IP;
+    }
 }

+ 1 - 1
sms_water/src/main/java/com/huaxu/service/ReportWaterPumpStateService.java

@@ -20,5 +20,5 @@ public interface ReportWaterPumpStateService {
     * @Param [sceneId : 场景ID, days : 查询的时间范围]
     * @return java.util.List<com.huaxu.dto.watePump.ReprotWaterPumpDto>
     **/
-    List<ReprotWaterPumpDto> findReportWaterPumpStateList(List<Long> sceneId, Integer days);
+    List<ReprotWaterPumpDto> findReportWaterPumpStateList(Long sceneId, List<Long> sceneIds, Integer days);
 }

+ 22 - 22
sms_water/src/main/java/com/huaxu/service/impl/MonitorDataReportServiceImpl.java

@@ -1,8 +1,11 @@
 package com.huaxu.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
+import com.huaxu.dao.DeviceSceneMapper;
 import com.huaxu.dao.MonitorDataReportMapper;
 import com.huaxu.dto.*;
 import com.huaxu.dto.generalView.*;
+import com.huaxu.dto.scene.SceneIdDto;
 import com.huaxu.entity.DeviceEntity;
 import com.huaxu.entity.MonitorDataEntity;
 import com.huaxu.entity.MonitorDataValueEntity;
@@ -57,6 +60,9 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
     @Autowired
     private DeviceService deviceService;
 
+    @Autowired
+    private DeviceSceneMapper deviceSceneMapper;
+
 
     @Override
     public List<MonitorDataChartReportDeviceDto> monitorDataChartReportByDay(Long sceneId, Integer year, Integer month , Integer day) {
@@ -83,23 +89,7 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
         LoginUser loginUser = UserUtil.getCurrentUser();
         List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = monitorDataReportMapper.monthMonitorData(startTime, endTime,sceneId,
                 loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
-        LocalDateTime  startDate =  LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-        LocalDateTime  endDate   =  LocalDateTime.parse(endTime,   DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-        if (startDate.getYear() == endDate.getYear()){
-            for (int i = startDate.getMonth().getValue();i <= endDate.getMonth().getValue(); i++){
-                FillLoseData(monitorDataChartReportDeviceDtos,2, startDate.getYear(), i, 1);
-            }
-        } else {
-            int start = 0;
-            int end = 0;
-            for (int i = startDate.getYear(); i <= endDate.getYear(); i++){
-                start = i == startDate.getYear() ? startDate.getMonth().getValue() : 1;
-                end   = i == endDate.getYear()   ? endDate.getMonthValue() : 12;
-                for (int m = start;m <= end; m++){
-                    FillLoseData(monitorDataChartReportDeviceDtos,2, i , m,1);
-                }
-            }
-        }
+        FillLoseData(startTime, endTime, monitorDataChartReportDeviceDtos);
         return monitorDataChartReportDeviceDtos;
     }
 
@@ -310,7 +300,12 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
     }
     @Override
     public List<MonitorDataChartReportDeviceDto> monitorDataDeviceReport(Integer type, List<Long>  deviceIds, Integer searchType, Integer year, Integer month , Integer day, String startTime, String endTime){
-
+        Long sceneId =null;
+        String name = searchType == 1 ? "压力" : ((searchType == 2) ?  "流量" : "水质");
+        SceneIdDto sceneIdDto = deviceSceneMapper.findSceneId("管网",name, deviceIds.get(0));
+        if (sceneIdDto != null) {
+            sceneId = sceneIdDto.getSceneId();
+        }
         LoginUser loginUser = UserUtil.getCurrentUser();
         List<MonitorDataChartReportDeviceDto> monitorDataChartReportDeviceDtos = null;
         if (type == null) {
@@ -318,18 +313,18 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
         }
         if (type == 3){
             monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByDay(deviceIds,searchType,year,month,day,
-                    loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
+                    loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList(),sceneId);
         } else if(type == 2){
             monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByMonth(deviceIds,searchType,year,month,
-                    loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
+                    loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList(),sceneId);
         } else if(type == 1){
             monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReportByYear(deviceIds,searchType,year,
-                    loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
+                    loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList(),sceneId);
         } else if (type == 4){
             startTime += " 00:00:00";
             endTime   += " 23:59:59";
             monitorDataChartReportDeviceDtos = monitorDataReportMapper.MonitorDataDeviceReport(deviceIds,searchType,startTime,endTime,
-                    loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
+                    loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList(),sceneId);
         }
         if (monitorDataChartReportDeviceDtos != null && type == 4){
             FillLoseData(startTime,endTime, monitorDataChartReportDeviceDtos);
@@ -1476,5 +1471,10 @@ public class MonitorDataReportServiceImpl implements MonitorDataReportService {
                 }
             }
         }
+        for (MonitorDataChartReportDeviceDto dto : monitorDataChartReportDeviceDtos ) {
+            for (MonitorDataChartReportAttributeDto attributeDto : dto.getAttributeData() ) {
+                Collections.sort(attributeDto.getMonitorDataChartReportValue());
+            }
+        }
     }
 }

+ 3 - 2
sms_water/src/main/java/com/huaxu/service/impl/ReportWaterPumpStateServiceImpl.java

@@ -28,11 +28,11 @@ public class ReportWaterPumpStateServiceImpl implements ReportWaterPumpStateServ
     private DeviceService deviceService;
 
     @Override
-    public List<ReprotWaterPumpDto> findReportWaterPumpStateList(List<Long> sceneId, Integer days) {
+    public List<ReprotWaterPumpDto> findReportWaterPumpStateList(Long sceneId, List<Long> sceneIds, Integer days) {
         // 查询场景下的所有设备信息
         List<DeviceDto> devices = new ArrayList<>();
         DeviceDto deviceDto = new DeviceDto();
-        deviceDto.setSceneIds(sceneId);
+        deviceDto.setSceneIds(sceneIds);
         if (deviceDto.getSceneIds().size() > 0){
             devices.addAll(deviceService.selectList(deviceDto));
         }
@@ -41,6 +41,7 @@ public class ReportWaterPumpStateServiceImpl implements ReportWaterPumpStateServ
         queryDto.setTenantId(UserUtil.getCurrentUser().getTenantId());
         // queryDto.setDay(days);
         queryDto.setBeginTime(DatesUtil.formatDate(DatesUtil.addDayOfDate(new Date(), -(days-1)),"yyyy-MM-dd") + " 00:00:00");
+        queryDto.setSceneId(sceneId);
         return reportWaterPumpStateMapper.findReportWaterPumpStateList(queryDto);
     }
 }

+ 8 - 8
sms_water/src/main/resources/application-dev.properties

@@ -118,16 +118,16 @@ ribbon.ReadTimeout=5000
 ribbon.ConnectionTimeout=5000
 
 #localhost
-#message.spring.rabbitmq.host=127.0.0.1
-#message.spring.rabbitmq.port=5672
-#message.spring.rabbitmq.username=andy
-#message.spring.rabbitmq.password=andy
+message.spring.rabbitmq.host=127.0.0.1
+message.spring.rabbitmq.port=5672
+message.spring.rabbitmq.username=andy
+message.spring.rabbitmq.password=andy
 
 ##rabbitmq
-message.spring.rabbitmq.host=114.135.61.188
-message.spring.rabbitmq.port=55672
-message.spring.rabbitmq.username=zoniot
-message.spring.rabbitmq.password=zcxk100
+#message.spring.rabbitmq.host=114.135.61.188
+#message.spring.rabbitmq.port=55672
+#message.spring.rabbitmq.username=zoniot
+#message.spring.rabbitmq.password=zcxk100
 message.spring.rabbitmq.virtual-host= /
 message.spring.rabbitmq.requested-heartbeat = 10
 message.spring.rabbitmq.listener.simple.acknowledge-mode = NONE

+ 12 - 8
sms_water/src/main/resources/mapper/MonitorDataReportMapper.xml

@@ -398,7 +398,7 @@
         p.parm_type AS "attributeType",
         da.unit AS "unit",
 
-        ifnull( ROUND( sum( r.SUM_VALUE ), 2 ), 0 ) AS "data",
+        ifnull( ROUND( sum( r.SUM_VALUE ), 3 ), 0 ) AS "data",
         max( r.COLLECT_DATE ) AS "date"
         FROM sms_device_parm p
         LEFT JOIN sms_day_report r ON p.DEVICE_ID = r.DEVICE_ID AND p.ATTRIBUTE_ID = r.ATTRIBUTE_ID
@@ -454,7 +454,7 @@
         p.parm_type AS "attributeType",
         da.unit AS "unit",
 
-        ifnull( ROUND( sum( r.SUM_VALUE ), 2 ), 0 ) AS "data",
+        ifnull( ROUND( sum( r.SUM_VALUE ), 3 ), 0 ) AS "data",
         max( r.COLLECT_DATE ) AS "date"
         FROM sms_device_parm p
         LEFT JOIN sms_month_report r ON p.DEVICE_ID = r.DEVICE_ID AND p.ATTRIBUTE_ID = r.ATTRIBUTE_ID
@@ -510,7 +510,7 @@
         p.parm_type AS "attributeType",
         da.unit AS "unit",
 
-        ifnull( ROUND( sum( r.SUM_VALUE ), 2 ), 0 ) AS "data",
+        ifnull( ROUND( sum( r.SUM_VALUE ), 3 ), 0 ) AS "data",
         max( r.COLLECT_DATE ) AS "date"
         FROM sms_device_parm p
         LEFT JOIN sms_year_report r ON p.DEVICE_ID = r.DEVICE_ID AND p.ATTRIBUTE_ID = r.ATTRIBUTE_ID
@@ -676,7 +676,7 @@
         IFNULL(p.REMARK,da.`NAME`) AS "attributeName",
         da.unit AS "unit",
         r.`HOUR` AS "dateLabel",
-        ifnull( ROUND( sum( r.AVG_VALUE ), 2 ), 0 ) AS "data",
+        ifnull( ROUND( sum( r.AVG_VALUE ), 3 ), 0 ) AS "data",
         max( r.COLLECT_DATE ) AS "date"
         FROM sms_device_parm p
         LEFT JOIN sms_day_report r ON p.DEVICE_ID = r.DEVICE_ID AND p.ATTRIBUTE_ID = r.ATTRIBUTE_ID
@@ -694,6 +694,7 @@
         <if test="tenantId != null and tenantId != '' ">
             and d.tenant_id = #{tenantId}
         </if>
+        and p.SCENE_ID = #{sceneId}
         <if test="userType!=null and userType!=-999 and userType!=-9999 and  programItems != null and programItems.size() > 0">
             <if test="permissonType == 5 or permissonType == 2">
                 and ( d.DEPT_ORG_ID in
@@ -732,7 +733,7 @@
         IFNULL(p.REMARK,da.`NAME`) AS "attributeName",
         da.unit AS "unit",
         r.`day` AS "dateLabel",
-        ifnull( ROUND( sum( r.AVG_VALUE ), 2 ), 0 ) AS "data",
+        ifnull( ROUND( sum( r.AVG_VALUE ), 3 ), 0 ) AS "data",
         max( r.COLLECT_DATE ) AS "date"
         FROM sms_device_parm p
         LEFT JOIN sms_month_report r ON p.DEVICE_ID = r.DEVICE_ID AND p.ATTRIBUTE_ID = r.ATTRIBUTE_ID
@@ -749,6 +750,7 @@
         <if test="tenantId != null and tenantId != '' ">
             and d.tenant_id = #{tenantId}
         </if>
+        and p.SCENE_ID = #{sceneId}
         <if test="userType!=null and userType!=-999 and userType!=-9999 and  programItems != null and programItems.size() > 0">
             <if test="permissonType == 5 or permissonType == 2">
                 and ( d.DEPT_ORG_ID in
@@ -786,7 +788,7 @@
         IFNULL(p.REMARK,da.`NAME`) AS "attributeName",
         da.unit AS "unit",
         r.month AS "dateLabel",
-        ifnull( ROUND( sum( r.AVG_VALUE ), 2 ), 0 ) AS "data",
+        ifnull( ROUND( sum( r.AVG_VALUE ), 3 ), 0 ) AS "data",
         max( r.COLLECT_DATE ) AS "date"
         FROM sms_device_parm p
         LEFT JOIN sms_year_report r ON p.DEVICE_ID = r.DEVICE_ID AND p.ATTRIBUTE_ID = r.ATTRIBUTE_ID
@@ -803,6 +805,7 @@
         <if test="tenantId != null and tenantId != '' ">
             and d.tenant_id = #{tenantId}
         </if>
+        and p.SCENE_ID = #{sceneId}
         <if test="userType!=null and userType!=-999 and userType!=-9999 and  programItems != null and programItems.size() > 0">
             <if test="permissonType == 5 or permissonType == 2">
                 and ( d.DEPT_ORG_ID in
@@ -1539,7 +1542,7 @@
         IFNULL(p.REMARK,da.`NAME`) AS "attributeName",
         da.unit AS "unit",
         r.`day` AS "dateLabel",
-        ifnull( ROUND( sum( r.AVG_VALUE ), 2 ), 0 ) AS "data",
+        ifnull( ROUND( sum( r.AVG_VALUE ), 3 ), 0 ) AS "data",
         max( r.COLLECT_DATE ) AS "date"
         FROM sms_device_parm p
         LEFT JOIN sms_month_report r ON p.DEVICE_ID = r.DEVICE_ID AND p.ATTRIBUTE_ID = r.ATTRIBUTE_ID
@@ -1558,6 +1561,7 @@
         <if test="tenantId != null and tenantId != '' ">
             and d.tenant_id = #{tenantId}
         </if>
+        and p.SCENE_ID = #{sceneId}
         <if test="userType!=null and userType!=-999 and userType!=-9999 and  programItems != null and programItems.size() > 0">
             <if test="permissonType == 5 or permissonType == 2">
                 and ( d.DEPT_ORG_ID in
@@ -1666,7 +1670,7 @@
         p.parm_type AS "attributeType",
         da.unit AS "unit",
 
-        ifnull( ROUND( sum( r.SUM_VALUE ), 2 ), 0 ) AS "data",
+        ifnull( ROUND( sum( r.SUM_VALUE ), 3 ), 0 ) AS "data",
         max( r.COLLECT_DATE ) AS "date"
         FROM sms_device_parm p
         LEFT JOIN sms_month_report r ON p.DEVICE_ID = r.DEVICE_ID AND p.ATTRIBUTE_ID = r.ATTRIBUTE_ID

+ 1 - 0
sms_water/src/main/resources/mapper/ReportWaterPumpStateMapper.xml

@@ -47,6 +47,7 @@
             <if test="waterPump.tenantId != null  and waterPump.tenantId != ''">
                and a.tenant_id = #{waterPump.tenantId}
             </if>
+            and b.SCENE_ID  = #{waterPump.sceneId}
             <if test="waterPump.deviceIds !=null and waterPump.deviceIds.size > 0">
                 and a.DEVICE_ID in
                 <foreach collection="waterPump.deviceIds" item="dramaId" open="(" close=")" separator=",">