|
|
@@ -1,5 +1,7 @@
|
|
|
package com.ruoyi.system.service.impl;
|
|
|
|
|
|
+import java.sql.SQLException;
|
|
|
+import java.sql.SQLIntegrityConstraintViolationException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -552,6 +554,8 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
SysDept sysDept = deptService.selectByDepName(user.getDeptName(), company);
|
|
|
if (sysDept ==null){
|
|
|
throw new ServiceException("部门数据异常,找不到部门");
|
|
|
+ }else {
|
|
|
+ user.setDeptId(sysDept.getDeptId());
|
|
|
}
|
|
|
}
|
|
|
userMapper.insertUser(user);
|
|
|
@@ -584,6 +588,8 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
SysDept sysDept = deptService.selectByDepName(user.getDeptName(), company);
|
|
|
if (sysDept ==null){
|
|
|
throw new ServiceException("部门数据异常,找不到部门");
|
|
|
+ }else {
|
|
|
+ user.setDeptId(sysDept.getDeptId());
|
|
|
}
|
|
|
}
|
|
|
if (user.getRoleName()!=null&&!user.getRoleName().equals(u.getRoleName())){
|
|
|
@@ -613,7 +619,11 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
{
|
|
|
failureNum++;
|
|
|
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
|
|
|
-// failureMsg.append(msg + e.getMessage());
|
|
|
+ if (e instanceof ServiceException){
|
|
|
+ failureMsg.append(msg + e.getMessage());
|
|
|
+ }else if (e instanceof SQLException){
|
|
|
+ failureMsg.append("数据异常");
|
|
|
+ }
|
|
|
log.error(msg, e);
|
|
|
}
|
|
|
}
|