|
@@ -1,12 +1,5 @@
|
|
|
package com.qmth.themis.business.service.impl;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.themis.business.bean.exam.FaceVerifyBean;
|
|
|
import com.qmth.themis.business.cache.FaceVerifyCacheUtil;
|
|
@@ -18,8 +11,11 @@ import com.qmth.themis.business.enums.VerifyExceptionEnum;
|
|
|
import com.qmth.themis.business.service.TOeExamBreakHistoryService;
|
|
|
import com.qmth.themis.business.service.TOeExamRecordService;
|
|
|
import com.qmth.themis.business.service.TOeFaceVerifyHistoryService;
|
|
|
-import com.qmth.themis.business.util.RedisUtil;
|
|
|
import com.qmth.themis.common.contanst.Constants;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
|
|
|
/**
|
|
|
* @Description: 人脸验证记录 服务实现类
|
|
@@ -31,56 +27,80 @@ import com.qmth.themis.common.contanst.Constants;
|
|
|
@Service
|
|
|
public class TOeFaceVerifyHistoryServiceImpl extends ServiceImpl<TOeFaceVerifyHistoryMapper, TOeFaceVerifyHistory> implements TOeFaceVerifyHistoryService {
|
|
|
|
|
|
-
|
|
|
- @Resource
|
|
|
- RedisUtil redisUtil;
|
|
|
-
|
|
|
- @Resource
|
|
|
- TOeExamBreakHistoryService examBreakHistoryService;
|
|
|
-
|
|
|
- @Resource
|
|
|
- TOeExamRecordService examRecordService;
|
|
|
-
|
|
|
- @Override
|
|
|
- public FaceVerifyBean verify(Long recordId, String type, String photoUrl, Integer faceCount, Double similarity,
|
|
|
- Double realness, Long time, String exception) {
|
|
|
- FaceVerifyCacheBean cache=new FaceVerifyCacheBean();
|
|
|
- cache.setId(Constants.idGen.next());
|
|
|
- cache.setExamRecordId(recordId);
|
|
|
- cache.setFaceCount(faceCount);
|
|
|
- cache.setException(VerifyExceptionEnum.valueOf(exception));
|
|
|
- cache.setPhotoUrl(photoUrl);
|
|
|
- cache.setRealness(realness);
|
|
|
- cache.setSimilarity(similarity);
|
|
|
- cache.setType(ExamTypeEnum.valueOf(type));
|
|
|
- cache.setTime(time);
|
|
|
- FaceVerifyCacheUtil.setFaceVerifyCacheBean(recordId, cache.getId(), cache);
|
|
|
- FaceVerifyBean ret=new FaceVerifyBean();
|
|
|
- ret.setId(cache.getId());
|
|
|
- ret.setUpdateTime(System.currentTimeMillis());
|
|
|
- if(ExamTypeEnum.RESUME_START.equals(cache.getType())) {
|
|
|
- examBreakHistoryService.saveAuthenticationResult(recordId, cache.getId(), cache.getException());
|
|
|
- }else {
|
|
|
- examRecordService.saveFaceVerify(cache.getType(),recordId, cache.getId(), cache.getException());
|
|
|
- }
|
|
|
- return ret;
|
|
|
- }
|
|
|
+ @Resource
|
|
|
+ TOeExamBreakHistoryService examBreakHistoryService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TOeExamRecordService examRecordService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TOeFaceVerifyHistoryMapper tOeFaceVerifyHistoryMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public FaceVerifyBean verify(Long recordId, String type, String photoUrl, Integer faceCount, Double similarity,
|
|
|
+ Double realness, Long time, String exception) {
|
|
|
+ FaceVerifyCacheBean cache = new FaceVerifyCacheBean();
|
|
|
+ cache.setId(Constants.idGen.next());
|
|
|
+ cache.setExamRecordId(recordId);
|
|
|
+ cache.setFaceCount(faceCount);
|
|
|
+ cache.setException(VerifyExceptionEnum.valueOf(exception));
|
|
|
+ cache.setPhotoUrl(photoUrl);
|
|
|
+ cache.setRealness(realness);
|
|
|
+ cache.setSimilarity(similarity);
|
|
|
+ cache.setType(ExamTypeEnum.valueOf(type));
|
|
|
+ cache.setTime(time);
|
|
|
+ FaceVerifyCacheUtil.setFaceVerifyCacheBean(recordId, cache.getId(), cache);
|
|
|
+ FaceVerifyBean ret = new FaceVerifyBean();
|
|
|
+ ret.setId(cache.getId());
|
|
|
+ ret.setUpdateTime(System.currentTimeMillis());
|
|
|
+ if (ExamTypeEnum.RESUME_START.equals(cache.getType())) {
|
|
|
+ examBreakHistoryService.saveAuthenticationResult(recordId, cache.getId(), cache.getException());
|
|
|
+ } else {
|
|
|
+ examRecordService.saveFaceVerify(cache.getType(), recordId, cache.getId(), cache.getException());
|
|
|
+ }
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public void save(Long id, Long recordId, String type, String photoUrl, Integer faceCount, Double similarity,
|
|
|
+ Double realness, Long time, String exception) {
|
|
|
+ TOeFaceVerifyHistory entity = new TOeFaceVerifyHistory();
|
|
|
+ entity.setId(id);
|
|
|
+ entity.setExamRecordId(recordId);
|
|
|
+ entity.setFaceCount(faceCount);
|
|
|
+ entity.setException(VerifyExceptionEnum.valueOf(exception));
|
|
|
+ entity.setPhotoUrl(photoUrl);
|
|
|
+ entity.setRealness(realness);
|
|
|
+ entity.setSimilarity(similarity);
|
|
|
+ entity.setType(ExamTypeEnum.valueOf(type));
|
|
|
+ entity.setTime(time);
|
|
|
+ saveOrUpdate(entity);
|
|
|
+ }
|
|
|
|
|
|
- @Transactional
|
|
|
- @Override
|
|
|
- public void save(Long id, Long recordId, String type, String photoUrl, Integer faceCount, Double similarity,
|
|
|
- Double realness, Long time, String exception) {
|
|
|
- TOeFaceVerifyHistory entity=new TOeFaceVerifyHistory();
|
|
|
- entity.setId(id);
|
|
|
- entity.setExamRecordId(recordId);
|
|
|
- entity.setFaceCount(faceCount);
|
|
|
- entity.setException(VerifyExceptionEnum.valueOf(exception));
|
|
|
- entity.setPhotoUrl(photoUrl);
|
|
|
- entity.setRealness(realness);
|
|
|
- entity.setSimilarity(similarity);
|
|
|
- entity.setType(ExamTypeEnum.valueOf(type));
|
|
|
- entity.setTime(time);
|
|
|
- saveOrUpdate(entity);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * count人脸数量异常
|
|
|
+ *
|
|
|
+ * @param recordId
|
|
|
+ * @param exception
|
|
|
+ * @param faceCount
|
|
|
+ * @param multipleFace
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Integer faceCountError(Long recordId, String exception, Integer faceCount, Boolean multipleFace) {
|
|
|
+ return tOeFaceVerifyHistoryMapper.faceCountError(recordId, exception, faceCount, multipleFace);
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * count人脸比对异常
|
|
|
+ *
|
|
|
+ * @param recordId
|
|
|
+ * @param exception
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Integer faceCompareError(Long recordId, String exception) {
|
|
|
+ return tOeFaceVerifyHistoryMapper.faceCompareError(recordId, exception);
|
|
|
+ }
|
|
|
}
|