|
@@ -28,8 +28,10 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
|
|
|
@Service
|
|
@@ -64,17 +66,38 @@ public class ExamFaceLiveVerifyServiceImpl implements ExamFaceLiveVerifyService
|
|
|
throw new StatusException("考试会话已过期");
|
|
|
}
|
|
|
|
|
|
- ExamFaceLiveVerifyEntity entity = new ExamFaceLiveVerifyEntity();
|
|
|
- entity.setExamRecordDataId(examRecordDataId);
|
|
|
- entity.setFinished(false);
|
|
|
- entity.setStatus(FaceLiveVerifyStatus.ERROR);
|
|
|
- examFaceLiveVerifyRepo.save(entity);
|
|
|
+ int times = 1;
|
|
|
+ Long faceLiveVerifyId = null;
|
|
|
+ List<ExamFaceLiveVerifyEntity> entities = examFaceLiveVerifyRepo.findByExamRecordDataId(examRecordData.getId());
|
|
|
+ if (!CollectionUtils.isEmpty(entities)) {
|
|
|
+ for (ExamFaceLiveVerifyEntity entity : entities) {
|
|
|
+ if (entity.getFinished()) {
|
|
|
+ times++;
|
|
|
+ } else {
|
|
|
+ faceLiveVerifyId = entity.getId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- FaceLiveVerifyInfo info = new FaceLiveVerifyInfo();
|
|
|
- info.setFaceLiveVerifyId(entity.getId());
|
|
|
+ if (times > 2) {
|
|
|
+ throw new StatusException("活检次数不能超过2次");
|
|
|
+ }
|
|
|
|
|
|
- // todo 第几次活检、活检开始时间
|
|
|
+ if (faceLiveVerifyId == null) {
|
|
|
+ ExamFaceLiveVerifyEntity entity = new ExamFaceLiveVerifyEntity();
|
|
|
+ entity.setExamRecordDataId(examRecordDataId);
|
|
|
+ entity.setFinished(false);
|
|
|
+ entity.setStatus(FaceLiveVerifyStatus.ERROR);
|
|
|
+ examFaceLiveVerifyRepo.save(entity);
|
|
|
+ faceLiveVerifyId = entity.getId();
|
|
|
+ }
|
|
|
+
|
|
|
+ Integer startMinute = this.calculateStartFaceVerifyMinute(examRecordDataId);
|
|
|
|
|
|
+ FaceLiveVerifyInfo info = new FaceLiveVerifyInfo();
|
|
|
+ info.setFaceLiveVerifyId(faceLiveVerifyId);
|
|
|
+ info.setStartMinute(startMinute);
|
|
|
+ info.setTimes(times);
|
|
|
return info;
|
|
|
}
|
|
|
|