| | |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class CarOnlineCalculation extends IndexCalculationServe<TMonitorResult, CarOnlineCalculation.AreaStats> implements CalculationStrategy<TMonitorResult> { |
| | | public class CarOnlineCalculation extends IndexCalculationServe<SnapshotDataMonitorResult, CarOnlineCalculation.AreaStats> implements CalculationStrategy<SnapshotDataMonitorResult> { |
| | | @Autowired |
| | | private CheckIndexCarMapper checkIndexCarMapper; |
| | | @Autowired |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void calculate(List<TMonitorResult> list) { |
| | | public void calculate(List<SnapshotDataMonitorResult> list) { |
| | | //获取分区域的指标数量 |
| | | Map<String, CarOnlineCalculation.AreaStats> areaStatsMap = getAreaStatsMap(list,Boolean.FALSE); |
| | | if (areaStatsMap == null) return; |
| | |
| | | * 累计总点位数、离线数、总抓拍量 |
| | | */ |
| | | @Override |
| | | public void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, TMonitorResult result) { |
| | | public void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, SnapshotDataMonitorResult result) { |
| | | //返回对象的引用,如果不存在会放入新的key,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | | |
| | | if (result.getOnline()!=null && result.getOnline()) { |
| | | if (ApiConstants.HK_SnapCount_ResultType_Null != result.getResultType()) { |
| | | stats.onlineSites++; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ycl.platform.domain.entity.CheckIndexCar; |
| | | import com.ycl.platform.domain.entity.CheckIndexFace; |
| | | import com.ycl.platform.domain.result.HK.SnapshotDataMonitorResult; |
| | | import com.ycl.platform.domain.result.SYS.TMonitorResult; |
| | | import com.ycl.platform.mapper.CheckIndexCarMapper; |
| | | import com.ycl.platform.mapper.CheckIndexFaceMapper; |
| | | import com.ycl.platform.service.ICheckIndexCarService; |
| | | import com.ycl.platform.service.ICheckIndexFaceService; |
| | | import com.ycl.utils.DateUtils; |
| | | import constant.ApiConstants; |
| | | import constant.CheckThreadConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class FaceOnlineCalculation extends IndexCalculationServe<TMonitorResult, FaceOnlineCalculation.AreaStats> implements CalculationStrategy<TMonitorResult> { |
| | | public class FaceOnlineCalculation extends IndexCalculationServe<SnapshotDataMonitorResult, FaceOnlineCalculation.AreaStats> implements CalculationStrategy<SnapshotDataMonitorResult> { |
| | | @Autowired |
| | | private CheckIndexFaceMapper checkIndexFaceMapper; |
| | | @Autowired |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void calculate(List<TMonitorResult> list) { |
| | | public void calculate(List<SnapshotDataMonitorResult> list) { |
| | | //获取分区域的指标数量 |
| | | Map<String, FaceOnlineCalculation.AreaStats> areaStatsMap = getAreaStatsMap(list,Boolean.FALSE); |
| | | if (areaStatsMap == null) return; |
| | |
| | | * 累计总点位数、离线数、总抓拍量 |
| | | */ |
| | | @Override |
| | | public void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, TMonitorResult result) { |
| | | public void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, SnapshotDataMonitorResult result) { |
| | | //返回对象的引用,如果不存在会放入新的key,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | | |
| | | if (result.getOnline()!=null && result.getOnline()) { |
| | | if (ApiConstants.HK_SnapCount_ResultType_Null != result.getResultType()) { |
| | | stats.onlineSites++; |
| | | } |
| | | } |
| | |
| | | String deptId = monitor.getDeptId().toString(); |
| | | updateAreaStats(areaStatsMap, deptId, result); |
| | | |
| | | // 处理省厅数据 |
| | | // 处理省厅考核数据 |
| | | if (result.getProvinceTag() != null && result.getProvinceTag()) { |
| | | String provinceKey = ApiConstants.Province + deptId; |
| | | updateAreaStats(areaStatsMap, provinceKey, result); |
| | | } |
| | | // 处理公安部数据 |
| | | // 处理公安部考核数据 |
| | | if (needDept) { |
| | | if (result.getDeptTag() != null && result.getDeptTag()) { |
| | | String deptKey = ApiConstants.Dept + deptId; |
| | |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class VideoOnlineCalculation extends IndexCalculationServe<TMonitorResult, VideoOnlineCalculation.AreaStats> implements CalculationStrategy<TMonitorResult> { |
| | | public class VideoOnlineCalculation extends IndexCalculationServe<VideoOnlineResult, VideoOnlineCalculation.AreaStats> implements CalculationStrategy<VideoOnlineResult> { |
| | | @Autowired |
| | | private CheckIndexVideoMapper checkIndexVideoMapper; |
| | | @Autowired |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void calculate(List<TMonitorResult> list) { |
| | | public void calculate(List<VideoOnlineResult> list) { |
| | | //获取分区域的指标数量 |
| | | Map<String, VideoOnlineCalculation.AreaStats> areaStatsMap = getAreaStatsMap(list,Boolean.TRUE); |
| | | if (areaStatsMap == null) return; |
| | |
| | | * 累计总点位数、在线点位数、重点点位数、重点点位在线数、指挥图像数、指挥图像在线数 |
| | | */ |
| | | @Override |
| | | public void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, TMonitorResult result) { |
| | | public void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, VideoOnlineResult result) { |
| | | //返回对象的引用,如果不存在会放入新的key,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | |
| | | if(result.getDeptTag()!=null && result.getDeptTag()){ |
| | | stats.deptSites++; |
| | | } |
| | | if (result.getOnline()!=null && result.getOnline()){ |
| | | if (ApiConstants.UY_OnlineSite_Online.equals(result.getStatus())){ |
| | | stats.onlineSites++; |
| | | if(result.getImportantTag()!=null && result.getImportantTag()){ |
| | | stats.importantOnlineSites++; |
| | |
| | | private YwPointMapper pointMapper; |
| | | public void siteOnlineTask() { |
| | | log.info("开始计算点位在线率"); |
| | | VideoExportForm form = new VideoExportForm(); |
| | | form.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Car+"")); |
| | | List<TMonitorResult> tMonitorResults = monitorMapper.selectMonitorResult(form); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Car_SiteOnline); |
| | | calculator.calculate(tMonitorResults); |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //计算点位在线率和视图库对接稳定性 |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday)) |
| | | .and("dataType").is(ApiConstants.HK_DataType_CAR)); |
| | | List<SnapshotDataMonitorResult> results = mongoTemplate.find(query, SnapshotDataMonitorResult.class); |
| | | CalculationStrategy<SnapshotDataMonitorResult> calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Car_SiteOnline); |
| | | calculator.calculate(results); |
| | | log.info("结束计算视图库对接稳定性"); |
| | | } |
| | | |
| | |
| | | |
| | | public void siteOnlineTask() { |
| | | log.info("开始计算点位在线率"); |
| | | VideoExportForm form = new VideoExportForm(); |
| | | form.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Face+"")); |
| | | List<TMonitorResult> tMonitorResults = monitorMapper.selectMonitorResult(form); |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //点位在线率和视图库对接稳定性 |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday)) |
| | | .and("dataType").is(ApiConstants.HK_DataType_FACE)); |
| | | List<SnapshotDataMonitorResult> results = mongoTemplate.find(query, SnapshotDataMonitorResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Face_SiteOnline); |
| | | calculator.calculate(tMonitorResults); |
| | | calculator.calculate(results); |
| | | log.info("结束计算视图库对接稳定性"); |
| | | } |
| | | public void viewConnectTask() { |
| | |
| | | /** |
| | | * 点位在线检测 |
| | | */ |
| | | //TODO:视频离线次数、监测次数 |
| | | //TODO:视频离线次数、监测次数(修改逻辑只针对工单,检测在线的) |
| | | public void pointOnline() throws ExecutionException, InterruptedException { |
| | | log.info("开始检测点位在线"); |
| | | Integer times = 2; |
| | |
| | | log.info("点位在线监测完成"); |
| | | } |
| | | |
| | | //(弃用)点位在线率 |
| | | //点位在线率(优云) |
| | | public void videoOnlineTask() { |
| | | //视频图像质量 |
| | | log.info("开始执行点位在线数据同步"); |
| | |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, VideoOnlineResult.class); |
| | | //打标签 |
| | | pointService.setDeviceTagByGB(records); |
| | | //存放在mongo中 |
| | | mongoTemplate.insertAll(records); |
| | | // 工单生成 |
| | |
| | | item.setNo(item.getDeviceId()); |
| | | } |
| | | }); |
| | | //打标签 |
| | | pointService.setDeviceTagByGB(records); |
| | | //存放在mongo中 |
| | | mongoTemplate.insertAll(records); |
| | |
| | | |
| | | public void siteOnlineTask() { |
| | | log.info("开始计算点位在线率"); |
| | | VideoExportForm form = new VideoExportForm(); |
| | | form.setCameraFunType(Integer.valueOf(CheckConstants.Rule_Category_Video+"")); |
| | | List<TMonitorResult> tMonitorResults = monitorMapper.selectMonitorResult(form); |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //计算点位在线率和重点点位在线率和指挥图像在线率 |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); |
| | | List<VideoOnlineResult> results = mongoTemplate.find(query, VideoOnlineResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_SiteOnline); |
| | | calculator.calculate(tMonitorResults); |
| | | calculator.calculate(results); |
| | | log.info("结束计算点位在线率"); |
| | | } |
| | | |