| | |
| | | import com.ycl.platform.domain.vo.home.HomeVideoVO; |
| | | import com.ycl.platform.domain.vo.screen.MonitorRateVO; |
| | | import com.ycl.platform.domain.vo.screen.MonitorTotalVO; |
| | | import com.ycl.platform.mapper.DynamicColumnMapper; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.mapper.WorkOrderMapper; |
| | | import com.ycl.platform.mapper.YwPointMapper; |
| | | import com.ycl.platform.mapper.*; |
| | | import com.ycl.platform.service.IMonitorConstructionService; |
| | | import com.ycl.platform.service.ITMonitorService; |
| | | import com.ycl.system.Result; |
| | |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | // 获取月份第一天的Date |
| | | Date startDate = calendar.getTime(); |
| | | log.info("首页查询开始日期:{}",startDate); |
| | | // 设置Calendar为月份的最后一天(通过增加一个月份然后减去一天) |
| | | calendar.add(Calendar.MONTH, 1); |
| | | calendar.add(Calendar.DAY_OF_MONTH, -1); |
| | | // 获取月份最后一天的Date |
| | | Date endDate = calendar.getTime(); |
| | | |
| | | log.info("首页查询结束日期:{}",endDate); |
| | | String constructionType = monitorQuery.getConstructionType(); |
| | | List<String> deviceNoList = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(constructionType)){ |
| | | List<MonitorConstruction> serialNumberListByConstructionType = monitorConstructionService.getSerialNumberListByConstructionType(constructionType); |
| | | if (!CollectionUtils.isEmpty(serialNumberListByConstructionType)){ |
| | | deviceNoList = serialNumberListByConstructionType.stream().map(MonitorConstruction::getSerialNumber).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | if (StringUtils.isNotBlank(constructionType) && deviceNoList.isEmpty()) { |
| | | // 当constructionType有值但无对应设备时,返回包含空列表的Map |
| | | Map<String, Object> emptyResult = new HashMap<>(); |
| | | emptyResult.put("list", results); // results此时为空列表 |
| | | emptyResult.put("baseLine", 0); // 可根据业务默认基准线值调整 |
| | | return emptyResult; |
| | | } |
| | | //mongo查录像状态 |
| | | MongoDatabase database = mongoTemplate.getDb(); |
| | | MongoCollection<Document> collection = database.getCollection("uy_record_meta_d_sum"); |
| | | Integer examineTag = monitorQuery.getExamineTag(); |
| | | String arealayerno = monitorQuery.getArea(); |
| | | Document matchConditions = new Document("statTime", new Document("$gte", startDate).append("$lte", endDate)); |
| | | if (!deviceNoList.isEmpty()) { |
| | | log.info("打印分建类型no集合:{}",deviceNoList); |
| | | matchConditions.append("no", new Document("$in", deviceNoList)); |
| | | } |
| | | // 根据examineTag的值动态添加额外的条件 |
| | | if (examineTag != null && examineTag.equals(1)) { |
| | | matchConditions.append("provinceTag", true); |
| | |
| | | List<Document> onlineMatch = new ArrayList<>(); |
| | | onlineMatch.add(new Document("mongoCreateTime", new Document("$gte", startDate).append("$lte", endDate))); |
| | | onlineMatch.add(new Document("monitorType", new Document("$regex", "1"))); |
| | | if (!deviceNoList.isEmpty()) { |
| | | onlineMatch.add(new Document("no", new Document("$in", deviceNoList))); |
| | | } |
| | | if (examineTag != null && examineTag.equals(1)) { |
| | | onlineMatch.add(new Document("provinceTag", true)); |
| | | } else if (examineTag != null && examineTag.equals(2)) { |