Commit 4232d127 authored by hongguangwu's avatar hongguangwu

1.7.21-参加工作日期

parent 582ae4fa
...@@ -24,7 +24,10 @@ import org.springframework.web.util.UriComponentsBuilder; ...@@ -24,7 +24,10 @@ import org.springframework.web.util.UriComponentsBuilder;
import java.net.URL; import java.net.URL;
import java.security.SignatureException; import java.security.SignatureException;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.*; import java.util.*;
import static com.alibaba.fastjson.serializer.SerializerFeature.*; import static com.alibaba.fastjson.serializer.SerializerFeature.*;
...@@ -460,6 +463,9 @@ public class SocialFriendConfig { ...@@ -460,6 +463,9 @@ public class SocialFriendConfig {
// 企业职工基本医疗保险参保登记表 安徽非必填! 数组 // 企业职工基本医疗保险参保登记表 安徽非必填! 数组
String[] arr = {qyzgjbylbxcbdjb}; String[] arr = {qyzgjbylbxcbdjb};
JSONArray ybzyclArr; JSONArray ybzyclArr;
String birthStr;
String thisDay = DateUtil.formatDate(new Date());
String workDay;
// 2025-3-14 15:44:32 单个改造为批量 // 2025-3-14 15:44:32 单个改造为批量
for (SociaFriendYgsAddVo vo : listVo) { for (SociaFriendYgsAddVo vo : listVo) {
cbrymdOne = new JSONObject(); cbrymdOne = new JSONObject();
...@@ -475,7 +481,8 @@ public class SocialFriendConfig { ...@@ -475,7 +481,8 @@ public class SocialFriendConfig {
// 性别 // 性别
cbrymdOne.put("xb", getSexName(vo.getEmpIdcard())); cbrymdOne.put("xb", getSexName(vo.getEmpIdcard()));
// 出生日期 // 出生日期
cbrymdOne.put("csrq", getBirthStr(vo.getEmpIdcard())); birthStr = getBirthStr(vo.getEmpIdcard());
cbrymdOne.put("csrq", birthStr);
// 民族 空的默认汉族 // 民族 空的默认汉族
cbrymdOne.put("mz", vo.getEmpNational()); cbrymdOne.put("mz", vo.getEmpNational());
// 手机号码 // 手机号码
...@@ -493,8 +500,11 @@ public class SocialFriendConfig { ...@@ -493,8 +500,11 @@ public class SocialFriendConfig {
cbrymdOne.put("jzdzxzq", areaName); cbrymdOne.put("jzdzxzq", areaName);
// 社保起缴日期(养老起缴)yyyy-MM-dd // 社保起缴日期(养老起缴)yyyy-MM-dd
startDate = vo.getSocialStartDate(); startDate = vo.getSocialStartDate();
// workDay = startDate,判断要在区间birthStr和thisDay之间,否则为birthStr或thisDay
workDay = startDate;
workDay = judgeWorkDayBetweenBirthAndThisDay(birthStr, thisDay, workDay);
// 参加工作日期 // 参加工作日期
cbrymdOne.put("cjgzrq", startDate); cbrymdOne.put("cjgzrq", workDay);
// 文化程度 见字典“受教育程度” 空的默认“大学专科” // 文化程度 见字典“受教育程度” 空的默认“大学专科”
//cbrymdOne.put("whcd", "大学专科") //cbrymdOne.put("whcd", "大学专科")
cbrymdOne.put("whcd", vo.getEducationName()); cbrymdOne.put("whcd", vo.getEducationName());
...@@ -625,6 +635,37 @@ public class SocialFriendConfig { ...@@ -625,6 +635,37 @@ public class SocialFriendConfig {
json.put(buyType, cbrymdArr); json.put(buyType, cbrymdArr);
} }
// 判断参加工作日期在出生日期与当前时间之间
private static String judgeWorkDayBetweenBirthAndThisDay(String birthStr, String thisDay, String workDay) {
if (Common.isNotNull(workDay) && Common.isNotNull(birthStr) && Common.isNotNull(thisDay)) {
// 确保参加工作日期在出生日期之后,今天之前
if (isValidDate(birthStr) && workDay.compareTo(birthStr) < 0) {
// 如果参加工作日期早于出生日期,使用出生日期
workDay = birthStr;
} else if (workDay.compareTo(thisDay) > 0) {
// 如果参加工作日期晚于今天,使用今天
workDay = thisDay;
}
} else {
// 如果 startDate 为空,默认为今天
workDay = thisDay;
}
return workDay;
}
// 判断字符串是否为日期格式
public static boolean isValidDate(String birthStr) {
if (birthStr == null || birthStr.trim().isEmpty()) {
return false;
}
try {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate.parse(birthStr, formatter);
return true;
} catch (DateTimeParseException e) {
return false;
}
}
/** /**
* @param json 主json存数据 * @param json 主json存数据
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment