| | |
| | | |
| | | /** 视频传输网危险资产得分比重 */ |
| | | @Excel(name = "视频传输网危险资产得分比重",width = 25) |
| | | @TableField("video_transmission_dangerous_assetsScore") |
| | | @TableField("video_transmission_dangerous_assets_score") |
| | | private BigDecimal videoTransmissionDangerousAssetsScore; |
| | | |
| | | /** 视频传输网边界完整性检测扣分项 */ |
| | |
| | | import com.ycl.system.mapper.SysConfigMapper; |
| | | import constant.ApiConstants; |
| | | import constant.CheckSnapCountConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class CarClockAccuracyCalculation extends IndexCalculationServe implements CalculationStrategy<VehicleDeviceInspectionResult> { |
| | | @Autowired |
| | | private CheckIndexCarMapper checkIndexCarMapper; |
| | |
| | | @Override |
| | | public void calculate(List<VehicleDeviceInspectionResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | |
| | |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | 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 CarConsistentCalculation extends IndexCalculationServe implements CalculationStrategy<TMonitorVO> { |
| | | @Autowired |
| | | private CheckIndexCarMapper checkIndexCarMapper; |
| | |
| | | @Override |
| | | public void calculate(List<TMonitorVO> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | //返回以国标码为key的设备map |
| | |
| | | import com.ycl.system.mapper.SysConfigMapper; |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class CarDataIntegrityCalculation extends IndexCalculationServe implements CalculationStrategy<DataIntegrityMonitoringResult> { |
| | | @Autowired |
| | | private CheckIndexCarMapper checkIndexCarMapper; |
| | |
| | | @Override |
| | | public void calculate(List<DataIntegrityMonitoringResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | //返回以国标码为key的设备map |
| | |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.service.ICheckIndexCarService; |
| | | 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; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class CarDeviceSampleCalculation extends IndexCalculationServe implements CalculationStrategy<VehicleDeviceSamplingResult> { |
| | | @Autowired |
| | | private CheckIndexCarMapper checkIndexCarMapper; |
| | |
| | | @Override |
| | | public void calculate(List<VehicleDeviceSamplingResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | //返回以国标码为key的设备map |
| | |
| | | checkIndexCar.setVehicleUrlAvailability(urlUsability); |
| | | //调用大图可用性计算方法 |
| | | Map<String, Object> usabilityParam = new HashMap<>(); |
| | | urlParam.put("totalSites", stats.totalSites); |
| | | urlParam.put("picUsabilitySites", stats.picUsabilitySites); |
| | | usabilityParam.put("totalSites", stats.totalSites); |
| | | usabilityParam.put("picUsabilitySites", stats.picUsabilitySites); |
| | | BigDecimal picUsability = picUsability(usabilityParam); |
| | | checkIndexCar.setVehiclePictureAvailability(picUsability); |
| | | return checkIndexCar; |
| | |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import constant.CheckSnapCountConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class CarInFoAccuracyCalculation extends IndexCalculationServe implements CalculationStrategy<CrossDetailResult> { |
| | | @Autowired |
| | | private CheckIndexCarMapper checkIndexCarMapper; |
| | |
| | | @Override |
| | | public void calculate(List<CrossDetailResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | //返回以国标码为key的设备map |
| | |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import constant.CheckSnapCountConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class CarSnapshopDataCalculation extends IndexCalculationServe implements CalculationStrategy<SnapshotDataMonitorResult> { |
| | | @Autowired |
| | | private CheckIndexCarMapper checkIndexCarMapper; |
| | |
| | | @Override |
| | | public void calculate(List<SnapshotDataMonitorResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | |
| | |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import constant.CheckSnapCountConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class CarSnapshotDelayCalculation extends IndexCalculationServe implements CalculationStrategy<SnapshotDelayMonitorResult> { |
| | | @Autowired |
| | | private CheckIndexCarMapper checkIndexCarMapper; |
| | |
| | | @Override |
| | | public void calculate(List<SnapshotDelayMonitorResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | |
| | |
| | | import com.ycl.platform.service.ICheckIndexFaceService; |
| | | 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; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class FaceClockAccuracyCalculation extends IndexCalculationServe implements CalculationStrategy<FaceDeviceInspectionResult> { |
| | | @Autowired |
| | | private CheckIndexFaceMapper CheckIndexFaceMapper; |
| | |
| | | @Override |
| | | public void calculate(List<FaceDeviceInspectionResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | |
| | |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | 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 FaceConsistentCalculation extends IndexCalculationServe implements CalculationStrategy<TMonitorVO> { |
| | | @Autowired |
| | | private CheckIndexFaceMapper checkIndexFaceMapper; |
| | |
| | | @Override |
| | | public void calculate(List<TMonitorVO> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | //返回以国标码为key的设备map |
| | |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.service.ICheckIndexFaceService; |
| | | 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; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class FaceDeviceSampleCalculation extends IndexCalculationServe implements CalculationStrategy<FaceDeviceSamplingResult> { |
| | | @Autowired |
| | | private CheckIndexFaceMapper checkIndexFaceMapper; |
| | |
| | | @Override |
| | | public void calculate(List<FaceDeviceSamplingResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | //返回以国标码为key的设备map |
| | |
| | | import com.ycl.system.mapper.SysConfigMapper; |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class FaceInFoAccuracyCalculation extends IndexCalculationServe implements CalculationStrategy<MonitoringDetailResult> { |
| | | @Autowired |
| | | private CheckIndexFaceMapper checkIndexFaceMapper; |
| | |
| | | @Override |
| | | public void calculate(List<MonitoringDetailResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | //返回以国标码为key的设备map |
| | |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import constant.CheckSnapCountConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | //TODD:系统配置里的区分人脸和车辆、累加次数的概念、区县不少于40路,不达标市州的当月该项成绩不能得分。 |
| | | public class FaceSnapshotDataCalculation extends IndexCalculationServe implements CalculationStrategy<SnapshotDataMonitorResult> { |
| | | @Autowired |
| | |
| | | @Override |
| | | public void calculate(List<SnapshotDataMonitorResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | //返回以国标码为key的设备map |
| | |
| | | import com.ycl.platform.service.ICheckIndexFaceService; |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class FaceSnapshotDelayCalculation extends IndexCalculationServe implements CalculationStrategy<SnapshotDelayMonitorResult> { |
| | | @Autowired |
| | | private CheckIndexFaceMapper checkIndexFaceMapper; |
| | |
| | | @Override |
| | | public void calculate(List<SnapshotDelayMonitorResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | |
| | |
| | | BigDecimal qualifyMonitor = new BigDecimal((Integer) param.get("qualifyMonitor")); |
| | | return qualifyMonitor.divide(totalMonitors, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //一机一档注册率率 |
| | | public BigDecimal monitorRegistration(Map<String, Object> param) { |
| | | //新+正在用的档案数 |
| | |
| | | BigDecimal useSites = new BigDecimal((Integer) param.get("totalSites") - (Integer) param.get("newSites")); |
| | | return useSites.divide(totalSites, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //档案考核比 |
| | | public BigDecimal archivesRate(Map<String, Object> param) { |
| | | BigDecimal allFiles = new BigDecimal((Integer) param.get("allFiles")); |
| | | BigDecimal todayFiles = new BigDecimal((Integer) param.get("todayFiles")); |
| | | return todayFiles.divide(allFiles, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //点位在线率 |
| | | public BigDecimal siteOnline(Map<String, Object> param) { |
| | | BigDecimal totalSites = new BigDecimal((Integer) param.get("totalSites")); |
| | |
| | | BigDecimal osdAccuracySites = new BigDecimal((Integer) param.get("osdAccuracySites")); |
| | | return osdAccuracySites.divide(totalSites, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //视频时间合格率 |
| | | public BigDecimal osdTimeAccuracy(Map<String, Object> param) { |
| | | BigDecimal totalSites = new BigDecimal((Integer) param.get("totalSites")); |
| | |
| | | } |
| | | return result.max(BigDecimal.ZERO); |
| | | } |
| | | |
| | | //视图库对接稳定性 |
| | | public BigDecimal viewConnectStability(Map<String, Object> param) { |
| | | BigDecimal totalDataSum = new BigDecimal((Integer) param.get("totalDataSum")); |
| | |
| | | List<YwPoint> commandImages = pointMapper.selectByTag(null, null, Boolean.TRUE); |
| | | return CollectionUtils.isEmpty(commandImages) ? new ArrayList<>() : commandImages.stream().map(YwPoint::getSerialNumber).collect(Collectors.toList()); |
| | | } |
| | | |
| | | //返回monitor |
| | | //TODO:时间写死了 |
| | | public List<String> getMonitorFromMongo() { |
| | |
| | | |
| | | return CollectionUtils.isEmpty(oneMachineFileResults) ? new ArrayList<>() : oneMachineFileResults.stream().map(result -> result.getSerialNumber().getValue()).collect(Collectors.toList()); |
| | | } |
| | | |
| | | //检查是否存在当日数据 |
| | | public <T extends CheckIndex> T getCheckIndex(String key, List<T> checkIndexList, Class<T> clazz) { |
| | | T checkIndex; |
| | | |
| | | // 检查是否已存在今日数据 |
| | | Optional<T> existingIndex = checkIndexList.stream() |
| | | .filter(index -> key.equals(index.getDeptId().toString()) && |
| | | (key.startsWith(ApiConstants.Province) ? CheckConstants.Examine_Tag_Province.equals(index.getExamineTag()) |
| | | : CheckConstants.Examine_Tag_County.equals(index.getExamineTag()))) |
| | | .filter(index -> key.startsWith(ApiConstants.Province) ? |
| | | CheckConstants.Examine_Tag_Province.equals(index.getExamineTag()) && key.split("_")[1].equals(index.getDeptId().toString()) |
| | | : CheckConstants.Examine_Tag_County.equals(index.getExamineTag()) && key.equals(index.getDeptId().toString())) |
| | | .findFirst(); |
| | | |
| | | if (existingIndex.isPresent()) { |
| | |
| | | } |
| | | return checkIndex; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.service.ICheckIndexVideoService; |
| | | 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; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class MonitorQualifyCalculation extends IndexCalculationServe implements CalculationStrategy<MonitorQualifyResult> { |
| | | @Autowired |
| | | private CheckIndexVideoMapper checkIndexVideoMapper; |
| | |
| | | @Override |
| | | public void calculate(List<MonitorQualifyResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | |
| | |
| | | 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; |
| | |
| | | import com.ycl.system.mapper.SysDeptMapper; |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * 不区分区域 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class PlatformOnlineCalculation extends IndexCalculationServe implements CalculationStrategy<PlatformOnlineVO> { |
| | | @Autowired |
| | | private SysDeptMapper deptMapper; |
| | |
| | | videos.add(checkIndex); |
| | | } |
| | | }); |
| | | |
| | | checkIndexVideoService.saveOrUpdateBatch(videos); |
| | | }else { |
| | | log.info("数据为空"); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class VideoOnlineCalculation extends IndexCalculationServe implements CalculationStrategy<VideoOnlineResult> { |
| | | @Autowired |
| | | private CheckIndexVideoMapper checkIndexVideoMapper; |
| | |
| | | @Override |
| | | public void calculate(List<VideoOnlineResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.service.ICheckIndexVideoService; |
| | | 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; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class VideoOsdCalculation extends IndexCalculationServe implements CalculationStrategy<PyOsdResult> { |
| | | @Autowired |
| | | private CheckIndexVideoMapper checkIndexVideoMapper; |
| | |
| | | @Override |
| | | public void calculate(List<PyOsdResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | |
| | |
| | | checkIndexVideo.setAnnotationAccuracy(osdAccuracy); |
| | | //调用osd标注计算方法 计算重点osd标注 |
| | | Map<String, Object> importantParam = new HashMap<>(); |
| | | param.put("totalSites", stats.importantTotalSites); |
| | | param.put("osdAccuracySites", stats.importantOsdAccuracySites); |
| | | importantParam.put("totalSites", stats.importantTotalSites); |
| | | importantParam.put("osdAccuracySites", stats.importantOsdAccuracySites); |
| | | BigDecimal imOsdAccuracy = osdAccuracy(importantParam); |
| | | checkIndexVideo.setKeyAnnotationAccuracy(imOsdAccuracy); |
| | | |
| | | //调用osd时间准确率 |
| | | Map<String, Object> timeParam = new HashMap<>(); |
| | | param.put("totalSites", stats.totalSites); |
| | | param.put("timeAccuracySites", stats.timeAccuracySites); |
| | | timeParam.put("totalSites", stats.totalSites); |
| | | timeParam.put("timeAccuracySites", stats.timeAccuracySites); |
| | | BigDecimal osdTimeAccuracy = osdTimeAccuracy(timeParam); |
| | | checkIndexVideo.setTimingAccuracy(osdTimeAccuracy); |
| | | //调用osd时间准确率,计算重点 |
| | | Map<String, Object> importantTimeParam = new HashMap<>(); |
| | | param.put("totalSites", stats.importantTotalSites); |
| | | param.put("timeAccuracySites", stats.importantTimeAccuracySites); |
| | | importantTimeParam.put("totalSites", stats.importantTotalSites); |
| | | importantTimeParam.put("timeAccuracySites", stats.importantTimeAccuracySites); |
| | | BigDecimal imOsdTimeAccuracy = osdTimeAccuracy(importantTimeParam); |
| | | checkIndexVideo.setKeyTimingAccuracy(imOsdTimeAccuracy); |
| | | return checkIndexVideo; |
| | |
| | | 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.result.UY.RecordMetaDSumResult; |
| | | 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; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | public class VideoUsabilityCalculation extends IndexCalculationServe implements CalculationStrategy<RecordMetaDSumParam> { |
| | | @Slf4j |
| | | public class VideoUsabilityCalculation extends IndexCalculationServe implements CalculationStrategy<RecordMetaDSumResult> { |
| | | @Autowired |
| | | private CheckIndexVideoMapper checkIndexVideoMapper; |
| | | @Autowired |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void calculate(List<RecordMetaDSumParam> list) { |
| | | public void calculate(List<RecordMetaDSumResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | log.info("数据为空"); |
| | | return; |
| | | } |
| | | |
| | | //获得国标码为key的设备map |
| | | Map<String, TMonitorVO> monitorMap = monitorMapper.selectListByIds(list.stream().map(RecordMetaDSumParam::getDeviceId).collect(Collectors.toList())) |
| | | Map<String, TMonitorVO> monitorMap = monitorMapper.selectListByIds(list.stream().map(RecordMetaDSumResult::getDeviceId).collect(Collectors.toList())) |
| | | .stream().collect(Collectors.toMap(TMonitorVO::getSerialNumber, Function.identity())); |
| | | //获取省厅国标码集合 |
| | | List<String> provinceIds = getProvince(); |
| | |
| | | List<String> important = getImportant(); |
| | | |
| | | Map<String, AreaStats> areaStatsMap = new HashMap<>(); |
| | | for (RecordMetaDSumParam result : list) { |
| | | for (RecordMetaDSumResult result : list) { |
| | | TMonitorVO monitor = monitorMap.get(result.getDeviceId()); |
| | | if (monitor == null) continue; |
| | | |
| | |
| | | /** |
| | | * 累计总点位数、在线点位数、重点点位数、重点点位在线数 |
| | | */ |
| | | private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, RecordMetaDSumParam result, List<String> important) { |
| | | private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, RecordMetaDSumResult result, List<String> important) { |
| | | //返回对象的引用,如果不存在会放入新的key,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | |
| | | checkIndexVideo.setVideoAvailable(videoUsability); |
| | | //调用录像可用率计算方法 计算重点点位录像可用率 |
| | | Map<String, Object> importantParam = new HashMap<>(); |
| | | param.put("totalSites", stats.importantSites); |
| | | param.put("usabilitySites", stats.importantUsabilitySites); |
| | | importantParam.put("totalSites", stats.importantSites); |
| | | importantParam.put("usabilitySites", stats.importantUsabilitySites); |
| | | BigDecimal importantVideoUsability = videoUsability(importantParam); |
| | | checkIndexVideo.setKeyVideoAvailable(importantVideoUsability); |
| | | return checkIndexVideo; |
| | |
| | | //同步mongodb一机一档到数据库 |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void synchronize() { |
| | | log.info("开始同步mongodb一机一档到数据库"); |
| | | Date date = DateUtils.getDay(2024,7,13); |
| | | Query query = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(date)).lt(DateUtils.getDayEnd(date))); |
| | | // Query query = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | |
| | | } |
| | | //新的数据放入Redis中等待考核指标任务使用 |
| | | redisTemplate.opsForValue().set(RedisConstant.New_Monitor_Set, JSONArray.toJSONString(newMonitorList)); |
| | | log.info("结束同步mongodb一机一档到数据库"); |
| | | } |
| | | |
| | | private YwPoint getPoint(MonitorQualifyResult result, Map<String, YwPoint> pointMap, List<String> importantSite) { |
| | |
| | | log.info("结束执行图像监测数据同步"); |
| | | } |
| | | |
| | | // //一机一档 |
| | | // public void monitorTask() { |
| | | // // 一机一档注册率 |
| | | // // 档案考核比 |
| | | // log.info("开始执行一机一档数据同步"); |
| | | // OneMachineFileParam param = new OneMachineFileParam(); |
| | | // param.setOffset(ApiConstants.PageNo); |
| | | // param.setLimit(ApiConstants.PageSize); |
| | | // JSONObject jsonObject = uyClient.oneMachineFile(param); |
| | | // if (jsonObject != null) { |
| | | // JSONObject cameraList = jsonObject.getJSONObject("CameraList"); |
| | | // if (cameraList != null) { |
| | | // List<OneMachineFileResult> data = cameraList.getList("data", OneMachineFileResult.class); |
| | | // if (!CollectionUtils.isEmpty(data)) { |
| | | // //如果今天存在之前的数据先删除 |
| | | // Query query = new Query(Criteria |
| | | // .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | // DeleteResult result = mongoTemplate.remove(query, OneMachineFileResult.class); |
| | | // //存放在mongo中 |
| | | // mongoTemplate.insertAll(data); |
| | | // } else { |
| | | // log.error("一机一档数据为空{}", cameraList); |
| | | // } |
| | | // } else { |
| | | // log.error("一机一档数据为空{}", jsonObject); |
| | | // } |
| | | // } else { |
| | | // log.error("一机一档数据为空"); |
| | | // } |
| | | // log.info("结束执行一机一档数据同步"); |
| | | // } |
| | | |
| | | //一机一档 |
| | | public void monitorQualifyTask() { |
| | | //一机一档合格率 |
| | |
| | | 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.PyOsdResult; |
| | | import com.ycl.platform.domain.result.UY.QueryVqdResult; |
| | | import com.ycl.platform.domain.result.UY.VideoOnlineResult; |
| | | import com.ycl.platform.domain.result.UY.*; |
| | | import com.ycl.platform.domain.vo.PlatformOnlineVO; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.CheckIndexVideoMapper; |
| | |
| | | |
| | | public void siteOnlineTask() { |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //TODO:时间写死了 |
| | | Date date = DateUtils.getDay(2024,7,13); |
| | | //计算点位在线率和重点点位在线率和指挥图像在线率 |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(date)).lt(DateUtils.getDayEnd(date))); |
| | | |
| | | List<VideoOnlineResult> results = mongoTemplate.find(query, VideoOnlineResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_SiteOnline); |
| | |
| | | |
| | | public void videoUsabilityTask() { |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //TODO:时间写死了 |
| | | Date date = DateUtils.getDay(2024,7,13); |
| | | //计算录像可用率和重点录像可用率 |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(date)).lt(DateUtils.getDayEnd(date))); |
| | | |
| | | List<RecordMetaDSumParam> results = mongoTemplate.find(query, RecordMetaDSumParam.class); |
| | | List<RecordMetaDSumResult> results = mongoTemplate.find(query, RecordMetaDSumResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_Usability); |
| | | calculator.calculate(results); |
| | | } |
| | |
| | | public void oneMonitorFileTask() { |
| | | //计算一机一档注册率、档案考核比 |
| | | List<TMonitorVO> tMonitorVOS = monitorMapper.selectMonitorVOList(); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_Usability); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_MonitorRegis_ArchiveRate); |
| | | calculator.calculate(tMonitorVOS); |
| | | } |
| | | //TODO:时间写死了 |
| | | public void oneMonitorQualifyTask(){ |
| | | //计算一机一档合格率 |
| | | // Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //TODO:时间写死了 |
| | | Date date = DateUtils.getDay(2024,7,13); |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | |
| | | public void osdTask() { |
| | | //计算Osd标注、时间准确率 |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //TODO:时间写死了 |
| | | Date date = DateUtils.getDay(2024,7,13); |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(date)).lt(DateUtils.getDayEnd(date))); |
| | | List<PyOsdResult> results = mongoTemplate.find(query, PyOsdResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_OsdTime); |
| | | calculator.calculate(results); |
| | |
| | | spring: |
| | | # 数据源配置 |
| | | datasource: |
| | | url: jdbc:mysql://51.92.65.72:3306/zgyw?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://51.92.65.72:3306/zgyw?useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8&rewriteBatchedStatements=true |
| | | username: root |
| | | password: zgyw@202488 |
| | | type: com.alibaba.druid.pool.DruidDataSource |