feat(video): 完善视频评价功能,增加问题机位和标签管理

- 新增VideoReviewSourceEnum枚举,定义评价来源类型(订单、渲染)
- 添加LongListTypeHandler和StringListTypeHandler,处理数据库JSON字段与Java列表转换
- 修改VideoReviewEntity实体类,将机位评价改为问题机位ID列表和问题标签列表
- 创建AdminVideoReviewLogReqDTO和AdminVideoReviewLogRespDTO,实现管理后台评价日志查询
- 在VideoReviewController中增加管理后台分页查询评价日志接口
- 更新视频评价添加逻辑,验证来源参数并记录问题机位和标签信息
- 修改
This commit is contained in:
2026-01-27 21:28:33 +08:00
parent 1c0a506238
commit 93744510ec
15 changed files with 826 additions and 112 deletions

View File

@@ -15,8 +15,12 @@
<result property="creatorName" column="creator_name"/>
<result property="rating" column="rating"/>
<result property="content" column="content"/>
<result property="cameraPositionRating" column="camera_position_rating"
typeHandler="com.ycwl.basic.handler.MapTypeHandler"/>
<result property="problemDeviceIds" column="problem_device_ids"
typeHandler="com.ycwl.basic.handler.LongListTypeHandler"/>
<result property="problemTags" column="problem_tags"
typeHandler="com.ycwl.basic.handler.StringListTypeHandler"/>
<result property="source" column="source"/>
<result property="sourceId" column="source_id"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
@@ -31,7 +35,10 @@
vr.creator,
vr.rating,
vr.content,
vr.camera_position_rating,
vr.problem_device_ids,
vr.problem_tags,
vr.source,
vr.source_id,
vr.create_time,
vr.update_time,
v.video_url,
@@ -72,6 +79,15 @@
<if test="keyword != null and keyword != ''">
AND vr.content LIKE CONCAT('%', #{keyword}, '%')
</if>
<if test="problemDeviceId != null">
AND JSON_CONTAINS(vr.problem_device_ids, CAST(#{problemDeviceId} AS CHAR), '$')
</if>
<if test="problemTag != null and problemTag != ''">
AND JSON_CONTAINS(vr.problem_tags, JSON_QUOTE(#{problemTag}), '$')
</if>
<if test="source != null and source != ''">
AND vr.source = #{source}
</if>
</where>
ORDER BY
<choose>
@@ -140,11 +156,156 @@
LIMIT #{limit}
</select>
<!-- 查询所有机位评价数据 -->
<select id="selectAllCameraPositionRatings" resultType="java.util.Map">
SELECT camera_position_rating
<!-- 查询所有问题机位ID列表 -->
<select id="selectAllProblemDeviceIds" resultType="java.util.List">
SELECT problem_device_ids
FROM video_review
WHERE camera_position_rating IS NOT NULL AND camera_position_rating != ''
WHERE problem_device_ids IS NOT NULL
AND problem_device_ids != ''
AND problem_device_ids != '[]'
</select>
<!-- 管理后台评价日志结果映射 -->
<resultMap id="AdminVideoReviewLogRespMap" type="com.ycwl.basic.model.pc.videoreview.dto.AdminVideoReviewLogRespDTO">
<id property="id" column="id"/>
<result property="videoId" column="video_id"/>
<result property="videoUrl" column="video_url"/>
<result property="templateId" column="template_id"/>
<result property="templateName" column="template_name"/>
<result property="scenicId" column="scenic_id"/>
<result property="scenicName" column="scenic_name"/>
<result property="creator" column="creator"/>
<result property="creatorName" column="creator_name"/>
<result property="creatorAccount" column="creator_account"/>
<result property="rating" column="rating"/>
<result property="content" column="content"/>
<result property="problemDeviceIds" column="problem_device_ids"
typeHandler="com.ycwl.basic.handler.LongListTypeHandler"/>
<result property="problemDeviceCount" column="problem_device_count"/>
<result property="problemTags" column="problem_tags"
typeHandler="com.ycwl.basic.handler.StringListTypeHandler"/>
<result property="source" column="source"/>
<result property="sourceId" column="source_id"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="operationDuration" column="operation_duration"/>
</resultMap>
<!-- 管理后台分页查询评价日志 -->
<select id="selectAdminReviewLogList" parameterType="com.ycwl.basic.model.pc.videoreview.dto.AdminVideoReviewLogReqDTO"
resultMap="AdminVideoReviewLogRespMap">
SELECT
vr.id,
vr.video_id,
vr.scenic_id,
vr.creator,
vr.rating,
vr.content,
vr.problem_device_ids,
vr.problem_tags,
vr.source,
vr.source_id,
vr.create_time,
vr.update_time,
v.video_url,
v.template_id,
t.name AS template_name,
s.name AS scenic_name,
u.name AS creator_name,
u.account AS creator_account,
<!-- 计算问题机位数量 -->
CASE
WHEN vr.problem_device_ids IS NOT NULL AND vr.problem_device_ids != '' AND vr.problem_device_ids != '[]'
THEN JSON_LENGTH(vr.problem_device_ids)
ELSE 0
END AS problem_device_count,
<!-- 计算操作时长(秒) -->
TIMESTAMPDIFF(SECOND, vr.create_time, vr.update_time) AS operation_duration
FROM video_review vr
LEFT JOIN video v ON vr.video_id = v.id
LEFT JOIN template t ON v.template_id = t.id
LEFT JOIN scenic s ON vr.scenic_id = s.id
LEFT JOIN admin_user u ON vr.creator = u.id
<where>
<if test="id != null">
AND vr.id = #{id}
</if>
<if test="videoId != null">
AND vr.video_id = #{videoId}
</if>
<if test="scenicId != null">
AND vr.scenic_id = #{scenicId}
</if>
<if test="creator != null">
AND vr.creator = #{creator}
</if>
<if test="creatorName != null and creatorName != ''">
AND u.name LIKE CONCAT('%', #{creatorName}, '%')
</if>
<if test="rating != null">
AND vr.rating = #{rating}
</if>
<if test="minRating != null">
AND vr.rating &gt;= #{minRating}
</if>
<if test="maxRating != null">
AND vr.rating &lt;= #{maxRating}
</if>
<if test="startTime != null and startTime != ''">
AND vr.create_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND vr.create_time &lt;= #{endTime}
</if>
<if test="templateId != null">
AND v.template_id = #{templateId}
</if>
<if test="templateName != null and templateName != ''">
AND t.name LIKE CONCAT('%', #{templateName}, '%')
</if>
<if test="keyword != null and keyword != ''">
AND (
vr.content LIKE CONCAT('%', #{keyword}, '%')
OR s.name LIKE CONCAT('%', #{keyword}, '%')
OR t.name LIKE CONCAT('%', #{keyword}, '%')
)
</if>
<if test="hasCameraRating != null">
<!-- hasCameraRating 参数已废弃,保留以兼容旧接口 -->
</if>
<if test="problemDeviceId != null">
AND JSON_CONTAINS(vr.problem_device_ids, CAST(#{problemDeviceId} AS CHAR), '$')
</if>
<if test="problemTag != null and problemTag != ''">
AND JSON_CONTAINS(vr.problem_tags, JSON_QUOTE(#{problemTag}), '$')
</if>
<if test="source != null and source != ''">
AND vr.source = #{source}
</if>
</where>
ORDER BY
<choose>
<when test="orderBy == 'rating'">
vr.rating
</when>
<when test="orderBy == 'update_time'">
vr.update_time
</when>
<when test="orderBy == 'id'">
vr.id
</when>
<otherwise>
vr.create_time
</otherwise>
</choose>
<choose>
<when test="orderDirection == 'ASC'">
ASC
</when>
<otherwise>
DESC
</otherwise>
</choose>
</select>
</mapper>