| | |
| | | |
| | | /** |
| | | * 计算人脸设备抓拍数据上传及时性 |
| | | * 抓拍数据时延监测接口 |
| | | * 获取分省厅、区域的map<k,v> k为deptId或者Province_deptId |
| | | * 循环map计算数据上传及时性 |
| | | * 更新或新增 |
| | |
| | | @Autowired |
| | | private CheckIndexFaceMapper checkIndexFaceMapper; |
| | | @Autowired |
| | | private SysConfigMapper sysConfigMapper; |
| | | @Autowired |
| | | private ITMonitorService monitorService; |
| | | @Autowired |
| | | private ICheckIndexFaceService checkIndexFaceService; |
| | | |
| | | //区域车辆点位在线指标的内部类 |
| | | //区域人脸数据上传延迟指标的内部类 |
| | | private static class AreaStats { |
| | | int totalCount = 0; |
| | | //0-180s |
| | |
| | | areaStatsMap.forEach((deptId, stats) -> { |
| | | if (stats.totalCount > 0) { |
| | | CheckIndexFace checkIndexFace = createOrUpdateCheckIndexFace(deptId, stats, checkIndexFaceList); |
| | | checkIndexFaces.add(checkIndexFace); |
| | | if (checkIndexFace != null) { |
| | | checkIndexFaces.add(checkIndexFace); |
| | | } |
| | | } |
| | | }); |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 累计总点位数、离线数、总抓拍量 |
| | | * 累计总数据量、延迟数据量 |
| | | */ |
| | | private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, SnapshotDelayMonitorResult result) { |
| | | //返回对象的引用,如果不存在会放入新的key,value |
| | |
| | | stats.delayCount3 += result.getDataDelayCount3(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 车辆点位在线率和视图库对接稳定性 |
| | | * 人脸数据上传及时性 |
| | | */ |
| | | private CheckIndexFace createOrUpdateCheckIndexFace(String key, AreaStats stats, List<CheckIndexFace> checkIndexFaceList) { |
| | | CheckIndexFace checkIndexFace; |
| | | |
| | | // 检查是否已存在今日数据 |
| | | Optional<CheckIndexFace> existingFace = checkIndexFaceList.stream() |
| | | .filter(face -> key.equals(face.getDeptId().toString()) && |
| | | (key.startsWith("Province_") ? CheckConstants.Examine_Tag_City.equals(face.getExamineTag()) |
| | | : CheckConstants.Examine_Tag_County.equals(face.getExamineTag()))) |
| | | .findFirst(); |
| | | |
| | | if (existingFace.isPresent()) { |
| | | checkIndexFace = existingFace.get(); |
| | | } else { |
| | | checkIndexFace = new CheckIndexFace(); |
| | | checkIndexFace.setDeptId(key.startsWith("Province_") ? Long.parseLong(key.split("_")[1]) : Long.parseLong(key)); |
| | | checkIndexFace.setExamineTag(key.startsWith("Province_") ? CheckConstants.Examine_Tag_City : CheckConstants.Examine_Tag_County); |
| | | checkIndexFace.setCreateTime(new Date()); |
| | | CheckIndexFace checkIndexFace = getCheckIndex(key, checkIndexFaceList, CheckIndexFace.class); |
| | | if (checkIndexFace == null) { |
| | | return null; |
| | | } |
| | | |
| | | //调用抓拍上传及时性计算方法 |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("totalCount", stats.totalCount); |