| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | 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; |