WANG 6 years ago
parent
commit
e09fe9dbfa

+ 15 - 5
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/ExamStudentController.java

@@ -34,6 +34,7 @@ import com.google.common.collect.Lists;
 import cn.com.qmth.examcloud.api.commons.enums.CourseLevel;
 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.util.PathUtil;
 import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
@@ -98,17 +99,26 @@ public class ExamStudentController extends ControllerSupport {
 	 * @return
 	 */
 	@ApiOperation(value = "查询考生的专业集合")
-	@GetMapping("specialtyNameList/{studentId}")
-	public List<String> getSpecialtyNameListByStudentId(@PathVariable Long studentId) {
-		List<String> querySpecialtyNameList = examStudentRepo.querySpecialtyNameList(studentId);
+	@GetMapping("specialtyNameList")
+	public List<String> getSpecialtyNameListByStudentId() {
+		User accessUser = getAccessUser();
+		if (!accessUser.getUserType().equals(UserType.STUDENT)) {
+			throw new StatusException("005002", "用户类型错误");
+		}
+		List<String> querySpecialtyNameList = examStudentRepo
+				.querySpecialtyNameList(accessUser.getUserId());
 		querySpecialtyNameList.removeAll(Collections.singleton(null));
 		return querySpecialtyNameList;
 	}
 
 	@ApiOperation(value = "查询考生的专业集合")
-	@GetMapping("courseLevelList/{studentId}")
+	@GetMapping("courseLevelList")
 	public List<String> getCourseLevelByStudentId(@PathVariable Long studentId) {
-		List<String> courseLevelList = examStudentRepo.queryCourseLevelList(studentId);
+		User accessUser = getAccessUser();
+		if (!accessUser.getUserType().equals(UserType.STUDENT)) {
+			throw new StatusException("005001", "用户类型错误");
+		}
+		List<String> courseLevelList = examStudentRepo.queryCourseLevelList(accessUser.getUserId());
 		List<String> ret = Lists.newArrayList();
 		for (String cur : courseLevelList) {
 			if (null != cur) {