| | |
| | | if (params.getOption() != null) { |
| | | query.addCriteria(Criteria.where("online").is(params.getOption())); |
| | | } |
| | | Sort sort = Sort.by( |
| | | Sort.Order.asc("pingOnline"), // 首先按照 pingOnline 升序排序 |
| | | Sort.Order.desc("offLineCount") // 首先按照 pingOnline 升序排序 |
| | | ); |
| | | // 通过pingOnline字段排序,为false的排在前面 |
| | | query.with(Sort.by(Sort.Order.asc("pingOnline"))); |
| | | query.with(sort); |
| | | //分页数量 |
| | | long total = mongoTemplate.count(query, TMonitorResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | } else { |
| | | item.setOnlineStr("未知"); |
| | | } |
| | | List<Date> offLineTime = item.getOffLineTime(); |
| | | List<String> offLineTime = item.getOffLineTimeStr(); |
| | | if(!CollectionUtils.isEmpty(offLineTime)) { |
| | | //后续可以改成配置的离线次数(提取前n次,n为配置的离线次数) |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | if (offLineTime.size() > 1) { |
| | | offLineTime = offLineTime.subList(0, 2); |
| | | } |
| | | List<String> dateStr = new ArrayList<>(); |
| | | for (Date date : offLineTime) { |
| | | String formatDate = format.format(date); |
| | | dateStr.add(formatDate); |
| | | } |
| | | item.setOffLineTimeStr(dateStr); |
| | | item.setOffLineTimeStr(offLineTime); |
| | | } |
| | | }); |
| | | params.setDeptTag(-1); |
| | |
| | | // 添加固定条件 |
| | | criteriaList.add(Criteria.where("monitorType").regex(".*" + CheckConstants.Rule_Category_Video + ".*")); |
| | | criteriaList.add(Criteria.where("mongoCreateTime").gte(params.getStartTime()).lte(params.getEndTime())); |
| | | criteriaList.add(Criteria.where("deptTag").is(Boolean.TRUE)); |
| | | // 根据dataType动态添加条件 |
| | | if (params.getDataType() == 1) { |
| | | criteriaList.add(Criteria.where("provinceTag").is(Boolean.TRUE)); |
| | |
| | | MongoUtil.setPage(query, params, "checkTime"); |
| | | List<OsdCheckResult> resultList = mongoTemplate.find(query, OsdCheckResult.class); |
| | | for (OsdCheckResult osdCheckResult : resultList) { |
| | | OsdCheckResult.getText(osdCheckResult); |
| | | OsdCheckResult.getError(osdCheckResult); |
| | | } |
| | | // 统计数量 |
| | | MongoDatabase database = mongoTemplate.getDb(); |
| | |
| | | Document errorFilter = new Document("$or", errorConditions); |
| | | dList2.add(errorFilter); |
| | | Document osdErrorFilter = new Document("$and", dList2); |
| | | //TODO:未知数 新增0的状态 |
| | | //未知数 |
| | | List<Document> dList3 = new ArrayList<>(2); |
| | | setTag(params,dList3); |
| | | dList3.add(importantTagCondition); |
| | |
| | | @Override |
| | | public Result videoImportantPointCheckTimeAccuracy(DataCenterQuery params) { |
| | | List<String> likeFileds = Arrays.asList("deviceNo", "osdName"); |
| | | Query query = MongoUtil.getQuery(params, "checkTime", likeFileds, 3); |
| | | Query query = MongoUtil.getQuery(params, "checkTime", likeFileds, null); |
| | | //下拉框标注正确查询条件 |
| | | if (params.getOption() != null) { |
| | | if(params.getOption()==1) { |
| | |
| | | List<OsdCheckResult> resultList = mongoTemplate.find(query, OsdCheckResult.class); |
| | | |
| | | for (OsdCheckResult osdCheckResult : resultList) { |
| | | OsdCheckResult.getText(osdCheckResult); |
| | | OsdCheckResult.getError(osdCheckResult); |
| | | } |
| | | // 统计数量 |
| | | MongoDatabase database = mongoTemplate.getDb(); |
| | |
| | | Document errorFilter = new Document("$or", errorConditions); |
| | | dList2.add(errorFilter); |
| | | Document osdErrorFilter = new Document("$and", dList2); |
| | | //TODO:未知数 新增0的状态 |
| | | //未知数 |
| | | List<Document> dList3 = new ArrayList<>(2); |
| | | setTag(params,dList3); |
| | | dList3.add(importantTagCondition); |
| | |
| | | if (params.getOption() != null) { |
| | | query.addCriteria(Criteria.where("online").is(params.getOption())); |
| | | } |
| | | Sort sort = Sort.by( |
| | | Sort.Order.asc("pingOnline"), // 首先按照 pingOnline 升序排序 |
| | | Sort.Order.desc("offLineCount") // 首先按照 pingOnline 升序排序 |
| | | ); |
| | | // 通过pingOnline字段排序,为false的排在前面 |
| | | query.with(Sort.by(Sort.Order.asc("pingOnline"))); |
| | | query.with(sort); |
| | | //分页数量 |
| | | long total = mongoTemplate.count(query, TMonitorResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | item.setOnlineStr("离线"); |
| | | } else { |
| | | item.setOnlineStr("未知"); |
| | | } |
| | | List<String> offLineTime = item.getOffLineTimeStr(); |
| | | if(!CollectionUtils.isEmpty(offLineTime)) { |
| | | //后续可以改成配置的离线次数(提取前n次,n为配置的离线次数) |
| | | if (offLineTime.size() > 1) { |
| | | offLineTime = offLineTime.subList(0, 2); |
| | | } |
| | | item.setOffLineTimeStr(offLineTime); |
| | | } |
| | | }); |
| | | |
| | |
| | | if (params.getOption() != null) { |
| | | query.addCriteria(Criteria.where("online").is(params.getOption())); |
| | | } |
| | | Sort sort = Sort.by( |
| | | Sort.Order.asc("pingOnline"), // 首先按照 pingOnline 升序排序 |
| | | Sort.Order.desc("offLineCount") // 首先按照 pingOnline 升序排序 |
| | | ); |
| | | // 通过pingOnline字段排序,为false的排在前面 |
| | | query.with(Sort.by(Sort.Order.asc("pingOnline"))); |
| | | query.with(sort); |
| | | //分页数量 |
| | | long total = mongoTemplate.count(query, TMonitorResult.class); |
| | | MongoUtil.setPage(query, params, TIME_FIELD); |
| | |
| | | } else { |
| | | item.setOnlineStr("未知"); |
| | | } |
| | | List<String> offLineTime = item.getOffLineTimeStr(); |
| | | if(!CollectionUtils.isEmpty(offLineTime)) { |
| | | //后续可以改成配置的离线次数(提取前n次,n为配置的离线次数) |
| | | if (offLineTime.size() > 1) { |
| | | offLineTime = offLineTime.subList(0, 2); |
| | | } |
| | | item.setOffLineTimeStr(offLineTime); |
| | | } |
| | | }); |
| | | params.setDeptTag(-1); |
| | | params.setDeviceType(3); |
| | | |
| | | // 统计设备数量 |
| | | // 统计设备数量 |
| | | //卡片统计 |
| | | int totalCount = 0; |
| | | int onlineCount = 0; |