|
|
|
@ -1,22 +1,48 @@
|
|
|
|
|
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.QueryParam;
|
|
|
|
|
import com.engine.organization.entity.comp.bo.CompBO;
|
|
|
|
|
import com.engine.organization.entity.comp.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.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.JobPO;
|
|
|
|
|
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.JobMapper;
|
|
|
|
|
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;
|
|
|
|
@ -29,10 +55,37 @@ import java.util.stream.Collectors;
|
|
|
|
|
*/
|
|
|
|
|
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 CompMapper getCompMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(CompMapper.class);
|
|
|
|
|
}
|
|
|
|
@ -41,6 +94,23 @@ public class JobServiceImpl extends Service implements JobService {
|
|
|
|
|
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<>();
|
|
|
|
@ -70,6 +140,249 @@ public class JobServiceImpl extends Service implements JobService {
|
|
|
|
|
return dataMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> listPage(JobSearchParam param) {
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
JobPO jobPO = JobBO.convertParamsToPO(param, (long) 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");
|
|
|
|
|
jobNoItem.setRules("required|string");
|
|
|
|
|
// 所属分部
|
|
|
|
|
SearchConditionItem parentCompBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属分部", "161", "parentComp", "compBrowser");
|
|
|
|
|
parentCompBrowserItem.setRules("required|string");
|
|
|
|
|
// 所属部门
|
|
|
|
|
SearchConditionItem parentDeptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属部门", "161", "parentDept", "deptBrowser");
|
|
|
|
|
parentDeptBrowserItem.setRules("required|string");
|
|
|
|
|
// 岗位序列
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
// 处理明细表
|
|
|
|
|
resultMap.put("tables", getExtService(user).getExtendTables(user, EXTEND_TYPE, JCL_ORG_JOBEXT_DT1, id, viewAttr, false));
|
|
|
|
|
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, (long) user.getUID());
|
|
|
|
|
return getJobMapper().insertIgnoreNull(jobPO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@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());
|
|
|
|
|
int updateCount = 0;
|
|
|
|
|
// 更新主表数据
|
|
|
|
|
updateCount += getJobMapper().updateBaseJob(jobPO);
|
|
|
|
|
// 更新主表拓展表
|
|
|
|
|
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOBEXT, params, groupId, jobPO.getId());
|
|
|
|
|
//更新明细表
|
|
|
|
|
getExtService(user).updateExtDT(user, EXTEND_TYPE, JCL_ORG_JOBEXT_DT1, params, jobPO.getId());
|
|
|
|
|
return updateCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加查询元素的父级元素
|
|
|
|
|
*
|
|
|
|
@ -263,4 +576,145 @@ public class JobServiceImpl extends Service implements JobService {
|
|
|
|
|
}).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");
|
|
|
|
|
jobNoItem.setRules("required|string");
|
|
|
|
|
// 所属分部
|
|
|
|
|
SearchConditionItem parentCompBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属分部", "161", "parentComp", "compBrowser");
|
|
|
|
|
parentCompBrowserItem.setRules("required|string");
|
|
|
|
|
// 所属部门
|
|
|
|
|
SearchConditionItem parentDeptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属部门", "161", "parentDept", "deptBrowser");
|
|
|
|
|
parentDeptBrowserItem.setRules("required|string");
|
|
|
|
|
// 岗位序列
|
|
|
|
|
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.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(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(QueryParam.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(QueryParam.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(QueryParam.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(QueryParam.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(QueryParam.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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|