Parcourir la source

web页面查询修改

jingyuanchao il y a 1 an
Parent
commit
957c05f6ee

+ 1 - 2
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotDvrDiskServiceImpl.java

@@ -4,7 +4,6 @@ import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xunmei.common.core.constant.SecurityConstants;
@@ -73,7 +72,7 @@ public class IotDvrDiskServiceImpl extends ServiceImpl<IotDvrDiskMapper, IotDvrD
             SysOrg org = orgService.selectOrgById(pageDto.getOrgId(), SecurityConstants.INNER);
             orgPath = org.getPath();
         }
-        pageDto.setCategoryId(CategoryDataEnum.MONITOR_HOST_DEVICE.getId());
+        //pageDto.setCategoryId(CategoryDataEnum.MONITOR_HOST_DEVICE.getId());
         Page<DvrDiskPageVo> page = pageDto.toPage();
 
         page = baseMapper.selectHostPage(page, pageDto, orgPath);

+ 63 - 6
soc-modules/soc-modules-iot/src/main/resources/mapper/DvrDiskMapper.xml

@@ -45,7 +45,7 @@
             <result column="state" property="state"/>
         </collection>
     </resultMap>
-    <select id="selectHostPage" resultMap="selectHostPageMap">
+   <!-- <select id="selectHostPage" resultMap="selectHostPageMap">
         SELECT
         d.id,
         d.equipment_code AS equipmentCode,
@@ -56,14 +56,14 @@
         o.affiliated_bank,
         d.producer as brand,
         dd.state as netState
-        <!--        dhd.check_status AS `status`,-->
-        <!--        dhd.check_time AS alarmTime,-->
-        <!--        dhd.detail_info as detailInfo-->
+        &lt;!&ndash;        dhd.check_status AS `status`,&ndash;&gt;
+        &lt;!&ndash;        dhd.check_time AS alarmTime,&ndash;&gt;
+        &lt;!&ndash;        dhd.detail_info as detailInfo&ndash;&gt;
         FROM
         iot_device d
         inner  join sys_org o on d.org_id =o.id and o.deleted=0 and o.is_lock='0'
         left join iot_device_detection dd on d.equipment_code =dd.equipment_code
-<!--        LEFT JOIN iot_dvr_hard_disk_detection dhd ON d.equipment_code = dhd.equipment_code-->
+&lt;!&ndash;        LEFT JOIN iot_dvr_hard_disk_detection dhd ON d.equipment_code = dhd.equipment_code&ndash;&gt;
         WHERE
         d.category_id=#{pageDto.categoryId}
         <if test="pageDto.checkSub==true">
@@ -78,6 +78,48 @@
         <if test="pageDto.netState!=null">
             and dd.state=#{pageDto.netState}
         </if>
+        &lt;!&ndash;        <if test="pageDto.status !=null">&ndash;&gt;
+        &lt;!&ndash;            and dhd.`status` = #{pageDto.status}&ndash;&gt;
+        &lt;!&ndash;        </if>&ndash;&gt;
+        &lt;!&ndash;        <if test="pageDto.alarmStartTime !=null">&ndash;&gt;
+        &lt;!&ndash;            and dhd.alarm_time >= #{pageDto.alarmStartTime}&ndash;&gt;
+        &lt;!&ndash;        </if>&ndash;&gt;
+        &lt;!&ndash;        <if test="pageDto.alarmEndTime !=null">&ndash;&gt;
+        &lt;!&ndash;            and #{pageDto.alarmEndTime}>= dhd.`alarm_time`&ndash;&gt;
+        &lt;!&ndash;        </if>&ndash;&gt;
+        and d.deleted=0
+    </select>-->
+    <select id="selectHostPage" resultMap="selectHostPageMap">
+        SELECT
+        d.id,
+        ie.net_address as ip,
+        d.device_code AS equipmentCode,
+        d.device_name AS equipmentName,
+        d.org_name AS orgName,
+        o.affiliated_area,
+        o.affiliated_bank,
+        d.device_product as brand,
+        dd.state as netState
+
+        FROM
+        iot_device_info d
+        inner  join sys_org o on d.org_id =o.id and o.deleted=0 and o.is_lock='0'
+        left join iot_device_detection dd on d.device_code =dd.equipment_code
+        left join iot_device_info_extend ie on d.id =ie.device_id
+        WHERE d.device_type=1
+
+        <if test="pageDto.checkSub==true">
+            and d.org_path like concat(#{orgPath},"%")
+        </if>
+        <if test="pageDto.checkSub==false">
+            and d.org_id = #{pageDto.orgId}
+        </if>
+        <if test="pageDto.hostName!=null and pageDto.hostName!=''">
+            and d.device_name like concat('%', #{pageDto.hostName},'%')
+        </if>
+        <if test="pageDto.netState!=null">
+            and dd.state=#{pageDto.netState}
+        </if>
         <!--        <if test="pageDto.status !=null">-->
         <!--            and dhd.`status` = #{pageDto.status}-->
         <!--        </if>-->
@@ -150,7 +192,7 @@
         order by r.alarm_start_time desc
     </select>
 
-    <select id="diskStatistic" resultType="com.xunmei.iot.vo.dvrDisk.DvrDiskStatisticVo">
+    <!--<select id="diskStatistic" resultType="com.xunmei.iot.vo.dvrDisk.DvrDiskStatisticVo">
         SELECT count(0) AS dvrTotal,
         SUM(dd.count) AS diskTotal,
         SUM(dd.exceptionCount) as diskExceptionCount
@@ -164,6 +206,21 @@
         <if test="pageDto.checkSub==false">
             and d.org_id = #{pageDto.orgId}
         </if>
+    </select>-->
+    <select id="diskStatistic" resultType="com.xunmei.iot.vo.dvrDisk.DvrDiskStatisticVo">
+        SELECT count(0) AS dvrTotal,
+        SUM(dd.count) AS diskTotal,
+        SUM(dd.exceptionCount) as diskExceptionCount
+        FROM iot_device_info d
+        LEFT JOIN (SELECT host_code,count(0) as count,SUM(if(state=1,1,0)) as exceptionCount from iot_dvr_disk WHERE
+        deleted=0 group by host_code) dd on dd.host_code =d.device_code
+        where d.deleted=0 and d.device_type=1
+        <if test="pageDto.checkSub==true">
+            and d.org_path like concat(#{orgPath},"%")
+        </if>
+        <if test="pageDto.checkSub==false">
+            and d.org_id = #{pageDto.orgId}
+        </if>
     </select>
     <select id="selectAppHostPage" resultMap="selectAppHostPageMap">
         SELECT

+ 91 - 2
soc-modules/soc-modules-iot/src/main/resources/mapper/IotDvrChannelMapper.xml

@@ -73,7 +73,7 @@
             <result column="state" property="state"></result>
         </collection>
     </resultMap>
-    <select id="selectPage" resultType="com.xunmei.iot.vo.videoDiagnosis.VideoDiagnosisWebPageVo">
+    <!--<select id="selectPage" resultType="com.xunmei.iot.vo.videoDiagnosis.VideoDiagnosisWebPageVo">
         SELECT DISTINCT
         c.id,
         c.host_code,
@@ -126,12 +126,68 @@
         <if test="pageDto.diagnosisState!=null and pageDto.diagnosisState==2">
             and vdr.id is null
         </if>
+        &lt;!&ndash;        <if test="pageDto.status !=null">&ndash;&gt;
+        &lt;!&ndash;            and dhd.`status` = #{pageDto.status}&ndash;&gt;
+        &lt;!&ndash;        </if>&ndash;&gt;
+    </select>-->
+    <select id="selectPage" resultType="com.xunmei.iot.vo.videoDiagnosis.VideoDiagnosisWebPageVo">
+        SELECT DISTINCT
+        c.id,
+        c.host_code,
+        c.device_code as  channelCode,
+        c.org_name,
+        o.affiliated_area,
+        o.affiliated_bank,
+        d.device_name as hostName,
+        c.device_name as channelName,
+        vic.lose_duration,
+        vdc.plan_days,
+        vdc.real_days,
+        if(vdr.id is
+        null,null,if(vdr.signal_lost+vdr.occlude+vdr.brightness+vdr.color_cast+vdr.snowflake+vdr.stripe+vdr.contrast+vdr.blurry>=1,1,0))
+        as quality
+        from iot_device_info c
+        INNER JOIN iot_device_info d on c.host_code=d.device_code
+        inner  join sys_org o on c.org_id =o.id and o.deleted=0 and o.is_lock='0'
+        left JOIN mediator_video_days_check vdc on c.host_code=vdc.equipment_code and c.device_code=vdc.channel_code
+        left JOIN mediator_video_integrity_check vic on c.host_code=vic.equipment_code and
+        c.device_code=vic.channel_code
+        left JOIN mediator_video_diagnosis_record vdr on c.host_code=vdr.equipment_code and
+        c.device_code=vdr.channel_code
+        where c.deleted=0 and d.deleted=0
+        <if test="pageDto.checkSub==true">
+            and c.org_path like concat(#{orgPath},"%")
+        </if>
+        <if test="pageDto.checkSub==false">
+            and c.org_id = #{pageDto.orgId}
+        </if>
+        <if test="pageDto.hostName!=null and pageDto.hostName!=''">
+            and d.device_name like concat('%', #{pageDto.hostName},'%')
+        </if>
+        <if test="pageDto.channelName!=null and pageDto.channelName!=''">
+            and c.device_name like concat('%', #{pageDto.channelName},'%')
+        </if>
+        <if test="pageDto.integrityState!=null">
+            and vic.status=#{pageDto.integrityState}
+        </if>
+        <if test="pageDto.daysState==0">
+            and vdc.plan_days=vdc.real_days
+        </if>
+        <if test="pageDto.daysState==1">
+            and vdc.plan_days!=vdc.real_days
+        </if>
+        <if test="pageDto.diagnosisState!=null and pageDto.diagnosisState!=2">
+            and vdr.is_alarm=#{pageDto.diagnosisState}
+        </if>
+        <if test="pageDto.diagnosisState!=null and pageDto.diagnosisState==2">
+            and vdr.id is null
+        </if>
         <!--        <if test="pageDto.status !=null">-->
         <!--            and dhd.`status` = #{pageDto.status}-->
         <!--        </if>-->
     </select>
 
-    <select id="diagnosisDetail" resultMap="diagnosisDetailMap">
+    <!--<select id="diagnosisDetail" resultMap="diagnosisDetailMap">
         SELECT d.equipment_name        as hostName,
                c.channel_name          as channelName,
                c.channel_addr          as channelIp,
@@ -164,6 +220,39 @@
                            ON c.host_code = vdr.equipment_code AND c.channel_code = vdr.channel_code
         WHERE c.host_code = #{hostCode}
           and c.channel_code = #{channelCode}
+    </select>-->
+    <select id="diagnosisDetail" resultMap="diagnosisDetailMap">
+        SELECT d.device_name        as hostName,
+               c.device_name          as channelName,
+               vdr.update_time         as quality_update_time,
+               vdr.signal_lost         as quality_signal_lost,
+               vdr.occlude             as quality_occlude,
+               vdr.brightness          as quality_brightness,
+               vdr.color_cast          as quality_colorCast,
+               vdr.snowflake           as quality_snowflake,
+               vdr.stripe              as quality_stripe,
+               vdr.contrast            as quality_contrast,
+               vdr.blurry              as quality_blurry,
+               vdr.img_url             as quality_image,
+               vic.record_date         as integrity_record_date,
+               vic.lose_duration       as integrity_lose_duration,
+               vic.lose_span           as integrity_lose_span,
+               vic.check_span          as integrity_check_span,
+               vic.update_time         as integrity_update_time,
+               vic.status              as integrity_status,
+               vdc.plan_days           as storage_plan_days,
+               vdc.real_days           as storage_real_days,
+               vdc.earliest_video_time as storage_earliest_video_time
+        FROM iot_device_info c
+                 INNER JOIN iot_device_info d ON c.host_code = d.device_code
+                 LEFT JOIN mediator_video_days_check vdc
+                           ON c.host_code = vdc.equipment_code AND c.device_code = vdc.channel_code
+                 LEFT JOIN mediator_video_integrity_check vic
+                           ON c.host_code = vic.equipment_code AND c.device_code = vic.channel_code
+                 LEFT JOIN mediator_video_diagnosis_record vdr
+                           ON c.host_code = vdr.equipment_code AND c.device_code = vdr.channel_code
+        WHERE c.host_code = #{hostCode}
+          and c.device_code = #{channelCode}
     </select>
 
     <select id="selectAppChannels" resultType="com.xunmei.iot.vo.videoDiagnosis.VideoDiagnosisAppPageChannelVo">