| | |
| | | long total = mongoTemplate.count(query, DataIntegrityMonitoringResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | | List<DataIntegrityMonitoringResult> resultList = mongoTemplate.find(query, DataIntegrityMonitoringResult.class); |
| | | // 统计数 |
| | | |
| | | // 统计数量 |
| | | MongoDatabase database = mongoTemplate.getDb(); |
| | | MongoCollection<Document> collection = database.getCollection("hk_data_integrity_monitoring"); |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", CollectionUtils.EMPTY_COLLECTION); |
| | | map.put("list", resultList); |
| | |
| | | long total = mongoTemplate.count(query, VehicleDeviceInspectionResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | | List<VehicleDeviceInspectionResult> resultList = mongoTemplate.find(query, VehicleDeviceInspectionResult.class); |
| | | // 统计数 |
| | | long one = mongoTemplate.count(new Query().addCriteria(Criteria.where("snapResult").is("1")), VehicleDeviceInspectionResult.class); |
| | | long two = mongoTemplate.count(new Query().addCriteria(Criteria.where("snapResult").is("2")), VehicleDeviceInspectionResult.class); |
| | | long four = mongoTemplate.count(new Query().addCriteria(Criteria.where("snapResult").is("4")), VehicleDeviceInspectionResult.class); |
| | | |
| | | |
| | | // 统计数量 |
| | | 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> lists = Arrays.asList(ipErrFilter, macdzErrFilter, longitudeErrFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | | // $group 去重 |
| | | new Document("$group", new Document("_id", "$externalIndexCode")), |
| | | new Document("$count", "uniqueDeviceIds") |
| | | ); |
| | | // 执行聚合查询并获取结果 |
| | | AggregateIterable<Document> result = collection.aggregate(pipeline); |
| | | Integer uniqueDeviceIdCount = 0; |
| | | for (Document doc : result) { |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", Arrays.asList(one, two, four)); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |
| | |
| | | long total = mongoTemplate.count(query, SnapshotDataMonitorResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | | List<SnapshotDataMonitorResult> resultList = mongoTemplate.find(query, SnapshotDataMonitorResult.class); |
| | | // 统计数 |
| | | long one = mongoTemplate.count(new Query().addCriteria(Criteria.where("resultType").is("1")), SnapshotDataMonitorResult.class); |
| | | long two = mongoTemplate.count(new Query().addCriteria(Criteria.where("resultType").is("2")), SnapshotDataMonitorResult.class); |
| | | long three = mongoTemplate.count(new Query().addCriteria(Criteria.where("resultType").is("3")), SnapshotDataMonitorResult.class); |
| | | long four = mongoTemplate.count(new Query().addCriteria(Criteria.where("resultType").is("4")), SnapshotDataMonitorResult.class); |
| | | |
| | | // 统计数量 |
| | | 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> lists = Arrays.asList(normalFilter, noDataFilter, trFilter, littleFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | | // $group 去重 |
| | | new Document("$group", new Document("_id", "$externalIndexCode")), |
| | | new Document("$count", "uniqueDeviceIds") |
| | | ); |
| | | // 执行聚合查询并获取结果 |
| | | AggregateIterable<Document> result = collection.aggregate(pipeline); |
| | | Integer uniqueDeviceIdCount = 0; |
| | | for (Document doc : result) { |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", Arrays.asList(one, two, three, four)); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |
| | |
| | | long total = mongoTemplate.count(query, SnapshotDataMonitorResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | | List<SnapshotDataMonitorResult> resultList = mongoTemplate.find(query, SnapshotDataMonitorResult.class); |
| | | // 统计数 |
| | | long one = mongoTemplate.count(new Query().addCriteria(Criteria.where("resultType").is("1")), SnapshotDataMonitorResult.class); |
| | | long two = mongoTemplate.count(new Query().addCriteria(Criteria.where("resultType").is("2")), SnapshotDataMonitorResult.class); |
| | | long three = mongoTemplate.count(new Query().addCriteria(Criteria.where("resultType").is("3")), SnapshotDataMonitorResult.class); |
| | | long four = mongoTemplate.count(new Query().addCriteria(Criteria.where("resultType").is("4")), SnapshotDataMonitorResult.class); |
| | | |
| | | // 统计数量 |
| | | 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> lists = Arrays.asList(normalFilter, noDataFilter, trFilter, littleFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | | // $group 去重 |
| | | new Document("$group", new Document("_id", "$externalIndexCode")), |
| | | new Document("$count", "uniqueDeviceIds") |
| | | ); |
| | | // 执行聚合查询并获取结果 |
| | | AggregateIterable<Document> result = collection.aggregate(pipeline); |
| | | Integer uniqueDeviceIdCount = 0; |
| | | for (Document doc : result) { |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", Arrays.asList(one, two, three, four)); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |
| | |
| | | long total = mongoTemplate.count(query, MonitorQualifyResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | | List<MonitorQualifyResult> resultList = mongoTemplate.find(query, MonitorQualifyResult.class); |
| | | // 统计数 |
| | | long nonNetwork = mongoTemplate.count(new Query().addCriteria(Criteria.where("LWSX").is("0")), MonitorQualifyResult.class); |
| | | long network = mongoTemplate.count(new Query().addCriteria(Criteria.where("LWSX").is("1")), MonitorQualifyResult.class); |
| | | long video = mongoTemplate.count(new Query().addCriteria(Criteria.where("SXJGNLX").regex(".*1.*")), MonitorQualifyResult.class); |
| | | long car = mongoTemplate.count(new Query().addCriteria(Criteria.where("SXJGNLX").regex(".*2.*")), MonitorQualifyResult.class); |
| | | long face = mongoTemplate.count(new Query().addCriteria(Criteria.where("SXJGNLX").regex(".*3.*")), MonitorQualifyResult.class); |
| | | |
| | | // 统计数量 |
| | | 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> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | | // $group 去重 |
| | | new Document("$group", new Document("_id", "$serialNumber.showValue")), |
| | | new Document("$count", "uniqueDeviceIds") |
| | | ); |
| | | // 执行聚合查询并获取结果 |
| | | AggregateIterable<Document> result = collection.aggregate(pipeline); |
| | | Integer uniqueDeviceIdCount = 0; |
| | | for (Document doc : result) { |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", Arrays.asList(nonNetwork, network, video, car, face)); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |
| | |
| | | long total = mongoTemplate.count(query, CrossDetailResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | | List<CrossDetailResult> resultList = mongoTemplate.find(query, CrossDetailResult.class); |
| | | // 统计数 |
| | | long one = mongoTemplate.count(new Query().addCriteria(Criteria.where("lalType").is("1")), CrossDetailResult.class); |
| | | long two = mongoTemplate.count(new Query().addCriteria(Criteria.where("lalType").is("2")), CrossDetailResult.class); |
| | | long three = mongoTemplate.count(new Query().addCriteria(Criteria.where("lalType").is("3")), CrossDetailResult.class); |
| | | long four = mongoTemplate.count(new Query().addCriteria(Criteria.where("lalType").is("4")), CrossDetailResult.class); |
| | | |
| | | // 统计数量 |
| | | 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> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | | // $group 去重 |
| | | new Document("$group", new Document("_id", "$externalIndexCode")), |
| | | new Document("$count", "uniqueDeviceIds") |
| | | ); |
| | | // 执行聚合查询并获取结果 |
| | | AggregateIterable<Document> result = collection.aggregate(pipeline); |
| | | Integer uniqueDeviceIdCount = 0; |
| | | for (Document doc : result) { |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", Arrays.asList(one, two, three, four)); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |
| | |
| | | @Override |
| | | public Result faceImgQualification(DataCenterQuery params) { |
| | | |
| | | Query query = MongoUtil.getQuery(params, "deviceId", TIME_FIELD, null); |
| | | Query query = MongoUtil.getQuery(params, "externalIndexCode", TIME_FIELD, null); |
| | | |
| | | long total = mongoTemplate.count(query, MonitoringDetailResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | | List<MonitoringDetailResult> resultList = mongoTemplate.find(query, MonitoringDetailResult.class); |
| | | // 统计数 |
| | | long one = mongoTemplate.count(new Query().addCriteria(Criteria.where("lalType").is("1")), MonitoringDetailResult.class); |
| | | long two = mongoTemplate.count(new Query().addCriteria(Criteria.where("lalType").is("2")), MonitoringDetailResult.class); |
| | | long three = mongoTemplate.count(new Query().addCriteria(Criteria.where("lalType").is("3")), MonitoringDetailResult.class); |
| | | long four = mongoTemplate.count(new Query().addCriteria(Criteria.where("lalType").is("4")), MonitoringDetailResult.class); |
| | | |
| | | // 统计数量 |
| | | 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> lists = Arrays.asList(ipErrFilter, macdzErrFilter, latitudeErrFilter, longitudeErrFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | | // $group 去重 |
| | | new Document("$group", new Document("_id", "$externalIndexCode")), |
| | | new Document("$count", "uniqueDeviceIds") |
| | | ); |
| | | // 执行聚合查询并获取结果 |
| | | AggregateIterable<Document> result = collection.aggregate(pipeline); |
| | | Integer uniqueDeviceIdCount = 0; |
| | | for (Document doc : result) { |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", Arrays.asList(one, two, three, four)); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |
| | |
| | | long total = mongoTemplate.count(query, FaceDeviceInspectionResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | | List<FaceDeviceInspectionResult> resultList = mongoTemplate.find(query, FaceDeviceInspectionResult.class); |
| | | // 统计数 |
| | | long one = mongoTemplate.count(new Query().addCriteria(Criteria.where("snapResult").is("1")), FaceDeviceInspectionResult.class); |
| | | long two = mongoTemplate.count(new Query().addCriteria(Criteria.where("snapResult").is("2")), FaceDeviceInspectionResult.class); |
| | | long four = mongoTemplate.count(new Query().addCriteria(Criteria.where("snapResult").is("4")), FaceDeviceInspectionResult.class); |
| | | |
| | | // 统计数量 |
| | | 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> lists = Arrays.asList(ipErrFilter, macdzErrFilter, longitudeErrFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | | // $group 去重 |
| | | new Document("$group", new Document("_id", "$externalIndexCode")), |
| | | new Document("$count", "uniqueDeviceIds") |
| | | ); |
| | | // 执行聚合查询并获取结果 |
| | | AggregateIterable<Document> result = collection.aggregate(pipeline); |
| | | Integer uniqueDeviceIdCount = 0; |
| | | for (Document doc : result) { |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", Arrays.asList(one, two, four)); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |
| | |
| | | long total = mongoTemplate.count(query, FaceDeviceInspectionResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | | List<FaceDeviceInspectionResult> resultList = mongoTemplate.find(query, FaceDeviceInspectionResult.class); |
| | | // 统计数 |
| | | long one = mongoTemplate.count(new Query().addCriteria(Criteria.where("snapResult").is("1")), FaceDeviceInspectionResult.class); |
| | | long two = mongoTemplate.count(new Query().addCriteria(Criteria.where("snapResult").is("2")), FaceDeviceInspectionResult.class); |
| | | long four = mongoTemplate.count(new Query().addCriteria(Criteria.where("snapResult").is("4")), FaceDeviceInspectionResult.class); |
| | | |
| | | // 统计数量 |
| | | 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> lists = Arrays.asList(ipErrFilter, macdzErrFilter, longitudeErrFilter); |
| | | List<Integer> rList = lists.stream().map(filter -> { |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", filter), |
| | | // $group 去重 |
| | | new Document("$group", new Document("_id", "$externalIndexCode")), |
| | | new Document("$count", "uniqueDeviceIds") |
| | | ); |
| | | // 执行聚合查询并获取结果 |
| | | AggregateIterable<Document> result = collection.aggregate(pipeline); |
| | | Integer uniqueDeviceIdCount = 0; |
| | | for (Document doc : result) { |
| | | uniqueDeviceIdCount = doc.getInteger("uniqueDeviceIds"); |
| | | break; // 不需要继续遍历,因为 $count 只会产生一个结果 |
| | | } |
| | | return uniqueDeviceIdCount; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("count", Arrays.asList(one, two, four)); |
| | | map.put("count", rList); |
| | | map.put("list", resultList); |
| | | return Result.ok().data(map).total(total); |
| | | } |