wangwei 6 роки тому
батько
коміт
a2172e348b

+ 1 - 1
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/OrgController.java

@@ -546,7 +546,7 @@ public class OrgController extends ControllerSupport {
 		User accessUser = getAccessUser();
 		Long rootId = domain.getRootId();
 		if (null == rootId) {
-			throw new StatusException("B-140001", "rootId is null");
+			rootId = accessUser.getRootOrgId();
 		}
 
 		validateRootOrgIsolation(rootId);

+ 35 - 0
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/StudentController.java

@@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -264,4 +265,38 @@ public class StudentController extends ControllerSupport {
 		return studentInfo;
 	}
 
+	@ApiOperation(value = "解绑学号", notes = "")
+	@PostMapping("unbindStudentCode/{ids}")
+	public void unbindStudentCode(@PathVariable String ids) {
+		List<Long> studentIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
+				.collect(Collectors.toList());
+		for (Long cur : studentIds) {
+			StudentEntity s = studentRepo.findOne(cur);
+			if (null == s) {
+				throw new StatusException("B-450110", "学生不存在");
+			}
+			validateRootOrgIsolation(s.getRootOrgId());
+
+			s.setStudentCode(null);
+			studentRepo.save(s);
+		}
+	}
+
+	@ApiOperation(value = "解绑安全手机", notes = "")
+	@PostMapping("unbindSecurityPhone/{ids}")
+	public void unbindSecurityPhone(@PathVariable String ids) {
+		List<Long> studentIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
+				.collect(Collectors.toList());
+		for (Long cur : studentIds) {
+			StudentEntity s = studentRepo.findOne(cur);
+			if (null == s) {
+				throw new StatusException("B-450110", "学生不存在");
+			}
+			validateRootOrgIsolation(s.getRootOrgId());
+
+			s.setSecurityPhone(null);
+			studentRepo.save(s);
+		}
+	}
+
 }