|
@@ -207,7 +207,16 @@ public class StudentController extends ControllerSupport {
|
|
|
.collect(Collectors.toList());
|
|
|
for (Long cur : studentIds) {
|
|
|
Student s = studentRepo.findOne(cur);
|
|
|
- s.setPassword(Consts.DEFAULT_PASSWORD);
|
|
|
+ if (null == s) {
|
|
|
+ throw new StatusException("B-450110", "学生不存在");
|
|
|
+ }
|
|
|
+ String identityNumber = s.getIdentityNumber();
|
|
|
+ if (StringUtils.isNotEmpty(identityNumber)
|
|
|
+ && identityNumber.matches("[0-9a-zA-Z]{6,}")) {
|
|
|
+ s.setPassword(StringUtils.substring(identityNumber, -6, identityNumber.length()));
|
|
|
+ } else {
|
|
|
+ s.setPassword(Consts.DEFAULT_PASSWORD);
|
|
|
+ }
|
|
|
studentRepo.save(s);
|
|
|
}
|
|
|
}
|