|
@@ -1,25 +1,5 @@
|
|
package com.qmth.themis.business.service.impl;
|
|
package com.qmth.themis.business.service.impl;
|
|
|
|
|
|
-import java.text.ParseException;
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Arrays;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Objects;
|
|
|
|
-import java.util.Set;
|
|
|
|
-
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
-
|
|
|
|
-import org.springframework.cache.annotation.CacheEvict;
|
|
|
|
-import org.springframework.cache.annotation.CachePut;
|
|
|
|
-import org.springframework.cache.annotation.Cacheable;
|
|
|
|
-import org.springframework.dao.DuplicateKeyException;
|
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
-
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.qmth.themis.business.cache.bean.ExamActivityCacheBean;
|
|
import com.qmth.themis.business.cache.bean.ExamActivityCacheBean;
|
|
@@ -28,30 +8,29 @@ import com.qmth.themis.business.cache.bean.ExamCourseCacheBean;
|
|
import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
|
|
import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
|
|
import com.qmth.themis.business.dao.TEExamActivityMapper;
|
|
import com.qmth.themis.business.dao.TEExamActivityMapper;
|
|
import com.qmth.themis.business.dto.MqDto;
|
|
import com.qmth.themis.business.dto.MqDto;
|
|
|
|
+import com.qmth.themis.business.dto.response.StreamDto;
|
|
import com.qmth.themis.business.dto.response.TEExamActivityDto;
|
|
import com.qmth.themis.business.dto.response.TEExamActivityDto;
|
|
import com.qmth.themis.business.dto.response.TEExamActivityQueryDto;
|
|
import com.qmth.themis.business.dto.response.TEExamActivityQueryDto;
|
|
import com.qmth.themis.business.dto.response.TEExamActivityWaitDto;
|
|
import com.qmth.themis.business.dto.response.TEExamActivityWaitDto;
|
|
import com.qmth.themis.business.entity.TBUser;
|
|
import com.qmth.themis.business.entity.TBUser;
|
|
import com.qmth.themis.business.entity.TEExam;
|
|
import com.qmth.themis.business.entity.TEExam;
|
|
import com.qmth.themis.business.entity.TEExamActivity;
|
|
import com.qmth.themis.business.entity.TEExamActivity;
|
|
-import com.qmth.themis.business.enums.EntryAuthenticationPolicyEnum;
|
|
|
|
-import com.qmth.themis.business.enums.FieldUniqueEnum;
|
|
|
|
-import com.qmth.themis.business.enums.HardwareTestEnum;
|
|
|
|
-import com.qmth.themis.business.enums.InvigilateMonitorStatusEnum;
|
|
|
|
-import com.qmth.themis.business.enums.MonitorVideoSourceEnum;
|
|
|
|
-import com.qmth.themis.business.enums.MqTagEnum;
|
|
|
|
-import com.qmth.themis.business.service.MqDtoService;
|
|
|
|
-import com.qmth.themis.business.service.TEExamActivityService;
|
|
|
|
-import com.qmth.themis.business.service.TEExamCourseService;
|
|
|
|
-import com.qmth.themis.business.service.TEExamService;
|
|
|
|
-import com.qmth.themis.business.service.TEExamStudentService;
|
|
|
|
-import com.qmth.themis.business.util.JacksonUtil;
|
|
|
|
-import com.qmth.themis.business.util.MqUtil;
|
|
|
|
-import com.qmth.themis.business.util.RedisUtil;
|
|
|
|
-import com.qmth.themis.business.util.ServletUtil;
|
|
|
|
-import com.qmth.themis.business.util.UidUtil;
|
|
|
|
|
|
+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;
|
|
import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
|
|
+import org.springframework.cache.annotation.CacheEvict;
|
|
|
|
+import org.springframework.cache.annotation.CachePut;
|
|
|
|
+import org.springframework.cache.annotation.Cacheable;
|
|
|
|
+import org.springframework.dao.DuplicateKeyException;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.text.ParseException;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 考试场次 服务实现类
|
|
* @Description: 考试场次 服务实现类
|
|
@@ -86,6 +65,7 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private MqUtil mqUtil;
|
|
private MqUtil mqUtil;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 表是否存在
|
|
* 表是否存在
|
|
*
|
|
*
|
|
@@ -175,10 +155,11 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
* @param examActivityId
|
|
* @param examActivityId
|
|
* @param examStudentId
|
|
* @param examStudentId
|
|
* @param courseCode
|
|
* @param courseCode
|
|
|
|
+ * @param prefix
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public TEExamActivityDto getWaitingExam(Long examActivityId, Long examStudentId, String courseCode) {
|
|
|
|
|
|
+ public TEExamActivityDto getWaitingExam(Long examActivityId, Long examStudentId, String courseCode, String prefix, Long recordId) {
|
|
TEExamActivityDto teExamActivityDto = teExamActivityMapper.getWaitingExamByExamActivityId(examActivityId);
|
|
TEExamActivityDto teExamActivityDto = teExamActivityMapper.getWaitingExamByExamActivityId(examActivityId);
|
|
ExamCacheBean examCache = teExamService.getExamCacheBean(teExamActivityDto.getExamId());
|
|
ExamCacheBean examCache = teExamService.getExamCacheBean(teExamActivityDto.getExamId());
|
|
ExamStudentCacheBean examStudentCacheBean = teExamStudentService
|
|
ExamStudentCacheBean examStudentCacheBean = teExamStudentService
|
|
@@ -204,8 +185,12 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
}
|
|
}
|
|
if (Objects.nonNull(teExamActivityDto.getMonitorVideoSourceStr()) && !Objects
|
|
if (Objects.nonNull(teExamActivityDto.getMonitorVideoSourceStr()) && !Objects
|
|
.equals(teExamActivityDto.getMonitorVideoSourceStr().toString().trim().replaceAll(" ", ""), "")) {
|
|
.equals(teExamActivityDto.getMonitorVideoSourceStr().toString().trim().replaceAll(" ", ""), "")) {
|
|
- teExamActivityDto.setMonitorVideoSource(Arrays.asList(
|
|
|
|
- teExamActivityDto.getMonitorVideoSourceStr().trim().toUpperCase().replaceAll(" ", "").split(",")));
|
|
|
|
|
|
+ List<String> videoSources = Arrays.asList(teExamActivityDto.getMonitorVideoSourceStr().trim().toUpperCase().replaceAll(" ", "").split(","));
|
|
|
|
+ List<StreamDto> streamDtoList = new ArrayList<>();
|
|
|
|
+ videoSources.forEach(s -> {
|
|
|
|
+ streamDtoList.add(new StreamDto(MonitorVideoSourceEnum.valueOf(s), prefix + "_" + recordId + "_" + MonitorVideoSourceEnum.valueOf(s).name().toLowerCase()));
|
|
|
|
+ });
|
|
|
|
+ teExamActivityDto.setMonitorVideoSource(streamDtoList);
|
|
teExamActivityDto.setMonitorAudioEnable(examCache.getMonitorAudioEnable());
|
|
teExamActivityDto.setMonitorAudioEnable(examCache.getMonitorAudioEnable());
|
|
//加入hardwareTest逻辑
|
|
//加入hardwareTest逻辑
|
|
if (teExamActivityDto.getMonitorVideoSourceStr().toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name())
|
|
if (teExamActivityDto.getMonitorVideoSourceStr().toUpperCase().contains(MonitorVideoSourceEnum.CLIENT_CAMERA.name())
|
|
@@ -296,11 +281,11 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
public List<TEExamActivity> findByExamIdAndOrgId(Long examId, Long orgId) {
|
|
public List<TEExamActivity> findByExamIdAndOrgId(Long examId, Long orgId) {
|
|
return teExamActivityMapper.findByExamIdAndOrgId(examId, orgId);
|
|
return teExamActivityMapper.findByExamIdAndOrgId(examId, orgId);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
public void saveExamActivity(List<TEExamActivity> teExamActivityList) {
|
|
public void saveExamActivity(List<TEExamActivity> teExamActivityList) {
|
|
- if (Objects.isNull(teExamActivityList) || teExamActivityList.size() == 0) {
|
|
|
|
|
|
+ if (Objects.isNull(teExamActivityList) || teExamActivityList.size() == 0) {
|
|
throw new BusinessException(ExceptionResultEnum.EXAM_INFO_IS_NULL);
|
|
throw new BusinessException(ExceptionResultEnum.EXAM_INFO_IS_NULL);
|
|
}
|
|
}
|
|
Long examId = null;
|
|
Long examId = null;
|
|
@@ -356,20 +341,20 @@ public class TEExamActivityServiceImpl extends ServiceImpl<TEExamActivityMapper,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
- public List<Long> findExamIdToday(){
|
|
|
|
- try {
|
|
|
|
- Date now=new Date();
|
|
|
|
- SimpleDateFormat sdf1=new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
- String today=sdf1.format(now);
|
|
|
|
- SimpleDateFormat sdf2=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
- Long start=sdf2.parse(today+" 00:00:00").getTime();
|
|
|
|
- Long end=sdf2.parse(today+" 23:59:59").getTime();
|
|
|
|
- return teExamActivityMapper.findExamIdToday(start, end);
|
|
|
|
- } catch (ParseException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
- return null;
|
|
|
|
|
|
+ public List<Long> findExamIdToday() {
|
|
|
|
+ try {
|
|
|
|
+ Date now = new Date();
|
|
|
|
+ SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ String today = sdf1.format(now);
|
|
|
|
+ SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ Long start = sdf2.parse(today + " 00:00:00").getTime();
|
|
|
|
+ Long end = sdf2.parse(today + " 23:59:59").getTime();
|
|
|
|
+ return teExamActivityMapper.findExamIdToday(start, end);
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
}
|
|
}
|