fuliqi
2024-08-19 fb7012d6016229ad0159efebddf64be1fd3e642f
ycl-server/src/main/java/com/ycl/calculate/VideoOnlineCalculation.java
@@ -13,6 +13,7 @@
import com.ycl.platform.service.ICheckIndexVideoService;
import com.ycl.platform.service.ITMonitorService;
import constant.ApiConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
@@ -34,6 +35,7 @@
 * 更新或新增
 */
@Component
@Slf4j
public class VideoOnlineCalculation extends IndexCalculationServe implements CalculationStrategy<VideoOnlineResult> {
    @Autowired
    private CheckIndexVideoMapper checkIndexVideoMapper;
@@ -55,6 +57,7 @@
    @Override
    public void calculate(List<VideoOnlineResult> list) {
        if (CollectionUtils.isEmpty(list)) {
            log.info("数据为空");
            return;
        }
@@ -88,7 +91,7 @@
        List<CheckIndexVideo> checkIndexVideos = new ArrayList<>();
        areaStatsMap.forEach((deptId, stats) -> {
            if (stats.totalSites > 0) {
                CheckIndexVideo CheckIndexVideo = createOrUpdateCheckIndexFace(deptId, stats, checkIndexVideoList);
                CheckIndexVideo CheckIndexVideo = createOrUpdateCheckIndexVideo(deptId, stats, checkIndexVideoList);
                if (CheckIndexVideo != null) {
                    checkIndexVideos.add(CheckIndexVideo);
                }
@@ -127,7 +130,7 @@
    /**
     * 视频点位在线率
     */
    private CheckIndexVideo createOrUpdateCheckIndexFace(String key, AreaStats stats, List<CheckIndexVideo> checkIndexVideoList) {
    private CheckIndexVideo createOrUpdateCheckIndexVideo(String key, AreaStats stats, List<CheckIndexVideo> checkIndexVideoList) {
        CheckIndexVideo checkIndexVideo = getCheckIndex(key, checkIndexVideoList, CheckIndexVideo.class);
        if (checkIndexVideo == null) {
            return null;
@@ -140,15 +143,15 @@
        checkIndexVideo.setSiteOnline(siteOnline);
        //调用点位在线率计算方法 计算重点点位在线率
        Map<String, Object> importantParam = new HashMap<>();
        param.put("totalSites", stats.importantSites);
        param.put("onlineSites", stats.importantOnlineSites);
        importantParam.put("totalSites", stats.importantSites);
        importantParam.put("onlineSites", stats.importantOnlineSites);
        BigDecimal importantSiteOnline = siteOnline(importantParam);
        checkIndexVideo.setKeySiteOnline(importantSiteOnline);
        //调用点位在线率计算方法 计算指挥图像在线率
        Map<String, Object> commandParam = new HashMap<>();
        param.put("totalSites", stats.commandSites);
        param.put("onlineSites", stats.commandOnlineSites);
        BigDecimal commandSiteOnline = siteOnline(importantParam);
        commandParam.put("totalSites", stats.commandSites);
        commandParam.put("onlineSites", stats.commandOnlineSites);
        BigDecimal commandSiteOnline = siteOnline(commandParam);
        checkIndexVideo.setKeyCommandImageOnline(commandSiteOnline);
        return checkIndexVideo;
    }