Преглед на файлове

考试记录新增视频删除状态

wangliang преди 2 години
родител
ревизия
116db7c1c8

+ 17 - 3
themis-admin/src/main/java/com/qmth/themis/admin/api/SysController.java

@@ -45,6 +45,8 @@ import javax.validation.constraints.Min;
 import java.io.File;
 import java.io.IOException;
 import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * @Description: 系统信息 前端控制器
@@ -493,7 +495,6 @@ public class SysController {
     @Transactional
     public Result getTencentVideo(@ApiParam(value = "考试批次id", required = true) @RequestParam Long examId) {
         List<TOeExamRecord> tOeExamRecordList = tOeExamRecordService.findExamRecordByNotVideoUrl(examId);
-
         if (!CollectionUtils.isEmpty(tOeExamRecordList)) {
             for (TOeExamRecord t : tOeExamRecordList) {
                 Map<String, Object> resultMap = tencentYunUtil.callTencentVideo(t.getId());
@@ -551,12 +552,12 @@ public class SysController {
     @ApiOperation(value = "视频存储查询接口")
     @RequestMapping(value = "/video/select", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "超管视频存储查询接口", response = VideoQueryResult.class)})
-    public Result videoSelect(@ApiParam(value = "机构代码") @RequestParam(required = false) String orgCode,
+    public Result videoSelect(@ApiParam(value = "考试批次名称") @RequestParam(required = false) String examName,
                               @ApiParam(value = "机构名称") @RequestParam(required = false) String orgName,
                               @ApiParam(value = "状态,ALL:全部,TRUE:已删除,FALSE:有效") @RequestParam(required = false) VideoTypeEnum type,
                               @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) int pageNumber,
                               @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.SELECT_PAGE_SIZE_MAX) int pageSize) {
-        return ResultUtil.ok(teExamService.videoQuery(new Page<>(pageNumber, pageSize), orgCode, orgName, type));
+        return ResultUtil.ok(teExamService.videoQuery(new Page<>(pageNumber, pageSize), examName, orgName, type));
     }
 
     @ApiOperation(value = "视频删除状态重置接口")
@@ -586,8 +587,14 @@ public class SysController {
             if (lock) {
                 try {
                     Set<Long> tencentVideoMessageIds = new HashSet<>(tmTencentVideoMessageList.size());
+                    QueryWrapper<TOeExamRecord> tOeExamRecordQueryWrapper = new QueryWrapper<>();
+                    tOeExamRecordQueryWrapper.lambda().eq(TOeExamRecord::getExamId, examId);
+                    List<TOeExamRecord> tOeExamRecordList = tOeExamRecordService.list(tOeExamRecordQueryWrapper);
+                    Map<Long, TOeExamRecord> tOeExamRecordMap = tOeExamRecordList.stream().collect(
+                            Collectors.toMap(TOeExamRecord::getId, Function.identity(), (dto1, dto2) -> dto1));
                     for (TMTencentVideoMessage t : tmTencentVideoMessageList) {
                         tencentVideoMessageIds.add(t.getId());
+                        TOeExamRecord tOeExamRecord = tOeExamRecordMap.get(t.getExamRecordId());
                         if (Objects.nonNull(t.getObject()) && !Objects.equals(t.getObject().trim(), "")) {
                             JSONObject jsonObject = JSONObject.parseObject(t.getObject());
                             if (Objects.nonNull(jsonObject.get("mediaInfoSet")) && !Objects.equals(jsonObject.getString("mediaInfoSet").trim(), "")) {
@@ -601,6 +608,9 @@ public class SysController {
                                                 "",
                                                 tencentYunUtil.getVodAppId(),
                                                 object.getString("fileId"));
+                                        if (Objects.nonNull(tOeExamRecord)) {
+                                            tOeExamRecord.setVideoStatus(true);
+                                        }
                                     }
                                 }
                             } else if (Objects.nonNull(jsonObject.get("file_id")) && !Objects.equals(jsonObject.getString("file_id").trim(), "")) {
@@ -610,10 +620,14 @@ public class SysController {
                                         "",
                                         tencentYunUtil.getVodAppId(),
                                         jsonObject.getString("file_id"));
+                                if (Objects.nonNull(tOeExamRecord)) {
+                                    tOeExamRecord.setVideoStatus(true);
+                                }
                             }
                         }
                     }
                     tmTencentVideoMessageService.removeByIds(tencentVideoMessageIds);
+                    tOeExamRecordService.updateBatchById(tOeExamRecordMap.values());
                 } finally {
                     redisUtil.releaseLock(SystemConstant.REDIS_LOCK_TENCENT_VIDEO_DELETE_PREFIX + examId);
                 }

+ 2 - 2
themis-business/src/main/java/com/qmth/themis/business/dao/TEExamMapper.java

@@ -93,10 +93,10 @@ public interface TEExamMapper extends BaseMapper<TEExam> {
      * 视频存储查询接口
      *
      * @param iPage
-     * @param orgCode
+     * @param examName
      * @param orgName
      * @param type
      * @return
      */
-    public IPage<VideoQueryResult> videoQuery(IPage<Map> iPage, @Param("orgCode") String orgCode, @Param("orgName") String orgName, @Param("type") String type);
+    public IPage<VideoQueryResult> videoQuery(IPage<Map> iPage, @Param("examName") String examName, @Param("orgName") String orgName, @Param("type") String type);
 }

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/dto/response/TEStudentExamRecordDto.java

@@ -67,6 +67,17 @@ public class TEStudentExamRecordDto implements Serializable {
     @ApiModelProperty(name = "非分段视频源")
     private String tencentVideoUrl;
 
+    @ApiModelProperty(value = "视频删除状态,false:未删除,true:已删除")
+    private Boolean videoStatus;
+
+    public Boolean getVideoStatus() {
+        return videoStatus;
+    }
+
+    public void setVideoStatus(Boolean videoStatus) {
+        this.videoStatus = videoStatus;
+    }
+
     public String getVideoSource() {
         return videoSource;
     }

+ 11 - 0
themis-business/src/main/java/com/qmth/themis/business/entity/TOeExamRecord.java

@@ -281,6 +281,17 @@ public class TOeExamRecord implements Serializable {
     @ApiModelProperty(value = "更新时间")
     private Long updateTime;
 
+    @ApiModelProperty(value = "视频删除状态,false:未删除,true:已删除")
+    private Boolean videoStatus;
+
+    public Boolean getVideoStatus() {
+        return videoStatus;
+    }
+
+    public void setVideoStatus(Boolean videoStatus) {
+        this.videoStatus = videoStatus;
+    }
+
     public Long getUpdateTime() {
         return updateTime;
     }

+ 2 - 2
themis-business/src/main/java/com/qmth/themis/business/service/TEExamService.java

@@ -240,10 +240,10 @@ public interface TEExamService extends IService<TEExam> {
      * 视频存储查询接口
      *
      * @param iPage
-     * @param orgCode
+     * @param examName
      * @param orgName
      * @param type
      * @return
      */
-    public IPage<VideoQueryResult> videoQuery(IPage<Map> iPage, String orgCode, String orgName, VideoTypeEnum type);
+    public IPage<VideoQueryResult> videoQuery(IPage<Map> iPage, String examName, String orgName, VideoTypeEnum type);
 }

+ 3 - 3
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamServiceImpl.java

@@ -1633,13 +1633,13 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
      * 视频存储查询接口
      *
      * @param iPage
-     * @param orgCode
+     * @param examName
      * @param orgName
      * @param type
      * @return
      */
     @Override
-    public IPage<VideoQueryResult> videoQuery(IPage<Map> iPage, String orgCode, String orgName, VideoTypeEnum type) {
-        return teExamMapper.videoQuery(iPage, orgCode, orgName, Objects.nonNull(type) ? type.name() : null);
+    public IPage<VideoQueryResult> videoQuery(IPage<Map> iPage, String examName, String orgName, VideoTypeEnum type) {
+        return teExamMapper.videoQuery(iPage, examName, orgName, Objects.nonNull(type) ? type.name() : null);
     }
 }

+ 2 - 2
themis-business/src/main/resources/mapper/TEExamMapper.xml

@@ -300,8 +300,8 @@
                 join t_b_org tbo on
                 tbo.id = tee.org_id
         <where> 1 = 1
-            <if test="orgCode != null and orgCode !=''">
-                and tbo.code like concat('%', #{orgCode}, '%')
+            <if test="examName != null and examName !=''">
+                and tee.name like concat('%', #{examName}, '%')
             </if>
             <if test="orgName != null and orgName !=''">
                 and tbo.name like concat('%', #{orgName}, '%')

+ 2 - 1
themis-business/src/main/resources/mapper/TEStudentMapper.xml

@@ -70,7 +70,8 @@
             t.exam_record_id = toer.id)) as videoCount,
             toer.monitor_record as monitorRecord,
             (select GROUP_CONCAT(t.video_source) from t_m_tencent_video_message t where t.exam_record_id = toer.id) as videoSource,
-            toer.tencent_video_url as tencentVideoUrl
+            toer.tencent_video_url as tencentVideoUrl,
+            toer.video_status as videoStatus
         from
             t_e_exam_student tees
         join t_e_exam tee on

+ 9 - 21
themis-business/src/main/resources/mapper/TMTencentVideoMessageMapper.xml

@@ -4,27 +4,15 @@
 
     <select id="videoQuery" resultType="com.qmth.themis.business.entity.TMTencentVideoMessage">
         select
-            *
+            tmtvm.*,
+            toer.*
         from
-            t_m_tencent_video_message tmtvm
-        where
-            EXISTS (
-                    select
-                        toer.id
-                    from
-                        t_oe_exam_record toer
-                    where
-                        EXISTS (
-                                SELECT
-                                    x.id
-                                FROM
-                                    t_e_exam x
-                                <where> 1 = 1
-                                    <if test="examId != null and examId !=''">
-                                        and x.id = #{examId}
-                                    </if>
-                                </where>
-                                  and toer.exam_id = x.id)
-                      and tmtvm.exam_record_id = toer.id);
+        t_m_tencent_video_message tmtvm
+            join t_oe_exam_record toer on toer.id = tmtvm.exam_record_id
+        <where> 1 = 1
+            <if test="examId != null and examId !=''">
+                and toer.exam_id = #{examId}
+            </if>
+        </where>
     </select>
 </mapper>