From 8febea78af8515def606491b3373c16db7d54941 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期三, 25 九月 2024 18:34:49 +0800
Subject: [PATCH] 数据中心部级标签查询条件

---
 ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml                       |    4 
 ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java |  248 ++++++++++++++-----------------------------------
 ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml                      |   12 +-
 3 files changed, 81 insertions(+), 183 deletions(-)

diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java
index da8133f..ed9dc88 100644
--- a/ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java
@@ -214,24 +214,16 @@
 
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("ip.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("macdz.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         List<Document> dList3 = new ArrayList<>(2);
         dList3.add(new Document("latitude.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList3.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList3);
         List<Document> dList4 = new ArrayList<>(2);
         dList4.add(new Document("longitude.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList4.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList4);
         Document ipErrFilter = new Document("$and", dList1);
         Document macdzErrFilter = new Document("$and", dList2);
         Document latitudeErrFilter = new Document("$and", dList3);
@@ -296,24 +288,16 @@
 
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("ip.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("macdz.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         List<Document> dList3 = new ArrayList<>(2);
         dList3.add(new Document("latitude.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList3.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList3);
         List<Document> dList4 = new ArrayList<>(2);
         dList4.add(new Document("longitude.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList4.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList4);
         Document ipErrFilter = new Document("$and", dList1);
         Document macdzErrFilter = new Document("$and", dList2);
         Document latitudeErrFilter = new Document("$and", dList3);
@@ -365,7 +349,6 @@
      */
     @Override
     public Result videoAssessmentFileRatio(DataCenterQuery params) {
-        // TODO 鏂板涓�寮犺〃璁板綍姣忔鐨勬。妗堣�冩牳
         List<String> likeFileds = Arrays.asList("ip.showValue", "name.showValue", "serialNumber.showValue");
         Query query = MongoUtil.getQuery(params, TIME_FIELD, likeFileds, null);
 
@@ -379,24 +362,16 @@
 
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("ip.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("macdz.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         List<Document> dList3 = new ArrayList<>(2);
         dList3.add(new Document("latitude.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList3.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList3);
         List<Document> dList4 = new ArrayList<>(2);
         dList4.add(new Document("longitude.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList4.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList4);
         Document ipErrFilter = new Document("$and", dList1);
         Document macdzErrFilter = new Document("$and", dList2);
         Document latitudeErrFilter = new Document("$and", dList3);
@@ -450,9 +425,7 @@
         List<String> resultCount = status.stream().map(item -> {
             List<Document> dList = new ArrayList<>(2);
             dList.add(new Document("recordStatus", new Document("$eq", item)));
-            if (params.getDataType().equals(1)) {
-                dList.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-            }
+            setTag(params, dList);
             Document filter = new Document("$and", dList);
             // 鏋勫缓鑱氬悎绠¢亾
             List<Document> pipeline = Arrays.asList(
@@ -513,9 +486,7 @@
             List<Document> dList = new ArrayList<>(4);
             dList.add(new Document("deptTag", new Document("$eq", Boolean.TRUE)));
             dList.add(new Document("recordStatus",  new Document("$eq", item)));
-            if (params.getDataType().equals(1)) {
-                dList.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-            }
+            setTag(params,dList);
             Document filter = new Document("$and", dList);
             // 鏋勫缓鑱氬悎绠¢亾
             List<Document> pipeline = Arrays.asList(
@@ -576,11 +547,7 @@
             List<Document> dList = new ArrayList<>(4);
             dList.add(new Document("importantTag", new Document("$eq", Boolean.TRUE)));
             dList.add(new Document("recordStatus", new Document("$eq", item)));
-            if (params.getDataType().equals(1)) {
-                dList.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-            }else if(params.getDataType().equals(2)){
-                dList.add(new Document("deptTag", new Document("$eq", Boolean.TRUE)));
-            }
+            setTag(params,dList);
             Document filter = new Document("$and", dList);
             // 鏋勫缓鑱氬悎绠¢亾
             List<Document> pipeline = Arrays.asList(
@@ -665,27 +632,19 @@
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("importantTag", Boolean.TRUE));
         dList1.add(new Document("osdNameCorrect", new Document("$eq", 1)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("importantTag", Boolean.TRUE));
         dList2.add(new Document("osdNameCorrect", new Document("$eq", -1)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         List<Document> dList3 = new ArrayList<>(2);
         dList3.add(new Document("importantTag", Boolean.TRUE));
         dList3.add(new Document("osdTimeCorrect", new Document("$eq", 1)));
-        if (params.getDataType().equals(1)) {
-            dList3.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList3);
         List<Document> dList4 = new ArrayList<>(2);
         dList4.add(new Document("importantTag", Boolean.TRUE));
         dList4.add(new Document("osdTimeCorrect", new Document("$eq", -1)));
-        if (params.getDataType().equals(1)) {
-            dList4.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList4);
         Document osdNameFilter = new Document("$and", dList1);
         Document osdNameErrFilter = new Document("$and", dList2);
         Document osdTimeFilter = new Document("$and", dList3);
@@ -777,15 +736,11 @@
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("importantTag", Boolean.TRUE));
         dList1.add(new Document("osdTimeCorrect", new Document("$eq", 1)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("importantTag", Boolean.TRUE));
         dList2.add(new Document("osdTimeCorrect", new Document("$eq", -1)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         Document osdTimeFilter = new Document("$and", dList1);
         Document osdTimeErrFilter = new Document("$and", dList2);
         List<Document> lists = Arrays.asList(osdTimeFilter, osdTimeErrFilter);
@@ -849,27 +804,19 @@
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("importantTag", Boolean.TRUE));
         dList1.add(new Document("resultType", new Document("$eq", 1)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("importantTag", Boolean.TRUE));
         dList2.add(new Document("resultType", new Document("$eq", 2)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         List<Document> dList3 = new ArrayList<>(2);
         dList3.add(new Document("importantTag", Boolean.TRUE));
         dList3.add(new Document("resultType", new Document("$eq", 3)));
-        if (params.getDataType().equals(1)) {
-            dList3.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList3);
         List<Document> dList4 = new ArrayList<>(2);
         dList4.add(new Document("importantTag", Boolean.TRUE));
         dList4.add(new Document("resultType", new Document("$eq", 4)));
-        if (params.getDataType().equals(1)) {
-            dList4.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList4);
         Document normalFilter = new Document("$and", dList1);
         Document noDataFilter = new Document("$and", dList2);
         Document trFilter = new Document("$and", dList3);
@@ -967,24 +914,16 @@
 
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("ip.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("macdz.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         List<Document> dList3 = new ArrayList<>(2);
         dList3.add(new Document("latitude.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList3.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList3);
         List<Document> dList4 = new ArrayList<>(2);
         dList4.add(new Document("longitude.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList4.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList4);
         Document ipErrFilter = new Document("$and", dList1);
         Document macdzErrFilter = new Document("$and", dList2);
         Document latitudeErrFilter = new Document("$and", dList3);
@@ -1048,24 +987,16 @@
 
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("lalType", new Document("$eq", 1)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("lalType", new Document("$eq", 2)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         List<Document> dList3 = new ArrayList<>(2);
         dList3.add(new Document("lalType", new Document("$eq", 3)));
-        if (params.getDataType().equals(1)) {
-            dList3.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList3);
         List<Document> dList4 = new ArrayList<>(2);
         dList4.add(new Document("lalType", new Document("$eq", 4)));
-        if (params.getDataType().equals(1)) {
-            dList4.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList4);
         Document ipErrFilter = new Document("$and", dList1);
         Document macdzErrFilter = new Document("$and", dList2);
         Document latitudeErrFilter = new Document("$and", dList3);
@@ -1202,19 +1133,13 @@
 
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("snapResult", new Document("$eq", 1)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("snapResult", new Document("$eq", 2)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         List<Document> dList3 = new ArrayList<>(2);
         dList3.add(new Document("snapResult", new Document("$eq", 4)));
-        if (params.getDataType().equals(1)) {
-            dList3.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList3);
         Document ipErrFilter = new Document("$and", dList1);
         Document macdzErrFilter = new Document("$and", dList2);
         Document longitudeErrFilter = new Document("$and", dList3);
@@ -1380,24 +1305,16 @@
 
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("resultType", new Document("$eq", 1)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("resultType", new Document("$eq", 2)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         List<Document> dList3 = new ArrayList<>(2);
         dList3.add(new Document("resultType", new Document("$eq", 3)));
-        if (params.getDataType().equals(1)) {
-            dList3.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList3);
         List<Document> dList4 = new ArrayList<>(2);
         dList4.add(new Document("resultType", new Document("$eq", 4)));
-        if (params.getDataType().equals(1)) {
-            dList4.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList4);
         Document normalFilter = new Document("$and", dList1);
         Document noDataFilter = new Document("$and", dList2);
         Document trFilter = new Document("$and", dList3);
@@ -1498,24 +1415,16 @@
 
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("ip.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("macdz.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         List<Document> dList3 = new ArrayList<>(2);
         dList3.add(new Document("latitude.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList3.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList3);
         List<Document> dList4 = new ArrayList<>(2);
         dList4.add(new Document("longitude.error", new Document("$eq", Boolean.TRUE)));
-        if (params.getDataType().equals(1)) {
-            dList4.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList4);
         Document ipErrFilter = new Document("$and", dList1);
         Document macdzErrFilter = new Document("$and", dList2);
         Document latitudeErrFilter = new Document("$and", dList3);
@@ -1579,24 +1488,16 @@
 
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("lalType", new Document("$eq", 1)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("lalType", new Document("$eq", 2)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         List<Document> dList3 = new ArrayList<>(2);
         dList3.add(new Document("lalType", new Document("$eq", 3)));
-        if (params.getDataType().equals(1)) {
-            dList3.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList3);
         List<Document> dList4 = new ArrayList<>(2);
         dList4.add(new Document("lalType", new Document("$eq", 4)));
-        if (params.getDataType().equals(1)) {
-            dList4.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList4);
         Document ipErrFilter = new Document("$and", dList1);
         Document macdzErrFilter = new Document("$and", dList2);
         Document latitudeErrFilter = new Document("$and", dList3);
@@ -1660,24 +1561,16 @@
 
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("lalType", new Document("$eq", 1)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("lalType", new Document("$eq", 2)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         List<Document> dList3 = new ArrayList<>(2);
         dList3.add(new Document("lalType", new Document("$eq", 3)));
-        if (params.getDataType().equals(1)) {
-            dList3.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList3);
         List<Document> dList4 = new ArrayList<>(2);
         dList4.add(new Document("lalType", new Document("$eq", 4)));
-        if (params.getDataType().equals(1)) {
-            dList4.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList4);
         Document ipErrFilter = new Document("$and", dList1);
         Document macdzErrFilter = new Document("$and", dList2);
         Document latitudeErrFilter = new Document("$and", dList3);
@@ -1742,19 +1635,13 @@
 
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("snapResult", new Document("$eq", 1)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("snapResult", new Document("$eq", 2)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         List<Document> dList3 = new ArrayList<>(2);
         dList3.add(new Document("snapResult", new Document("$eq", 4)));
-        if (params.getDataType().equals(1)) {
-            dList3.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList3);
         Document ipErrFilter = new Document("$and", dList1);
         Document macdzErrFilter = new Document("$and", dList2);
         Document longitudeErrFilter = new Document("$and", dList3);
@@ -1818,19 +1705,13 @@
 
         List<Document> dList1 = new ArrayList<>(2);
         dList1.add(new Document("snapResult", new Document("$eq", 1)));
-        if (params.getDataType().equals(1)) {
-            dList1.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList1);
         List<Document> dList2 = new ArrayList<>(2);
         dList2.add(new Document("snapResult", new Document("$eq", 2)));
-        if (params.getDataType().equals(1)) {
-            dList2.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList2);
         List<Document> dList3 = new ArrayList<>(2);
         dList3.add(new Document("snapResult", new Document("$eq", 4)));
-        if (params.getDataType().equals(1)) {
-            dList3.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
-        }
+        setTag(params,dList3);
         Document ipErrFilter = new Document("$and", dList1);
         Document macdzErrFilter = new Document("$and", dList2);
         Document longitudeErrFilter = new Document("$and", dList3);
@@ -1935,4 +1816,17 @@
         DF.setDecimalSeparatorAlwaysShown(false);
         return DF.format(rate) + "%";
     }
+
+    /**
+     * 璁剧疆鏍囩鎼滅储鏉′欢
+     * @param params
+     * @param dList
+     */
+    private void setTag(DataCenterQuery params, List<Document> dList) {
+        if (params.getDataType().equals(1)) {
+            dList.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
+        } else if (params.getDataType().equals(2)) {
+            dList.add(new Document("deptTag", new Document("$eq", Boolean.TRUE)));
+        }
+    }
 }
diff --git a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
index a9e920f..93f3d4a 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
@@ -439,7 +439,7 @@
             COUNT(p1.id) - COUNT(p2.id) AS normalNum
         FROM t_monitor
         LEFT JOIN t_yw_point p1 ON t_monitor.serial_number = p1.serial_number <if test="dataScope == 1"> AND p1.province_tag = 1 </if><if test="dataScope == 3"> AND p1.dept_tag = 1 </if><if test="deptId != null"> AND p1.dept_id = #{deptId} </if>
-        LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.recovery = 1 AND p1.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 1 </if><if test="dataScope == 3"> AND p2.dept_tag = 1 </if><if test="deptId != null"> AND p2.dept_id = #{deptId} </if>
+        LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.online = 0 AND p1.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 1 </if><if test="dataScope == 3"> AND p2.dept_tag = 1 </if><if test="deptId != null"> AND p2.dept_id = #{deptId} </if>
         WHERE INSTR(camera_fun_type, 1)
         UNION ALL
         SELECT
@@ -449,7 +449,7 @@
             COUNT(p1.id) - COUNT(p2.id) AS normalNum
         FROM t_monitor
         LEFT JOIN t_yw_point p1 ON t_monitor.serial_number = p1.serial_number <if test="dataScope == 1"> AND p1.province_tag = 1 </if><if test="dataScope == 3"> AND p1.dept_tag = 1 </if><if test="deptId != null"> AND p1.dept_id = #{deptId} </if>
-        LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.recovery = 1 AND p1.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = '1' </if><if test="dataScope == 3"> AND p2.dept_tag = 1 </if><if test="deptId != null"> AND p2.dept_id = #{deptId} </if>
+        LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.online = 0 AND p1.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = '1' </if><if test="dataScope == 3"> AND p2.dept_tag = 1 </if><if test="deptId != null"> AND p2.dept_id = #{deptId} </if>
         WHERE INSTR(camera_fun_type, 2)
         UNION ALL
         SELECT
@@ -459,7 +459,7 @@
             COUNT(p1.id) - COUNT(p2.id) AS normalNum
         FROM t_monitor
         LEFT JOIN t_yw_point p1 ON t_monitor.serial_number = p1.serial_number <if test="dataScope == 1"> AND p1.province_tag = 1 </if><if test="dataScope == 3"> AND p1.dept_tag = 1 </if><if test="deptId != null"> AND p1.dept_id = #{deptId} </if>
-        LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.recovery = 1 AND p1.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 1 </if><if test="dataScope == 3"> AND p2.dept_tag = 1 </if><if test="deptId != null"> AND p2.dept_id = #{deptId} </if>
+        LEFT JOIN t_yw_point p2 ON t_monitor.serial_number = p2.serial_number AND p2.online = 0 AND p1.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 1 </if><if test="dataScope == 3"> AND p2.dept_tag = 1 </if><if test="deptId != null"> AND p2.dept_id = #{deptId} </if>
         WHERE INSTR(camera_fun_type, 3)
     </select>
     <select id="monitorRate" resultType="com.ycl.platform.domain.vo.screen.MonitorRateVO">
@@ -476,7 +476,7 @@
                 FROM
                     sys_dept d
                         LEFT JOIN t_yw_point p ON p.dept_id = d.dept_id AND p.deleted = 0 <if test="dataScope == 1"> AND p.province_tag = 1 </if><if test="dataScope == 3"> AND p.dept_tag = 1 </if>
-                        LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.recovery = 1 AND p.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 1 </if><if test="dataScope == 3"> AND p2.dept_tag = 1 </if>
+                        LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.online = 0 AND p.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 1 </if><if test="dataScope == 3"> AND p2.dept_tag = 1 </if>
                         LEFT JOIN t_monitor m ON m.serial_number = p.serial_number AND INSTR(m.camera_fun_type, 3)
                         LEFT JOIN t_monitor m2 ON m2.serial_number = p2.serial_number AND INSTR(m2.camera_fun_type, 3)
                 WHERE d.del_flag = 0 AND d.area IS NOT NULL
@@ -494,7 +494,7 @@
                 FROM
                     sys_dept d
                         LEFT JOIN t_yw_point p ON p.dept_id = d.dept_id AND p.deleted = 0 <if test="dataScope == 1"> AND p.province_tag = 1 </if><if test="dataScope == 3"> AND p.dept_tag = 1 </if>
-                        LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.recovery = 1 AND p.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 1 </if><if test="dataScope == 3"> AND p2.dept_tag = 1 </if>
+                        LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.online = 0 AND p.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 1 </if><if test="dataScope == 3"> AND p2.dept_tag = 1 </if>
                         LEFT JOIN t_monitor m ON m.serial_number = p.serial_number AND INSTR(m.camera_fun_type, 2)
                         LEFT JOIN t_monitor m2 ON m2.serial_number = p2.serial_number AND INSTR(m2.camera_fun_type, 2)
                 WHERE d.del_flag = 0 AND d.area IS NOT NULL
@@ -512,7 +512,7 @@
                 FROM
                     sys_dept d
                         LEFT JOIN t_yw_point p ON p.dept_id = d.dept_id AND p.deleted = 0 <if test="dataScope == 1"> AND p.province_tag = 1 </if><if test="dataScope == 3"> AND p.dept_tag = 1 </if>
-                        LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.recovery = 1 AND p.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 1 </if><if test="dataScope == 3"> AND p2.dept_tag = 1 </if>
+                        LEFT JOIN t_yw_point p2 ON p2.dept_id = d.dept_id AND p2.deleted = 0 AND p2.online = 0 AND p.id = p2.id <if test="dataScope == 1"> AND p2.province_tag = 1 </if><if test="dataScope == 3"> AND p2.dept_tag = 1 </if>
                         LEFT JOIN t_monitor m ON m.serial_number = p.serial_number AND INSTR(m.camera_fun_type, 1)
                         LEFT JOIN t_monitor m2 ON m2.serial_number = p2.serial_number AND INSTR(m2.camera_fun_type, 1)
                 WHERE d.del_flag = 0 AND d.area IS NOT NULL
diff --git a/ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml
index ce49da5..7a35194 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/YwPointMapper.xml
@@ -110,6 +110,9 @@
             <if test="query.dataType == 1">
                 AND p.province_tag = 1
             </if>
+            <if test="query.dataType == 2">
+                AND p.dept_tag = 1
+            </if>
             <choose>
                 <when test="query.deptTag == 1">
                     AND dept_tag = 1
@@ -151,6 +154,7 @@
                                                         FROM sys_config
                                                         WHERE config_key = 'operation.and.maintenance.expiration.warning.time')
         ORDER BY end_time
+        limit 50
         ]]>
     </select>
 

--
Gitblit v1.8.0