فهرست منبع

设备监测模块设备报表、运行状态统计 更新

jichaobo 4 سال پیش
والد
کامیت
4c205a0e19

+ 4 - 0
fiveep-persistence/src/main/java/com/bizmatics/persistence/mapper/RtSwitchDataMapper.java

@@ -1,10 +1,12 @@
 package com.bizmatics.persistence.mapper;
 
+import com.bizmatics.model.AlarmPower;
 import com.bizmatics.model.RtSwitchData;
 import com.bizmatics.common.mvc.base.CrudMapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -26,4 +28,6 @@ public interface RtSwitchDataMapper extends CrudMapper<RtSwitchData> {
 
     Integer getOffCountMMap(@Param("siteId") Integer siteId);
 
+    List<AlarmPower> getLoopStatusListMap(@Param("siteId") Integer siteId);
+
 }

+ 21 - 2
fiveep-persistence/src/main/resources/mapper/mysql/RtSwitchDataMapper.xml

@@ -80,7 +80,7 @@
             and ap.meas_name = 'LoadLive'
             and ap.digital_value = 1
             and d.enable = 1
-            and to_days(ap.sending_time) = to_days(now())
+            and to_days(ap.soe_time) = to_days(now())
             <if test="siteId != null and siteId != 0">
                 and us.site_id = #{siteId}
             </if>
@@ -97,10 +97,29 @@
             and ap.meas_name = 'LoadLive'
             and ap.digital_value = 1
             and d.enable = 1
-            and DATE_FORMAT( sending_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
+            and DATE_FORMAT( soe_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
             <if test="siteId != null and siteId != 0">
                 and us.site_id = #{siteId}
             </if>
         </where>
     </select>
+
+    <select id="getLoopStatusListMap" resultType="com.bizmatics.model.AlarmPower">
+        select
+        *
+        from user_site as us
+        inner join device as d
+        on us.site_id = d.site_id
+        inner join alarm_power as rsd
+        on d.device_code = rsd.device_code
+        <where>
+            and d.enable = 1
+            and rsd.meas_name='LoadLive'
+            and to_days(rsd.soe_time) = to_days(now())
+            <if test="siteId != null and siteId != 0">
+                and us.site_id = #{siteId}
+            </if>
+        </where>
+        order by rsd.soe_time asc
+    </select>
 </mapper>

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

@@ -200,7 +200,7 @@ public class RtAnalogDataServiceImpl extends AbstractCrudService<RtAnalogDataMap
                     }
                 }
                 if (days<=24){
-                    map.put("dataTime",rtAnalogData.getDataTime());
+                    map.put("dataTime",DateUtils.format(rtAnalogData.getDataTime(),"MM-dd HH:mm"));
                 }else if (days<360&&days>24){
                     map.put("dataTime", DateUtils.format(rtAnalogData.getDataTime(),"MM-dd HH:mm"));
                 }else if (days>=360){
@@ -262,7 +262,7 @@ public class RtAnalogDataServiceImpl extends AbstractCrudService<RtAnalogDataMap
                 Map<String,Object> map9 = new HashMap<>();
                 HtAnalogData rtAnalogData = (HtAnalogData)rtAnalogDataList.get(i);
                 if (days<=24){
-                    map.put("dataTime",rtAnalogData.getDataTime());
+                    map.put("dataTime",DateUtils.format(rtAnalogData.getDataTime(),"MM-dd HH:mm"));
                 }else if (days<360&&days>24){
                     map.put("dataTime", DateUtils.format(rtAnalogData.getDataTime(),"MM-dd HH:mm"));
                 }else if (days>=360){

+ 14 - 0
fiveep-service/src/main/java/com/bizmatics/service/impl/RtSwitchDataServiceImpl.java

@@ -1,5 +1,6 @@
 package com.bizmatics.service.impl;
 
+import com.bizmatics.model.AlarmPower;
 import com.bizmatics.model.RtSwitchData;
 import com.bizmatics.persistence.mapper.AlarmPowerMapper;
 import com.bizmatics.persistence.mapper.RtSwitchDataMapper;
@@ -45,10 +46,23 @@ public class RtSwitchDataServiceImpl extends AbstractCrudService<RtSwitchDataMap
         Object value = radMap.get("LoadLive");
         int day_count = baseMapper.getOffCountDMap(siteId);
         int month_count = baseMapper.getOffCountMMap(siteId);
+        List<AlarmPower> duration_list = baseMapper.getLoopStatusListMap(siteId);
+        long minute=0;
+        if (duration_list.size()>2){
+            for (int i = 0; i < duration_list.size(); i++) {
+                if (duration_list.get(i).getDigitalValue()==0){
+                    long diff = duration_list.get(i).getSoeTime().getTime()-duration_list.get(i-1).getSoeTime().getTime();
+                    minute += diff / (1000 * 60);
+//                minute = diff % (1000 * 24 * 60 * 60) % (1000 * 60 * 60) / (1000 * 60);
+                }
+            }
+        }
+
         Map<String,Object> map = new HashMap<>();
         map.put("LoadLive",value);
         map.put("day_count",day_count);
         map.put("month_count",month_count);
+        map.put("minute",minute);
         list.add(map);