| | |
| | | import com.mongodb.client.MongoCollection; |
| | | import com.mongodb.client.MongoDatabase; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.excel.TMonitorExp; |
| | | import com.ycl.platform.domain.excel.VideoDailyExp; |
| | | import com.ycl.platform.domain.excel.VideoTotalExp; |
| | | import com.ycl.platform.domain.form.VideoExportForm; |
| | |
| | | import com.ycl.platform.domain.query.DataCenterQuery; |
| | | import com.ycl.platform.domain.query.HomeQuery; |
| | | import com.ycl.platform.domain.result.BaseResult; |
| | | import com.ycl.platform.domain.result.HK.FaceDeviceInspectionResult; |
| | | import com.ycl.platform.domain.result.HK.FaceDeviceSamplingResult; |
| | | import com.ycl.platform.domain.result.HK.VehicleDeviceInspectionResult; |
| | | import com.ycl.platform.domain.result.HK.VehicleDeviceSamplingResult; |
| | | import com.ycl.platform.domain.result.HK.*; |
| | | import com.ycl.platform.domain.result.SYS.TMonitorResult; |
| | | import com.ycl.platform.domain.result.UY.MonitorQualifyResult; |
| | | import com.ycl.platform.domain.result.UY.OsdCheckResult; |
| | | import com.ycl.platform.domain.result.UY.RecordMetaDSumResult; |
| | | import com.ycl.platform.domain.vo.DynamicColumnVO; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.domain.vo.WorkOrderVO; |
| | | import com.ycl.platform.domain.vo.home.BaseHomeVO; |
| | |
| | | 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.service.ITMonitorService; |
| | |
| | | import com.ycl.system.service.ISysConfigService; |
| | | import com.ycl.utils.DateUtils; |
| | | import com.ycl.utils.StringUtils; |
| | | import com.ycl.utils.poi.ExcelUtil; |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import enumeration.general.AreaDeptEnum; |
| | |
| | | private WorkOrderMapper workOrderMapper; |
| | | @Autowired |
| | | private SysDictDataMapper dictDataMapper; |
| | | @Autowired |
| | | private DynamicColumnMapper dynamicColumnMapper; |
| | | |
| | | /** |
| | | * 查询设备资产 |
| | |
| | | for (TMonitorVO monitor : monitors) { |
| | | if (!CollectionUtils.isEmpty(voList)) { |
| | | for (WorkOrderVO workOrderVO : voList) { |
| | | if (monitor.getWorkOrderNo().equals(workOrderVO.getWorkOrderNo())) { |
| | | if (monitor.getWorkOrderNo() != null && monitor.getWorkOrderNo().equals(workOrderVO.getWorkOrderNo())) { |
| | | monitor.setUnitContact(workOrderVO.getUnitContact()); |
| | | monitor.setUnitContactPhone(workOrderVO.getUnitContactPhone()); |
| | | monitor.setYwPeopleName(workOrderVO.getYwPeopleName()); |
| | |
| | | } |
| | | // 车辆监控设备 |
| | | if (Objects.equals(tMonitor.getCameraFunType(), "2")) { |
| | | //属性一致率、大图、url |
| | | //属性一致率、大图 |
| | | List<VehicleDeviceSamplingResult> sampleResults = mongoTemplate.find(query, VehicleDeviceSamplingResult.class); |
| | | List<PicAccessResult> picAccessResults = mongoTemplate.find(query, PicAccessResult.class); |
| | | //抓拍量、时钟、上传 |
| | | List<VehicleDeviceInspectionResult> inspectResults = mongoTemplate.find(query, VehicleDeviceInspectionResult.class); |
| | | for (TMonitorVO monitor : monitors) { |
| | | monitor.setMongoCreateTime(now); |
| | | //一机一档 |
| | | setOneFile(monitorQualifyResults, monitor); |
| | | //属性一致率、大图、url |
| | | //url |
| | | if (!CollectionUtils.isEmpty(sampleResults)) { |
| | | for (PicAccessResult picAccessResult : picAccessResults) { |
| | | if (monitor.getSerialNumber().equals(picAccessResult.getNo())) { |
| | | BigDecimal bigDecimal = PicAccessResult.calUrl(picAccessResult); |
| | | monitor.setUrlPercent(bigDecimal); |
| | | } |
| | | } |
| | | } |
| | | //属性一致率、大图 |
| | | if (!CollectionUtils.isEmpty(sampleResults)) { |
| | | for (VehicleDeviceSamplingResult sampleResult : sampleResults) { |
| | | if (monitor.getSerialNumber().equals(sampleResult.getNo())) { |
| | | if (sampleResult.getBigUseful() != null) { |
| | | monitor.setBigUsefulPercent(sampleResult.getBigUseful().getBigUsefulPercent()); |
| | | monitor.setUrlPercent(VehicleDeviceSamplingResult.BigUsefulness.calUrl(sampleResult.getBigUseful())); |
| | | } |
| | | if (sampleResult.getVehDiff() != null) { |
| | | monitor.setImportantConPercent(sampleResult.getVehDiff().getImportantConPercent()); |
| | |
| | | monitor.setMongoCreateTime(now); |
| | | //一机一档 |
| | | setOneFile(monitorQualifyResults, monitor); |
| | | //人脸合格、大图、url访问异常 |
| | | //人脸合格、大图 |
| | | if (!CollectionUtils.isEmpty(sampleResults)) { |
| | | for (FaceDeviceSamplingResult sampleResult : sampleResults) { |
| | | if (monitor.getSerialNumber().equals(sampleResult.getNo())) { |
| | | if (sampleResult.getBigUseful() != null) { |
| | | monitor.setBigUsefulPercent(sampleResult.getBigUseful().getBigUsefulPercent()); |
| | | monitor.setUrlPercent(FaceDeviceSamplingResult.BigUsefulness.calUrl(sampleResult.getBigUseful())); |
| | | } |
| | | if (sampleResult.getFaceEligibility() != null) |
| | | monitor.setFacePercent(sampleResult.getFaceEligibility().getFaceEligPercent()); |
| | |
| | | @Override |
| | | public void exportVideoTotal(HttpServletResponse response, VideoExportForm exportForm) throws IOException { |
| | | //默认查所有部门 |
| | | if(CollectionUtils.isEmpty(exportForm.getDeptIds())){ |
| | | if (CollectionUtils.isEmpty(exportForm.getDeptIds())) { |
| | | List<Integer> deptIds = new ArrayList<>(); |
| | | for (AreaDeptEnum value : AreaDeptEnum.values()) { |
| | | deptIds.add(value.getDeptId()); |
| | |
| | | List<TMonitorResult> onlines = onlineList.stream().filter(tMonitorResult -> tMonitorResult.getMongoCreateTime().minusDays(1).equals(parseTime)).collect(Collectors.toList()); |
| | | if (!CollectionUtils.isEmpty(onlines)) { |
| | | videoExp.setTotal(onlines.size()); |
| | | videoExp.setOnline(Integer.valueOf(onlines.stream() |
| | | .filter(TMonitorResult::getOnline) |
| | | .count() + "")); |
| | | long count = onlines.stream() |
| | | .filter(item -> ApiConstants.UY_OnlineSite_Online.equals(item.getOnline())) |
| | | .count(); |
| | | videoExp.setOnline(Integer.valueOf(count + "")); |
| | | videoExp.setOffline(videoExp.getTotal() - videoExp.getOnline()); |
| | | } |
| | | //设置存储情况 |
| | |
| | | @Override |
| | | public void exportVideoOnline(HttpServletResponse response, VideoExportForm exportForm) throws IOException, NoSuchFieldException, IllegalAccessException { |
| | | //默认查所有部门 |
| | | if(CollectionUtils.isEmpty(exportForm.getDeptIds())){ |
| | | if (CollectionUtils.isEmpty(exportForm.getDeptIds())) { |
| | | List<Integer> deptIds = new ArrayList<>(); |
| | | for (AreaDeptEnum value : AreaDeptEnum.values()) { |
| | | deptIds.add(value.getDeptId()); |
| | |
| | | exportForm.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video + "")); |
| | | VideoExportForm.convertTags(exportForm); |
| | | List<TMonitorResult> tMonitorResults = tMonitorMapper.selectMonitorResult(exportForm); |
| | | //获取动态列数据 |
| | | List<Integer> pointIds = tMonitorResults.stream().map(TMonitorResult::getPointId).collect(Collectors.toList()); |
| | | List<DynamicColumnVO> dynamics = dynamicColumnMapper.getDynamicsByIds("t_yw_point", pointIds); |
| | | //补充动态列数据 |
| | | if (!CollectionUtils.isEmpty(dynamics)) { |
| | | Map<Integer, List<DynamicColumnVO>> map = dynamics.stream().collect(Collectors.groupingBy(DynamicColumnVO::getRefId)); |
| | | for (TMonitorResult tMonitorResult : tMonitorResults) { |
| | | Integer pointId = tMonitorResult.getPointId(); |
| | | tMonitorResult.setDynamicColumnList(map.get(pointId)); |
| | | } |
| | | } |
| | | List<String> deviceIds = tMonitorResults.stream().map(BaseResult::getNo).collect(Collectors.toList()); |
| | | Query query = getQuery(deviceIds, exportForm.getMonth()); |
| | | //月份每日在线数据 |
| | |
| | | videoDailyExp.setSerialNumber(result.getNo()); |
| | | videoDailyExp.setDeviceName(result.getName()); |
| | | videoDailyExp.setArea(areaDeptEnum == null ? "未知" : areaDeptEnum.getName()); |
| | | String tag = "" + (result.getProvinceTag() ? "省厅、" : "") + (result.getImportantTag() ? "重点点位、" : "") + (result.getImportantCommandImageTag() ? "重点指挥图像、" : "") + (result.getDeptTag() ? "部级、" : ""); |
| | | // 删除字符串末尾的“、” |
| | | if (tag.endsWith("、")) { |
| | | tag = tag.substring(0, tag.length() - 1); |
| | | StringBuilder tag = new StringBuilder("" + (result.getProvinceTag() ? "省厅、" : "") + (result.getImportantTag() ? "重点点位、" : "") + (result.getImportantCommandImageTag() ? "重点指挥图像、" : "") + (result.getDeptTag() ? "部级、" : "")); |
| | | //动态列处理加在标签里 |
| | | if (!CollectionUtils.isEmpty(result.getDynamicColumnList())) { |
| | | List<DynamicColumnVO> dynamicColumnList = result.getDynamicColumnList(); |
| | | for (DynamicColumnVO dynamicColumnVO : dynamicColumnList) { |
| | | tag.append(dynamicColumnVO.getColumnValue()).append("、"); |
| | | } |
| | | } |
| | | videoDailyExp.setTag(tag); |
| | | // 删除字符串末尾的“、” |
| | | if (tag.toString().endsWith("、")) { |
| | | tag = new StringBuilder(tag.substring(0, tag.length() - 1)); |
| | | } |
| | | videoDailyExp.setTag(tag.toString()); |
| | | setOnlineDaily(videoDailyExp, result, onlines); |
| | | videoDailyExps.add(videoDailyExp); |
| | | //全量表 |
| | |
| | | @Override |
| | | public void exportVideoRecord(HttpServletResponse response, VideoExportForm exportForm) throws IOException, NoSuchFieldException, IllegalAccessException { |
| | | //默认查所有部门 |
| | | if(CollectionUtils.isEmpty(exportForm.getDeptIds())){ |
| | | if (CollectionUtils.isEmpty(exportForm.getDeptIds())) { |
| | | List<Integer> deptIds = new ArrayList<>(); |
| | | for (AreaDeptEnum value : AreaDeptEnum.values()) { |
| | | deptIds.add(value.getDeptId()); |
| | |
| | | exportForm.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video + "")); |
| | | VideoExportForm.convertTags(exportForm); |
| | | List<TMonitorResult> tMonitorResults = tMonitorMapper.selectMonitorResult(exportForm); |
| | | //获取动态列数据 |
| | | List<Integer> pointIds = tMonitorResults.stream().map(TMonitorResult::getPointId).collect(Collectors.toList()); |
| | | List<DynamicColumnVO> dynamics = dynamicColumnMapper.getDynamicsByIds("t_yw_point", pointIds); |
| | | //补充动态列数据 |
| | | if (!CollectionUtils.isEmpty(dynamics)) { |
| | | Map<Integer, List<DynamicColumnVO>> map = dynamics.stream().collect(Collectors.groupingBy(DynamicColumnVO::getRefId)); |
| | | for (TMonitorResult tMonitorResult : tMonitorResults) { |
| | | Integer pointId = tMonitorResult.getPointId(); |
| | | tMonitorResult.setDynamicColumnList(map.get(pointId)); |
| | | } |
| | | } |
| | | List<String> deviceIds = tMonitorResults.stream().map(BaseResult::getNo).collect(Collectors.toList()); |
| | | Query query = getQuery(deviceIds, exportForm.getMonth()); |
| | | //月份每日录像线数据 |
| | |
| | | videoDailyExp.setSerialNumber(result.getNo()); |
| | | videoDailyExp.setDeviceName(result.getName()); |
| | | videoDailyExp.setArea(areaDeptEnum == null ? "未知" : areaDeptEnum.getName()); |
| | | String tag = "" + (result.getProvinceTag() ? "省厅、" : "") + (result.getImportantTag() ? "重点点位、" : "") + (result.getImportantCommandImageTag() ? "重点指挥图像、" : "") + (result.getDeptTag() ? "部级、" : ""); |
| | | // 删除字符串末尾的“、” |
| | | if (tag.endsWith("、")) { |
| | | tag = tag.substring(0, tag.length() - 1); |
| | | StringBuilder tag = new StringBuilder("" + (result.getProvinceTag() ? "省厅、" : "") + (result.getImportantTag() ? "重点点位、" : "") + (result.getImportantCommandImageTag() ? "重点指挥图像、" : "") + (result.getDeptTag() ? "部级、" : "")); |
| | | //动态列处理加在标签里 |
| | | if (!CollectionUtils.isEmpty(result.getDynamicColumnList())) { |
| | | List<DynamicColumnVO> dynamicColumnList = result.getDynamicColumnList(); |
| | | for (DynamicColumnVO dynamicColumnVO : dynamicColumnList) { |
| | | tag.append(dynamicColumnVO.getColumnValue()).append("、"); |
| | | } |
| | | } |
| | | videoDailyExp.setTag(tag); |
| | | // 删除字符串末尾的“、” |
| | | if (tag.toString().endsWith("、")) { |
| | | tag = new StringBuilder(tag.substring(0, tag.length() - 1)); |
| | | } |
| | | videoDailyExp.setTag(tag.toString()); |
| | | setRecordDaily(videoDailyExp, result, records); |
| | | //区县表 |
| | | videoDailyExps.add(videoDailyExp); |
| | |
| | | @Override |
| | | public void exportVideoLoseTime(HttpServletResponse response, VideoExportForm exportForm) throws NoSuchFieldException, IllegalAccessException, IOException { |
| | | //默认查所有部门 |
| | | if(CollectionUtils.isEmpty(exportForm.getDeptIds())){ |
| | | if (CollectionUtils.isEmpty(exportForm.getDeptIds())) { |
| | | List<Integer> deptIds = new ArrayList<>(); |
| | | for (AreaDeptEnum value : AreaDeptEnum.values()) { |
| | | deptIds.add(value.getDeptId()); |
| | |
| | | exportForm.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video + "")); |
| | | VideoExportForm.convertTags(exportForm); |
| | | List<TMonitorResult> tMonitorResults = tMonitorMapper.selectMonitorResult(exportForm); |
| | | //获取动态列数据 |
| | | List<Integer> pointIds = tMonitorResults.stream().map(TMonitorResult::getPointId).collect(Collectors.toList()); |
| | | List<DynamicColumnVO> dynamics = dynamicColumnMapper.getDynamicsByIds("t_yw_point", pointIds); |
| | | //补充动态列数据 |
| | | if (!CollectionUtils.isEmpty(dynamics)) { |
| | | Map<Integer, List<DynamicColumnVO>> map = dynamics.stream().collect(Collectors.groupingBy(DynamicColumnVO::getRefId)); |
| | | for (TMonitorResult tMonitorResult : tMonitorResults) { |
| | | Integer pointId = tMonitorResult.getPointId(); |
| | | tMonitorResult.setDynamicColumnList(map.get(pointId)); |
| | | } |
| | | } |
| | | List<String> deviceIds = tMonitorResults.stream().map(BaseResult::getNo).collect(Collectors.toList()); |
| | | Query query = getQuery(deviceIds, exportForm.getMonth()); |
| | | //月份每日录像线数据 |
| | |
| | | videoDailyExp.setSerialNumber(result.getNo()); |
| | | videoDailyExp.setDeviceName(result.getName()); |
| | | videoDailyExp.setArea(areaDeptEnum == null ? "未知" : areaDeptEnum.getName()); |
| | | String tag = "" + (result.getProvinceTag() ? "省厅、" : "") + (result.getImportantTag() ? "重点点位、" : "") + (result.getImportantCommandImageTag() ? "重点指挥图像、" : "") + (result.getDeptTag() ? "部级、" : ""); |
| | | // 删除字符串末尾的“、” |
| | | if (tag.endsWith("、")) { |
| | | tag = tag.substring(0, tag.length() - 1); |
| | | StringBuilder tag = new StringBuilder("" + (result.getProvinceTag() ? "省厅、" : "") + (result.getImportantTag() ? "重点点位、" : "") + (result.getImportantCommandImageTag() ? "重点指挥图像、" : "") + (result.getDeptTag() ? "部级、" : "")); |
| | | //动态列处理加在标签里 |
| | | if (!CollectionUtils.isEmpty(result.getDynamicColumnList())) { |
| | | List<DynamicColumnVO> dynamicColumnList = result.getDynamicColumnList(); |
| | | for (DynamicColumnVO dynamicColumnVO : dynamicColumnList) { |
| | | tag.append(dynamicColumnVO.getColumnValue()).append("、"); |
| | | } |
| | | } |
| | | videoDailyExp.setTag(tag); |
| | | // 删除字符串末尾的“、” |
| | | if (tag.toString().endsWith("、")) { |
| | | tag = new StringBuilder(tag.substring(0, tag.length() - 1)); |
| | | } |
| | | videoDailyExp.setTag(tag.toString()); |
| | | setLoseDaily(videoDailyExp, result, records); |
| | | videoDailyExps.add(videoDailyExp); |
| | | //全量表 |
| | |
| | | new Document("$group", new Document("_id", "$mongoCreateTime") |
| | | .append("onlineCount", new Document("$sum", |
| | | new Document("$cond", Arrays.asList( |
| | | new Document("$eq", Arrays.asList("$online", Boolean.TRUE)), |
| | | new Document("$eq", Arrays.asList("$online", ApiConstants.UY_OnlineSite_Online)), |
| | | 1, |
| | | 0 |
| | | )) |
| | |
| | | resultMap.put("baseLine", Integer.valueOf(sysDictData.getDictValue())); |
| | | } |
| | | return resultMap; |
| | | } |
| | | |
| | | /** |
| | | * 列表导出 |
| | | * |
| | | * @param response |
| | | * @param tMonitor |
| | | */ |
| | | @Override |
| | | public void export(HttpServletResponse response, TMonitorVO tMonitor) { |
| | | List<TMonitorExp> monitors = tMonitorMapper.exportTMonitorList(tMonitor); |
| | | //获取动态列数据 |
| | | List<Integer> pointIds = monitors.stream().map(TMonitorExp::getPointId).collect(Collectors.toList()); |
| | | List<DynamicColumnVO> dynamics = dynamicColumnMapper.getDynamicsByIds("t_yw_point", pointIds); |
| | | //补充动态列数据 |
| | | if (!CollectionUtils.isEmpty(dynamics)) { |
| | | Map<Integer, List<DynamicColumnVO>> map = dynamics.stream().collect(Collectors.groupingBy(DynamicColumnVO::getRefId)); |
| | | for (TMonitorExp tMonitorResult : monitors) { |
| | | Integer pointId = tMonitorResult.getPointId(); |
| | | tMonitorResult.setDynamicColumnList(map.get(pointId)); |
| | | } |
| | | } |
| | | monitors.forEach(monitor -> { |
| | | String cameraFunType = monitor.getCameraFunType(); |
| | | if (!StringUtils.isEmpty(cameraFunType)) { |
| | | String video = cameraFunType.replaceAll("1", "视频"); |
| | | String car = video.replaceAll("2", "车辆"); |
| | | String type = car.replaceAll("3", "人脸"); |
| | | monitor.setCameraFunType(type); |
| | | } |
| | | StringBuilder tag = new StringBuilder("" + (monitor.getProvinceTag() ? "省厅、" : "") + (monitor.getImportantTag() ? "重点点位、" : "") + (monitor.getImportantCommandImageTag() ? "重点指挥图像、" : "") + (monitor.getDeptTag() ? "部级、" : "")); |
| | | //动态列处理加在标签里 |
| | | if (!CollectionUtils.isEmpty(monitor.getDynamicColumnList())) { |
| | | List<DynamicColumnVO> dynamicColumnList = monitor.getDynamicColumnList(); |
| | | for (DynamicColumnVO dynamicColumnVO : dynamicColumnList) { |
| | | tag.append(dynamicColumnVO.getColumnValue()).append("、"); |
| | | } |
| | | } |
| | | // 删除字符串末尾的“、” |
| | | if (tag.toString().endsWith("、")) { |
| | | tag = new StringBuilder(tag.substring(0, tag.length() - 1)); |
| | | } |
| | | monitor.setTag(tag.toString()); |
| | | }); |
| | | ExcelUtil<TMonitorExp> util = new ExcelUtil<>(TMonitorExp.class); |
| | | util.exportExcel(response, monitors, "2".equals(tMonitor.getCameraFunType()) ? "车辆" : "人脸"); |
| | | } |
| | | |
| | | |
| | |
| | | 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( |
| | |
| | | .append("dataCount", new Document("$sum", "$dataCount")) |
| | | ) |
| | | ); |
| | | |
| | | // 执行聚合查询并获取结果 |
| | | AggregateIterable<Document> result = collection.aggregate(pipeline); |
| | | for (Document doc : result) { |
| | |
| | | results.add(homecarVO); |
| | | } |
| | | |
| | | //mongo查点位在线 |
| | | //TODO:在线修改,需要把检测海康优云检测的结果存入mongo,mongo查点位在线 |
| | | MongoCollection<Document> onlineCollection = database.getCollection("t_monitor_online"); |
| | | // 构建基本的$match条件 |
| | | List<Document> onlineMatch = new ArrayList<>(); |
| | |
| | | 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( |
| | |
| | | new Document("$group", new Document("_id", "$mongoCreateTime") |
| | | .append("onlineCount", new Document("$sum", |
| | | new Document("$cond", Arrays.asList( |
| | | new Document("$eq", Arrays.asList("$online", Boolean.TRUE)), |
| | | new Document("$eq", Arrays.asList("$online", ApiConstants.UY_OnlineSite_Online)), |
| | | 1, |
| | | 0 |
| | | )) |
| | |
| | | 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( |
| | |
| | | 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( |
| | |
| | | new Document("$group", new Document("_id", "$mongoCreateTime") |
| | | .append("onlineCount", new Document("$sum", |
| | | new Document("$cond", Arrays.asList( |
| | | new Document("$eq", Arrays.asList("$online", Boolean.TRUE)), |
| | | new Document("$eq", Arrays.asList("$online", ApiConstants.UY_OnlineSite_Online)), |
| | | 1, |
| | | 0 |
| | | )) |
| | |
| | | for (TMonitorResult monitorResult : onlineResult) { |
| | | int dayOfMonth = monitorResult.getMongoCreateTime().getDayOfMonth(); |
| | | String online = ""; |
| | | online += monitorResult.getOnline() ? "在线" : "离线"; |
| | | 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); |