fuliqi
2024-08-08 8cd9885418c811542c28434da5b1805a4a690092
ycl-server/src/main/java/com/ycl/task/VideoTask.java
@@ -3,23 +3,32 @@
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.vo.PlatformOnlineVO;
import com.ycl.platform.mapper.CheckIndexVideoMapper;
import com.ycl.platform.mapper.PlatformOnlineMapper;
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;
/**
 * 视频计算考核指标任务
@@ -32,6 +41,10 @@
    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);
@@ -64,9 +77,25 @@
    public void platformOnlineTask() {
        //计算平台在线率
        //拿到今日离线时长数据
        Integer time = platformOnlineMapper.sumOffTime(DateUtils.getMouthStart(new Date()), DateUtils.getMouthEnd(new Date()));
        int num = (time / 60) % 30;
        double score = Math.max(1 - num * 0.1,0);
        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) -> {
//
//        });
    }
}