From a09c636267ea9e37296fa58d6619e43644e9eacd Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 06 九月 2024 00:18:06 +0800
Subject: [PATCH] 数据中心分省厅

---
 ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java |  583 +++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 477 insertions(+), 106 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 39fb39a..f7b2e36 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
@@ -18,6 +18,7 @@
 import com.ycl.system.page.PageUtil;
 import com.ycl.utils.DateUtils;
 import com.ycl.utils.MongoUtil;
+import constant.CheckConstants;
 import lombok.RequiredArgsConstructor;
 import org.apache.commons.collections.CollectionUtils;
 import org.bson.Document;
@@ -30,6 +31,7 @@
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.text.DecimalFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -52,6 +54,8 @@
 
 
     private final static String TIME_FIELD = "mongoCreateTime";
+
+    private static DecimalFormat DF = new DecimalFormat("#.####");
 
     /**
      * 瑙嗛锛氱偣浣嶅湪绾跨巼
@@ -86,7 +90,7 @@
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
         HashMap<String, Object> map = new HashMap<>();
-        map.put("count", Arrays.asList(distinctCount + "",onlineRate + "%"));
+        map.put("count", Arrays.asList(distinctCount + "",this.remove0(onlineRate)));
         map.put("list", resultList);
         return Result.ok().data(map).total(total);
     }
@@ -112,7 +116,12 @@
         // 缁熻鏁伴噺
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("uy_online");
-        Document filter = new Document("deptTag", new Document("$eq", Boolean.TRUE));
+        List<Document> dList = new ArrayList<>(2);
+        dList.add(new Document("deptTag", new Document("$eq", Boolean.TRUE)));
+        if (params.getDataType().equals(1)) {
+            dList.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
+        }
+        Document filter = new Document("$and", dList);
         // 鏋勫缓鑱氬悎绠¢亾
         List<Document> pipeline = Arrays.asList(
                 // 鍙閮ㄧ骇鐨�
@@ -131,6 +140,7 @@
         Date now = new Date();
         List<CheckIndexVideo> videoList = new LambdaQueryChainWrapper<>(checkIndexVideoService.getBaseMapper())
                 .select(CheckIndexVideo::getMinistrySiteOnline)
+                .eq(params.getDataType().equals(1), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -140,7 +150,7 @@
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
         HashMap<String, Object> map = new HashMap<>();
-        map.put("count", Arrays.asList(uniqueDeviceIdCount + "", onlineRate + "%"));
+        map.put("count", Arrays.asList(uniqueDeviceIdCount + "", this.remove0(onlineRate)));
         map.put("list", resultList);
         return Result.ok().data(map).total(total);
     }
@@ -163,7 +173,13 @@
         // 缁熻鏁伴噺
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("uy_online");
-        Document filter = new Document("importantTag", new Document("$eq", Boolean.TRUE));
+
+        List<Document> dList = new ArrayList<>(2);
+        dList.add(new Document("importantTag", new Document("$eq", Boolean.TRUE)));
+        if (params.getDataType().equals(1)) {
+            dList.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
+        }
+        Document filter = new Document("$and", dList);
         // 鏋勫缓鑱氬悎绠¢亾
         List<Document> pipeline = Arrays.asList(
                 new Document("$match", filter),
@@ -182,6 +198,7 @@
         Date now = new Date();
         List<CheckIndexVideo> videoList = new LambdaQueryChainWrapper<>(checkIndexVideoService.getBaseMapper())
                 .select(CheckIndexVideo::getKeySiteOnline)
+                .eq(params.getDataType().equals(1), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -191,7 +208,7 @@
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
         HashMap<String, Object> map = new HashMap<>();
-        map.put("count", Arrays.asList(uniqueDeviceIdCount + "", onlineRate + "%"));
+        map.put("count", Arrays.asList(uniqueDeviceIdCount + "", this.remove0(onlineRate)));
         map.put("list", resultList);
         return Result.ok().data(map).total(total);
     }
@@ -214,7 +231,13 @@
         // 缁熻鏁伴噺
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("uy_online");
-        Document filter = new Document("importantCommandImageTag", new Document("$eq", Boolean.TRUE));
+
+        List<Document> dList = new ArrayList<>(2);
+        dList.add(new Document("importantCommandImageTag", new Document("$eq", Boolean.TRUE)));
+        if (params.getDataType().equals(1)) {
+            dList.add(new Document("provinceTag", new Document("$eq", Boolean.TRUE)));
+        }
+        Document filter = new Document("$and", dList);
         // 鏋勫缓鑱氬悎绠¢亾
         List<Document> pipeline = Arrays.asList(
                 new Document("$match", filter),
@@ -233,6 +256,7 @@
         Date now = new Date();
         List<CheckIndexVideo> videoList = new LambdaQueryChainWrapper<>(checkIndexVideoService.getBaseMapper())
                 .select(CheckIndexVideo::getKeyCommandImageOnline)
+                .eq(params.getDataType().equals(1), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -242,7 +266,7 @@
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
         HashMap<String, Object> map = new HashMap<>();
-        map.put("count", Arrays.asList(uniqueDeviceIdCount + "", onlineRate + "%"));
+        map.put("count", Arrays.asList(uniqueDeviceIdCount + "", this.remove0(onlineRate)));
         map.put("list", resultList);
         return Result.ok().data(map).total(total);
     }
@@ -266,10 +290,30 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("uy_monitor_qualify");
 
-        Document ipErrFilter = new Document("ip.error", true);
-        Document macdzErrFilter = new Document("macdz.error", true);
-        Document latitudeErrFilter = new Document("latitude.error", true);
-        Document longitudeErrFilter = new Document("longitude.error", true);
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document ipErrFilter = new Document("$and", dList1);
+        Document macdzErrFilter = new Document("$and", dList2);
+        Document latitudeErrFilter = new Document("$and", dList3);
+        Document longitudeErrFilter = new Document("$and", dList4);
 
         List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter);
         List<String> rList = lists.stream().map(filter -> {
@@ -293,6 +337,7 @@
         Date now = new Date();
         List<CheckIndexVideo> videoList = new LambdaQueryChainWrapper<>(checkIndexVideoService.getBaseMapper())
                 .select(CheckIndexVideo::getMonitorRegistration)
+                .eq(params.getDataType().equals(1), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -301,7 +346,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -327,10 +372,30 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("uy_monitor_qualify");
 
-        Document ipErrFilter = new Document("ip.error", true);
-        Document macdzErrFilter = new Document("macdz.error", true);
-        Document latitudeErrFilter = new Document("latitude.error", true);
-        Document longitudeErrFilter = new Document("longitude.error", true);
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document ipErrFilter = new Document("$and", dList1);
+        Document macdzErrFilter = new Document("$and", dList2);
+        Document latitudeErrFilter = new Document("$and", dList3);
+        Document longitudeErrFilter = new Document("$and", dList4);
 
         List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter);
         List<String> rList = lists.stream().map(filter -> {
@@ -354,6 +419,7 @@
         Date now = new Date();
         List<CheckIndexVideo> videoList = new LambdaQueryChainWrapper<>(checkIndexVideoService.getBaseMapper())
                 .select(CheckIndexVideo::getMonitorQualification)
+                .eq(params.getDataType().equals(1), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -362,7 +428,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -389,10 +455,30 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("uy_monitor_qualify");
 
-        Document ipErrFilter = new Document("ip.error", true);
-        Document macdzErrFilter = new Document("macdz.error", true);
-        Document latitudeErrFilter = new Document("latitude.error", true);
-        Document longitudeErrFilter = new Document("longitude.error", true);
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document ipErrFilter = new Document("$and", dList1);
+        Document macdzErrFilter = new Document("$and", dList2);
+        Document latitudeErrFilter = new Document("$and", dList3);
+        Document longitudeErrFilter = new Document("$and", dList4);
 
         List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter);
         List<String> rList = lists.stream().map(filter -> {
@@ -440,7 +526,12 @@
         MongoCollection<Document> collection = database.getCollection("uy_record_meta_d_sum");
         List<Integer> status = Arrays.asList(1, 0, -1);
         List<String> resultCount = status.stream().map(item -> {
-            Document filter = new Document("recordStatus", 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)));
+            }
+            Document filter = new Document("$and", dList);
             // 鏋勫缓鑱氬悎绠¢亾
             List<Document> pipeline = Arrays.asList(
                     new Document("$match", filter),
@@ -461,6 +552,7 @@
         Date now = new Date();
         List<CheckIndexVideo> videoList = new LambdaQueryChainWrapper<>(checkIndexVideoService.getBaseMapper())
                 .select(CheckIndexVideo::getVideoAvailable)
+                .eq(params.getDataType().equals(1), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -469,7 +561,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        resultCount.add(onlineRate + "%");
+        resultCount.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", resultCount);
         map.put("list", resultList);
@@ -496,10 +588,13 @@
         MongoCollection<Document> collection = database.getCollection("uy_record_meta_d_sum");
         List<Integer> status = Arrays.asList(1, 0, -1);
         List<String> resultCount = status.stream().map(item -> {
-            Document filter = new Document("$and", Arrays.asList(
-                    new Document("deptTag", new Document("$eq", Boolean.TRUE)),
-                    new Document("recordStatus", item)
-            ));
+            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)));
+            }
+            Document filter = new Document("$and", dList);
             // 鏋勫缓鑱氬悎绠¢亾
             List<Document> pipeline = Arrays.asList(
                     new Document("$match", filter),
@@ -520,6 +615,7 @@
         Date now = new Date();
         List<CheckIndexVideo> videoList = new LambdaQueryChainWrapper<>(checkIndexVideoService.getBaseMapper())
                 .select(CheckIndexVideo::getMinistryVideoAvailable)
+                .eq(params.getDataType().equals(1), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -528,7 +624,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        resultCount.add(onlineRate + "%");
+        resultCount.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", resultCount);
         map.put("list", resultList);
@@ -555,10 +651,13 @@
         MongoCollection<Document> collection = database.getCollection("uy_record_meta_d_sum");
         List<Integer> status = Arrays.asList(1, 0, -1);
         List<String> resultCount = status.stream().map(item -> {
-            Document filter = new Document("$and", Arrays.asList(
-                    new Document("importantTag", new Document("$eq", Boolean.TRUE)),
-                    new Document("recordStatus", item)
-            ));
+            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)));
+            }
+            Document filter = new Document("$and", dList);
             // 鏋勫缓鑱氬悎绠¢亾
             List<Document> pipeline = Arrays.asList(
                     new Document("$match", filter),
@@ -579,6 +678,7 @@
         Date now = new Date();
         List<CheckIndexVideo> videoList = new LambdaQueryChainWrapper<>(checkIndexVideoService.getBaseMapper())
                 .select(CheckIndexVideo::getKeyVideoAvailable)
+                .eq(params.getDataType().equals(1), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -587,7 +687,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        resultCount.add(onlineRate + "%");
+        resultCount.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", resultCount);
         map.put("list", resultList);
@@ -638,11 +738,34 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("osd_check_result");
 
-        Document importantTag = new Document("importantTag", Boolean.TRUE);
-        Document osdNameFilter = new Document("$and", Arrays.asList(new Document("osdNameCorrect", 1), importantTag));
-        Document osdNameErrFilter = new Document("$and", Arrays.asList(new Document("osdNameCorrect", -1), importantTag));
-        Document osdTimeFilter = new Document("$and", Arrays.asList(new Document("osdTimeCorrect", 1), importantTag));
-        Document osdTimeErrFilter = new Document("$and", Arrays.asList(new Document("osdTimeCorrect", -1), importantTag));
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document osdNameFilter = new Document("$and", dList1);
+        Document osdNameErrFilter = new Document("$and", dList2);
+        Document osdTimeFilter = new Document("$and", dList3);
+        Document osdTimeErrFilter = new Document("$and", dList4);
         List<Document> lists = Arrays.asList(osdNameFilter, osdNameErrFilter, osdTimeFilter, osdTimeErrFilter);
         List<String> rList = lists.stream().map(filter -> {
             // 鏋勫缓鑱氬悎绠¢亾
@@ -665,6 +788,7 @@
         Date now = new Date();
         List<CheckIndexVideo> videoList = new LambdaQueryChainWrapper<>(checkIndexVideoService.getBaseMapper())
                 .select(CheckIndexVideo::getKeyAnnotationAccuracy)
+                .eq(params.getDataType().equals(1), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -673,7 +797,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -726,9 +850,20 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("osd_check_result");
 
-        Document importantTag = new Document("importantTag", Boolean.TRUE);
-        Document osdTimeFilter = new Document("$and", Arrays.asList(new Document("osdTimeCorrect", 1), importantTag));
-        Document osdTimeErrFilter = new Document("$and", Arrays.asList(new Document("osdTimeCorrect", -1), importantTag));
+        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)));
+        }
+        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)));
+        }
+        Document osdTimeFilter = new Document("$and", dList1);
+        Document osdTimeErrFilter = new Document("$and", dList2);
         List<Document> lists = Arrays.asList(osdTimeFilter, osdTimeErrFilter);
         List<String> rList = lists.stream().map(filter -> {
             // 鏋勫缓鑱氬悎绠¢亾
@@ -751,6 +886,7 @@
         Date now = new Date();
         List<CheckIndexVideo> videoList = new LambdaQueryChainWrapper<>(checkIndexVideoService.getBaseMapper())
                 .select(CheckIndexVideo::getKeyTimingAccuracy)
+                .eq(params.getDataType().equals(1), CheckIndexVideo::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexVideo::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -759,7 +895,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -786,10 +922,34 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("hk_snapshot_data_monitor");
 
-        Document normalFilter = new Document("resultType", 1);
-        Document noDataFilter = new Document("resultType", 2);
-        Document trFilter = new Document("resultType", 3);
-        Document littleFilter = new Document("resultType", 4);
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document normalFilter = new Document("$and", dList1);
+        Document noDataFilter = new Document("$and", dList2);
+        Document trFilter = new Document("$and", dList3);
+        Document littleFilter = new Document("$and", dList4);
         List<Document> lists = Arrays.asList(normalFilter, noDataFilter, trFilter, littleFilter);
         List<String> rList = lists.stream().map(filter -> {
             // 鏋勫缓鑱氬悎绠¢亾
@@ -812,6 +972,7 @@
         Date now = new Date();
         List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper())
                 .select(CheckIndexCar::getViewConnectStability)
+                .eq(params.getDataType().equals(1), CheckIndexCar::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -820,7 +981,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -850,6 +1011,7 @@
         Date now = new Date();
         List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper())
                 .select(CheckIndexCar::getSiteOnline)
+                .eq(params.getDataType().equals(1), CheckIndexCar::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -859,7 +1021,7 @@
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
         HashMap<String, Object> map = new HashMap<>();
-        map.put("count", Arrays.asList(distinctCount + "%", onlineRate + "%"));
+        map.put("count", Arrays.asList(distinctCount + "", this.remove0(onlineRate)));
         map.put("list", resultList);
         return Result.ok().data(map).total(total);
     }
@@ -883,11 +1045,30 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("uy_monitor_qualify");
 
-        Document ipErrFilter = new Document("ip.error", true);
-        Document macdzErrFilter = new Document("macdz.error", true);
-        Document latitudeErrFilter = new Document("latitude.error", true);
-        Document longitudeErrFilter = new Document("longitude.error", true);
-
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document ipErrFilter = new Document("$and", dList1);
+        Document macdzErrFilter = new Document("$and", dList2);
+        Document latitudeErrFilter = new Document("$and", dList3);
+        Document longitudeErrFilter = new Document("$and", dList4);
         List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter);
         List<String> rList = lists.stream().map(filter -> {
             // 鏋勫缓鑱氬悎绠¢亾
@@ -904,12 +1085,13 @@
                 uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds");
                 break; // 涓嶉渶瑕佺户缁亶鍘嗭紝鍥犱负 $count 鍙細浜х敓涓�涓粨鏋�
             }
-            return uniqueDeviceIdCount + "%";
+            return uniqueDeviceIdCount + "";
         }).collect(Collectors.toList());
 
         Date now = new Date();
         List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper())
                 .select(CheckIndexCar::getDeviceDirectoryConsistent)
+                .eq(params.getDataType().equals(1), CheckIndexCar::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -918,7 +1100,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -944,10 +1126,30 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("hk_cross_detail");
 
-        Document ipErrFilter = new Document("lalType", 1);
-        Document macdzErrFilter = new Document("lalType", 2);
-        Document latitudeErrFilter = new Document("lalType", 3);
-        Document longitudeErrFilter = new Document("lalType", 4);
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document ipErrFilter = new Document("$and", dList1);
+        Document macdzErrFilter = new Document("$and", dList2);
+        Document latitudeErrFilter = new Document("$and", dList3);
+        Document longitudeErrFilter = new Document("$and", dList4);
 
         List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter);
         List<String> rList = lists.stream().map(filter -> {
@@ -971,6 +1173,7 @@
         Date now = new Date();
         List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper())
                 .select(CheckIndexCar::getVehicleInformationCollectionAccuracy)
+                .eq(params.getDataType().equals(1), CheckIndexCar::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -979,7 +1182,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -1008,6 +1211,7 @@
         Date now = new Date();
         List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper())
                 .select(CheckIndexCar::getVehicleCaptureIntegrity)
+                .eq(params.getDataType().equals(1), CheckIndexCar::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -1018,7 +1222,7 @@
         }
 
         HashMap<String, Object> map = new HashMap<>();
-        map.put("count", Arrays.asList(onlineRate + "%"));
+        map.put("count", Arrays.asList(this.remove0(onlineRate)));
         map.put("list", resultList);
         return Result.ok().data(map).total(total);
     }
@@ -1041,6 +1245,7 @@
         Date now = new Date();
         List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper())
                 .select(CheckIndexCar::getVehicleCaptureAccuracy)
+                .eq(params.getDataType().equals(1), CheckIndexCar::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -1050,7 +1255,7 @@
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
         HashMap<String, Object> map = new HashMap<>();
-        map.put("count", Arrays.asList(onlineRate + "%"));
+        map.put("count", Arrays.asList(this.remove0(onlineRate)));
         map.put("list", resultList);
         return Result.ok().data(map).total(total);
     }
@@ -1075,9 +1280,24 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("hk_vehicle_device_inspection");
 
-        Document ipErrFilter = new Document("snapResult", 1);
-        Document macdzErrFilter = new Document("snapResult", 2);
-        Document longitudeErrFilter = new Document("snapResult", 4);
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document ipErrFilter = new Document("$and", dList1);
+        Document macdzErrFilter = new Document("$and", dList2);
+        Document longitudeErrFilter = new Document("$and", dList3);
 
         List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, longitudeErrFilter);
         List<String> rList = lists.stream().map(filter -> {
@@ -1101,6 +1321,7 @@
         Date now = new Date();
         List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper())
                 .select(CheckIndexCar::getVehicleTimingAccuracy)
+                .eq(params.getDataType().equals(1), CheckIndexCar::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -1109,7 +1330,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -1135,6 +1356,7 @@
         Date now = new Date();
         List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper())
                 .select(CheckIndexCar::getVehicleUploadTimeliness)
+                .eq(params.getDataType().equals(1), CheckIndexCar::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -1144,7 +1366,7 @@
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
         HashMap<String, Object> map = new HashMap<>();
-        map.put("count", Arrays.asList(onlineRate + "%"));
+        map.put("count", Arrays.asList(this.remove0(onlineRate)));
         map.put("list", resultList);
         return Result.ok().data(map).total(total);
     }
@@ -1168,6 +1390,7 @@
         Date now = new Date();
         List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper())
                 .select(CheckIndexCar::getVehicleUrlAvailability)
+                .eq(params.getDataType().equals(1), CheckIndexCar::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -1177,7 +1400,7 @@
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
         HashMap<String, Object> map = new HashMap<>();
-        map.put("count", Arrays.asList(onlineRate + "%"));
+        map.put("count", Arrays.asList(this.remove0(onlineRate)));
         map.put("list", resultList);
         return Result.ok().data(map).total(total);
     }
@@ -1201,6 +1424,7 @@
         Date now = new Date();
         List<CheckIndexCar> videoList = new LambdaQueryChainWrapper<>(checkIndexCarService.getBaseMapper())
                 .select(CheckIndexCar::getVehiclePictureAvailability)
+                .eq(params.getDataType().equals(1), CheckIndexCar::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexCar::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -1210,7 +1434,7 @@
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
         HashMap<String, Object> map = new HashMap<>();
-        map.put("count", Arrays.asList(onlineRate + "%"));
+        map.put("count", Arrays.asList(this.remove0(onlineRate)));
         map.put("list", resultList);
         return Result.ok().data(map).total(total);
     }
@@ -1234,10 +1458,30 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("hk_snapshot_data_monitor");
 
-        Document normalFilter = new Document("resultType", 1);
-        Document noDataFilter = new Document("resultType", 2);
-        Document trFilter = new Document("resultType", 3);
-        Document littleFilter = new Document("resultType", 4);
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document normalFilter = new Document("$and", dList1);
+        Document noDataFilter = new Document("$and", dList2);
+        Document trFilter = new Document("$and", dList3);
+        Document littleFilter = new Document("$and", dList4);
         List<Document> lists = Arrays.asList(normalFilter, noDataFilter, trFilter, littleFilter);
         List<String> rList = lists.stream().map(filter -> {
             // 鏋勫缓鑱氬悎绠¢亾
@@ -1260,6 +1504,7 @@
         Date now = new Date();
         List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper())
                 .select(CheckIndexFace::getViewConnectStability)
+                .eq(params.getDataType().equals(1), CheckIndexFace::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -1268,7 +1513,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -1294,10 +1539,30 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("hk_snapshot_data_monitor");
 
-        Document normalFilter = new Document("resultType", 1);
-        Document noDataFilter = new Document("resultType", 2);
-        Document trFilter = new Document("resultType", 3);
-        Document littleFilter = new Document("resultType", 4);
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document normalFilter = new Document("$and", dList1);
+        Document noDataFilter = new Document("$and", dList2);
+        Document trFilter = new Document("$and", dList3);
+        Document littleFilter = new Document("$and", dList4);
         List<Document> lists = Arrays.asList(normalFilter, noDataFilter, trFilter, littleFilter);
         List<String> rList = lists.stream().map(filter -> {
             // 鏋勫缓鑱氬悎绠¢亾
@@ -1320,6 +1585,7 @@
         Date now = new Date();
         List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper())
                 .select(CheckIndexFace::getSiteOnline)
+                .eq(params.getDataType().equals(1), CheckIndexFace::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -1328,7 +1594,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -1354,11 +1620,30 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("uy_monitor_qualify");
 
-        Document ipErrFilter = new Document("ip.error", true);
-        Document macdzErrFilter = new Document("macdz.error", true);
-        Document latitudeErrFilter = new Document("latitude.error", true);
-        Document longitudeErrFilter = new Document("longitude.error", true);
-
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document ipErrFilter = new Document("$and", dList1);
+        Document macdzErrFilter = new Document("$and", dList2);
+        Document latitudeErrFilter = new Document("$and", dList3);
+        Document longitudeErrFilter = new Document("$and", dList4);
         List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter);
         List<String> rList = lists.stream().map(filter -> {
             // 鏋勫缓鑱氬悎绠¢亾
@@ -1381,6 +1666,7 @@
         Date now = new Date();
         List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper())
                 .select(CheckIndexFace::getDeviceDirectoryConsistent)
+                .eq(params.getDataType().equals(1), CheckIndexFace::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -1389,7 +1675,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -1415,11 +1701,30 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("hk_cross_detail");
 
-        Document ipErrFilter = new Document("lalType", 1);
-        Document macdzErrFilter = new Document("lalType", 2);
-        Document latitudeErrFilter = new Document("lalType", 3);
-        Document longitudeErrFilter = new Document("lalType", 4);
-
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document ipErrFilter = new Document("$and", dList1);
+        Document macdzErrFilter = new Document("$and", dList2);
+        Document latitudeErrFilter = new Document("$and", dList3);
+        Document longitudeErrFilter = new Document("$and", dList4);
         List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter);
         List<String> rList = lists.stream().map(filter -> {
             // 鏋勫缓鑱氬悎绠¢亾
@@ -1442,6 +1747,7 @@
         Date now = new Date();
         List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper())
                 .select(CheckIndexFace::getFaceInformationCollectionAccuracy)
+                .eq(params.getDataType().equals(1), CheckIndexFace::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -1450,7 +1756,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -1476,10 +1782,30 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("hk_monitoring_detail");
 
-        Document ipErrFilter = new Document("lalType", 1);
-        Document macdzErrFilter = new Document("lalType", 2);
-        Document latitudeErrFilter = new Document("lalType", 3);
-        Document longitudeErrFilter = new Document("lalType", 4);
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document ipErrFilter = new Document("$and", dList1);
+        Document macdzErrFilter = new Document("$and", dList2);
+        Document latitudeErrFilter = new Document("$and", dList3);
+        Document longitudeErrFilter = new Document("$and", dList4);
 
         List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter);
         List<String> rList = lists.stream().map(filter -> {
@@ -1503,6 +1829,7 @@
         Date now = new Date();
         List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper())
                 .select(CheckIndexFace::getFacePictureQualification)
+                .eq(params.getDataType().equals(1), CheckIndexFace::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -1511,7 +1838,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -1537,9 +1864,24 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("hk_vehicle_device_inspection");
 
-        Document ipErrFilter = new Document("snapResult", 1);
-        Document macdzErrFilter = new Document("snapResult", 2);
-        Document longitudeErrFilter = new Document("snapResult", 4);
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document ipErrFilter = new Document("$and", dList1);
+        Document macdzErrFilter = new Document("$and", dList2);
+        Document longitudeErrFilter = new Document("$and", dList3);
 
         List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, longitudeErrFilter);
         List<String> rList = lists.stream().map(filter -> {
@@ -1563,6 +1905,7 @@
         Date now = new Date();
         List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper())
                 .select(CheckIndexFace::getFaceTimingAccuracy)
+                .eq(params.getDataType().equals(1), CheckIndexFace::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -1571,7 +1914,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -1597,9 +1940,24 @@
         MongoDatabase database = mongoTemplate.getDb();
         MongoCollection<Document> collection = database.getCollection("hk_vehicle_device_inspection");
 
-        Document ipErrFilter = new Document("snapResult", 1);
-        Document macdzErrFilter = new Document("snapResult", 2);
-        Document longitudeErrFilter = new Document("snapResult", 4);
+        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)));
+        }
+        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)));
+        }
+        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)));
+        }
+        Document ipErrFilter = new Document("$and", dList1);
+        Document macdzErrFilter = new Document("$and", dList2);
+        Document longitudeErrFilter = new Document("$and", dList3);
 
         List<Document> lists = Arrays.asList(ipErrFilter, macdzErrFilter, longitudeErrFilter);
         List<String> rList = lists.stream().map(filter -> {
@@ -1623,6 +1981,7 @@
         Date now = new Date();
         List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper())
                 .select(CheckIndexFace::getFaceUploadTimeliness)
+                .eq(params.getDataType().equals(1), CheckIndexFace::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -1631,7 +1990,7 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
-        rList.add(onlineRate + "%");
+        rList.add(this.remove0(onlineRate));
         HashMap<String, Object> map = new HashMap<>();
         map.put("count", rList);
         map.put("list", resultList);
@@ -1657,6 +2016,7 @@
         Date now = new Date();
         List<CheckIndexFace> videoList = new LambdaQueryChainWrapper<>(checkIndexFaceService.getBaseMapper())
                 .select(CheckIndexFace::getFacePictureAvailability)
+                .eq(params.getDataType().equals(1), CheckIndexFace::getExamineTag, CheckConstants.Examine_Tag_Province)
                 .between(CheckIndexFace::getCreateTime, DateUtils.getDayStart(now), DateUtils.getDayEnd(now))
                 .list();
         BigDecimal onlineRate = BigDecimal.ZERO;
@@ -1665,8 +2025,9 @@
             BigDecimal count = BigDecimal.valueOf(videoList.size());
             onlineRate = sum.divide(count, 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
         }
+
         HashMap<String, Object> map = new HashMap<>();
-        map.put("count", Arrays.asList(onlineRate + "%"));
+        map.put("count", Arrays.asList(this.remove0(onlineRate)));
         map.put("list", resultList);
         return Result.ok().data(map).total(total);
     }
@@ -1688,4 +2049,14 @@
         return Result.ok().data(map).total(page.getTotal());
 
     }
+
+    /**
+     * 鍒犻櫎灏鹃儴鐨�0
+     * @param rate
+     * @return
+     */
+    private String remove0(BigDecimal rate) {
+        DF.setDecimalSeparatorAlwaysShown(false);
+        return DF.format(rate) + "%";
+    }
 }

--
Gitblit v1.8.0