Przeglądaj źródła

Merge branch 'V0.0.9' of http://10.87.21.221:8000/jzyd_yyds/soc into V0.0.9

zhulu 1 rok temu
rodzic
commit
3954b61f86

Plik diff jest za duży
+ 0 - 0
project_data/sql/0.0.9/soc/soc.sql


+ 5 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/mapper/VideoDaysCheckMapper.java

@@ -5,6 +5,9 @@ import com.xunmei.common.core.domain.video.MediatorVideoDaysCheck;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.Date;
+import java.util.List;
+
 /**
  * <p>
  * 录像机天数检查 Mapper 接口
@@ -17,4 +20,6 @@ import org.apache.ibatis.annotations.Param;
 public interface VideoDaysCheckMapper extends BaseMapper<MediatorVideoDaysCheck> {
 
     Integer selectExceptionCount(@Param("orgId") Long orgId);
+
+    List<MediatorVideoDaysCheck> selectDataList(@Param("orgPath") String orgPath, @Param("startTime") Date startTime);
 }

+ 37 - 26
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotBoardServiceImpl.java

@@ -5,14 +5,13 @@ import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
-import com.alibaba.fastjson2.JSON;
 import com.google.common.collect.Lists;
 import com.xunmei.common.core.constant.CacheConstants;
 import com.xunmei.common.core.constant.SecurityConstants;
 import com.xunmei.common.core.domain.iot.domain.IotDvrDisk;
-import com.xunmei.common.core.domain.iot.domain.IotDvrHardDiskDetectionLog;
 import com.xunmei.common.core.domain.iot.domain.IotSensor;
 import com.xunmei.common.core.domain.mediator.domain.IotAlarmData;
+import com.xunmei.common.core.domain.video.MediatorVideoDaysCheck;
 import com.xunmei.common.core.domain.video.MediatorVideoIntegrityCheckLog;
 import com.xunmei.common.core.enums.CategoryDataEnum;
 import com.xunmei.common.core.enums.iot.SensorType;
@@ -24,7 +23,7 @@ import com.xunmei.common.security.utils.SecurityUtils;
 import com.xunmei.iot.mapper.IotBoardMapper;
 import com.xunmei.iot.mapper.IotDvrChannelMapper;
 import com.xunmei.iot.mapper.IotDvrDiskMapper;
-import com.xunmei.iot.mapper.IotDvrHardDiskDetectionLogMapper;
+import com.xunmei.iot.mapper.VideoDaysCheckMapper;
 import com.xunmei.iot.service.IIotCommonSensorService;
 import com.xunmei.iot.service.IotAlarmDataService;
 import com.xunmei.iot.service.IotBoardService;
@@ -74,7 +73,7 @@ public class IotBoardServiceImpl implements IotBoardService {
     IotAlarmDataService alarmDataService;
 
     @Resource
-    IotDvrHardDiskDetectionLogMapper dvrHardDiskDetectionLogMapper;
+    VideoDaysCheckMapper videoDaysCheckMapper;
     @Resource
     IotDvrDiskMapper iotDvrDiskMapper;
 
@@ -342,6 +341,24 @@ public class IotBoardServiceImpl implements IotBoardService {
             }
         }
         totalData.setDeviceOverview(deviceOverview);
+        this.sensorData(MAP_VALUE, DEVICE_TYPE, orgPath, totalData);
+        //录像文件自检
+        this.selectVideoCheckSelf(orgVO, now, totalData, channelDataOffsetDay);
+
+        final Date startTime = DateUtil.beginOfDay(DateUtil.offsetDay(now, -channelDataOffsetDay));
+        //录像天数存储
+        this.selectVideoDaysStorage(orgPath, startTime, totalData);
+
+        IotBoardTotalData.VideoDiagnostic videoDiagnostic = videoDiagnosisService.selectVideoDiagnostic(orgPath, startTime);
+        totalData.setVideoDiagnostic(videoDiagnostic);
+
+        totalData.setAirConditionerInfo(new IotBoardTotalData.AirConditionerInfo());
+        totalData.setUpsInfo(new IotBoardTotalData.UpsInfo());
+
+        return totalData;
+    }
+
+    private void sensorData(String MAP_VALUE, String DEVICE_TYPE, String orgPath, IotBoardTotalData totalData) {
         //物联设备最近90天的告警数据
         List<Map<String, String>> alarmCountMap = alarmDataService.selectAlarmCount(orgPath);
         //计算alarmCountMap 所有nums的总和
@@ -370,32 +387,26 @@ public class IotBoardServiceImpl implements IotBoardService {
             sensorDataList.add(sensorData);
         }
         totalData.setSensorDetails(sensorDataList);
-        //录像文件自检
-        this.selectVideoCheckSelf(orgVO, now, totalData, channelDataOffsetDay);
+    }
 
-        final Date startTime = DateUtil.beginOfDay(DateUtil.offsetDay(now, -channelDataOffsetDay));
-        //录像天数存储
-        List<Map<String, String>> videoCheckMap = iotBoardMapper.selectVideoDaysStorage(orgPath,startTime);
-        HashMap<Integer, Integer> hashMap = new LinkedHashMap<>();
-        IotBoardTotalData.RecordingStorage storage = new IotBoardTotalData.RecordingStorage();
-        if (!videoCheckMap.isEmpty()) {
-            for (Map<String, String> map : videoCheckMap) {
-                hashMap.put(Integer.parseInt(map.get("planDays")), Integer.parseInt(map.get(MAP_VALUE)));
-            }
-            String string = videoCheckMap.get(0).get("time");
-            storage.setUpdateTime(DateUtil.parseDateTime(string));
+    private void selectVideoDaysStorage(String orgPath, Date startTime, IotBoardTotalData totalData) {
+        List<MediatorVideoDaysCheck> daysCheckList = videoDaysCheckMapper.selectDataList(orgPath, startTime);
+        IotBoardTotalData.RecordingStorage recordingStorage = new IotBoardTotalData.RecordingStorage();
+        totalData.setRecordingStorage(recordingStorage);
+        if (ObjectUtil.isEmpty(daysCheckList)) {
+            return;
         }
 
-        storage.setHashmap(hashMap);
-        totalData.setRecordingStorage(storage);
+        final Optional<MediatorVideoDaysCheck> optional = daysCheckList.stream().max(Comparator.comparing(MediatorVideoDaysCheck::getUpdateTime));
+        optional.ifPresent(daysCheck -> recordingStorage.setUpdateTime(daysCheck.getUpdateTime()));
+        final List<Integer> list = daysCheckList.stream().map(MediatorVideoDaysCheck::getRealDays).collect(Collectors.toList());
+        final long count = list.stream().filter(d -> 30 <= d && d < 90).count();
+        final long count1 = list.stream().filter(d -> 90 <= d).count();
 
-        IotBoardTotalData.VideoDiagnostic videoDiagnostic = videoDiagnosisService.selectVideoDiagnostic(orgPath, startTime);
-        totalData.setVideoDiagnostic(videoDiagnostic);
-
-        totalData.setAirConditionerInfo(new IotBoardTotalData.AirConditionerInfo());
-        totalData.setUpsInfo(new IotBoardTotalData.UpsInfo());
-
-        return totalData;
+        Map<Integer, Integer> map = new HashMap<>();
+        map.put(30, (int) count);
+        map.put(90, (int) count1);
+        recordingStorage.setHashmap(map);
     }
 
     private void selectVideoCheckSelf(SysOrgVO org, Date now, IotBoardTotalData totalData, Integer channelDataOffsetDay) {

+ 9 - 0
soc-modules/soc-modules-iot/src/main/resources/mapper/VideoDaysCheckMapper.xml

@@ -15,4 +15,13 @@
         where dc.org_id = #{orgId}
           and dc.deleted = 0
     </select>
+
+    <select id="selectDataList" resultType="com.xunmei.common.core.domain.video.MediatorVideoDaysCheck">
+        select c.plan_days, c.real_days,c.update_time
+        from mediator_video_days_check c
+                 inner join sys_org o on o.id = c.org_id
+        where o.deleted = 0
+          and c.update_time >= #{startTime}
+          and org_path like concat(#{orgPath}, '%')
+    </select>
 </mapper>

+ 2 - 2
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/OwnershipConverter.java

@@ -28,9 +28,9 @@ public class OwnershipConverter implements Converter<Integer> {
 
     @Override
     public CellData convertToExcelData(Integer s, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
-        if ("1".equals(s)) {
+        if (null != s && s == 1) {
             return new CellData("部分自有+部分租赁");
-        }else if ("2".equals(s)){
+        }else if (null != s && s == 2){
             return new CellData("自有");
         }else {
             return new CellData("租赁");

+ 2 - 4
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysOrgMapper.xml

@@ -1010,15 +1010,13 @@ and
             IFNULL( SUM( a.cash_adding_room_control_count ), 0 ) AS cashAddingRoomControlCount,
             IFNULL( SUM( a.remote_control_count ), 0 ) AS remoteControlCount
         FROM
-            sys_org_extend a
-                LEFT JOIN sys_org b ON a.org_id = b.id
+            ( SELECT * FROM sys_org WHERE type = 10 and is_lock = 0 and deleted = 0 AND path LIKE concat( #{orgPath}, '%' )  ORDER BY create_time DESC LIMIT 0, 1 ) b
+            LEFT JOIN sys_org_extend a ON a.org_id = b.id
         where
             1=1
           and b.type = 10
-/*          and a.remote_control = 1*/
           and b.deleted = 0
           and b.is_lock = 0
-          and b.path LIKE concat(#{orgPath}, '%')
     </select>
     <select id="getDuty" resultType="java.util.Map">
         SELECT

+ 7 - 8
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysPhysicalDefenseConstructionMapper.xml

@@ -50,14 +50,13 @@
 
     <select id="selectListByPath" resultType="com.xunmei.system.dto.SysPhysicalDefenseConstructionDTO">
         select op.*,o.path as orgPath from sys_org o INNER JOIN sys_org_physical_defense_construction op ON o.id = op.org_id
-        <where>
-            <if test="type != null  and type != ''">
-                and op.type = #{type}
-            </if>
-            <if test="orgPath != null  and orgPath != ''">
-                and o.path LIKE concat(#{orgPath}, '%')
-            </if>
-        </where>
+        where o.is_lock != 1 and o.deleted = 0
+        <if test="type != null  and type != ''">
+            and op.type = #{type}
+        </if>
+        <if test="orgPath != null  and orgPath != ''">
+            and o.path LIKE concat(#{orgPath}, '%')
+        </if>
     </select>
 
 

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików