瀏覽代碼

Merge remote-tracking branch 'remotes/origin/dev_1.0.0' into release_1.0.0

xiatian 2 年之前
父節點
當前提交
39151dd5fe
共有 1 個文件被更改,包括 10 次插入7 次删除
  1. 10 7
      src/main/java/cn/com/qmth/mps/service/impl/UserServiceImpl.java

+ 10 - 7
src/main/java/cn/com/qmth/mps/service/impl/UserServiceImpl.java

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