WANG 5 năm trước cách đây
mục cha
commit
b29601e58e

+ 51 - 0
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/ExamController.java

@@ -48,6 +48,7 @@ import cn.com.qmth.examcloud.api.commons.enums.CURD;
 import cn.com.qmth.examcloud.api.commons.enums.ExamType;
 import cn.com.qmth.examcloud.api.commons.exchange.PageInfo;
 import cn.com.qmth.examcloud.api.commons.security.bean.User;
+import cn.com.qmth.examcloud.api.commons.security.bean.UserType;
 import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.commons.helpers.DynamicEnum;
 import cn.com.qmth.examcloud.commons.helpers.DynamicEnumManager;
@@ -91,6 +92,10 @@ import cn.com.qmth.examcloud.core.examwork.service.impl.ExamStudentServiceImpl;
 import cn.com.qmth.examcloud.core.oe.admin.api.ExamRecordCloudService;
 import cn.com.qmth.examcloud.core.oe.admin.api.request.CheckExamIsStartedReq;
 import cn.com.qmth.examcloud.core.oe.admin.api.response.CheckExamIsStartedResp;
+import cn.com.qmth.examcloud.support.cache.CacheHelper;
+import cn.com.qmth.examcloud.support.cache.bean.OrgExamConfigCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.OrgExamPropertyCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.StudentCacheBean;
 import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
 import cn.com.qmth.examcloud.task.api.request.SyncExamReq;
 import cn.com.qmth.examcloud.web.config.SystemConfig;
@@ -656,6 +661,52 @@ public class ExamController extends ControllerSupport {
 		return map;
 	}
 
+	@ApiOperation(value = "查询考生的考试批次配置")
+	@GetMapping("examConfigFromCache4StudentSession/{examId}")
+	public OrgExamConfigCacheBean getExamConfigFromCacheByStudentSession(
+			@PathVariable Long examId) {
+
+		User accessUser = getAccessUser();
+		if (!accessUser.getUserType().equals(UserType.STUDENT)) {
+			throw new StatusException("001259", "just allowed by student");
+		}
+
+		Long studentId = accessUser.getUserId();
+
+		StudentCacheBean student = CacheHelper.getStudent(studentId);
+		Long orgId = student.getOrgId();
+
+		OrgExamConfigCacheBean orgExamConfig = CacheHelper.getOrgExamConfig(examId, orgId);
+		return orgExamConfig;
+	}
+
+	@ApiOperation(value = "查询考生的考试批次属性集")
+	@GetMapping("examPropertyFromCache4StudentSession/{examId}/{keys}")
+	public Map<String, String> getExamPropertyFromCacheByStudentSession(@PathVariable Long examId,
+			@PathVariable String keys) {
+
+		String[] keyArray = StringUtils.splitByWholeSeparator(keys, ",");
+
+		User accessUser = getAccessUser();
+		if (!accessUser.getUserType().equals(UserType.STUDENT)) {
+			throw new StatusException("001258", "just allowed by student");
+		}
+
+		Long studentId = accessUser.getUserId();
+
+		StudentCacheBean student = CacheHelper.getStudent(studentId);
+		Long orgId = student.getOrgId();
+
+		Map<String, String> map = Maps.newHashMap();
+		for (String key : keyArray) {
+			OrgExamPropertyCacheBean orgExamProperty = CacheHelper.getOrgExamProperty(examId, orgId,
+					key);
+			map.put(key, orgExamProperty.getValue());
+		}
+
+		return map;
+	}
+
 	/**
 	 * 方法注释
 	 *