|
|
package com.engine.organization.service.impl;
|
|
|
|
|
|
|
|
|
import com.api.browser.bean.SearchConditionGroup;
|
|
|
import com.api.browser.bean.SearchConditionItem;
|
|
|
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.service.impl.OrganizationServiceImpl;
|
|
|
import com.engine.organization.component.OrganizationWeaTable;
|
|
|
import com.engine.organization.entity.DeleteParam;
|
|
|
import com.engine.organization.entity.company.bo.CompanyBO;
|
|
|
import com.engine.organization.entity.company.dto.CompanyListDTO;
|
|
|
import com.engine.organization.entity.company.param.CompanyParam;
|
|
|
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.comp.CompanyMapper;
|
|
|
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;
|
|
|
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 org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
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;
|
|
|
|
|
|
/**
|
|
|
* @description:
|
|
|
* @author:dxfeng
|
|
|
* @createTime: 2022/05/16
|
|
|
* @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 CompanyMapper getCompanyMapper() {
|
|
|
return MapperProxyFactory.getProxy(CompanyMapper.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(CompanyParam params) {
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
|
|
|
datas.put("hasRight", hasRight);
|
|
|
if (!hasRight) {
|
|
|
return datas;
|
|
|
}
|
|
|
CompanyPO companyPO = CompanyBO.convertParamToPO(params, user.getUID());
|
|
|
boolean filter = isFilter(companyPO);
|
|
|
PageInfo<CompanyListDTO> pageInfos;
|
|
|
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams());
|
|
|
List<CompanyPO> allList = getCompanyMapper().listAll(orderSql);
|
|
|
|
|
|
new DetachUtil(user.getUID()).filterCompanyList(allList);
|
|
|
|
|
|
// 通过子级遍历父级元素
|
|
|
if (filter) {
|
|
|
// 根据条件获取元素
|
|
|
List<CompanyPO> filterCompPOs = getCompanyMapper().listByFilter(companyPO, orderSql);
|
|
|
new DetachUtil(user.getUID()).filterCompanyList(filterCompPOs);
|
|
|
|
|
|
// 添加父级元素
|
|
|
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<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());
|
|
|
}
|
|
|
|
|
|
pageInfos.setPageNum(params.getCurrent());
|
|
|
pageInfos.setPageSize(params.getPageSize());
|
|
|
|
|
|
OrganizationWeaTable<CompanyListDTO> table = new OrganizationWeaTable<>(user, CompanyListDTO.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();
|
|
|
|
|
|
datas.put("pageInfo", pageInfos);
|
|
|
datas.put("dataKey", result.getResultMap());
|
|
|
return datas;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Long saveBaseComp(Map<String, Object> params) {
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.ADD, params).sync();
|
|
|
String companyId = Util.null2String(syncMap.get("id"));
|
|
|
OrganizationAssert.isTrue(StringUtils.isNotBlank(companyId), syncMap.get("message").toString());
|
|
|
return Long.parseLong(companyId);
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int updateForbiddenTagById(CompanyParam params) {
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
CompanyPO compPO = CompanyPO.builder().id(params.getId()).canceled(params.getCanceled() ? 0 : 1).build();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("id", compPO.getId().toString());
|
|
|
map.put("forbiddenTag", compPO.getCanceled());
|
|
|
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.CANCELED, map).sync();
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Long updateComp(Map<String, Object> params) {
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
String ecCompanyId = Util.null2String(params.get("id"));
|
|
|
new OrganizationSyncEc(user, LogModuleNameEnum.COMPANY, OperateTypeEnum.UPDATE, params).sync();
|
|
|
return Long.parseLong(ecCompanyId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> deleteByIds(Map<String, Object> params) {
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
return ServiceUtil.getService(OrganizationServiceImpl.class, user).delSubCompany(params, user);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> getSearchCondition() {
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
|
|
// 编号
|
|
|
SearchConditionItem subCompanyCodeItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "编号", "subCompanyCode");
|
|
|
// 名称
|
|
|
SearchConditionItem subCompanyDescItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "subCompanyDesc");
|
|
|
// 简称
|
|
|
SearchConditionItem subCompanyNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "简称", "subCompanyName");
|
|
|
// 上级公司
|
|
|
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;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Map<String, List<MenuBtn>> getHasRight() {
|
|
|
return MenuBtn.getDatasNoBtnColum();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> getCompBaseForm(Map<String, Object> params) {
|
|
|
HasRightUtil.hasRight(user, RIGHT_NAME, false);
|
|
|
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_COMP : JCL_ORG_COMPEXT, viewAttr, id, extendTitle.getId() + "", "");
|
|
|
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_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<>();
|
|
|
|
|
|
apiDatas.put("result", resultMap);
|
|
|
|
|
|
return apiDatas;
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
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<>();
|
|
|
|
|
|
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 ("sibling".equals(addType)) {
|
|
|
supsubcomid = subCompanyComInfo.getSupsubcomid(id);
|
|
|
} else if ("child".equals(addType)) {
|
|
|
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 || !"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);
|
|
|
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 fieldValue = "";
|
|
|
if (StringUtils.isNotBlank(addType)) {
|
|
|
} else {
|
|
|
if ("1".equals(HrmFieldComInfo.getIssystem(fieldId))) {
|
|
|
fieldValue = hfm.getData(fieldName);
|
|
|
} else {
|
|
|
fieldValue = hfm.getData("hrmsubcompanydefined", 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 ("84".equals(fieldId)) {
|
|
|
if (user.getUID() != 1) {
|
|
|
continue;
|
|
|
}
|
|
|
fieldValue = "0".equals(fieldValue) ? "" : fieldValue;
|
|
|
}
|
|
|
if (supsubcomid.length() > 0 && "supsubcomid".equals(fieldName)) {
|
|
|
fieldValue = supsubcomid;
|
|
|
}
|
|
|
|
|
|
if ("subshowid".equals(fieldName)) {
|
|
|
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 ("supsubcomid".equals(hrmFieldBean.getFieldname())) {
|
|
|
hrmFieldBean.setHideVirtualOrg(true);
|
|
|
}
|
|
|
if ("subcompanycode".equals(hrmFieldBean.getFieldname())) {
|
|
|
hrmFieldBean.setMultilang(false);
|
|
|
}
|
|
|
SearchConditionItem searchConditionItem = hrmFieldSearchConditionComInfo.getSearchConditionItem(hrmFieldBean, user);
|
|
|
if (searchConditionItem != null) {
|
|
|
searchConditionItem.setLabelcol(8);
|
|
|
searchConditionItem.setFieldcol(16);
|
|
|
if ("showorder".equals(hrmFieldBean.getFieldname())) {
|
|
|
searchConditionItem.setPrecision(2);
|
|
|
}
|
|
|
if ("subshowid".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);
|
|
|
}
|
|
|
|
|
|
itemList.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<CompanyPO> compPOS = getCompanyMapper().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(CompanyPO 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<CompanyPO> compPOS) {
|
|
|
for (CompanyPO compPO : compPOS) {
|
|
|
disableIds.add(compPO.getId());
|
|
|
List<CompanyPO> childCompPOS = getCompanyMapper().listChild(DeleteParam.builder().ids(compPO.getId().toString()).build().getIds());
|
|
|
addDisableIds(disableIds, childCompPOS);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|