xiangpei
2024-08-16 9d30f3aba92b1fe90eaecd486113f544f0f18b7c
ycl-server/src/main/java/com/ycl/calculate/VideoUsabilityCalculation.java
@@ -5,7 +5,9 @@
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.domain.vo.TMonitorVO;
import com.ycl.platform.mapper.CheckIndexVideoMapper;
import com.ycl.platform.mapper.TMonitorMapper;
import com.ycl.platform.service.ICheckIndexVideoService;
import com.ycl.platform.service.ITMonitorService;
import constant.ApiConstants;
@@ -34,7 +36,7 @@
    @Autowired
    private CheckIndexVideoMapper checkIndexVideoMapper;
    @Autowired
    private ITMonitorService monitorService;
    private TMonitorMapper monitorMapper;
    @Autowired
    private ICheckIndexVideoService checkIndexVideoService;
@@ -53,9 +55,8 @@
        }
        //获得国标码为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()));
        Map<String, TMonitorVO> monitorMap = monitorMapper.selectListByIds(list.stream().map(RecordMetaDSumParam::getDeviceId).collect(Collectors.toList()))
                .stream().collect(Collectors.toMap(TMonitorVO::getSerialNumber, Function.identity()));
        //获取省厅国标码集合
        List<String> provinceIds = getProvince();
        //重点点位集合
@@ -63,7 +64,7 @@
        Map<String, AreaStats> areaStatsMap = new HashMap<>();
        for (RecordMetaDSumParam result : list) {
            TMonitor monitor = monitorMap.get(result.getDeviceId());
            TMonitorVO monitor = monitorMap.get(result.getDeviceId());
            if (monitor == null) continue;
            String deptId = monitor.getDeptId().toString();
@@ -71,7 +72,7 @@
            // 处理省厅数据
            if (!CollectionUtils.isEmpty(provinceIds) && provinceIds.contains(monitor.getSerialNumber())) {
                String provinceKey = "Province_" + deptId;
                String provinceKey = ApiConstants.Province + deptId;
                updateAreaStats(areaStatsMap, provinceKey, result, important);
            }
        }
@@ -81,9 +82,9 @@
        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);
                CheckIndexVideo checkIndexVideo = createOrUpdateCheckIndexVideo(deptId, stats, checkIndexVideoList);
                if (checkIndexVideo != null) {
                    checkIndexVideos.add(checkIndexVideo);
                }
            }
        });
@@ -113,7 +114,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;