|
@@ -82,15 +82,18 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|
if (StringUtils.isBlank(domain.getLoginName())) {
|
|
if (StringUtils.isBlank(domain.getLoginName())) {
|
|
throw new StatusException("登录名不能为空");
|
|
throw new StatusException("登录名不能为空");
|
|
}
|
|
}
|
|
- if (domain.getId() == null && StringUtils.isBlank(domain.getPasswd())) {
|
|
|
|
- throw new StatusException("密码不能为空");
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
if (domain.getRole() == null) {
|
|
if (domain.getRole() == null) {
|
|
throw new StatusException("角色不能为空");
|
|
throw new StatusException("角色不能为空");
|
|
}
|
|
}
|
|
|
|
+
|
|
if (domain.getRole().equals(Role.SUPER_ADMIN)) {
|
|
if (domain.getRole().equals(Role.SUPER_ADMIN)) {
|
|
throw new StatusException("不能新增超管");
|
|
throw new StatusException("不能新增超管");
|
|
}
|
|
}
|
|
|
|
+ if (!domain.getRole().equals(Role.SECTION_LEADER) && domain.getId() == null
|
|
|
|
+ && StringUtils.isBlank(domain.getPasswd())) {
|
|
|
|
+ throw new StatusException("密码不能为空");
|
|
|
|
+ }
|
|
if (!domain.getRole().equals(Role.SECTION_LEADER) && CollectionUtils.isNotEmpty(domain.getCourse())) {
|
|
if (!domain.getRole().equals(Role.SECTION_LEADER) && CollectionUtils.isNotEmpty(domain.getCourse())) {
|
|
throw new StatusException("只有科组长可关联科目");
|
|
throw new StatusException("只有科组长可关联科目");
|
|
}
|
|
}
|
|
@@ -109,8 +112,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|
ue.setSchoolId(domain.getSchoolId());
|
|
ue.setSchoolId(domain.getSchoolId());
|
|
ue.setEnable(true);
|
|
ue.setEnable(true);
|
|
}
|
|
}
|
|
- UserEntity lg=getByLoginName(domain.getLoginName());
|
|
|
|
- if (lg!= null&&(domain.getId()==null||!lg.getId().equals(domain.getId()))) {
|
|
|
|
|
|
+ UserEntity lg = getByLoginName(domain.getLoginName());
|
|
|
|
+ if (lg != null && (domain.getId() == null || !lg.getId().equals(domain.getId()))) {
|
|
throw new StatusException("登录名已存在");
|
|
throw new StatusException("登录名已存在");
|
|
}
|
|
}
|
|
ue.setLoginName(domain.getLoginName());
|
|
ue.setLoginName(domain.getLoginName());
|
|
@@ -140,9 +143,9 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|
InputStream inputStream = null;
|
|
InputStream inputStream = null;
|
|
try {
|
|
try {
|
|
inputStream = file.getInputStream();
|
|
inputStream = file.getInputStream();
|
|
- ExcelReader reader=ExcelReader.create(ExcelType.XLSX, inputStream, 0);
|
|
|
|
|
|
+ ExcelReader reader = ExcelReader.create(ExcelType.XLSX, inputStream, 0);
|
|
List<DataMap> lineList = reader.getDataMapList();
|
|
List<DataMap> lineList = reader.getDataMapList();
|
|
- if(!Arrays.equals(EXCEL_HEADER,reader.getColumnNames())) {
|
|
|
|
|
|
+ if (!Arrays.equals(EXCEL_HEADER, reader.getColumnNames())) {
|
|
throw new StatusException("Excel表头错误");
|
|
throw new StatusException("Excel表头错误");
|
|
}
|
|
}
|
|
if (CollectionUtils.isEmpty(lineList)) {
|
|
if (CollectionUtils.isEmpty(lineList)) {
|