wangwei пре 6 година
родитељ
комит
7788792dd2

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

@@ -19,7 +19,6 @@ 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;
@@ -310,7 +309,7 @@ public class StudentController extends ControllerSupport {
 	}
 
 	@ApiOperation(value = "解绑学号", notes = "")
-	@PostMapping("unbindStudentCode/{ids}")
+	@PutMapping("unbindStudentCode/{ids}")
 	public void unbindStudentCode(@PathVariable String ids) {
 		List<Long> studentIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
 				.collect(Collectors.toList());
@@ -327,7 +326,7 @@ public class StudentController extends ControllerSupport {
 	}
 
 	@ApiOperation(value = "解绑安全手机", notes = "")
-	@PostMapping("unbindSecurityPhone/{ids}")
+	@PutMapping("unbindSecurityPhone/{ids}")
 	public void unbindSecurityPhone(@PathVariable String ids) {
 		List<Long> studentIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
 				.collect(Collectors.toList());

+ 5 - 2
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/StudentServiceImpl.java

@@ -106,7 +106,8 @@ public class StudentServiceImpl implements StudentService {
 				throw new StatusException("B-160008", "学号被占用. 学号: " + studentCode);
 			}
 
-			if (null != student && (!student.getStudentCode().equals(studentCode))) {
+			if (null != student && null != student.getStudentCode()
+					&& (!studentCode.equals(student.getStudentCode()))) {
 				throw new StatusException("B-160005", "身份证号已关联学号");
 			}
 		}
@@ -128,8 +129,10 @@ public class StudentServiceImpl implements StudentService {
 
 		student.setRootOrgId(rootOrgId);
 		student.setIdentityNumber(identityNumber);
-		student.setStudentCode(studentCode);
 		student.setOrgId(orgId);
+		if (StringUtils.isNotBlank(studentCode)) {
+			student.setStudentCode(studentCode);
+		}
 		if (null != studentInfo.getName()) {
 			student.setName(studentInfo.getName());
 		}