You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.8 KiB
Java
85 lines
2.8 KiB
Java
3 years ago
|
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);
|
||
|
}
|
||
|
|
||
|
}
|