BUG修复

pull/195/MERGE^2
dxfeng 3 years ago
parent e0b09bde52
commit ea64d13503

@ -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);
}
}
}

@ -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, "导入数据为空");
// 遍历每一行数据

Loading…
Cancel
Save