Merge remote-tracking branch 'origin/master'
| | |
| | | * è½¦è¾æ¶éåç¡®æ§ |
| | | */ |
| | | public static final String Car_ClockAccuracy = "carClockAccuracy"; |
| | | |
| | | /** |
| | | * 车è¾ç®å½ä¸è´ç |
| | | */ |
| | | public static final String Car_DirectConsistent = "carDirectConsistent"; |
| | | |
| | | /** |
| | | * äººè¸æ°æ®ä¸ä¼ åæ¶æ§ |
| | |
| | | * äººè¸æ¶éåç¡®æ§ |
| | | */ |
| | | public static final String Face_ClockAccuracy = "faceClockAccuracy"; |
| | | /** |
| | | * 人è¸ç®å½ä¸è´ç |
| | | */ |
| | | public static final String Face_DirectConsistent = "faceDirectConsistent"; |
| | | |
| | | |
| | | /** |
| | | * 䏿ºä¸æ¡£æ³¨åçãæ¡£æ¡èæ ¸æ¯ |
| | | */ |
| | | public static final String Video_MonitorRegis_ArchiveRate = "videoMonitorRegisArchiveRate"; |
| | | /** |
| | | * 䏿ºä¸æ¡£åæ ¼ç |
| | | */ |
| | |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * éé设å¤å±æ§çæµç»æï¼äººè¸ï¼è®¾å¤ææå¾çåæ ¼æ§ï¼ |
| | | * éé设å¤å±æ§çæµç»æï¼äººè¸ï¼äººè¸å¡å£ä¿¡æ¯ééåç¡®çï¼ |
| | | * |
| | | * @author gonghl |
| | | */ |
| | |
| | | * @dateï¼2024/8/8 20:36 |
| | | */ |
| | | @Data |
| | | @Document(collation = "uy_image_detection") |
| | | @Document(collection = "uy_image_detection") |
| | | public class ImageDetectionResult extends BaseResult { |
| | | |
| | | /** |
New file |
| | |
| | | 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.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 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; |
| | | |
| | | /** |
| | | * 计ç®è½¦è¾ç®å½ä¸è´ç |
| | | * è·ååçå
ãåºåçmap<k,v> k为deptIdæè
Province_deptId |
| | | * æ´æ°ææ°å¢ |
| | | */ |
| | | @Component |
| | | public class CarConsistentCalculation extends IndexCalculationServe implements CalculationStrategy<TMonitorVO> { |
| | | @Autowired |
| | | private CheckIndexCarMapper checkIndexCarMapper; |
| | | @Autowired |
| | | private TMonitorMapper monitorMapper; |
| | | @Autowired |
| | | private ICheckIndexCarService checkIndexCarService; |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | //åºå车è¾ä¿¡æ¯ééåç¡®ççå
é¨ç±» |
| | | private static class AreaStats { |
| | | int totalSites = 0; |
| | | int newSites = 0; |
| | | } |
| | | |
| | | @Override |
| | | public void calculate(List<TMonitorVO> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return; |
| | | } |
| | | //è¿å以彿 ç 为keyç设å¤map |
| | | Map<String, TMonitorVO> monitorMap = new HashMap<>(); |
| | | if(!CollectionUtils.isEmpty(list)){ |
| | | monitorMap = list.stream().collect(Collectors.toMap(TMonitorVO::getSerialNumber, Function.identity())); |
| | | } |
| | | //è·åçå
彿 ç éå |
| | | List<String> provinceIds = getProvince(); |
| | | //æªæ³¨å车è¾è®¾å¤ |
| | | Map<String,TMonitor> newMonitorMap = new HashMap<>(); |
| | | //Mongo䏿ºä¸æ¡£åæ¥Mysqlæ¶æ¾å
¥Redis çéåºè½¦è¾æ¡£æ¡ |
| | | String json = (String) redisTemplate.opsForValue().get(RedisConstant.New_Monitor_Set); |
| | | if (!StringUtils.isEmpty(json)) { |
| | | List<TMonitor> newMonitors = JSONArray.parseArray(json, TMonitor.class); |
| | | if(!CollectionUtils.isEmpty(newMonitors)){ |
| | | newMonitorMap = newMonitors.stream().filter(tMonitor -> tMonitor.getCameraFunType().contains(CheckConstants.Rule_Category_Car+"")).collect(Collectors.toMap(TMonitor::getSerialNumber, Function.identity())); |
| | | } |
| | | } |
| | | Map<String, AreaStats> areaStatsMap = new HashMap<>(); |
| | | for (TMonitorVO result : list) { |
| | | TMonitorVO monitor = monitorMap.get(result.getSerialNumber()); |
| | | if (monitor == null) continue; |
| | | String deptId = monitor.getDeptId().toString(); |
| | | updateAreaStats(areaStatsMap, deptId, result,newMonitorMap); |
| | | |
| | | // å¤ççå
æ°æ® |
| | | if (!CollectionUtils.isEmpty(provinceIds) && provinceIds.contains(monitor.getSerialNumber())) { |
| | | String provinceKey = ApiConstants.Province + deptId; |
| | | updateAreaStats(areaStatsMap, provinceKey, result,newMonitorMap); |
| | | } |
| | | } |
| | | |
| | | // æ¥è¯¢æ¯å¦index表已ç»åå¨ä»æ¥æ°æ® |
| | | List<CheckIndexCar> checkIndexCarList = checkIndexCarMapper.selectToday(DateUtils.getDate()); |
| | | List<CheckIndexCar> checkIndexCars = new ArrayList<>(); |
| | | areaStatsMap.forEach((deptId, stats) -> { |
| | | if (stats.totalSites > 0) { |
| | | CheckIndexCar checkIndexCar = createOrUpdateCheckIndexCar(deptId, stats, checkIndexCarList); |
| | | if (checkIndexCar != null) { |
| | | checkIndexCars.add(checkIndexCar); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | checkIndexCarService.saveOrUpdateBatch(checkIndexCars); |
| | | } |
| | | |
| | | /** |
| | | * 累计车è¾ç®å½ä¸è´ç |
| | | */ |
| | | private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, TMonitorVO result,Map<String,TMonitor> newMonitorMap) { |
| | | //è¿å对象çå¼ç¨ï¼å¦æä¸åå¨ä¼æ¾å
¥æ°çkey,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | | if(newMonitorMap.containsKey(result.getSerialNumber())){ |
| | | stats.newSites++; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 车è¾ä¿¡æ¯ééæ£ç¡®ç |
| | | */ |
| | | private CheckIndexCar createOrUpdateCheckIndexCar(String key, AreaStats stats, List<CheckIndexCar> checkIndexCarList) { |
| | | CheckIndexCar checkIndexCar = getCheckIndex(key, checkIndexCarList, CheckIndexCar.class); |
| | | if (checkIndexCar == null) { |
| | | return null; |
| | | } |
| | | //è°ç¨ç®å½ä¸è´çè®¡ç®æ¹æ³ |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("totalSites", stats.totalSites); |
| | | param.put("newSites", stats.newSites); |
| | | BigDecimal directoryConstant = directoryConstant(param); |
| | | checkIndexCar.setDeviceDirectoryConsistent(directoryConstant); |
| | | return checkIndexCar; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.calculate; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.ycl.platform.domain.entity.CheckIndexFace; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.CheckIndexFaceMapper; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.service.ICheckIndexFaceService; |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import constant.RedisConstant; |
| | | 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; |
| | | |
| | | /** |
| | | * 计ç®è½¦è¾ç®å½ä¸è´ç |
| | | * è·ååçå
ãåºåçmap<k,v> k为deptIdæè
Province_deptId |
| | | * æ´æ°ææ°å¢ |
| | | */ |
| | | @Component |
| | | public class FaceConsistentCalculation extends IndexCalculationServe implements CalculationStrategy<TMonitorVO> { |
| | | @Autowired |
| | | private CheckIndexFaceMapper checkIndexFaceMapper; |
| | | @Autowired |
| | | private TMonitorMapper monitorMapper; |
| | | @Autowired |
| | | private ICheckIndexFaceService checkIndexFaceService; |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | //åºå车è¾ä¿¡æ¯ééåç¡®ççå
é¨ç±» |
| | | private static class AreaStats { |
| | | int totalSites = 0; |
| | | int newSites = 0; |
| | | } |
| | | |
| | | @Override |
| | | public void calculate(List<TMonitorVO> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return; |
| | | } |
| | | //è¿å以彿 ç 为keyç设å¤map |
| | | Map<String, TMonitorVO> monitorMap = new HashMap<>(); |
| | | if(!CollectionUtils.isEmpty(list)){ |
| | | monitorMap = list.stream().collect(Collectors.toMap(TMonitorVO::getSerialNumber, Function.identity())); |
| | | } |
| | | //è·åçå
彿 ç éå |
| | | List<String> provinceIds = getProvince(); |
| | | //æªæ³¨å车è¾è®¾å¤ |
| | | Map<String,TMonitor> newMonitorMap = new HashMap<>(); |
| | | //Mongo䏿ºä¸æ¡£åæ¥Mysqlæ¶æ¾å
¥Redis çéåºè½¦è¾æ¡£æ¡ |
| | | String json = (String) redisTemplate.opsForValue().get(RedisConstant.New_Monitor_Set); |
| | | if (!StringUtils.isEmpty(json)) { |
| | | List<TMonitor> newMonitors = JSONArray.parseArray(json, TMonitor.class); |
| | | if(!CollectionUtils.isEmpty(newMonitors)){ |
| | | newMonitorMap = newMonitors.stream().filter(tMonitor -> tMonitor.getCameraFunType().contains(CheckConstants.Rule_Category_Face+"")).collect(Collectors.toMap(TMonitor::getSerialNumber, Function.identity())); |
| | | } |
| | | } |
| | | Map<String, AreaStats> areaStatsMap = new HashMap<>(); |
| | | for (TMonitorVO result : list) { |
| | | TMonitorVO monitor = monitorMap.get(result.getSerialNumber()); |
| | | if (monitor == null) continue; |
| | | String deptId = monitor.getDeptId().toString(); |
| | | updateAreaStats(areaStatsMap, deptId, result,newMonitorMap); |
| | | |
| | | // å¤ççå
æ°æ® |
| | | if (!CollectionUtils.isEmpty(provinceIds) && provinceIds.contains(monitor.getSerialNumber())) { |
| | | String provinceKey = ApiConstants.Province + deptId; |
| | | updateAreaStats(areaStatsMap, provinceKey, result,newMonitorMap); |
| | | } |
| | | } |
| | | |
| | | // æ¥è¯¢æ¯å¦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, TMonitorVO result,Map<String,TMonitor> newMonitorMap) { |
| | | //è¿å对象çå¼ç¨ï¼å¦æä¸åå¨ä¼æ¾å
¥æ°çkey,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | | if(newMonitorMap.containsKey(result.getSerialNumber())){ |
| | | stats.newSites++; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 人è¸ä¿¡æ¯ééæ£ç¡®ç |
| | | */ |
| | | 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> param = new HashMap<>(); |
| | | param.put("totalSites", stats.totalSites); |
| | | param.put("newSites", stats.newSites); |
| | | BigDecimal directoryConstant = directoryConstant(param); |
| | | checkIndexFace.setDeviceDirectoryConsistent(directoryConstant); |
| | | return checkIndexFace; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | import com.ycl.platform.base.CheckIndex; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.entity.YwPoint; |
| | | 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 constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private YwPointMapper pointMapper; |
| | | |
| | | @Autowired |
| | | private TMonitorMapper monitorMapper; |
| | | |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | //䏿ºä¸æ¡£åæ ¼ç |
| | | public BigDecimal monitorQualify(Map<String, Object> param) { |
| | | BigDecimal totalMonitors = new BigDecimal((Integer) param.get("totalMonitors")); |
| | | BigDecimal qualifyMonitor = new BigDecimal((Integer) param.get("qualifyMonitor")); |
| | | return qualifyMonitor.divide(totalMonitors, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //䏿ºä¸æ¡£æ³¨åçç |
| | | public BigDecimal monitorRegistration(Map<String, Object> param) { |
| | | //æ°+æ£å¨ç¨çæ¡£æ¡æ° |
| | | BigDecimal totalSites = new BigDecimal((Integer) param.get("totalSites")); |
| | | //æ£å¨ç¨çæ¡£æ¡æ° |
| | | 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")); |
| | |
| | | return onlineSites.divide(totalSites, 4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | //ç®å½ä¸è´çï¼æ¯è¶
è¿ç¾åä¹1æ£10% |
| | | public BigDecimal directoryConstant(Map<String, Object> param) { |
| | | BigDecimal totalSites = new BigDecimal((Integer) param.get("totalSites")); |
| | | BigDecimal newSites = new BigDecimal((Integer) param.get("newSites")); |
| | | // 计ç®newSiteså totalSitesçç¾åæ¯åæ° |
| | | BigDecimal percentage = newSites.divide(totalSites, 2, RoundingMode.DOWN).multiply(BigDecimal.valueOf(100)); |
| | | BigDecimal result = BigDecimal.ONE; |
| | | if(BigDecimal.ONE.compareTo(percentage) <= 0 ){ |
| | | result = result.subtract(percentage.multiply(new BigDecimal("0.1"))); |
| | | } |
| | | 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()); |
| | | } |
| | | //è¿åéç¹ææ¥å¾åéå |
| | | public List<String> getMonitorFromMongo() { |
| | | // è·åCalendarå®ä¾ï¼é»è®¤ä½¿ç¨å½åæ¶åºåè¯è¨ç¯å¢ |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // æ¸
é¤Calendarä¸çææå段å¼ï¼ä»¥é¿å
å®ä»¬å¯¹å½åæ¥ææ¶é´æå½±å |
| | | calendar.clear(); |
| | | // 设置年份ãæä»½ï¼æ³¨æï¼æä»½æ¯ä»0å¼å§çï¼æä»¥8ææ¯7ï¼ãæ¥æ |
| | | calendar.set(Calendar.YEAR, 2024); |
| | | calendar.set(Calendar.MONTH, Calendar.AUGUST); |
| | | calendar.set(Calendar.DAY_OF_MONTH, 13); |
| | | // Calendar.getTime()æ¹æ³è¿åä¸ä¸ªè¡¨ç¤ºæ¤Calendaræ¶é´å¼çDate对象 |
| | | Date date = calendar.getTime(); |
| | | 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()))); |
| | | List<MonitorQualifyResult> oneMachineFileResults = mongoTemplate.find(query, MonitorQualifyResult.class); |
| | | |
| | | 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; |
New file |
| | |
| | | package com.ycl.calculate; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.ycl.platform.domain.entity.CheckIndexVideo; |
| | | import com.ycl.platform.domain.entity.TMonitor; |
| | | import com.ycl.platform.domain.entity.YwPoint; |
| | | import com.ycl.platform.domain.result.UY.VideoOnlineResult; |
| | | 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 constant.ApiConstants; |
| | | import constant.RedisConstant; |
| | | 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.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 计ç®ä¸æºä¸æ¡£æ³¨åçãæ¡£æ¡èæ ¸æ¯ |
| | | * è·ååçå
ãåºåçmap<k,v> k为deptIdæè
Province_deptId |
| | | * æ´æ°ææ°å¢ |
| | | */ |
| | | @Component |
| | | public class MonitorRegistrationCalculation extends IndexCalculationServe implements CalculationStrategy<TMonitorVO> { |
| | | @Autowired |
| | | private CheckIndexVideoMapper checkIndexVideoMapper; |
| | | @Autowired |
| | | private ICheckIndexVideoService checkIndexVideoService; |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | //åºåè§é¢å¨çº¿ççå
é¨ç±» |
| | | private static class AreaStats { |
| | | //èµäº§åºç»è®°å¨ç¨æ° |
| | | int totalSites = 0; |
| | | //æªæ³¨åçæ°é |
| | | int newSites = 0; |
| | | //å
¨å¹´çåæ° |
| | | int allFiles = 0; |
| | | //彿¥æ¡£æ¡æ° |
| | | int todayFiles = 0; |
| | | } |
| | | |
| | | @Override |
| | | public void calculate(List<TMonitorVO> list) { |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return; |
| | | } |
| | | //è·å¾å½æ ç 为keyç设å¤map |
| | | Map<String, TMonitorVO> monitorMap = new HashMap<>(); |
| | | if(!CollectionUtils.isEmpty(list)){ |
| | | monitorMap = list.stream().collect(Collectors.toMap(TMonitorVO::getSerialNumber, Function.identity())); |
| | | } |
| | | //è·åçå
彿 ç éå |
| | | List<String> provinceIds = getProvince(); |
| | | //æªæ³¨åè®¾å¤ |
| | | Map<String,TMonitor> newMonitorMap = new HashMap<>(); |
| | | //Mongo䏿ºä¸æ¡£åæ¥Mysqlæ¶æ¾å
¥Redis |
| | | String json = (String) redisTemplate.opsForValue().get(RedisConstant.New_Monitor_Set); |
| | | if (!StringUtils.isEmpty(json)) { |
| | | List<TMonitor> newMonitors = JSONArray.parseArray(json, TMonitor.class); |
| | | if(!CollectionUtils.isEmpty(newMonitors)){ |
| | | newMonitorMap = newMonitors.stream().collect(Collectors.toMap(TMonitor::getSerialNumber, Function.identity())); |
| | | } |
| | | } |
| | | |
| | | //è·åæ¨æ¥mongo䏿ºä¸æ¡£æ°é |
| | | List<String> todayMonitor = getMonitorFromMongo(); |
| | | Map<String, AreaStats> areaStatsMap = new HashMap<>(); |
| | | for (TMonitorVO result : list) { |
| | | TMonitorVO monitor = monitorMap.get(result.getSerialNumber()); |
| | | if (monitor == null) continue; |
| | | |
| | | String deptId = monitor.getDeptId().toString(); |
| | | updateAreaStats(areaStatsMap, deptId, result,newMonitorMap,todayMonitor); |
| | | // å¤ççå
æ°æ® |
| | | if (!CollectionUtils.isEmpty(provinceIds) && provinceIds.contains(monitor.getSerialNumber())) { |
| | | String provinceKey = ApiConstants.Province + deptId; |
| | | updateAreaStats(areaStatsMap, provinceKey, result,newMonitorMap,todayMonitor); |
| | | } |
| | | } |
| | | |
| | | // æ¥è¯¢æ¯å¦index表已ç»åå¨ä»æ¥æ°æ® |
| | | List<CheckIndexVideo> checkIndexVideoList = checkIndexVideoMapper.selectToday(DateUtils.getDate()); |
| | | List<CheckIndexVideo> checkIndexVideos = new ArrayList<>(); |
| | | areaStatsMap.forEach((deptId, stats) -> { |
| | | if (stats.totalSites > 0) { |
| | | CheckIndexVideo CheckIndexVideo = createOrUpdateCheckIndexVideo(deptId, stats, checkIndexVideoList); |
| | | if (CheckIndexVideo != null) { |
| | | checkIndexVideos.add(CheckIndexVideo); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | checkIndexVideoService.saveOrUpdateBatch(checkIndexVideos); |
| | | } |
| | | |
| | | /** |
| | | * 累计æ»ç¹ä½æ°ãå¨çº¿ç¹ä½æ°ãéç¹ç¹ä½æ°ãéç¹ç¹ä½å¨çº¿æ°ãææ¥å¾åæ°ãææ¥å¾åå¨çº¿æ° |
| | | */ |
| | | private void updateAreaStats(Map<String, AreaStats> areaStatsMap, String key, TMonitorVO result,Map<String,TMonitor> newMonitors,List<String> todayMonitor) { |
| | | //è¿å对象çå¼ç¨ï¼å¦æä¸åå¨ä¼æ¾å
¥æ°çkey,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalSites++; |
| | | stats.allFiles++; |
| | | if(newMonitors.containsKey(result.getSerialNumber())){ |
| | | stats.newSites++; |
| | | } |
| | | if(todayMonitor.contains(result.getSerialNumber())){ |
| | | stats.todayFiles++; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è§é¢ç¹ä½å¨çº¿ç |
| | | */ |
| | | private CheckIndexVideo createOrUpdateCheckIndexVideo(String key, AreaStats stats, List<CheckIndexVideo> checkIndexVideoList) { |
| | | CheckIndexVideo checkIndexVideo = getCheckIndex(key, checkIndexVideoList, CheckIndexVideo.class); |
| | | if (checkIndexVideo == null) { |
| | | return null; |
| | | } |
| | | //è°ç¨ä¸æºä¸æ¡£æ³¨åç |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("totalSites", stats.totalSites); |
| | | param.put("newSites", stats.newSites); |
| | | 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); |
| | | checkIndexVideo.setArchivesRate(archivesRate); |
| | | |
| | | return checkIndexVideo; |
| | | } |
| | | } |
| | |
| | | List<CheckIndexVideo> checkIndexVideos = new ArrayList<>(); |
| | | areaStatsMap.forEach((deptId, stats) -> { |
| | | if (stats.totalSites > 0) { |
| | | CheckIndexVideo CheckIndexVideo = createOrUpdateCheckIndexFace(deptId, stats, checkIndexVideoList); |
| | | CheckIndexVideo CheckIndexVideo = createOrUpdateCheckIndexVideo(deptId, stats, checkIndexVideoList); |
| | | if (CheckIndexVideo != null) { |
| | | checkIndexVideos.add(CheckIndexVideo); |
| | | } |
| | |
| | | /** |
| | | * è§é¢ç¹ä½å¨çº¿ç |
| | | */ |
| | | private CheckIndexVideo createOrUpdateCheckIndexFace(String key, AreaStats stats, List<CheckIndexVideo> checkIndexVideoList) { |
| | | private CheckIndexVideo createOrUpdateCheckIndexVideo(String key, AreaStats stats, List<CheckIndexVideo> checkIndexVideoList) { |
| | | CheckIndexVideo checkIndexVideo = getCheckIndex(key, checkIndexVideoList, CheckIndexVideo.class); |
| | | if (checkIndexVideo == null) { |
| | | return null; |
| | |
| | | calculators.put(CalculationStrategyConstants.Car_DataAccuracy_Url_PicUsability, new CarDeviceSampleCalculation()); |
| | | //è½¦è¾æ¶éåç¡®æ§ |
| | | calculators.put(CalculationStrategyConstants.Car_ClockAccuracy, new CarClockAccuracyCalculation()); |
| | | //TODOï¼è½¦è¾ç®å½ä¸è´ |
| | | //车è¾ç®å½ä¸è´ |
| | | calculators.put(CalculationStrategyConstants.Car_DirectConsistent, new CarConsistentCalculation()); |
| | | |
| | | //人è¸ç¹ä½å¨çº¿ãè§å¾åºå¯¹æ¥ç¨³å® |
| | | calculators.put(CalculationStrategyConstants.Face_SiteOnline_ViewStability, new FaceSnapshotDataCalculation()); |
| | |
| | | calculators.put(CalculationStrategyConstants.Face_DataAccuracy_PicUsability, new FaceDeviceSampleCalculation()); |
| | | //äººè¸æ¶éåç¡®æ§ |
| | | calculators.put(CalculationStrategyConstants.Face_ClockAccuracy, new FaceClockAccuracyCalculation()); |
| | | //TODOï¼äººè¸ç®å½ä¸è´ |
| | | //人è¸ç®å½ä¸è´ |
| | | calculators.put(CalculationStrategyConstants.Face_DirectConsistent, new FaceConsistentCalculation()); |
| | | |
| | | //䏿ºä¸æ¡£æ³¨åçãæ¡£æ¡èæ ¸æ¯ |
| | | calculators.put(CalculationStrategyConstants.Video_MonitorRegis_ArchiveRate,new MonitorRegistrationCalculation()) |
| | | //䏿ºä¸æ¡£åæ ¼ç |
| | | calculators.put(CalculationStrategyConstants.Video_MonitorQualify, new MonitorQualifyCalculation()); |
| | | //è§é¢ç¹ä½å¨çº¿ç |
| | |
| | | private final ITMonitorService tMonitorService; |
| | | private final WorkOrderService workOrderService; |
| | | private final YwPointService ywPointService; |
| | | private final IContractScoreService contractScoreService; |
| | | private final ICheckScoreService checkScoreService; |
| | | |
| | | @GetMapping("/ywUnitList") |
| | |
| | | } |
| | | |
| | | @GetMapping("/calculate") |
| | | public AjaxResult calculate() { |
| | | return AjaxResult.success(contractScoreService.calculate()); |
| | | public AjaxResult calculate(String category) { |
| | | return AjaxResult.success(checkScoreService.calculate(category)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ycl.platform.domain.entity.CheckScore; |
| | | import enumeration.OperationType; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | * @return æ°æ® |
| | | */ |
| | | List<Map<String, Object>> home(); |
| | | |
| | | /** |
| | | * é¦é¡µæ ¸ç® |
| | | * @param startDate æ¬æç¬¬ä¸å¤© |
| | | * @param endDate å½åæ¶é´ |
| | | * @param category åç±» |
| | | * @return æ°æ® |
| | | */ |
| | | List<Map<String, Object>> calculate(Date startDate, Date endDate, String category); |
| | | } |
| | |
| | | import com.ycl.platform.domain.entity.ContractScore; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ååæåMapperæ¥å£ |
| | |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteDefaultScoreByIds(Long[] ids); |
| | | |
| | | /** |
| | | * é¦é¡µæ ¸ç® |
| | | * @return æ ¸ç® |
| | | */ |
| | | List<Map<String, Object>> calculate(); |
| | | } |
| | |
| | | IPage getPage(IPage page, @Param("query") DataCenterQuery query); |
| | | |
| | | //æ¨æ¥æ°æ® |
| | | List<PlatformOnlineVO> sumYesterday(@Param("startDate")String startDate, @Param("endDate")String endDate); |
| | | List<PlatformOnlineVO> yesterdayData(@Param("startDate")String startDate, @Param("endDate")String endDate); |
| | | |
| | | } |
| | |
| | | * @return æ°æ® |
| | | */ |
| | | List<Map<String, Object>> home(); |
| | | |
| | | |
| | | /** |
| | | * é¦é¡µæ ¸ç® |
| | | * @return æ ¸ç® |
| | | */ |
| | | List<Map<String, Object>> calculate(String category); |
| | | // /** |
| | | // * æ°å¢èæ ¸ç§¯åæç» |
| | | // * |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ååæåServiceæ¥å£ |
| | |
| | | */ |
| | | List<ContractScore> getDateRangeScoreByContractId(Long id, String startTime, String endTime); |
| | | |
| | | /** |
| | | * é¦é¡µæ ¸ç® |
| | | * @return æ ¸ç® |
| | | */ |
| | | List<Map<String, Object>> calculate(); |
| | | } |
| | |
| | | return baseMapper.home(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> calculate(String category) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | Date endDate = calendar.getTime(); |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | Date startDate = calendar.getTime(); |
| | | return scoreMapper.calculate(startDate, endDate, category); |
| | | } |
| | | |
| | | // /** |
| | | // * æ°å¢èæ ¸ç§¯å |
| | | // * |
| | |
| | | import java.io.Serializable; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | .list(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> calculate() { |
| | | return contractScoreMapper.calculate(); |
| | | } |
| | | } |
| | |
| | | import com.ycl.calculate.CalculationStrategy; |
| | | import com.ycl.factory.IndexCalculationFactory; |
| | | import com.ycl.platform.domain.result.HK.*; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.utils.DateUtils; |
| | | import constant.ApiConstants; |
| | | import constant.CalculationStrategyConstants; |
| | | import constant.CheckConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 车è¾è®¡ç®èæ ¸ææ ä»»å¡ |
| | |
| | | public class CarTask { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Autowired |
| | | private TMonitorMapper monitorMapper; |
| | | public void siteOnlineTask() { |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //计ç®ç¹ä½å¨çº¿çåè§å¾åºå¯¹æ¥ç¨³å®æ§ |
| | |
| | | calculator.calculate(results); |
| | | } |
| | | |
| | | public void test() { |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //TODOï¼ä¸æºä¸æ¡£ èç½å¡å£è®¾å¤ç®å½ä¸è´ç |
| | | public void directConsistentTask() { |
| | | //车è¾ç®å½ä¸è´ç |
| | | List<TMonitorVO> tMonitorVOS = monitorMapper.selectMonitorVOList(); |
| | | List<TMonitorVO> list = tMonitorVOS.stream().filter(tMonitorVO -> tMonitorVO.getCameraFunType().contains(CheckConstants.Rule_Category_Car + "")).collect(Collectors.toList()); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Car_DirectConsistent); |
| | | calculator.calculate(list); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ycl.calculate.CalculationStrategy; |
| | | import com.ycl.factory.IndexCalculationFactory; |
| | | import com.ycl.platform.domain.result.HK.*; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.utils.DateUtils; |
| | | import constant.ApiConstants; |
| | | import constant.CalculationStrategyConstants; |
| | | import constant.CheckConstants; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 人è¸è®¡ç®èæ ¸ææ ä»»å¡ |
| | |
| | | public class FaceTask { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | @Autowired |
| | | private TMonitorMapper monitorMapper; |
| | | |
| | | public void siteOnlineTask() { |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | |
| | | calculator.calculate(results); |
| | | } |
| | | |
| | | public void test() { |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //TODOï¼ä¸æºä¸æ¡£ èç½å¡å£è®¾å¤ç®å½ä¸è´ç |
| | | public void directConsistentTask() { |
| | | //人è¸ç®å½ä¸è´ç |
| | | List<TMonitorVO> tMonitorVOS = monitorMapper.selectMonitorVOList(); |
| | | List<TMonitorVO> list = tMonitorVOS.stream().filter(tMonitorVO -> tMonitorVO.getCameraFunType().contains(CheckConstants.Rule_Category_Face + "")).collect(Collectors.toList()); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Face_DirectConsistent); |
| | | calculator.calculate(list); |
| | | } |
| | | } |
| | |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date())) |
| | | .and("dataType").is(ApiConstants.HK_DataType_CAR)); |
| | | DeleteResult result = mongoTemplate.remove(query, SnapshotDelayMonitorParam.class); |
| | | DeleteResult result = mongoTemplate.remove(query, SnapshotDelayMonitorResult.class); |
| | | //åæ¾å¨mongoä¸ |
| | | carList.forEach(item -> item.setDataType(ApiConstants.HK_DataType_CAR)); |
| | | mongoTemplate.insertAll(carList); |
| | |
| | | faceParam.setPageSize(ApiConstants.HKPageSize); |
| | | faceParam.setDate(DateUtils.getDate()); |
| | | faceParam.setDataType(ApiConstants.HK_DataType_FACE); |
| | | List<SnapshotDelayMonitorParam> faceList = HkApiUtil.sendAPI("/api/dqd/service/rs/v1/data/snapAgingDetail/query", faceParam, SnapshotDelayMonitorParam.class); |
| | | List<SnapshotDelayMonitorResult> faceList = HkApiUtil.sendAPI("/api/dqd/service/rs/v1/data/snapAgingDetail/query", faceParam, SnapshotDelayMonitorResult.class); |
| | | |
| | | if (!CollectionUtils.isEmpty(faceList)) { |
| | | //妿ä»å¤©åå¨ä¹åçæ°æ®å
å é¤ |
| | | Query query = new Query(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date())) |
| | | .and("dataType").is(ApiConstants.HK_DataType_FACE)); |
| | | DeleteResult result = mongoTemplate.remove(query, SnapshotDelayMonitorParam.class); |
| | | DeleteResult result = mongoTemplate.remove(query, SnapshotDelayMonitorResult.class); |
| | | //åæ¾å¨mongoä¸ |
| | | carList.forEach(item -> item.setDataType(ApiConstants.HK_DataType_FACE)); |
| | | faceList.forEach(item -> item.setDataType(ApiConstants.HK_DataType_FACE)); |
| | | mongoTemplate.insertAll(faceList); |
| | | } |
| | | //TODO:å·¥å |
| | |
| | | //忥mongodb䏿ºä¸æ¡£å°æ°æ®åº |
| | | @Transactional |
| | | public void synchronize() { |
| | | Query query = new Query(Criteria.where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | // è·åCalendarå®ä¾ï¼é»è®¤ä½¿ç¨å½åæ¶åºåè¯è¨ç¯å¢ |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // æ¸
é¤Calendarä¸çææå段å¼ï¼ä»¥é¿å
å®ä»¬å¯¹å½åæ¥ææ¶é´æå½±å |
| | | calendar.clear(); |
| | | // 设置年份ãæä»½ï¼æ³¨æï¼æä»½æ¯ä»0å¼å§çï¼æä»¥8ææ¯7ï¼ãæ¥æ |
| | | calendar.set(Calendar.YEAR, 2024); |
| | | calendar.set(Calendar.MONTH, Calendar.AUGUST); |
| | | calendar.set(Calendar.DAY_OF_MONTH, 13); |
| | | // Calendar.getTime()æ¹æ³è¿åä¸ä¸ªè¡¨ç¤ºæ¤Calendaræ¶é´å¼çDate对象 |
| | | Date date = calendar.getTime(); |
| | | 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()))); |
| | | List<MonitorQualifyResult> oneMachineFileResults = mongoTemplate.find(query, MonitorQualifyResult.class); |
| | | //æ°æ®åºmonitorè¡¨æ°æ® |
| | | Map<String, TMonitorVO> monitorVOMap = monitorMapper.selectMonitorVOList().stream().collect(Collectors.toMap(TMonitorVO::getSerialNumber, Function.identity())); |
| | |
| | | List<SysDictData> DictDataList = dictDataService.selectDictDataList(sysDictData); |
| | | List<String> importantSite = DictDataList.stream().map(SysDictData::getDictValue).collect(Collectors.toList()); |
| | | |
| | | //TODO:å
¨å¹´çåè¿æ¯å次çå |
| | | //å
¨å¹´çå |
| | | for (MonitorQualifyResult result : oneMachineFileResults) { |
| | | TMonitor monitor = getMonitor(result, monitorVOMap); |
| | | YwPoint point = getPoint(result, pointMap, importantSite); |
| | |
| | | import com.ycl.platform.domain.result.UY.QueryVqdResult; |
| | | import com.ycl.platform.domain.result.UY.VideoOnlineResult; |
| | | import com.ycl.platform.domain.vo.PlatformOnlineVO; |
| | | import com.ycl.platform.domain.vo.TMonitorVO; |
| | | import com.ycl.platform.mapper.CheckIndexVideoMapper; |
| | | import com.ycl.platform.mapper.PlatformOnlineMapper; |
| | | import com.ycl.platform.mapper.TMonitorMapper; |
| | | import com.ycl.platform.service.PlatformOnlineService; |
| | | import com.ycl.system.mapper.SysDeptMapper; |
| | | import com.ycl.utils.DateUtils; |
| | |
| | | private MongoTemplate mongoTemplate; |
| | | @Autowired |
| | | private PlatformOnlineMapper platformOnlineMapper; |
| | | |
| | | @Autowired |
| | | private TMonitorMapper monitorMapper; |
| | | |
| | | public void siteOnlineTask() { |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | |
| | | |
| | | public void oneMonitorFileTask() { |
| | | //计ç®ä¸æºä¸æ¡£æ³¨åçãæ¡£æ¡èæ ¸æ¯ |
| | | |
| | | List<TMonitorVO> tMonitorVOS = monitorMapper.selectMonitorVOList(); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_Usability); |
| | | calculator.calculate(tMonitorVOS); |
| | | } |
| | | |
| | | public void oneMonitorQualifyTask(){ |
| | |
| | | } |
| | | public void platformOnlineTask() { |
| | | //计ç®å¹³å°å¨çº¿ç |
| | | List<PlatformOnlineVO> list = platformOnlineMapper.sumYesterday(DateUtils.getMouthStart(new Date()), DateUtils.getMouthEnd(new Date())); |
| | | List<PlatformOnlineVO> list = platformOnlineMapper.yesterdayData(DateUtils.getMouthStart(new Date()), DateUtils.getMouthEnd(new Date())); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_PlatformOnline); |
| | | calculator.calculate(list); |
| | | } |
| | |
| | | </select> |
| | | |
| | | <select id="home" resultType="java.util.Map"> |
| | | <![CDATA[ |
| | | SELECT |
| | | DATE_FORMAT(cs.create_time, '%Y-%m-%d %h:%i:%s') AS createTime, |
| | | d.area, |
| | |
| | | t_check_score cs |
| | | LEFT JOIN t_check_template ct ON cs.template_id = ct.id |
| | | LEFT JOIN sys_dept d ON cs.dept_id = d.dept_id |
| | | WHERE cs.score > ct.alarm_score |
| | | WHERE cs.score < ct.alarm_score |
| | | ORDER BY cs.create_time DESC |
| | | ]]> |
| | | </select> |
| | | |
| | | <select id="calculate" resultType="java.util.Map"> |
| | | SELECT |
| | | dept_name AS deptName, |
| | | ROUND(AVG(score)) AS score |
| | | FROM |
| | | t_check_score tcs |
| | | LEFT JOIN sys_dept d ON tcs.dept_id = d.dept_id |
| | | WHERE |
| | | examine_tag = 1 |
| | | AND examine_category = #{category} |
| | | AND DATE_FORMAT(tcs.create_time, '%Y-%m') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m') AND DATE_FORMAT(#{endDate}, '%Y-%m') |
| | | GROUP BY tcs.dept_id |
| | | ORDER BY score DESC, tcs.dept_id |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <select id="calculate" resultType="java.util.Map"> |
| | | SELECT |
| | | SUBSTRING_INDEX(rule_name, '/', 1) AS name, |
| | | COUNT(*) AS num, |
| | | -SUM(score) AS score |
| | | FROM t_contract_score |
| | | WHERE auditing_status = 'PASS' AND deleted = 0 |
| | | GROUP BY SUBSTRING_INDEX(rule_name, '/', 1) |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="sumYesterday" resultMap="BaseResultMap"> |
| | | <select id="yesterdayData" resultMap="BaseResultMap"> |
| | | select * from t_platform_online |
| | | where create_date between #{startDate} and #{endDate} |
| | | </select> |
| | |
| | | <select id="ywUnitCount" resultType="java.util.Map"> |
| | | SELECT |
| | | u.unit_name AS name, |
| | | COUNT(tcs.id) AS num |
| | | COUNT(tcs.id) AS num, |
| | | 100 - SUM(score) AS score |
| | | FROM |
| | | t_contract_score tcs |
| | | LEFT JOIN t_yw_unit u ON tcs.unit_id = u.id |
| | | WHERE tcs.deleted = 0 |
| | | GROUP BY tcs.unit_id |
| | | ORDER BY score DESC |
| | | </select> |
| | | </mapper> |