|
@@ -1,8 +1,10 @@
|
|
|
package com.qmth.themis.admin.api;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.google.common.reflect.TypeToken;
|
|
|
import com.qmth.boot.core.solar.config.SolarProperties;
|
|
|
import com.qmth.boot.core.solar.service.SolarService;
|
|
@@ -10,15 +12,13 @@ import com.qmth.themis.admin.config.DictionaryConfig;
|
|
|
import com.qmth.themis.business.bean.admin.DataCountBean;
|
|
|
import com.qmth.themis.business.bean.admin.MapDataCountBean;
|
|
|
import com.qmth.themis.business.bean.admin.OrgDataCountBean;
|
|
|
+import com.qmth.themis.business.bean.result.VideoQueryResult;
|
|
|
import com.qmth.themis.business.constant.SystemConstant;
|
|
|
import com.qmth.themis.business.dto.AuthDto;
|
|
|
import com.qmth.themis.business.dto.response.RoomCodeQueryDto;
|
|
|
import com.qmth.themis.business.dto.response.TEExamQueryDto;
|
|
|
import com.qmth.themis.business.entity.*;
|
|
|
-import com.qmth.themis.business.enums.DownloadFileEnum;
|
|
|
-import com.qmth.themis.business.enums.InvigilateMonitorStatusEnum;
|
|
|
-import com.qmth.themis.business.enums.RoleEnum;
|
|
|
-import com.qmth.themis.business.enums.UploadFileEnum;
|
|
|
+import com.qmth.themis.business.enums.*;
|
|
|
import com.qmth.themis.business.service.*;
|
|
|
import com.qmth.themis.business.util.*;
|
|
|
import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
@@ -40,11 +40,11 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.validation.constraints.Max;
|
|
|
+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: 系统信息 前端控制器
|
|
@@ -118,6 +118,9 @@ public class SysController {
|
|
|
@Resource
|
|
|
SolarProperties solarProperties;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TMTencentVideoMessageService tmTencentVideoMessageService;
|
|
|
+
|
|
|
@ApiOperation(value = "同步机构接口")
|
|
|
@RequestMapping(value = "/sync/org", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "菜单信息", response = Result.class)})
|
|
@@ -541,4 +544,73 @@ public class SysController {
|
|
|
return ResultUtil.ok(new DataCountBean(orgDataCountBeanList, mapDataCountBeanList));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @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,
|
|
|
+ @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));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "视频存储删除接口")
|
|
|
+ @RequestMapping(value = "/video/delete", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "超管视频存储删除接口", response = Result.class)})
|
|
|
+ @Transactional
|
|
|
+ public Result videoDelete(@ApiParam(value = "考试id", required = true) @RequestParam Long examId) {
|
|
|
+ List<TMTencentVideoMessage> tmTencentVideoMessageList = tmTencentVideoMessageService.videoQuery(examId);
|
|
|
+ if (!CollectionUtils.isEmpty(tmTencentVideoMessageList)) {
|
|
|
+ Boolean lock = redisUtil.lock(SystemConstant.REDIS_LOCK_TENCENT_VIDEO_DELETE_PREFIX + examId, SystemConstant.REDIS_LOCK_TENCENT_VIDEO_DELETE_TIME_OUT);
|
|
|
+ if (lock) {
|
|
|
+ try {
|
|
|
+ Set<Long> tencentVideoMessageIds = new HashSet<>(tmTencentVideoMessageList.size());
|
|
|
+ for (TMTencentVideoMessage t : tmTencentVideoMessageList) {
|
|
|
+ tencentVideoMessageIds.add(t.getId());
|
|
|
+ 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(), "")) {
|
|
|
+ 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"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } 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"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tmTencentVideoMessageService.removeByIds(tencentVideoMessageIds);
|
|
|
+ TEExam teExam = teExamService.getById(examId);
|
|
|
+ Optional.ofNullable(teExam).orElseThrow(() -> new BusinessException(ExceptionResultEnum.EXAM_NO));
|
|
|
+
|
|
|
+ Long time = System.currentTimeMillis();
|
|
|
+ teExam.setVideoDelete(false);
|
|
|
+ teExam.setVideoDeleteTime(time);
|
|
|
+ teExam.setUpdateTime(time);
|
|
|
+ teExamService.updateById(teExam);
|
|
|
+ teExamService.updateExamCacheBean(examId);
|
|
|
+ } finally {
|
|
|
+ redisUtil.releaseLock(SystemConstant.REDIS_LOCK_TENCENT_VIDEO_DELETE_PREFIX + examId);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new BusinessException("该考试批次正在删除视频,请稍候再试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultUtil.ok(true);
|
|
|
+ }
|
|
|
}
|