添加单点登录相关
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package com.ruoyi.cms.util;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -229,4 +233,94 @@ public class StringUtil {
|
||||
}
|
||||
return str.toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过身份证获取年龄
|
||||
*
|
||||
* @param idNumber
|
||||
* @return
|
||||
*/
|
||||
public static String getAgeByIdNumber(String idNumber) {
|
||||
if (idNumber == null || idNumber.length() != 18) {
|
||||
return null;
|
||||
}
|
||||
//出生日期(yyyyMMdd)
|
||||
String birthDateStr = idNumber.substring(6, 14);
|
||||
LocalDate birthDate = LocalDate.parse(birthDateStr, DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
// 年龄
|
||||
return String.valueOf(Period.between(birthDate, LocalDate.now()).getYears());
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换学历至本地学历
|
||||
*
|
||||
* @param val
|
||||
* @return
|
||||
*/
|
||||
public static String convertEducation(String val) {
|
||||
//模型码值
|
||||
//初中及以下 0 0 小学
|
||||
//中专/中技 1 1 初中
|
||||
//高中 2 2 高中
|
||||
//大专 3 3 中专
|
||||
//本科 4 4 大专
|
||||
//硕士 5 5 本科
|
||||
//博士 6 6 硕士
|
||||
//MBA/EMBA 7 7 博士
|
||||
//留学学士 8
|
||||
//留学硕士 9
|
||||
//留学博士 10
|
||||
String result = null;
|
||||
if (val == null) {
|
||||
return null;
|
||||
}
|
||||
if ("0".equals(val) || "1".equals(val)) {//小学,初中-->初中及以下
|
||||
result = "0";
|
||||
} else if ("2".equals(val)) {
|
||||
result = "2";
|
||||
} else if ("3".equals(val)) {
|
||||
result = "1";
|
||||
} else if ("4".equals(val)) {
|
||||
result = "3";
|
||||
} else if ("5".equals(val)) {
|
||||
result = "4";
|
||||
} else if ("6".equals(val)) {
|
||||
result = "5";
|
||||
} else if ("7".equals(val)) {
|
||||
result = "6";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 工作经验转模型经验
|
||||
* @param personYearsWorking
|
||||
* @return
|
||||
*/
|
||||
public static String convertExp(Integer personYearsWorking) {
|
||||
// 实习生 1
|
||||
// 应届毕业生 2
|
||||
// 1年以下 3
|
||||
// 1-3年 4
|
||||
// 3-5年 5
|
||||
// 5-10年 6
|
||||
// 10年以上 7
|
||||
// 经验不限 0
|
||||
String modelExp = null;
|
||||
if (ObjectUtils.isEmpty(personYearsWorking)) {
|
||||
return null;
|
||||
}
|
||||
if (personYearsWorking <= 1) {
|
||||
modelExp = "3";
|
||||
} else if (personYearsWorking <= 3) {
|
||||
modelExp = "4";
|
||||
} else if (personYearsWorking <= 5) {
|
||||
modelExp = "5";
|
||||
} else if (personYearsWorking <= 10) {
|
||||
modelExp = "6";
|
||||
} else {
|
||||
modelExp = "7";
|
||||
}
|
||||
return modelExp;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user