Răsfoiți Sursa

update loggers

deason 1 an în urmă
părinte
comite
525c70a775
10 a modificat fișierele cu 74 adăugiri și 53 ștergeri
  1. 16 8
      examcloud-core-oe-student-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/student/api/controller/ExamControlController.java
  2. 2 1
      examcloud-core-oe-student-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/student/api/controller/ExamQuestionController.java
  3. 2 1
      examcloud-core-oe-student-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/student/api/controller/FaceBiopsyController.java
  4. 10 5
      examcloud-core-oe-student-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/student/api/controller/client/ExamProcessController.java
  5. 2 1
      examcloud-core-oe-student-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/student/api/provider/ExamRecordDataCloudServiceProvider.java
  6. 9 9
      examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/ExamControlService.java
  7. 4 2
      examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/ExamRecordQuestionsService.java
  8. 22 21
      examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamControlServiceImpl.java
  9. 2 1
      examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamFaceLivenessVerifyServiceImpl.java
  10. 5 4
      examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamRecordQuestionsServiceImpl.java

+ 16 - 8
examcloud-core-oe-student-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/student/api/controller/ExamControlController.java

@@ -92,7 +92,8 @@ public class ExamControlController extends ControllerSupport {
             throw new StatusException("403X01", "禁止访问!");
         }
 
-        return examControlService.startExam(examStudentId, user.getUserId(), getIp(request), null);
+        String fromBy = "startExam-oldApi";
+        return examControlService.startExam(examStudentId, user.getUserId(), getIp(request), null, fromBy);
     }
 
     /**
@@ -102,7 +103,8 @@ public class ExamControlController extends ControllerSupport {
     @PostMapping("/unonline/startExam")
     public StartExamInfo startExamForOther(@RequestParam Long examStudentId, HttpServletRequest request) {
         User user = getAccessUser();
-        return examControlService.startExam(examStudentId, user.getUserId(), getIp(request), false);
+        String fromBy = "startExam-unonline-webClient";
+        return examControlService.startExam(examStudentId, user.getUserId(), getIp(request), false, fromBy);
     }
 
     /**
@@ -113,8 +115,9 @@ public class ExamControlController extends ControllerSupport {
     @PostMapping(value = "/online/startExam", consumes = MediaType.TEXT_PLAIN_VALUE, produces = MediaType.TEXT_PLAIN_VALUE)
     public String startExamWithCrypto(@RequestBody String encryptParams, HttpServletRequest request) {
         User user = getAccessUser();
+        String fromBy = "startExam-online-webClient";
         return examControlService.startExamWithCrypto(encryptParams, user, getIp(request),
-                request.getHeader(CryptoConstant.TIMESTAMP));
+                request.getHeader(CryptoConstant.TIMESTAMP), fromBy);
     }
 
     /**
@@ -138,7 +141,8 @@ public class ExamControlController extends ControllerSupport {
         String referer = request.getHeader("REFERER");
         String agent = request.getHeader("USER-AGENT");
         String timestampStr = request.getHeader(CryptoConstant.TIMESTAMP);
-        examRecordQuestionsService.submitQuestionAnswerWithCrypto(data, user, referer, agent, timestampStr, getIp(request));
+        String fromBy = "submitQuestionAnswer-webClient";
+        examRecordQuestionsService.submitQuestionAnswerWithCrypto(data, user, referer, agent, timestampStr, getIp(request), fromBy);
     }
 
     /**
@@ -148,7 +152,8 @@ public class ExamControlController extends ControllerSupport {
     @GetMapping("/checkExamInProgress")
     public ExamProcessResultInfo checkExamInProgress(HttpServletRequest request) {
         User user = getAccessUser();
-        return examControlService.checkExamInProgress2(user.getUserId(), getIp(request));
+        String fromBy = "checkExamInProgress-webClient";
+        return examControlService.checkExamInProgress2(user.getUserId(), getIp(request), fromBy);
     }
 
     /**
@@ -160,7 +165,8 @@ public class ExamControlController extends ControllerSupport {
     @GetMapping("/examHeartbeat")
     public Long examHeartbeat(HttpServletRequest request) {
         User user = getAccessUser();
-        return examControlService.examHeartbeat(user, getIp(request));
+        String fromBy = "examHeartbeat-webClient";
+        return examControlService.examHeartbeat(user, getIp(request), fromBy);
     }
 
     /**
@@ -171,7 +177,8 @@ public class ExamControlController extends ControllerSupport {
     @GetMapping("/endExam")
     public void endExam(@RequestParam(required = false) Boolean force, HttpServletRequest request) {
         User user = getAccessUser();
-        examControlService.manualEndExam(user.getUserId(), getIp(request), force);
+        String fromBy = "handInExam-manual-oldApi";
+        examControlService.manualEndExam(user.getUserId(), getIp(request), force, fromBy);
     }
 
     /**
@@ -182,8 +189,9 @@ public class ExamControlController extends ControllerSupport {
     @PostMapping(value = "/endExam", consumes = MediaType.TEXT_PLAIN_VALUE)
     public void endExamWithCrypto(@RequestBody String encryptParams, HttpServletRequest request) {
         User user = getAccessUser();
+        String fromBy = "handInExam-manual-webClient";
         examControlService.manualEndExamWithCrypto(encryptParams, user, getIp(request),
-                request.getHeader(CryptoConstant.TIMESTAMP));
+                request.getHeader(CryptoConstant.TIMESTAMP), fromBy);
     }
 
     /**

+ 2 - 1
examcloud-core-oe-student-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/student/api/controller/ExamQuestionController.java

@@ -75,7 +75,8 @@ public class ExamQuestionController extends ControllerSupport {
 
         String referer = request.getHeader("REFERER");
         String agent = request.getHeader("USER-AGENT");
-        examRecordQuestionsService.submitQuestionAnswer(user.getUserId(), examQuestionInfos, referer, agent, getIp(request));
+        String fromBy = "submitQuestionAnswer-oldApi";
+        examRecordQuestionsService.submitQuestionAnswer(user.getUserId(), examQuestionInfos, referer, agent, getIp(request), fromBy);
     }
 
 }

+ 2 - 1
examcloud-core-oe-student-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/student/api/controller/FaceBiopsyController.java

@@ -220,7 +220,8 @@ public class FaceBiopsyController extends ControllerSupport {
 
         //如果活检满足交卷条件,则系统自动交卷,自动交卷逻辑不应该影响活检保存结果,所以不能放一个事务中
         if (resp.getEndExam()) {
-            examControlService.handInExam(req.getExamRecordDataId(), HandInExamType.AUTO, null, true);
+            String fromBy = "handInExam-auto-活检失败违纪";
+            examControlService.handInExam(req.getExamRecordDataId(), HandInExamType.AUTO, null, true, fromBy);
         }
         return resp;
     }

+ 10 - 5
examcloud-core-oe-student-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/student/api/controller/client/ExamProcessController.java

@@ -73,7 +73,8 @@ public class ExamProcessController extends ControllerSupport {
     @PostMapping("/startExam")
     public StartExamInfo startExam(@RequestParam Long examStudentId) {
         User user = getAccessUser();
-        return examControlService.startExam(examStudentId, user.getUserId(), getIp(getRequest()), null);
+        String fromBy = "startExam-pcClient";
+        return examControlService.startExam(examStudentId, user.getUserId(), getIp(getRequest()), null, fromBy);
     }
 
     @ApiOperation(value = "开始答题")
@@ -87,21 +88,24 @@ public class ExamProcessController extends ControllerSupport {
     @PostMapping("/checkExamInProgress")
     public ExamProcessResultInfo checkExamInProgress() {
         User user = getAccessUser();
-        return examControlService.checkExamInProgress2(user.getUserId(), getIp(getRequest()));
+        String fromBy = "checkExamInProgress-pcClient";
+        return examControlService.checkExamInProgress2(user.getUserId(), getIp(getRequest()), fromBy);
     }
 
     @ApiOperation(value = "考试心跳")
     @PostMapping("/examHeartbeat")
     public Long examHeartbeat(HttpServletRequest request) {
         User user = getAccessUser();
-        return examControlService.examHeartbeat(user, getIp(request));
+        String fromBy = "examHeartbeat-pcClient";
+        return examControlService.examHeartbeat(user, getIp(request), fromBy);
     }
 
     @ApiOperation(value = "结束考试:交卷")
     @PostMapping("/endExam")
     public void endExam(@RequestParam(required = false) Boolean force, HttpServletRequest request) {
         User user = getAccessUser();
-        examControlService.manualEndExam(user.getUserId(), getIp(request), force);
+        String fromBy = "handInExam-manual-pcClient";
+        examControlService.manualEndExam(user.getUserId(), getIp(request), force, fromBy);
     }
 
     @ApiOperation(value = "获取考试记录信息")
@@ -148,7 +152,8 @@ public class ExamProcessController extends ControllerSupport {
         User user = getAccessUser();
         String referer = request.getHeader("REFERER");
         String agent = request.getHeader("USER-AGENT") + "client-" + Constants.ELECTRON_EXAM_SHELL;
-        examRecordQuestionsService.submitQuestionAnswer(user.getUserId(), examQuestionInfos, referer, agent, getIp(request));
+        String fromBy = "submitQuestionAnswer-pcClient";
+        examRecordQuestionsService.submitQuestionAnswer(user.getUserId(), examQuestionInfos, referer, agent, getIp(request), fromBy);
     }
 
     @ApiOperation(value = "获取课程信息")

+ 2 - 1
examcloud-core-oe-student-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/student/api/provider/ExamRecordDataCloudServiceProvider.java

@@ -292,7 +292,8 @@ public class ExamRecordDataCloudServiceProvider extends ControllerSupport implem
     @PostMapping("/handInExam")
     @Override
     public HandInExamResp handInExam(@RequestBody HandInExamReq req) {
-        examControlService.handInExam(req.getExamRecordDataId(), req.getHandInExamType(), req.getIp(), true);
+        String fromBy = "handInExam-auto-rpcApi";
+        examControlService.handInExam(req.getExamRecordDataId(), req.getHandInExamType(), req.getIp(), true, fromBy);
         return new HandInExamResp();
     }
 

+ 9 - 9
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/ExamControlService.java

@@ -16,13 +16,13 @@ public interface ExamControlService {
     /**
      * 开始考试
      */
-    StartExamInfo startExam(Long examStudentId, Long userId, String ip, Boolean allowOnline);
+    StartExamInfo startExam(Long examStudentId, Long userId, String ip, Boolean allowOnline, String fromBy);
 
     /**
      * 开始考试(新)
      * 注:需要加、解密
      */
-    String startExamWithCrypto(String encryptParams, User user, String requestIP, String timestampStr);
+    String startExamWithCrypto(String encryptParams, User user, String requestIP, String timestampStr, String fromBy);
 
     /**
      * 开始答题
@@ -32,13 +32,13 @@ public interface ExamControlService {
     /**
      * 手动交卷
      */
-    void manualEndExam(Long studentId, String ip, Boolean force);
+    void manualEndExam(Long studentId, String ip, Boolean force, String fromBy);
 
     /**
      * 手动交卷(新)
      * 注:需要加、解密
      */
-    void manualEndExamWithCrypto(String encryptParams, User user, String requestIP, String timestampStr);
+    void manualEndExamWithCrypto(String encryptParams, User user, String requestIP, String timestampStr, String fromBy);
 
     /**
      * 交卷
@@ -47,25 +47,25 @@ public interface ExamControlService {
      * @param handInExamType   交卷类型
      * @param ip               请求ip,可以为空
      */
-    void handInExam(Long examRecordDataId, HandInExamType handInExamType, String ip, Boolean force);
+    void handInExam(Long examRecordDataId, HandInExamType handInExamType, String ip, Boolean force, String fromBy);
 
     /**
      * 断点续考:检查正在进行中的考试
      *
      * @param studentId
      */
-    CheckExamInProgressInfo checkExamInProgress(Long studentId, String ip);
+    CheckExamInProgressInfo checkExamInProgress(Long studentId, String ip, String fromBy);
 
-    ExamProcessResultInfo checkExamInProgress2(Long studentId, String ip);
+    ExamProcessResultInfo checkExamInProgress2(Long studentId, String ip, String fromBy);
 
     /**
      * 考试心跳
      *
      * @param
      */
-    long examHeartbeat(User user, String ip);
+    long examHeartbeat(User user, String ip, String fromBy);
 
-    void setAndSaveActiveTime(Long examRecordDataId, String ip, String operate);
+    void setAndSaveActiveTime(Long examRecordDataId, String ip, String fromBy);
 
     /**
      * 获取考试结束后的相关信息

+ 4 - 2
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/ExamRecordQuestionsService.java

@@ -41,13 +41,15 @@ public interface ExamRecordQuestionsService {
 
     String getQuestionContentForClient(Long studentId, String questionId);
 
-    void submitQuestionAnswer(Long studentId, List<ExamStudentQuestionInfo> examQuestionInfos, String referer, String agent, String ip);
+    void submitQuestionAnswer(Long studentId, List<ExamStudentQuestionInfo> examQuestionInfos,
+                              String referer, String agent, String ip, String fromBy);
 
     /**
      * 考生作答(新)
      * 注:需要加、解密
      */
-    void submitQuestionAnswerWithCrypto(ExamStudentQuestionAnswerInfo data, User user, String referer, String agent, String timestampStr, String ip);
+    void submitQuestionAnswerWithCrypto(ExamStudentQuestionAnswerInfo data, User user, String referer,
+                                        String agent, String timestampStr, String ip, String fromBy);
 
     GetExamRecordQuestionsResp getExamRecordQuestions(GetExamRecordQuestionsReq req);
 

+ 22 - 21
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamControlServiceImpl.java

@@ -227,7 +227,7 @@ public class ExamControlServiceImpl implements ExamControlService {
      */
     @Transactional
     @Override
-    public StartExamInfo startExam(Long examStudentId, Long userId, String ip, Boolean allowOnline) {
+    public StartExamInfo startExam(Long examStudentId, Long userId, String ip, Boolean allowOnline, String fromBy) {
         Check.isNull(examStudentId, "examStudentId不能为空");
         Check.isNull(userId, "userId不能为空");
 
@@ -312,7 +312,7 @@ public class ExamControlServiceImpl implements ExamControlService {
         initializeExamRecordSession(examingSession, examRecordData, examBean);
 
         //设置并保存上次活动时间
-        setAndSaveActiveTime(examRecordData.getId(), ip, "startExam");
+        setAndSaveActiveTime(examRecordData.getId(), ip, fromBy);
 
         // 保存考试次数控制信息
         ExamBoss eb = examBossService.getExamBoss(examingSession.getExamStudentId());
@@ -341,7 +341,7 @@ public class ExamControlServiceImpl implements ExamControlService {
 
 
     @Override
-    public String startExamWithCrypto(String encryptParams, User user, String requestIP, String timestampStr) {
+    public String startExamWithCrypto(String encryptParams, User user, String requestIP, String timestampStr, String fromBy) {
         long timestamp;
         try {
             timestamp = CryptoHelper.parseTimestamp(timestampStr);
@@ -382,7 +382,7 @@ public class ExamControlServiceImpl implements ExamControlService {
         }
 
         Long examStudentId = jsonNode.get("examStudentId").asLong();
-        StartExamInfo examInfo = this.startExam(examStudentId, user.getUserId(), requestIP, true);
+        StartExamInfo examInfo = this.startExam(examStudentId, user.getUserId(), requestIP, true, fromBy);
         String jsonResult = new JsonMapper().toJson(examInfo);
 
         // 按加密方案组合依次加密
@@ -793,7 +793,7 @@ public class ExamControlServiceImpl implements ExamControlService {
     }
 
     @Override
-    public void manualEndExamWithCrypto(String encryptParams, User user, String requestIP, String timestampStr) {
+    public void manualEndExamWithCrypto(String encryptParams, User user, String requestIP, String timestampStr, String fromBy) {
         long timestamp;
         try {
             timestamp = CryptoHelper.parseTimestamp(timestampStr);
@@ -825,11 +825,11 @@ public class ExamControlServiceImpl implements ExamControlService {
             throw new StatusException("400X01", CryptoConstant.REQUEST_PARAM_ERROR);
         }
 
-        this.manualEndExam(user.getUserId(), requestIP, false);
+        this.manualEndExam(user.getUserId(), requestIP, false, fromBy);
     }
 
     @Override
-    public void manualEndExam(Long studentId, String ip, Boolean force) {
+    public void manualEndExam(Long studentId, String ip, Boolean force, String fromBy) {
         String sequenceLockKey = CacheConstants.LOCK_EXAM_CONTROL + studentId;
         //系统在请求结束后会,自动释放锁,无需手动解锁
         SequenceLockHelper.getLock(sequenceLockKey);
@@ -839,7 +839,7 @@ public class ExamControlServiceImpl implements ExamControlService {
             throw new StatusException("8010", "无效的会话,请离开考试");
         }
 
-        this.handInExam(examingSession.getExamRecordDataId(), HandInExamType.MANUAL, ip, force);
+        this.handInExam(examingSession.getExamRecordDataId(), HandInExamType.MANUAL, ip, force, fromBy);
     }
 
     /**
@@ -850,7 +850,7 @@ public class ExamControlServiceImpl implements ExamControlService {
      */
     @Transactional
     @Override
-    public void handInExam(Long examRecordDataId, HandInExamType handInExamType, String ip, Boolean force) {
+    public void handInExam(Long examRecordDataId, HandInExamType handInExamType, String ip, Boolean force, String fromBy) {
         // 此锁是为了避免自动交卷服务与断点续考交卷或活检失败交卷,同一时刻交卷争抢资源导致死锁
         String sequenceLockKey = CacheConstants.LOCK_HAND_IN_EXAM + examRecordDataId;
         // 系统在请求结束后会,自动释放锁,无需手动解锁
@@ -870,7 +870,7 @@ public class ExamControlServiceImpl implements ExamControlService {
             examRecordData.setExamRecordStatus(ExamRecordStatus.EXAM_HAND_IN);
             examRecordData.setEndTime(new Date());
             //设置并保存上次活动时间
-            setAndSaveActiveTime(examRecordDataId, ip, "handInExam");
+            setAndSaveActiveTime(examRecordDataId, ip, fromBy);
         } else if (handInExamType == HandInExamType.AUTO) {
             examRecordData.setExamRecordStatus(ExamRecordStatus.EXAM_AUTO_HAND_IN);
             examRecordData.setCleanTime(new Date());
@@ -1695,14 +1695,14 @@ public class ExamControlServiceImpl implements ExamControlService {
     }
 
     @Override
-    public ExamProcessResultInfo checkExamInProgress2(Long studentId, String ip) {
+    public ExamProcessResultInfo checkExamInProgress2(Long studentId, String ip, String fromBy) {
         String sequenceLockKey = CacheConstants.LOCK_EXAM_CONTROL + studentId;
         // 系统在请求结束后会,自动释放锁,无需手动解锁
         SequenceLockHelper.getLock(sequenceLockKey);
 
         ExamProcessResultInfo res = new ExamProcessResultInfo();
         try {
-            CheckExamInProgressInfo info = this.checkExamInProgress(studentId, ip);
+            CheckExamInProgressInfo info = this.checkExamInProgress(studentId, ip, fromBy);
             res.setCode(Constants.COMMON_SUCCESS_CODE);
             res.setData(info);
             return res;
@@ -1718,7 +1718,7 @@ public class ExamControlServiceImpl implements ExamControlService {
     }
 
     @Override
-    public CheckExamInProgressInfo checkExamInProgress(Long studentId, String ip) {
+    public CheckExamInProgressInfo checkExamInProgress(Long studentId, String ip, String fromBy) {
         ExamingSession examSessionInfo = examingSessionService.getExamingSession(studentId);
         if (examSessionInfo == null || ExamingStatus.INFORMAL.equals(examSessionInfo.getExamingStatus())) {
             return null;
@@ -1791,7 +1791,7 @@ public class ExamControlServiceImpl implements ExamControlService {
         checkExamInProgressInfo.setFaceVerifyMinute(faceVerifyMinute);
 
         //设置并保存上次活动时间
-        setAndSaveActiveTime(examRecordDataId, ip, "checkExamInProgress");
+        setAndSaveActiveTime(examRecordDataId, ip, fromBy);
 
         //考试过程记录(断点)打点
         ExamingActivityTime lastExamingActivityTime = getExamingActivityTime(examRecordDataId);
@@ -1875,7 +1875,8 @@ public class ExamControlServiceImpl implements ExamControlService {
      */
     private void delayHandInExamIfLocked(Long examRecordDataId) {
         try {
-            this.handInExam(examRecordDataId, HandInExamType.AUTO, null, true);
+            String fromBy = "handInExam-auto-考试时间结束";
+            this.handInExam(examRecordDataId, HandInExamType.AUTO, null, true, fromBy);
         } catch (SequenceLockException e) {
             // 如果发现自动服务正在交卷,则重试1500毫秒获取考试记录状态,判断是否已交卷
             int loopTimes = 0;
@@ -1919,7 +1920,7 @@ public class ExamControlServiceImpl implements ExamControlService {
      * @param user 学生
      */
     @Override
-    public long examHeartbeat(User user, String ip) {
+    public long examHeartbeat(User user, String ip, String fromBy) {
         Long studentId = user.getUserId();
         ExamingSession examSessionInfo = examingSessionService.getExamingSession(studentId);
         if (examSessionInfo == null || ExamingStatus.INFORMAL.equals(examSessionInfo.getExamingStatus())) {
@@ -1966,7 +1967,7 @@ public class ExamControlServiceImpl implements ExamControlService {
         redisClient.set(examingHeartbeatKey, examingHeartbeat, OeConstants.TIME_OUT_7_DAY);//更新心跳缓存
 
         //设置并保存上次活动时间
-        setAndSaveActiveTime(examSessionInfo.getExamRecordDataId(), ip, "examHeartbeat");
+        setAndSaveActiveTime(examSessionInfo.getExamRecordDataId(), ip, fromBy);
 
         // 在线考生心跳打点
         ReportsUtil.report(new OnlineExamStudentReport(user.getRootOrgId(), user.getUserId(),
@@ -1988,10 +1989,12 @@ public class ExamControlServiceImpl implements ExamControlService {
      *
      * @param examRecordDataId 考试记录id
      * @param ip               IP地址
-     * @param operate          操作
+     * @param fromBy           操作来源
      */
     @Override
-    public void setAndSaveActiveTime(Long examRecordDataId, String ip, String operate) {
+    public void setAndSaveActiveTime(Long examRecordDataId, String ip, String fromBy) {
+        log.warn("setAndSaveActiveTime examRecordDataId:{} ip:{} fromBy:{}", examRecordDataId, ip, fromBy);
+
         String examingActiveTimeKey = RedisKeyHelper.getBuilder().examingActiveTimeKey(examRecordDataId);
         ExamingActivityTime examingActiveTime = redisClient.get(examingActiveTimeKey, ExamingActivityTime.class);
         if (null == examingActiveTime) {
@@ -2009,8 +2012,6 @@ public class ExamControlServiceImpl implements ExamControlService {
         examingActiveTime.setRealIp(ip);
 
         redisClient.set(examingActiveTimeKey, examingActiveTime, OeConstants.TIME_OUT_7_DAY);
-
-        log.warn("setAndSaveActiveTime examRecordDataId:{} ip:{} operate:{}", examRecordDataId, ip, operate);
     }
 
     /**

+ 2 - 1
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamFaceLivenessVerifyServiceImpl.java

@@ -239,7 +239,8 @@ public class ExamFaceLivenessVerifyServiceImpl implements ExamFaceLivenessVerify
 
         //如果活体检失败,需要清除会话并自动交卷
         if (IsSuccess.strToEnum(result) == IsSuccess.FAILED) {
-            examControlService.handInExam(examRecordDataId, HandInExamType.AUTO, null, true);
+            String fromBy = "handInExam-auto-活检失败";
+            examControlService.handInExam(examRecordDataId, HandInExamType.AUTO, null, true, fromBy);
         }
     }
 

+ 5 - 4
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamRecordQuestionsServiceImpl.java

@@ -304,7 +304,7 @@ public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsServic
     }
 
     @Override
-    public void submitQuestionAnswer(Long studentId, List<ExamStudentQuestionInfo> examQuestionInfos, String referer, String agent, String ip) {
+    public void submitQuestionAnswer(Long studentId, List<ExamStudentQuestionInfo> examQuestionInfos, String referer, String agent, String ip, String fromBy) {
         if (CollectionUtils.isEmpty(examQuestionInfos)) {
             log.warn("submitQuestionAnswer is empty. studentId = {} ", studentId);
             return;
@@ -325,6 +325,7 @@ public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsServic
         if (StringUtils.isEmpty(referer) || StringUtils.isEmpty(agent) || !agent.contains(Constants.ELECTRON_EXAM_SHELL)) {
             String cacheKey = CacheConstants.CACHE_OE_DISCIPLINE_ILLEGAL_DATA + examSessionInfo.getExamRecordDataId();
             redisClient.set(cacheKey, true, OeConstants.TIME_OUT_1_DAY);
+            log.warn("DISCIPLINE_ILLEGAL_DATA examRecordDataId:{} agent:{} referer:{} fromBy:{}", examSessionInfo.getExamRecordDataId(), agent, referer, fromBy);
         }
 
         for (ExamStudentQuestionInfo examQuestionInfo : examQuestionInfos) {
@@ -354,11 +355,11 @@ public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsServic
         }
 
         // 设置并保存上次活动时间
-        examControlService.setAndSaveActiveTime(examRecordDataId, ip, "submitQuestionAnswer");
+        examControlService.setAndSaveActiveTime(examRecordDataId, ip, fromBy);
     }
 
     @Override
-    public void submitQuestionAnswerWithCrypto(ExamStudentQuestionAnswerInfo data, User user, String referer, String agent, String timestampStr, String ip) {
+    public void submitQuestionAnswerWithCrypto(ExamStudentQuestionAnswerInfo data, User user, String referer, String agent, String timestampStr, String ip, String fromBy) {
         long timestamp;
         try {
             timestamp = CryptoHelper.parseTimestamp(timestampStr);
@@ -385,7 +386,7 @@ public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsServic
 
         List<ExamStudentQuestionInfo> answers = new JsonMapper().toList(data.getAnswers(), ExamStudentQuestionInfo.class);
 
-        this.submitQuestionAnswer(user.getUserId(), answers, referer, agent, ip);
+        this.submitQuestionAnswer(user.getUserId(), answers, referer, agent, ip, fromBy);
     }
 
     @Override