部门查看、编辑接口调整

pull/83/head
dxfeng 2 years ago
parent 6fc67d7d67
commit 37dc31b7b5

@ -187,10 +187,7 @@ public class CompServiceImpl extends Service implements CompService {
if (2 == viewAttr) {
params.put("viewattr", viewAttr);
Object condition = getCompSaveForm(params).get("condition");
if (condition instanceof List) {
groupList = getCompanyConditionGroups(params);
}
groupList = getCompanyConditionGroups(params);
} else {
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
@ -209,18 +206,24 @@ public class CompServiceImpl extends Service implements CompService {
for (int tmp = 0; lsGroup != null && tmp < lsGroup.size(); tmp++) {
String groupId = (String) lsGroup.get(tmp);
List lsField = hfm.getLsField(groupId);
if (lsField.size() == 0)
if (lsField.size() == 0) {
continue;
}
if (hfm.getGroupCount(lsField) == 0) {
continue;
if (hfm.getGroupCount(lsField) == 0)
}
if (!"1".equals(Util.null2String(HrmFieldGroupComInfo.getIsShow(groupId)))) {
continue;
if (!Util.null2String(HrmFieldGroupComInfo.getIsShow(groupId)).equals("1")) continue;
}
String groupLabel = HrmFieldGroupComInfo.getLabel(groupId);
itemList = new ArrayList<>();
for (Object o : lsField) {
String fieldId = (String) o;
String isUse = HrmFieldComInfo.getIsused(fieldId);
if (!isUse.equals("1")) continue;
if (!"1".equals(isUse)) {
continue;
}
String fieldName = HrmFieldComInfo.getFieldname(fieldId);
String fieldLabel = HrmFieldComInfo.getLabel(fieldId);
String fieldHtmlType = HrmFieldComInfo.getFieldhtmltype(fieldId);
@ -228,18 +231,20 @@ public class CompServiceImpl extends Service implements CompService {
String dmlUrl = Util.null2String(HrmFieldComInfo.getFieldDmlurl(fieldId));
String isSystem = HrmFieldComInfo.getIssystem(fieldId);
String fieldValue;
if (isSystem.equals("1")) {
if ("1".equals(isSystem)) {
fieldValue = hfm.getData(fieldName);
} else {
fieldValue = hfm.getData("hrmsubcompanydefined", fieldName);
}
if ("84".equals(fieldId)) {
if (user.getUID() != 1) continue;
fieldValue = fieldValue.equals("0") ? "" : fieldValue;
if (user.getUID() != 1) {
continue;
}
fieldValue = "0".equals(fieldValue) ? "" : fieldValue;
}
if (id.length() > 0 && fieldName.equals("subshowid")) {
if (id.length() > 0 && "subshowid".equals(fieldName)) {
fieldValue = id;
}
@ -257,7 +262,7 @@ public class CompServiceImpl extends Service implements CompService {
if (searchConditionItem.getBrowserConditionParam() != null) {
searchConditionItem.getBrowserConditionParam().setViewAttr(viewAttr);
}
if (fieldName.equals("showorder")) {
if ("showorder".equals(fieldName)) {
searchConditionItem.setPrecision(2);
}

@ -12,6 +12,7 @@ import com.engine.core.impl.Service;
import com.engine.hrm.entity.RuleCodeType;
import com.engine.hrm.service.impl.OrganizationServiceImpl;
import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.TopTab;
import com.engine.organization.entity.codesetting.po.CodeRulePO;
import com.engine.organization.entity.company.bo.CompBO;
import com.engine.organization.entity.company.po.CompPO;
@ -20,7 +21,6 @@ import com.engine.organization.entity.department.dto.DepartmentListDTO;
import com.engine.organization.entity.department.param.*;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.department.vo.SingleDeptTreeVO;
import com.engine.organization.entity.extend.po.ExtendTitlePO;
import com.engine.organization.entity.job.bo.JobBO;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.job.vo.SingleJobTreeVO;
@ -32,10 +32,8 @@ import com.engine.organization.exception.OrganizationRunTimeException;
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.service.DepartmentService;
import com.engine.organization.service.ExtService;
import com.engine.organization.thread.JobTriggerRunnable;
import com.engine.organization.thread.OrganizationSyncEc;
import com.engine.organization.util.*;
@ -52,12 +50,14 @@ import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.StringUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.definedfield.HrmDeptFieldManagerE9;
import weaver.hrm.definedfield.HrmFieldComInfo;
import weaver.hrm.definedfield.HrmFieldGroupComInfo;
import weaver.hrm.moduledetach.ManageDetachComInfo;
import weaver.systeminfo.SystemEnv;
import weaver.systeminfo.systemright.CheckSubCompanyRight;
import java.util.*;
import java.util.stream.Collectors;
@ -70,34 +70,8 @@ import java.util.stream.Collectors;
**/
public class DepartmentServiceImpl extends Service implements DepartmentService {
/**
*
* 1
* 2
* 3
*/
private static final String EXTEND_TYPE = "2";
/**
*
*/
private static final String JCL_ORG_DEPT = "JCL_ORG_DEPT";
/**
*
*/
private static final String JCL_ORG_DEPTEXT = "JCL_ORG_DEPTEXT";
/**
*
*/
private static final String JCL_ORG_DEPTEXT_DT1 = "JCL_ORG_DEPTEXT_DT1";
private static final String RIGHT_NAME = "Department:All";
/**
* titleID
*/
private static final Long GROUP_ID = 2L;
private static DepartmentMapper getDepartmentMapper() {
return MapperProxyFactory.getProxy(DepartmentMapper.class);
}
@ -110,19 +84,10 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
return MapperProxyFactory.getProxy(CompMapper.class);
}
private ExtendTitleMapper getExtendTitleMapper() {
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
}
private ExtService getExtService(User user) {
return ServiceUtil.getService(ExtServiceImpl.class, user);
}
@Override
public PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) {
//1.查询分部下所有部门
//PageUtil.start(param.getCurrent(), param.getPageSize());
List<DepartmentPO> departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).listAll("showOrder");
PageInfo<DepartmentPO> pageInfo = new PageInfo<>(departmentPOS);
List<SingleDeptTreeVO> singleDeptTreeVOS = DepartmentBO.buildSingleDeptTreeVOS(departmentPOS, param.getParentComp());
@ -167,7 +132,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(param, user.getUID());
boolean filter = isFilter(departmentPO);
PageInfo<DepartmentListDTO> pageInfos;
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams()," showorder ");
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams(), " showorder ");
List<DepartmentPO> allList = getDepartmentMapper().listAll(orderSql);
new DetachUtil(user.getUID()).filterDepartmentList(allList);
// 通过子级遍历父级元素
@ -272,194 +237,162 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
@Override
public Map<String, Object> getDeptBaseForm(Map<String, Object> params) {
OrganizationAssert.notNull(params.get("viewAttr"), "请标识操作类型");
// 2编辑 1查看
int viewAttr = Integer.parseInt((String) params.get("viewAttr"));
long id = Long.parseLong((String) params.get("id"));
String groupId = (String) params.get("viewCondition");
HashMap<String, Object> buttonsMap = new HashMap<>();
buttonsMap.put("hasEdit", true);
buttonsMap.put("hasSave", true);
List<SearchConditionGroup> addGroups = new ArrayList<>();
if ("0".equals(groupId)) {
groupId = GROUP_ID.toString();
}
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(Long.parseLong(groupId), "1");
if (CollectionUtils.isNotEmpty(extendTitles)) {
for (ExtendTitlePO extendTitle : extendTitles) {
List<SearchConditionItem> items = getExtService(user).getExtForm(user, EXTEND_TYPE + "", GROUP_ID.equals(Long.parseLong(groupId)) ? JCL_ORG_DEPT : JCL_ORG_DEPTEXT, viewAttr, id, extendTitle.getId().toString(), "");
if (CollectionUtils.isNotEmpty(items)) {
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items));
}
}
}
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("buttons", buttonsMap);
resultMap.put("conditions", addGroups);
resultMap.put("id", id);
// 拓展页面分组
resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_DEPTEXT));
// 处理明细表
resultMap.put("tables", getExtService(user).getExtendTables(user, EXTEND_TYPE, Long.parseLong(groupId), JCL_ORG_DEPTEXT_DT1, id, viewAttr, false));
Map<String, Object> apiDatas = new HashMap<>();
apiDatas.put("result", resultMap);
return apiDatas;
}
@Override
public Map<String, Object> getSaveForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
Map<String, Object> apiDatas = new HashMap<>();
List<Map<String, Object>> groupList = new ArrayList<>();
Map<String, Object> groupItem;
List<Object> itemList;
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);
String nodeType = Util.null2String(params.get("type"));
String addType = Util.null2String(params.get("addType"));
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
String subcompanyid1 = "";
String supDepId = "";
switch (addType) {
case "normal":
if (nodeType.equals("subcompany")) {
subcompanyid1 = id;
} else {
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
}
break;
case "sibling":
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
supDepId = departmentComInfo.getDepartmentsupdepid(id);
break;
case "child":
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
supDepId = id;
break;
}
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
SearchConditionItem searchConditionItem;
HrmFieldBean hrmFieldBean;
HrmDeptFieldManagerE9 hfm;
try {
hfm = new HrmDeptFieldManagerE9(5);
} catch (Exception e) {
throw new OrganizationRunTimeException("");
}
hfm.isReturnDecryptData(true);
hfm.getCustomData(Util.getIntValue(id));
List lsGroup = hfm.getLsGroup();
for (int tmp = 0; lsGroup != null && tmp < lsGroup.size(); tmp++) {
String groupid = (String) lsGroup.get(tmp);
List lsField = hfm.getLsField(groupid);
if (2 == viewAttr) {
params.put("viewattr", viewAttr);
groupList = getDepartmentConditionGroups(params);
} else {
boolean groupHide = lsField.size() == 0 || hfm.getGroupCount(lsField) == 0 || !Util.null2String(HrmFieldGroupComInfo.getIsShow(groupid)).equals("1");
String grouplabel = HrmFieldGroupComInfo.getLabel(groupid);
itemList = new ArrayList<>();
groupItem = new HashMap<>();
groupItem.put("title", SystemEnv.getHtmlLabelNames(grouplabel, user.getLanguage()));
groupItem.put("hide", groupHide);
groupItem.put("defaultshow", true);
for (Object o : lsField) {
String fieldId = (String) o;
String fieldName = HrmFieldComInfo.getFieldname(fieldId);
String isUse = HrmFieldComInfo.getIsused(fieldId);
if (!isUse.equals("1")) continue;
int tmpViewAttr = viewAttr;
String rules = "";
String fieldLabel = HrmFieldComInfo.getLabel(fieldId);
String fieldHtmlType = HrmFieldComInfo.getFieldhtmltype(fieldId);
String type = HrmFieldComInfo.getFieldType(fieldId);
String dmlUrl = Util.null2String(HrmFieldComInfo.getFieldDmlurl(fieldId));
String fieldValue = "";
if (StringUtils.isBlank(addType)) {
if (HrmFieldComInfo.getIssystem(fieldId).equals("1")) {
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
SearchConditionItem searchConditionItem;
HrmFieldBean hrmFieldBean;
HrmDeptFieldManagerE9 hfm;
try {
hfm = new HrmDeptFieldManagerE9(5);
} catch (Exception e) {
throw new RuntimeException(e);
}
hfm.getCustomData(Util.getIntValue(id));
List lsGroup = hfm.getLsGroup();
for (int tmp = 0; lsGroup != null && tmp < lsGroup.size(); tmp++) {
String groupId = (String) lsGroup.get(tmp);
List lsField = hfm.getLsField(groupId);
if (lsField.size() == 0)
continue;
if (hfm.getGroupCount(lsField) == 0)
continue;
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);
if (!"1".equals(isUse)) continue;
String fieldName = HrmFieldComInfo.getFieldname(fieldId);
String fieldLabel = HrmFieldComInfo.getLabel(fieldId);
String fieldHtmlType = HrmFieldComInfo.getFieldhtmltype(fieldId);
String type = HrmFieldComInfo.getFieldType(fieldId);
String dmlUrl = Util.null2String(HrmFieldComInfo.getFieldDmlurl(fieldId));
String isSystem = HrmFieldComInfo.getIssystem(fieldId);
String fieldValue;
if ("1".equals(isSystem)) {
fieldValue = hfm.getData(fieldName);
} else {
fieldValue = hfm.getData("hrmdepartmentdefined", fieldName);
}
}
if (!groupHide && tmpViewAttr == 2 && HrmFieldComInfo.getIsmand(fieldId).equals("1")) {
tmpViewAttr = 3;
if ("1".equals(fieldHtmlType) && "2".equals(type)) {
rules = "required|integer";
} else {
rules = "required|string";
if (id.length() > 0 && "showid".equals(fieldName)) {
fieldValue = id;
}
}
if (subcompanyid1.length() > 0 && fieldName.equals("subcompanyid1")) {
fieldValue = subcompanyid1;
}
hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldid(fieldId);
hrmFieldBean.setFieldname(fieldName);
hrmFieldBean.setFieldlabel(fieldLabel);
hrmFieldBean.setFieldhtmltype(fieldHtmlType);
hrmFieldBean.setType(type);
hrmFieldBean.setIsFormField(true);
hrmFieldBean.setFieldvalue(fieldValue);
hrmFieldBean.setDmlurl(dmlUrl);
hrmFieldBean.setIssystem("1");
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
if (searchConditionItem.getBrowserConditionParam() != null) {
searchConditionItem.getBrowserConditionParam().setViewAttr(viewAttr);
}
if ("showorder".equals(fieldName)) {
searchConditionItem.setPrecision(2);
}
if (supDepId.length() > 0 && fieldName.equals("supdepid")) {
fieldValue = supDepId;
}
if ("6".equals(fieldHtmlType)) {//附件
Map<String, Object> otherParams1 = new HashMap<>();
otherParams1.put("showOrder", false);
searchConditionItem.setOtherParams(otherParams1);
}
if (fieldName.equals("showid")) {
if (addType.length() > 0) {
continue;
searchConditionItem.setViewAttr(viewAttr);
if ("1".equals(isSystem)) {
itemList.add(searchConditionItem);
} else {
fieldValue = id;
tmpViewAttr = 1;
extendItemList.add(searchConditionItem);
}
}
hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldid(fieldId);
hrmFieldBean.setFieldname(fieldName);
hrmFieldBean.setFieldlabel(fieldLabel);
hrmFieldBean.setFieldhtmltype(fieldHtmlType);
hrmFieldBean.setType(type);
hrmFieldBean.setIsFormField(true);
hrmFieldBean.setIssystem("1");
hrmFieldBean.setFieldvalue(fieldValue);
hrmFieldBean.setDmlurl(dmlUrl);
hrmFieldBean.setViewAttr(tmpViewAttr);
hrmFieldBean.setRules(rules);
if (hrmFieldBean.getFieldname().equals("subcompanyid1") || hrmFieldBean.getFieldname().equals("supdepid")) {
hrmFieldBean.setHideVirtualOrg(true);
}
if (hrmFieldBean.getFieldname().equals("departmentcode")) {
hrmFieldBean.setMultilang(false);
int operateLevel;
ManageDetachComInfo manageDetachComInfo = new ManageDetachComInfo();
boolean hrmDetachAble = manageDetachComInfo.isUseHrmManageDetach();
if (hrmDetachAble) {
CheckSubCompanyRight checkSubCompanyRight = new CheckSubCompanyRight();
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
operateLevel = checkSubCompanyRight.ChkComRightByUserRightCompanyId(user.getUID(), "HrmDepartmentEdit:Edit", Integer.parseInt(departmentComInfo.getSubcompanyid1(id)));
} else {
operateLevel = 2;
}
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
if (searchConditionItem != null) {
searchConditionItem.setLabelcol(8);
searchConditionItem.setFieldcol(16);
if (fieldName.equals("showorder")) {
searchConditionItem.setPrecision(2);
}
if (fieldName.equals("showid")) {
Map<String, Object> otherParams = new HashMap<>();
otherParams.put("hasBorder", true);
searchConditionItem.setOtherParams(otherParams);
if (tmp == 0 && HrmUserVarify.checkUserRight("HrmDepartmentEdit:Edit", user) && operateLevel > 0) {
int resourceNum = 0;
RecordSet rs = new RecordSet();
String sql = "SELECT COUNT(*) FROM hrmresource WHERE departmentid = " + id + " and ( status =0 or status = 1 or status = 2 or status = 3)";
rs.execute(sql);
if (rs.next()) {
resourceNum = rs.getInt(1);
}
if ("6".equals(fieldHtmlType)) {//附件
Map<String, Object> otherParams1 = new HashMap<>();
otherParams1.put("showOrder", false);
searchConditionItem.setOtherParams(otherParams1);
//4:解聘 5:离职 6:退休 7:无效
int resourceNum1 = 0;
sql = "SELECT COUNT(*) FROM hrmresource WHERE departmentid = " + id + " and status in(4,5,6,7)";
rs.execute(sql);
if (rs.next()) {
resourceNum1 = rs.getInt(1);
}
hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldname("deptResourceInfo");
hrmFieldBean.setFieldlabel("382428");
hrmFieldBean.setFieldhtmltype("1");
hrmFieldBean.setType("1");
hrmFieldBean.setIsFormField(true);
hrmFieldBean.setFieldvalue(resourceNum + "/" + resourceNum1);
hrmFieldBean.setDmlurl("");
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
searchConditionItem.setViewAttr(viewAttr);
itemList.add(searchConditionItem);
}
groupList.add(new SearchConditionGroup(SystemEnv.getHtmlLabelNames(groupLabel, user.getLanguage()), true, itemList));
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
}
groupItem.put("items", itemList);
groupList.add(groupItem);
}
apiDatas.put("condition", groupList);
HashMap<String, Object> buttonsMap = new HashMap<>();
buttonsMap.put("hasEdit", true);
buttonsMap.put("hasSave", true);
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("buttons", buttonsMap);
resultMap.put("conditions", groupList);
resultMap.put("id", id);
List<TopTab> topTabs = new ArrayList<>();
topTabs.add(TopTab.builder().color("#000000").groupId("4").showcount(false).title("部门信息").viewCondition("4").build());
resultMap.put("tabInfo", topTabs);
Map<String, Object> apiDatas = new HashMap<>();
apiDatas.put("result", resultMap);
return apiDatas;
}
@Override
public Map<String, Object> getSaveForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
Map<String, Object> apiDatas = new HashMap<>();
apiDatas.put("condition", getDepartmentConditionGroups(params));
return apiDatas;
}
@ -626,7 +559,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
// 更新子部门下岗位的所属分部
for (DepartmentPO departmentPO : firstChildDeptList) {
List<DepartmentPO> deptList = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
forbiddenChildTag(targetDepartment.getSubCompanyId1(), Util.null2String(targetDepartment.getSubCompanyId1()), deptList);
forbiddenChildTag(targetDepartment.getSubCompanyId1(), deptList);
}
// 原部门删除
// DepartmentPO mergeDepartment = getDepartmentMapper().getDeptById(mergeParam.getId());
@ -713,7 +646,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
//for (Long hrmResourceId : hrmResourceIds) {
//TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
//}
forbiddenChildTag(deptById.getSubCompanyId1(), Util.null2String(deptById.getSubCompanyId1()), deptList);
forbiddenChildTag(deptById.getSubCompanyId1(), deptList);
// 递归更新下级部门、岗位
return 1;
}
@ -721,20 +654,20 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
/**
* id
*
* @param parentComp
* @param subCompanyId1
* @param deptList
*/
void forbiddenChildTag(Integer parentComp, String ecCompanyId, List<DepartmentPO> deptList) {
void forbiddenChildTag(Integer subCompanyId1, List<DepartmentPO> deptList) {
if (CollectionUtils.isNotEmpty(deptList)) {
for (DepartmentPO departmentPO : deptList) {
departmentPO.setSubCompanyId1(parentComp);
departmentPO.setSubCompanyId1(subCompanyId1);
// 更新EC表部门
updateEcDepartment(departmentPO);
updateEcDepartment(departmentPO);
// 更新组织架构图
// TODO new DepartmentTriggerRunnable(departmentPO.getId()).run();
// 刷新岗位所属分部
refreshJobComp(departmentPO.getId(), parentComp);
refreshJobComp(departmentPO.getId(), subCompanyId1);
// 更新当前部门下的人员
// String ecDepartmentId = EcHrmRelationUtil.getEcDepartmentId(departmentPO.getId().toString());
//new RecordSet().executeUpdate("update hrmresource set SUBCOMPANYID1 =? where DEPARTMENTID = ?", ecCompanyId, ecDepartmentId);
@ -745,7 +678,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
//TODO new HrmResourceTriggerRunnable(hrmResourceId).run();
//}
List<DepartmentPO> childList = getDepartmentMapper().getDeptListByPId(departmentPO.getId());
forbiddenChildTag(parentComp, ecCompanyId, childList);
forbiddenChildTag(subCompanyId1, childList);
}
}
}
@ -892,7 +825,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
map.put("showorder", Util.null2String(departmentPO.getShowOrder()));
map.put("departmentcode", departmentPO.getDepartmentCode());
map.put("coadjutant", Util.null2String(departmentPO.getCoadjutant()));
map.put("id", Util.null2String(departmentPO.getId()));
map.put("id", Util.null2String(departmentPO.getId()));
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.UPDATE, map).sync();
}
@ -913,17 +846,6 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
return new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.ADD, map).sync();
}
/**
* EC
*
* @param id
*/
private void cancelEcDepartment(Long id) {
Map<String, Object> map = new HashMap<>();
map.put("id", id);
map.put("forbiddenTag", 1);
new OrganizationSyncEc(user, LogModuleNameEnum.DEPARTMENT, OperateTypeEnum.CANCELED, map).sync();
}
private void addDisableIds(Set<Integer> disableIds, List<DepartmentPO> deptListByPId) {
for (DepartmentPO departmentPO : deptListByPId) {
@ -951,4 +873,154 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
}
}
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);
String nodeType = Util.null2String(params.get("type"));
String addType = Util.null2String(params.get("addType"));
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
String subcompanyid1 = "";
String supDepId = "";
switch (addType) {
case "normal":
if ("subcompany".equals(nodeType)) {
subcompanyid1 = id;
} else {
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
}
break;
case "sibling":
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
supDepId = departmentComInfo.getDepartmentsupdepid(id);
break;
case "child":
subcompanyid1 = departmentComInfo.getSubcompanyid1(id);
supDepId = id;
break;
default:
break;
}
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
SearchConditionItem searchConditionItem;
HrmFieldBean hrmFieldBean;
HrmDeptFieldManagerE9 hfm;
try {
hfm = new HrmDeptFieldManagerE9(5);
} catch (Exception e) {
throw new OrganizationRunTimeException("");
}
hfm.isReturnDecryptData(true);
hfm.getCustomData(Util.getIntValue(id));
List lsGroup = hfm.getLsGroup();
for (int tmp = 0; lsGroup != null && tmp < lsGroup.size(); tmp++) {
String groupId = (String) lsGroup.get(tmp);
List lsField = hfm.getLsField(groupId);
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);
String isUse = HrmFieldComInfo.getIsused(fieldId);
if (!"1".equals(isUse)) continue;
int tmpViewAttr = viewAttr;
String rules = "";
String fieldLabel = HrmFieldComInfo.getLabel(fieldId);
String fieldHtmlType = HrmFieldComInfo.getFieldhtmltype(fieldId);
String type = HrmFieldComInfo.getFieldType(fieldId);
String dmlUrl = Util.null2String(HrmFieldComInfo.getFieldDmlurl(fieldId));
String isSystem = HrmFieldComInfo.getIssystem(fieldId);
String fieldValue = "";
if (StringUtils.isBlank(addType)) {
if ("1".equals(isSystem)) {
fieldValue = hfm.getData(fieldName);
} else {
fieldValue = hfm.getData("hrmdepartmentdefined", fieldName);
}
}
if (!groupHide && tmpViewAttr == 2 && "1".equals(HrmFieldComInfo.getIsmand(fieldId))) {
tmpViewAttr = 3;
if ("1".equals(fieldHtmlType) && "2".equals(type)) {
rules = "required|integer";
} else {
rules = "required|string";
}
}
if (subcompanyid1.length() > 0 && "subcompanyid1".equals(fieldName)) {
fieldValue = subcompanyid1;
}
if (supDepId.length() > 0 && "supdepid".equals(fieldName)) {
fieldValue = supDepId;
}
if ("showid".equals(fieldName)) {
if (addType.length() > 0) {
continue;
} else {
fieldValue = id;
tmpViewAttr = 1;
}
}
hrmFieldBean = new HrmFieldBean();
hrmFieldBean.setFieldid(fieldId);
hrmFieldBean.setFieldname(fieldName);
hrmFieldBean.setFieldlabel(fieldLabel);
hrmFieldBean.setFieldhtmltype(fieldHtmlType);
hrmFieldBean.setType(type);
hrmFieldBean.setIsFormField(true);
hrmFieldBean.setIssystem("1");
hrmFieldBean.setFieldvalue(fieldValue);
hrmFieldBean.setDmlurl(dmlUrl);
hrmFieldBean.setViewAttr(tmpViewAttr);
hrmFieldBean.setRules(rules);
if ("subcompanyid1".equals(hrmFieldBean.getFieldname()) || "supdepid".equals(hrmFieldBean.getFieldname())) {
hrmFieldBean.setHideVirtualOrg(true);
}
if ("departmentcode".equals(hrmFieldBean.getFieldname())) {
hrmFieldBean.setMultilang(false);
}
searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
if (searchConditionItem != null) {
searchConditionItem.setLabelcol(8);
searchConditionItem.setFieldcol(16);
if ("showorder".equals(fieldName)) {
searchConditionItem.setPrecision(2);
}
if ("showid".equals(fieldName)) {
Map<String, Object> otherParams = new HashMap<>();
otherParams.put("hasBorder", true);
searchConditionItem.setOtherParams(otherParams);
}
if ("6".equals(fieldHtmlType)) {//附件
Map<String, Object> otherParams1 = new HashMap<>();
otherParams1.put("showOrder", false);
searchConditionItem.setOtherParams(otherParams1);
}
if ("1".equals(isSystem)) {
itemList.add(searchConditionItem);
} else {
extendItemList.add(searchConditionItem);
}
}
}
groupList.add(new SearchConditionGroup(SystemEnv.getHtmlLabelNames(grouplabel, user.getLanguage()), true, itemList));
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
}
return groupList;
}
}

Loading…
Cancel
Save