1.完成生成简历
This commit is contained in:
@@ -103,7 +103,7 @@ public class DictUtils
|
||||
{
|
||||
for (String value : dictValue.split(separator))
|
||||
{
|
||||
if (value.equals(dict.getDictValue()))
|
||||
if (value.trim().equals(dict.getDictValue().trim()))
|
||||
{
|
||||
propertyString.append(dict.getDictLabel()).append(separator);
|
||||
break;
|
||||
@@ -115,7 +115,7 @@ public class DictUtils
|
||||
{
|
||||
for (BussinessDictData dict : datas)
|
||||
{
|
||||
if (dictValue.equals(dict.getDictValue()))
|
||||
if (dictValue.trim().equals(dict.getDictValue().trim()))
|
||||
{
|
||||
return dict.getDictLabel();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ruoyi.cms.util;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -315,4 +316,31 @@ public class StringUtil {
|
||||
.filter(StringUtils::hasText)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 从身份证号码中提取出生日期,格式化为 YYYY-MM-DD
|
||||
* @param idCard 身份证号码(15位或18位)
|
||||
* @return 格式化后的出生日期,解析失败返回空字符串
|
||||
*/
|
||||
public static String getBirthDateFromIdCard(String idCard) {
|
||||
if (idCard == null || (idCard.length() != 15 && idCard.length() != 18)) {
|
||||
return "";
|
||||
}
|
||||
String birthDateStr = "";
|
||||
try {
|
||||
if (idCard.length() == 18) {
|
||||
birthDateStr = idCard.substring(6, 14);
|
||||
} else if (idCard.length() == 15) {
|
||||
birthDateStr = "20" + idCard.substring(6, 12);
|
||||
}
|
||||
|
||||
SimpleDateFormat sdfInput = new SimpleDateFormat("yyyyMMdd");
|
||||
SimpleDateFormat sdfOutput = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date birthDate = sdfInput.parse(birthDateStr);
|
||||
return sdfOutput.format(birthDate);
|
||||
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user