| | |
| | | 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.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; |
| | |
| | | for (TMonitorVO monitor : monitors) { |
| | | if (!CollectionUtils.isEmpty(voList)) { |
| | | for (WorkOrderVO workOrderVO : voList) { |
| | | if (monitor.getWorkOrderNo()!=null && 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()); |
| | |
| | | @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()); |
| | |
| | | long count = onlines.stream() |
| | | .filter(item -> ApiConstants.UY_OnlineSite_Online.equals(item.getOnline())) |
| | | .count(); |
| | | videoExp.setOnline(Integer.valueOf(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()); |
| | |
| | | List<Integer> pointIds = tMonitorResults.stream().map(TMonitorResult::getPointId).collect(Collectors.toList()); |
| | | List<DynamicColumnVO> dynamics = dynamicColumnMapper.getDynamicsByIds("t_yw_point", pointIds); |
| | | //补充动态列数据 |
| | | if(!CollectionUtils.isEmpty(dynamics)) { |
| | | if (!CollectionUtils.isEmpty(dynamics)) { |
| | | Map<Integer, List<DynamicColumnVO>> map = dynamics.stream().collect(Collectors.groupingBy(DynamicColumnVO::getRefId)); |
| | | for (TMonitorResult tMonitorResult : tMonitorResults) { |
| | | Integer pointId = tMonitorResult.getPointId(); |
| | |
| | | videoDailyExp.setArea(areaDeptEnum == null ? "未知" : areaDeptEnum.getName()); |
| | | StringBuilder tag = new StringBuilder("" + (result.getProvinceTag() ? "省厅、" : "") + (result.getImportantTag() ? "重点点位、" : "") + (result.getImportantCommandImageTag() ? "重点指挥图像、" : "") + (result.getDeptTag() ? "部级、" : "")); |
| | | //动态列处理加在标签里 |
| | | if(!CollectionUtils.isEmpty(result.getDynamicColumnList())){ |
| | | if (!CollectionUtils.isEmpty(result.getDynamicColumnList())) { |
| | | List<DynamicColumnVO> dynamicColumnList = result.getDynamicColumnList(); |
| | | for (DynamicColumnVO dynamicColumnVO : dynamicColumnList) { |
| | | tag.append(dynamicColumnVO.getColumnValue()).append("、"); |
| | |
| | | @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()); |
| | |
| | | List<Integer> pointIds = tMonitorResults.stream().map(TMonitorResult::getPointId).collect(Collectors.toList()); |
| | | List<DynamicColumnVO> dynamics = dynamicColumnMapper.getDynamicsByIds("t_yw_point", pointIds); |
| | | //补充动态列数据 |
| | | if(!CollectionUtils.isEmpty(dynamics)) { |
| | | if (!CollectionUtils.isEmpty(dynamics)) { |
| | | Map<Integer, List<DynamicColumnVO>> map = dynamics.stream().collect(Collectors.groupingBy(DynamicColumnVO::getRefId)); |
| | | for (TMonitorResult tMonitorResult : tMonitorResults) { |
| | | Integer pointId = tMonitorResult.getPointId(); |
| | |
| | | videoDailyExp.setArea(areaDeptEnum == null ? "未知" : areaDeptEnum.getName()); |
| | | StringBuilder tag = new StringBuilder("" + (result.getProvinceTag() ? "省厅、" : "") + (result.getImportantTag() ? "重点点位、" : "") + (result.getImportantCommandImageTag() ? "重点指挥图像、" : "") + (result.getDeptTag() ? "部级、" : "")); |
| | | //动态列处理加在标签里 |
| | | if(!CollectionUtils.isEmpty(result.getDynamicColumnList())){ |
| | | if (!CollectionUtils.isEmpty(result.getDynamicColumnList())) { |
| | | List<DynamicColumnVO> dynamicColumnList = result.getDynamicColumnList(); |
| | | for (DynamicColumnVO dynamicColumnVO : dynamicColumnList) { |
| | | tag.append(dynamicColumnVO.getColumnValue()).append("、"); |
| | |
| | | @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()); |
| | |
| | | List<Integer> pointIds = tMonitorResults.stream().map(TMonitorResult::getPointId).collect(Collectors.toList()); |
| | | List<DynamicColumnVO> dynamics = dynamicColumnMapper.getDynamicsByIds("t_yw_point", pointIds); |
| | | //补充动态列数据 |
| | | if(!CollectionUtils.isEmpty(dynamics)) { |
| | | if (!CollectionUtils.isEmpty(dynamics)) { |
| | | Map<Integer, List<DynamicColumnVO>> map = dynamics.stream().collect(Collectors.groupingBy(DynamicColumnVO::getRefId)); |
| | | for (TMonitorResult tMonitorResult : tMonitorResults) { |
| | | Integer pointId = tMonitorResult.getPointId(); |
| | |
| | | videoDailyExp.setArea(areaDeptEnum == null ? "未知" : areaDeptEnum.getName()); |
| | | StringBuilder tag = new StringBuilder("" + (result.getProvinceTag() ? "省厅、" : "") + (result.getImportantTag() ? "重点点位、" : "") + (result.getImportantCommandImageTag() ? "重点指挥图像、" : "") + (result.getDeptTag() ? "部级、" : "")); |
| | | //动态列处理加在标签里 |
| | | if(!CollectionUtils.isEmpty(result.getDynamicColumnList())){ |
| | | if (!CollectionUtils.isEmpty(result.getDynamicColumnList())) { |
| | | List<DynamicColumnVO> dynamicColumnList = result.getDynamicColumnList(); |
| | | for (DynamicColumnVO dynamicColumnVO : dynamicColumnList) { |
| | | tag.append(dynamicColumnVO.getColumnValue()).append("、"); |
| | |
| | | new Document("$group", new Document("_id", "$mongoCreateTime") |
| | | .append("onlineCount", new Document("$sum", |
| | | new Document("$cond", Arrays.asList( |
| | | new Document("$eq", Arrays.asList("$online",ApiConstants.UY_OnlineSite_Online)), |
| | | 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()) ? "车辆" : "人脸"); |
| | | } |
| | | |
| | | |
| | |
| | | new Document("$group", new Document("_id", "$mongoCreateTime") |
| | | .append("onlineCount", new Document("$sum", |
| | | new Document("$cond", Arrays.asList( |
| | | new Document("$eq", Arrays.asList("$online",ApiConstants.UY_OnlineSite_Online)), |
| | | new Document("$eq", Arrays.asList("$online", ApiConstants.UY_OnlineSite_Online)), |
| | | 1, |
| | | 0 |
| | | )) |
| | |
| | | for (TMonitorResult monitorResult : onlineResult) { |
| | | int dayOfMonth = monitorResult.getMongoCreateTime().getDayOfMonth(); |
| | | String online = ""; |
| | | if(ApiConstants.UY_OnlineSite_Online.equals(monitorResult.getOnline())){ |
| | | online +="在线"; |
| | | }else if(ApiConstants.UY_OnlineSite_Offline.equals(monitorResult.getOnline())){ |
| | | online +="离线"; |
| | | }else { |
| | | online +="未知"; |
| | | 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); |