|
|
|
@ -193,9 +193,20 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
@Override
|
|
|
|
|
public Long updateForm(Map<String, Object> params) {
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
String ecCompanyId = Util.null2String(params.get("id"));
|
|
|
|
|
Integer ecDepartmentId = Integer.parseInt(Util.null2String(params.get("id")));
|
|
|
|
|
Integer supDepId = Integer.parseInt(Util.null2String(params.get("supdepid")));
|
|
|
|
|
// 不可选择合并的数据,本身及子部门
|
|
|
|
|
Set<Integer> disableIds = new HashSet<>();
|
|
|
|
|
// 添加选择部门本身
|
|
|
|
|
disableIds.add(ecDepartmentId);
|
|
|
|
|
List<DepartmentPO> deptListByPId = getDepartmentMapper().getDeptListByPId(ecDepartmentId);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(deptListByPId)) {
|
|
|
|
|
addDisableIds(disableIds, deptListByPId);
|
|
|
|
|
}
|
|
|
|
|
OrganizationAssert.isFalse(disableIds.contains(supDepId), "上级部门不能选择部门本身及其下级部门");
|
|
|
|
|
|
|
|
|
|
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, params).sync();
|
|
|
|
|
return Long.parseLong(ecCompanyId);
|
|
|
|
|
return (long) ecDepartmentId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -241,7 +252,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
|
|
|
|
|
List<SearchConditionGroup> groupList = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> itemList;
|
|
|
|
|
List<SearchConditionItem> extendItemList;
|
|
|
|
|
String id = Util.null2String(params.get("id"));
|
|
|
|
|
if (2 == viewAttr) {
|
|
|
|
|
params.put("viewattr", viewAttr);
|
|
|
|
@ -271,7 +281,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
if (!"1".equals(Util.null2String(HrmFieldGroupComInfo.getIsShow(groupId)))) continue;
|
|
|
|
|
String groupLabel = HrmFieldGroupComInfo.getLabel(groupId);
|
|
|
|
|
itemList = new ArrayList<>();
|
|
|
|
|
extendItemList = new ArrayList<>();
|
|
|
|
|
for (Object o : lsField) {
|
|
|
|
|
String fieldId = (String) o;
|
|
|
|
|
String isUse = HrmFieldComInfo.getIsused(fieldId);
|
|
|
|
@ -318,11 +327,8 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
searchConditionItem.setViewAttr(viewAttr);
|
|
|
|
|
if ("1".equals(isSystem)) {
|
|
|
|
|
itemList.add(searchConditionItem);
|
|
|
|
|
} else {
|
|
|
|
|
extendItemList.add(searchConditionItem);
|
|
|
|
|
}
|
|
|
|
|
itemList.add(searchConditionItem);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int operateLevel;
|
|
|
|
@ -366,9 +372,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
itemList.add(searchConditionItem);
|
|
|
|
|
}
|
|
|
|
|
groupList.add(new SearchConditionGroup(SystemEnv.getHtmlLabelNames(groupLabel, user.getLanguage()), true, itemList));
|
|
|
|
|
if (CollectionUtils.isNotEmpty(extendItemList)) {
|
|
|
|
|
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -816,21 +820,16 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
* @param parentComp
|
|
|
|
|
*/
|
|
|
|
|
private void refreshJobComp(Integer parentDepartment, Integer parentComp) {
|
|
|
|
|
//List<JobPO> jobPOS = getJobMapper().listJobsByDepartmentId(parentDepartment);
|
|
|
|
|
//jobPOS = jobPOS.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
|
|
|
|
|
//if (CollectionUtils.isNotEmpty(jobPOS)) {
|
|
|
|
|
// getJobMapper().updateJobCompany(jobPOS.stream().map(JobPO::getId).collect(Collectors.toList()), parentComp, parentComp);
|
|
|
|
|
// for (JobPO jobPO : jobPOS) {
|
|
|
|
|
// // 刷新组织架构图
|
|
|
|
|
// new JobTriggerRunnable(jobPO.getId()).run();
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
List<JobPO> jobPOS = getJobMapper().listJobsByDepartmentId(parentDepartment);
|
|
|
|
|
jobPOS = jobPOS.stream().filter(item -> null == item.getParentJob() || 0 == item.getParentJob()).collect(Collectors.toList());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(jobPOS)) {
|
|
|
|
|
getJobMapper().updateJobCompany(jobPOS.stream().map(JobPO::getId).collect(Collectors.toList()), parentComp, parentComp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<SearchConditionGroup> getDepartmentConditionGroups(Map<String, Object> params) {
|
|
|
|
|
List<SearchConditionGroup> groupList = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> itemList;
|
|
|
|
|
List<SearchConditionItem> extendItemList;
|
|
|
|
|
|
|
|
|
|
String id = Util.null2String(params.get("id"));
|
|
|
|
|
int viewAttr = Util.getIntValue(Util.null2String(params.get("viewattr")), 1);
|
|
|
|
@ -863,7 +862,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
boolean groupHide = lsField.size() == 0 || hfm.getGroupCount(lsField) == 0 || !"1".equals(Util.null2String(HrmFieldGroupComInfo.getIsShow(groupId)));
|
|
|
|
|
String grouplabel = HrmFieldGroupComInfo.getLabel(groupId);
|
|
|
|
|
itemList = new ArrayList<>();
|
|
|
|
|
extendItemList = new ArrayList<>();
|
|
|
|
|
for (Object o : lsField) {
|
|
|
|
|
String fieldId = (String) o;
|
|
|
|
|
String fieldName = HrmFieldComInfo.getFieldname(fieldId);
|
|
|
|
@ -946,17 +944,12 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|
|
|
|
otherParams1.put("showOrder", false);
|
|
|
|
|
searchConditionItem.setOtherParams(otherParams1);
|
|
|
|
|
}
|
|
|
|
|
if ("1".equals(isSystem)) {
|
|
|
|
|
itemList.add(searchConditionItem);
|
|
|
|
|
} else {
|
|
|
|
|
extendItemList.add(searchConditionItem);
|
|
|
|
|
}
|
|
|
|
|
itemList.add(searchConditionItem);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
groupList.add(new SearchConditionGroup(SystemEnv.getHtmlLabelNames(grouplabel, user.getLanguage()), true, itemList));
|
|
|
|
|
if (CollectionUtils.isNotEmpty(extendItemList)) {
|
|
|
|
|
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return groupList;
|
|
|
|
|
}
|
|
|
|
|