|
|
|
|
package com.engine.organization.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.api.browser.bean.BrowserBean;
|
|
|
|
|
import com.api.browser.bean.SearchConditionGroup;
|
|
|
|
|
import com.api.browser.bean.SearchConditionItem;
|
|
|
|
|
import com.api.browser.bean.SearchConditionOption;
|
|
|
|
|
import com.api.hrm.bean.TreeNode;
|
|
|
|
|
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.organization.component.OrganizationWeaTable;
|
|
|
|
|
import com.engine.organization.entity.DeleteParam;
|
|
|
|
|
import com.engine.organization.entity.company.bo.CompBO;
|
|
|
|
|
import com.engine.organization.entity.company.po.CompPO;
|
|
|
|
|
import com.engine.organization.entity.department.bo.DepartmentBO;
|
|
|
|
|
import com.engine.organization.entity.department.dto.DepartmentListDTO;
|
|
|
|
|
import com.engine.organization.entity.department.po.DepartmentPO;
|
|
|
|
|
import com.engine.organization.entity.employee.vo.EmployeeTableVO;
|
|
|
|
|
import com.engine.organization.entity.extend.bo.ExtendInfoBO;
|
|
|
|
|
import com.engine.organization.entity.extend.po.ExtendInfoPO;
|
|
|
|
|
import com.engine.organization.entity.job.bo.JobBO;
|
|
|
|
|
import com.engine.organization.entity.job.dto.JobListDTO;
|
|
|
|
|
import com.engine.organization.entity.job.param.JobSearchParam;
|
|
|
|
|
import com.engine.organization.entity.job.po.JobDTPO;
|
|
|
|
|
import com.engine.organization.entity.job.po.JobPO;
|
|
|
|
|
import com.engine.organization.entity.scheme.po.GradePO;
|
|
|
|
|
import com.engine.organization.entity.searchtree.SearchTree;
|
|
|
|
|
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
|
|
|
|
import com.engine.organization.mapper.comp.CompMapper;
|
|
|
|
|
import com.engine.organization.mapper.department.DepartmentMapper;
|
|
|
|
|
import com.engine.organization.mapper.extend.ExtendGroupMapper;
|
|
|
|
|
import com.engine.organization.mapper.job.JobDTMapper;
|
|
|
|
|
import com.engine.organization.mapper.job.JobMapper;
|
|
|
|
|
import com.engine.organization.mapper.scheme.GradeMapper;
|
|
|
|
|
import com.engine.organization.mapper.scheme.LevelMapper;
|
|
|
|
|
import com.engine.organization.mapper.scheme.SchemeMapper;
|
|
|
|
|
import com.engine.organization.mapper.sequence.SequenceMapper;
|
|
|
|
|
import com.engine.organization.service.ExtService;
|
|
|
|
|
import com.engine.organization.service.JobService;
|
|
|
|
|
import com.engine.organization.util.MenuBtn;
|
|
|
|
|
import com.engine.organization.util.OrganizationAssert;
|
|
|
|
|
import com.engine.organization.util.OrganizationFormItemUtil;
|
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
|
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.collections4.CollectionUtils;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
import weaver.general.StringUtil;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
import weaver.hrm.User;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description: TODO
|
|
|
|
|
* @author:dxfeng
|
|
|
|
|
* @createTime: 2022/05/26
|
|
|
|
|
* @version: 1.0
|
|
|
|
|
*/
|
|
|
|
|
public class JobServiceImpl extends Service implements JobService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 左侧树 类型表示
|
|
|
|
|
* <p>
|
|
|
|
|
* 0:集团
|
|
|
|
|
* 1:分部
|
|
|
|
|
* 2:部门
|
|
|
|
|
*/
|
|
|
|
|
private static final String TYPE_GROUP = "0";
|
|
|
|
|
private static final String TYPE_COMP = "1";
|
|
|
|
|
private static final String TYPE_DEPT = "2";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 分组类型
|
|
|
|
|
* 1:分部
|
|
|
|
|
* 2:部门
|
|
|
|
|
* 3:岗位
|
|
|
|
|
*/
|
|
|
|
|
private static final String EXTEND_TYPE = "3";
|
|
|
|
|
/**
|
|
|
|
|
* 主表拓展表
|
|
|
|
|
*/
|
|
|
|
|
private static final String JCL_ORG_JOBEXT = "JCL_ORG_JOBEXT";
|
|
|
|
|
/**
|
|
|
|
|
* 明细表拓展表
|
|
|
|
|
*/
|
|
|
|
|
private static final String JCL_ORG_JOBEXT_DT1 = "JCL_ORG_JOBEXT_DT1";
|
|
|
|
|
|
|
|
|
|
private JobMapper getJobMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(JobMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private JobDTMapper getJobDTMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(JobDTMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private CompMapper getCompMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(CompMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DepartmentMapper getDepartmentMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private SequenceMapper getSequenceMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(SequenceMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private SchemeMapper getSchemeMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(SchemeMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ExtendGroupMapper getExtendGroupMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(ExtendGroupMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ExtService getExtService(User user) {
|
|
|
|
|
return ServiceUtil.getService(ExtServiceImpl.class, user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getSearchTree(SearchTreeParams params) {
|
|
|
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
|
SearchTree topGroup = getTopGroup();
|
|
|
|
|
// 集团
|
|
|
|
|
List<SearchTree> companyList = new ArrayList<>();
|
|
|
|
|
companyList.add(topGroup);
|
|
|
|
|
String keyword = params.getKeyword();
|
|
|
|
|
String type = Util.null2String(params.getType());
|
|
|
|
|
String id = params.getId();
|
|
|
|
|
|
|
|
|
|
List<TreeNode> treeDatas = getFilterCompany(id, type, keyword);
|
|
|
|
|
// 未点击,初始化树结构
|
|
|
|
|
if (StringUtil.isEmpty(type)) {
|
|
|
|
|
dataMap.put("companys", companyList);
|
|
|
|
|
SearchTree rootCompany = getTopGroup();
|
|
|
|
|
rootCompany.setSubs(treeDatas);
|
|
|
|
|
rootCompany.setIsParent(CollectionUtils.isNotEmpty(rootCompany.getSubs()));
|
|
|
|
|
Map<String, Object> rootCompanyMap = new HashMap<>();
|
|
|
|
|
rootCompanyMap.put("rootCompany", rootCompany);
|
|
|
|
|
dataMap.put("datas", rootCompanyMap);
|
|
|
|
|
} else {
|
|
|
|
|
// 根据ID查询
|
|
|
|
|
dataMap.put("datas", treeDatas);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dataMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> listPage(JobSearchParam param) {
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
JobPO jobPO = JobBO.convertParamsToPO(param, user.getUID());
|
|
|
|
|
boolean filter = isFilter(jobPO);
|
|
|
|
|
PageInfo<JobListDTO> pageInfos;
|
|
|
|
|
List<JobListDTO> allList = getJobMapper().listNoFilter();
|
|
|
|
|
// 通过子级遍历父级元素
|
|
|
|
|
if (filter) {
|
|
|
|
|
// 根据条件获取元素
|
|
|
|
|
List<JobListDTO> filterJobPOs = getJobMapper().listByFilter(jobPO);
|
|
|
|
|
// 添加父级元素
|
|
|
|
|
List<JobListDTO> compListDTOS = JobBO.buildJobDTOList(allList, filterJobPOs);
|
|
|
|
|
List<JobListDTO> subList = PageUtil.subList(param.getCurrent(), param.getPageSize(), compListDTOS);
|
|
|
|
|
pageInfos = new PageInfo<>(subList, JobListDTO.class);
|
|
|
|
|
pageInfos.setTotal(compListDTOS.size());
|
|
|
|
|
} else {
|
|
|
|
|
// 组合list
|
|
|
|
|
List<JobListDTO> compListDTOS = JobBO.buildDTOList(allList);
|
|
|
|
|
List<JobListDTO> subList = PageUtil.subList(param.getCurrent(), param.getPageSize(), compListDTOS);
|
|
|
|
|
pageInfos = new PageInfo<>(subList, JobListDTO.class);
|
|
|
|
|
pageInfos.setTotal(compListDTOS.size());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pageInfos.setPageNum(param.getCurrent());
|
|
|
|
|
pageInfos.setPageSize(param.getPageSize());
|
|
|
|
|
|
|
|
|
|
OrganizationWeaTable<DepartmentListDTO> table = new OrganizationWeaTable<>(user, DepartmentListDTO.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 Map<String, Object> getHasRight() {
|
|
|
|
|
Map<String, Object> btnDatas = new HashMap<>();
|
|
|
|
|
ArrayList<MenuBtn> topMenuList = new ArrayList<>();
|
|
|
|
|
ArrayList<MenuBtn> rightMenuList = new ArrayList<>();
|
|
|
|
|
// 新增
|
|
|
|
|
topMenuList.add(MenuBtn.topMenu_addNew());
|
|
|
|
|
// 批量删除
|
|
|
|
|
topMenuList.add(MenuBtn.topMenu_batchDelete());
|
|
|
|
|
// 复制
|
|
|
|
|
topMenuList.add(MenuBtn.topMenu_copy());
|
|
|
|
|
btnDatas.put("topMenu", topMenuList);
|
|
|
|
|
// 新增
|
|
|
|
|
rightMenuList.add(MenuBtn.rightMenu_addNew());
|
|
|
|
|
// 复制
|
|
|
|
|
rightMenuList.add(MenuBtn.rightMenu_copy());
|
|
|
|
|
// 日志
|
|
|
|
|
rightMenuList.add(MenuBtn.rightMenu_btnLog());
|
|
|
|
|
btnDatas.put("rightMenu", rightMenuList);
|
|
|
|
|
return btnDatas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getSearchCondition() {
|
|
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
|
|
|
|
// 编号
|
|
|
|
|
SearchConditionItem jobNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "编号", "jobNo");
|
|
|
|
|
// 名称
|
|
|
|
|
SearchConditionItem jobNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "jobName");
|
|
|
|
|
// 所属分部
|
|
|
|
|
SearchConditionItem parentCompBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属分部", "161", "parentComp", "compBrowser");
|
|
|
|
|
// 所属部门
|
|
|
|
|
SearchConditionItem parentDeptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属部门", "161", "parentDept", "deptBrowser");
|
|
|
|
|
// 岗位序列
|
|
|
|
|
SearchConditionItem sequenceBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "岗位序列", "161", "sequenceId", "sequenceBrowser");
|
|
|
|
|
// 等级方案
|
|
|
|
|
SearchConditionItem schemeBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "等级方案", "161", "schemeId", "schemeBrowser");
|
|
|
|
|
// 上级岗位
|
|
|
|
|
SearchConditionItem parentJobBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "上级岗位", "161", "parentJob", "jobBrowser");
|
|
|
|
|
// 是否关键岗
|
|
|
|
|
List<SearchConditionOption> isKeyOptions = new ArrayList<>();
|
|
|
|
|
SearchConditionOption yesOption = new SearchConditionOption("0", "否");
|
|
|
|
|
SearchConditionOption noOption = new SearchConditionOption("1", "是");
|
|
|
|
|
isKeyOptions.add(yesOption);
|
|
|
|
|
isKeyOptions.add(noOption);
|
|
|
|
|
SearchConditionItem isKeyItem = OrganizationFormItemUtil.selectItem(user, isKeyOptions, 2, 16, 6, false, "是否关键岗", "forbiddenTag");
|
|
|
|
|
// 工作地点
|
|
|
|
|
SearchConditionItem workplaceItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "工作地点", "workplace");
|
|
|
|
|
// 工作概述
|
|
|
|
|
// SearchConditionItem descriptionItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "工作概述", "description");
|
|
|
|
|
// 任职职责
|
|
|
|
|
//SearchConditionItem workDutyItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "任职职责", "workDuty");
|
|
|
|
|
// 工作权限
|
|
|
|
|
// SearchConditionItem workAuthorityItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "工作权限", "workAuthority");
|
|
|
|
|
// 禁用标记
|
|
|
|
|
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(jobNoItem);
|
|
|
|
|
conditionItems.add(jobNameItem);
|
|
|
|
|
conditionItems.add(parentCompBrowserItem);
|
|
|
|
|
conditionItems.add(parentDeptBrowserItem);
|
|
|
|
|
conditionItems.add(sequenceBrowserItem);
|
|
|
|
|
conditionItems.add(schemeBrowserItem);
|
|
|
|
|
conditionItems.add(parentJobBrowserItem);
|
|
|
|
|
conditionItems.add(isKeyItem);
|
|
|
|
|
conditionItems.add(workplaceItem);
|
|
|
|
|
//conditionItems.add(descriptionItem);
|
|
|
|
|
//conditionItems.add(workDutyItem);
|
|
|
|
|
//conditionItems.add(workAuthorityItem);
|
|
|
|
|
conditionItems.add(forbiddenTagItem);
|
|
|
|
|
|
|
|
|
|
addGroups.add(new SearchConditionGroup("高级搜索条件", true, conditionItems));
|
|
|
|
|
apiDatas.put("conditions", addGroups);
|
|
|
|
|
return apiDatas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getSaveForm() {
|
|
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
|
|
|
|
// 编号
|
|
|
|
|
SearchConditionItem jobNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "编号", "jobNo");
|
|
|
|
|
jobNoItem.setRules("required|string");
|
|
|
|
|
// 名称
|
|
|
|
|
SearchConditionItem jobNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "名称", "jobName");
|
|
|
|
|
jobNameItem.setRules("required|string");
|
|
|
|
|
// 所属分部
|
|
|
|
|
SearchConditionItem parentCompBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属分部", "161", "parentComp", "compBrowser");
|
|
|
|
|
// 所属部门
|
|
|
|
|
SearchConditionItem parentDeptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属部门", "161", "parentDept", "deptBrowser");
|
|
|
|
|
// 岗位序列
|
|
|
|
|
SearchConditionItem sequenceBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "岗位序列", "161", "sequenceId", "sequenceBrowser");
|
|
|
|
|
// 等级方案
|
|
|
|
|
SearchConditionItem schemeBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "等级方案", "161", "schemeId", "schemeBrowser");
|
|
|
|
|
// 上级岗位
|
|
|
|
|
SearchConditionItem parentJobBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "上级岗位", "161", "parentJob", "jobBrowser");
|
|
|
|
|
// 是否关键岗
|
|
|
|
|
List<SearchConditionOption> isKeyOptions = new ArrayList<>();
|
|
|
|
|
SearchConditionOption yesOption = new SearchConditionOption("0", "否");
|
|
|
|
|
SearchConditionOption noOption = new SearchConditionOption("1", "是");
|
|
|
|
|
isKeyOptions.add(yesOption);
|
|
|
|
|
isKeyOptions.add(noOption);
|
|
|
|
|
SearchConditionItem isKeyItem = OrganizationFormItemUtil.selectItem(user, isKeyOptions, 2, 16, 6, false, "是否关键岗", "isKey");
|
|
|
|
|
isKeyItem.setDetailtype(3);
|
|
|
|
|
|
|
|
|
|
conditionItems.add(jobNoItem);
|
|
|
|
|
conditionItems.add(jobNameItem);
|
|
|
|
|
conditionItems.add(parentCompBrowserItem);
|
|
|
|
|
conditionItems.add(parentDeptBrowserItem);
|
|
|
|
|
conditionItems.add(sequenceBrowserItem);
|
|
|
|
|
conditionItems.add(schemeBrowserItem);
|
|
|
|
|
conditionItems.add(parentJobBrowserItem);
|
|
|
|
|
conditionItems.add(isKeyItem);
|
|
|
|
|
|
|
|
|
|
addGroups.add(new SearchConditionGroup("基本信息", true, conditionItems));
|
|
|
|
|
apiDatas.put("condition", addGroups);
|
|
|
|
|
return apiDatas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getJobBaseForm(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 (StringUtil.isEmpty(groupId) || "0".equals(groupId)) {
|
|
|
|
|
addGroups.add(new SearchConditionGroup("基本信息", true, getBaseForm(viewAttr, id)));
|
|
|
|
|
} else {
|
|
|
|
|
addGroups.add(new SearchConditionGroup(getExtendGroupMapper().getGroupNameById(groupId), true, getExtService(user).getExtForm(user, EXTEND_TYPE, JCL_ORG_JOBEXT, viewAttr, id, groupId)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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_JOBEXT));
|
|
|
|
|
// 处理明细表
|
|
|
|
|
List<Map<String, Object>> extendTables = getExtService(user).getExtendTables(user, EXTEND_TYPE, JCL_ORG_JOBEXT_DT1, id, viewAttr, false);
|
|
|
|
|
|
|
|
|
|
Map<String, Object> tableMap = new HashMap<>();
|
|
|
|
|
tableMap.put("hide", false);
|
|
|
|
|
tableMap.put("tabname", "职等职级");
|
|
|
|
|
Map<String, Object> tabinfoMap = new HashMap<>();
|
|
|
|
|
List<ExtendInfoPO> infoPOList = new ArrayList<>();
|
|
|
|
|
infoPOList.add(ExtendInfoPO.builder().fieldName("gradeId").fieldNameDesc("职级").controlType(3).isrequired(1).browserType("161").customBrowserId("gradeBrowser").build());
|
|
|
|
|
infoPOList.add(ExtendInfoPO.builder().fieldName("levelId").fieldNameDesc("职等").controlType(3).isrequired(1).browserType("162").customBrowserId("levelBrowser").build());
|
|
|
|
|
tabinfoMap.put("columns", ExtendInfoBO.convertInfoListToTable(user, infoPOList, viewAttr, false));
|
|
|
|
|
tabinfoMap.put("rownum", "rownum");
|
|
|
|
|
// 去除null 元素
|
|
|
|
|
List<JobDTPO> maps = getJobDTMapper().listJobDTByMainID(id);
|
|
|
|
|
maps.removeIf(Objects::isNull);
|
|
|
|
|
tabinfoMap.put("datas", maps);
|
|
|
|
|
tableMap.put("tabinfo", tabinfoMap);
|
|
|
|
|
// 添加明细表
|
|
|
|
|
extendTables.add(0, tableMap);
|
|
|
|
|
|
|
|
|
|
resultMap.put("tables", extendTables);
|
|
|
|
|
|
|
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
apiDatas.put("result", resultMap);
|
|
|
|
|
|
|
|
|
|
return apiDatas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int saveBaseForm(JobSearchParam params) {
|
|
|
|
|
List<JobPO> list = getJobMapper().listByNo(Util.null2String(params.getJobNo()));
|
|
|
|
|
OrganizationAssert.isEmpty(list, "编号不允许重复");
|
|
|
|
|
JobPO jobPO = JobBO.convertParamsToPO(params, user.getUID());
|
|
|
|
|
jobPO.setIsKey(null == jobPO.getIsKey() ? 0 : jobPO.getIsKey());
|
|
|
|
|
int insertCount = getJobMapper().insertIgnoreNull(jobPO);
|
|
|
|
|
if (null != jobPO.getSchemeId()) {
|
|
|
|
|
// 插入明细表信息
|
|
|
|
|
// 根据等级方案查询职等、职级
|
|
|
|
|
List<GradePO> gradePOS = MapperProxyFactory.getProxy(GradeMapper.class).listGradesBySchemeId(jobPO.getSchemeId());
|
|
|
|
|
for (GradePO gradePO : gradePOS) {
|
|
|
|
|
List<Map<String, Object>> maps = MapperProxyFactory.getProxy(LevelMapper.class).listLevelsByIds(DeleteParam.builder().ids(gradePO.getLevelId()).build().getIds());
|
|
|
|
|
String levelNames = maps.stream().map(item -> (String) item.get("name")).collect(Collectors.joining(","));
|
|
|
|
|
insertCount += getJobDTMapper().insertIgnoreNull(JobDTPO.builder().levelId(gradePO.getLevelId()).gradeId(gradePO.getId() + "").levelIdspan(levelNames).gradeIdspan(gradePO.getGradeName()).mainId(jobPO.getId()).creator((long) user.getUID()).deleteType(0).createTime(new Date()).updateTime(new Date()).build());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return insertCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int updateForm(Map<String, Object> params) {
|
|
|
|
|
JobSearchParam searchParam = JSONObject.parseObject(JSONObject.toJSONString(params), JobSearchParam.class);
|
|
|
|
|
String groupId = (String) params.get("viewCondition");
|
|
|
|
|
JobPO jobPO = JobBO.convertParamsToPO(searchParam, user.getUID());
|
|
|
|
|
jobPO.setIsKey(null == jobPO.getIsKey() ? 0 : jobPO.getIsKey());
|
|
|
|
|
int updateCount = 0;
|
|
|
|
|
// 更新主表数据
|
|
|
|
|
updateCount += getJobMapper().updateBaseJob(jobPO);
|
|
|
|
|
// 更新主表拓展表
|
|
|
|
|
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOBEXT, params, groupId, jobPO.getId());
|
|
|
|
|
// 更新明细表
|
|
|
|
|
getJobDTMapper().deleteByIds(jobPO.getId());
|
|
|
|
|
int rowNum = Util.getIntValue((String) params.get("rownum"));
|
|
|
|
|
for (int i = 0; i < rowNum; i++) {
|
|
|
|
|
String levelId = (String) params.get("levelId_" + i);
|
|
|
|
|
String gradeId = (String) params.get("gradeId_" + i);
|
|
|
|
|
String levelIdspan = (String) params.get("levelIdspan_" + i);
|
|
|
|
|
String gradeIdspan = (String) params.get("gradeIdspan_" + i);
|
|
|
|
|
getJobDTMapper().insertIgnoreNull(JobDTPO.builder().levelId(levelId).gradeId(gradeId).levelIdspan(levelIdspan).gradeIdspan(gradeIdspan).mainId(jobPO.getId()).creator((long) user.getUID()).deleteType(0).createTime(new Date()).updateTime(new Date()).build());
|
|
|
|
|
}
|
|
|
|
|
getExtService(user).updateExtDT(user, EXTEND_TYPE, JCL_ORG_JOBEXT_DT1, params, jobPO.getId());
|
|
|
|
|
return updateCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int copyJobItem(String ids, String department) {
|
|
|
|
|
OrganizationAssert.notBlank(department, "请指定需要复制的部门");
|
|
|
|
|
int insertCount = 0;
|
|
|
|
|
List<Long> idList = Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList());
|
|
|
|
|
for (Long id : idList) {
|
|
|
|
|
JobPO jobById = getJobMapper().getJobById(id);
|
|
|
|
|
// TODO 自动编号
|
|
|
|
|
jobById.setJobNo("复制_" + jobById.getJobNo());
|
|
|
|
|
jobById.setParentDept(Long.parseLong(department));
|
|
|
|
|
insertCount += getJobMapper().insertIgnoreNull(jobById);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return insertCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int updateForbiddenTagById(JobSearchParam params) {
|
|
|
|
|
JobPO jobPO = JobPO.builder().id(params.getId()).forbiddenTag(params.getForbiddenTag() ? 0 : 1).build();
|
|
|
|
|
return getJobMapper().updateForbiddenTagById(jobPO.getId(), jobPO.getForbiddenTag());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int deleteByIds(Collection<Long> ids) {
|
|
|
|
|
OrganizationAssert.notEmpty(ids, "请选择要删除的数据");
|
|
|
|
|
Collection<Long> deleteIds = new ArrayList<>();
|
|
|
|
|
// 递归删除子节点
|
|
|
|
|
getChildIds(ids, deleteIds);
|
|
|
|
|
return getJobMapper().deleteByIds(deleteIds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getHrmListByJobId(Long jobId) {
|
|
|
|
|
OrganizationWeaTable<EmployeeTableVO> table = new OrganizationWeaTable<>(user, EmployeeTableVO.class);
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
|
result.putAll(table.makeDataResult());
|
|
|
|
|
result.success();
|
|
|
|
|
return result.getResultMap();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加查询元素的父级元素
|
|
|
|
|
*
|
|
|
|
|
* @param departmentPO
|
|
|
|
|
* @param builderDeparts
|
|
|
|
|
*/
|
|
|
|
|
private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) {
|
|
|
|
|
builderDeparts.add(departmentPO);
|
|
|
|
|
if (isTop(departmentPO.getParentDept())) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getParentDept());
|
|
|
|
|
if (null != parentDept) {
|
|
|
|
|
buildParentDepts(parentDept, builderDeparts);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加查询元素的父级元素
|
|
|
|
|
*
|
|
|
|
|
* @param compPO
|
|
|
|
|
* @param builderComps
|
|
|
|
|
*/
|
|
|
|
|
private void buildParentComps(CompPO compPO, Set<CompPO> builderComps) {
|
|
|
|
|
builderComps.add(compPO);
|
|
|
|
|
if (isTop(compPO.getParentCompany())) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
CompPO parentComp = getCompMapper().listById(compPO.getParentCompany());
|
|
|
|
|
if (null != parentComp) {
|
|
|
|
|
buildParentComps(parentComp, builderComps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取集团
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private SearchTree getTopGroup() {
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
String sql = "select * from HrmCompany ";
|
|
|
|
|
rs.executeQuery(sql);
|
|
|
|
|
SearchTree groupTree = new SearchTree();
|
|
|
|
|
groupTree.setCanClick(false);
|
|
|
|
|
groupTree.setCanceled(false);
|
|
|
|
|
groupTree.setCompanyid("1");
|
|
|
|
|
groupTree.setIcon("icon-coms-LargeArea");
|
|
|
|
|
groupTree.setId("0");
|
|
|
|
|
groupTree.setIsVirtual("0");
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
groupTree.setName(rs.getString("COMPANYNAME"));
|
|
|
|
|
}
|
|
|
|
|
groupTree.setSelected(false);
|
|
|
|
|
groupTree.setType(TYPE_GROUP);
|
|
|
|
|
return groupTree;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据keyword查询数据
|
|
|
|
|
*
|
|
|
|
|
* @param id
|
|
|
|
|
* @param type
|
|
|
|
|
* @param keyword
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private List<TreeNode> getFilterCompany(String id, String type, String keyword) {
|
|
|
|
|
List<TreeNode> compSearchTree = new ArrayList<>();
|
|
|
|
|
// 通过分部、公司 组装数据
|
|
|
|
|
if (StringUtil.isEmpty(id) || TYPE_COMP.equals(type)) {
|
|
|
|
|
Long parentCompId = StringUtil.isEmpty(id) ? null : Long.parseLong(id);
|
|
|
|
|
DepartmentPO departmentBuild = DepartmentPO.builder().deptName(keyword).parentComp(parentCompId).build();
|
|
|
|
|
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).build();
|
|
|
|
|
buildTreeByCompAndDept(departmentBuild, compBuild, compSearchTree);
|
|
|
|
|
} else if (TYPE_DEPT.equals(type)) {
|
|
|
|
|
//
|
|
|
|
|
// 查询部门信息
|
|
|
|
|
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(DepartmentPO.builder().deptName(keyword).parentDept(Long.parseLong(id)).build());
|
|
|
|
|
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
|
|
|
|
for (DepartmentPO departmentPO : filterDeparts) {
|
|
|
|
|
buildParentDepts(departmentPO, builderDeparts);
|
|
|
|
|
}
|
|
|
|
|
List<SearchTree> deptTrees = builderTreeMode(DepartmentBO.buildSetToSearchTree(builderDeparts));
|
|
|
|
|
// 排序,设置是否为叶子节点
|
|
|
|
|
List<TreeNode> collect = deptTrees.stream().peek(item ->
|
|
|
|
|
item.setIsParent(CollectionUtils.isNotEmpty(item.getSubs()))
|
|
|
|
|
).sorted(Comparator.comparing(item -> Integer.parseInt(item.getId()))).collect(Collectors.toList());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(collect)) {
|
|
|
|
|
compSearchTree.addAll(collect);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return compSearchTree;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 分部、部门 组装左侧树
|
|
|
|
|
*
|
|
|
|
|
* @param departmentBuild
|
|
|
|
|
* @param compBuild
|
|
|
|
|
* @param compSearchTree
|
|
|
|
|
*/
|
|
|
|
|
private void buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild, List<TreeNode> compSearchTree) {
|
|
|
|
|
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild);
|
|
|
|
|
// 查询分部信息
|
|
|
|
|
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild);
|
|
|
|
|
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
|
|
|
|
for (DepartmentPO departmentPO : filterDeparts) {
|
|
|
|
|
buildParentDepts(departmentPO, builderDeparts);
|
|
|
|
|
}
|
|
|
|
|
List<SearchTree> deptTrees = builderTreeMode(DepartmentBO.buildSetToSearchTree(builderDeparts));
|
|
|
|
|
// 添加部门的上级分部
|
|
|
|
|
String parentCompS = deptTrees.stream().map(SearchTree::getParentComp).collect(Collectors.joining(","));
|
|
|
|
|
if (!StringUtil.isEmpty(parentCompS)) {
|
|
|
|
|
List<CompPO> compsByIds = getCompMapper().getCompsByIds(DeleteParam.builder().ids(parentCompS).build().getIds());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(compsByIds)) {
|
|
|
|
|
filterComps.addAll(compsByIds);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Set<CompPO> builderComps = new HashSet<>();
|
|
|
|
|
for (CompPO compPO : filterComps) {
|
|
|
|
|
buildParentComps(compPO, builderComps);
|
|
|
|
|
}
|
|
|
|
|
List<TreeNode> compTrees = builderTreeMode(CompBO.buildSetToSearchTree(builderComps), deptTrees);
|
|
|
|
|
|
|
|
|
|
// 排序,设置是否为叶子节点
|
|
|
|
|
List<TreeNode> collect = compTrees.stream().peek(item ->
|
|
|
|
|
item.setIsParent(CollectionUtils.isNotEmpty(item.getSubs()))
|
|
|
|
|
).sorted(Comparator.comparing(item -> Integer.parseInt(item.getId()))).collect(Collectors.toList());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(collect)) {
|
|
|
|
|
compSearchTree.addAll(collect);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断是为顶层数据
|
|
|
|
|
*
|
|
|
|
|
* @param pid
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean isTop(Long pid) {
|
|
|
|
|
return null == pid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断是为顶层数据
|
|
|
|
|
*
|
|
|
|
|
* @param pid
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean isTop(String pid) {
|
|
|
|
|
return StringUtil.isEmpty(pid) || "0".equals(pid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 处理树层级
|
|
|
|
|
*
|
|
|
|
|
* @param treeList
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private List<SearchTree> builderTreeMode(List<SearchTree> treeList) {
|
|
|
|
|
Map<String, List<TreeNode>> collects = treeList.stream().collect(Collectors.groupingBy(TreeNode::getPid));
|
|
|
|
|
return treeList.stream().peek(e -> e.setSubs(collects.get(e.getId()))).peek(item -> {
|
|
|
|
|
if (CollectionUtils.isNotEmpty(item.getSubs())) {
|
|
|
|
|
item.setIsParent(true);
|
|
|
|
|
}
|
|
|
|
|
}).filter(item -> isTop(item.getPid())).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 组合分部、部门层级关系
|
|
|
|
|
*
|
|
|
|
|
* @param treeList
|
|
|
|
|
* @param deptTrees
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private List<TreeNode> builderTreeMode(List<TreeNode> treeList, List<SearchTree> deptTrees) {
|
|
|
|
|
Map<String, List<TreeNode>> parentMap = treeList.stream().collect(Collectors.groupingBy(TreeNode::getPid));
|
|
|
|
|
Map<String, List<SearchTree>> childMap = deptTrees.stream().collect(Collectors.groupingBy(SearchTree::getParentComp));
|
|
|
|
|
boolean isAdd = !childMap.isEmpty();
|
|
|
|
|
return treeList.stream().peek(e -> {
|
|
|
|
|
List<TreeNode> treeNodes = new ArrayList<>();
|
|
|
|
|
List<TreeNode> nodes = parentMap.get(e.getId());
|
|
|
|
|
if (CollectionUtils.isNotEmpty(nodes)) {
|
|
|
|
|
treeNodes.addAll(nodes);
|
|
|
|
|
}
|
|
|
|
|
if (isAdd && CollectionUtils.isNotEmpty(childMap.get(e.getId()))) {
|
|
|
|
|
treeNodes.addAll(childMap.get(e.getId()));
|
|
|
|
|
}
|
|
|
|
|
e.setSubs(treeNodes);
|
|
|
|
|
}).peek(item -> {
|
|
|
|
|
if (CollectionUtils.isNotEmpty(item.getSubs())) {
|
|
|
|
|
item.setIsParent(true);
|
|
|
|
|
}
|
|
|
|
|
}).filter(item -> isTop(item.getPid())).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 是否有搜索查询
|
|
|
|
|
*
|
|
|
|
|
* @param jobPO
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private boolean isFilter(JobPO jobPO) {
|
|
|
|
|
return !(StringUtil.isEmpty(jobPO.getJobNo())
|
|
|
|
|
&& StringUtil.isEmpty(jobPO.getJobName())
|
|
|
|
|
&& StringUtil.isEmpty(jobPO.getWorkplace())
|
|
|
|
|
&& StringUtil.isEmpty(jobPO.getDescription())
|
|
|
|
|
&& StringUtil.isEmpty(jobPO.getWorkDuty())
|
|
|
|
|
&& StringUtil.isEmpty(jobPO.getWorkAuthority())
|
|
|
|
|
&& null == jobPO.getParentComp()
|
|
|
|
|
&& null == jobPO.getParentDept()
|
|
|
|
|
&& null == jobPO.getSequenceId()
|
|
|
|
|
&& null == jobPO.getSchemeId()
|
|
|
|
|
&& null == jobPO.getIsKey())
|
|
|
|
|
&& null == jobPO.getForbiddenTag();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 基本信息基础表单
|
|
|
|
|
*
|
|
|
|
|
* @param viewAttr
|
|
|
|
|
* @param id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private List<SearchConditionItem> getBaseForm(int viewAttr, long id) {
|
|
|
|
|
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
|
|
|
|
// 编号
|
|
|
|
|
SearchConditionItem jobNoItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 1, 50, "编号", "jobNo");
|
|
|
|
|
// 名称
|
|
|
|
|
SearchConditionItem jobNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 3, 50, "名称", "jobName");
|
|
|
|
|
jobNameItem.setRules("required|string");
|
|
|
|
|
// 所属分部
|
|
|
|
|
SearchConditionItem parentCompBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属分部", "161", "parentComp", "compBrowser");
|
|
|
|
|
// 所属部门
|
|
|
|
|
SearchConditionItem parentDeptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属部门", "161", "parentDept", "deptBrowser");
|
|
|
|
|
// 岗位序列
|
|
|
|
|
SearchConditionItem sequenceBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "岗位序列", "161", "sequenceId", "sequenceBrowser");
|
|
|
|
|
// 等级方案
|
|
|
|
|
SearchConditionItem schemeBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 3, false, "等级方案", "161", "schemeId", "schemeBrowser");
|
|
|
|
|
// 上级岗位
|
|
|
|
|
SearchConditionItem parentJobBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "上级岗位", "161", "parentJob", "jobBrowser");
|
|
|
|
|
// 是否关键岗
|
|
|
|
|
List<SearchConditionOption> isKeyOptions = new ArrayList<>();
|
|
|
|
|
SearchConditionOption yesOption = new SearchConditionOption("0", "否");
|
|
|
|
|
SearchConditionOption noOption = new SearchConditionOption("1", "是");
|
|
|
|
|
isKeyOptions.add(yesOption);
|
|
|
|
|
isKeyOptions.add(noOption);
|
|
|
|
|
SearchConditionItem isKeyItem = OrganizationFormItemUtil.selectItem(user, isKeyOptions, 2, 16, 6, false, "是否关键岗", "isKey");
|
|
|
|
|
isKeyItem.setDetailtype(3);
|
|
|
|
|
// 工作地点
|
|
|
|
|
SearchConditionItem workplaceItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "工作地点", "workplace");
|
|
|
|
|
// 工作概述
|
|
|
|
|
SearchConditionItem descriptionItem = OrganizationFormItemUtil.textareaItem(user, 2, 16, false, 2, 50, "工作概述", "description");
|
|
|
|
|
// 任职职责
|
|
|
|
|
SearchConditionItem workDutyItem = OrganizationFormItemUtil.textareaItem(user, 2, 16, false, 2, 50, "任职职责", "workDuty");
|
|
|
|
|
// 工作权限
|
|
|
|
|
SearchConditionItem workAuthorityItem = OrganizationFormItemUtil.textareaItem(user, 2, 16, false, 2, 50, "工作权限", "workAuthority");
|
|
|
|
|
|
|
|
|
|
conditionItems.add(jobNoItem);
|
|
|
|
|
conditionItems.add(jobNameItem);
|
|
|
|
|
conditionItems.add(parentCompBrowserItem);
|
|
|
|
|
conditionItems.add(parentDeptBrowserItem);
|
|
|
|
|
conditionItems.add(sequenceBrowserItem);
|
|
|
|
|
conditionItems.add(schemeBrowserItem);
|
|
|
|
|
conditionItems.add(parentJobBrowserItem);
|
|
|
|
|
conditionItems.add(isKeyItem);
|
|
|
|
|
conditionItems.add(workplaceItem);
|
|
|
|
|
conditionItems.add(descriptionItem);
|
|
|
|
|
conditionItems.add(workDutyItem);
|
|
|
|
|
conditionItems.add(workAuthorityItem);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 编辑、查看状态赋值,设置只读状态
|
|
|
|
|
JobPO jobPO = getJobMapper().getJobById(id);
|
|
|
|
|
OrganizationAssert.notNull(jobPO, "数据不存在或数据已删除");
|
|
|
|
|
jobNoItem.setValue(jobPO.getJobNo());
|
|
|
|
|
jobNameItem.setValue(jobPO.getJobName());
|
|
|
|
|
isKeyItem.setValue(null == jobPO.getIsKey() ? "0" : jobPO.getIsKey() + "");
|
|
|
|
|
workplaceItem.setValue(jobPO.getWorkplace());
|
|
|
|
|
descriptionItem.setValue(jobPO.getDescription());
|
|
|
|
|
workDutyItem.setValue(jobPO.getWorkDuty());
|
|
|
|
|
workAuthorityItem.setValue(jobPO.getWorkAuthority());
|
|
|
|
|
|
|
|
|
|
if (null != jobPO.getParentComp()) {
|
|
|
|
|
BrowserBean browserBean = parentCompBrowserItem.getBrowserConditionParam();
|
|
|
|
|
List<Map<String, Object>> compMaps = getCompMapper().listCompsByIds(DeleteParam.builder().ids(jobPO.getParentComp().toString()).build().getIds());
|
|
|
|
|
browserBean.setReplaceDatas(compMaps);
|
|
|
|
|
parentCompBrowserItem.setBrowserConditionParam(browserBean);
|
|
|
|
|
}
|
|
|
|
|
if (null != jobPO.getParentDept()) {
|
|
|
|
|
BrowserBean browserBean = parentDeptBrowserItem.getBrowserConditionParam();
|
|
|
|
|
List<Map<String, Object>> deptMaps = getDepartmentMapper().listDeptsByIds(DeleteParam.builder().ids(jobPO.getParentDept().toString()).build().getIds());
|
|
|
|
|
browserBean.setReplaceDatas(deptMaps);
|
|
|
|
|
parentDeptBrowserItem.setBrowserConditionParam(browserBean);
|
|
|
|
|
}
|
|
|
|
|
if (null != jobPO.getSequenceId()) {
|
|
|
|
|
BrowserBean browserBean = sequenceBrowserItem.getBrowserConditionParam();
|
|
|
|
|
List<Map<String, Object>> deptMaps = getSequenceMapper().listSequencesByIds(DeleteParam.builder().ids(jobPO.getSequenceId().toString()).build().getIds());
|
|
|
|
|
browserBean.setReplaceDatas(deptMaps);
|
|
|
|
|
sequenceBrowserItem.setBrowserConditionParam(browserBean);
|
|
|
|
|
}
|
|
|
|
|
if (null != jobPO.getSchemeId()) {
|
|
|
|
|
BrowserBean browserBean = schemeBrowserItem.getBrowserConditionParam();
|
|
|
|
|
List<Map<String, Object>> deptMaps = getSchemeMapper().listSchemesByIds(DeleteParam.builder().ids(jobPO.getSchemeId().toString()).build().getIds());
|
|
|
|
|
browserBean.setReplaceDatas(deptMaps);
|
|
|
|
|
schemeBrowserItem.setBrowserConditionParam(browserBean);
|
|
|
|
|
}
|
|
|
|
|
if (null != jobPO.getParentJob()) {
|
|
|
|
|
BrowserBean browserBean = parentJobBrowserItem.getBrowserConditionParam();
|
|
|
|
|
List<Map<String, Object>> deptMaps = getJobMapper().listJobsByIds(DeleteParam.builder().ids(jobPO.getParentJob().toString()).build().getIds());
|
|
|
|
|
browserBean.setReplaceDatas(deptMaps);
|
|
|
|
|
schemeBrowserItem.setBrowserConditionParam(browserBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 查看,全部置为只读
|
|
|
|
|
if (1 == viewAttr) {
|
|
|
|
|
for (SearchConditionItem item : conditionItems) {
|
|
|
|
|
item.setViewAttr(viewAttr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return conditionItems;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取待删除数据的子级元素
|
|
|
|
|
*
|
|
|
|
|
* @param ids
|
|
|
|
|
* @param deleteIds
|
|
|
|
|
*/
|
|
|
|
|
private void getChildIds(Collection<Long> ids, Collection<Long> deleteIds) {
|
|
|
|
|
for (Long id : ids) {
|
|
|
|
|
deleteIds.add(id);
|
|
|
|
|
Collection<Long> childIds = getJobMapper().getJobsByPid(id).stream().map(JobPO::getId).collect(Collectors.toList());
|
|
|
|
|
getChildIds(childIds, deleteIds);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|