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.
98 lines
3.7 KiB
Java
98 lines
3.7 KiB
Java
package com.engine.organization.transmethod;
|
|
|
|
import com.cloudstore.dev.api.util.Util_DataCache;
|
|
import com.engine.organization.entity.job.bo.JobBO;
|
|
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.json.JSONObject;
|
|
import weaver.general.BaseBean;
|
|
import weaver.general.Util;
|
|
import weaver.hrm.User;
|
|
import weaver.hrm.definedfield.HrmFieldManager;
|
|
|
|
import javax.servlet.http.HttpSession;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* @author:dxfeng
|
|
* @createTime: 2022/06/21
|
|
* @version: 1.0
|
|
*/
|
|
public class HrmResourceTransMethod {
|
|
|
|
public static String getFieldTrueValue(String id, String para) {
|
|
HrmFieldManager hfm = new HrmFieldManager("HrmCustomFieldByInfoType", Integer.parseInt(para.split("_")[0]));
|
|
String fieldName = para.substring(para.lastIndexOf("_") + 1);
|
|
JSONObject hrmFieldConf = hfm.getHrmFieldConf(fieldName);
|
|
User user = new User();
|
|
user.setUid(1);
|
|
|
|
try {
|
|
if ("departmentid".equals(fieldName)) {
|
|
Map<String, Map<String, String>> dept = (Map) Util_DataCache.getObjVal("hmc_allDept");
|
|
return getAllDepartmentName(id, dept);
|
|
} else {
|
|
return hfm.getFieldvalue((HttpSession)null, user, (String)null, hrmFieldConf.getString("dmlurl"), hrmFieldConf.getInt("id"), hrmFieldConf.getInt("fieldhtmltype"), hrmFieldConf.getInt("type"), id, 0, fieldName);
|
|
}
|
|
} catch (Exception var7) {
|
|
(new BaseBean()).writeLog("getFieldTrueValue Exception:" + var7.getMessage());
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public static String getDepartmentName(String departmentId) {
|
|
return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(Integer.parseInt(departmentId));
|
|
}
|
|
|
|
public static String getCompanyName(String companyId) {
|
|
return MapperProxyFactory.getProxy(CompMapper.class).listById(Integer.parseInt(companyId)).getSubCompanyName();
|
|
}
|
|
|
|
public static String getJobName(String jobTitle) {
|
|
return JobBO.getJobTitleNameByEcJobTitle(jobTitle);
|
|
}
|
|
|
|
public static String getManagerName(String managerId) {
|
|
return new User(Integer.parseInt(managerId)).getLastname();
|
|
}
|
|
|
|
public static String getScDepartmentName(String departmentId) {
|
|
return MapperProxyFactory.getProxy(SystemDataMapper.class).getScDepartmentNameById(departmentId);
|
|
}
|
|
|
|
public static String getScCompanyName(String subCompanyId) {
|
|
return MapperProxyFactory.getProxy(SystemDataMapper.class).getScDepartmentNameById(subCompanyId);
|
|
}
|
|
|
|
public static String getScManagerName(String managerId) {
|
|
if ("0".equals(managerId)) {
|
|
return "";
|
|
}
|
|
return MapperProxyFactory.getProxy(SystemDataMapper.class).getScHrmResourceNameById(managerId);
|
|
}
|
|
|
|
private static String getAllDepartmentName(String id, Map<String, Map<String, String>> dept) {
|
|
String allname = "";
|
|
String departmentname = "";
|
|
|
|
try {
|
|
while(!"".equals(id) && !"0".equals(id)) {
|
|
Map<String, String> obj = (Map)dept.get(id);
|
|
id = Util.null2String((String)obj.get("supdepid"));
|
|
departmentname = Util.null2String((String)obj.get("departmentname"));
|
|
allname = departmentname + ">" + allname;
|
|
}
|
|
} catch (Exception var5) {
|
|
(new BaseBean()).writeLog("getAllDepartmentName Exception", var5.getMessage());
|
|
}
|
|
|
|
if (!"".equals(allname)) {
|
|
allname = allname.substring(0, allname.length() - 1);
|
|
}
|
|
|
|
return allname;
|
|
}
|
|
}
|