| | |
| | | */ |
| | | public class CalculationStrategyConstants { |
| | | /** |
| | | * 车辆点位在线率和视图库对接稳定性 |
| | | * 车辆点位在线率 |
| | | */ |
| | | public static final String Car_SiteOnline_ViewStability = "carSiteOnlineViewStability"; |
| | | public static final String Car_SiteOnline = "carSiteOnline"; |
| | | /** |
| | | * 车辆点视图库对接稳定性 |
| | | */ |
| | | public static final String Car_ViewStability = "carViewStability"; |
| | | /** |
| | | * 车辆抓拍数据准确性、url、大图可用性 |
| | | */ |
| | |
| | | */ |
| | | public static final String Face_SnapshotDelay = "faceSnapshotDelay"; |
| | | /** |
| | | * 人脸点位在线率和视图库对接稳定性 |
| | | * 人脸点位在线率 |
| | | */ |
| | | public static final String Face_SiteOnline_ViewStability = "faceSiteOnlineViewStability"; |
| | | public static final String Face_SiteOnline = "faceSiteOnline"; |
| | | /** |
| | | * 人脸视图库对接稳定性 |
| | | */ |
| | | public static final String Face_ViewStability = "faceViewStability"; |
| | | /** |
| | | * 车辆抓拍数据准确性、url、大图可用性 |
| | | */ |
New file |
| | |
| | | package com.ycl.platform.domain.result.SYS; |
| | | |
| | | |
| | | import com.ycl.platform.domain.result.BaseResult; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 点位在线率 |
| | | */ |
| | | @Data |
| | | public class TMonitorResult extends BaseResult { |
| | | /** 部门id */ |
| | | private Integer deptId; |
| | | /** 在线 */ |
| | | private Boolean online; |
| | | } |
| | |
| | | private String error; |
| | | private String unitName; |
| | | private LocalDate mongoCreateTime; |
| | | |
| | | /** |
| | | * 当日接收到的当日抓拍量 |
| | | */ |
| | |
| | | package com.ycl.calculate; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ycl.platform.domain.entity.CheckIndexCar; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.result.HK.DataIntegrityMonitoringResult; |
| | | import com.ycl.platform.domain.result.HK.SnapshotDataMonitorResult; |
| | | import com.ycl.platform.domain.result.HK.VehicleDeviceInspectionResult; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.CheckIndexCarMapper; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.service.ICheckIndexCarService; |
| | | import com.ycl.platform.service.ITMonitorService; |
| | | 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; |
| | | import utils.DateUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 计算车辆时钟准确性 |
| | |
| | | package com.ycl.calculate; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.ycl.platform.domain.entity.CheckIndexCar; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.result.HK.DataIntegrityMonitoringResult; |
| | | import com.ycl.platform.domain.result.HK.VehicleDeviceInspectionResult; |
| | | import com.ycl.platform.domain.result.UY.MonitorQualifyResult; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.CheckIndexCarMapper; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.service.ICheckIndexCarService; |
| | | 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; |
| | | import org.springframework.util.CollectionUtils; |
| | | import utils.DateUtils; |
| | | import utils.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 计算车辆目录一致率 |
| | |
| | | @Autowired |
| | | private CheckIndexCarMapper checkIndexCarMapper; |
| | | @Autowired |
| | | private TMonitorMapper monitorMapper; |
| | | @Autowired |
| | | private ICheckIndexCarService checkIndexCarService; |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | //区域车辆目录一致率的内部类 |
| | | protected static class AreaStats { |
| | |
| | | |
| | | import com.ycl.platform.domain.entity.CheckIndexCar; |
| | | import com.ycl.platform.domain.result.HK.VehicleDeviceSamplingResult; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.CheckIndexCarMapper; |
| | | 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; |
| | | import utils.DateUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 计算车辆抓拍数据准确性、url可用性、大图可用性 |
| | |
| | | public class CarDeviceSampleCalculation extends IndexCalculationServe<VehicleDeviceSamplingResult, CarDeviceSampleCalculation.AreaStats> implements CalculationStrategy<VehicleDeviceSamplingResult> { |
| | | @Autowired |
| | | private CheckIndexCarMapper checkIndexCarMapper; |
| | | @Autowired |
| | | private TMonitorMapper monitorMapper; |
| | | @Autowired |
| | | private ICheckIndexCarService checkIndexCarService; |
| | | |
New file |
| | |
| | | package com.ycl.calculate; |
| | | |
| | | import com.ycl.platform.domain.entity.CheckIndexCar; |
| | | import com.ycl.platform.domain.result.HK.SnapshotDataMonitorResult; |
| | | import com.ycl.platform.domain.result.SYS.TMonitorResult; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.CheckIndexCarMapper; |
| | | import com.ycl.platform.service.ICheckIndexCarService; |
| | | import com.ycl.system.entity.SysDictData; |
| | | import com.ycl.system.mapper.SysDictDataMapper; |
| | | import com.ycl.utils.DateUtils; |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import constant.CheckThreadConstants; |
| | | import constant.RedisConstant; |
| | | import enumeration.general.AreaDeptEnum; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 计算车辆点位在线率 |
| | | * 获取分省厅、区域的map<k,v> k为deptId或者Province_deptId |
| | | * 循环map计算点位在线率 |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class CarOnlineCalculation extends IndexCalculationServe<TMonitorResult, CarOnlineCalculation.AreaStats> implements CalculationStrategy<TMonitorResult> { |
| | | @Autowired |
| | | private CheckIndexCarMapper checkIndexCarMapper; |
| | | @Autowired |
| | | private ICheckIndexCarService checkIndexCarService; |
| | | |
| | | //区域车辆点位在线指标的内部类 |
| | | protected static class AreaStats { |
| | | int totalSites = 0; |
| | | int onlineSites = 0; |
| | | } |
| | | |
| | | @Override |
| | | public void calculate(List<TMonitorResult> list) { |
| | | //获取分区域的指标数量 |
| | | Map<String, CarOnlineCalculation.AreaStats> areaStatsMap = getAreaStatsMap(list); |
| | | if (areaStatsMap == null) return; |
| | | |
| | | // 查询是否index表已经存在今日数据 |
| | | List<CheckIndexCar> checkIndexCarList = checkIndexCarMapper.selectToday(DateUtils.getDate()); |
| | | List<CheckIndexCar> checkIndexCars = new ArrayList<>(); |
| | | areaStatsMap.forEach((key, stats) -> { |
| | | if (stats.totalSites > 0) { |
| | | CheckIndexCar checkIndexCar = createOrUpdateCheckIndexCar(key, stats, checkIndexCarList); |
| | | if (checkIndexCar != null) { |
| | | checkIndexCars.add(checkIndexCar); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | checkIndexCarService.saveOrUpdateBatch(checkIndexCars); |
| | | } |
| | | |
| | | /** |
| | | * 累计总点位数、离线数、总抓拍量 |
| | | */ |
| | | @Override |
| | | public void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, TMonitorResult result) { |
| | | //返回对象的引用,如果不存在会放入新的key,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | | |
| | | if (result.getOnline()!=null && result.getOnline()) { |
| | | stats.onlineSites++; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 车辆点位在线率 |
| | | */ |
| | | private CheckIndexCar createOrUpdateCheckIndexCar(String key, AreaStats stats, List<CheckIndexCar> checkIndexCarList) { |
| | | CheckIndexCar checkIndexCar = getCheckIndex(key, checkIndexCarList, CheckIndexCar.class); |
| | | if (checkIndexCar == null) { |
| | | return null; |
| | | } |
| | | |
| | | //调用点位在线计算方法 |
| | | if (stats.totalSites >= CheckThreadConstants.Check_Car_SiteOnline) { |
| | | Map<String, Object> siteOnlineParam = new HashMap<>(); |
| | | siteOnlineParam.put("totalSites", stats.totalSites); |
| | | siteOnlineParam.put("onlineSites", stats.onlineSites); |
| | | BigDecimal siteOnline = siteOnline(siteOnlineParam); |
| | | checkIndexCar.setSiteOnline(siteOnline.min(BigDecimal.ONE)); |
| | | } else { |
| | | checkIndexCar.setSiteOnline(BigDecimal.ZERO); |
| | | } |
| | | |
| | | return checkIndexCar; |
| | | } |
| | | } |
| | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 计算车辆点位在线率、视图库对接稳定性 |
| | | * 计算车辆视图库对接稳定性 |
| | | * 抓拍数据量监测结果接口数据 |
| | | * 获取分省厅、区域的map<k,v> k为deptId或者Province_deptId |
| | | * 循环map计算点位在线率 |
| | |
| | | private RedisTemplate redisTemplate; |
| | | @Autowired |
| | | private SysDictDataMapper dictDataMapper; |
| | | //区域车辆点位在线指标的内部类 |
| | | //区域车辆视图库对接稳定性的内部类 |
| | | protected static class AreaStats { |
| | | int totalSites = 0; |
| | | int onlineSites = 0; |
| | | int totalDataSum = 0; |
| | | } |
| | | |
| | |
| | | stats.totalSites++; |
| | | |
| | | if (ApiConstants.HK_SnapCount_ResultType_Null != result.getResultType()) { |
| | | stats.onlineSites++; |
| | | stats.totalDataSum += result.getDataCount(); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 车辆点位在线率和视图库对接稳定性 |
| | | * 车辆视图库对接稳定性 |
| | | */ |
| | | private CheckIndexCar createOrUpdateCheckIndexCar(String key, AreaStats stats, List<CheckIndexCar> checkIndexCarList,List<SysDictData> carSnap) { |
| | | CheckIndexCar checkIndexCar = getCheckIndex(key, checkIndexCarList, CheckIndexCar.class); |
| | |
| | | return null; |
| | | } |
| | | |
| | | //调用点位在线计算方法 |
| | | if (stats.totalSites >= CheckThreadConstants.Check_Car_SiteOnline) { |
| | | Map<String, Object> siteOnlineParam = new HashMap<>(); |
| | | siteOnlineParam.put("totalSites", stats.totalSites); |
| | | siteOnlineParam.put("onlineSites", stats.onlineSites); |
| | | BigDecimal siteOnline = siteOnline(siteOnlineParam); |
| | | checkIndexCar.setSiteOnline(siteOnline.min(BigDecimal.ONE)); |
| | | } else { |
| | | checkIndexCar.setSiteOnline(BigDecimal.ZERO); |
| | | } |
| | | //视图库对接稳定性 |
| | | //Redis记录该区县当月无数据上传次数 |
| | | Integer noDateCount = (Integer) redisTemplate.opsForHash().get(RedisConstant.Check_Car_ViewConnect, key); |
| | |
| | | @Autowired |
| | | private CheckIndexFaceMapper checkIndexFaceMapper; |
| | | @Autowired |
| | | private TMonitorMapper monitorMapper; |
| | | @Autowired |
| | | private ICheckIndexFaceService checkIndexFaceService; |
| | | |
| | | //区域车辆抽检指标 |
New file |
| | |
| | | package com.ycl.calculate; |
| | | |
| | | import com.ycl.platform.domain.entity.CheckIndexCar; |
| | | import com.ycl.platform.domain.entity.CheckIndexFace; |
| | | import com.ycl.platform.domain.result.SYS.TMonitorResult; |
| | | import com.ycl.platform.mapper.CheckIndexCarMapper; |
| | | import com.ycl.platform.mapper.CheckIndexFaceMapper; |
| | | import com.ycl.platform.service.ICheckIndexCarService; |
| | | import com.ycl.platform.service.ICheckIndexFaceService; |
| | | import com.ycl.utils.DateUtils; |
| | | import constant.CheckThreadConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 计算车辆点位在线率 |
| | | * 获取分省厅、区域的map<k,v> k为deptId或者Province_deptId |
| | | * 循环map计算点位在线率 |
| | | * 更新或新增 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class FaceOnlineCalculation extends IndexCalculationServe<TMonitorResult, FaceOnlineCalculation.AreaStats> implements CalculationStrategy<TMonitorResult> { |
| | | @Autowired |
| | | private CheckIndexFaceMapper checkIndexFaceMapper; |
| | | @Autowired |
| | | private ICheckIndexFaceService checkIndexFaceService; |
| | | |
| | | //区域车辆点位在线指标的内部类 |
| | | protected static class AreaStats { |
| | | int totalSites = 0; |
| | | int onlineSites = 0; |
| | | } |
| | | |
| | | @Override |
| | | public void calculate(List<TMonitorResult> list) { |
| | | //获取分区域的指标数量 |
| | | Map<String, FaceOnlineCalculation.AreaStats> areaStatsMap = getAreaStatsMap(list); |
| | | if (areaStatsMap == null) return; |
| | | |
| | | // 查询是否index表已经存在今日数据 |
| | | List<CheckIndexFace> checkIndexFaceList = checkIndexFaceMapper.selectToday(DateUtils.getDate()); |
| | | List<CheckIndexFace> checkIndexFaces = new ArrayList<>(); |
| | | areaStatsMap.forEach((key, stats) -> { |
| | | if (stats.totalSites > 0) { |
| | | CheckIndexFace checkIndexFace = createOrUpdateCheckIndexCar(key, stats, checkIndexFaceList); |
| | | if (checkIndexFace != null) { |
| | | checkIndexFaces.add(checkIndexFace); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | checkIndexFaceService.saveOrUpdateBatch(checkIndexFaces); |
| | | } |
| | | |
| | | /** |
| | | * 累计总点位数、离线数、总抓拍量 |
| | | */ |
| | | @Override |
| | | public void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, TMonitorResult result) { |
| | | //返回对象的引用,如果不存在会放入新的key,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | | |
| | | if (result.getOnline()!=null && result.getOnline()) { |
| | | stats.onlineSites++; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 车辆点位在线率 |
| | | */ |
| | | private CheckIndexFace createOrUpdateCheckIndexCar(String key, AreaStats stats, List<CheckIndexFace> checkIndexFaceList) { |
| | | CheckIndexFace checkIndexFace = getCheckIndex(key, checkIndexFaceList, CheckIndexFace.class); |
| | | if (checkIndexFace == null) { |
| | | return null; |
| | | } |
| | | |
| | | //调用点位在线计算方法 |
| | | if (stats.totalSites >= CheckThreadConstants.Check_Face_SiteOnline) { |
| | | Map<String, Object> siteOnlineParam = new HashMap<>(); |
| | | siteOnlineParam.put("totalSites", stats.totalSites); |
| | | siteOnlineParam.put("onlineSites", stats.onlineSites); |
| | | BigDecimal siteOnline = siteOnline(siteOnlineParam); |
| | | checkIndexFace.setSiteOnline(siteOnline.min(BigDecimal.ONE)); |
| | | } else { |
| | | checkIndexFace.setSiteOnline(BigDecimal.ZERO); |
| | | } |
| | | |
| | | return checkIndexFace; |
| | | } |
| | | } |
| | |
| | | //区域人脸点位在线指标的内部类 |
| | | protected static class AreaStats { |
| | | int totalSites = 0; |
| | | int onlineSites = 0; |
| | | int totalDataSum = 0; |
| | | } |
| | | |
| | |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | | if (ApiConstants.HK_SnapCount_ResultType_Null != result.getResultType()) { |
| | | stats.onlineSites++; |
| | | stats.totalDataSum += result.getDataCount(); |
| | | } |
| | | } |
| | | |
| | | |
| | | //车辆点位在线率和视图库对接稳定性 |
| | | //人脸视图库对接稳定性 |
| | | private CheckIndexFace createOrUpdateCheckIndexFace(String key, AreaStats stats, List<CheckIndexFace> checkIndexFaceList,List<SysDictData> faceSnap) { |
| | | CheckIndexFace checkIndexFace = getCheckIndex(key, checkIndexFaceList, CheckIndexFace.class); |
| | | if (checkIndexFace == null) { |
| | | return null; |
| | | } |
| | | //调用点位在线计算方法 |
| | | if (stats.totalSites >= CheckThreadConstants.Check_Face_SiteOnline) { |
| | | Map<String, Object> siteOnlineParam = new HashMap<>(); |
| | | siteOnlineParam.put("totalSites", stats.totalSites); |
| | | siteOnlineParam.put("onlineSites", stats.onlineSites); |
| | | BigDecimal siteOnline = siteOnline(siteOnlineParam); |
| | | checkIndexFace.setSiteOnline(siteOnline); |
| | | } else { |
| | | checkIndexFace.setSiteOnline(BigDecimal.ZERO); |
| | | } |
| | | //视图库对接稳定性 |
| | | //Redis记录该区县当月无数据上传次数 |
| | |
| | | @Slf4j |
| | | public class IndexCalculationUtils { |
| | | //检查是否存在当日数据 |
| | | public <I extends CheckIndex> I getCheckIndex(String key, List<I> checkIndexList, Class<I> clazz) { |
| | | I checkIndex; |
| | | public <T extends CheckIndex> T getCheckIndex(String key, List<T> checkIndexList, Class<T> clazz) { |
| | | T checkIndex; |
| | | |
| | | // 检查是否已存在今日数据 |
| | | Optional<I> existingIndex = checkIndexList.stream() |
| | | Optional<T> existingIndex = checkIndexList.stream() |
| | | .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())) |
| | |
| | | //全年留存数 |
| | | int allFiles = 0; |
| | | } |
| | | //TODO:改为MonitorQualifyResult |
| | | @Override |
| | | public void calculate(List<MonitorQualifyResult> list) { |
| | | //获取分区域的指标数量 |
| | |
| | | package com.ycl.calculate; |
| | | |
| | | import com.ycl.platform.domain.entity.CheckIndexVideo; |
| | | import com.ycl.platform.domain.result.SYS.TMonitorResult; |
| | | import com.ycl.platform.domain.result.UY.VideoOnlineResult; |
| | | import com.ycl.platform.mapper.CheckIndexVideoMapper; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class VideoOnlineCalculation extends IndexCalculationServe<VideoOnlineResult, VideoOnlineCalculation.AreaStats> implements CalculationStrategy<VideoOnlineResult> { |
| | | public class VideoOnlineCalculation extends IndexCalculationServe<TMonitorResult, VideoOnlineCalculation.AreaStats> implements CalculationStrategy<TMonitorResult> { |
| | | @Autowired |
| | | private CheckIndexVideoMapper checkIndexVideoMapper; |
| | | @Autowired |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void calculate(List<VideoOnlineResult> list) { |
| | | public void calculate(List<TMonitorResult> list) { |
| | | //获取分区域的指标数量 |
| | | Map<String, VideoOnlineCalculation.AreaStats> areaStatsMap = getAreaStatsMap(list); |
| | | if (areaStatsMap == null) return; |
| | |
| | | * 累计总点位数、在线点位数、重点点位数、重点点位在线数、指挥图像数、指挥图像在线数 |
| | | */ |
| | | @Override |
| | | public void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, VideoOnlineResult result) { |
| | | public void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, TMonitorResult result) { |
| | | //返回对象的引用,如果不存在会放入新的key,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | |
| | | if(result.getDeptTag()!=null && result.getDeptTag()){ |
| | | stats.deptSites++; |
| | | } |
| | | if (ApiConstants.UY_OnlineSite_Online.equals(result.getStatus())){ |
| | | if (result.getOnline()!=null && result.getOnline()){ |
| | | stats.onlineSites++; |
| | | if(result.getImportantTag()!=null && result.getImportantTag()){ |
| | | stats.importantOnlineSites++; |
| | |
| | | private static final Map<String, Class<? extends CalculationStrategy>> calculatorClasses = new HashMap<>(); |
| | | |
| | | static { |
| | | //车辆点位在线、视图库对接稳定性 |
| | | calculatorClasses.put(CalculationStrategyConstants.Car_SiteOnline_ViewStability, CarSnapshopDataCalculation.class); |
| | | //车辆点位在线 |
| | | calculatorClasses.put(CalculationStrategyConstants.Car_SiteOnline, CarOnlineCalculation.class); |
| | | //车辆视图库对接稳定性 |
| | | calculatorClasses.put(CalculationStrategyConstants.Car_ViewStability, CarSnapshopDataCalculation.class); |
| | | //车辆信息准确率 |
| | | calculatorClasses.put(CalculationStrategyConstants.Car_InfoAccuracy, CarInFoAccuracyCalculation.class); |
| | | //车辆抓拍数据上传延迟 |
| | |
| | | //车辆目录一致 |
| | | calculatorClasses.put(CalculationStrategyConstants.Car_DirectConsistent, CarConsistentCalculation.class); |
| | | |
| | | //人脸点位在线、视图库对接稳定 |
| | | calculatorClasses.put(CalculationStrategyConstants.Face_SiteOnline_ViewStability, FaceSnapshotDataCalculation.class); |
| | | //人脸点位在线 |
| | | calculatorClasses.put(CalculationStrategyConstants.Face_SiteOnline, FaceOnlineCalculation.class); |
| | | //人脸视图库对接稳定 |
| | | calculatorClasses.put(CalculationStrategyConstants.Face_ViewStability, FaceSnapshotDataCalculation.class); |
| | | //人脸信息准确率 |
| | | calculatorClasses.put(CalculationStrategyConstants.Face_InfoAccuracy, FaceInFoAccuracyCalculation.class); |
| | | //人脸抓拍数据延迟 |
| | |
| | | import com.ycl.platform.domain.query.DashboardQuery; |
| | | import com.ycl.platform.domain.query.DataCenterQuery; |
| | | import com.ycl.platform.domain.query.HomeQuery; |
| | | import com.ycl.platform.domain.result.SYS.TMonitorResult; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.domain.vo.UpdateOnlineVO; |
| | | import com.ycl.platform.domain.vo.screen.MonitorRateVO; |
| | |
| | | * @param online |
| | | */ |
| | | void updateOnline(@Param("online") UpdateOnlineVO online); |
| | | |
| | | /** |
| | | * 点位在线率 |
| | | * |
| | | * @param tMonitor 设备资产 |
| | | * @return 设备资产集合 |
| | | */ |
| | | public List<TMonitorResult> selectMonitorResult(Short cameraFunType); |
| | | } |
| | |
| | | package com.ycl.task; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ycl.calculate.CalculationStrategy; |
| | | import com.ycl.factory.IndexCalculationFactory; |
| | | import com.ycl.platform.domain.entity.YwPoint; |
| | | import com.ycl.platform.domain.result.HK.*; |
| | | import com.ycl.platform.domain.result.SYS.TMonitorResult; |
| | | import com.ycl.platform.domain.result.UY.MonitorQualifyResult; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.mapper.YwPointMapper; |
| | | import com.ycl.utils.DateUtils; |
| | | import com.ycl.utils.StringUtils; |
| | | import constant.ApiConstants; |
| | |
| | | private MongoTemplate mongoTemplate; |
| | | @Autowired |
| | | private TMonitorMapper monitorMapper; |
| | | @Autowired |
| | | private YwPointMapper pointMapper; |
| | | //TODO:加任务 |
| | | public void siteOnlineTask() { |
| | | log.info("开始计算车辆点位在线率和视图库对接稳定性"); |
| | | log.info("开始计算点位在线率"); |
| | | List<TMonitorResult> tMonitorResults = monitorMapper.selectMonitorResult(CheckConstants.Rule_Category_Car); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Car_SiteOnline); |
| | | calculator.calculate(tMonitorResults); |
| | | log.info("结束计算视图库对接稳定性"); |
| | | } |
| | | |
| | | //TODO:改任务名 |
| | | public void viewConnectTask() { |
| | | log.info("开始计算视图库对接稳定性"); |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //计算点位在线率和视图库对接稳定性 |
| | | Query query = new Query(); |
| | |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday)) |
| | | .and("dataType").is(ApiConstants.HK_DataType_CAR)); |
| | | List<SnapshotDataMonitorResult> results = mongoTemplate.find(query, SnapshotDataMonitorResult.class); |
| | | CalculationStrategy<SnapshotDataMonitorResult> calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Car_SiteOnline_ViewStability); |
| | | CalculationStrategy<SnapshotDataMonitorResult> calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Car_ViewStability); |
| | | calculator.calculate(results); |
| | | log.info("结束计算点位在线率和视图库对接稳定性"); |
| | | log.info("结束计算视图库对接稳定性"); |
| | | } |
| | | |
| | | public void deviceSampleTask() { |
| | |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); |
| | | // .*表示任意数量字符 1/2/3 视频/车辆/人脸 |
| | | // 1/2/3 视频/车辆/人脸 |
| | | Pattern pattern = Pattern.compile(".*2.*"); |
| | | query.addCriteria(Criteria.where("sxjgnlx.value").regex(pattern)); |
| | | List<MonitorQualifyResult> results = mongoTemplate.find(query, MonitorQualifyResult.class); |
| | |
| | | import com.ycl.calculate.CalculationStrategy; |
| | | import com.ycl.factory.IndexCalculationFactory; |
| | | import com.ycl.platform.domain.result.HK.*; |
| | | import com.ycl.platform.domain.result.SYS.TMonitorResult; |
| | | import com.ycl.platform.domain.result.UY.MonitorQualifyResult; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.utils.DateUtils; |
| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private TMonitorMapper monitorMapper; |
| | | |
| | | //TODO:加任务 |
| | | public void siteOnlineTask() { |
| | | log.info("开始计算人脸点位在线率和视图库对接稳定性"); |
| | | log.info("开始计算点位在线率"); |
| | | List<TMonitorResult> tMonitorResults = monitorMapper.selectMonitorResult(CheckConstants.Rule_Category_Face); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Face_SiteOnline); |
| | | calculator.calculate(tMonitorResults); |
| | | log.info("结束计算视图库对接稳定性"); |
| | | } |
| | | //TODO:改名字 |
| | | public void viewConnectTask() { |
| | | log.info("开始计算视图库对接稳定性"); |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //点位在线率和视图库对接稳定性 |
| | | //视图库对接稳定性 |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday)) |
| | | .and("dataType").is(ApiConstants.HK_DataType_FACE)); |
| | | List<SnapshotDataMonitorResult> results = mongoTemplate.find(query, SnapshotDataMonitorResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Face_SiteOnline_ViewStability); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Face_ViewStability); |
| | | calculator.calculate(results); |
| | | log.info("结束计算人脸点位在线率和视图库对接稳定性"); |
| | | } |
| | |
| | | public void directConsistentTask() { |
| | | log.info("开始计算人脸目录一致率"); |
| | | //人脸目录一致率 |
| | | List<TMonitorVO> tMonitorVOS = monitorMapper.selectMonitorVOList(); |
| | | List<TMonitorVO> list = tMonitorVOS.stream().filter(tMonitorVO ->!StringUtils.isEmpty(tMonitorVO.getCameraFunType()) && tMonitorVO.getCameraFunType().contains(CheckConstants.Rule_Category_Face + "")).collect(Collectors.toList()); |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); |
| | | // 1/2/3 视频/车辆/人脸 |
| | | Pattern pattern = Pattern.compile(".*3.*"); |
| | | query.addCriteria(Criteria.where("sxjgnlx.value").regex(pattern)); |
| | | List<MonitorQualifyResult> results = mongoTemplate.find(query, MonitorQualifyResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Face_DirectConsistent); |
| | | calculator.calculate(list); |
| | | calculator.calculate(results); |
| | | log.info("结束计算人脸目录一致率"); |
| | | } |
| | | } |
| | |
| | | * 比对mongoDB一机一档信息,整理成result存入mongo |
| | | * 同步品牌到mysql |
| | | */ |
| | | //TODO:大华动态库linux换位置 |
| | | public void getOSD() { |
| | | log.info("开始获取OSD"); |
| | | List<OSDResult> osdResultList = new ArrayList<>(); |
| | |
| | | import com.ycl.platform.domain.entity.CheckIndexVideo; |
| | | import com.ycl.platform.domain.entity.ImageResourceSecurity; |
| | | import com.ycl.platform.domain.entity.ImageResourceSecurityDetail; |
| | | import com.ycl.platform.domain.result.SYS.TMonitorResult; |
| | | 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.service.IImageResourceSecurityService; |
| | | import com.ycl.utils.DateUtils; |
| | | import com.ycl.utils.DictUtils; |
| | | import constant.ApiConstants; |
| | | import constant.CalculationStrategyConstants; |
| | | import constant.CheckConstants; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private final ImageResourceSecurityMapper imageResourceSecurityMapper; |
| | | |
| | | private static final BigDecimal NUM = new BigDecimal("0.15"); |
| | | |
| | | //TODO:加任务 |
| | | public void siteOnlineTask() { |
| | | log.info("开始计算点位在线率"); |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //计算点位在线率和重点点位在线率和指挥图像在线率 |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); |
| | | |
| | | List<VideoOnlineResult> results = mongoTemplate.find(query, VideoOnlineResult.class); |
| | | List<TMonitorResult> tMonitorResults = monitorMapper.selectMonitorResult(CheckConstants.Rule_Category_Video); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_SiteOnline); |
| | | calculator.calculate(results); |
| | | calculator.calculate(tMonitorResults); |
| | | log.info("结束计算点位在线率"); |
| | | } |
| | | |
| | |
| | | public void oneMonitorFileTask() { |
| | | log.info("开始计算一机一档注册率、档案考核比"); |
| | | //计算一机一档注册率、档案考核比 |
| | | List<TMonitorVO> tMonitorVOS = monitorMapper.selectMonitorVOList(); |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); |
| | | List<MonitorQualifyResult> results = mongoTemplate.find(query, MonitorQualifyResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_MonitorRegis_ArchiveRate); |
| | | calculator.calculate(tMonitorVOS); |
| | | calculator.calculate(results); |
| | | log.info("结束计算一机一档注册率、档案考核比"); |
| | | } |
| | | |
| | |
| | | /** |
| | | * 视频图像资源安全,需要排在平台在线率后面。 |
| | | */ |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void videoSecurity() { |
| | | ArrayList<ImageResourceSecurity> imageResourceSecurities = new ArrayList<>(); |
| | | List<CheckIndexVideo> list = checkIndexVideoMapper.selectAndDeptName(); |
| | |
| | | left join sys_dept d on p.dept_id = d.dept_id |
| | | </select> |
| | | |
| | | <select id="selectMonitorResult" resultType="com.ycl.platform.domain.result.SYS.TMonitorResult"> |
| | | select m.id, m.serial_number as no,d.dept_id,p.province_tag,p.important_tag,p.important_command_image_tag,p.dept_tag,p.online |
| | | from t_monitor m |
| | | left join t_yw_point p on m.serial_number = p.serial_number |
| | | left join sys_dept d on p.dept_id = d.dept_id |
| | | <where> |
| | | <if test="cameraFunType!=null"> |
| | | m.camera_fun_type like concat('%',#{cameraFunType},'%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="selectTMonitorById" parameterType="Long" resultType="com.ycl.platform.domain.vo.TMonitorVO"> |
| | | <include refid="selectTMonitorVo"/> |
| | | where id = #{id} |