|
@@ -46,7 +46,7 @@ import cn.com.qmth.mps.vo.user.UserVo;
|
|
|
|
|
|
@Service
|
|
|
public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements UserService {
|
|
|
- private static final String defPassWd = "123456";
|
|
|
+ private static final String DEFAULT_PASSWD = "123456";
|
|
|
|
|
|
@Autowired
|
|
|
private UserCourseRelationService userCourseRelationService;
|
|
@@ -70,12 +70,15 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|
|
if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(domain.getSchoolId())) {
|
|
|
throw new StatusException("非法操作");
|
|
|
}
|
|
|
- if (domain.getName() == null) {
|
|
|
+ if (StringUtils.isBlank(domain.getName())) {
|
|
|
throw new StatusException("姓名不能为空");
|
|
|
}
|
|
|
- if (domain.getLoginName() == null) {
|
|
|
+ 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("角色不能为空");
|
|
|
}
|
|
@@ -96,7 +99,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|
|
throw new StatusException("登录名已存在");
|
|
|
}
|
|
|
ue = new UserEntity();
|
|
|
- ue.setPassword(ByteUtil.toHexAscii(SHA256.encode(defPassWd)));
|
|
|
+ ue.setPassword(ByteUtil.toHexAscii(SHA256.encode(domain.getPasswd())));
|
|
|
ue.setSchoolId(user.getSchoolId());
|
|
|
ue.setEnable(true);
|
|
|
ue.setLoginName(domain.getLoginName());
|
|
@@ -187,6 +190,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
|
|
}
|
|
|
for (int i = 0; i < userList.size(); i++) {
|
|
|
UserDomain cur = userList.get(i);
|
|
|
+ cur.setPasswd(DEFAULT_PASSWD);
|
|
|
try {
|
|
|
saveUser(cur, user);
|
|
|
} catch (StatusException e) {
|