|
@@ -6,7 +6,7 @@ import com.qmth.themis.business.dto.WarningDto;
|
|
import com.qmth.themis.business.entity.TEConfig;
|
|
import com.qmth.themis.business.entity.TEConfig;
|
|
import com.qmth.themis.business.entity.TIeInvigilateWarnInfo;
|
|
import com.qmth.themis.business.entity.TIeInvigilateWarnInfo;
|
|
import com.qmth.themis.business.entity.TOeFaceVerifyHistory;
|
|
import com.qmth.themis.business.entity.TOeFaceVerifyHistory;
|
|
-import com.qmth.themis.business.enums.WarningEnum;
|
|
|
|
|
|
+import com.qmth.themis.business.enums.VerifyExceptionEnum;
|
|
import com.qmth.themis.business.enums.WarningLevelEnum;
|
|
import com.qmth.themis.business.enums.WarningLevelEnum;
|
|
import com.qmth.themis.business.service.TEConfigService;
|
|
import com.qmth.themis.business.service.TEConfigService;
|
|
import com.qmth.themis.business.service.TIeInvigilateWarnInfoService;
|
|
import com.qmth.themis.business.service.TIeInvigilateWarnInfoService;
|
|
@@ -20,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 预警规则公用
|
|
* @Description: 预警规则公用
|
|
@@ -54,23 +55,22 @@ public class WarningServiceImpl implements WarningService {
|
|
public void faceCountError(WarningDto warningDto) {
|
|
public void faceCountError(WarningDto warningDto) {
|
|
Long recordId = warningDto.getRecordId();
|
|
Long recordId = warningDto.getRecordId();
|
|
Integer faceCount = warningDto.getFaceCount();
|
|
Integer faceCount = warningDto.getFaceCount();
|
|
- WarningEnum warningEnum = warningDto.getWarningEnum();
|
|
|
|
|
|
+ VerifyExceptionEnum warningEnum = warningDto.getWarningEnum();
|
|
TEConfig teConfig = teConfigService.getGlobalConfig();
|
|
TEConfig teConfig = teConfigService.getGlobalConfig();
|
|
Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(recordId));
|
|
Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(recordId));
|
|
Long examId = Long.parseLong(String.valueOf(objectMap.get("examId")));
|
|
Long examId = Long.parseLong(String.valueOf(objectMap.get("examId")));
|
|
Long examStudentId = Long.parseLong(String.valueOf(objectMap.get("examStudentId")));
|
|
Long examStudentId = Long.parseLong(String.valueOf(objectMap.get("examStudentId")));
|
|
Long examActivityId = Long.parseLong(String.valueOf(objectMap.get("examActivityId")));
|
|
Long examActivityId = Long.parseLong(String.valueOf(objectMap.get("examActivityId")));
|
|
- QueryWrapper<TOeFaceVerifyHistory> tOeFaceVerifyHistoryQueryWrapper = new QueryWrapper<>();
|
|
|
|
if (faceCount > 1) {//多张人脸
|
|
if (faceCount > 1) {//多张人脸
|
|
- tOeFaceVerifyHistoryQueryWrapper.lambda().eq(TOeFaceVerifyHistory::getExamRecordId, recordId).ge(TOeFaceVerifyHistory::getFaceCount, 1).eq(TOeFaceVerifyHistory::getException, warningEnum.name());
|
|
|
|
- int count = faceVerifyHistoryService.count(tOeFaceVerifyHistoryQueryWrapper);
|
|
|
|
|
|
+ Integer count = faceVerifyHistoryService.faceCountError(recordId, warningDto.getWarningEnum().name(), faceCount, true);
|
|
|
|
+ count = Objects.isNull(count) ? 0 : count;
|
|
if (count >= teConfig.getMultipleFaceCountError()) {
|
|
if (count >= teConfig.getMultipleFaceCountError()) {
|
|
TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(1), WarningLevelEnum.valueOf(warningEnum.getLevel().get(1)).getDesc(), warningEnum);
|
|
TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(1), WarningLevelEnum.valueOf(warningEnum.getLevel().get(1)).getDesc(), warningEnum);
|
|
tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
|
|
tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
|
|
}
|
|
}
|
|
} else if (faceCount <= 0) {//未检测到人脸
|
|
} else if (faceCount <= 0) {//未检测到人脸
|
|
- tOeFaceVerifyHistoryQueryWrapper.lambda().eq(TOeFaceVerifyHistory::getExamRecordId, recordId).le(TOeFaceVerifyHistory::getFaceCount, 0).eq(TOeFaceVerifyHistory::getException, warningEnum.name());
|
|
|
|
- int count = faceVerifyHistoryService.count(tOeFaceVerifyHistoryQueryWrapper);
|
|
|
|
|
|
+ Integer count = faceVerifyHistoryService.faceCountError(recordId, warningDto.getWarningEnum().name(), faceCount, false);
|
|
|
|
+ count = Objects.isNull(count) ? 0 : count;
|
|
if (count >= teConfig.getNoFaceCountError()) {
|
|
if (count >= teConfig.getNoFaceCountError()) {
|
|
TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getDesc(), warningEnum);
|
|
TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getDesc(), warningEnum);
|
|
tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
|
|
tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
|
|
@@ -87,15 +87,14 @@ public class WarningServiceImpl implements WarningService {
|
|
@Transactional
|
|
@Transactional
|
|
public void faceCompareError(WarningDto warningDto) {
|
|
public void faceCompareError(WarningDto warningDto) {
|
|
Long recordId = warningDto.getRecordId();
|
|
Long recordId = warningDto.getRecordId();
|
|
- WarningEnum warningEnum = warningDto.getWarningEnum();
|
|
|
|
|
|
+ VerifyExceptionEnum warningEnum = warningDto.getWarningEnum();
|
|
TEConfig teConfig = teConfigService.getGlobalConfig();
|
|
TEConfig teConfig = teConfigService.getGlobalConfig();
|
|
Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(recordId));
|
|
Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(recordId));
|
|
Long examId = Long.parseLong(String.valueOf(objectMap.get("examId")));
|
|
Long examId = Long.parseLong(String.valueOf(objectMap.get("examId")));
|
|
Long examStudentId = Long.parseLong(String.valueOf(objectMap.get("examStudentId")));
|
|
Long examStudentId = Long.parseLong(String.valueOf(objectMap.get("examStudentId")));
|
|
Long examActivityId = Long.parseLong(String.valueOf(objectMap.get("examActivityId")));
|
|
Long examActivityId = Long.parseLong(String.valueOf(objectMap.get("examActivityId")));
|
|
- QueryWrapper<TOeFaceVerifyHistory> tOeFaceVerifyHistoryQueryWrapper = new QueryWrapper<>();
|
|
|
|
- tOeFaceVerifyHistoryQueryWrapper.lambda().eq(TOeFaceVerifyHistory::getExamRecordId, recordId).eq(TOeFaceVerifyHistory::getException, warningEnum.name());
|
|
|
|
- int count = faceVerifyHistoryService.count(tOeFaceVerifyHistoryQueryWrapper);
|
|
|
|
|
|
+ Integer count = faceVerifyHistoryService.faceCompareError(recordId, warningDto.getWarningEnum().name());
|
|
|
|
+ count = Objects.isNull(count) ? 0 : count;
|
|
if (count >= teConfig.getMatchFaceCompareErrorCount()) {
|
|
if (count >= teConfig.getMatchFaceCompareErrorCount()) {
|
|
TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getDesc(), warningEnum);
|
|
TIeInvigilateWarnInfo tIeInvigilateWarnInfo = new TIeInvigilateWarnInfo(examId, examActivityId, recordId, examStudentId, warningEnum.getLevel().get(0), WarningLevelEnum.valueOf(warningEnum.getLevel().get(0)).getDesc(), warningEnum);
|
|
tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
|
|
tIeInvigilateWarnInfoService.saveOrUpdate(tIeInvigilateWarnInfo);
|
|
@@ -135,7 +134,7 @@ public class WarningServiceImpl implements WarningService {
|
|
@Transactional
|
|
@Transactional
|
|
public void realnessError(WarningDto warningDto) {
|
|
public void realnessError(WarningDto warningDto) {
|
|
Long recordId = warningDto.getRecordId();
|
|
Long recordId = warningDto.getRecordId();
|
|
- WarningEnum warningEnum = warningDto.getWarningEnum();
|
|
|
|
|
|
+ VerifyExceptionEnum warningEnum = warningDto.getWarningEnum();
|
|
TEConfig teConfig = teConfigService.getGlobalConfig();
|
|
TEConfig teConfig = teConfigService.getGlobalConfig();
|
|
Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(recordId));
|
|
Map<String, Object> objectMap = redisUtil.getHashEntries(RedisKeyHelper.examRecordCacheKey(recordId));
|
|
Long examId = Long.parseLong(String.valueOf(objectMap.get("examId")));
|
|
Long examId = Long.parseLong(String.valueOf(objectMap.get("examId")));
|