|
|
|
@ -266,6 +266,13 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity |
|
|
|
|
if (userId == null){ |
|
|
|
|
ExceptionCast.cast(HrmsCode.EMPLOYEE_USER_IS_NULL); |
|
|
|
|
} |
|
|
|
|
if (employeeInfoVO.getName().length() == 0 |
|
|
|
|
|| employeeInfoVO.getAccount().length() == 0 |
|
|
|
|
|| employeeInfoVO.getCompanyMail().length() == 0 |
|
|
|
|
|| employeeInfoVO.getJobNumber().length() == 0 |
|
|
|
|
|| employeeInfoVO.getPhone().length() == 0){ |
|
|
|
|
ExceptionCast.cast(HrmsCode.EMPLOYEE_INFO_NOT_NULL); |
|
|
|
|
} |
|
|
|
|
String account = employeeInfoVO.getAccount(); |
|
|
|
|
EmployeeEntity employee = new EmployeeEntity(); |
|
|
|
|
BeanUtils.copyProperties(employeeInfoVO, employee); |
|
|
|
@ -299,13 +306,16 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity |
|
|
|
|
UserEntity user = new UserEntity(); |
|
|
|
|
user.setAccount(employeeInfoVO.getAccount()); |
|
|
|
|
user.setCreateTime(new Date()); |
|
|
|
|
user.setMotifyTime(new Date()); |
|
|
|
|
Boolean result1 = this.getBaseMapper().insertUser(user); |
|
|
|
|
EmployeeEntity employee = new EmployeeEntity(); |
|
|
|
|
if (result1) { |
|
|
|
|
// 根据新增的user主键id新增初始密码
|
|
|
|
|
Boolean result6 = this.getBaseMapper().updatePassword(user.getId(), Md5Util.md5(PromptSuccess.RESET_PASSWORD + user.getId())); |
|
|
|
|
employee.setUserId(user.getId()); |
|
|
|
|
BeanUtils.copyProperties(employeeInfoVO, employee); |
|
|
|
|
Boolean result2 = this.getBaseMapper().insertEmployee(employee); |
|
|
|
|
if (result2) { |
|
|
|
|
if (result2 && result6) { |
|
|
|
|
Boolean result3 = this.getBaseMapper().insertDepartment(employee.getId(), employeeInfoVO.getDepartmentIds()); |
|
|
|
|
Boolean result4 = this.getBaseMapper().insertPosition(employee.getId(), employeeInfoVO.getPositionIds()); |
|
|
|
|
Boolean result5 = this.getBaseMapper().insertRole(user.getId(), employeeInfoVO.getRoleIds()); |
|
|
|
@ -360,6 +370,7 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity |
|
|
|
|
EmployeeExcelImport employeeExcelImport = new EmployeeExcelImport(); |
|
|
|
|
UserEntity user = new UserEntity(); |
|
|
|
|
EmployeeEntity employee = new EmployeeEntity(); |
|
|
|
|
// 获取所有的部门、职位、角色,excel文件中的数据对比
|
|
|
|
|
List<DepartmentVO> listDepartmentIdAndName = deptDao.listDepartmentIdAndName(); |
|
|
|
|
List<PositionVO> listPositionIdAndName = positionDao.listPositionIdAndName(); |
|
|
|
|
List<RoleVO> listRoleIdAndName = roleDao.listRoleIdAndName(); |
|
|
|
@ -383,12 +394,15 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity |
|
|
|
|
} |
|
|
|
|
user.setAccount(employeeExcelImport.getAccount()); |
|
|
|
|
user.setCreateTime(new Date()); |
|
|
|
|
user.setMotifyTime(new Date()); |
|
|
|
|
this.getBaseMapper().insertUser(user); |
|
|
|
|
// 根据新增的user主键id新增初始密码
|
|
|
|
|
this.getBaseMapper().updatePassword(user.getId(),Md5Util.md5(PromptSuccess.RESET_PASSWORD+user.getId())); |
|
|
|
|
BeanUtils.copyProperties(e, employee); |
|
|
|
|
employee.setUserId(user.getId()); |
|
|
|
|
this.getBaseMapper().insertEmployee(employee); |
|
|
|
|
// 部门
|
|
|
|
|
String[] departmentNames = employeeExcelImport.getDepartmentNameList().split(","); |
|
|
|
|
String[] departmentNames = employeeExcelImport.getDepartmentNameList().split("&"); |
|
|
|
|
if (departmentNames.length == 0) { |
|
|
|
|
ExceptionCast.cast(HrmsCode.EMPLOYEE_DEPARTMENT_IS_NULL); |
|
|
|
|
} |
|
|
|
@ -404,7 +418,7 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity |
|
|
|
|
} |
|
|
|
|
this.getBaseMapper().insertDepartment(employee.getId(), new ArrayList<>(deptIds)); |
|
|
|
|
// 职位
|
|
|
|
|
String[] positionNames = employeeExcelImport.getPositionNameList().split(","); |
|
|
|
|
String[] positionNames = employeeExcelImport.getPositionNameList().split("&"); |
|
|
|
|
if (positionNames.length == 0) { |
|
|
|
|
ExceptionCast.cast(HrmsCode.EMPLOYEE_POSITION_IS_NULL); |
|
|
|
|
} |
|
|
|
@ -420,7 +434,7 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity |
|
|
|
|
} |
|
|
|
|
this.getBaseMapper().insertPosition(employee.getId(), new ArrayList<>(positionIds)); |
|
|
|
|
// 角色
|
|
|
|
|
String[] roleNames = employeeExcelImport.getRoleNameList().split(","); |
|
|
|
|
String[] roleNames = employeeExcelImport.getRoleNameList().split("&"); |
|
|
|
|
if (roleNames.length == 0) { |
|
|
|
|
ExceptionCast.cast(HrmsCode.EMPLOYEE_ROLE_IS_NULL); |
|
|
|
|
} |
|
|
|
|