Merge remote-tracking branch 'origin/master'
| | |
| | | private String tableName; |
| | | private Long deptId; |
| | | private String date; |
| | | private Integer examineTag; |
| | | private List<String> quarter; |
| | | } |
| | |
| | | * 通道名(monitor的设备名) |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * OSD4、5都可能为名字,两条一起比对 |
| | | */ |
| | | private String name2; |
| | | //osd左下 |
| | | /** |
| | | * 固、枪、路、西北 |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ycl.platform.domain.result.BaseResult; |
| | | import lombok.Data; |
| | | import org.springframework.data.mongodb.core.annotation.Collation; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * python获取osd数据 |
| | | * 获取osd数据 |
| | | * |
| | | * @author:xp |
| | | * @date:2024/8/8 19:35 |
| | | */ |
| | | @Data |
| | | @Collation("osd_check_result") |
| | | @Document(collection = "osd_check_result") |
| | | public class OsdCheckResult extends BaseResult { |
| | | |
| | | /** |
| | |
| | | NET_TITLE_OSD_INFO[] stuOSD = title.stuOSD; |
| | | for (NET_TITLE_OSD_INFO osd : stuOSD) { |
| | | String osdStr = null; |
| | | osdStr = new String(osd.szText, StandardCharsets.UTF_8); |
| | | osdStr = new String(osd.szText, StandardCharsets.UTF_8).trim(); |
| | | if (!StringUtils.isEmpty(osdStr)) { |
| | | osdResult.setOSD4(osdStr); |
| | | } |
| | |
| | | int num = 0; |
| | | for (NET_TITLE_OSD_INFO osd : stuOSD) { |
| | | String osdStr = null; |
| | | osdStr = new String(osd.szText, StandardCharsets.UTF_8); |
| | | osdStr = new String(osd.szText, StandardCharsets.UTF_8).trim(); |
| | | if (!StringUtils.isEmpty(osdStr)) { |
| | | if(num ==0){ |
| | | osdResult.setOSD1(osdStr); |
| | |
| | | osdResult.setOSD3(osdStr); |
| | | }else if(num ==3){ |
| | | osdResult.setName(osdStr); |
| | | }else if(num ==4){ |
| | | osdResult.setName2(osdStr); |
| | | } |
| | | } |
| | | num++; |
| | |
| | | Node node = nodeList.item(i); |
| | | if (node.getNodeType() == Node.ELEMENT_NODE && "TextOverlay".equals(tagName1)) { |
| | | Element element = (Element) node; |
| | | String id = element.getElementsByTagName("id").item(0).getTextContent(); |
| | | String textContent = element.getElementsByTagName(tagName2).item(0).getTextContent(); |
| | | // log.info("TEXT : " + textContent); |
| | | if (i == 0) { |
| | | if ("1".equals(id)) { |
| | | osdResult.setOSD1(textContent); |
| | | } else if (i == 1) { |
| | | } else if ("2".equals(id)) { |
| | | osdResult.setOSD2(textContent); |
| | | } else if (i == 2) { |
| | | } else if ("3".equals(id)) { |
| | | osdResult.setOSD3(textContent); |
| | | } else if (i == 3) { |
| | | } else if ("4".equals(id)) { |
| | | osdResult.setName(textContent); |
| | | } else if (i == 4) { |
| | | } else if ("5".equals(id)) { |
| | | osdResult.setName2(textContent); |
| | | } else if ("7".equals(id)) { |
| | | osdResult.setOSD4(textContent); |
| | | } |
| | | } else if (node.getNodeType() == Node.ELEMENT_NODE && "Time".equals(tagName1)) { |
| | |
| | | //区域车辆点位在线指标的内部类 |
| | | private static class AreaStats { |
| | | int totalCount = 0; |
| | | int delayCount = 0; |
| | | //0-180s |
| | | int delayCount1 = 0; |
| | | //180-300s |
| | |
| | | //返回对象的引用,如果不存在会放入新的key,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalCount += result.getDataCount(); |
| | | stats.delayCount += result.getDelayCount(); |
| | | stats.delayCount1 += result.getDataDelayCount1(); |
| | | stats.delayCount2 += result.getDataDelayCount2(); |
| | | stats.delayCount3 += result.getDataDelayCount3(); |
| | |
| | | //调用抓拍上传及时性计算方法 |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("totalCount", stats.totalCount); |
| | | param.put("delayCount", stats.delayCount); |
| | | param.put("delayCount1", stats.delayCount1); |
| | | param.put("delayCount2", stats.delayCount2); |
| | | param.put("delayCount3", stats.delayCount3); |
| | |
| | | //区域人脸数据上传延迟指标的内部类 |
| | | private static class AreaStats { |
| | | int totalCount = 0; |
| | | int delayCount = 0; |
| | | //0-180s |
| | | int delayCount1 = 0; |
| | | //180-300s |
| | |
| | | //返回对象的引用,如果不存在会放入新的key,value |
| | | AreaStats stats = areaStatsMap.computeIfAbsent(key, k -> new AreaStats()); |
| | | stats.totalCount += result.getDataCount(); |
| | | stats.delayCount += result.getDelayCount(); |
| | | stats.delayCount1 += result.getDataDelayCount1(); |
| | | stats.delayCount2 += result.getDataDelayCount2(); |
| | | stats.delayCount3 += result.getDataDelayCount3(); |
| | |
| | | //调用抓拍上传及时性计算方法 |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("totalCount", stats.totalCount); |
| | | param.put("delayCount", stats.delayCount); |
| | | param.put("delayCount1", stats.delayCount1); |
| | | param.put("delayCount2", stats.delayCount2); |
| | | param.put("delayCount3", stats.delayCount3); |
| | |
| | | //数据上传及时性 |
| | | public BigDecimal snapshopDelay(Map<String, Object> param) { |
| | | BigDecimal totalCount = new BigDecimal((Integer) param.get("totalCount")); |
| | | BigDecimal delayCount = new BigDecimal((Integer) param.get("delayCount")); |
| | | BigDecimal delayCount1 = new BigDecimal((Integer) param.get("delayCount1")); |
| | | BigDecimal delayCount2 = new BigDecimal((Integer) param.get("delayCount2")); |
| | | BigDecimal delayCount3 = new BigDecimal((Integer) param.get("delayCount3")); |
| | | BigDecimal result = BigDecimal.ZERO.compareTo(totalCount) == 0 ? BigDecimal.ZERO : delayCount1.divide(totalCount, 10, RoundingMode.HALF_UP).multiply(BigDecimal.ONE) |
| | | .add(delayCount2.divide(totalCount, 10, RoundingMode.HALF_UP).multiply(new BigDecimal("0.8"))) |
| | | .add(delayCount3.divide(totalCount, 10, RoundingMode.HALF_UP).multiply(new BigDecimal("0.6"))); |
| | | BigDecimal result = BigDecimal.ZERO.compareTo(totalCount) == 0 ? BigDecimal.ZERO : |
| | | totalCount.subtract(delayCount).divide(totalCount, 10, RoundingMode.HALF_UP).multiply(BigDecimal.ONE) |
| | | .add(delayCount1.divide(totalCount, 10, RoundingMode.HALF_UP).multiply(BigDecimal.ONE)) |
| | | .add(delayCount2.divide(totalCount, 10, RoundingMode.HALF_UP).multiply(new BigDecimal("0.8"))) |
| | | .add(delayCount3.divide(totalCount, 10, RoundingMode.HALF_UP).multiply(new BigDecimal("0.6"))); |
| | | return result.setScale(4, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | |
| | | //区域视频在线率的内部类 |
| | | private static class AreaStats { |
| | | int totalSites = 0; |
| | | |
| | | int importantTotalSites = 0; |
| | | int importantOsdAccuracySites = 0; |
| | | int importantTimeAccuracySites = 0; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.glassfish.jaxb.core.v2.TODO; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | .setDate(checkScoreIndexDTO.getDate()) |
| | | .setQuarter(checkScoreIndexDTO.getQuarter()); |
| | | scoreIndexDTO.setParams(checkScoreIndexDTO.getParams()); |
| | | |
| | | scoreIndexDTO.setExamineTag(checkScore.getExamineTag()); |
| | | //获当月份 |
| | | if(StringUtils.isEmpty(scoreIndexDTO.getDate()) && CollectionUtils.isEmpty(checkScoreIndexDTO.getQuarter())){ |
| | | //如果查询条件不含参数,查询积分对应创建时间 |
| | |
| | | @Override |
| | | public void exportIndex(HttpServletResponse response,CheckScore checkScoreDTO) throws IOException { |
| | | String date = checkScoreDTO.getDate(); |
| | | Integer examineTag = null; |
| | | //如果请求参数时间为空,查这条记录的时间 |
| | | if(StringUtils.isEmpty(checkScoreDTO.getDate()) && CollectionUtils.isEmpty(checkScoreDTO.getQuarter())){ |
| | | CheckScore checkScore = getById(checkScoreDTO.getId()); |
| | | Date createTime = checkScore.getCreateTime(); |
| | | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM"); |
| | | date = formatter.format(createTime); |
| | | examineTag = checkScore.getExamineTag(); |
| | | } |
| | | |
| | | /** 导三张sheet */ |
| | |
| | | CheckIndexCar checkIndexCar = new CheckIndexCar(); |
| | | checkIndexCar.setDate(date); |
| | | checkIndexCar.setQuarter(checkScoreDTO.getQuarter()); |
| | | if(examineTag!=null) { |
| | | checkIndexCar.setExamineTag(Short.parseShort(examineTag + "")); |
| | | } |
| | | List<CheckIndexCar> checkIndexCars = indexCarService.selectCheckIndexCarList(checkIndexCar); |
| | | ExcelExp e1 = new ExcelExp("车辆考核指标数据",checkIndexCars,CheckIndexCar.class); |
| | | //人脸 |
| | | CheckIndexFace checkIndexFace = new CheckIndexFace(); |
| | | checkIndexFace.setDate(date); |
| | | checkIndexFace.setQuarter(checkScoreDTO.getQuarter()); |
| | | if(examineTag!=null) { |
| | | checkIndexFace.setExamineTag(Short.parseShort(examineTag + "")); |
| | | } |
| | | List<CheckIndexFace> checkIndexFaces = indexFaceService.selectCheckIndexFaceList(checkIndexFace); |
| | | ExcelExp e2 = new ExcelExp("人脸考核指标数据",checkIndexFaces,CheckIndexFace.class); |
| | | //视频 |
| | | CheckIndexVideo checkIndexVideo = new CheckIndexVideo(); |
| | | checkIndexVideo.setDate(date); |
| | | checkIndexVideo.setQuarter(checkScoreDTO.getQuarter()); |
| | | if(examineTag!=null) { |
| | | checkIndexVideo.setExamineTag(Short.parseShort(examineTag + "")); |
| | | } |
| | | List<CheckIndexVideo> checkIndexVideos = indexVideoService.selectCheckIndexVideoList(checkIndexVideo); |
| | | ExcelExp e3 = new ExcelExp("视频考核指标数据",checkIndexVideos,CheckIndexVideo.class); |
| | | |
| | |
| | | ); |
| | | List<TMonitor> monitors = monitorMapper.selectByNumbers(serialNumbers); |
| | | monitors = monitors.stream().filter(monitor -> !StringUtils.isEmpty(monitor.getIp()) && !"127.0.0.1".equals(monitor.getIp())).collect(Collectors.toList()); |
| | | log.info("处理数据大小{}", monitors.size()); |
| | | // log.info("处理数据大小{}", monitors.size()); |
| | | for (TMonitor monitor : monitors) { |
| | | executorService.submit(() -> { |
| | | if (DeviceType.HK.getType().equals(monitor.getDeviceType())) { |
| | |
| | | //封装OsdCheckResult |
| | | OsdCheckResult osdCheckResult = getOsdCheckResult(osdResult, monitor); |
| | | checkCorrect(osdResult, monitor, osdCheckResult); |
| | | log.info("校验结果:{}",osdCheckResult); |
| | | checkResults.add(osdCheckResult); |
| | | } |
| | | log.info("结果数据大小:{}", checkResults.size()); |
| | |
| | | } |
| | | } |
| | | //检查通道名是否正确 |
| | | //TODO:校验规则,这里暂时不比较全景和细节两字。 |
| | | if (!StringUtils.isEmpty(osdResult.getName()) && !StringUtils.isEmpty(monitor.getName())) { |
| | | if (monitor.getName().equals(osdResult.getName())) { |
| | | if (monitor.getName().equals(osdResult.getName()) || monitor.getName().replace("全景","细节").equals(osdResult.getName()) || monitor.getName().replace("细节","全景").equals(osdResult.getName())) { |
| | | //OSD4和5都可能为名字、比较其中一条正确即可,正确了改为正确名字 |
| | | osdCheckResult.setOsdNameCorrect(ApiConstants.OSD_Correct); |
| | | } else { |
| | | osdCheckResult.setOsdName(osdResult.getName()); |
| | | }else if (monitor.getName().equals(osdResult.getName2()) || monitor.getName().replace("全景","细节").equals(osdResult.getName2()) || monitor.getName().replace("细节","全景").equals(osdResult.getName2())) { |
| | | //OSD4和5都可能为名字、比较其中一条正确即可,正确了改为正确名字 |
| | | osdCheckResult.setOsdName(osdResult.getName2()); |
| | | osdCheckResult.setOsdNameCorrect(ApiConstants.OSD_Correct); |
| | | }else { |
| | | osdCheckResult.setOsdNameCorrect(ApiConstants.OSD_Error); |
| | | } |
| | | } |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | private static final BigDecimal NUM = new BigDecimal("0.15"); |
| | | |
| | | public void siteOnlineTask() { |
| | | log.info("开始计算点位在线率"); |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //计算点位在线率和重点点位在线率和指挥图像在线率 |
| | | Query query = new Query(); |
| | |
| | | List<VideoOnlineResult> results = mongoTemplate.find(query, VideoOnlineResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_SiteOnline); |
| | | calculator.calculate(results); |
| | | log.info("结束计算点位在线率"); |
| | | } |
| | | |
| | | public void videoUsabilityTask() { |
| | | log.info("开始计算录像可用率和重点录像可用率"); |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | //计算录像可用率和重点录像可用率 |
| | | Query query = new Query(); |
| | |
| | | List<RecordMetaDSumResult> results = mongoTemplate.find(query, RecordMetaDSumResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_Usability); |
| | | calculator.calculate(results); |
| | | log.info("结束计算录像可用率和重点录像可用率"); |
| | | } |
| | | |
| | | public void oneMonitorFileTask() { |
| | | log.info("开始计算一机一档注册率、档案考核比"); |
| | | //计算一机一档注册率、档案考核比 |
| | | List<TMonitorVO> tMonitorVOS = monitorMapper.selectMonitorVOList(); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_MonitorRegis_ArchiveRate); |
| | | calculator.calculate(tMonitorVOS); |
| | | log.info("结束计算一机一档注册率、档案考核比"); |
| | | } |
| | | public void oneMonitorQualifyTask(){ |
| | | log.info("开始计算一机一档合格率"); |
| | | //计算一机一档合格率 |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | Query query = new Query(); |
| | |
| | | List<MonitorQualifyResult> results = mongoTemplate.find(query, MonitorQualifyResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_MonitorQualify); |
| | | calculator.calculate(results); |
| | | log.info("结束计算一机一档合格率"); |
| | | } |
| | | public void platformOnlineTask() { |
| | | log.info("开始计算平台在线率"); |
| | | //计算平台在线率 |
| | | List<PlatformOnlineVO> list = platformOnlineMapper.yesterdayData(DateUtils.getMouthStart(new Date()), DateUtils.getMouthEnd(new Date())); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_PlatformOnline); |
| | | calculator.calculate(list); |
| | | log.info("结束计算平台在线率"); |
| | | } |
| | | public void osdTask() { |
| | | log.info("开始计算Osd标注、时间准确率"); |
| | | //计算Osd标注、时间准确率 |
| | | Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | // Date yesterday = DateUtils.addDays(new Date(), -1); |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(yesterday)).lt(DateUtils.getDayEnd(yesterday))); |
| | | .where("mongoCreateTime").gte(DateUtils.getDayStart(new Date())).lt(DateUtils.getDayEnd(new Date()))); |
| | | List<OsdCheckResult> results = mongoTemplate.find(query, OsdCheckResult.class); |
| | | CalculationStrategy calculator = IndexCalculationFactory.getCalculator(CalculationStrategyConstants.Video_OsdTime); |
| | | calculator.calculate(results); |
| | | log.info("结束计算Osd标注、时间准确率"); |
| | | } |
| | | |
| | | /** |
| | |
| | | count++; |
| | | } |
| | | } |
| | | imageResourceSecurity.setWeakPassword(BigDecimal.valueOf(score)); |
| | | imageResourceSecurity.setWeakPassword(BigDecimal.valueOf(score).divide(new BigDecimal(100),4, RoundingMode.HALF_UP)); |
| | | // 获取字典值-总数 |
| | | int onlineAssetsTotal = Integer.parseInt(DictUtils.getDictValue("online_assets_total", checkIndexVideo.getDeptName())); |
| | | imageResourceSecurity.setRiskProperty(BigDecimal.valueOf(count / onlineAssetsTotal)); |
| | |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | |
| | | <!-- 系统日志输出 --> |
| | | <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-info.log</file> |
| | |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | |
| | | <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-error.log</file> |
| | | <!-- 循环政策:基于时间创建日志文件 --> |
| | |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | |
| | | <!-- 用户访问日志输出 --> |
| | | <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.path}/sys-user.log</file> |
| | |
| | | <pattern>${log.pattern}</pattern> |
| | | </encoder> |
| | | </appender> |
| | | |
| | | |
| | | <!-- 系统模块日志级别控制 --> |
| | | <logger name="com.ycl" level="info" /> |
| | | <!-- Spring日志级别控制 --> |
| | |
| | | <root level="info"> |
| | | <appender-ref ref="console" /> |
| | | </root> |
| | | |
| | | <!-- 设置 Spring Security 的日志级别为 DEBUG --> |
| | | <logger name="org.springframework.security" level="DEBUG"/> |
| | | |
| | | <!--系统操作日志--> |
| | | <root level="info"> |
| | | <appender-ref ref="file_info" /> |
| | | <appender-ref ref="file_error" /> |
| | | </root> |
| | | |
| | | |
| | | <!--系统用户操作日志--> |
| | | <logger name="sys-user" level="info"> |
| | | <appender-ref ref="sys-user"/> |
| | | </logger> |
| | | </configuration> |
| | | </configuration> |
| | |
| | | <if test="deptId != null "> and tcs.dept_id = #{deptId}</if> |
| | | ${params.dataScope} |
| | | </where> |
| | | order by create_time desc; |
| | | order by create_time desc |
| | | </select> |
| | | |
| | | <select id="selectCheckScoreById" parameterType="Long" resultMap="CheckScoreResult"> |
| | |
| | | select t.* from ${tableName} t |
| | | left join sys_dept d on t.dept_id = d.dept_id |
| | | where t.dept_id = #{deptId} |
| | | <if test="examineTag != null"> |
| | | and examine_tag = #{examineTag} |
| | | </if> |
| | | <if test="date != null"> |
| | | and date_format(t.create_time,'%Y-%m') = #{date} |
| | | </if> |