!157 分部、部门 添加UUID列;部门表结构更新
Merge pull request !157 from dxfeng/feature/dxf
This commit is contained in:
commit
80903cbbd1
|
|
@ -111,6 +111,7 @@ CREATE TABLE JCL_ORG_COMP (
|
|||
delete_type int null,
|
||||
create_time date null,
|
||||
update_time date null,
|
||||
uuid varchar(100) null,
|
||||
CONSTRAINT JCL_ORG_COMP_PK PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
|
@ -211,6 +212,7 @@ CREATE TABLE JCL_ORG_DEPT (
|
|||
delete_type int null,
|
||||
create_time date null,
|
||||
update_time date null,
|
||||
uuid varchar(100) null,
|
||||
CONSTRAINT JCL_ORG_DEPT_PK PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
|
@ -241,7 +243,9 @@ CREATE TABLE JCL_ORG_JOB (
|
|||
job_no varchar(100) NULL,
|
||||
job_name varchar(100) NULL,
|
||||
parent_comp int null,
|
||||
ec_company int null,
|
||||
parent_dept int null,
|
||||
ec_department int null,
|
||||
sequence_id int null,
|
||||
scheme_id int null,
|
||||
parent_job int null,
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ CREATE TABLE JCL_ORG_COMP (
|
|||
DELETE_TYPE NUMBER NULL,
|
||||
CREATE_TIME DATE NULL,
|
||||
UPDATE_TIME DATE NULL,
|
||||
UUID NVARCHAR2(100) NULL,
|
||||
CONSTRAINT JCL_ORG_COMP_PK PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
|
|
@ -213,6 +214,7 @@ CREATE TABLE JCL_ORG_DEPT (
|
|||
DELETE_TYPE NUMBER NULL,
|
||||
CREATE_TIME DATE NULL,
|
||||
UPDATE_TIME DATE NULL,
|
||||
UUID NVARCHAR2(100) NULL,
|
||||
CONSTRAINT JCL_ORG_DEPT_PK PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
|
|
@ -243,7 +245,9 @@ CREATE TABLE JCL_ORG_JOB (
|
|||
JOB_NO NVARCHAR2(100) NULL,
|
||||
JOB_NAME NVARCHAR2(100) NULL,
|
||||
PARENT_COMP NUMBER NULL,
|
||||
EC_COMPANY NUMBER NULL,
|
||||
PARENT_DEPT NUMBER NULL,
|
||||
EC_DEPARTMENT NUMBER NULL,
|
||||
SEQUENCE_ID NUMBER NULL,
|
||||
SCHEME_ID NUMBER NULL,
|
||||
PARENT_JOB NUMBER NULL,
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ CREATE TABLE JCL_ORG_COMP (
|
|||
delete_type int null,
|
||||
create_time datetime null,
|
||||
update_time datetime null,
|
||||
uuid varchar(100) null,
|
||||
CONSTRAINT JCL_ORG_COMP_PK PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
|
@ -211,6 +212,7 @@ CREATE TABLE JCL_ORG_DEPT (
|
|||
delete_type int null,
|
||||
create_time datetime null,
|
||||
update_time datetime null,
|
||||
uuid varchar(100) null,
|
||||
CONSTRAINT JCL_ORG_DEPT_PK PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
|
@ -241,7 +243,9 @@ CREATE TABLE JCL_ORG_JOB (
|
|||
job_no varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
|
||||
job_name varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
|
||||
parent_comp int null,
|
||||
ec_company int null,
|
||||
parent_dept int null,
|
||||
ec_department int null,
|
||||
sequence_id int null,
|
||||
scheme_id int null,
|
||||
parent_job int null,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.engine.organization.entity.job.bo;
|
||||
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.job.dto.JobListDTO;
|
||||
import com.engine.organization.entity.job.param.JobSearchParam;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
|
|
@ -8,7 +10,9 @@ import com.engine.organization.entity.searchtree.SearchTree;
|
|||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.transmethod.JobTransMethod;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -25,13 +29,17 @@ public class JobBO {
|
|||
if (null == param) {
|
||||
return null;
|
||||
}
|
||||
CompPO jclCompany = EcHrmRelationUtil.getJclCompanyId(null == param.getEcCompany() ? Util.null2String(param.getSubcompanyid1()) : param.getEcCompany().toString());
|
||||
DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(null == param.getEcDepartment() ? Util.null2String(param.getDepartmentid()): param.getEcDepartment().toString());
|
||||
return JobPO
|
||||
.builder()
|
||||
.id(param.getId() == null ? 0 : param.getId())
|
||||
.jobNo(param.getJobNo())
|
||||
.jobName(param.getJobName())
|
||||
.parentComp(null == param.getParentComp() ? param.getSubcompanyid1() : param.getParentComp())
|
||||
.parentDept(null == param.getParentDept() ? param.getDepartmentid() : param.getParentDept())
|
||||
.ecCompany(null == param.getEcCompany() ? param.getSubcompanyid1() : param.getEcCompany())
|
||||
.ecDepartment(null == param.getEcDepartment() ? param.getDepartmentid() : param.getEcDepartment())
|
||||
.parentComp(null == jclCompany ? null : jclCompany.getId())
|
||||
.parentDept(null == jclDepartment ? null : jclDepartment.getId())
|
||||
.sequenceId(param.getSequenceId())
|
||||
.schemeId(param.getSchemeId())
|
||||
.parentJob(param.getParentJob())
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ public class JobSearchParam extends BaseQueryParam {
|
|||
*/
|
||||
private String jobName;
|
||||
/**
|
||||
* 所属分部
|
||||
* ec分部
|
||||
*/
|
||||
private Long parentComp;
|
||||
private Long ecCompany;
|
||||
/**
|
||||
* 所属部门
|
||||
* ec部门
|
||||
*/
|
||||
private Long parentDept;
|
||||
private Long ecDepartment;
|
||||
/**
|
||||
* 岗位序列
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,10 +34,20 @@ public class JobPO {
|
|||
* 所属分部
|
||||
*/
|
||||
private Long parentComp;
|
||||
|
||||
/**
|
||||
* ec分部
|
||||
*/
|
||||
private Long ecCompany;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private Long parentDept;
|
||||
/**
|
||||
* ec部门
|
||||
*/
|
||||
private Long ecDepartment;
|
||||
|
||||
/**
|
||||
* 岗位序列
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -77,6 +77,14 @@ public interface CompMapper {
|
|||
*/
|
||||
CompPO listById(@Param("id") long id);
|
||||
|
||||
/**
|
||||
* 根据UUID查询数据
|
||||
*
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
CompPO getCompanyByUUID(@Param("uuid") String uuid);
|
||||
|
||||
|
||||
/**
|
||||
* 根据No查询数据
|
||||
|
|
|
|||
|
|
@ -292,6 +292,14 @@
|
|||
from JCL_ORG_STAFFPLAN
|
||||
where delete_type = 0
|
||||
</select>
|
||||
<select id="getCompanyByUUID" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM
|
||||
jcl_org_comp t
|
||||
WHERE t.delete_type = 0
|
||||
and uuid = #{uuid}
|
||||
</select>
|
||||
|
||||
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.sequence.po.SequencePO">
|
||||
update jcl_org_comp
|
||||
|
|
|
|||
|
|
@ -62,6 +62,14 @@ public interface DepartmentMapper {
|
|||
*/
|
||||
DepartmentPO getDeptById(@Param("id") long id);
|
||||
|
||||
/**
|
||||
* 根据UUID查询数据
|
||||
*
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
DepartmentPO getDepartmentByUUID(@Param("uuid") String uuid);
|
||||
|
||||
/**
|
||||
* 根据ID查询名称
|
||||
*
|
||||
|
|
@ -117,6 +125,7 @@ public interface DepartmentMapper {
|
|||
|
||||
/**
|
||||
* 根据名称、上级 查询部门元素
|
||||
*
|
||||
* @param departmentName
|
||||
* @param parentCompany
|
||||
* @param parentDepartment
|
||||
|
|
|
|||
|
|
@ -150,6 +150,13 @@
|
|||
and parent_comp = #{parentCompany}
|
||||
<include refid="nullParentDepartment"/>
|
||||
</select>
|
||||
<select id="getDepartmentByUUID" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_dept t
|
||||
where delete_type = 0
|
||||
and uuid = #{uuid}
|
||||
</select>
|
||||
<sql id="nullParentDepartment">
|
||||
and ifnull(parent_dept,0) =
|
||||
#{parentDepartment}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import com.engine.organization.mapper.codesetting.CodeRuleMapper;
|
|||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
||||
import com.engine.organization.mapper.job.JobDTMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.service.ExtService;
|
||||
import com.engine.organization.service.JobService;
|
||||
|
|
@ -39,6 +38,7 @@ 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 com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import com.engine.organization.util.tree.SearchTreeUtil;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
|
@ -98,10 +98,6 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
return MapperProxyFactory.getProxy(JobMapper.class);
|
||||
}
|
||||
|
||||
private JobDTMapper getJobDTMapper() {
|
||||
return MapperProxyFactory.getProxy(JobDTMapper.class);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
|
@ -191,9 +187,9 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
// 名称
|
||||
SearchConditionItem jobNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "jobName");
|
||||
// 所属分部
|
||||
SearchConditionItem parentCompBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属分部", "161", "parentComp", "compBrowser");
|
||||
SearchConditionItem parentCompBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属分部", "164", "ecCompany", "");
|
||||
// 所属部门
|
||||
SearchConditionItem parentDeptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属部门", "161", "parentDept", "deptBrowser");
|
||||
SearchConditionItem parentDeptBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "所属部门", "4", "ecDepartment", "");
|
||||
// 岗位序列
|
||||
SearchConditionItem sequenceBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "岗位序列", "161", "sequenceId", "sequenceBrowser");
|
||||
// 等级方案
|
||||
|
|
@ -306,8 +302,14 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
|
||||
params.put("is_key", null == searchParam.getIsKey() ? 0 : searchParam.getIsKey());
|
||||
// TODO 处理ec表关联关系
|
||||
//DepartmentPO departmentPO = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(searchParam.getParentDept());
|
||||
//params.put("parent_comp", departmentPO.getParentComp());
|
||||
Long ecDepartment = searchParam.getEcDepartment();
|
||||
DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(ecDepartment + "");
|
||||
params.put("parent_dept", jclDepartment.getId());
|
||||
params.put("parent_comp", jclDepartment.getParentComp());
|
||||
if (null != jclDepartment.getParentComp()) {
|
||||
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(jclDepartment.getParentComp() + ""));
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(params.get("show_order").toString())) {
|
||||
int maxShowOrder = getJobMapper().getMaxShowOrder();
|
||||
params.put("show_order", maxShowOrder + 1);
|
||||
|
|
@ -334,8 +336,13 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
// 更新主表数据
|
||||
params.put("is_key", searchParam.getIsKey());
|
||||
// TODO 处理ec表关联关系
|
||||
//DepartmentPO departmentPO = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(searchParam.getParentDept());
|
||||
//params.put("parent_comp", departmentPO.getParentComp());
|
||||
Long ecDepartment = searchParam.getEcDepartment();
|
||||
DepartmentPO jclDepartment = EcHrmRelationUtil.getJclDepartmentId(ecDepartment + "");
|
||||
params.put("parent_dept", jclDepartment.getId());
|
||||
params.put("parent_comp", jclDepartment.getParentComp());
|
||||
if (null != jclDepartment.getParentComp()) {
|
||||
params.put("ec_company", EcHrmRelationUtil.getEcCompanyId(jclDepartment.getParentComp() + ""));
|
||||
}
|
||||
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOB, params, "", searchParam.getId());
|
||||
// 更新主表拓展表
|
||||
getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_JOBEXT, params, groupId, searchParam.getId());
|
||||
|
|
|
|||
|
|
@ -3,16 +3,13 @@ package com.engine.organization.thread;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.hrm.service.impl.OrganizationServiceImpl;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.extend.param.ExtendInfoParams;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.enums.OperateTypeEnum;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.extend.ExtMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.relation.EcHrmRelationUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
|
@ -47,15 +44,6 @@ public class OrganizationRunable implements Runnable {
|
|||
return MapperProxyFactory.getProxy(ExtMapper.class);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
||||
private DepartmentMapper getDepartmentMapper() {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
||||
}
|
||||
|
||||
|
||||
public OrganizationRunable(User user, LogModuleNameEnum moduleName, OperateTypeEnum operateType, Map<String, Object> params) {
|
||||
this.moduleName = moduleName;
|
||||
this.operateType = operateType;
|
||||
|
|
@ -142,13 +130,13 @@ public class OrganizationRunable implements Runnable {
|
|||
// 上级分部通过UUID联查ec表ID
|
||||
String parentCompany = Util.null2String(params.get("parent_comp"));
|
||||
if (StringUtils.isNotBlank(parentCompany)) {
|
||||
map.put("subcompanyid1", getEcCompanyId(parentCompany));
|
||||
map.put("subcompanyid1", EcHrmRelationUtil.getEcCompanyId(parentCompany));
|
||||
}
|
||||
|
||||
// 上级部门通过UUID联查ec表ID
|
||||
String parentDepartment = Util.null2String(params.get("parent_dept"));
|
||||
if (StringUtils.isNotBlank(parentDepartment)) {
|
||||
map.put("supdepid", getEcDepartmentId(parentDepartment));
|
||||
map.put("supdepid", EcHrmRelationUtil.getEcDepartmentId(parentDepartment));
|
||||
}
|
||||
|
||||
map.put("showorder", Util.null2String(params.get("show_order")));
|
||||
|
|
@ -170,7 +158,7 @@ public class OrganizationRunable implements Runnable {
|
|||
List<String> idList = new ArrayList<>();
|
||||
String[] split = departmentIds.split(",");
|
||||
for (String s : split) {
|
||||
idList.add(getEcDepartmentId(s));
|
||||
idList.add(EcHrmRelationUtil.getEcDepartmentId(s));
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", StringUtils.join(idList, ","));
|
||||
|
|
@ -189,20 +177,20 @@ public class OrganizationRunable implements Runnable {
|
|||
private void updateDepartment() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 获取ec表ID
|
||||
map.put("id", getEcDepartmentId(Util.null2String(params.get("id"))));
|
||||
map.put("id", EcHrmRelationUtil.getEcDepartmentId(Util.null2String(params.get("id"))));
|
||||
map.put("departmentmark", Util.null2String(params.get("dept_name_short")));
|
||||
map.put("departmentname", Util.null2String(params.get("dept_name")));
|
||||
|
||||
// 上级分部通过UUID联查ec表ID
|
||||
String parentCompany = Util.null2String(params.get("parent_comp"));
|
||||
if (StringUtils.isNotBlank(parentCompany)) {
|
||||
map.put("subcompanyid1", getEcCompanyId(parentCompany));
|
||||
map.put("subcompanyid1", EcHrmRelationUtil.getEcCompanyId(parentCompany));
|
||||
}
|
||||
|
||||
// 上级部门通过UUID联查ec表ID
|
||||
String parentDepartment = Util.null2String(params.get("parent_dept"));
|
||||
if (StringUtils.isNotBlank(parentDepartment)) {
|
||||
map.put("supdepid", getEcDepartmentId(parentDepartment));
|
||||
map.put("supdepid", EcHrmRelationUtil.getEcDepartmentId(parentDepartment));
|
||||
}
|
||||
|
||||
map.put("showorder", Util.null2String(params.get("show_order")));
|
||||
|
|
@ -221,7 +209,7 @@ public class OrganizationRunable implements Runnable {
|
|||
// 上级分部通过UUID联查ec表ID
|
||||
String parentCompany = Util.null2String(params.get("parent_company"));
|
||||
if (StringUtils.isNotBlank(parentCompany)) {
|
||||
map.put("supsubcomid", getEcCompanyId(parentCompany));
|
||||
map.put("supsubcomid", EcHrmRelationUtil.getEcCompanyId(parentCompany));
|
||||
}
|
||||
|
||||
map.put("subcompanycode", params.get("comp_no").toString());
|
||||
|
|
@ -241,12 +229,12 @@ public class OrganizationRunable implements Runnable {
|
|||
private void updateCompany() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 获取ec表ID
|
||||
map.put("id", getEcCompanyId(Util.null2String(params.get("id"))));
|
||||
map.put("id", EcHrmRelationUtil.getEcCompanyId(Util.null2String(params.get("id"))));
|
||||
|
||||
// 上级分部通过UUID联查ec表ID
|
||||
String parentCompany = Util.null2String(params.get("parent_company"));
|
||||
if (StringUtils.isNotBlank(parentCompany)) {
|
||||
map.put("supsubcomid", getEcCompanyId(parentCompany));
|
||||
map.put("supsubcomid", EcHrmRelationUtil.getEcCompanyId(parentCompany));
|
||||
}
|
||||
map.put("subcompanycode", Util.null2String(params.get("comp_no")));
|
||||
map.put("subcompanyname", Util.null2String(params.get("comp_name_short")));
|
||||
|
|
@ -264,7 +252,7 @@ public class OrganizationRunable implements Runnable {
|
|||
List<String> idList = new ArrayList<>();
|
||||
String[] split = companyIds.split(",");
|
||||
for (String s : split) {
|
||||
idList.add(getEcCompanyId(s));
|
||||
idList.add(EcHrmRelationUtil.getEcCompanyId(s));
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("id", StringUtils.join(idList, ","));
|
||||
|
|
@ -295,27 +283,4 @@ public class OrganizationRunable implements Runnable {
|
|||
getExtMapper().updateExt(infoParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据jcl_org_comp.id获取HrmSubCompany.id
|
||||
*
|
||||
* @param companyId
|
||||
* @return
|
||||
*/
|
||||
private String getEcCompanyId(String companyId) {
|
||||
CompPO compPO = getCompMapper().listById(Long.parseLong(companyId));
|
||||
JSONObject supSubCompany = getSystemDataMapper().getHrmObjectByUUID(HRM_COMPANY, compPO.getUuid());
|
||||
return supSubCompany.getString("id");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据jcl_org_dept.id获取HrmDepartment.id
|
||||
*
|
||||
* @param departmentId
|
||||
* @return
|
||||
*/
|
||||
private String getEcDepartmentId(String departmentId) {
|
||||
DepartmentPO departmentPO = getDepartmentMapper().getDeptById(Long.parseLong(departmentId));
|
||||
JSONObject supDepartment = getSystemDataMapper().getHrmObjectByUUID(HRM_DEPARTMENT, departmentPO.getUuid());
|
||||
return supDepartment.getString("id");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,84 @@
|
|||
package com.engine.organization.util.relation;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/07/13
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class EcHrmRelationUtil {
|
||||
|
||||
private static final String HRM_COMPANY = "hrmsubcompany";
|
||||
private static final String HRM_DEPARTMENT = "hrmdepartment";
|
||||
|
||||
|
||||
private static SystemDataMapper getSystemDataMapper() {
|
||||
return MapperProxyFactory.getProxy(SystemDataMapper.class);
|
||||
}
|
||||
|
||||
private static CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
||||
private static DepartmentMapper getDepartmentMapper() {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据jcl_org_comp.id获取HrmSubCompany.id
|
||||
*
|
||||
* @param companyId
|
||||
* @return
|
||||
*/
|
||||
public static String getEcCompanyId(String companyId) {
|
||||
CompPO compPO = getCompMapper().listById(Long.parseLong(companyId));
|
||||
JSONObject supSubCompany = getSystemDataMapper().getHrmObjectByUUID(HRM_COMPANY, compPO.getUuid());
|
||||
return supSubCompany.getString("id");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据jcl_org_dept.id获取HrmDepartment.id
|
||||
*
|
||||
* @param departmentId
|
||||
* @return
|
||||
*/
|
||||
public static String getEcDepartmentId(String departmentId) {
|
||||
DepartmentPO departmentPO = getDepartmentMapper().getDeptById(Long.parseLong(departmentId));
|
||||
JSONObject supDepartment = getSystemDataMapper().getHrmObjectByUUID(HRM_DEPARTMENT, departmentPO.getUuid());
|
||||
return supDepartment.getString("id");
|
||||
}
|
||||
|
||||
public static CompPO getJclCompanyId(String ecCompanyId) {
|
||||
if (StringUtils.isBlank(ecCompanyId)) {
|
||||
return null;
|
||||
}
|
||||
JSONObject ecCompany = getSystemDataMapper().getHrmObjectByID(HRM_COMPANY, ecCompanyId);
|
||||
if (null == ecCompany) {
|
||||
return null;
|
||||
}
|
||||
String uuid = ecCompany.getString("uuid");
|
||||
return getCompMapper().getCompanyByUUID(uuid);
|
||||
}
|
||||
|
||||
|
||||
public static DepartmentPO getJclDepartmentId(String ecDepartmentId) {
|
||||
if (StringUtils.isBlank(ecDepartmentId)) {
|
||||
return null;
|
||||
}
|
||||
JSONObject ecDepartment = getSystemDataMapper().getHrmObjectByID(HRM_DEPARTMENT, ecDepartmentId);
|
||||
if (null == ecDepartment) {
|
||||
return null;
|
||||
}
|
||||
String uuid = ecDepartment.getString("uuid");
|
||||
return getDepartmentMapper().getDepartmentByUUID(uuid);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue