| | |
| | | MongoDatabase database = mongoTemplate.getDb(); |
| | | MongoCollection<Document> collection = database.getCollection("uy_record_meta_d_sum"); |
| | | Integer examineTag = monitorQuery.getExamineTag(); |
| | | Document matchConditions = new Document("mongoCreateTime", new Document("$gte", startDate).append("$lte", endDate)); |
| | | Document matchConditions = new Document("statTime", new Document("$gte", startDate).append("$lte", endDate)); |
| | | // 根据examineTag的值动态添加额外的条件 |
| | | if (examineTag != null && examineTag.equals(1)) { |
| | | matchConditions.append("provinceTag", true); |
| | |
| | | // 构建聚合管道 |
| | | List<Document> pipeline = Arrays.asList( |
| | | new Document("$match", matchConditions), |
| | | new Document("$group", new Document("_id", "$mongoCreateTime") |
| | | new Document("$group", new Document("_id", "$statTime") |
| | | .append("normalCount", new Document("$sum", |
| | | new Document("$cond", Arrays.asList( |
| | | new Document("$eq", Arrays.asList("$recordStatus", 1)), |
| | |
| | | results.add(homecarVO); |
| | | } |
| | | |
| | | //TODO:在线修改,需要把检测海康优云检测的结果存入mongo,mongo查点位在线 |
| | | MongoCollection<Document> onlineCollection = database.getCollection("t_monitor_online"); |
| | | // 构建基本的$match条件 |
| | | List<Document> onlineMatch = new ArrayList<>(); |