|
|
|
@ -4,28 +4,31 @@ package com.engine.organization.service.impl;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.api.browser.bean.SearchConditionGroup;
|
|
|
|
|
import com.api.browser.bean.SearchConditionItem;
|
|
|
|
|
import com.api.browser.bean.SearchConditionOption;
|
|
|
|
|
import com.api.hrm.bean.HrmFieldBean;
|
|
|
|
|
import com.api.hrm.util.HrmFieldSearchConditionComInfo;
|
|
|
|
|
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
|
|
|
|
import com.cloudstore.eccom.result.WeaResultMsg;
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
|
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.DeleteParam;
|
|
|
|
|
import com.engine.organization.entity.codesetting.po.CodeRulePO;
|
|
|
|
|
import com.engine.organization.entity.commom.RecordInfo;
|
|
|
|
|
import com.engine.organization.entity.company.bo.CompBO;
|
|
|
|
|
import com.engine.organization.entity.company.bo.CompanyBO;
|
|
|
|
|
import com.engine.organization.entity.company.dto.CompListDTO;
|
|
|
|
|
import com.engine.organization.entity.company.dto.CompanyListDTO;
|
|
|
|
|
import com.engine.organization.entity.company.param.CompSearchParam;
|
|
|
|
|
import com.engine.organization.entity.company.param.CompanyParam;
|
|
|
|
|
import com.engine.organization.entity.company.po.CompPO;
|
|
|
|
|
import com.engine.organization.entity.company.po.CompanyPO;
|
|
|
|
|
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.mapper.codesetting.CodeRuleMapper;
|
|
|
|
|
import com.engine.organization.mapper.comp.CompMapper;
|
|
|
|
|
import com.engine.organization.mapper.extend.ExtDTMapper;
|
|
|
|
|
import com.engine.organization.mapper.extend.ExtMapper;
|
|
|
|
|
import com.engine.organization.mapper.comp.CompanyMapper;
|
|
|
|
|
import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
|
|
|
|
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
|
|
|
|
import com.engine.organization.service.CompService;
|
|
|
|
@ -34,16 +37,19 @@ import com.engine.organization.thread.OrganizationSyncEc;
|
|
|
|
|
import com.engine.organization.util.*;
|
|
|
|
|
import com.engine.organization.util.coderule.CodeRuleUtil;
|
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
|
import com.engine.organization.util.detach.DetachUtil;
|
|
|
|
|
import com.engine.organization.util.page.Column;
|
|
|
|
|
import com.engine.organization.util.page.PageInfo;
|
|
|
|
|
import com.engine.organization.util.page.PageUtil;
|
|
|
|
|
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
import weaver.general.StringUtil;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
|
import weaver.hrm.company.SubCompanyComInfo;
|
|
|
|
|
import weaver.hrm.definedfield.HrmDeptFieldManagerE9;
|
|
|
|
|
import weaver.hrm.definedfield.HrmFieldComInfo;
|
|
|
|
|
import weaver.hrm.definedfield.HrmFieldGroupComInfo;
|
|
|
|
|
import weaver.systeminfo.SystemEnv;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
@ -84,6 +90,10 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
*/
|
|
|
|
|
private static final Long GROUP_ID = 1L;
|
|
|
|
|
|
|
|
|
|
private static CompanyMapper getCompanyMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(CompanyMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static CompMapper getCompMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(CompMapper.class);
|
|
|
|
|
}
|
|
|
|
@ -102,35 +112,37 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> listPage(CompSearchParam params) {
|
|
|
|
|
public Map<String, Object> listPage(CompanyParam params) {
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
|
|
|
|
|
datas.put("hasRight", hasRight);
|
|
|
|
|
if (!hasRight) {
|
|
|
|
|
return datas;
|
|
|
|
|
}
|
|
|
|
|
CompPO compPO = CompBO.convertParamToPO(params, (long) user.getUID());
|
|
|
|
|
boolean filter = isFilter(compPO);
|
|
|
|
|
PageInfo<CompListDTO> pageInfos;
|
|
|
|
|
CompanyPO companyPO = CompanyBO.convertParamToPO(params, user.getUID());
|
|
|
|
|
boolean filter = isFilter(companyPO);
|
|
|
|
|
PageInfo<CompanyListDTO> pageInfos;
|
|
|
|
|
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams());
|
|
|
|
|
List<CompPO> allList = getCompMapper().list(orderSql);
|
|
|
|
|
new DetachUtil(user.getUID()).filterCompanyList(allList);
|
|
|
|
|
List<CompanyPO> allList = getCompanyMapper().listAll(orderSql);
|
|
|
|
|
|
|
|
|
|
//TODO new DetachUtil(user.getUID()).filterCompanyList(allList);
|
|
|
|
|
|
|
|
|
|
// 通过子级遍历父级元素
|
|
|
|
|
if (filter) {
|
|
|
|
|
// 根据条件获取元素
|
|
|
|
|
List<CompPO> filterCompPOs = getCompMapper().listByFilter(compPO, orderSql);
|
|
|
|
|
new DetachUtil(user.getUID()).filterCompanyList(filterCompPOs);
|
|
|
|
|
List<CompanyPO> filterCompPOs = getCompanyMapper().listByFilter(companyPO, orderSql);
|
|
|
|
|
//TODO new DetachUtil(user.getUID()).filterCompanyList(filterCompPOs);
|
|
|
|
|
|
|
|
|
|
// 添加父级元素
|
|
|
|
|
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(allList, filterCompPOs);
|
|
|
|
|
List<CompListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);
|
|
|
|
|
pageInfos = new PageInfo<>(subList, CompListDTO.class);
|
|
|
|
|
List<CompanyListDTO> compListDTOS = CompanyBO.buildCompDTOList(allList, filterCompPOs);
|
|
|
|
|
List<CompanyListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);
|
|
|
|
|
pageInfos = new PageInfo<>(subList, CompanyListDTO.class);
|
|
|
|
|
pageInfos.setTotal(compListDTOS.size());
|
|
|
|
|
} else {
|
|
|
|
|
// 组合list
|
|
|
|
|
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(allList);
|
|
|
|
|
List<CompListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);
|
|
|
|
|
pageInfos = new PageInfo<>(subList, CompListDTO.class);
|
|
|
|
|
List<CompanyListDTO> compListDTOS = CompanyBO.buildCompDTOList(allList);
|
|
|
|
|
List<CompanyListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);
|
|
|
|
|
pageInfos = new PageInfo<>(subList, CompanyListDTO.class);
|
|
|
|
|
pageInfos.setTotal(compListDTOS.size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -140,9 +152,7 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
OrganizationWeaTable<CompListDTO> table = new OrganizationWeaTable<>(user, CompListDTO.class);
|
|
|
|
|
List<Column> columns = pageInfos.getColumns();
|
|
|
|
|
List<WeaTableColumn> weaTableColumn = columns.stream().map(v -> new WeaTableColumn("100", v.getTitle(), v.getKey())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
table.setColumns(weaTableColumn);
|
|
|
|
|
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
|
result.putAll(table.makeDataResult());
|
|
|
|
|
result.success();
|
|
|
|
@ -155,29 +165,10 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
@Override
|
|
|
|
|
public Long saveBaseComp(Map<String, Object> params) {
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
String compNo = (String) params.get("comp_no");
|
|
|
|
|
// 判断是否开启自动编号
|
|
|
|
|
compNo = repeatDetermine(compNo);
|
|
|
|
|
params.put("comp_no", compNo);
|
|
|
|
|
if (null == params.get("show_order") || StringUtils.isBlank(params.get("show_order").toString())) {
|
|
|
|
|
Integer maxShowOrder = getCompMapper().getMaxShowOrder();
|
|
|
|
|
if (null == maxShowOrder) {
|
|
|
|
|
maxShowOrder = 0;
|
|
|
|
|
}
|
|
|
|
|
params.put("show_order", maxShowOrder + 1);
|
|
|
|
|
}
|
|
|
|
|
// 赋值上级分部
|
|
|
|
|
String ecCompany = Util.null2String(params.get("ec_company"));
|
|
|
|
|
if (StringUtils.isNotBlank(ecCompany)) {
|
|
|
|
|
params.put("parent_company", EcHrmRelationUtil.getJclCompanyId(ecCompany).getId());
|
|
|
|
|
}
|
|
|
|
|
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.ADD, params).sync();
|
|
|
|
|
String ecCompanyID = Util.null2String(syncMap.get("id"));
|
|
|
|
|
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecCompanyID), syncMap.get("message").toString());
|
|
|
|
|
// 查询UUID
|
|
|
|
|
RecordInfo recordInfo = getSystemDataMapper().getHrmObjectByID(HRM_COMPANY, ecCompanyID);
|
|
|
|
|
params.put("uuid", recordInfo.getUuid());
|
|
|
|
|
return getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_COMP, params, "", null);
|
|
|
|
|
String companyId = Util.null2String(syncMap.get("id"));
|
|
|
|
|
OrganizationAssert.isTrue(StringUtils.isNotBlank(companyId), syncMap.get("message").toString());
|
|
|
|
|
return Long.parseLong(companyId);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -228,56 +219,29 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int deleteByIds(Collection<Long> ids) {
|
|
|
|
|
public Map<String, Object> deleteByIds(Map<String, Object> params) {
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
OrganizationAssert.notEmpty(ids, "请选择要删除的数据");
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
for (Long id : ids) {
|
|
|
|
|
map.put("id", id);
|
|
|
|
|
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.CANCELED, map).sync();
|
|
|
|
|
// 删除拓展表、明细表
|
|
|
|
|
MapperProxyFactory.getProxy(ExtMapper.class).deleteByID("jcl_org_compext", id);
|
|
|
|
|
MapperProxyFactory.getProxy(ExtDTMapper.class).deleteByMainID("jcl_org_compext_dt1", id, null);
|
|
|
|
|
}
|
|
|
|
|
return getCompMapper().deleteByIds(ids);
|
|
|
|
|
return ServiceUtil.getService(OrganizationServiceImpl.class, user).delSubCompany(params, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
|
|
|
|
|
public Map<String, Object> getSearchCondition() {
|
|
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
|
|
|
|
// 编号
|
|
|
|
|
SearchConditionItem compNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "编号", "compNo");
|
|
|
|
|
SearchConditionItem subCompanyCodeItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "编号", "subCompanyCode");
|
|
|
|
|
// 名称
|
|
|
|
|
SearchConditionItem compNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "compName");
|
|
|
|
|
SearchConditionItem subCompanyDescItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "subCompanyDesc");
|
|
|
|
|
// 简称
|
|
|
|
|
SearchConditionItem compNameShortItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "简称", "compNameShort");
|
|
|
|
|
SearchConditionItem subCompanyNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "简称", "subCompanyName");
|
|
|
|
|
// 上级公司
|
|
|
|
|
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "上级公司", "164", "ecCompany", "");
|
|
|
|
|
// 组织机构代码
|
|
|
|
|
SearchConditionItem orgCodeItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "组织机构代码", "orgCode");
|
|
|
|
|
// 行业
|
|
|
|
|
SearchConditionItem industryItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "行业", "63", "industry", "");
|
|
|
|
|
// 负责人
|
|
|
|
|
SearchConditionItem compPrincipalItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "负责人", "1", "compPrincipal", "");
|
|
|
|
|
// 禁用标记
|
|
|
|
|
List<SearchConditionOption> selectOptions = new ArrayList<>();
|
|
|
|
|
SearchConditionOption enableOption = new SearchConditionOption("true", "启用");
|
|
|
|
|
SearchConditionOption disableOption = new SearchConditionOption("false", "禁用");
|
|
|
|
|
selectOptions.add(enableOption);
|
|
|
|
|
selectOptions.add(disableOption);
|
|
|
|
|
SearchConditionItem forbiddenTagItem = OrganizationFormItemUtil.selectItem(user, selectOptions, 2, 16, 6, false, "禁用标记", "forbiddenTag");
|
|
|
|
|
|
|
|
|
|
conditionItems.add(compNoItem);
|
|
|
|
|
conditionItems.add(compNameItem);
|
|
|
|
|
conditionItems.add(compNameShortItem);
|
|
|
|
|
conditionItems.add(compBrowserItem);
|
|
|
|
|
conditionItems.add(orgCodeItem);
|
|
|
|
|
conditionItems.add(industryItem);
|
|
|
|
|
conditionItems.add(compPrincipalItem);
|
|
|
|
|
conditionItems.add(forbiddenTagItem);
|
|
|
|
|
SearchConditionItem supSubComIdItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属分部", "164", "supSubComId", "");
|
|
|
|
|
|
|
|
|
|
conditionItems.add(subCompanyCodeItem);
|
|
|
|
|
conditionItems.add(subCompanyDescItem);
|
|
|
|
|
conditionItems.add(subCompanyNameItem);
|
|
|
|
|
conditionItems.add(supSubComIdItem);
|
|
|
|
|
addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems));
|
|
|
|
|
apiDatas.put("conditions", addGroups);
|
|
|
|
|
return apiDatas;
|
|
|
|
@ -333,20 +297,145 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getCompSaveForm() {
|
|
|
|
|
public Map<String, Object> getCompSaveForm(Map<String, Object> params) {
|
|
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(GROUP_ID, "1");
|
|
|
|
|
if (CollectionUtils.isNotEmpty(extendTitles)) {
|
|
|
|
|
for (ExtendTitlePO extendTitle : extendTitles) {
|
|
|
|
|
List<SearchConditionItem> items = getExtService(user).getExtSaveForm(user, EXTEND_TYPE + "", JCL_ORG_COMP, 2, extendTitle.getId() + "", "comp_no", RuleCodeType.SUBCOMPANY.getValue(), null);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(items)) {
|
|
|
|
|
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, items));
|
|
|
|
|
List<Map<String, Object>> grouplist = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
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 = "";
|
|
|
|
|
if (addType.equals("sibling")) {
|
|
|
|
|
supsubcomid = subCompanyComInfo.getSupsubcomid(id);
|
|
|
|
|
} else if (addType.equals("child")) {
|
|
|
|
|
supsubcomid = id;
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(addType)) {
|
|
|
|
|
id = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HrmFieldGroupComInfo HrmFieldGroupComInfo = new HrmFieldGroupComInfo();
|
|
|
|
|
HrmFieldComInfo HrmFieldComInfo = new HrmFieldComInfo();
|
|
|
|
|
HrmFieldSearchConditionComInfo hrmFieldSearchConditionComInfo = new HrmFieldSearchConditionComInfo();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HrmDeptFieldManagerE9 hfm;
|
|
|
|
|
try {
|
|
|
|
|
hfm = new HrmDeptFieldManagerE9(4);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new RuntimeException("");
|
|
|
|
|
}
|
|
|
|
|
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 || !Util.null2String(HrmFieldGroupComInfo.getIsShow(groupId)).equals("1");
|
|
|
|
|
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);
|
|
|
|
|
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.isNotBlank(addType)) {
|
|
|
|
|
} else {
|
|
|
|
|
if (HrmFieldComInfo.getIssystem(fieldId).equals("1")) {
|
|
|
|
|
fieldValue = hfm.getData(fieldName);
|
|
|
|
|
} else {
|
|
|
|
|
fieldValue = hfm.getData("hrmsubcompanydefined", 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 ("84".equals(fieldId)) {
|
|
|
|
|
if (user.getUID() != 1)
|
|
|
|
|
continue;
|
|
|
|
|
fieldValue = fieldValue.equals("0") ? "" : fieldValue;
|
|
|
|
|
}
|
|
|
|
|
if (supsubcomid.length() > 0 && fieldName.equals("supsubcomid")) {
|
|
|
|
|
fieldValue = supsubcomid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fieldName.equals("subshowid")) {
|
|
|
|
|
if (StringUtils.isNotBlank(addType)) {
|
|
|
|
|
continue;
|
|
|
|
|
} else {
|
|
|
|
|
fieldValue = id;
|
|
|
|
|
tmpViewAttr = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HrmFieldBean 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.setViewAttr(tmpViewAttr);
|
|
|
|
|
hrmFieldBean.setRules(rules);
|
|
|
|
|
hrmFieldBean.setIssystem("1");
|
|
|
|
|
if (hrmFieldBean.getFieldname().equals("supsubcomid")) {
|
|
|
|
|
hrmFieldBean.setHideVirtualOrg(true);
|
|
|
|
|
}
|
|
|
|
|
if (hrmFieldBean.getFieldname().equals("subcompanycode")) {
|
|
|
|
|
hrmFieldBean.setMultilang(false);
|
|
|
|
|
}
|
|
|
|
|
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
|
|
|
|
if (searchConditionItem != null) {
|
|
|
|
|
searchConditionItem.setLabelcol(8);
|
|
|
|
|
searchConditionItem.setFieldcol(16);
|
|
|
|
|
if (hrmFieldBean.getFieldname().equals("showorder")) {
|
|
|
|
|
searchConditionItem.setPrecision(2);
|
|
|
|
|
}
|
|
|
|
|
if (fieldName.equals("subshowid")) {
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
itemList.add(searchConditionItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
groupItem.put("items", itemList);
|
|
|
|
|
grouplist.add(groupItem);
|
|
|
|
|
}
|
|
|
|
|
apiDatas.put("condition", addGroups);
|
|
|
|
|
apiDatas.put("condition", grouplist);
|
|
|
|
|
return apiDatas;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -364,52 +453,33 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int moveCompany(DepartmentMoveParam moveParam) {
|
|
|
|
|
Long targetCompanyId = moveParam.getCompany();
|
|
|
|
|
//OrganizationAssert.notNull(targetCompanyId, "请选择要转移到的分部");
|
|
|
|
|
Long companyId = moveParam.getId();
|
|
|
|
|
Integer companyId = moveParam.getId().intValue();
|
|
|
|
|
Integer targetCompanyId = moveParam.getCompany().intValue();
|
|
|
|
|
// 判断目标分部是否为它本身以及子元素
|
|
|
|
|
Set<Long> disableIds = new HashSet<>();
|
|
|
|
|
Set<Integer> disableIds = new HashSet<>();
|
|
|
|
|
disableIds.add(companyId);
|
|
|
|
|
List<CompPO> compPOS = getCompMapper().listChild(DeleteParam.builder().ids(companyId.toString()).build().getIds());
|
|
|
|
|
List<CompanyPO> compPOS = getCompanyMapper().listChild(DeleteParam.builder().ids(companyId.toString()).build().getIds());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(compPOS)) {
|
|
|
|
|
addDisableIds(disableIds, compPOS);
|
|
|
|
|
}
|
|
|
|
|
OrganizationAssert.isFalse(disableIds.contains(targetCompanyId), "请勿选择当前分部本身及其子分部");
|
|
|
|
|
CompPO compPO = getCompMapper().listById(companyId);
|
|
|
|
|
compPO.setEcCompany(targetCompanyId);
|
|
|
|
|
CompPO jclCompanyId = EcHrmRelationUtil.getJclCompanyId(Util.null2String(targetCompanyId));
|
|
|
|
|
if (null != jclCompanyId) {
|
|
|
|
|
compPO.setParentCompany(jclCompanyId.getId());
|
|
|
|
|
} else {
|
|
|
|
|
compPO.setParentCompany(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("id", compPO.getId());
|
|
|
|
|
map.put("parent_company", compPO.getParentCompany());
|
|
|
|
|
map.put("comp_no", compPO.getCompNo());
|
|
|
|
|
map.put("comp_name_short", compPO.getCompNameShort());
|
|
|
|
|
map.put("comp_name", compPO.getCompName());
|
|
|
|
|
map.put("show_order", compPO.getShowOrder());
|
|
|
|
|
map.put("id", companyId.toString());
|
|
|
|
|
map.put("supsubcomid", targetCompanyId.toString());
|
|
|
|
|
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, map).sync();
|
|
|
|
|
return getCompMapper().updateBaseComp(compPO);
|
|
|
|
|
return companyId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 是否为搜索查询
|
|
|
|
|
*
|
|
|
|
|
* @param compPO
|
|
|
|
|
* @param companyPO
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean isFilter(CompPO compPO) {
|
|
|
|
|
return !(StringUtil.isEmpty(compPO.getCompName())
|
|
|
|
|
&& StringUtil.isEmpty(compPO.getCompNo())
|
|
|
|
|
&& StringUtil.isEmpty(compPO.getCompNameShort())
|
|
|
|
|
&& StringUtil.isEmpty(compPO.getOrgCode())
|
|
|
|
|
&& null == compPO.getEcCompany()
|
|
|
|
|
&& null == compPO.getIndustry()
|
|
|
|
|
&& null == compPO.getCompPrincipal()
|
|
|
|
|
&& null == compPO.getForbiddenTag());
|
|
|
|
|
private boolean isFilter(CompanyPO companyPO) {
|
|
|
|
|
return StringUtils.isNotBlank(companyPO.getSubCompanyCode()) || StringUtils.isNotBlank(companyPO.getSubCompanyDesc()) || StringUtils.isNotBlank(companyPO.getSubCompanyName()) || null != companyPO.getSupSubComId();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -451,10 +521,10 @@ public class CompServiceImpl extends Service implements CompService {
|
|
|
|
|
* @param disableIds
|
|
|
|
|
* @param compPOS
|
|
|
|
|
*/
|
|
|
|
|
private void addDisableIds(Set<Long> disableIds, List<CompPO> compPOS) {
|
|
|
|
|
for (CompPO compPO : compPOS) {
|
|
|
|
|
private void addDisableIds(Set<Integer> disableIds, List<CompanyPO> compPOS) {
|
|
|
|
|
for (CompanyPO compPO : compPOS) {
|
|
|
|
|
disableIds.add(compPO.getId());
|
|
|
|
|
List<CompPO> childCompPOS = getCompMapper().listChild(DeleteParam.builder().ids(compPO.getId().toString()).build().getIds());
|
|
|
|
|
List<CompanyPO> childCompPOS = getCompanyMapper().listChild(DeleteParam.builder().ids(compPO.getId().toString()).build().getIds());
|
|
|
|
|
addDisableIds(disableIds, childCompPOS);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|