添加学生和教师,判断账号是否符合要求

beetlsql3-dev
maLix 2 years ago
parent 521869585e
commit 69c0703291

@ -271,9 +271,12 @@ public class CorePlatformService {
/**
*
* true/false 使{@link #isAllowUserCodeThrowMessage}
*
* @param code
* @return
*/
@Deprecated
public boolean isAllowUserCode(String code){
code = code.trim();
CoreUser coreUser = new CoreUser();
@ -282,6 +285,25 @@ public class CorePlatformService {
return !code.startsWith(ACCESS_SUPPER_ADMIN) && coreUserList.size() == 0;
}
/**
* ,
* @param code
* @return
*/
public void isAllowUserCodeThrowMessage(String code){
code = code.trim();
CoreUser coreUser = new CoreUser();
coreUser.setCode(code);
List<CoreUser> coreUserList = coreUserDao.template(coreUser);
if (code.startsWith(ACCESS_SUPPER_ADMIN)) {
throw new PlatformException("注册账号不允许admin开头" + code);
}
if (coreUserList != null && coreUserList.size() > 0) {
throw new PlatformException("注册的账号已存在:" + code);
}
}
public boolean isAllowUserCode(Long id,String code){
CoreUser coreUser = new CoreUser();
coreUser.setCode(code);

@ -463,9 +463,7 @@ public class StudentService extends CoreBaseService<Student>{
this.save(student);
String code = student.createCode();
if (!platformService.isAllowUserCode(code)) {
throw new PlatformException("不允许的注册账号 " + code);
}
platformService.isAllowUserCodeThrowMessage(code);
SchoolClass schoolClass = schoolClassService.queryById(student.getClassId());
Long orgId = schoolClass.getOrgId();
@ -662,6 +660,7 @@ public class StudentService extends CoreBaseService<Student>{
String code = pojo.createCode();//TODO 可改规则
// 这里不需要修改,该接口 已经丢弃。
if (!platformService.isAllowUserCode(code)) {
delList.add(pojo.getStudentId());
// msg += "第"+(i+1)+"行不允许的注册账号 "+code+"<br>";

@ -231,9 +231,7 @@ public class TeacherService extends CoreBaseService<Teacher> {
this.save(teacher);
String code = teacher.createCode();//TODO 可改规则
if (!platformService.isAllowUserCode(code)) {
throw new PlatformException("不允许的注册账号 " + code);
}
platformService.isAllowUserCodeThrowMessage(code);
UniversitiesColleges universitiesColleges = universitiesCollegesService.queryById(teacher.getUniversitiesCollegesId());
Long orgId = universitiesColleges.getOrgId();

Loading…
Cancel
Save