Commit fb3da26e authored by fangxinjiang's avatar fangxinjiang

社保公积金自动化定时任务+社保公积金起缴日期+户截止日配置-fxj

parent 06030182
...@@ -1983,4 +1983,101 @@ public class DateUtil { ...@@ -1983,4 +1983,101 @@ public class DateUtil {
} }
return false; return false;
} }
/**
* 日期月份类型枚举
*/
public enum MonthType {
/**
* 当月及之前月份
*/
CURRENT_OR_BEFORE,
/**
* 次月
*/
NEXT_MONTH,
/**
* 次次月及之后月份
*/
NEXT_NEXT_MONTH_OR_AFTER
}
/**
* 判断给定日期相对于当前日期的月份类型
*
* @param targetDate 目标日期
* @return 月份类型枚举值
*/
public static MonthType checkMonthType(Date targetDate) {
if (targetDate == null) {
throw new IllegalArgumentException("目标日期不能为空");
}
// 获取当前月份的第一天
Date currentMonthFirstDay = DateUtil.setDayByDate(new Date(), 1);
// 获取下个月的第一天
Date nextMonthFirstDay = DateUtil.addMonthByDate(currentMonthFirstDay, 1);
// 获取下下个月的第一天
Date nextNextMonthFirstDay = DateUtil.addMonthByDate(currentMonthFirstDay, 2);
// 判断目标日期是否早于下个月第一天
if (!DateUtil.isAfter(targetDate, nextMonthFirstDay)) {
return MonthType.CURRENT_OR_BEFORE;
}
// 判断目标日期是否早于下下个月第一天
else if (!DateUtil.isAfter(targetDate, nextNextMonthFirstDay)) {
return MonthType.NEXT_MONTH;
}
// 其他情况为次次月及之后
else {
return MonthType.NEXT_NEXT_MONTH_OR_AFTER;
}
}
/**
* 判断给定日期是否为当月及之前月份
*
* @param targetDate 目标日期
* @return true: 当月及之前月份, false: 之后月份
*/
public static boolean isCurrentOrBeforeMonth(Date targetDate) {
return checkMonthType(targetDate) == MonthType.CURRENT_OR_BEFORE;
}
/**
* 判断给定日期是否为次月
*
* @param targetDate 目标日期
* @return true: 次月, false: 其他月份
*/
public static boolean isNextMonth(Date targetDate) {
return checkMonthType(targetDate) == MonthType.NEXT_MONTH;
}
/**
* 判断给定日期是否为次次月及之后月份
*
* @param targetDate 目标日期
* @return true: 次次月及之后月份, false: 之前月份
*/
public static boolean isNextNextMonthOrAfter(Date targetDate) {
return checkMonthType(targetDate) == MonthType.NEXT_NEXT_MONTH_OR_AFTER;
}
/**
* @Author fxj
* @Description 日期格式化后返回
* @Date 17:47 2025/12/19
* @Param
* @return
**/
public static Date formatDateByPatten(Date date, String patten) {
if (Common.isEmpty(patten)) {
patten = DATETIME_YYYYMM;
}
SimpleDateFormat sdf = new SimpleDateFormat(patten);
return stringToDate(sdf.format(date));
}
} }
...@@ -825,6 +825,9 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -825,6 +825,9 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}else { }else {
innerVo = resultR.getData(); innerVo = resultR.getData();
} }
if (null == innerVo){
throw new RuntimeException("请及时配置户("+houseName+")截止日配置信息");
}
boolean canBeHandle = innerVo.getCanBeHandle(); boolean canBeHandle = innerVo.getCanBeHandle();
LocalTime currentTime = LocalTime.now(); LocalTime currentTime = LocalTime.now();
LocalTime thresholdTime = LocalTime.of(15, 20); LocalTime thresholdTime = LocalTime.of(15, 20);
...@@ -835,11 +838,11 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -835,11 +838,11 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
String confirmTimeFormat = " 09:00"; String confirmTimeFormat = " 09:00";
//获取次月1号日期 //获取次月1号日期
Date nextMonthFirstDay = DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1); Date nextMonthFirstDay = DateUtil.addMonthByDate(DateUtil.formatDateByPatten(new Date(), DateUtil.ISO_EXPANDED_DATE_FORMAT), 1);
nextMonthFirstDay = DateUtil.setDayByDate(nextMonthFirstDay, 1); nextMonthFirstDay = DateUtil.setDayByDate(nextMonthFirstDay, 1);
//获取起缴月份1号 //获取起缴月份1号
Date startDateFirstDay = DateUtil.addDayByDate(startDate, 0); Date startDateFirstDay = DateUtil.addDayByDate(DateUtil.formatDateByPatten(startDate, DateUtil.ISO_EXPANDED_DATE_FORMAT), 0);
startDateFirstDay = DateUtil.setDayByDate(startDateFirstDay, 1); startDateFirstDay = DateUtil.setDayByDate(startDateFirstDay, 1);
//获取起缴月-1日期 //获取起缴月-1日期
...@@ -848,7 +851,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -848,7 +851,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
//获取次日 //获取次日
Date tomorrow = DateUtil.getDateByDayNum(1); Date tomorrow = DateUtil.getDateByDayNum(1);
//1.起缴月份为当月及之前的月份 //1.起缴月份为当月及之前的月份
if (!DateUtil.isAfter(startDate, DateUtil.getDateByDayNum(0))){ if (DateUtil.isCurrentOrBeforeMonth(startDate)){
if (canBeHandle){ if (canBeHandle){
//发起时间不看工作日 //发起时间不看工作日
if (isBeforeThreshold) { if (isBeforeThreshold) {
...@@ -871,10 +874,10 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -871,10 +874,10 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
} }
} }
//2.起缴月份为次月 //2.起缴月份为次月
else if (preVo2.getSocialStartDate().getTime() == DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1).getTime()){ else if (DateUtil.isNextMonth(startDate)){
//当月办次月生效 //当月办次月生效
if (CommonConstants.ONE_STRING.equals(innerVo.getAddHandleRule())){ if (CommonConstants.ONE_STRING.equals(innerVo.getAddHandleRule())){
if (canBeHandle && isBeforeThreshold){ if (canBeHandle){
Date today = new Date(); Date today = new Date();
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString( preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
today, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE)); today, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
...@@ -895,7 +898,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -895,7 +898,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
} }
} }
//3.起缴月份为次月之后的月份 //3.起缴月份为次月之后的月份
else if (preVo2.getSocialStartDate().getTime() > DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1).getTime()){ else if (DateUtil.isNextNextMonthOrAfter(startDate)){
//当月办次月生效 //当月办次月生效
if (CommonConstants.ONE_STRING.equals(innerVo.getAddHandleRule())){ if (CommonConstants.ONE_STRING.equals(innerVo.getAddHandleRule())){
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString( preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
......
...@@ -1023,11 +1023,11 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap ...@@ -1023,11 +1023,11 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
String confirmTimeFormat = " 09:00"; String confirmTimeFormat = " 09:00";
//获取次月1号日期 //获取次月1号日期
Date nextMonthFirstDay = DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1); Date nextMonthFirstDay = DateUtil.addMonthByDate(DateUtil.formatDateByPatten(new Date(), DateUtil.ISO_EXPANDED_DATE_FORMAT), 1);
nextMonthFirstDay = DateUtil.setDayByDate(nextMonthFirstDay, 1); nextMonthFirstDay = DateUtil.setDayByDate(nextMonthFirstDay, 1);
//获取起缴月份1号 //获取起缴月份1号
Date startDateFirstDay = DateUtil.addDayByDate(startDate, 0); Date startDateFirstDay = DateUtil.addDayByDate(DateUtil.formatDateByPatten(startDate, DateUtil.ISO_EXPANDED_DATE_FORMAT), 0);
startDateFirstDay = DateUtil.setDayByDate(startDateFirstDay, 1); startDateFirstDay = DateUtil.setDayByDate(startDateFirstDay, 1);
//获取起缴月-1日期 //获取起缴月-1日期
...@@ -1036,7 +1036,7 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap ...@@ -1036,7 +1036,7 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
//获取次日 //获取次日
Date tomorrow = DateUtil.getDateByDayNum(1); Date tomorrow = DateUtil.getDateByDayNum(1);
//1.起缴月份为当月及之前的月份 //1.起缴月份为当月及之前的月份
if (!DateUtil.isAfter(startDate, DateUtil.getDateByDayNum(0))){ if (DateUtil.isCurrentOrBeforeMonth(startDate)){
if (canBeHandle){ if (canBeHandle){
//发起时间不看工作日 //发起时间不看工作日
if (isBeforeThreshold) { if (isBeforeThreshold) {
...@@ -1059,10 +1059,10 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap ...@@ -1059,10 +1059,10 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
} }
} }
//2.起缴月份为次月 //2.起缴月份为次月
else if (preVo2.getSocialStartDate().getTime() == DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1).getTime()){ else if (DateUtil.isNextMonth(startDate)){
//当月办次月生效 //当月办次月生效
if (CommonConstants.ONE_STRING.equals(innerVo.getAddHandleRule())){ if (CommonConstants.ONE_STRING.equals(innerVo.getAddHandleRule())){
if (canBeHandle && isBeforeThreshold){ if (canBeHandle){
Date today = new Date(); Date today = new Date();
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString( preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
today, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE)); today, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
...@@ -1083,7 +1083,7 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap ...@@ -1083,7 +1083,7 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
} }
} }
//3.起缴月份为次月之后的月份 //3.起缴月份为次月之后的月份
else if (preVo2.getSocialStartDate().getTime() > DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1).getTime()){ else if (DateUtil.isNextNextMonthOrAfter(startDate)){
//当月办次月生效 //当月办次月生效
if (CommonConstants.ONE_STRING.equals(innerVo.getAddHandleRule())){ if (CommonConstants.ONE_STRING.equals(innerVo.getAddHandleRule())){
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString( preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
......
...@@ -214,6 +214,7 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe ...@@ -214,6 +214,7 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe
data.setRowIndex(rowIndex + 1); data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex()); ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)) { if (Common.isNotNull(errorMessage)) {
errorMessage.setData(data);
errorMessageList.add(errorMessage); errorMessageList.add(errorMessage);
} else { } else {
cachedDataList.add(data); cachedDataList.add(data);
...@@ -319,8 +320,8 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe ...@@ -319,8 +320,8 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe
errorMessageList.add(errorMsg); errorMessageList.add(errorMsg);
continue; continue;
} }
if (Integer.parseInt(excel.getDeadLineDay()) > 31 || Integer.parseInt(excel.getDeadLineDay()) < 1){ if (Integer.parseInt(excel.getDeadLineDay()) > 31 || Integer.parseInt(excel.getDeadLineDay()) < 10){
errorMsg = new ErrorMessage(excel.getRowIndex(), "派增截止(日)只能是1-31的数字", excel); errorMsg = new ErrorMessage(excel.getRowIndex(), "派增截止(日)只能是10-31的数字", excel);
errorMessageList.add(errorMsg); errorMessageList.add(errorMsg);
continue; continue;
} }
...@@ -439,7 +440,7 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe ...@@ -439,7 +440,7 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe
try { try {
TEmployeeInsuranceWorkDayVo vo = new TEmployeeInsuranceWorkDayVo(); TEmployeeInsuranceWorkDayVo vo = new TEmployeeInsuranceWorkDayVo();
// 设置RegistDate为当前月份对应的截止日期deadLineDay // 设置RegistDate为当前月份对应的截止日期deadLineDay
Date registDate = DateUtil.setDayByDate(new Date(), Integer.parseInt(deadLineDay)); Date registDate = DateUtil.setDayByDate(DateUtil.getDateByDayNum(0), Integer.parseInt(deadLineDay));
if (null == registDate) { if (null == registDate) {
return R.failed("未找到截止日期对应的可用工作日"); return R.failed("未找到截止日期对应的可用工作日");
} }
...@@ -476,11 +477,11 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe ...@@ -476,11 +477,11 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe
boolean isBeforeThreshold = currentTime.isBefore(thresholdTime) || currentTime.equals(thresholdTime); boolean isBeforeThreshold = currentTime.isBefore(thresholdTime) || currentTime.equals(thresholdTime);
//获取次月1号日期 //获取次月1号日期
Date nextMonthFirstDay = DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1); Date nextMonthFirstDay = DateUtil.addMonthByDate(DateUtil.formatDateByPatten(new Date(), DateUtil.ISO_EXPANDED_DATE_FORMAT), 1);
nextMonthFirstDay = DateUtil.setDayByDate(nextMonthFirstDay, 1); nextMonthFirstDay = DateUtil.setDayByDate(nextMonthFirstDay, 1);
//获取起缴月份1号 //获取起缴月份1号
Date startDateFirstDay = DateUtil.addDayByDate(startDate, 0); Date startDateFirstDay = DateUtil.addDayByDate(DateUtil.formatDateByPatten(startDate, DateUtil.ISO_EXPANDED_DATE_FORMAT), 0);
startDateFirstDay = DateUtil.setDayByDate(startDateFirstDay, 1); startDateFirstDay = DateUtil.setDayByDate(startDateFirstDay, 1);
//获取起缴月-1日期 //获取起缴月-1日期
...@@ -489,7 +490,7 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe ...@@ -489,7 +490,7 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe
//获取次日 //获取次日
Date tomorrow = DateUtil.getDateByDayNum(1); Date tomorrow = DateUtil.getDateByDayNum(1);
//1.起缴月份为当月及之前的月份 //1.起缴月份为当月及之前的月份
if (!DateUtil.isAfter(startDate, DateUtil.getDateByDayNum(0))){ if (DateUtil.isCurrentOrBeforeMonth(startDate)){
if (canBeHandle){ if (canBeHandle){
//发起时间不看工作日 //发起时间不看工作日
if (isBeforeThreshold) { if (isBeforeThreshold) {
...@@ -503,10 +504,10 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe ...@@ -503,10 +504,10 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe
} }
} }
//2.起缴月份为次月 //2.起缴月份为次月
else if (startDate.getTime() == DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1).getTime()){ else if (DateUtil.isNextMonth(startDate)){
//当月办次月生效 //当月办次月生效
if (CommonConstants.ONE_STRING.equals(addHandleRule)){ if (CommonConstants.ONE_STRING.equals(addHandleRule)){
if (canBeHandle && isBeforeThreshold){ if (canBeHandle){
Date today = new Date(); Date today = new Date();
return DateUtil.dateToString(today, DateUtil.ISO_EXPANDED_DATE_FORMAT); return DateUtil.dateToString(today, DateUtil.ISO_EXPANDED_DATE_FORMAT);
} else { } else {
...@@ -518,7 +519,7 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe ...@@ -518,7 +519,7 @@ public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMappe
} }
} }
//3.起缴月份为次月之后的月份 //3.起缴月份为次月之后的月份
else if (startDate.getTime() > DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1).getTime()){ else if (DateUtil.isNextNextMonthOrAfter(startDate)){
//当月办次月生效 //当月办次月生效
if (CommonConstants.ONE_STRING.equals(addHandleRule)){ if (CommonConstants.ONE_STRING.equals(addHandleRule)){
return DateUtil.dateToString(startDatePrevMonth, DateUtil.ISO_EXPANDED_DATE_FORMAT); return DateUtil.dateToString(startDatePrevMonth, DateUtil.ISO_EXPANDED_DATE_FORMAT);
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
AND a.ID = #{tHouseHoldLimit.id} AND a.ID = #{tHouseHoldLimit.id}
</if> </if>
<if test="tHouseHoldLimit.name != null and tHouseHoldLimit.name.trim() != ''"> <if test="tHouseHoldLimit.name != null and tHouseHoldLimit.name.trim() != ''">
AND a.NAME = #{tHouseHoldLimit.name} AND a.NAME like concat('%', #{tHouseHoldLimit.name}, '%')
</if> </if>
<if test="tHouseHoldLimit.type != null and tHouseHoldLimit.type.trim() != ''"> <if test="tHouseHoldLimit.type != null and tHouseHoldLimit.type.trim() != ''">
AND a.TYPE = #{tHouseHoldLimit.type} AND a.TYPE = #{tHouseHoldLimit.type}
......
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