89 lines
2.8 KiB
Plaintext
89 lines
2.8 KiB
Plaintext
package com.engine.gainway.transmethod;
|
|
|
|
import com.engine.gainway.util.BasicResourceUtil;
|
|
import com.engine.hrm.biz.HrmFieldManager;
|
|
import org.apache.commons.lang.StringUtils;
|
|
import weaver.general.Util;
|
|
import weaver.hrm.User;
|
|
import weaver.hrm.company.SubCompanyComInfo;
|
|
import weaver.hrm.job.EducationLevelComInfo;
|
|
import weaver.hrm.job.JobTitlesComInfo;
|
|
|
|
import java.time.LocalDate;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.util.Calendar;
|
|
|
|
/**
|
|
* @Author liang.cheng
|
|
* @Date 2024/12/12 9:33 AM
|
|
* @Description: TODO
|
|
* @Version 1.0
|
|
*/
|
|
public class BasicResourceTrans {
|
|
|
|
public static String selectSubCompanyName(String subcompanyid) {
|
|
SubCompanyComInfo sub = new SubCompanyComInfo();
|
|
return sub.getSubCompanyname(subcompanyid);
|
|
}
|
|
|
|
public static String selectJobName(String jobId) {
|
|
JobTitlesComInfo jc = new JobTitlesComInfo();
|
|
return jc.getJobTitlesname(jobId);
|
|
}
|
|
|
|
public static String selectSexName(String sex) {
|
|
if (StringUtils.isEmpty(sex)) {
|
|
return "未设置";
|
|
}else {
|
|
return "0".equals(sex) ? "男" : "女";
|
|
}
|
|
}
|
|
|
|
public static String selectAge(String birthday) {
|
|
String age = "";
|
|
if (StringUtils.isNotEmpty(birthday)) {
|
|
age = String.valueOf(BasicResourceUtil.calculateAge(birthday));
|
|
}
|
|
return age;
|
|
}
|
|
|
|
public static String selectEducation(String educationlevel) {
|
|
EducationLevelComInfo edu = new EducationLevelComInfo();
|
|
String eduName = edu.getEducationLevelname(educationlevel);
|
|
if (StringUtils.isEmpty(eduName)) {
|
|
eduName = "空";
|
|
}
|
|
return eduName;
|
|
}
|
|
|
|
public static String selectCompanyYear(String companydate) {
|
|
Calendar calendar = Calendar.getInstance();
|
|
int currentYear = calendar.get(Calendar.YEAR);
|
|
String yearDifference = "";
|
|
if (StringUtils.isNotEmpty(companydate)) {
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
LocalDate date = LocalDate.parse(companydate, formatter);
|
|
int dateYear = date.getYear();
|
|
yearDifference = String.valueOf(currentYear - dateYear);
|
|
}
|
|
return yearDifference;
|
|
}
|
|
|
|
|
|
public static String selectNativeplace(String nativeplace,String userId) {
|
|
HrmFieldManager hrmFieldManager = new HrmFieldManager();
|
|
String title = "";
|
|
User user = new User();
|
|
try {
|
|
user.setUid(Integer.parseInt(userId));
|
|
title = hrmFieldManager.getFieldvalue(user, null, 0, 3, 2222, nativeplace, 0);
|
|
title = Util.formatMultiLang(title, Util.null2String(user.getLanguage()));
|
|
}catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return title;
|
|
}
|
|
|
|
|
|
}
|