Merge remote-tracking branch 'origin/master'
| | |
| | | //国际编码监测结果 11-13位不合标准 |
| | | public final static Integer HK_Info_GbCodeType_11NotStandard = 4; |
| | | |
| | | |
| | | //优云在线状态 1在线 0未知 -1离线 |
| | | public final static Integer UY_OnlineSite_Online = 1; |
| | | public final static Integer UY_OnlineSite_Unknown = 0; |
| | | public final static Integer UY_OnlineSite_Offline = -1; |
| | | //优云录像完整状态 |
| | | public final static Integer UY_RecordStatus_Integrity = 1; |
| | | public final static Integer UY_RecordStatus_Interval = 0; |
| | | public final static Integer UY_RecordStatus_Abnormal = -1; |
| | | } |
| | |
| | | */ |
| | | public static final String Face_ClockAccuracy = "faceClockAccuracy"; |
| | | |
| | | |
| | | /** |
| | | * 视频点位在线率 |
| | | */ |
| | | public static final String Video_SiteOnline = "videoSiteOnline"; |
| | | /** |
| | | * 视频录像可用率 |
| | | */ |
| | | public static final String Video_Usability = "videoUsability"; |
| | | } |
New file |
| | |
| | | package com.ycl.platform.domain.param.UY; |
| | | |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | public class OsdMonitorParam { |
| | | /** |
| | | * 分页页码 |
| | | */ |
| | | private Integer pageNum; |
| | | /** |
| | | * 分页大小 |
| | | */ |
| | | private Integer pageSize; |
| | | /** |
| | | * tenantId必须 |
| | | */ |
| | | private Integer tenantId; |
| | | /** |
| | | * 区域编码 |
| | | */ |
| | | private Integer arealayerno; |
| | | /** |
| | | * 关键字 |
| | | */ |
| | | private Integer keyword; |
| | | /** |
| | | * 字幕信息格式是否有效,1:有效, -1:未知, 0:无效 |
| | | */ |
| | | private Integer osdFormat; |
| | | /** |
| | | * 图片上的字幕时间和摄像机拉码流时间差是否大于最大值, 1:大于, -1:未知, 0 小于 |
| | | */ |
| | | private Integer osdTime; |
| | | } |
New file |
| | |
| | | package com.ycl.api; |
| | | |
| | | import com.ycl.platform.domain.param.UY.OsdMonitorParam; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * 接收python接口推送的时钟准确 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | public class PythonController { |
| | | @PostMapping("/videoClock") |
| | | public void videoClock(@RequestBody OsdMonitorParam param) { |
| | | //存储python推送视频时钟信息 |
| | | |
| | | } |
| | | } |
| | |
| | | //区域车辆点位在线指标的内部类 |
| | | private static class AreaStats { |
| | | int totalSites = 0; |
| | | int offlineSites = 0; |
| | | int onlineSites = 0; |
| | | int totalDataSum = 0; |
| | | } |
| | | |
| | |
| | | //返回对象的引用,如果不存在会放入新的key,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | | if (ApiConstants.HK_SnapCount_ResultType_Null == result.getResultType()) { |
| | | stats.offlineSites++; |
| | | if (ApiConstants.HK_SnapCount_ResultType_Null != result.getResultType()) { |
| | | stats.onlineSites++; |
| | | } else { |
| | | stats.totalDataSum += result.getDataCount(); |
| | | } |
| | |
| | | //调用点位在线计算方法 |
| | | Map<String, Object> siteOnlineParam = new HashMap<>(); |
| | | siteOnlineParam.put("totalSites", stats.totalSites); |
| | | siteOnlineParam.put("offlineSites", stats.offlineSites); |
| | | siteOnlineParam.put("onlineSites", stats.onlineSites); |
| | | BigDecimal siteOnline = siteOnline(siteOnlineParam); |
| | | checkIndexCar.setSiteOnline(siteOnline); |
| | | //视图库对接稳定性 |
| | |
| | | //区域人脸点位在线指标的内部类 |
| | | private static class AreaStats { |
| | | int totalSites = 0; |
| | | int offlineSites = 0; |
| | | int onlineSites = 0; |
| | | int totalDataSum = 0; |
| | | } |
| | | |
| | |
| | | //返回对象的引用,如果不存在会放入新的key,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | | if (ApiConstants.HK_SnapCount_ResultType_Null == result.getResultType()) { |
| | | stats.offlineSites++; |
| | | if (ApiConstants.HK_SnapCount_ResultType_Null != result.getResultType()) { |
| | | stats.onlineSites++; |
| | | } else { |
| | | stats.totalDataSum += result.getDataCount(); |
| | | } |
| | |
| | | //调用点位在线计算方法 |
| | | Map<String, Object> siteOnlineParam = new HashMap<>(); |
| | | siteOnlineParam.put("totalSites", stats.totalSites); |
| | | siteOnlineParam.put("offlineSites", stats.offlineSites); |
| | | siteOnlineParam.put("onlineSites", stats.onlineSites); |
| | | BigDecimal siteOnline = siteOnline(siteOnlineParam); |
| | | checkIndexFace.setSiteOnline(siteOnline); |
| | | //视图库对接稳定性 |
| | |
| | | //点位在线率 |
| | | public BigDecimal siteOnline(Map<String, Object> param) { |
| | | BigDecimal totalSites = new BigDecimal((Integer) param.get("totalSites")); |
| | | BigDecimal offlineSites = new BigDecimal((Integer) param.get("offlineSites")); |
| | | BigDecimal onlineSites = totalSites.subtract(offlineSites); |
| | | BigDecimal onlineSites = new BigDecimal((Integer) param.get("onlineSites")); |
| | | return onlineSites.divide(totalSites, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | |
| | | return picQualifySites.divide(totalSitesCount, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //录像可用率 |
| | | public BigDecimal videoUsability(Map<String, Object> param) { |
| | | BigDecimal totalSites = new BigDecimal((Integer) param.get("totalSites")); |
| | | BigDecimal usabilitySites = new BigDecimal((Integer) param.get("usabilitySites")); |
| | | return usabilitySites.divide(totalSites, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //返回省厅国标码集合 |
| | | public List<String> getProvince() { |
| | | // TODO: 分省厅市局 需要补充集合数据 |
New file |
| | |
| | | package com.ycl.calculate; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ycl.platform.domain.entity.CheckIndexVideo; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.result.HK.SnapshotDelayMonitorResult; |
| | | import com.ycl.platform.domain.result.UY.QueryVqdResult; |
| | | import com.ycl.platform.mapper.CheckIndexVideoMapper; |
| | | import com.ycl.platform.service.ICheckIndexFaceService; |
| | | import com.ycl.platform.service.ICheckIndexVideoService; |
| | | import com.ycl.platform.service.ITMonitorService; |
| | | import constant.ApiConstants; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | import utils.DateUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 计算视频设备点位在线率、重点点位在线率 |
| | | * 图像监测诊断结果 |
| | | * 获取分省厅、区域的map<k,v> k为deptId或者Province_deptId |
| | | * 循环map计算数据上传及时性 |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | //TODO:重点指挥图像在线率 |
| | | public class VideoOnlineCalculation extends IndexCalculationServe implements CalculationStrategy<QueryVqdResult> { |
| | | @Autowired |
| | | private CheckIndexVideoMapper checkIndexVideoMapper; |
| | | @Autowired |
| | | private ITMonitorService monitorService; |
| | | @Autowired |
| | | private ICheckIndexVideoService checkIndexVideoService; |
| | | |
| | | //区域视频在线率的内部类 |
| | | private static class AreaStats { |
| | | int totalSites = 0; |
| | | int onlineSites = 0; |
| | | int importantSites = 0; |
| | | int importantOnlineSites = 0; |
| | | } |
| | | |
| | | @Override |
| | | public void calculate(List<QueryVqdResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return; |
| | | } |
| | | |
| | | //获得国标码为key的设备map |
| | | Map<String, TMonitor> monitorMap = monitorService.list(new QueryWrapper<TMonitor>() |
| | | .in("serial_number", list.stream().map(QueryVqdResult::getDeviceId).collect(Collectors.toList()))) |
| | | .stream().collect(Collectors.toMap(TMonitor::getSerialNumber, Function.identity())); |
| | | //获取省厅国标码集合 |
| | | List<String> provinceIds = getProvince(); |
| | | //重点点位集合 |
| | | List<String> important = getImportant(); |
| | | |
| | | Map<String, AreaStats> areaStatsMap = new HashMap<>(); |
| | | for (QueryVqdResult result : list) { |
| | | TMonitor monitor = monitorMap.get(result.getDeviceId()); |
| | | if (monitor == null) continue; |
| | | |
| | | String deptId = monitor.getDeptId().toString(); |
| | | updateAreaStats(areaStatsMap, deptId, result, important); |
| | | |
| | | // 处理省厅数据 |
| | | if (!CollectionUtils.isEmpty(provinceIds) && provinceIds.contains(monitor.getSerialNumber())) { |
| | | String provinceKey = "Province_" + deptId; |
| | | updateAreaStats(areaStatsMap, provinceKey, result, important); |
| | | } |
| | | } |
| | | |
| | | // 查询是否index表已经存在今日数据 |
| | | List<CheckIndexVideo> checkIndexVideoList = checkIndexVideoMapper.selectToday(DateUtils.getDate()); |
| | | List<CheckIndexVideo> checkIndexVideos = new ArrayList<>(); |
| | | areaStatsMap.forEach((deptId, stats) -> { |
| | | if (stats.totalSites > 0) { |
| | | CheckIndexVideo CheckIndexVideo = createOrUpdateCheckIndexFace(deptId, stats, checkIndexVideoList); |
| | | if (CheckIndexVideo != null) { |
| | | checkIndexVideos.add(CheckIndexVideo); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | checkIndexVideoService.saveOrUpdateBatch(checkIndexVideos); |
| | | } |
| | | |
| | | /** |
| | | * 累计总点位数、在线点位数、重点点位数、重点点位在线数 |
| | | */ |
| | | private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, QueryVqdResult result, List<String> important) { |
| | | //返回对象的引用,如果不存在会放入新的key,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | | if(important.contains(result.getDeviceId())){ |
| | | stats.importantSites++; |
| | | } |
| | | if (ApiConstants.UY_OnlineSite_Online.equals(result.getOnlineStatus())){ |
| | | stats.onlineSites++; |
| | | if(important.contains(result.getDeviceId())){ |
| | | stats.importantOnlineSites++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 视频点位在线率 |
| | | */ |
| | | private CheckIndexVideo createOrUpdateCheckIndexFace(String key, AreaStats stats, List<CheckIndexVideo> checkIndexVideoList) { |
| | | CheckIndexVideo checkIndexVideo = getCheckIndex(key, checkIndexVideoList, CheckIndexVideo.class); |
| | | if (checkIndexVideo == null) { |
| | | return null; |
| | | } |
| | | //调用点位在线率计算方法 |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("totalSites", stats.totalSites); |
| | | param.put("onlineSites", stats.onlineSites); |
| | | BigDecimal siteOnline = siteOnline(param); |
| | | checkIndexVideo.setSiteOnline(siteOnline); |
| | | //调用点位在线率计算方法 计算重点点位在线率 |
| | | Map<String, Object> importantParam = new HashMap<>(); |
| | | param.put("totalSites", stats.importantSites); |
| | | param.put("onlineSites", stats.importantOnlineSites); |
| | | BigDecimal importantSiteOnline = siteOnline(importantParam); |
| | | checkIndexVideo.setKeySiteOnline(importantSiteOnline); |
| | | return checkIndexVideo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ycl.calculate; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ycl.platform.domain.entity.CheckIndexVideo; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.param.UY.RecordMetaDSumParam; |
| | | import com.ycl.platform.domain.result.UY.QueryVqdResult; |
| | | import com.ycl.platform.mapper.CheckIndexVideoMapper; |
| | | import com.ycl.platform.service.ICheckIndexVideoService; |
| | | import com.ycl.platform.service.ITMonitorService; |
| | | import constant.ApiConstants; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | import utils.DateUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 计算视频设备录像可用率 |
| | | * 录像可用率接口 |
| | | * 获取分省厅、区域的map<k,v> k为deptId或者Province_deptId |
| | | * 循环map计算数据上传及时性 |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | public class VideoUsabilityCalculation extends IndexCalculationServe implements CalculationStrategy<RecordMetaDSumParam> { |
| | | @Autowired |
| | | private CheckIndexVideoMapper checkIndexVideoMapper; |
| | | @Autowired |
| | | private ITMonitorService monitorService; |
| | | @Autowired |
| | | private ICheckIndexVideoService checkIndexVideoService; |
| | | |
| | | //区域视频在线率的内部类 |
| | | private static class AreaStats { |
| | | int totalSites = 0; |
| | | int usabilitySites = 0; |
| | | int importantSites = 0; |
| | | int importantUsabilitySites = 0; |
| | | } |
| | | |
| | | @Override |
| | | public void calculate(List<RecordMetaDSumParam> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return; |
| | | } |
| | | |
| | | //获得国标码为key的设备map |
| | | Map<String, TMonitor> monitorMap = monitorService.list(new QueryWrapper<TMonitor>() |
| | | .in("serial_number", list.stream().map(RecordMetaDSumParam::getDeviceId).collect(Collectors.toList()))) |
| | | .stream().collect(Collectors.toMap(TMonitor::getSerialNumber, Function.identity())); |
| | | //获取省厅国标码集合 |
| | | List<String> provinceIds = getProvince(); |
| | | //重点点位集合 |
| | | List<String> important = getImportant(); |
| | | |
| | | Map<String, AreaStats> areaStatsMap = new HashMap<>(); |
| | | for (RecordMetaDSumParam result : list) { |
| | | TMonitor monitor = monitorMap.get(result.getDeviceId()); |
| | | if (monitor == null) continue; |
| | | |
| | | String deptId = monitor.getDeptId().toString(); |
| | | updateAreaStats(areaStatsMap, deptId, result, important); |
| | | |
| | | // 处理省厅数据 |
| | | if (!CollectionUtils.isEmpty(provinceIds) && provinceIds.contains(monitor.getSerialNumber())) { |
| | | String provinceKey = "Province_" + deptId; |
| | | updateAreaStats(areaStatsMap, provinceKey, result, important); |
| | | } |
| | | } |
| | | |
| | | // 查询是否index表已经存在今日数据 |
| | | List<CheckIndexVideo> checkIndexVideoList = checkIndexVideoMapper.selectToday(DateUtils.getDate()); |
| | | List<CheckIndexVideo> checkIndexVideos = new ArrayList<>(); |
| | | areaStatsMap.forEach((deptId, stats) -> { |
| | | if (stats.totalSites > 0) { |
| | | CheckIndexVideo CheckIndexVideo = createOrUpdateCheckIndexFace(deptId, stats, checkIndexVideoList); |
| | | if (CheckIndexVideo != null) { |
| | | checkIndexVideos.add(CheckIndexVideo); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | checkIndexVideoService.saveOrUpdateBatch(checkIndexVideos); |
| | | } |
| | | |
| | | /** |
| | | * 累计总点位数、在线点位数、重点点位数、重点点位在线数 |
| | | */ |
| | | private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, RecordMetaDSumParam result, List<String> important) { |
| | | //返回对象的引用,如果不存在会放入新的key,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | | boolean flag = important.contains(result.getDeviceId()); |
| | | if(flag){ |
| | | stats.importantSites++; |
| | | } |
| | | if (ApiConstants.UY_RecordStatus_Integrity.equals(result.getRecordStatus())){ |
| | | stats.usabilitySites++; |
| | | if(flag){ |
| | | stats.importantUsabilitySites++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 视频点位在线率 |
| | | */ |
| | | private CheckIndexVideo createOrUpdateCheckIndexFace(String key, AreaStats stats, List<CheckIndexVideo> checkIndexVideoList) { |
| | | CheckIndexVideo checkIndexVideo = getCheckIndex(key, checkIndexVideoList, CheckIndexVideo.class); |
| | | if (checkIndexVideo == null) { |
| | | return null; |
| | | } |
| | | //调用录像可用计算方法 |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("totalSites", stats.totalSites); |
| | | param.put("usabilitySites", stats.usabilitySites); |
| | | BigDecimal videoUsability = videoUsability(param); |
| | | checkIndexVideo.setVideoAvailable(videoUsability); |
| | | //调用录像可用率计算方法 计算重点点位录像可用率 |
| | | Map<String, Object> importantParam = new HashMap<>(); |
| | | param.put("totalSites", stats.importantSites); |
| | | param.put("usabilitySites", stats.importantUsabilitySites); |
| | | BigDecimal importantVideoUsability = videoUsability(importantParam); |
| | | checkIndexVideo.setKeyVideoAvailable(importantVideoUsability); |
| | | return checkIndexVideo; |
| | | } |
| | | } |
| | |
| | | //人脸时钟准确性 |
| | | calculators.put(CalculationStrategyConstants.Face_ClockAccuracy, new FaceClockAccuracyCalculation()); |
| | | //TODO:人脸目录一致 |
| | | |
| | | //视频点位在线率 |
| | | calculators.put(CalculationStrategyConstants.Video_SiteOnline, new VideoOnlineCalculation()); |
| | | //视频录像可用率 |
| | | calculators.put(CalculationStrategyConstants.Video_Usability, new VideoUsabilityCalculation()); |
| | | |
| | | } |
| | | |
| | | public static CalculationStrategy getCalculator(String indexName) { |
| | |
| | | @PostMapping("/report/recordMetaDSum/list") |
| | | JSONObject recordMetaDSumList(@RequestBody RecordMetaDSumParam recordMetaDSumParam); |
| | | |
| | | /** |
| | | * osd标注信息 |
| | | * @return |
| | | */ |
| | | @GetMapping("/api/v1/app/osdMonitor/list") |
| | | JSONObject osdMonitorList(); |
| | | JSONObject osdMonitorList(@SpringQueryMap OsdMonitorParam param); |
| | | |
| | | /** |
| | | * 图像检测诊断结果 |
| | |
| | | package com.ycl.platform.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ycl.platform.domain.entity.CheckIndexFace; |
| | | import com.ycl.platform.domain.entity.CheckIndexVideo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 视频指标概率数据Mapper接口 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | * @date 2024-04-29 |
| | | */ |
| | | public interface CheckIndexVideoMapper |
| | | public interface CheckIndexVideoMapper extends BaseMapper<CheckIndexVideo> |
| | | { |
| | | /** |
| | | * 查询视频指标概率数据 |
| | | * |
| | | * |
| | | * @param id 视频指标概率数据主键 |
| | | * @return 视频指标概率数据 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 查询视频指标概率数据列表 |
| | | * |
| | | * |
| | | * @param checkIndexVideo 视频指标概率数据 |
| | | * @return 视频指标概率数据集合 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 新增视频指标概率数据 |
| | | * |
| | | * |
| | | * @param checkIndexVideo 视频指标概率数据 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改视频指标概率数据 |
| | | * |
| | | * |
| | | * @param checkIndexVideo 视频指标概率数据 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 删除视频指标概率数据 |
| | | * |
| | | * |
| | | * @param id 视频指标概率数据主键 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 批量删除视频指标概率数据 |
| | | * |
| | | * |
| | | * @param ids 需要删除的数据主键集合 |
| | | * @return 结果 |
| | | */ |
| | | public int deleteCheckIndexVideoByIds(Long[] ids); |
| | | |
| | | List<CheckIndexVideo> selectToday(String date); |
| | | } |
| | |
| | | package com.ycl.platform.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ycl.platform.domain.entity.CheckIndexVideo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 视频指标概率数据Service接口 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | * @date 2024-04-29 |
| | | */ |
| | | public interface ICheckIndexVideoService |
| | | { |
| | | public interface ICheckIndexVideoService extends IService<CheckIndexVideo> { |
| | | /** |
| | | * 查询视频指标概率数据 |
| | | * |
| | | * |
| | | * @param id 视频指标概率数据主键 |
| | | * @return 视频指标概率数据 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 查询视频指标概率数据列表 |
| | | * |
| | | * |
| | | * @param checkIndexVideo 视频指标概率数据 |
| | | * @return 视频指标概率数据集合 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 新增视频指标概率数据 |
| | | * |
| | | * |
| | | * @param checkIndexVideo 视频指标概率数据 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改视频指标概率数据 |
| | | * |
| | | * |
| | | * @param checkIndexVideo 视频指标概率数据 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 批量删除视频指标概率数据 |
| | | * |
| | | * |
| | | * @param ids 需要删除的视频指标概率数据主键集合 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 删除视频指标概率数据信息 |
| | | * |
| | | * |
| | | * @param id 视频指标概率数据主键 |
| | | * @return 结果 |
| | | */ |
| | |
| | | package com.ycl.platform.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.platform.domain.entity.CheckIndexFace; |
| | | import com.ycl.platform.domain.entity.CheckIndexVideo; |
| | | import com.ycl.platform.mapper.CheckIndexFaceMapper; |
| | | import com.ycl.platform.mapper.CheckIndexVideoMapper; |
| | | import com.ycl.platform.service.ICheckIndexVideoService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | /** |
| | | * 视频指标概率数据Service业务层处理 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | * @date 2024-04-29 |
| | | */ |
| | | @Service |
| | | public class CheckIndexVideoServiceImpl implements ICheckIndexVideoService |
| | | public class CheckIndexVideoServiceImpl extends ServiceImpl<CheckIndexVideoMapper, CheckIndexVideo> implements ICheckIndexVideoService |
| | | { |
| | | @Autowired |
| | | private CheckIndexVideoMapper checkIndexVideoMapper; |
| | | |
| | | /** |
| | | * 查询视频指标概率数据 |
| | | * |
| | | * |
| | | * @param id 视频指标概率数据主键 |
| | | * @return 视频指标概率数据 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 查询视频指标概率数据列表 |
| | | * |
| | | * |
| | | * @param checkIndexVideo 视频指标概率数据 |
| | | * @return 视频指标概率数据 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 新增视频指标概率数据 |
| | | * |
| | | * |
| | | * @param checkIndexVideo 视频指标概率数据 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改视频指标概率数据 |
| | | * |
| | | * |
| | | * @param checkIndexVideo 视频指标概率数据 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 批量删除视频指标概率数据 |
| | | * |
| | | * |
| | | * @param ids 需要删除的视频指标概率数据主键 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 删除视频指标概率数据信息 |
| | | * |
| | | * |
| | | * @param id 视频指标概率数据主键 |
| | | * @return 结果 |
| | | */ |
| | |
| | | import com.mongodb.client.result.DeleteResult; |
| | | import com.ycl.feign.UYClient; |
| | | import com.ycl.platform.domain.param.UY.OneMachineFileParam; |
| | | import com.ycl.platform.domain.param.UY.OsdMonitorParam; |
| | | import com.ycl.platform.domain.param.UY.QueryVqdParam; |
| | | import com.ycl.platform.domain.param.UY.RecordMetaDSumParam; |
| | | import com.ycl.platform.domain.result.UY.OneMachineFileResult; |
| | | import com.ycl.platform.domain.result.UY.OsdMonitorResult; |
| | | import com.ycl.platform.domain.result.UY.QueryVqdResult; |
| | | import com.ycl.platform.domain.result.UY.RecordMetaDSumResult; |
| | | import com.ycl.platform.service.ITMonitorService; |
| | |
| | | } |
| | | log.info("结束执行录像可用数据同步"); |
| | | } |
| | | |
| | | //视频标注 |
| | | public void OsdMonitorTask() { |
| | | //视频标注 |
| | | log.info("开始执行视频标注数据同步"); |
| | | OsdMonitorParam param = new OsdMonitorParam(); |
| | | JSONObject jsonObject = uyClient.osdMonitorList(param); |
| | | if (jsonObject != null) { |
| | | if (jsonObject.getBoolean("success")) { |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | if (data != null) { |
| | | List<OsdMonitorResult> records = data.getList("records", OsdMonitorResult.class); |
| | | if (!CollectionUtils.isEmpty(records)) { |
| | | //如果今天存在之前的数据先删除 |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | DeleteResult result = mongoTemplate.remove(query, OsdMonitorResult.class); |
| | | //存放在mongo中 |
| | | mongoTemplate.insert(records); |
| | | } else { |
| | | log.error("视频标注数据为空{}", data); |
| | | } |
| | | } else { |
| | | log.error("视频标注数据为空{}", jsonObject); |
| | | } |
| | | } else { |
| | | log.error("视频标注数据为空{}", jsonObject); |
| | | } |
| | | } else { |
| | | log.error("视频标注数据为空"); |
| | | } |
| | | log.info("结束执行视频标注数据同步"); |
| | | } |
| | | } |
| | |
| | | package com.ycl.task; |
| | | |
| | | |
| | | import com.ycl.calculate.CalculationStrategy; |
| | | import com.ycl.factory.IndexCalculationFactory; |
| | | import com.ycl.platform.domain.param.UY.RecordMetaDSumParam; |
| | | import com.ycl.platform.domain.result.HK.SnapshotDataMonitorResult; |
| | | import com.ycl.platform.domain.result.UY.QueryVqdResult; |
| | | import com.ycl.utils.DateUtils; |
| | | import constant.ApiConstants; |
| | | import constant.CalculationStrategyConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 视频计算考核指标任务 |
| | |
| | | public class VideoTask { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | public void siteOnlineTask(){ |
| | | 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<QueryVqdResult> results = mongoTemplate.find(query, QueryVqdResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_SiteOnline); |
| | | calculator.calculate(results); |
| | | } |
| | | public void videoUsabilityTask(){ |
| | | 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<RecordMetaDSumParam> results = mongoTemplate.find(query, RecordMetaDSumParam.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_Usability); |
| | | calculator.calculate(results); |
| | | } |
| | | public void oneMonitorFileTask(){ |
| | | //计算一机一档注册率、一机一档合格率、档案考核比 |
| | | } |
| | | public void platformOnlineTask(){ |
| | | //计算平台在线率 |
| | | } |
| | | } |
| | |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ycl.platform.mapper.CheckIndexVideoMapper"> |
| | | |
| | | |
| | | <resultMap type="com.ycl.platform.domain.entity.CheckIndexVideo" id="CheckIndexVideoResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="deptId" column="dept_id" /> |
| | |
| | | <select id="selectCheckIndexVideoList" parameterType="CheckIndexVideo" resultMap="CheckIndexVideoResult"> |
| | | select tciv.*,sd.dept_name |
| | | from t_check_index_video tciv left join sys_dept sd on tciv.dept_id = sd.dept_id |
| | | <where> |
| | | <where> |
| | | <if test="deptId != null "> and tciv.dept_id = #{deptId}</if> |
| | | <if test="examineTag != null "> and examine_tag = #{examineTag}</if> |
| | | <if test="date != null "> and date_format(tciv.create_time,'%Y-%m') = #{date}</if> |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <select id="selectCheckIndexVideoById" resultMap="CheckIndexVideoResult"> |
| | | <include refid="selectCheckIndexVideoVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | |
| | | <insert id="insertCheckIndexVideo" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into t_check_index_video |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | </delete> |
| | | |
| | | <delete id="deleteCheckIndexVideoByIds" > |
| | | delete from t_check_index_video where id in |
| | | delete from t_check_index_video where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |
| | | |
| | | <select id="selectToday"> |
| | | select * from t_check_index_video where DATE(create_time) = #{today} |
| | | </select> |
| | | </mapper> |