|
@@ -0,0 +1,47 @@
|
|
|
|
+package cn.com.qmth.examcloud.core.oe.student.api.controller.client;
|
|
|
|
+
|
|
|
|
+import cn.com.qmth.examcloud.api.commons.security.bean.User;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.student.service.ExamingSessionService;
|
|
|
|
+import cn.com.qmth.examcloud.support.Constants;
|
|
|
|
+import cn.com.qmth.examcloud.support.examing.ExamingSession;
|
|
|
|
+import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
|
|
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+
|
|
|
|
+@Api(tags = "(客户端)考试过程相关接口")
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("${app.api.oe.student}/client/exam/process")
|
|
|
|
+public class ExamProcessController extends ControllerSupport {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExamingSessionService examingSessionService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private RedisClient redisClient;
|
|
|
|
+
|
|
|
|
+ @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);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String cacheKey = Constants.OE_DISCIPLINE_ILLEGAL_CLIENT + examingSession.getExamRecordDataId();
|
|
|
|
+ redisClient.set(cacheKey, reason, 3 * 60 * 60);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|