Browse Source

视频审核统计

develop
王兴琳 4 months ago
parent
commit
2baabad092
  1. 1002
      ruoyi-ui/src/views/videoReview/index.vue
  2. 7
      zc-business/src/main/java/com/zc/business/controller/DcWarningController.java
  3. 3
      zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java
  4. 2
      zc-business/src/main/java/com/zc/business/service/IDcWarningService.java
  5. 106
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java
  6. 42
      zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

1002
ruoyi-ui/src/views/videoReview/index.vue

File diff suppressed because it is too large

7
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)) ;
}
/**
* 导出预警信息列表

3
zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java

@ -171,4 +171,7 @@ public interface DcWarningMapper
List<DcWarning> selectVideoEventList(DcWarning dcWarning);
List<DcWarning> selectVideoReviewEventTimeList(DcWarning dcWarning);
List<DcWarning> videoReviewEventTimeList(DcWarning dcWarning);
}

2
zc-business/src/main/java/com/zc/business/service/IDcWarningService.java

@ -127,4 +127,6 @@ Map<String,Object> selectVideoReviewSectionDistribution(DcWarning dcWarning);
List<DcWarning> videoReviewEventSourceList(DcWarning dcWarning);
Map<String,Object> videoReviewEventTime(DcWarning dcWarning);
List<DcWarning> videoReviewEventTimeList(DcWarning dcWarning);
}

106
zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

@ -1573,14 +1573,120 @@ public class DcWarningServiceImpl implements IDcWarningService {
//时间分布
@Override
public Map<String, Object> videoReviewEventTime(DcWarning dcWarning) {
// 获取不同类型审核标记的数据
dcWarning.setAuditFlag(UniversalEnum.ONE.getNumber());
List<DcWarning> dcWarningsOne = dcWarningMapper.selectVideoReviewEventTimeList(dcWarning);
dcWarning.setAuditFlag(UniversalEnum.TWO.getNumber());
List<DcWarning> 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<DcWarning> videoReviewEventTimeList(DcWarning dcWarning) {
List<DcWarning> dcWarningList = dcWarningMapper.videoReviewEventTimeList(dcWarning);
return dcWarningList;
}
private Map<String, Object> groupByMonth(List<DcWarning> dcWarningsOne, List<DcWarning> dcWarningsTwo) {
// 分别对两个列表按月份分组
Map<String, Integer> eventOneMonthly = groupByMonthAndCount(dcWarningsOne);
Map<String, Integer> eventTwoMonthly = groupByMonthAndCount(dcWarningsTwo);
// 转换为百分比
Map<String, String> eventOnePercents = convertToPercentage(eventOneMonthly, eventTwoMonthly);
Map<String, String> eventTwoPercents = convertToPercentage(eventTwoMonthly, eventOneMonthly);
// 提取所有的 key 并排序
Set<String> allKeys = new TreeSet<>();
allKeys.addAll(eventOneMonthly.keySet());
allKeys.addAll(eventTwoMonthly.keySet());
// 使用 LinkedHashMap 来保持插入顺序
Map<String, Object> finalData = new LinkedHashMap<>();
for (String key : allKeys) {
Map<String, Object> 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<String, Object> groupByData(List<DcWarning> dcWarningsOne, List<DcWarning> dcWarningsTwo) {
// 分别对两个列表按月份分组
Map<String, Integer> eventOneMonthly = groupByDataAndCount(dcWarningsOne);
Map<String, Integer> eventTwoMonthly = groupByDataAndCount(dcWarningsTwo);
// 转换为百分比
Map<String, String> eventOnePercents = convertToPercentage(eventOneMonthly, eventTwoMonthly);
Map<String, String> eventTwoPercents = convertToPercentage(eventTwoMonthly, eventOneMonthly);
// 提取所有的 key 并排序
Set<String> allKeys = new TreeSet<>();
allKeys.addAll(eventOneMonthly.keySet());
allKeys.addAll(eventTwoMonthly.keySet());
// 保持插入顺序
Map<String, Object> finalData = new LinkedHashMap<>();
for (String key : allKeys) {
Map<String, Object> 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<String, Integer> groupByMonthAndCount(List<DcWarning> dcWarnings) {
Map<String, Integer> monthlyCounts = new HashMap<>();
for (DcWarning warning : dcWarnings) {
String monthKey = extractYearMonth(warning); // 提取年份和月份作为键
monthlyCounts.merge(monthKey, 1, Integer::sum);
}
return monthlyCounts;
}
private Map<String, Integer> groupByDataAndCount(List<DcWarning> dcWarnings) {
Map<String, Integer> 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<String, Integer> stakeMarkCount(List<DcWarning> dcWarnings){
Map<String, Integer> groupCountMap = new HashMap<>();
for (DcWarning dcWarning : dcWarnings) {

42
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
<where>
<if test="stakeMark != null and stakeMark != ''"> and stake_mark BETWEEN #{stakeMark} and #{endStakeMark}</if>
<if test="startStakeMark != null and startStakeMark != ''"> and stake_mark BETWEEN #{startStakeMark} and #{endStakeMark}</if>
<if test="direction != null and direction != ''"> and direction = #{direction}</if>
<if test="deptId != null"> and dept_id = #{deptId}</if>
<if test="warningState != null"> and warning_state = #{warningState}</if>
@ -515,9 +515,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warningLevel != null"> and warning_level = #{warningLevel}</if>
<if test="warningType != null"> and warning_type = #{warningType}</if>
<if test="warningSubclass != null and warningSubclass != ''"> and warning_subclass = #{warningSubclass}</if>
<if test="warningTitle != null and warningTitle != ''"> and warning_title = #{warningTitle}</if>
<if test="otherConfig != null and otherConfig != ''"> and other_config = #{otherConfig}</if>
<if test="lane != null and lane != ''"> and lane = #{lane}</if>
<if test="startDate != null and startDate != ''"> and date_format(audit_time, '%Y-%m-%d') >= #{startDate}</if>
<if test="endDate != null and endDate != ''"> and date_format(audit_time,'%Y-%m-%d') &lt;= #{endDate}</if>
@ -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
<where>
(audit_flag = '1' OR audit_flag = '2')
<if test="startStakeMark != null and startStakeMark != ''"> and stake_mark BETWEEN #{startStakeMark} and #{endStakeMark}</if>
<if test="direction != null and direction != ''"> and direction = #{direction}</if>
<if test="deptId != null"> and dept_id = #{deptId}</if>
<if test="warningState != null"> and warning_state = #{warningState}</if>
<if test="warningTime != null"> and warning_time = #{warningTime}</if>
<if test="userId != null"> and user_id = #{userId}</if>
<if test="warningSourceArray != null and warningSourceArray.length > 0">
and warning_source in
<foreach item="item" index="index" collection="warningSourceArray" open="(" separator="," close=")">
@ -543,15 +538,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warningLevel != null"> and warning_level = #{warningLevel}</if>
<if test="warningType != null"> and warning_type = #{warningType}</if>
<if test="warningSubclass != null and warningSubclass != ''"> and warning_subclass = #{warningSubclass}</if>
<if test="warningTitle != null and warningTitle != ''"> and warning_title = #{warningTitle}</if>
<if test="otherConfig != null and otherConfig != ''"> and other_config = #{otherConfig}</if>
<if test="lane != null and lane != ''"> and lane = #{lane}</if>
<if test="auditFlag != null and auditFlag != ''"> and audit_flag = #{auditFlag}</if>
<if test="type == 1">
and YEAR(audit_time) = #{startDate}
</if>
<if test="type == 2">
and DATE_FORMAT(audit_time, '%Y-%m') = #{startDate}
</if>
</where>
</select>
<select id="videoReviewEventTimeList" resultMap="DcWarningResult" parameterType="com.zc.business.domain.DcWarning">
select id, stake_mark, warning_type, warning_subclass, audit_flag,warning_source,audit_time
from dc_warning
<where>
(audit_flag = '1' OR audit_flag = '2')
<if test="startStakeMark != null and startStakeMark != ''"> and stake_mark BETWEEN #{startStakeMark} and #{endStakeMark}</if>
<if test="direction != null and direction != ''"> and direction = #{direction}</if>
<if test="deptId != null"> and dept_id = #{deptId}</if>
<if test="warningState != null"> and warning_state = #{warningState}</if>
<if test="warningTime != null"> and warning_time = #{warningTime}</if>
<if test="warningSourceArray != null and warningSourceArray.length > 0">
and warning_source in
<foreach item="item" index="index" collection="warningSourceArray" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="warningLevel != null"> and warning_level = #{warningLevel}</if>
<if test="warningType != null"> and warning_type = #{warningType}</if>
<if test="warningSubclass != null and warningSubclass != ''"> and warning_subclass = #{warningSubclass}</if>
<if test="type == 1">
YEAR(dg.statistical_date) = #{startDate}
and YEAR(audit_time) = #{startDate}
</if>
<if test="type == 2">
DATE_FORMAT(dg.statistical_date, '%Y-%m') = #{startDate}
and DATE_FORMAT(audit_time, '%Y-%m') = #{startDate}
</if>
</where>

Loading…
Cancel
Save