|
|
@ -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) { |
|
|
|