fuliqi
2024-08-09 c8ca3c42906b89c5de910ad3ff9f164e6b846a4c
ycl-server/src/main/java/com/ycl/task/VideoTask.java
@@ -6,6 +6,7 @@
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.MonitorQualifyResult;
import com.ycl.platform.domain.result.UY.QueryVqdResult;
import com.ycl.platform.domain.vo.PlatformOnlineVO;
import com.ycl.platform.mapper.CheckIndexVideoMapper;
@@ -41,14 +42,11 @@
    private MongoTemplate mongoTemplate;
    @Autowired
    private PlatformOnlineMapper platformOnlineMapper;
    @Autowired
    private CheckIndexVideoMapper videoMapper;
    @Autowired
    private SysDeptMapper deptMapper;
    public void siteOnlineTask() {
        Date yesterday = DateUtils.addDays(new Date(), -1);
        //计算点位在线率和重点点位在线率
        //TODO:计算点位在线率和重点点位在线率
        Query query = new Query();
        query.addCriteria(Criteria
                .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday)));
@@ -71,31 +69,26 @@
    }
    public void oneMonitorFileTask() {
        //计算一机一档注册率、一机一档合格率、档案考核比
        //计算一机一档注册率、档案考核比
    }
    public void oneMonitorQualifyTask(){
        //计算一机一档合格率
        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<MonitorQualifyResult> results = mongoTemplate.find(query, MonitorQualifyResult.class);
        CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_MonitorQualify);
        calculator.calculate(results);
    }
    public void platformOnlineTask() {
        //计算平台在线率
        //拿到今日离线时长数据
        List<PlatformOnlineVO> list = platformOnlineMapper.sumYesterday(DateUtils.getMouthStart(new Date()), DateUtils.getMouthEnd(new Date()));
//        int num = (time / 60) % 30;
//        double score = Math.max(1 - num * 0.1, 0);
//        List<CheckIndexVideo> checkIndexVideos = videoMapper.selectToday(DateUtils.getDate());
//        List<Long> deptIds = deptMapper.selectByParentId(207L);
//        Map<String, CheckIndexVideo> map = new HashMap<>();
//        for (Long deptId : deptIds) {
//            CheckIndexVideo video = new CheckIndexVideo();
//            video.setExamineTag(CheckConstants.Examine_Tag_County);
//            map.put(deptId + "", video);
//            CheckIndexVideo provinceVideo = new CheckIndexVideo();
//            provinceVideo.setExamineTag(CheckConstants.Examine_Tag_Province);
//            map.put("Province_" + deptId, new CheckIndexVideo());
//        }
//        map.forEach((deptId, video) -> {
//
//        });
        CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_PlatformOnline);
        calculator.calculate(list);
    }
}