|
@@ -17,6 +17,7 @@ import com.qmth.themis.business.constant.SystemConstant;
|
|
import com.qmth.themis.business.dto.AuthDto;
|
|
import com.qmth.themis.business.dto.AuthDto;
|
|
import com.qmth.themis.business.dto.response.RoomCodeQueryDto;
|
|
import com.qmth.themis.business.dto.response.RoomCodeQueryDto;
|
|
import com.qmth.themis.business.dto.response.TEExamQueryDto;
|
|
import com.qmth.themis.business.dto.response.TEExamQueryDto;
|
|
|
|
+import com.qmth.themis.business.dto.response.TEStudentMonitorRecordDto;
|
|
import com.qmth.themis.business.entity.*;
|
|
import com.qmth.themis.business.entity.*;
|
|
import com.qmth.themis.business.enums.*;
|
|
import com.qmth.themis.business.enums.*;
|
|
import com.qmth.themis.business.service.*;
|
|
import com.qmth.themis.business.service.*;
|
|
@@ -584,6 +585,7 @@ public class SysController {
|
|
@ApiResponses({@ApiResponse(code = 200, message = "超管视频存储删除接口", response = Result.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "超管视频存储删除接口", response = Result.class)})
|
|
@Transactional
|
|
@Transactional
|
|
public Result videoDelete(@ApiParam(value = "考试id", required = true) @RequestParam Long examId) {
|
|
public Result videoDelete(@ApiParam(value = "考试id", required = true) @RequestParam Long examId) {
|
|
|
|
+ //新考试视频
|
|
List<TMTencentVideoMessage> tmTencentVideoMessageList = tmTencentVideoMessageService.videoQuery(examId);
|
|
List<TMTencentVideoMessage> tmTencentVideoMessageList = tmTencentVideoMessageService.videoQuery(examId);
|
|
if (!CollectionUtils.isEmpty(tmTencentVideoMessageList)) {
|
|
if (!CollectionUtils.isEmpty(tmTencentVideoMessageList)) {
|
|
Boolean lock = redisUtil.lock(SystemConstant.REDIS_LOCK_TENCENT_VIDEO_DELETE_PREFIX + examId, SystemConstant.REDIS_LOCK_TENCENT_VIDEO_DELETE_TIME_OUT);
|
|
Boolean lock = redisUtil.lock(SystemConstant.REDIS_LOCK_TENCENT_VIDEO_DELETE_PREFIX + examId, SystemConstant.REDIS_LOCK_TENCENT_VIDEO_DELETE_TIME_OUT);
|
|
@@ -638,6 +640,70 @@ public class SysController {
|
|
throw new BusinessException("该考试批次正在删除视频,请稍候再试");
|
|
throw new BusinessException("该考试批次正在删除视频,请稍候再试");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //老考试视频
|
|
|
|
+ QueryWrapper<TOeExamRecord> tOeExamRecordQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ tOeExamRecordQueryWrapper.lambda().eq(TOeExamRecord::getExamId, examId)
|
|
|
|
+ .isNotNull(TOeExamRecord::getTencentVideoUrl);
|
|
|
|
+ List<TOeExamRecord> tOeExamRecordList = tOeExamRecordService.list(tOeExamRecordQueryWrapper);
|
|
|
|
+ if (!CollectionUtils.isEmpty(tOeExamRecordList)) {
|
|
|
|
+ Boolean lock = redisUtil.lock(SystemConstant.REDIS_LOCK_TENCENT_VIDEO_DELETE_PREFIX + examId, SystemConstant.REDIS_LOCK_TENCENT_VIDEO_DELETE_TIME_OUT);
|
|
|
|
+ if (lock) {
|
|
|
|
+ try {
|
|
|
|
+ Map<Long, TMTencentVideoMessage> tmTencentVideoMessageMap = new HashMap<>();
|
|
|
|
+ Set<Long> tencentVideoMessageIds = new HashSet<>();
|
|
|
|
+ Map<Long, TOeExamRecord> tOeExamRecordMap = tOeExamRecordList.stream().collect(
|
|
|
|
+ Collectors.toMap(TOeExamRecord::getId, Function.identity(), (dto1, dto2) -> dto1));
|
|
|
|
+ for (TOeExamRecord t : tOeExamRecordList) {
|
|
|
|
+ List<TEStudentMonitorRecordDto> monitorRecordList = GsonUtil.fromJson(t.getTencentVideoUrl(), new TypeToken<List<TEStudentMonitorRecordDto>>() {
|
|
|
|
+ }.getType());
|
|
|
|
+ for (TEStudentMonitorRecordDto teStudentMonitorRecordDto : monitorRecordList) {
|
|
|
|
+ QueryWrapper<TMTencentVideoMessage> tencentVideoMessageQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ tencentVideoMessageQueryWrapper.lambda().like(TMTencentVideoMessage::getObject, teStudentMonitorRecordDto.getVideoSource());
|
|
|
|
+ List<TMTencentVideoMessage> tencentVideoMessageList = tmTencentVideoMessageService.list(tencentVideoMessageQueryWrapper);
|
|
|
|
+ for (TMTencentVideoMessage tencentVideoMessage : tencentVideoMessageList) {
|
|
|
|
+ if (!tmTencentVideoMessageMap.containsKey(tencentVideoMessage.getId())) {
|
|
|
|
+ tmTencentVideoMessageMap.put(tencentVideoMessage.getId(), tencentVideoMessage);
|
|
|
|
+ } else {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ tencentVideoMessageIds.add(t.getId());
|
|
|
|
+ if (Objects.nonNull(tencentVideoMessage.getObject()) && !Objects.equals(tencentVideoMessage.getObject().trim(), "")) {
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(tencentVideoMessage.getObject());
|
|
|
|
+ if (Objects.nonNull(jsonObject.get("mediaInfoSet")) && !Objects.equals(jsonObject.getString("mediaInfoSet").trim(), "")) {
|
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(jsonObject.getString("mediaInfoSet"));
|
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
|
+ JSONObject object = jsonArray.getJSONObject(i);
|
|
|
|
+ if (Objects.nonNull(object.get("fileId")) && !Objects.equals(object.getString("fileId").trim(), "")) {
|
|
|
|
+ tencentYunUtil.deleteMedia(tencentYunUtil.getSecretId(),
|
|
|
|
+ tencentYunUtil.getSecretKey(),
|
|
|
|
+ tencentYunUtil.getQueryUrl(),
|
|
|
|
+ "",
|
|
|
|
+ tencentYunUtil.getVodAppId(),
|
|
|
|
+ object.getString("fileId"));
|
|
|
|
+ t.setVideoStatus(true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if (Objects.nonNull(jsonObject.get("file_id")) && !Objects.equals(jsonObject.getString("file_id").trim(), "")) {
|
|
|
|
+ tencentYunUtil.deleteMedia(tencentYunUtil.getSecretId(),
|
|
|
|
+ tencentYunUtil.getSecretKey(),
|
|
|
|
+ tencentYunUtil.getQueryUrl(),
|
|
|
|
+ "",
|
|
|
|
+ tencentYunUtil.getVodAppId(),
|
|
|
|
+ jsonObject.getString("file_id"));
|
|
|
|
+ t.setVideoStatus(true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ tmTencentVideoMessageService.removeByIds(tencentVideoMessageIds);
|
|
|
|
+ tOeExamRecordService.updateBatchById(tOeExamRecordMap.values());
|
|
|
|
+ } finally {
|
|
|
|
+ redisUtil.releaseLock(SystemConstant.REDIS_LOCK_TENCENT_VIDEO_DELETE_PREFIX + examId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
TEExam teExam = teExamService.getById(examId);
|
|
TEExam teExam = teExamService.getById(examId);
|
|
Optional.ofNullable(teExam).orElseThrow(() -> new BusinessException(ExceptionResultEnum.EXAM_NO));
|
|
Optional.ofNullable(teExam).orElseThrow(() -> new BusinessException(ExceptionResultEnum.EXAM_NO));
|
|
|
|
|