Merge remote-tracking branch 'origin/master'
| | |
| | | */ |
| | | public static final String Car_SiteOnline_ViewStability = "carSiteOnlineViewStability"; |
| | | /** |
| | | * è½¦è¾æææ°æ®åç¡®æ§ãurlã大å¾å¯ç¨æ§ |
| | | */ |
| | | public static final String Car_DataAccuracy_Url_PicUsability = "carDataAccuracyUrlPicUsability"; |
| | | /** |
| | | * 车è¾å¡å£å±æ§çæµç»æ |
| | | */ |
| | | public static final String Car_InfoAccuracy = "carInfoAccuracy"; |
| | |
| | | */ |
| | | public static final String Car_DataIntegrity = "carDataIntegrity"; |
| | | /** |
| | | * è½¦è¾æææ°æ®åç¡®æ§ |
| | | */ |
| | | public static final String Car_DataAccuracy = "carDataAccuracy"; |
| | | /** |
| | | * è½¦è¾æ¶éåç¡®æ§ |
| | | */ |
| | | public static final String Car_ClockAccuracy = "carClockAccuracy"; |
| | | |
| | | |
| | | /** |
| | | * äººè¸æ°æ®ä¸ä¼ åæ¶æ§ |
| | |
| | | */ |
| | | public static final String Face_SiteOnline_ViewStability = "faceSiteOnlineViewStability"; |
| | | /** |
| | | * è½¦è¾æææ°æ®åç¡®æ§ãurlã大å¾å¯ç¨æ§ |
| | | */ |
| | | public static final String Face_DataAccuracy_PicUsability = "faceDataAccuracyPicUsability"; |
| | | /** |
| | | * 人è¸å±æ§çæµç»æ |
| | | */ |
| | | public static final String Face_InfoAccuracy = "faceInfoAccuracy"; |
| | | /** |
| | | * äººè¸æ¶éåç¡®æ§ |
| | | */ |
| | | public static final String Face_ClockAccuracy = "faceClockAccuracy"; |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * 计ç®è½¦è¾æ¶éåç¡®æ§ |
| | | * éç¨è½¦è¾å
¨æ£æ¥å£ |
| | | * è·ååçå
ãåºåçmap<k,v> k为deptIdæè
Province_deptId |
| | | * 循ç¯mapè®¡ç®æ¶éåç¡®æ§ |
| | | * æ´æ°ææ°å¢ |
| | |
| | | return null; |
| | | } |
| | | //è°ç¨æ¶éåç¡®æ§è®¡ç®æ¹æ³ |
| | | Map<String, Object> siteOnlineParam = new HashMap<>(); |
| | | siteOnlineParam.put("totalSites", stats.totalSites); |
| | | siteOnlineParam.put("accuracySites", stats.accuracySites); |
| | | BigDecimal clockAccuracy = clockAccuracy(siteOnlineParam); |
| | | Map<String, Object> clockAccuracyParam = new HashMap<>(); |
| | | clockAccuracyParam.put("totalSites", stats.totalSites); |
| | | clockAccuracyParam.put("accuracySites", stats.accuracySites); |
| | | BigDecimal clockAccuracy = clockAccuracy(clockAccuracyParam); |
| | | checkIndexCar.setVehicleTimingAccuracy(clockAccuracy); |
| | | return checkIndexCar; |
| | | } |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 计ç®è½¦è¾æ°æ®å®æ´æ§ |
| | | * 计ç®è½¦è¾æ°æ®å®æ´æ§ï¼æ£æµè½¦çå·ã车çé¢è²å¥çåä¸åæ å |
| | | * éç¨æ°æ®å®æ´æ§çæµæ¥å£ |
| | | * è·ååçå
ãåºåçmap<k,v> k为deptIdæè
Province_deptId |
| | | * æ´æ°ææ°å¢ |
| | | */ |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * è½¦è¾æ°æ®æ½æ£æ¥å£ |
| | | * 计ç®è½¦è¾å±æ§è¯å«åç¡®çãurlå¯ç¨æ§ã大å¾å¯ç¨æ§ |
| | | * è½¦è¾æ°æ®æ½æ£æ¥å£ |
| | | * è·ååçå
ãåºåçmap<k,v> k为deptIdæè
Province_deptId |
| | | * æ´æ°ææ°å¢ |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 计ç®è½¦è¾å¡å£ä¿¡æ¯ééåç¡®ç 设å¤ç¼ç ãè¡æ¿åºå代ç ãå®è£
ä½ç½®ãåæ ç»çº¬åº¦ä¿¡æ¯å®æ´åç¡® |
| | | * éç¨å¡å£å±æ§çæµæ¥å£ |
| | | * è·ååçå
ãåºåçmap<k,v> k为deptIdæè
Province_deptId |
| | | * æ´æ°ææ°å¢ |
| | | */ |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 计ç®è½¦è¾ç¹ä½å¨çº¿çãè§å¾åºå¯¹æ¥ç¨³å®æ§ |
| | | * æææ°æ®éçæµç»ææ¥å£æ°æ® |
| | | * 计ç®è½¦è¾ã人è¸ç¹ä½å¨çº¿çãè§å¾åºå¯¹æ¥ç¨³å®æ§ |
| | | * è·ååçå
ãåºåçmap<k,v> k为deptIdæè
Province_deptId |
| | | * 循ç¯map计ç®ç¹ä½å¨çº¿ç |
| | | * æ´æ°ææ°å¢ |
| | |
| | | |
| | | /** |
| | | * 计ç®è½¦è¾å¤æææ°æ®ä¸ä¼ åæ¶æ§ |
| | | * æææ°æ®æ¶å»¶çæµæ¥å£ |
| | | * è·ååçå
ãåºåçmap<k,v> k为deptIdæè
Province_deptId |
| | | * 循ç¯mapè®¡ç®æ°æ®ä¸ä¼ åæ¶æ§ |
| | | * æ´æ°ææ°å¢ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 累计æ»ç¹ä½æ°ã离线æ°ãæ»ææé |
| | | * ç´¯è®¡æ»æ°æ®éãå»¶è¿æ°æ®é |
| | | */ |
| | | private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, SnapshotDelayMonitorResult result) { |
| | | //è¿å对象çå¼ç¨ï¼å¦æä¸åå¨ä¼æ¾å
¥æ°çkey,value |
New file |
| | |
| | | package com.ycl.calculate; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ycl.platform.domain.entity.CheckIndexFace; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.result.HK.FaceDeviceInspectionResult; |
| | | import com.ycl.platform.domain.result.HK.FaceDeviceInspectionResult; |
| | | import com.ycl.platform.mapper.CheckIndexFaceMapper; |
| | | import com.ycl.platform.service.ICheckIndexFaceService; |
| | | import com.ycl.platform.service.ITMonitorService; |
| | | 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.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 计ç®äººè¸æ¶éåç¡®æ§ |
| | | * éç¨äººè¸å
¨æ£æ¥å£ |
| | | * è·ååçå
ãåºåçmap<k,v> k为deptIdæè
Province_deptId |
| | | * 循ç¯mapè®¡ç®æ¶éåç¡®æ§ |
| | | * æ´æ°ææ°å¢ |
| | | */ |
| | | @Component |
| | | public class FaceClockAccuracyCalculation extends IndexCalculationServe implements CalculationStrategy<FaceDeviceInspectionResult> { |
| | | @Autowired |
| | | private CheckIndexFaceMapper CheckIndexFaceMapper; |
| | | @Autowired |
| | | private ITMonitorService monitorService; |
| | | @Autowired |
| | | private ICheckIndexFaceService checkIndexFaceService; |
| | | |
| | | //åºåè½¦è¾æ¶éåç¡®æ§çå
é¨ç±» |
| | | private static class AreaStats { |
| | | int totalSites = 0; |
| | | int accuracySites = 0; |
| | | } |
| | | |
| | | @Override |
| | | public void calculate(List<FaceDeviceInspectionResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return; |
| | | } |
| | | |
| | | //è·å¾å½æ ç 为keyç设å¤map |
| | | Map<String, TMonitor> monitorMap = monitorService.list(new QueryWrapper<TMonitor>() |
| | | .in("serial_number", list.stream().map(FaceDeviceInspectionResult::getExternalIndexCode).collect(Collectors.toList()))) |
| | | .stream().collect(Collectors.toMap(TMonitor::getSerialNumber, Function.identity())); |
| | | //è·åçå
彿 ç éå |
| | | List<String> provinceIds = getProvince(); |
| | | |
| | | Map<String, AreaStats> areaStatsMap = new HashMap<>(); |
| | | for (FaceDeviceInspectionResult result : list) { |
| | | TMonitor monitor = monitorMap.get(result.getExternalIndexCode()); |
| | | if (monitor == null) continue; |
| | | |
| | | String deptId = monitor.getDeptId().toString(); |
| | | updateAreaStats(areaStatsMap, deptId, result); |
| | | |
| | | // å¤ççå
æ°æ® |
| | | if (!CollectionUtils.isEmpty(provinceIds) && provinceIds.contains(monitor.getSerialNumber())) { |
| | | String provinceKey = "Province_" + deptId; |
| | | updateAreaStats(areaStatsMap, provinceKey, result); |
| | | } |
| | | } |
| | | |
| | | // æ¥è¯¢æ¯å¦index表已ç»åå¨ä»æ¥æ°æ® |
| | | List<CheckIndexFace> checkIndexFaceList = CheckIndexFaceMapper.selectToday(DateUtils.getDate()); |
| | | List<CheckIndexFace> checkIndexFaces = new ArrayList<>(); |
| | | areaStatsMap.forEach((deptId, stats) -> { |
| | | if (stats.totalSites > 0) { |
| | | CheckIndexFace checkIndexFace = createOrUpdateCheckIndexCar(deptId, stats, checkIndexFaceList); |
| | | if (checkIndexFace != null) { |
| | | checkIndexFaces.add(checkIndexFace); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | checkIndexFaceService.saveOrUpdateBatch(checkIndexFaces); |
| | | } |
| | | |
| | | /** |
| | | * 累计æ¶éåæ ¼è®¾å¤ |
| | | */ |
| | | private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, FaceDeviceInspectionResult result) { |
| | | //è¿å对象çå¼ç¨ï¼å¦æä¸åå¨ä¼æ¾å
¥æ°çkey,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | | //æ¶éåç¡®ç大äº90%ä¸ºåæ ¼è®¾å¤ |
| | | if (result.getSnapClock().getClockPercent() >= 0.9) { |
| | | stats.accuracySites++; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è½¦è¾æ¶éåç¡®æ§ |
| | | */ |
| | | private CheckIndexFace createOrUpdateCheckIndexCar(String key, AreaStats stats, List<CheckIndexFace> checkIndexFaceList) { |
| | | CheckIndexFace checkIndexFace = getCheckIndex(key, checkIndexFaceList, CheckIndexFace.class); |
| | | if (checkIndexFace == null) { |
| | | return null; |
| | | } |
| | | //è°ç¨æ¶éåç¡®æ§è®¡ç®æ¹æ³ |
| | | Map<String, Object> clockAccuracyParam = new HashMap<>(); |
| | | clockAccuracyParam.put("totalSites", stats.totalSites); |
| | | clockAccuracyParam.put("accuracySites", stats.accuracySites); |
| | | BigDecimal clockAccuracy = clockAccuracy(clockAccuracyParam); |
| | | checkIndexFace.setFaceTimingAccuracy(clockAccuracy); |
| | | return checkIndexFace; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ycl.calculate; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ycl.platform.domain.entity.CheckIndexFace; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.result.HK.FaceDeviceSamplingResult; |
| | | import com.ycl.platform.mapper.CheckIndexFaceMapper; |
| | | import com.ycl.platform.service.ICheckIndexFaceService; |
| | | import com.ycl.platform.service.ITMonitorService; |
| | | 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.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 计ç®äººè¸ææå¾çåæ ¼æ§ã大å¾å¯ç¨æ§ |
| | | * äººè¸æ°æ®æ½æ£æ¥å£ |
| | | * è·ååçå
ãåºåçmap<k,v> k为deptIdæè
Province_deptId |
| | | * æ´æ°ææ°å¢ |
| | | */ |
| | | @Component |
| | | public class FaceDeviceSampleCalculation extends IndexCalculationServe implements CalculationStrategy<FaceDeviceSamplingResult> { |
| | | @Autowired |
| | | private CheckIndexFaceMapper checkIndexFaceMapper; |
| | | @Autowired |
| | | private ITMonitorService monitorService; |
| | | @Autowired |
| | | private ICheckIndexFaceService checkIndexFaceService; |
| | | |
| | | //åºåè½¦è¾æ½æ£ææ |
| | | private static class AreaStats { |
| | | int totalSites = 0; |
| | | //å¾çåæ ¼çç¹ä½æ° |
| | | int picQualifySites = 0; |
| | | //å¾çå¯ç¨çç¹ä½æ° |
| | | int picUsabilitySites = 0; |
| | | } |
| | | |
| | | @Override |
| | | public void calculate(List<FaceDeviceSamplingResult> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return; |
| | | } |
| | | //è¿å以彿 ç 为keyç设å¤map |
| | | //TODOï¼monitor廿äºdeptId |
| | | Map<String, TMonitor> monitorMap = monitorService.list(new QueryWrapper<TMonitor>() |
| | | .in("serial_number", list.stream().map(FaceDeviceSamplingResult::getExternalIndexCode).collect(Collectors.toList()))) |
| | | .stream().collect(Collectors.toMap(TMonitor::getSerialNumber, Function.identity())); |
| | | //è·åçå
彿 ç éå |
| | | List<String> provinceIds = getProvince(); |
| | | Map<String, AreaStats> areaStatsMap = new HashMap<>(); |
| | | for (FaceDeviceSamplingResult result : list) { |
| | | TMonitor monitor = monitorMap.get(result.getExternalIndexCode()); |
| | | if (monitor == null) continue; |
| | | String deptId = monitor.getDeptId().toString(); |
| | | updateAreaStats(areaStatsMap, deptId, result); |
| | | |
| | | // å¤ççå
æ°æ® |
| | | if (!CollectionUtils.isEmpty(provinceIds) && provinceIds.contains(monitor.getSerialNumber())) { |
| | | String provinceKey = "Province_" + deptId; |
| | | updateAreaStats(areaStatsMap, provinceKey, result); |
| | | } |
| | | } |
| | | |
| | | // æ¥è¯¢æ¯å¦index表已ç»åå¨ä»æ¥æ°æ® |
| | | 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, checkIndexFaceList); |
| | | if (checkIndexFace != null) { |
| | | checkIndexFaces.add(checkIndexFace); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | checkIndexFaceService.saveOrUpdateBatch(checkIndexFaces); |
| | | } |
| | | |
| | | /** |
| | | * ç´¯è®¡æææ°æ®åç¡®è®¾å¤æ°åè®¾å¤æ»æ° |
| | | */ |
| | | private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, FaceDeviceSamplingResult result) { |
| | | //è¿å对象çå¼ç¨ï¼å¦æä¸åå¨ä¼æ¾å
¥æ°çkey,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | FaceDeviceSamplingResult.BigUsefulness bigUseful = result.getBigUseful(); |
| | | FaceDeviceSamplingResult.FaceEligibility faceElig = result.getFaceElig(); |
| | | stats.totalSites++; |
| | | //90%å以䏿°æ®åæ ¼åæ¤äººè¸è®¾å¤è¢«è§ä¸ºå¾çåæ ¼ |
| | | if (faceElig.getFaceEligPercent() >= 0.9) { |
| | | stats.picQualifySites++; |
| | | } |
| | | //大å¾å¯ç¨ç大äº90%è§ä¸ºåæ ¼ |
| | | if (bigUseful.getBigUsefulPercent() >= 0.9) { |
| | | stats.picUsabilitySites++; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 人è¸å¾çåæ ¼çã大å¾å¯ç¨æ§ |
| | | */ |
| | | private CheckIndexFace createOrUpdateCheckIndexFace(String key, AreaStats stats, List<CheckIndexFace> checkIndexFaceList) { |
| | | CheckIndexFace checkIndexFace = getCheckIndex(key, checkIndexFaceList, CheckIndexFace.class); |
| | | if (checkIndexFace == null) { |
| | | return null; |
| | | } |
| | | //è°ç¨å¾çåæ ¼çè®¡ç®æ¹æ³ |
| | | Map<String, Object> qualifyParam = new HashMap<>(); |
| | | qualifyParam.put("totalSites", stats.totalSites); |
| | | qualifyParam.put("picQualifySites", stats.picQualifySites); |
| | | BigDecimal dataQualify = dataQualify(qualifyParam); |
| | | checkIndexFace.setFacePictureQualification(dataQualify); |
| | | //è°ç¨å¤§å¾å¯ç¨æ§è®¡ç®æ¹æ³ |
| | | Map<String, Object> usabilityParam = new HashMap<>(); |
| | | usabilityParam.put("totalSites", stats.totalSites); |
| | | usabilityParam.put("picUsabilitySites", stats.picUsabilitySites); |
| | | BigDecimal picUsability = picUsability(usabilityParam); |
| | | checkIndexFace.setFacePictureAvailability(picUsability); |
| | | return checkIndexFace; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * 人è¸å¡å£ä¿¡æ¯ééåç¡®ç 设å¤ç¼ç ãè¡æ¿åºå代ç ãå®è£
ä½ç½®ãåæ ç»çº¬åº¦ä¿¡æ¯å®æ´åç¡® |
| | | * éé设å¤å±æ§çæµæ¥å£ |
| | | * è·ååçå
ãåºåçmap<k,v> k为deptIdæè
Province_deptId |
| | | * æ´æ°ææ°å¢ |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 车è¾ä¿¡æ¯ééæ£ç¡®ç |
| | | * 人è¸ä¿¡æ¯ééæ£ç¡®ç |
| | | */ |
| | | private CheckIndexFace createOrUpdateCheckIndexFace(String key, AreaStats stats, List<CheckIndexFace> checkIndexFaceList) { |
| | | CheckIndexFace checkIndexFace = getCheckIndex(key, checkIndexFaceList, CheckIndexFace.class); |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æææ°æ®éçæµç»ææ¥å£æ°æ® |
| | | * 计ç®äººè¸ç¹ä½å¨çº¿çãè§å¾åºå¯¹æ¥ç¨³å®æ§ |
| | | * æææ°æ®éçæµç»ææ¥å£æ°æ® |
| | | * è·ååçå
ãåºåçmap<k,v> k为deptIdæè
Province_deptId |
| | | * 循ç¯map计ç®ç¹ä½å¨çº¿ç |
| | | * æ´æ°ææ°å¢ |
| | | */ |
| | | @Component |
| | | //TODD:ç³»ç»é
ç½®éçåºå人è¸å车è¾ãç´¯å æ¬¡æ°çæ¦å¿µãåºå¿ä¸å°äº40è·¯ï¼ä¸è¾¾æ å¸å·çå½æè¯¥é¡¹æç»©ä¸è½å¾åã |
| | | public class FaceSnapshotDataCalculation extends IndexCalculationServe implements CalculationStrategy<SnapshotDataMonitorResult> { |
| | | @Autowired |
| | | private CheckIndexFaceMapper checkIndexFaceMapper; |
| | |
| | | |
| | | /** |
| | | * 计ç®äººè¸è®¾å¤æææ°æ®ä¸ä¼ åæ¶æ§ |
| | | * æææ°æ®æ¶å»¶çæµæ¥å£ |
| | | * è·ååçå
ãåºåçmap<k,v> k为deptIdæè
Province_deptId |
| | | * 循ç¯mapè®¡ç®æ°æ®ä¸ä¼ åæ¶æ§ |
| | | * æ´æ°ææ°å¢ |
| | |
| | | @Autowired |
| | | private ICheckIndexFaceService checkIndexFaceService; |
| | | |
| | | //åºå车è¾ç¹ä½å¨çº¿ææ çå
é¨ç±» |
| | | //åºåäººè¸æ°æ®ä¸ä¼ å»¶è¿ææ çå
é¨ç±» |
| | | private static class AreaStats { |
| | | int totalCount = 0; |
| | | //0-180s |
| | |
| | | } |
| | | |
| | | /** |
| | | * 累计æ»ç¹ä½æ°ã离线æ°ãæ»ææé |
| | | * ç´¯è®¡æ»æ°æ®éãå»¶è¿æ°æ®é |
| | | */ |
| | | private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, SnapshotDelayMonitorResult result) { |
| | | //è¿å对象çå¼ç¨ï¼å¦æä¸åå¨ä¼æ¾å
¥æ°çkey,value |
| | |
| | | stats.delayCount3 += result.getDataDelayCount3(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 车è¾ç¹ä½å¨çº¿çåè§å¾åºå¯¹æ¥ç¨³å®æ§ |
| | | * äººè¸æ°æ®ä¸ä¼ åæ¶æ§ |
| | | */ |
| | | private CheckIndexFace createOrUpdateCheckIndexFace(String key, AreaStats stats, List<CheckIndexFace> checkIndexFaceList) { |
| | | CheckIndexFace checkIndexFace = getCheckIndex(key, checkIndexFaceList, CheckIndexFace.class); |
| | |
| | | return picUsabilitySites.divide(totalSitesCount, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //å¾çåæ ¼ç |
| | | public BigDecimal dataQualify(Map<String, Object> param) { |
| | | BigDecimal totalSitesCount = new BigDecimal((Integer) param.get("totalSites")); |
| | | BigDecimal picQualifySites = new BigDecimal((Integer) param.get("picQualifySites")); |
| | | return picQualifySites.divide(totalSitesCount, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //è¿åçå
彿 ç éå |
| | | public List<String> getProvince() { |
| | |
| | | private static final Map<String, CalculationStrategy> calculators = new HashMap<>(); |
| | | |
| | | static { |
| | | //ç¹ä½å¨çº¿ãè§å¾åºå¯¹æ¥ç¨³å®æ§ |
| | | //车è¾ç¹ä½å¨çº¿ãè§å¾åºå¯¹æ¥ç¨³å®æ§ |
| | | calculators.put(CalculationStrategyConstants.Car_SiteOnline_ViewStability, new CarSnapshopDataCalculation()); |
| | | calculators.put(CalculationStrategyConstants.Face_SiteOnline_ViewStability, new FaceSnapshotDataCalculation()); |
| | | //ä¿¡æ¯åç¡®ç |
| | | //车è¾ä¿¡æ¯åç¡®ç |
| | | calculators.put(CalculationStrategyConstants.Car_InfoAccuracy, new CarInFoAccuracyCalculation()); |
| | | calculators.put(CalculationStrategyConstants.Face_InfoAccuracy, new FaceInFoAccuracyCalculation()); |
| | | //æææ°æ®ä¸ä¼ å»¶è¿ |
| | | //è½¦è¾æææ°æ®ä¸ä¼ å»¶è¿ |
| | | calculators.put(CalculationStrategyConstants.Car_SnapshotDelay, new CarSnapshotDelayCalculation()); |
| | | calculators.put(CalculationStrategyConstants.Face_SnapshotDelay, new FaceSnapshotDelayCalculation()); |
| | | //è½¦è¾æ°æ®ææå®æ´æ§ |
| | | calculators.put(CalculationStrategyConstants.Car_DataIntegrity,new CarDataIntegrityCalculation()); |
| | | //è½¦è¾æ°æ®ææåç¡®æ§ |
| | | calculators.put(CalculationStrategyConstants.Car_DataAccuracy,new CarDeviceSampleCalculation()); |
| | | calculators.put(CalculationStrategyConstants.Car_DataIntegrity, new CarDataIntegrityCalculation()); |
| | | //è½¦è¾æ°æ®ææåç¡®æ§ãurlã大å¾å¯ç¨ |
| | | calculators.put(CalculationStrategyConstants.Car_DataAccuracy_Url_PicUsability, new CarDeviceSampleCalculation()); |
| | | //è½¦è¾æ¶éåç¡®æ§ |
| | | calculators.put(CalculationStrategyConstants.Car_ClockAccuracy,new CarClockAccuracyCalculation()); |
| | | calculators.put(CalculationStrategyConstants.Car_ClockAccuracy, new CarClockAccuracyCalculation()); |
| | | //TODOï¼è½¦è¾ç®å½ä¸è´ |
| | | |
| | | //人è¸ç¹ä½å¨çº¿ãè§å¾åºå¯¹æ¥ç¨³å® |
| | | calculators.put(CalculationStrategyConstants.Face_SiteOnline_ViewStability, new FaceSnapshotDataCalculation()); |
| | | //人è¸ä¿¡æ¯åç¡®ç |
| | | calculators.put(CalculationStrategyConstants.Face_InfoAccuracy, new FaceInFoAccuracyCalculation()); |
| | | //äººè¸æææ°æ®å»¶è¿ |
| | | calculators.put(CalculationStrategyConstants.Face_SnapshotDelay, new FaceSnapshotDelayCalculation()); |
| | | //人è¸å¾çåæ ¼ã大å¾å¯ç¨ |
| | | calculators.put(CalculationStrategyConstants.Face_DataAccuracy_PicUsability, new FaceDeviceSampleCalculation()); |
| | | //äººè¸æ¶éåç¡®æ§ |
| | | calculators.put(CalculationStrategyConstants.Face_ClockAccuracy, new FaceClockAccuracyCalculation()); |
| | | //TODOï¼äººè¸ç®å½ä¸è´ |
| | | } |
| | | |
| | | public static CalculationStrategy getCalculator(String indexName) { |
| | |
| | | |
| | | public void deviceSampleTask() { |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //计ç®è½¦è¾å¡å£è®¾å¤æææ°æ®åç¡®æ§ãurlå¯ç¨æ§ã大å¾å¯ç¨æ§ |
| | | //计ç®è½¦è¾å¡å£è®¾å¤æ°æ®è¯å«åç¡®æ§ãurlå¯ç¨æ§ã大å¾å¯ç¨æ§ |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); |
| | | List<VehicleDeviceSamplingResult> results = mongoTemplate.find(query, VehicleDeviceSamplingResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Car_DataIntegrity); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Car_DataAccuracy_Url_PicUsability); |
| | | calculator.calculate(results); |
| | | } |
| | | |
| | |
| | | |
| | | public void snapShopDelay() { |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //计ç®è½¦è¾æææ°æ®ä¸ä¼ å»¶è¿ |
| | | //计ç®è½¦è¾æææ°æ®ä¸ä¼ åæ¶æ§ |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday)) |
| | |
| | | calculator.calculate(results); |
| | | } |
| | | |
| | | public void CarClockAccuracyTask() { |
| | | public void clockAccuracyTask() { |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //计ç®è½¦è¾å¡å£è®¾å¤æ¶éåç¡®æ§ |
| | | Query query = new Query(); |
| | |
| | | |
| | | import com.ycl.calculate.CalculationStrategy; |
| | | import com.ycl.factory.IndexCalculationFactory; |
| | | import com.ycl.platform.domain.result.HK.CrossDetailResult; |
| | | import com.ycl.platform.domain.result.HK.MonitoringDetailResult; |
| | | import com.ycl.platform.domain.result.HK.SnapshotDataMonitorResult; |
| | | import com.ycl.platform.domain.result.HK.SnapshotDelayMonitorResult; |
| | | import com.ycl.platform.domain.result.HK.*; |
| | | import com.ycl.utils.DateUtils; |
| | | import constant.ApiConstants; |
| | | import constant.CalculationStrategyConstants; |
| | |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Face_SiteOnline_ViewStability); |
| | | calculator.calculate(results); |
| | | } |
| | | public void InfoAccuracyTask(){ |
| | | public void deviceSampleTask() { |
| | | 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<FaceDeviceSamplingResult> results = mongoTemplate.find(query, FaceDeviceSamplingResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Face_DataAccuracy_PicUsability); |
| | | calculator.calculate(results); |
| | | } |
| | | public void infoAccuracyTask(){ |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //计ç®äººè¸å¡å£ä¿¡æ¯ééåç¡®ç |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); |
| | |
| | | } |
| | | public void snapShopDelay(){ |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //计ç®è½¦è¾å¡å£ä¿¡æ¯ééåç¡®ç |
| | | //计ç®äººè¸æææ°æ®ä¸ä¼ åæ¶æ§ |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday)) |
| | |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Face_SnapshotDelay); |
| | | calculator.calculate(results); |
| | | } |
| | | public void clockAccuracyTask() { |
| | | 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<FaceDeviceInspectionResult> results = mongoTemplate.find(query, FaceDeviceInspectionResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Face_ClockAccuracy); |
| | | calculator.calculate(results); |
| | | } |
| | | |
| | | public void test() { |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //TODOï¼ä¸æºä¸æ¡£ èç½å¡å£è®¾å¤ç®å½ä¸è´ç åredis |
| | | } |
| | | } |