|
|
|
@ -12,19 +12,17 @@ import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.hrm.service.impl.OrganizationServiceImpl;
|
|
|
|
|
import com.engine.organization.component.OrganizationWeaTable;
|
|
|
|
|
import com.engine.organization.entity.DeleteParam;
|
|
|
|
|
import com.engine.organization.entity.TopTab;
|
|
|
|
|
import com.engine.organization.entity.company.bo.CompBO;
|
|
|
|
|
import com.engine.organization.entity.company.dto.CompListDTO;
|
|
|
|
|
import com.engine.organization.entity.company.param.CompParam;
|
|
|
|
|
import com.engine.organization.entity.company.po.CompPO;
|
|
|
|
|
import com.engine.organization.entity.department.param.DepartmentMoveParam;
|
|
|
|
|
import com.engine.organization.entity.extend.po.ExtendTitlePO;
|
|
|
|
|
import com.engine.organization.enums.LogModuleNameEnum;
|
|
|
|
|
import com.engine.organization.enums.OperateTypeEnum;
|
|
|
|
|
import com.engine.organization.exception.OrganizationRunTimeException;
|
|
|
|
|
import com.engine.organization.mapper.comp.CompMapper;
|
|
|
|
|
import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
|
|
|
|
import com.engine.organization.service.CompService;
|
|
|
|
|
import com.engine.organization.service.ExtService;
|
|
|
|
|
import com.engine.organization.thread.OrganizationSyncEc;
|
|
|
|
|
import com.engine.organization.util.*;
|
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
@ -34,13 +32,16 @@ import com.engine.organization.util.page.PageInfo;
|
|
|
|
|
import com.engine.organization.util.page.PageUtil;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
|
import weaver.hrm.HrmUserVarify;
|
|
|
|
|
import weaver.hrm.company.SubCompanyComInfo;
|
|
|
|
|
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;
|
|
|
|
@ -52,48 +53,13 @@ import java.util.stream.Collectors;
|
|
|
|
|
* @version: 1.0
|
|
|
|
|
*/
|
|
|
|
|
public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
/**
|
|
|
|
|
* 分组类型
|
|
|
|
|
* 1:分部
|
|
|
|
|
* 2:部门
|
|
|
|
|
* 3:岗位
|
|
|
|
|
*/
|
|
|
|
|
private static final String EXTEND_TYPE = "1";
|
|
|
|
|
/**
|
|
|
|
|
* 主表表名
|
|
|
|
|
*/
|
|
|
|
|
private static final String JCL_ORG_COMP = "JCL_ORG_COMP";
|
|
|
|
|
/**
|
|
|
|
|
* 主表拓展表
|
|
|
|
|
*/
|
|
|
|
|
private static final String JCL_ORG_COMPEXT = "JCL_ORG_COMPEXT";
|
|
|
|
|
/**
|
|
|
|
|
* 明细表拓展表
|
|
|
|
|
*/
|
|
|
|
|
private static final String JCL_ORG_COMPEXT_DT1 = "JCL_ORG_COMPEXT_DT1";
|
|
|
|
|
|
|
|
|
|
private static final String RIGHT_NAME = "Company:All";
|
|
|
|
|
|
|
|
|
|
private static final String HRM_COMPANY = "hrmsubcompany";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 公司/分部主表title指定ID
|
|
|
|
|
*/
|
|
|
|
|
private static final Long GROUP_ID = 1L;
|
|
|
|
|
|
|
|
|
|
private static CompMapper getCompMapper() {
|
|
|
|
|
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 Map<String, Object> listPage(CompParam params) {
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
@ -105,7 +71,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
CompPO companyPO = CompBO.convertParamToPO(params, user.getUID());
|
|
|
|
|
boolean filter = isFilter(companyPO);
|
|
|
|
|
PageInfo<CompListDTO> pageInfos;
|
|
|
|
|
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams()," showorder ");
|
|
|
|
|
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams(), " showorder ");
|
|
|
|
|
List<CompPO> allList = getCompMapper().listAll(orderSql);
|
|
|
|
|
|
|
|
|
|
new DetachUtil(user.getUID()).filterCompanyList(allList);
|
|
|
|
@ -211,43 +177,162 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getCompBaseForm(Map<String, Object> params) {
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
OrganizationAssert.notNull(params.get("viewAttr"), "请标识操作类型");
|
|
|
|
|
// 2编辑 1查看
|
|
|
|
|
Map<String, Object> retMap = new HashMap<>();
|
|
|
|
|
List<SearchConditionGroup> groupList = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> itemList;
|
|
|
|
|
List<SearchConditionItem> extendItemList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
String id = Util.null2String(params.get("id"));
|
|
|
|
|
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);
|
|
|
|
|
if (2 == viewAttr) {
|
|
|
|
|
params.put("viewattr", viewAttr);
|
|
|
|
|
Object condition = getCompSaveForm(params).get("condition");
|
|
|
|
|
if (condition instanceof List) {
|
|
|
|
|
groupList = getCompanyConditionGroups(params);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
|
|
|
|
|
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
|
|
|
|
|
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
|
|
|
|
|
SearchConditionItem searchConditionItem;
|
|
|
|
|
HrmFieldBean hrmFieldBean;
|
|
|
|
|
HrmDeptFieldManagerE9 hfm;
|
|
|
|
|
try {
|
|
|
|
|
hfm = new HrmDeptFieldManagerE9(4);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
if ("0".equals(groupId)) {
|
|
|
|
|
groupId = GROUP_ID.toString();
|
|
|
|
|
}
|
|
|
|
|
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(Long.parseLong(groupId), "1");
|
|
|
|
|
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 (!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;
|
|
|
|
|
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 (isSystem.equals("1")) {
|
|
|
|
|
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 (id.length() > 0 && fieldName.equals("subshowid")) {
|
|
|
|
|
fieldValue = id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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_COMP : JCL_ORG_COMPEXT, viewAttr, id, extendTitle.getId() + "", "");
|
|
|
|
|
if (CollectionUtils.isNotEmpty(items)) {
|
|
|
|
|
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items));
|
|
|
|
|
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 (fieldName.equals("showorder")) {
|
|
|
|
|
searchConditionItem.setPrecision(2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ("6".equals(fieldHtmlType)) {//附件
|
|
|
|
|
Map<String, Object> otherParams1 = new HashMap<>();
|
|
|
|
|
otherParams1.put("showOrder", false);
|
|
|
|
|
searchConditionItem.setOtherParams(otherParams1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
searchConditionItem.setViewAttr(viewAttr);
|
|
|
|
|
if ("1".equals(isSystem)) {
|
|
|
|
|
itemList.add(searchConditionItem);
|
|
|
|
|
} else {
|
|
|
|
|
extendItemList.add(searchConditionItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int operateLevel;
|
|
|
|
|
ManageDetachComInfo manageDetachComInfo = new ManageDetachComInfo();
|
|
|
|
|
boolean hrmDetachAble = manageDetachComInfo.isUseHrmManageDetach();
|
|
|
|
|
if (hrmDetachAble) {
|
|
|
|
|
CheckSubCompanyRight checkSubCompanyRight = new CheckSubCompanyRight();
|
|
|
|
|
operateLevel = checkSubCompanyRight.ChkComRightByUserRightCompanyId(user.getUID(), "HrmSubCompanyEdit:Edit", Integer.parseInt(id));
|
|
|
|
|
} else {
|
|
|
|
|
operateLevel = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tmp == 0 && HrmUserVarify.checkUserRight("HrmSubCompanyEdit:Edit", user) && operateLevel > 0) {
|
|
|
|
|
int resourceNum = 0;
|
|
|
|
|
|
|
|
|
|
String sql;
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
sql = "SELECT COUNT(*) FROM hrmresource WHERE subcompanyid1 = " + id + " and ( status =0 or status = 1 or status = 2 or status = 3)";
|
|
|
|
|
rs.execute(sql);
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
resourceNum = rs.getInt(1);
|
|
|
|
|
}
|
|
|
|
|
//4:解聘 5:离职 6:退休 7:无效
|
|
|
|
|
int resourceNum1 = 0;
|
|
|
|
|
sql = "SELECT COUNT(*) FROM hrmresource WHERE subcompanyid1 = " + id + " and status in(4,5,6,7)";
|
|
|
|
|
rs.execute(sql);
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
resourceNum1 = rs.getInt(1);
|
|
|
|
|
}
|
|
|
|
|
hrmFieldBean = new HrmFieldBean();
|
|
|
|
|
hrmFieldBean.setFieldname("subcomResourceInfo");
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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", addGroups);
|
|
|
|
|
resultMap.put("id", id);
|
|
|
|
|
// 拓展页面分组
|
|
|
|
|
resultMap.put("tabInfo", getExtService(user).getTabInfo(EXTEND_TYPE, JCL_ORG_COMPEXT));
|
|
|
|
|
// 处理明细表
|
|
|
|
|
resultMap.put("tables", getExtService(user).getExtendTables(user, EXTEND_TYPE, Long.parseLong(groupId), JCL_ORG_COMPEXT_DT1, id, viewAttr, false));
|
|
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
|
|
retMap.put("id", id);
|
|
|
|
|
retMap.put("conditions", groupList);
|
|
|
|
|
retMap.put("buttons", buttonsMap);
|
|
|
|
|
List<TopTab> topTabs = new ArrayList<>();
|
|
|
|
|
topTabs.add(TopTab.builder().color("#000000").groupId("4").showcount(false).title("分部信息").viewCondition("4").build());
|
|
|
|
|
retMap.put("tabInfo", topTabs);
|
|
|
|
|
|
|
|
|
|
apiDatas.put("result", resultMap);
|
|
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
apiDatas.put("result", retMap);
|
|
|
|
|
return apiDatas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -256,18 +341,79 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
public Map<String, Object> getCompSaveForm(Map<String, Object> params) {
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
|
|
List<Map<String, Object>> grouplist = new ArrayList<>();
|
|
|
|
|
apiDatas.put("condition", getCompanyConditionGroups(params));
|
|
|
|
|
return apiDatas;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<SearchConditionGroup> getMoveForm() {
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> condition = new ArrayList<>();
|
|
|
|
|
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "转移到", "164", "company", "compBrowser");
|
|
|
|
|
compBrowserItem.setHelpfulTip("在不选择分部情况下,默认转移到集团下一级分部!!!");
|
|
|
|
|
condition.add(compBrowserItem);
|
|
|
|
|
addGroups.add(new SearchConditionGroup("", true, condition));
|
|
|
|
|
return addGroups;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int moveCompany(DepartmentMoveParam moveParam) {
|
|
|
|
|
Integer companyId = moveParam.getId();
|
|
|
|
|
Integer targetCompanyId = moveParam.getCompany();
|
|
|
|
|
// 判断目标分部是否为它本身以及子元素
|
|
|
|
|
Set<Integer> disableIds = new HashSet<>();
|
|
|
|
|
disableIds.add(companyId);
|
|
|
|
|
List<CompPO> compPOS = getCompMapper().listChild(DeleteParam.builder().ids(companyId.toString()).build().getIds());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(compPOS)) {
|
|
|
|
|
addDisableIds(disableIds, compPOS);
|
|
|
|
|
}
|
|
|
|
|
OrganizationAssert.isFalse(disableIds.contains(targetCompanyId), "请勿选择当前分部本身及其子分部");
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("id", companyId.toString());
|
|
|
|
|
map.put("supsubcomid", targetCompanyId.toString());
|
|
|
|
|
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, map).sync();
|
|
|
|
|
return companyId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 是否为搜索查询
|
|
|
|
|
*
|
|
|
|
|
* @param companyPO
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean isFilter(CompPO companyPO) {
|
|
|
|
|
return StringUtils.isNotBlank(companyPO.getSubCompanyCode()) || StringUtils.isNotBlank(companyPO.getSubCompanyDesc()) || StringUtils.isNotBlank(companyPO.getSubCompanyName()) || null != companyPO.getSupSubComId();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加子元素ID
|
|
|
|
|
*
|
|
|
|
|
* @param disableIds
|
|
|
|
|
* @param compPOS
|
|
|
|
|
*/
|
|
|
|
|
private void addDisableIds(Set<Integer> disableIds, List<CompPO> compPOS) {
|
|
|
|
|
for (CompPO compPO : compPOS) {
|
|
|
|
|
disableIds.add(compPO.getId());
|
|
|
|
|
List<CompPO> childCompPOS = getCompMapper().listChild(DeleteParam.builder().ids(compPO.getId().toString()).build().getIds());
|
|
|
|
|
addDisableIds(disableIds, childCompPOS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<SearchConditionGroup> getCompanyConditionGroups(Map<String, Object> params) {
|
|
|
|
|
String id = Util.null2String(params.get("id"));
|
|
|
|
|
int viewAttr = Util.getIntValue(Util.null2String(params.get("viewattr")), 1);
|
|
|
|
|
|
|
|
|
|
String addType = Util.null2String(params.get("addType"));
|
|
|
|
|
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
|
|
|
|
String supsubcomid = "";
|
|
|
|
|
String supSubComId = "";
|
|
|
|
|
if ("sibling".equals(addType)) {
|
|
|
|
|
supsubcomid = subCompanyComInfo.getSupsubcomid(id);
|
|
|
|
|
supSubComId = subCompanyComInfo.getSupsubcomid(id);
|
|
|
|
|
} else if ("child".equals(addType)) {
|
|
|
|
|
supsubcomid = id;
|
|
|
|
|
supSubComId = id;
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(addType)) {
|
|
|
|
|
id = "";
|
|
|
|
@ -287,21 +433,20 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
hfm.isReturnDecryptData(true);
|
|
|
|
|
hfm.getCustomData(Util.getIntValue(id));
|
|
|
|
|
List lsGroup = hfm.getLsGroup();
|
|
|
|
|
List<SearchConditionGroup> groupList = new ArrayList<>();
|
|
|
|
|
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);
|
|
|
|
|
List<Object> itemList = new ArrayList<>();
|
|
|
|
|
Map<String, Object> groupItem = new HashMap<>();
|
|
|
|
|
groupItem.put("title", SystemEnv.getHtmlLabelNames(groupLabel, user.getLanguage()));
|
|
|
|
|
groupItem.put("hide", groupHide);
|
|
|
|
|
groupItem.put("defaultshow", true);
|
|
|
|
|
for (int j = 0; j < lsField.size(); j++) {
|
|
|
|
|
String fieldId = (String) lsField.get(j);
|
|
|
|
|
List<SearchConditionItem> itemList = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> extendItemList = new ArrayList<>();
|
|
|
|
|
for (Object o : lsField) {
|
|
|
|
|
String fieldId = (String) o;
|
|
|
|
|
String fieldName = HrmFieldComInfo.getFieldname(fieldId);
|
|
|
|
|
String isUse = HrmFieldComInfo.getIsused(fieldId);
|
|
|
|
|
String isSystem = HrmFieldComInfo.getIssystem(fieldId);
|
|
|
|
|
if (!"1".equals(isUse)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -312,9 +457,8 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
String type = HrmFieldComInfo.getFieldType(fieldId);
|
|
|
|
|
String dmlUrl = Util.null2String(HrmFieldComInfo.getFieldDmlurl(fieldId));
|
|
|
|
|
String fieldValue = "";
|
|
|
|
|
if (StringUtils.isNotBlank(addType)) {
|
|
|
|
|
} else {
|
|
|
|
|
if ("1".equals(HrmFieldComInfo.getIssystem(fieldId))) {
|
|
|
|
|
if (StringUtils.isBlank(addType)) {
|
|
|
|
|
if ("1".equals(isSystem)) {
|
|
|
|
|
fieldValue = hfm.getData(fieldName);
|
|
|
|
|
} else {
|
|
|
|
|
fieldValue = hfm.getData("hrmsubcompanydefined", fieldName);
|
|
|
|
@ -336,8 +480,8 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
}
|
|
|
|
|
fieldValue = "0".equals(fieldValue) ? "" : fieldValue;
|
|
|
|
|
}
|
|
|
|
|
if (supsubcomid.length() > 0 && "supsubcomid".equals(fieldName)) {
|
|
|
|
|
fieldValue = supsubcomid;
|
|
|
|
|
if (supSubComId.length() > 0 && "supsubcomid".equals(fieldName)) {
|
|
|
|
|
fieldValue = supSubComId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ("subshowid".equals(fieldName)) {
|
|
|
|
@ -385,106 +529,16 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
otherParams1.put("showOrder", false);
|
|
|
|
|
searchConditionItem.setOtherParams(otherParams1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
itemList.add(searchConditionItem);
|
|
|
|
|
if ("1".equals(isSystem)) {
|
|
|
|
|
itemList.add(searchConditionItem);
|
|
|
|
|
} else {
|
|
|
|
|
extendItemList.add(searchConditionItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
groupItem.put("items", itemList);
|
|
|
|
|
grouplist.add(groupItem);
|
|
|
|
|
}
|
|
|
|
|
apiDatas.put("condition", grouplist);
|
|
|
|
|
return apiDatas;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<SearchConditionGroup> getMoveForm() {
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> condition = new ArrayList<>();
|
|
|
|
|
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "转移到", "164", "company", "compBrowser");
|
|
|
|
|
compBrowserItem.setHelpfulTip("在不选择分部情况下,默认转移到集团下一级分部!!!");
|
|
|
|
|
condition.add(compBrowserItem);
|
|
|
|
|
addGroups.add(new SearchConditionGroup("", true, condition));
|
|
|
|
|
return addGroups;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int moveCompany(DepartmentMoveParam moveParam) {
|
|
|
|
|
Integer companyId = moveParam.getId();
|
|
|
|
|
Integer targetCompanyId = moveParam.getCompany();
|
|
|
|
|
// 判断目标分部是否为它本身以及子元素
|
|
|
|
|
Set<Integer> disableIds = new HashSet<>();
|
|
|
|
|
disableIds.add(companyId);
|
|
|
|
|
List<CompPO> compPOS = getCompMapper().listChild(DeleteParam.builder().ids(companyId.toString()).build().getIds());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(compPOS)) {
|
|
|
|
|
addDisableIds(disableIds, compPOS);
|
|
|
|
|
groupList.add(new SearchConditionGroup(SystemEnv.getHtmlLabelNames(groupLabel, user.getLanguage()), true, itemList));
|
|
|
|
|
groupList.add(new SearchConditionGroup("拓展信息", true, extendItemList));
|
|
|
|
|
}
|
|
|
|
|
OrganizationAssert.isFalse(disableIds.contains(targetCompanyId), "请勿选择当前分部本身及其子分部");
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("id", companyId.toString());
|
|
|
|
|
map.put("supsubcomid", targetCompanyId.toString());
|
|
|
|
|
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, map).sync();
|
|
|
|
|
return companyId;
|
|
|
|
|
return groupList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 是否为搜索查询
|
|
|
|
|
*
|
|
|
|
|
* @param companyPO
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean isFilter(CompPO companyPO) {
|
|
|
|
|
return StringUtils.isNotBlank(companyPO.getSubCompanyCode()) || StringUtils.isNotBlank(companyPO.getSubCompanyDesc()) || StringUtils.isNotBlank(companyPO.getSubCompanyName()) || null != companyPO.getSupSubComId();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断编号是否重复
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public static String repeatDetermine(String compNo) {
|
|
|
|
|
//CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(RuleCodeType.SUBCOMPANY.getValue());
|
|
|
|
|
//if (StringUtils.isNotBlank(compNo)) {
|
|
|
|
|
// compNo = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, compNo);
|
|
|
|
|
// List<CompPO> list = getCompMapper().listByNo(Util.null2String(compNo));
|
|
|
|
|
// OrganizationAssert.isEmpty(list, "编号不允许重复");
|
|
|
|
|
//} else {
|
|
|
|
|
// OrganizationAssert.isTrue(null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable()), "编号不允许为空");
|
|
|
|
|
// compNo = autoCreateCompanyNo();
|
|
|
|
|
//}
|
|
|
|
|
//return compNo;
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///**
|
|
|
|
|
// * 自动编号处理
|
|
|
|
|
// *
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
//private static String autoCreateCompanyNo() {
|
|
|
|
|
// String generateCode = CodeRuleUtil.generateCode(RuleCodeType.SUBCOMPANY, "");
|
|
|
|
|
// List<CompPO> list = getCompMapper().listByNo(Util.null2String(generateCode));
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
// generateCode = autoCreateCompanyNo();
|
|
|
|
|
// }
|
|
|
|
|
// return generateCode;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加子元素ID
|
|
|
|
|
*
|
|
|
|
|
* @param disableIds
|
|
|
|
|
* @param compPOS
|
|
|
|
|
*/
|
|
|
|
|
private void addDisableIds(Set<Integer> disableIds, List<CompPO> compPOS) {
|
|
|
|
|
for (CompPO compPO : compPOS) {
|
|
|
|
|
disableIds.add(compPO.getId());
|
|
|
|
|
List<CompPO> childCompPOS = getCompMapper().listChild(DeleteParam.builder().ids(compPO.getId().toString()).build().getIds());
|
|
|
|
|
addDisableIds(disableIds, childCompPOS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|