| | |
| | | import com.ycl.platform.service.ICheckIndexVideoService; |
| | | import constant.ApiConstants; |
| | | import constant.RedisConstant; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class MonitorRegistrationCalculation extends IndexCalculationServe implements CalculationStrategy<TMonitorVO> { |
| | | @Autowired |
| | | private CheckIndexVideoMapper checkIndexVideoMapper; |
| | |
| | | @Override |
| | | public void calculate(List<TMonitorVO> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | //获得国标码为key的设备map |
| | |
| | | // 查询是否index表已经存在今日数据 |
| | | List<CheckIndexVideo> checkIndexVideoList = checkIndexVideoMapper.selectToday(DateUtils.getDate()); |
| | | List<CheckIndexVideo> checkIndexVideos = new ArrayList<>(); |
| | | areaStatsMap.forEach((deptId, stats) -> { |
| | | areaStatsMap.forEach((key, stats) -> { |
| | | if (stats.totalSites > 0) { |
| | | CheckIndexVideo CheckIndexVideo = createOrUpdateCheckIndexVideo(deptId, stats, checkIndexVideoList); |
| | | if (CheckIndexVideo != null) { |
| | | checkIndexVideos.add(CheckIndexVideo); |
| | | CheckIndexVideo checkIndexVideo = createOrUpdateCheckIndexVideo(key, stats, checkIndexVideoList); |
| | | if (checkIndexVideo != null) { |
| | | checkIndexVideos.add(checkIndexVideo); |
| | | } |
| | | } |
| | | }); |
| | |
| | | BigDecimal monitorRegistration = monitorRegistration(param); |
| | | checkIndexVideo.setMonitorRegistration(monitorRegistration); |
| | | //调用档案考核比计算 |
| | | Map<String, Object> importantParam = new HashMap<>(); |
| | | param.put("allFiles", stats.allFiles); |
| | | param.put("todayFiles", stats.todayFiles); |
| | | BigDecimal archivesRate = archivesRate(importantParam); |
| | | Map<String, Object> archiveParam = new HashMap<>(); |
| | | archiveParam.put("allFiles", stats.allFiles); |
| | | archiveParam.put("todayFiles", stats.todayFiles); |
| | | BigDecimal archivesRate = archivesRate(archiveParam); |
| | | checkIndexVideo.setArchivesRate(archivesRate); |
| | | |
| | | return checkIndexVideo; |