feat(video-review): 支持机位多维度评价功能
All checks were successful
ZhenTu-BE/pipeline/head This commit looks good

- 新增NestedMapTypeHandler处理嵌套Map与JSON互转
- 修改VideoReview相关实体类和DTO以支持嵌套Map结构
- 更新数据库查询逻辑以适配新的评价数据结构
- 优化平均分计算方法以处理多机位多维度评分
- 完善MyBatis配置中的typeHandler引用
- 补充视频查询接口返回任务开始结束时间字段
- 修正SQL关联查询条件确保数据准确性
This commit is contained in:
2025-11-18 10:14:42 +08:00
parent 3d361200b0
commit bb2367c5a6
9 changed files with 118 additions and 28 deletions

View File

@@ -218,7 +218,7 @@ public class VideoReviewServiceImpl implements VideoReviewService {
* 计算机位评价各维度的平均值
*/
private Map<String, BigDecimal> calculateCameraPositionAverage() {
List<Map<String, Integer>> allRatings = videoReviewMapper.selectAllCameraPositionRatings();
List<Map<String, Map<String, Integer>>> allRatings = videoReviewMapper.selectAllCameraPositionRatings();
if (allRatings == null || allRatings.isEmpty()) {
return new HashMap<>();
@@ -226,10 +226,15 @@ public class VideoReviewServiceImpl implements VideoReviewService {
// 统计各维度的总分和次数
Map<String, List<Integer>> dimensionScores = new HashMap<>();
for (Map<String, Integer> rating : allRatings) {
for (Map<String, Map<String, Integer>> rating : allRatings) {
if (rating == null) continue;
for (Map.Entry<String, Integer> entry : rating.entrySet()) {
dimensionScores.computeIfAbsent(entry.getKey(), k -> new ArrayList<>()).add(entry.getValue());
// 遍历每个机位
for (Map<String, Integer> deviceRatings : rating.values()) {
if (deviceRatings == null) continue;
// 遍历该机位的每个维度
for (Map.Entry<String, Integer> entry : deviceRatings.entrySet()) {
dimensionScores.computeIfAbsent(entry.getKey(), k -> new ArrayList<>()).add(entry.getValue());
}
}
}