From 2baabad0921625a2e001255a320b66186429ccb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Thu, 5 Dec 2024 14:49:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=AE=A1=E6=A0=B8=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/views/videoReview/index.vue | 1002 +++++++++++++++++ .../controller/DcWarningController.java | 7 + .../zc/business/mapper/DcWarningMapper.java | 3 + .../business/service/IDcWarningService.java | 2 + .../service/impl/DcWarningServiceImpl.java | 106 ++ .../mapper/business/DcWarningMapper.xml | 42 +- 6 files changed, 1151 insertions(+), 11 deletions(-) create mode 100644 ruoyi-ui/src/views/videoReview/index.vue diff --git a/ruoyi-ui/src/views/videoReview/index.vue b/ruoyi-ui/src/views/videoReview/index.vue new file mode 100644 index 00000000..069a5b1c --- /dev/null +++ b/ruoyi-ui/src/views/videoReview/index.vue @@ -0,0 +1,1002 @@ + + + + + diff --git a/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java b/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java index c910fde3..e5cc6ff5 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java @@ -115,6 +115,13 @@ public class DcWarningController extends BaseController public AjaxResult videoReviewEventTime(DcWarning dcWarning) { return AjaxResult.success(dcWarningService.videoReviewEventTime(dcWarning)) ; + } @ApiOperation("查询视频审核事件时间列表") + // @PreAuthorize("@ss.hasPermi('business:warning:list')") + @GetMapping("/videoReviewEventTimeList") + public TableDataInfo videoReviewEventTimeList(DcWarning dcWarning) + { + startPage(); + return getDataTable(dcWarningService.videoReviewEventTimeList(dcWarning)) ; } /** * 导出预警信息列表 diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java index 0a9f2afb..04dbcb95 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java @@ -171,4 +171,7 @@ public interface DcWarningMapper List selectVideoEventList(DcWarning dcWarning); List selectVideoReviewEventTimeList(DcWarning dcWarning); + + List videoReviewEventTimeList(DcWarning dcWarning); + } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java b/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java index c20ed8d1..0ed7c59e 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java @@ -127,4 +127,6 @@ Map selectVideoReviewSectionDistribution(DcWarning dcWarning); List videoReviewEventSourceList(DcWarning dcWarning); Map videoReviewEventTime(DcWarning dcWarning); + + List videoReviewEventTimeList(DcWarning dcWarning); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java index d56bb1cc..223f7672 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java @@ -1573,14 +1573,120 @@ public class DcWarningServiceImpl implements IDcWarningService { //时间分布 @Override public Map videoReviewEventTime(DcWarning dcWarning) { + // 获取不同类型审核标记的数据 dcWarning.setAuditFlag(UniversalEnum.ONE.getNumber()); List dcWarningsOne = dcWarningMapper.selectVideoReviewEventTimeList(dcWarning); + dcWarning.setAuditFlag(UniversalEnum.TWO.getNumber()); List dcWarningsTwo = dcWarningMapper.selectVideoReviewEventTimeList(dcWarning); + if (dcWarning.getType().equals("1")) { // 查月份 + return groupByMonth(dcWarningsOne, dcWarningsTwo); + } else if (dcWarning.getType().equals("2")) { // 查天 + + + return groupByData(dcWarningsOne, dcWarningsTwo); + } + return null; } + @Override + public List videoReviewEventTimeList(DcWarning dcWarning) { + List dcWarningList = dcWarningMapper.videoReviewEventTimeList(dcWarning); + return dcWarningList; + } + + private Map groupByMonth(List dcWarningsOne, List dcWarningsTwo) { + // 分别对两个列表按月份分组 + Map eventOneMonthly = groupByMonthAndCount(dcWarningsOne); + Map eventTwoMonthly = groupByMonthAndCount(dcWarningsTwo); + + // 转换为百分比 + Map eventOnePercents = convertToPercentage(eventOneMonthly, eventTwoMonthly); + Map eventTwoPercents = convertToPercentage(eventTwoMonthly, eventOneMonthly); + + // 提取所有的 key 并排序 + Set allKeys = new TreeSet<>(); + allKeys.addAll(eventOneMonthly.keySet()); + allKeys.addAll(eventTwoMonthly.keySet()); + + // 使用 LinkedHashMap 来保持插入顺序 + Map finalData = new LinkedHashMap<>(); + + for (String key : allKeys) { + Map segmentData = new HashMap<>(); + segmentData.put("AuditFlag1_Count", eventOneMonthly.getOrDefault(key, 0)); + segmentData.put("AuditFlag2_Count", eventTwoMonthly.getOrDefault(key, 0)); + segmentData.put("AuditFlag1_Percentage", eventOnePercents.getOrDefault(key, "0%")); + segmentData.put("AuditFlag2_Percentage", eventTwoPercents.getOrDefault(key, "0%")); + + finalData.put(key, segmentData); + } + + return finalData; + } + private Map groupByData(List dcWarningsOne, List dcWarningsTwo) { + // 分别对两个列表按月份分组 + Map eventOneMonthly = groupByDataAndCount(dcWarningsOne); + Map eventTwoMonthly = groupByDataAndCount(dcWarningsTwo); + + // 转换为百分比 + Map eventOnePercents = convertToPercentage(eventOneMonthly, eventTwoMonthly); + Map eventTwoPercents = convertToPercentage(eventTwoMonthly, eventOneMonthly); + + // 提取所有的 key 并排序 + Set allKeys = new TreeSet<>(); + allKeys.addAll(eventOneMonthly.keySet()); + allKeys.addAll(eventTwoMonthly.keySet()); + + // 保持插入顺序 + Map finalData = new LinkedHashMap<>(); + + for (String key : allKeys) { + Map segmentData = new HashMap<>(); + segmentData.put("AuditFlag1_Count", eventOneMonthly.getOrDefault(key, 0)); + segmentData.put("AuditFlag2_Count", eventTwoMonthly.getOrDefault(key, 0)); + segmentData.put("AuditFlag1_Percentage", eventOnePercents.getOrDefault(key, "0%")); + segmentData.put("AuditFlag2_Percentage", eventTwoPercents.getOrDefault(key, "0%")); + + finalData.put(key, segmentData); + } + + return finalData; + } + private Map groupByMonthAndCount(List dcWarnings) { + Map monthlyCounts = new HashMap<>(); + for (DcWarning warning : dcWarnings) { + String monthKey = extractYearMonth(warning); // 提取年份和月份作为键 + monthlyCounts.merge(monthKey, 1, Integer::sum); + } + return monthlyCounts; + } + private Map groupByDataAndCount(List dcWarnings) { + Map monthlyCounts = new HashMap<>(); + for (DcWarning warning : dcWarnings) { + String monthKey = extractYearData(warning); // 提取年份和月份作为键 + monthlyCounts.merge(monthKey, 1, Integer::sum); + } + return monthlyCounts; + } + private String extractYearMonth(DcWarning warning) { + // 假设 DcWarning 有一个 getDate() 方法返回 java.util.Date 或 java.time.LocalDate + // 根据实际情况调整此方法 + if (warning.getAuditTime() != null) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); + return sdf.format(warning.getAuditTime()); + } + return ""; + } private String extractYearData(DcWarning warning) { + if (warning.getAuditTime() != null) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + return sdf.format(warning.getAuditTime()); + } + return ""; + } + public Map stakeMarkCount(List dcWarnings){ Map groupCountMap = new HashMap<>(); for (DcWarning dcWarning : dcWarnings) { diff --git a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml index 2ae5d6f6..9cf63136 100644 --- a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml @@ -472,7 +472,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select id, stake_mark, warning_type, warning_subclass, audit_flag,warning_source from dc_warning - and stake_mark BETWEEN #{stakeMark} and #{endStakeMark} + and stake_mark BETWEEN #{startStakeMark} and #{endStakeMark} and direction = #{direction} and dept_id = #{deptId} and warning_state = #{warningState} @@ -515,9 +515,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and warning_level = #{warningLevel} and warning_type = #{warningType} and warning_subclass = #{warningSubclass} - and warning_title = #{warningTitle} - and other_config = #{otherConfig} - and lane = #{lane} and date_format(audit_time, '%Y-%m-%d') >= #{startDate} and date_format(audit_time,'%Y-%m-%d') <= #{endDate} @@ -527,13 +524,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select id, stake_mark, warning_type, warning_subclass, audit_flag,warning_source,audit_time from dc_warning - (audit_flag = '1' OR audit_flag = '2') and stake_mark BETWEEN #{startStakeMark} and #{endStakeMark} and direction = #{direction} and dept_id = #{deptId} and warning_state = #{warningState} and warning_time = #{warningTime} - and user_id = #{userId} and warning_source in @@ -543,15 +538,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and warning_level = #{warningLevel} and warning_type = #{warningType} and warning_subclass = #{warningSubclass} - and warning_title = #{warningTitle} - and other_config = #{otherConfig} - and lane = #{lane} + and audit_flag = #{auditFlag} + + and YEAR(audit_time) = #{startDate} + + + and DATE_FORMAT(audit_time, '%Y-%m') = #{startDate} + + + +