| | |
| | | |
| | | import com.ycl.calculate.CalculationStrategy; |
| | | import com.ycl.factory.IndexCalculationFactory; |
| | | import com.ycl.platform.domain.entity.CheckIndexVideo; |
| | | 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.platform.domain.result.UY.*; |
| | | import com.ycl.platform.domain.vo.PlatformOnlineVO; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.CheckIndexVideoMapper; |
| | | import com.ycl.platform.mapper.PlatformOnlineMapper; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.service.PlatformOnlineService; |
| | | import com.ycl.system.mapper.SysDeptMapper; |
| | | import com.ycl.utils.DateUtils; |
| | | import constant.ApiConstants; |
| | | import constant.CalculationStrategyConstants; |
| | | import constant.CheckConstants; |
| | | import enumeration.general.AreaDeptEnum; |
| | | 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 org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 视频计算考核指标任务 |
| | | * 凌晨执行计算昨天数据 |
| | | * */ |
| | | */ |
| | | @Slf4j |
| | | @Component("videoTask") |
| | | public class VideoTask { |
| | |
| | | private MongoTemplate mongoTemplate; |
| | | @Autowired |
| | | private PlatformOnlineMapper platformOnlineMapper; |
| | | @Autowired |
| | | private TMonitorMapper monitorMapper; |
| | | |
| | | public void siteOnlineTask(){ |
| | | public void siteOnlineTask() { |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //计算点位在线率和重点点位在线率 |
| | | //TODO:时间写死了 |
| | | Date date = DateUtils.getDay(2024,7,13); |
| | | //计算点位在线率和重点点位在线率和指挥图像在线率 |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(date)).lt(DateUtils.getDayEnd(date))); |
| | | |
| | | List<QueryVqdResult> results = mongoTemplate.find(query, QueryVqdResult.class); |
| | | List<VideoOnlineResult> results = mongoTemplate.find(query, VideoOnlineResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_SiteOnline); |
| | | calculator.calculate(results); |
| | | } |
| | | public void videoUsabilityTask(){ |
| | | |
| | | public void videoUsabilityTask() { |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //TODO:时间写死了 |
| | | Date date = DateUtils.getDay(2024,7,13); |
| | | //计算录像可用率和重点录像可用率 |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(date)).lt(DateUtils.getDayEnd(date))); |
| | | |
| | | List<RecordMetaDSumParam> results = mongoTemplate.find(query, RecordMetaDSumParam.class); |
| | | List<RecordMetaDSumResult> results = mongoTemplate.find(query, RecordMetaDSumResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_Usability); |
| | | calculator.calculate(results); |
| | | } |
| | | public void oneMonitorFileTask(){ |
| | | //计算一机一档注册率、一机一档合格率、档案考核比 |
| | | |
| | | public void oneMonitorFileTask() { |
| | | //计算一机一档注册率、档案考核比 |
| | | List<TMonitorVO> tMonitorVOS = monitorMapper.selectMonitorVOList(); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_MonitorRegis_ArchiveRate); |
| | | calculator.calculate(tMonitorVOS); |
| | | } |
| | | public void platformOnlineTask(){ |
| | | public void oneMonitorQualifyTask(){ |
| | | //计算一机一档合格率 |
| | | // Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //TODO:时间写死了 |
| | | Date date = DateUtils.getDay(2024,7,13); |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(date)).lt(DateUtils.getDayEnd(date))); |
| | | List<MonitorQualifyResult> results = mongoTemplate.find(query, MonitorQualifyResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_MonitorQualify); |
| | | calculator.calculate(results); |
| | | } |
| | | public void platformOnlineTask() { |
| | | //计算平台在线率 |
| | | //拿到今日离线时长数据 |
| | | Integer time = platformOnlineMapper.sumOffTime(DateUtils.getMouthStart(new Date()),DateUtils.getMouthEnd(new Date())); |
| | | |
| | | List<PlatformOnlineVO> list = platformOnlineMapper.yesterdayData(DateUtils.getMouthStart(new Date()), DateUtils.getMouthEnd(new Date())); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_PlatformOnline); |
| | | calculator.calculate(list); |
| | | } |
| | | public void osdTask() { |
| | | //计算Osd标注、时间准确率 |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //TODO:时间写死了 |
| | | Date date = DateUtils.getDay(2024,7,13); |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(date)).lt(DateUtils.getDayEnd(date))); |
| | | List<PyOsdResult> results = mongoTemplate.find(query, PyOsdResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_OsdTime); |
| | | calculator.calculate(results); |
| | | } |
| | | |
| | | } |