ycl-common/src/main/java/constant/ApiConstants.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ycl-common/src/main/java/constant/CheckConstants.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ycl-common/src/main/java/constant/CheckSnapCountConstants.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ycl-common/src/main/java/enumeration/general/AreaDeptEnum.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ycl-server/src/main/java/com/ycl/calculate/CarSnapshopDataCalculation.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ycl-server/src/main/java/com/ycl/calculate/FaceSnapshotDataCalculation.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ycl-server/src/main/java/com/ycl/task/MonitorTask.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
ycl-server/src/main/java/com/ycl/task/VideoTask.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
ycl-common/src/main/java/constant/ApiConstants.java
@@ -69,7 +69,7 @@ //省厅前缀 public final static String Province = "Province_"; public final static String County = "County_"; //海康访问OSD路径 public final static String HK_OSD_PATH = "/ISAPI/System/Video/inputs/channels/1/overlays"; //海康访问时间路径 ycl-common/src/main/java/constant/CheckConstants.java
@@ -25,4 +25,16 @@ public static final String Status_Use = "0"; public static final String Status_Stop = "1"; /** * 车辆同期抓拍量字典表 */ public final static String DICT_CAR_SNAP = "check_car_snap"; /** * 人脸同期抓拍量字典表 */ public final static String DICT_FACE_SNAP = "check_face_snap"; /** * 2022抓拍数计算倍率 */ public final static String MultiplyNum = "1.2"; } ycl-common/src/main/java/constant/CheckSnapCountConstants.java
@@ -2,32 +2,7 @@ public class CheckSnapCountConstants { /** * 2022年同期车辆抓拍量(省厅) */ public final static String Car_City = "check.snapCount.car.city"; /** * 2022年同期车辆抓拍量(区县) */ public final static String Car_County = "check.snapCount.car.county"; /** * 2022年同期人脸抓拍量(省厅) */ public final static String Face_City = "check.snapCount.face.city"; /** * 2022年同期人脸抓拍量(区县) */ public final static String Face_County = "check.snapCount.face.city"; /** * 2022抓拍数计算倍率 */ public final static String Multiply = "1.2"; /** * 区域个数 */ public final static Integer CountyNum = 7; } ycl-common/src/main/java/enumeration/general/AreaDeptEnum.java
@@ -36,5 +36,12 @@ } return null; } public static AreaDeptEnum fromDept(Integer deptId) { for (AreaDeptEnum type : AreaDeptEnum.values()) { if (type.getDeptId().equals(deptId) ) { return type; } } return null; } } ycl-server/src/main/java/com/ycl/calculate/CarSnapshopDataCalculation.java
@@ -6,12 +6,14 @@ import com.ycl.platform.mapper.CheckIndexCarMapper; import com.ycl.platform.mapper.TMonitorMapper; import com.ycl.platform.service.ICheckIndexCarService; import com.ycl.system.entity.SysDictData; import com.ycl.system.mapper.SysConfigMapper; import com.ycl.system.mapper.SysDeptMapper; import com.ycl.system.mapper.SysDictDataMapper; import com.ycl.system.mapper.SysDictTypeMapper; import com.ycl.utils.DateUtils; import constant.ApiConstants; import constant.CheckSnapCountConstants; import constant.CheckThreadConstants; import constant.RedisConstant; import constant.*; import enumeration.general.AreaDeptEnum; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; @@ -49,7 +51,8 @@ private ICheckIndexCarService checkIndexCarService; @Autowired private RedisTemplate redisTemplate; @Autowired private SysDictDataMapper dictDataMapper; //区域车辆点位在线指标的内部类 private static class AreaStats { int totalSites = 0; @@ -94,16 +97,17 @@ } } //获取2022同期抓拍平均值 省厅、市局 BigDecimal cityCountAvg = getAverageCount(CheckSnapCountConstants.Car_City); BigDecimal countyCountAvg = getAverageCount(CheckSnapCountConstants.Car_County); // //获取2022同期抓拍平均值 省厅、市局 // BigDecimal cityCountAvg = getAverageCount(CheckSnapCountConstants.Car_City); // BigDecimal countyCountAvg = getAverageCount(CheckSnapCountConstants.Car_County); //从字典获取同期抓拍量 List<SysDictData> carSnap = dictDataMapper.selectDictDataByType(CheckConstants.DICT_CAR_SNAP); // 查询是否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, cityCountAvg, countyCountAvg, checkIndexCarList); CheckIndexCar checkIndexCar = createOrUpdateCheckIndexCar(key, stats, checkIndexCarList,carSnap); if (checkIndexCar != null) { checkIndexCars.add(checkIndexCar); } @@ -129,20 +133,9 @@ } /** * 获取2022同期抓拍平均值 */ private BigDecimal getAverageCount(String configKey) { String count = sysConfigMapper.checkConfigKeyUnique(configKey).getConfigValue(); return new BigDecimal(count) .multiply(new BigDecimal(CheckSnapCountConstants.Multiply)) .divide(new BigDecimal(CheckSnapCountConstants.CountyNum), 10, RoundingMode.HALF_UP) .divide(new BigDecimal(LocalDate.now().getDayOfMonth()), 0, RoundingMode.HALF_UP); } /** * 车辆点位在线率和视图库对接稳定性 */ private CheckIndexCar createOrUpdateCheckIndexCar(String key, AreaStats stats, BigDecimal cityCountAvg, BigDecimal countyCountAvg, List<CheckIndexCar> checkIndexCarList) { private CheckIndexCar createOrUpdateCheckIndexCar(String key, AreaStats stats, List<CheckIndexCar> checkIndexCarList,List<SysDictData> carSnap) { CheckIndexCar checkIndexCar = getCheckIndex(key, checkIndexCarList, CheckIndexCar.class); if (checkIndexCar == null) { return null; @@ -168,10 +161,13 @@ Double deductScore = 0.1 * noDateCount; if (stats.totalDataSum != 0) { BigDecimal avgCount = key.startsWith(ApiConstants.Province) ? cityCountAvg : countyCountAvg; Integer deptId = key.startsWith(ApiConstants.Province) ? Integer.parseInt(key.split("_")[1]) : Integer.parseInt(key); String dictKey = key.startsWith(ApiConstants.Province) ? ApiConstants.Province+AreaDeptEnum.fromDept(deptId).getCode() : ApiConstants.County+AreaDeptEnum.fromDept(deptId).getCode(); String value = carSnap.stream().filter(sysDictData -> sysDictData.getDictLabel().equals(dictKey)).findFirst().get().getDictValue(); Map<String, Object> viewConnectParam = new HashMap<>(); viewConnectParam.put("totalDataSum", stats.totalDataSum); viewConnectParam.put("avgCount", avgCount); viewConnectParam.put("avgCount", new BigDecimal(value).multiply(new BigDecimal(CheckConstants.MultiplyNum)).divide(new BigDecimal(LocalDate.now().getDayOfMonth()), 0, RoundingMode.HALF_UP)); BigDecimal viewConnectStability = viewConnectStability(viewConnectParam); viewConnectStability = viewConnectStability.subtract(new BigDecimal(deductScore)).max(BigDecimal.ZERO).min(BigDecimal.ONE); checkIndexCar.setViewConnectStability(viewConnectStability); ycl-server/src/main/java/com/ycl/calculate/FaceSnapshotDataCalculation.java
@@ -10,8 +10,11 @@ import com.ycl.platform.mapper.TMonitorMapper; import com.ycl.platform.service.ICheckIndexFaceService; import com.ycl.platform.service.ITMonitorService; import com.ycl.system.entity.SysDictData; import com.ycl.system.mapper.SysConfigMapper; import com.ycl.system.mapper.SysDictDataMapper; import constant.*; import enumeration.general.AreaDeptEnum; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; @@ -47,7 +50,8 @@ private TMonitorMapper monitorMapper; @Autowired private RedisTemplate redisTemplate; @Autowired private SysDictDataMapper dictDataMapper; //区域人脸点位在线指标的内部类 private static class AreaStats { int totalSites = 0; @@ -91,16 +95,17 @@ } } //获取2022同期抓拍平均值 省厅、市局 BigDecimal cityCountAvg = getAverageCount(CheckSnapCountConstants.Face_City); BigDecimal countyCountAvg = getAverageCount(CheckSnapCountConstants.Face_County); // //获取2022同期抓拍平均值 省厅、市局 // BigDecimal cityCountAvg = getAverageCount(CheckSnapCountConstants.Face_City); // BigDecimal countyCountAvg = getAverageCount(CheckSnapCountConstants.Face_County); //从字典获取同期抓拍量 List<SysDictData> faceSnap = dictDataMapper.selectDictDataByType(CheckConstants.DICT_FACE_SNAP); // 查询今日数据 List<CheckIndexFace> checkIndexFaceList = checkIndexFaceMapper.selectToday(DateUtils.getDate()); List<CheckIndexFace> checkIndexFaces = new ArrayList<>(); areaStatsMap.forEach((deptId, stats) -> { if (stats.totalSites > 0) { CheckIndexFace checkIndexFace = createOrUpdateCheckIndexFace(deptId, stats, cityCountAvg, countyCountAvg, checkIndexFaceList); CheckIndexFace checkIndexFace = createOrUpdateCheckIndexFace(deptId, stats, checkIndexFaceList,faceSnap); if (checkIndexFace != null) { checkIndexFaces.add(checkIndexFace); } @@ -121,17 +126,17 @@ } } //获取2022同期抓拍平均值 private BigDecimal getAverageCount(String configKey) { String count = sysConfigMapper.checkConfigKeyUnique(configKey).getConfigValue(); return new BigDecimal(count) .multiply(new BigDecimal(CheckSnapCountConstants.Multiply)) .divide(new BigDecimal(CheckSnapCountConstants.CountyNum), 10, RoundingMode.HALF_UP) .divide(new BigDecimal(LocalDate.now().getDayOfMonth()), 0, RoundingMode.HALF_UP); } // //获取2022同期抓拍平均值 // private BigDecimal getAverageCount(String configKey) { // String count = sysConfigMapper.checkConfigKeyUnique(configKey).getConfigValue(); // return new BigDecimal(count) // .multiply(new BigDecimal(CheckSnapCountConstants.Multiply)) // .divide(new BigDecimal(CheckSnapCountConstants.CountyNum), 10, RoundingMode.HALF_UP) // .divide(new BigDecimal(LocalDate.now().getDayOfMonth()), 0, RoundingMode.HALF_UP); // } //车辆点位在线率和视图库对接稳定性 private CheckIndexFace createOrUpdateCheckIndexFace(String key, AreaStats stats, BigDecimal cityCountAvg, BigDecimal countyCountAvg, List<CheckIndexFace> checkIndexFaceList) { 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; @@ -156,10 +161,14 @@ Double deductScore = 0.1 * noDateCount; log.info("总量:{}",stats.totalDataSum); if (stats.totalDataSum != 0) { BigDecimal avgCount = key.startsWith(ApiConstants.Province) ? cityCountAvg : countyCountAvg; Integer deptId = key.startsWith(ApiConstants.Province) ? Integer.parseInt(key.split("_")[1]) : Integer.parseInt(key); String dictKey = key.startsWith(ApiConstants.Province) ? ApiConstants.Province+ AreaDeptEnum.fromDept(deptId).getCode() : ApiConstants.County+AreaDeptEnum.fromDept(deptId).getCode(); String value = faceSnap.stream().filter(sysDictData -> sysDictData.getDictLabel().equals(dictKey)).findFirst().get().getDictValue(); Map<String, Object> viewConnectParam = new HashMap<>(); viewConnectParam.put("totalDataSum", stats.totalDataSum); viewConnectParam.put("avgCount", avgCount); viewConnectParam.put("avgCount", new BigDecimal(value).multiply(new BigDecimal(CheckConstants.MultiplyNum)).divide(new BigDecimal(LocalDate.now().getDayOfMonth()), 0, RoundingMode.HALF_UP)); BigDecimal viewConnectStability = viewConnectStability(viewConnectParam); viewConnectStability = viewConnectStability.subtract(new BigDecimal(deductScore)).max(BigDecimal.ZERO).min(BigDecimal.ONE); checkIndexFace.setViewConnectStability(viewConnectStability); ycl-server/src/main/java/com/ycl/platform/service/impl/CheckScoreServiceImpl.java
@@ -307,7 +307,6 @@ SysUser user = SecurityUtils.getLoginUser().getUser(); if (!user.isAdmin()) { for (SysRole role : roles) { //TODO:本地库修改 if (role.getPermissions().contains("check:score:role:publish")) { Map<String, Object> params = checkScore.getParams(); params.put("publish", PublishType.PUBLISHED.getCode()); ycl-server/src/main/java/com/ycl/task/MonitorTask.java
@@ -64,8 +64,7 @@ Query query = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); List<MonitorQualifyResult> oneMachineFileResults = mongoTemplate.find(query, MonitorQualifyResult.class); //mongo品牌数据 //TODO:测试改为今天 Query OSDQuery = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); Query OSDQuery = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday)))); Map<String, OsdCheckResult> osdMap = mongoTemplate.find(query, OsdCheckResult.class).stream().collect(Collectors.toMap(OsdCheckResult::getDeviceNo, Function.identity())); //数据库monitor表数据 Map<String, TMonitorVO> monitorVOMap = monitorMapper.selectMonitorVOList().stream().collect(Collectors.toMap(TMonitorVO::getSerialNumber, Function.identity())); ycl-server/src/main/java/com/ycl/task/VideoTask.java
@@ -114,11 +114,10 @@ public void osdTask() { log.info("开始计算Osd标注、时间准确率"); //计算Osd标注、时间准确率 //TODO测试改为今天 Date yesterday = DateUtils.addDays(new Date(), -1); Query query = new Query(); query.addCriteria(Criteria .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); List<OsdCheckResult> results = mongoTemplate.find(query, OsdCheckResult.class); CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_OsdTime); calculator.calculate(results);