deason 3 ani în urmă
părinte
comite
77a6b5bb92

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

@@ -16,6 +16,7 @@ import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -210,4 +211,24 @@ public class ExamProcessController extends ControllerSupport {
         return examRecordDataService.findCourseNameById(id);
     }
 
+    @ApiOperation(value = "违纪(非法考生端应用)")
+    @PostMapping("/discipline")
+    public void discipline(@RequestParam(required = false) String reason) {
+        User user = getAccessUser();
+        ExamingSession examingSession = examingSessionService.getExamingSession(user.getUserId());
+        if (examingSession == null) {
+            return;
+        }
+
+        if (StringUtils.isNotEmpty(reason)) {
+            // 限制字符串最大长度
+            reason = StringUtils.substring(reason, 0, 1000);
+        } else {
+            reason = "非法考生端应用";
+        }
+
+        String cacheKey = Constants.OE_DISCIPLINE_ILLEGAL_CLIENT + examingSession.getExamRecordDataId();
+        redisClient.set(cacheKey, reason, 3 * 60 * 60);
+    }
+
 }