Prechádzať zdrojové kódy

数据管理和电能质量模块171、173表调整1

jichaobo 3 rokov pred
rodič
commit
c858a5bd45

+ 10 - 0
fiveep-persistence/src/main/java/com/bizmatics/persistence/mapper/HtAnalogDataMapper.java

@@ -152,6 +152,11 @@ public interface HtAnalogDataMapper extends CrudMapper<HtAnalogData> {
                                                   @Param("startTime") String startTime,
                                                   @Param("endTime") String endTime);
 
+    List<SingleLoopReportVo> getSingleLoopReportData(@Param("deviceCode") String deviceCode,
+                                                     @Param("startTime") String startTime,
+                                                     @Param("endTime") String endTime,
+                                                     @Param("table") String table);
+
     @MapKey("PNA_ID")
     List<ContextualDataVo> getYearOnYearThree(@Param("deviceCode") List deviceCode,
                                               @Param("startTime") String startTime,
@@ -162,4 +167,9 @@ public interface HtAnalogDataMapper extends CrudMapper<HtAnalogData> {
                                               @Param("dataArea") Integer dataArea);
 
     List<Device> getDeviceList(@Param("deviceCode") List deviceCode);
+
+    List<HtAnalogData> getHtAnalogDataList(@Param("deviceCode") String deviceCode,
+                                           @Param("startTime") String startTime,
+                                           @Param("endTime") String endTime,
+                                           @Param("table") String table);
 }

+ 10 - 1
fiveep-persistence/src/main/java/com/bizmatics/persistence/mapper/RtAnalogDataMapper.java

@@ -1,10 +1,10 @@
 package com.bizmatics.persistence.mapper;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.bizmatics.common.mvc.base.CrudMapper;
 import com.bizmatics.model.Device;
 import com.bizmatics.model.HtAnalogData;
 import com.bizmatics.model.RtAnalogData;
-import com.bizmatics.common.mvc.base.CrudMapper;
 import com.bizmatics.model.vo.EvaluationReporVo;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -60,4 +60,13 @@ public interface RtAnalogDataMapper extends CrudMapper<RtAnalogData> {
                                                  @Param("startTime") String startTime,
                                                  @Param("endtime") String endtime);
 
+    List<EvaluationReporVo> getEvaluationReportList(@Param("siteId") Integer siteId,
+                                                    @Param("startTime") String startTime,
+                                                    @Param("endtime") String endtime,
+                                                    @Param("table") String table,
+                                                    @Param("deviceCode") List deviceCode);
+
+    List<RtAnalogData> getRtAnalogDataList(@Param("deviceCode") String deviceCode,
+                                           @Param("table") String table);
+
 }

+ 56 - 0
fiveep-persistence/src/main/resources/mapper/mysql/HtAnalogDataMapper.xml

@@ -1430,6 +1430,50 @@
         GROUP BY a.device_code
     </select>
 
+    <select id="getSingleLoopReportData" resultType="com.bizmatics.model.vo.SingleLoopReportVo">
+        SELECT
+        a.device_code,
+        a.device_name,
+        AVG(b.COS) AS COS,
+        AVG(F) AS avgF,
+        MAX(F) AS maxF,
+        min(F) AS minF,
+        AVG(b.Ia) AS avgIa,
+        AVG(b.Ib) AS avgIb,
+        AVG(b.Ic) AS avgIc,
+        max(b.Ia) AS maxIa,
+        max(b.Ib) AS maxIb,
+        max(b.Ic) AS maxIc,
+        min(b.Ia) AS minIa,
+        min(b.Ib) AS minIb,
+        min(b.Ic) AS minIc,
+        AVG(b.Ua) AS avgUa,
+        AVG(b.Ub) AS avgUb,
+        AVG(b.Uc) AS avgUc,
+        max(b.Ua) AS maxUa,
+        max(b.Ub) AS maxUb,
+        max(b.Uc) AS maxUc,
+        min(b.Ua) AS minUa,
+        min(b.Ub) AS minUb,
+        min(b.Uc) AS minUc,
+        c.voltage_level,
+        d.rated_current,
+        COUNT(b.id) AS measuringPoints
+        FROM
+        device AS a
+        LEFT JOIN ${table} AS b ON a.device_code = b.deviceName
+        LEFT JOIN site_dynamic_properties AS c ON a.site_id = c.site_id
+        LEFT JOIN device_attribute AS d ON a.device_code = d.monitor_device_code
+        <where>
+            and a. ENABLE = 1
+            AND a.device_type = 1
+            AND a.device_code = #{deviceCode}
+            AND b.dataTime BETWEEN #{startTime}
+            AND #{endTime}
+        </where>
+        GROUP BY a.device_code
+    </select>
+
     <select id="getYearOnYearThree" parameterType="java.util.List" resultType="com.bizmatics.model.vo.ContextualDataVo">
         SELECT
         <foreach collection="list" item="fieldDisplay" open=" " separator="," close=" ">
@@ -1466,4 +1510,16 @@
             </foreach>
         </where>
     </select>
+
+    <select id="getHtAnalogDataList" resultType="com.bizmatics.model.HtAnalogData">
+        SELECT
+            *
+        FROM
+            ${table}
+        WHERE
+            deviceName = #{deviceCode}
+        <if test="endTime != null and startTime != null and endTime != '' and startTime != ''">
+            and dataTime BETWEEN #{startTime} and #{endTime}
+        </if>
+    </select>
 </mapper>

+ 45 - 0
fiveep-persistence/src/main/resources/mapper/mysql/RtAnalogDataMapper.xml

@@ -789,4 +789,49 @@
         GROUP BY
         a.device_code
     </select>
+
+
+    <select id="getEvaluationReportList" resultType="com.bizmatics.model.vo.EvaluationReporVo">
+        SELECT
+        a.id,
+        a.device_code,
+        a.device_name,
+        AVG(b.COS) AS COS,
+        AVG(b.Ia) AS Ia,
+        AVG(b.Ib) AS Ib,
+        AVG(b.Ic) AS Ic,
+        AVG(b.Ua) AS Ua,
+        AVG(b.Ub) AS Ub,
+        AVG(b.Uc) AS Uc,
+        c.voltage_level,
+        d.rated_current
+        FROM
+        device AS a
+        LEFT JOIN ${table} AS b ON a.device_code = b.deviceName
+        LEFT JOIN site_dynamic_properties AS c ON a.site_id = c.site_id
+        LEFT JOIN device_attribute AS d ON a.device_code = d.monitor_device_code
+        <where>
+            and a.device_code in
+            <foreach item="item" collection="deviceCode" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            AND a.site_id = #{siteId}
+            AND a.enable = 1
+            AND a.device_type = 1
+            AND b.dataTime BETWEEN #{startTime}
+            AND #{endtime}
+        </where>
+        GROUP BY
+        a.device_code
+    </select>
+
+
+    <select id="getRtAnalogDataList" resultType="com.bizmatics.model.RtAnalogData">
+        SELECT
+            *
+        FROM
+            ${table}
+        WHERE
+            deviceName = #{deviceCode}
+    </select>
 </mapper>

+ 98 - 17
fiveep-service/src/main/java/com/bizmatics/service/impl/HtAnalogDataServiceImpl.java

@@ -302,18 +302,22 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
 
     @Override
     public List<RealScoreVO> rtRealScore(String deviceCode, Date startTime, Date endTime) {
-        LambdaQueryWrapper<HtAnalogData> queryWrapper = Wrappers.lambdaQuery();
-        queryWrapper.select(HtAnalogData::getIa, HtAnalogData::getIb, HtAnalogData::getIc,
-                HtAnalogData::getUa, HtAnalogData::getUb, HtAnalogData::getUc, HtAnalogData::getDataTime,
-                HtAnalogData::getCos)
-                .eq(HtAnalogData::getDeviceName, deviceCode)
-                .between(HtAnalogData::getDataTime, startTime, endTime);
-        List<HtAnalogData> list = this.list(queryWrapper);
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
         //查询设备
         LambdaQueryWrapper<Device> deviceQuery = Wrappers.lambdaQuery();
         deviceQuery.eq(Device::getDeviceCode, deviceCode);
         Device device = deviceService.getOne(deviceQuery);
         Optional.ofNullable(device).orElseThrow(() -> new BusinessException("设备不存在"));
+
+        String table = "ht_analog_data";
+        if (device.getDeviceType().equals("1")) {
+            table = "ht_analog_data";
+        } else if (device.getDeviceType().equals("4")) {
+            table = "ht_analog_173_data";
+        }
+        List<HtAnalogData> list = baseMapper.getDemandAnalysisList(deviceCode, formatter.format(startTime), formatter.format(endTime), table);
+
         //查询sd
         LambdaQueryWrapper<SiteDynamicProperties> sdQuery = Wrappers.lambdaQuery();
         sdQuery.eq(SiteDynamicProperties::getSiteId, device.getSiteId());
@@ -334,6 +338,39 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
         return realScoreVOS;
     }
 
+//    public List<RealScoreVO> rtRealScore(String deviceCode, Date startTime, Date endTime) {
+//        LambdaQueryWrapper<HtAnalogData> queryWrapper = Wrappers.lambdaQuery();
+//        queryWrapper.select(HtAnalogData::getIa, HtAnalogData::getIb, HtAnalogData::getIc,
+//                HtAnalogData::getUa, HtAnalogData::getUb, HtAnalogData::getUc, HtAnalogData::getDataTime,
+//                HtAnalogData::getCos)
+//                .eq(HtAnalogData::getDeviceName, deviceCode)
+//                .between(HtAnalogData::getDataTime, startTime, endTime);
+//        List<HtAnalogData> list = this.list(queryWrapper);
+//        //查询设备
+//        LambdaQueryWrapper<Device> deviceQuery = Wrappers.lambdaQuery();
+//        deviceQuery.eq(Device::getDeviceCode, deviceCode);
+//        Device device = deviceService.getOne(deviceQuery);
+//        Optional.ofNullable(device).orElseThrow(() -> new BusinessException("设备不存在"));
+//        //查询sd
+//        LambdaQueryWrapper<SiteDynamicProperties> sdQuery = Wrappers.lambdaQuery();
+//        sdQuery.eq(SiteDynamicProperties::getSiteId, device.getSiteId());
+//        SiteDynamicProperties siteDynamicProperties = siteDynamicPropertiesService.getOne(sdQuery);
+//        Optional.ofNullable(siteDynamicProperties).orElseThrow(() -> new BusinessException("sd不存在"));
+//        LambdaQueryWrapper<DeviceAttribute> adQuery = Wrappers.lambdaQuery();
+//        adQuery.eq(DeviceAttribute::getSiteId, device.getSiteId());
+//        List<DeviceAttribute> deviceAttributes = deviceAttributeService.list(adQuery);
+//        if (CollectionUtils.isEmpty(deviceAttributes)) {
+//            throw new BusinessException("da不存在");
+//        }
+//        DeviceAttribute deviceAttribute = deviceAttributes.stream().min(Comparator.comparing(DeviceAttribute::getId)).get();
+//        List<RealScoreVO> realScoreVOS = new ArrayList<>();
+//        for (HtAnalogData htAnalogData : list) {
+//            RtAnalogData rtAnalogData = BeanMapperUtils.map(htAnalogData, RtAnalogData.class);
+//            realScoreVOS.add(rtAnalogDataService.fillRealScoreData(rtAnalogData, siteDynamicProperties, deviceAttribute));
+//        }
+//        return realScoreVOS;
+//    }
+
 
     @Override
     public List<CommonIcoVO> yearOnYearList(DataManagementOneVO dataManagementOneVO) {
@@ -849,7 +886,7 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
         } else {
             throw new BusinessException("错误数据,设备不存在");
         }
-        List<HtAnalogData> list1 = baseMapper.getDemandAnalysisList(deviceCode, date1,date2 , table);
+        List<HtAnalogData> list1 = baseMapper.getDemandAnalysisList(deviceCode, date1, date2, table);
         List<Object> demandList = new ArrayList<>();
         List<Object> freezingTimesList = new ArrayList<>();
         for (int i = 0; i < list1.size(); i++) {
@@ -998,24 +1035,68 @@ public class HtAnalogDataServiceImpl extends AbstractCrudService<HtAnalogDataMap
                 throw new BusinessException("时间错误");
             }
         }
-        List<SingleLoopReportVo> SingleLoopReportList = baseMapper.SingleLoopReportData(deviceCode, startTime, endtime);
+
+        LambdaQueryWrapper<Device> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(Device::getDeviceCode, deviceCode);
+        List<Device> deviceList = deviceService.list(queryWrapper);
+        String table = "ht_analog_data";
+        if (deviceList.size() > 0) {
+            if (deviceList.get(0).getDeviceType().equals("1")) {
+                table = "ht_analog_data";
+            } else if (deviceList.get(0).getDeviceType().equals("4")) {
+                table = "ht_analog_173_data";
+            }
+        }
+
+        List<SingleLoopReportVo> SingleLoopReportList = baseMapper.getSingleLoopReportData(deviceCode, startTime, endtime, table);
         if (CollectionUtils.isEmpty(SingleLoopReportList)) {
-            SingleLoopReportOneVo singleLoopReportOneVo = null;
+            SingleLoopReportOneVo singleLoopReportOneVo = new SingleLoopReportOneVo();
             return singleLoopReportOneVo;
-//            throw new BusinessException("暂无数据");
         }
-        LambdaQueryWrapper<HtAnalogData> adQuery = Wrappers.lambdaQuery();
-        adQuery.eq(HtAnalogData::getDeviceName, deviceCode)
-                .between(HtAnalogData::getDataTime, startTime, endtime);
-        List<HtAnalogData> RtAnalogDataList = this.list(adQuery);
+
+        List<HtAnalogData> RtAnalogDataList = baseMapper.getHtAnalogDataList(deviceCode, startTime, endtime, table);
         if (CollectionUtils.isEmpty(RtAnalogDataList)) {
             throw new BusinessException("da不存在");
         }
-
-
         return analysisCalculation(SingleLoopReportList, RtAnalogDataList);
     }
 
+//    public SingleLoopReportOneVo SingleLoopReportData(String deviceCode, Date time, int type) {
+//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+//        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM");
+//        String startTime = null;
+//        String endtime = null;
+//        if (type == 1) {
+//            startTime = sdf.format(time) + " 00:00:00";
+//            endtime = sdf.format(time) + " 23:59:59";
+//        } else {
+//            startTime = sdf1.format(time) + "-01 00:00:00";
+//            String time1 = sdf1.format(time) + "-01";
+//            try {
+//                Date yq = getLastDayOfMonth(sdf.parse(time1));
+//                endtime = sdf.format(yq) + " 23:59:59";
+//            } catch (Exception e) {
+//                throw new BusinessException("时间错误");
+//            }
+//        }
+//        List<SingleLoopReportVo> SingleLoopReportList = baseMapper.SingleLoopReportData(deviceCode, startTime, endtime);
+//        if (CollectionUtils.isEmpty(SingleLoopReportList)) {
+//            SingleLoopReportOneVo singleLoopReportOneVo = null;
+//            return singleLoopReportOneVo;
+////            throw new BusinessException("暂无数据");
+//        }
+//        LambdaQueryWrapper<HtAnalogData> adQuery = Wrappers.lambdaQuery();
+//        adQuery.eq(HtAnalogData::getDeviceName, deviceCode)
+//                .between(HtAnalogData::getDataTime, startTime, endtime);
+//        List<HtAnalogData> RtAnalogDataList = this.list(adQuery);
+//        if (CollectionUtils.isEmpty(RtAnalogDataList)) {
+//            throw new BusinessException("da不存在");
+//        }
+//
+//
+//        return analysisCalculation(SingleLoopReportList, RtAnalogDataList);
+//    }
+
     public SingleLoopReportOneVo analysisCalculation(List<SingleLoopReportVo> SingleLoopReportList, List<HtAnalogData> RtAnalogDataList) {
         DecimalFormat df = new DecimalFormat("######0.00");
         List<Double> checkList = new ArrayList<>();

+ 126 - 9
fiveep-service/src/main/java/com/bizmatics/service/impl/RtAnalogDataServiceImpl.java

@@ -11,6 +11,7 @@ import com.bizmatics.common.core.util.*;
 import com.bizmatics.common.mvc.base.AbstractCrudService;
 import com.bizmatics.common.spring.util.GlobalUtils;
 import com.bizmatics.model.*;
+import com.bizmatics.model.vo.ContextualDataVo;
 import com.bizmatics.model.vo.EvaluationReporVo;
 import com.bizmatics.persistence.mapper.RtAnalogDataMapper;
 import com.bizmatics.service.DeviceAttributeService;
@@ -34,6 +35,8 @@ import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * <p>
@@ -148,15 +151,26 @@ public class RtAnalogDataServiceImpl extends AbstractCrudService<RtAnalogDataMap
 
     @Override
     public RealScoreVO realScore(String deviceCode) {
-        LambdaQueryWrapper<RtAnalogData> queryWrapper = Wrappers.lambdaQuery();
-        queryWrapper.eq(RtAnalogData::getDeviceName, deviceCode);
-        RtAnalogData rtAnalogData = getOne(queryWrapper);
-        Optional.ofNullable(rtAnalogData).orElseThrow(() -> new BusinessException("设备实时信息不存在"));
         //查询设备
         LambdaQueryWrapper<Device> deviceQuery = Wrappers.lambdaQuery();
         deviceQuery.eq(Device::getDeviceCode, deviceCode);
         Device device = deviceService.getOne(deviceQuery);
         Optional.ofNullable(device).orElseThrow(() -> new BusinessException("设备不存在"));
+
+        String table = "rt_analog_data";
+        if (device.getDeviceType().equals("1")){
+            table = "rt_analog_data";
+        }else if (device.getDeviceType().equals("4")){
+            table = "rt_analog_173_data";
+        }
+
+        List<RtAnalogData> rtAnalogDataList = baseMapper.getRtAnalogDataList(deviceCode,table);
+        RtAnalogData rtAnalogData = new RtAnalogData();
+        if (rtAnalogDataList.size()>0){
+            rtAnalogData = rtAnalogDataList.get(0);
+        }else {
+            new BusinessException("设备实时信息不存在");
+        }
         //查询sd
         LambdaQueryWrapper<SiteDynamicProperties> sdQuery = Wrappers.lambdaQuery();
         sdQuery.eq(SiteDynamicProperties::getSiteId, device.getSiteId());
@@ -171,18 +185,55 @@ public class RtAnalogDataServiceImpl extends AbstractCrudService<RtAnalogDataMap
         DeviceAttribute deviceAttribute = deviceAttributes.stream().min(Comparator.comparing(DeviceAttribute::getId)).get();
         return fillRealScoreData(rtAnalogData, siteDynamicProperties, deviceAttribute);
     }
+//    public RealScoreVO realScore(String deviceCode) {
+//        LambdaQueryWrapper<RtAnalogData> queryWrapper = Wrappers.lambdaQuery();
+//        queryWrapper.eq(RtAnalogData::getDeviceName, deviceCode);
+//        RtAnalogData rtAnalogData = getOne(queryWrapper);
+//        Optional.ofNullable(rtAnalogData).orElseThrow(() -> new BusinessException("设备实时信息不存在"));
+//        //查询设备
+//        LambdaQueryWrapper<Device> deviceQuery = Wrappers.lambdaQuery();
+//        deviceQuery.eq(Device::getDeviceCode, deviceCode);
+//        Device device = deviceService.getOne(deviceQuery);
+//        Optional.ofNullable(device).orElseThrow(() -> new BusinessException("设备不存在"));
+//        //查询sd
+//        LambdaQueryWrapper<SiteDynamicProperties> sdQuery = Wrappers.lambdaQuery();
+//        sdQuery.eq(SiteDynamicProperties::getSiteId, device.getSiteId());
+//        SiteDynamicProperties siteDynamicProperties = siteDynamicPropertiesService.getOne(sdQuery);
+//        Optional.ofNullable(siteDynamicProperties).orElseThrow(() -> new BusinessException("sd不存在"));
+//        LambdaQueryWrapper<DeviceAttribute> adQuery = Wrappers.lambdaQuery();
+//        adQuery.eq(DeviceAttribute::getSiteId, device.getSiteId());
+//        List<DeviceAttribute> deviceAttributes = deviceAttributeService.list(adQuery);
+//        if (CollectionUtils.isEmpty(deviceAttributes)) {
+//            throw new BusinessException("da不存在");
+//        }
+//        DeviceAttribute deviceAttribute = deviceAttributes.stream().min(Comparator.comparing(DeviceAttribute::getId)).get();
+//        return fillRealScoreData(rtAnalogData, siteDynamicProperties, deviceAttribute);
+//    }
 
     @Override
     public RealScoreOneVO realScoreOne(String deviceCode) {
-        LambdaQueryWrapper<RtAnalogData> queryWrapper = Wrappers.lambdaQuery();
-        queryWrapper.eq(RtAnalogData::getDeviceName, deviceCode);
-        RtAnalogData rtAnalogData = getOne(queryWrapper);
-        Optional.ofNullable(rtAnalogData).orElseThrow(() -> new BusinessException("设备实时信息不存在"));
         //查询设备
         LambdaQueryWrapper<Device> deviceQuery = Wrappers.lambdaQuery();
         deviceQuery.eq(Device::getDeviceCode, deviceCode);
         Device device = deviceService.getOne(deviceQuery);
         Optional.ofNullable(device).orElseThrow(() -> new BusinessException("设备不存在"));
+
+
+        String table = "rt_analog_data";
+        if (device.getDeviceType().equals("1")){
+            table = "rt_analog_data";
+        }else if (device.getDeviceType().equals("4")){
+            table = "rt_analog_173_data";
+        }
+
+        List<RtAnalogData> rtAnalogDataList = baseMapper.getRtAnalogDataList(deviceCode,table);
+        RtAnalogData rtAnalogData = new RtAnalogData();
+        if (rtAnalogDataList.size()>0){
+            rtAnalogData = rtAnalogDataList.get(0);
+        }else {
+            new BusinessException("设备实时信息不存在");
+        }
+
         //查询sd
         LambdaQueryWrapper<SiteDynamicProperties> sdQuery = Wrappers.lambdaQuery();
         sdQuery.eq(SiteDynamicProperties::getSiteId, device.getSiteId());
@@ -191,6 +242,24 @@ public class RtAnalogDataServiceImpl extends AbstractCrudService<RtAnalogDataMap
         return fillRealScoreDataOne(rtAnalogData, siteDynamicProperties);
     }
 
+//    public RealScoreOneVO realScoreOne(String deviceCode) {
+//        LambdaQueryWrapper<RtAnalogData> queryWrapper = Wrappers.lambdaQuery();
+//        queryWrapper.eq(RtAnalogData::getDeviceName, deviceCode);
+//        RtAnalogData rtAnalogData = getOne(queryWrapper);
+//        Optional.ofNullable(rtAnalogData).orElseThrow(() -> new BusinessException("设备实时信息不存在"));
+//        //查询设备
+//        LambdaQueryWrapper<Device> deviceQuery = Wrappers.lambdaQuery();
+//        deviceQuery.eq(Device::getDeviceCode, deviceCode);
+//        Device device = deviceService.getOne(deviceQuery);
+//        Optional.ofNullable(device).orElseThrow(() -> new BusinessException("设备不存在"));
+//        //查询sd
+//        LambdaQueryWrapper<SiteDynamicProperties> sdQuery = Wrappers.lambdaQuery();
+//        sdQuery.eq(SiteDynamicProperties::getSiteId, device.getSiteId());
+//        SiteDynamicProperties siteDynamicProperties = siteDynamicPropertiesService.getOne(sdQuery);
+//        Optional.ofNullable(siteDynamicProperties).orElseThrow(() -> new BusinessException("sd不存在"));
+//        return fillRealScoreDataOne(rtAnalogData, siteDynamicProperties);
+//    }
+
     @Override
     public RealScoreOneVO fillRealScoreDataOne(RtAnalogData rtAnalogData, SiteDynamicProperties siteDynamicProperties) {
         List<Double> checkList = new ArrayList<>();
@@ -1133,11 +1202,59 @@ public class RtAnalogDataServiceImpl extends AbstractCrudService<RtAnalogDataMap
                 throw new BusinessException("时间错误");
             }
         }
+        LambdaQueryWrapper<Device> queryWrapper1 = Wrappers.lambdaQuery();
+        queryWrapper1.eq(Device::getSiteId,siteId);
+        List<Device> deviceList = deviceService.list(queryWrapper1);
+        List<String> fieldDisplayOne183 = new ArrayList();
+        List<String> fieldDisplayOne171 = new ArrayList();
+        List<String> fieldDisplayOne173 = new ArrayList();
+        if (deviceList.size() > 0) {
+            for(int j = 0; j < deviceList.size(); j++){
+                if (deviceList.get(j).getDeviceType().equals("1")) {
+                    fieldDisplayOne183.add(deviceList.get(j).getDeviceCode());
+                } else if (deviceList.get(j).getDeviceType().equals("3")) {
+                    fieldDisplayOne171.add(deviceList.get(j).getDeviceCode());
+                } else if (deviceList.get(j).getDeviceType().equals("4")) {
+                    fieldDisplayOne173.add(deviceList.get(j).getDeviceCode());
+                }
+            }
+        }
+        List<EvaluationReporVo> evaluationReporVo1 = new ArrayList<>();
+        List<EvaluationReporVo> evaluationReporVo2 = new ArrayList<>();
+        if (fieldDisplayOne183.size()>0){
+            evaluationReporVo1 = baseMapper.getEvaluationReportList(siteId, startTime, endtime,"ht_analog_data",fieldDisplayOne183);
+        }
+        if (fieldDisplayOne173.size()>0){
+            evaluationReporVo2 = baseMapper.getEvaluationReportList(siteId, startTime, endtime,"ht_analog_173_data",fieldDisplayOne173);
+        }
 
-        List<EvaluationReporVo> evaluationReporVo = baseMapper.evaluationReportList(siteId, startTime, endtime);
+        List<EvaluationReporVo> evaluationReporVo = Stream.of(evaluationReporVo1, evaluationReporVo2).flatMap(Collection::stream).distinct().collect(Collectors.toList());
         return fillRealScoreDataTwo(evaluationReporVo);
     }
 
+//    public List<RealScoreVO> evaluationReport(int siteId, Date time, int type) {
+//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+//        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM");
+//        String startTime = null;
+//        String endtime = null;
+//        if (type == 1) {
+//            startTime = sdf.format(time) + " 00:00:00";
+//            endtime = sdf.format(time) + " 23:59:59";
+//        } else {
+//            startTime = sdf1.format(time) + "-01 00:00:00";
+//            String time1 = sdf1.format(time) + "-01";
+//            try {
+//                Date yq = getLastDayOfMonth(sdf.parse(time1));
+//                endtime = sdf.format(yq) + " 23:59:59";
+//            } catch (Exception e) {
+//                throw new BusinessException("时间错误");
+//            }
+//        }
+//
+//        List<EvaluationReporVo> evaluationReporVo = baseMapper.evaluationReportList(siteId, startTime, endtime);
+//        return fillRealScoreDataTwo(evaluationReporVo);
+//    }
+
     /**
      * 计算电压分数2
      *