|
|
@@ -532,8 +532,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
{
|
|
|
// 验证是否存在这个用户
|
|
|
SysUser u = userMapper.checkJobNumber(user.getJobNumber(),company);
|
|
|
- if (StringUtils.isNull(u))
|
|
|
- {
|
|
|
+ if (StringUtils.isNull(u)){
|
|
|
user.setPassword(SecurityUtils.encryptPassword(password));
|
|
|
user.setCreateBy(operName);
|
|
|
user.setUserId(null);
|
|
|
@@ -563,18 +562,25 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
}
|
|
|
successNum++;
|
|
|
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
|
|
|
- }
|
|
|
- else if (isUpdateSupport)
|
|
|
- {
|
|
|
- BeanValidators.validateWithException(validator, user);
|
|
|
+ } else if (isUpdateSupport) {
|
|
|
+// BeanValidators.validateWithException(validator, user);
|
|
|
checkUserAllowed(u);
|
|
|
checkUserDataScope(u.getUserId());
|
|
|
user.setUserId(u.getUserId());
|
|
|
user.setUpdateBy(operName);
|
|
|
- SysUser sysUser = userMapper.selectByNikeName(u.getSuperiorName(),company);
|
|
|
- if (sysUser != null){
|
|
|
- user.setSuperiorId(sysUser.getUserId());
|
|
|
+ if (user.getSuperiorName()!=null&&!user.getSuperiorName().equals(u.getSuperiorName())){
|
|
|
+ SysUser sysUser = userMapper.selectByNikeName(user.getSuperiorName(),company);
|
|
|
+ if (sysUser != null){
|
|
|
+ user.setSuperiorId(sysUser.getUserId());
|
|
|
+ }
|
|
|
}
|
|
|
+ if (user.getDeptName()!=null&&!user.getDeptName().equals(u.getDeptName())){
|
|
|
+ SysDept sysDept = deptService.selectByDepName(user.getDeptName(), company);
|
|
|
+ if (sysDept !=null){
|
|
|
+ user.setDeptId(sysDept.getDeptId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
userMapper.updateUser(user);
|
|
|
successNum++;
|
|
|
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");
|