commit
616cbbc3f8
|
|
@ -401,6 +401,8 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
int maxShowOrder = getDepartmentMapper().getMaxShowOrder();
|
||||
for (int i = 0; i < idList.size(); i++) {
|
||||
DepartmentPO deptById = getDepartmentMapper().getDeptById(idList.get(i));
|
||||
deptById.setDeptName(deptById.getDeptName() + "[复制]");
|
||||
deptById.setDeptNameShort(deptById.getDeptNameShort() + "[复制]");
|
||||
// 处理自动编号
|
||||
deptById.setDeptNo(CodeRuleUtil.generateCode(RuleCodeType.DEPARTMENT, deptById.getDeptNo(), false));
|
||||
deptById.setParentComp(Long.parseLong(copyParam.getCompany()));
|
||||
|
|
@ -408,8 +410,8 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
// 显示顺序字段
|
||||
deptById.setShowOrder(maxShowOrder + i + 1);
|
||||
insertCount += getDepartmentMapper().insertIgnoreNull(deptById);
|
||||
// 更新EC表部门
|
||||
updateEcDepartment(deptById);
|
||||
// 新增EC表部门
|
||||
addEcDepartment(deptById);
|
||||
// 新增岗位信息
|
||||
if ("1".equals(copyParam.getCopyJob())) {
|
||||
List<JobPO> jobPOS = MapperProxyFactory.getProxy(JobMapper.class).listJobsByDepartmentId(idList.get(i));
|
||||
|
|
@ -509,8 +511,13 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
// TODO 判断是否选择子部门
|
||||
Long department = moveParam.getDepartment();
|
||||
OrganizationAssert.notNull(department, "请选择要转移到的部门");
|
||||
getDepartmentMapper().getDeptListByPId(moveParam.getId());
|
||||
|
||||
List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(moveParam.getId());
|
||||
Set<Long> disableIds = new HashSet<>();
|
||||
disableIds.add(moveParam.getId());
|
||||
if (CollectionUtils.isNotEmpty(deptListByPId)) {
|
||||
addDisableIds(disableIds, deptListByPId);
|
||||
}
|
||||
OrganizationAssert.isFalse(disableIds.contains(department), "请勿选择当前部门本身及其子部门");
|
||||
deptById.setParentDept(department);
|
||||
DepartmentPO parentDepartment = getDepartmentMapper().getDeptById(department);
|
||||
deptById.setParentComp(parentDepartment.getParentComp());
|
||||
|
|
@ -671,6 +678,24 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
new Thread(new OrganizationRunable(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map)).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增EC表部门
|
||||
*
|
||||
* @param departmentPO
|
||||
*/
|
||||
private void addEcDepartment(DepartmentPO departmentPO) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("dept_name_short", departmentPO.getDeptNameShort());
|
||||
map.put("dept_name", departmentPO.getDeptName());
|
||||
map.put("parent_comp", departmentPO.getParentComp());
|
||||
map.put("parent_dept", departmentPO.getParentDept());
|
||||
map.put("show_order", departmentPO.getShowOrder());
|
||||
map.put("dept_no", departmentPO.getDeptNo());
|
||||
map.put("dept_principal", departmentPO.getDeptPrincipal());
|
||||
map.put("id", departmentPO.getId());
|
||||
new Thread(new OrganizationRunable(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, map)).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 封存EC表部门
|
||||
*
|
||||
|
|
@ -682,4 +707,12 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
new Thread(new OrganizationRunable(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map)).start();
|
||||
}
|
||||
|
||||
private void addDisableIds(Set<Long> disableIds, List<DepartmentPO> deptListByPId) {
|
||||
for (DepartmentPO departmentPO : deptListByPId) {
|
||||
disableIds.add(departmentPO.getId());
|
||||
List<DepartmentPO> childDeptPOS = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
|
||||
addDisableIds(disableIds, childDeptPOS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
* extend_group
|
||||
*/
|
||||
private static final Long COMPANY_TYPE = 1L;
|
||||
private static final Long DEPARTMENT_TYPE = 1L;
|
||||
private static final Long JOB_TYPE = 1L;
|
||||
private static final Long DEPARTMENT_TYPE = 2L;
|
||||
private static final Long JOB_TYPE = 3L;
|
||||
|
||||
|
||||
private ExtendInfoMapper getExtendInfoMapper() {
|
||||
|
|
@ -697,7 +697,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
XSSFSheet sheetAt = workbook.getSheetAt(0);
|
||||
int lastRow = sheetAt.getLastRowNum();
|
||||
List<ExtendInfoPO> extendInfoPOS = new ArrayList<>();
|
||||
OrganizationAssert.isTrue(lastRow > 1, "导入数据为空");
|
||||
OrganizationAssert.isTrue(lastRow > 0, "导入数据为空");
|
||||
|
||||
|
||||
// 遍历每一行数据
|
||||
|
|
@ -884,7 +884,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
XSSFSheet sheetAt = workbook.getSheetAt(0);
|
||||
int lastRow = sheetAt.getLastRowNum();
|
||||
List<ExtendInfoPO> extendInfoPOS = new ArrayList<>();
|
||||
OrganizationAssert.isTrue(lastRow > 1, "导入数据为空");
|
||||
OrganizationAssert.isTrue(lastRow > 0, "导入数据为空");
|
||||
|
||||
|
||||
// 遍历每一行数据
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class HasRightUtil {
|
|||
* @return
|
||||
*/
|
||||
public static boolean hasRight(User user, String rightName, boolean isReturnFalse) {
|
||||
boolean hasRight = HrmUserVarify.checkUserRight("Scheme:All", user);
|
||||
boolean hasRight = HrmUserVarify.checkUserRight(rightName, user);
|
||||
if (!isReturnFalse) {
|
||||
OrganizationAssert.isTrue(hasRight, "暂无权限访问");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue