fuliqi
2024-10-30 746a85a842adc99322b364d1c564a624dce62429
ycl-server/src/main/java/com/ycl/platform/service/impl/TMonitorServiceImpl.java
@@ -879,8 +879,6 @@
        matchConditions.add(new Document("dataType", new Document("$eq", ApiConstants.HK_DataType_CAR)));
        if (examineTag != null && examineTag.equals(1)) {
            matchConditions.add(new Document("provinceTag", true));
        } else if (examineTag != null && examineTag.equals(2)) {
            matchConditions.add(new Document("deptTag", true));
        }
        // 构建聚合管道
        List<Document> pipeline = Arrays.asList(
@@ -889,7 +887,6 @@
                        .append("dataCount", new Document("$sum", "$dataCount"))
                )
        );
        // 执行聚合查询并获取结果
        AggregateIterable<Document> result = collection.aggregate(pipeline);
        for (Document doc : result) {
@@ -899,7 +896,7 @@
            results.add(homecarVO);
        }
        //mongo查点位在线
        //TODO:在线修改,需要把检测海康优云检测的结果存入mongo,mongo查点位在线
        MongoCollection<Document> onlineCollection = database.getCollection("t_monitor_online");
        // 构建基本的$match条件
        List<Document> onlineMatch = new ArrayList<>();
@@ -907,8 +904,6 @@
        onlineMatch.add(new Document("monitorType", new Document("$regex", "2")));
        if (examineTag != null && examineTag.equals(1)) {
            onlineMatch.add(new Document("provinceTag", true));
        } else if (examineTag != null && examineTag.equals(2)) {
            onlineMatch.add(new Document("deptTag", true));
        }
        // 构建聚合管道
        List<Document> onlinePipeline = Arrays.asList(
@@ -994,8 +989,6 @@
        matchConditions.add(new Document("dataType", new Document("$eq", ApiConstants.HK_DataType_FACE)));
        if (examineTag != null && examineTag.equals(1)) {
            matchConditions.add(new Document("provinceTag", true));
        } else if (examineTag != null && examineTag.equals(2)) {
            matchConditions.add(new Document("deptTag", true));
        }
        // 构建聚合管道
        List<Document> pipeline = Arrays.asList(
@@ -1022,8 +1015,6 @@
        onlineMatch.add(new Document("monitorType", new Document("$regex", "3")));
        if (examineTag != null && examineTag.equals(1)) {
            onlineMatch.add(new Document("provinceTag", true));
        } else if (examineTag != null && examineTag.equals(2)) {
            onlineMatch.add(new Document("deptTag", true));
        }
        // 构建聚合管道
        List<Document> onlinePipeline = Arrays.asList(
@@ -1108,7 +1099,13 @@
        for (TMonitorResult monitorResult : onlineResult) {
            int dayOfMonth = monitorResult.getMongoCreateTime().getDayOfMonth();
            String online = "";
            online += monitorResult.getPingOnline() ? "在线" : "离线";
            if(ApiConstants.UY_OnlineSite_Online.equals(monitorResult.getOnline())){
                online +="在线";
            }else if(ApiConstants.UY_OnlineSite_Offline.equals(monitorResult.getOnline())){
                online +="离线";
            }else {
                online +="未知";
            }
            //反射赋值,字段统一定义为day+1,2,3...
            Field field = videoDailyExp.getClass().getDeclaredField("day" + dayOfMonth);
            field.setAccessible(true);