Commit 57aa7f82 authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/MVP1.7.18' into MVP1.7.18

parents 3806e44c 04955658
...@@ -68,7 +68,7 @@ public class TAutoFundRuleInfo extends BaseEntity { ...@@ -68,7 +68,7 @@ public class TAutoFundRuleInfo extends BaseEntity {
@Schema(description = "是否自动触发派增(字典:0自动触发派增,1:手动派增)") @Schema(description = "是否自动触发派增(字典:0自动触发派增,1:手动派增)")
private String autoFlag; private String autoFlag;
/** /**
* 派单发起时间(字典:0:起缴日期当日) * 派单发起时间(字典:0:起缴日期当日) 新:0:按起缴日期计算得出
*/ */
@ExcelAttribute(name = "派单发起时间", maxLength = 2) @ExcelAttribute(name = "派单发起时间", maxLength = 2)
@Length(max = 2, message = "派单发起时间不能超过2个字符") @Length(max = 2, message = "派单发起时间不能超过2个字符")
......
...@@ -93,12 +93,14 @@ public class TAutoFundRuleRel extends BaseEntity { ...@@ -93,12 +93,14 @@ public class TAutoFundRuleRel extends BaseEntity {
@Schema(description = "公积金单位个人比例是否一致(0-是,1-否)") @Schema(description = "公积金单位个人比例是否一致(0-是,1-否)")
private String fundPerFlag; private String fundPerFlag;
/** /**
* 起缴日期类型:0 入职日期 1 入职满1年次月 2 人员自定义 * 起缴日期类型:0 入职日期 1 入职满个月 2 入职满2个月 3 入职满3个月 4 入职满4个月 5 入职满5个月 6 入职满6个月 7 入职满7个月
* * 8 入职满8个月 9 入职满9个月 10 入职满10个月 11 入职满11个月 12 入职满12个月
* 原:0 入职日期 1 入职满1年次月 2 人员自定义
*/ */
@ExcelAttribute(name = "起缴日期类型", maxLength = 2) @ExcelAttribute(name = "起缴日期类型", maxLength = 2)
@Length(max = 2, message = "起缴日期类型不能超过2个字符") @Length(max = 2, message = "起缴日期类型不能超过2个字符")
@ExcelProperty("起缴日期类型") @ExcelProperty("起缴日期类型")
@Schema(description = "起缴日期类型:0 入职日期 1 入职满1年次月 2 人员自定义") @Schema(description = "起缴日期类型:0 入职日期 1 入职满个月 2 入职满2个月 3 入职满3个月 4 入职满4个月 5 入职满5个月 6 入职满6个月 7 入职满7个月 8 入职满8个月 9 入职满9个月 10 入职满10个月 11 入职满11个月 12 入职满12个月 ")
private String fundDateType; private String fundDateType;
/** /**
* 缴纳基数类型:0最低、1自定义、2最高、3固定基数 * 缴纳基数类型:0最低、1自定义、2最高、3固定基数
......
...@@ -67,12 +67,12 @@ public class TAutoSocialRuleInfo extends BaseEntity { ...@@ -67,12 +67,12 @@ public class TAutoSocialRuleInfo extends BaseEntity {
@Schema(description = "是否自动触发派增(字典:0自动触发派增,1:手动派增)") @Schema(description = "是否自动触发派增(字典:0自动触发派增,1:手动派增)")
private String autoFlag; private String autoFlag;
/** /**
* 派单发起时间(字典::0:入职满1个月...入职满6个月) * 派单发起时间(字典::0:入职满1个月...入职满6个月) 新:6:按起缴日期计算得出
*/ */
@ExcelAttribute(name = "派单发起时间", maxLength = 2,isNotEmpty = false, errorInfo = "派单发起时间不能为空") @ExcelAttribute(name = "派单发起时间", maxLength = 2,isNotEmpty = false, errorInfo = "派单发起时间不能为空")
@Length(max = 2, message = "派单发起时间不能超过2个字符") @Length(max = 2, message = "派单发起时间不能超过2个字符")
@ExcelProperty("派单发起时间") @ExcelProperty("派单发起时间")
@Schema(description = "派单发起时间(字典::0:入职满1个月...入职满6个月)") @Schema(description = "派单发起时间(字典::0:入职满1个月...入职满6个月 6:按起缴日期计算得出)")
private String startPeriod; private String startPeriod;
/** /**
* 派单发起具体时间字典:0:15:20 * 派单发起具体时间字典:0:15:20
......
...@@ -94,12 +94,14 @@ public class TAutoSocialRuleRel extends BaseEntity { ...@@ -94,12 +94,14 @@ public class TAutoSocialRuleRel extends BaseEntity {
@Schema(description = "社保起缴日期是否一致(0-是,1-否)") @Schema(description = "社保起缴日期是否一致(0-是,1-否)")
private String socialDateFlag; private String socialDateFlag;
/** /**
* 起缴日期:0 入职日期 * 起缴日期类型:0 入职日期 1 入职满个月 2 入职满2个月 3 入职满3个月 4 入职满4个月 5 入职满5个月 6 入职满6个月 7 入职满7个月
*/ * 8 入职满8个月 9 入职满9个月 10 入职满10个月 11 入职满11个月 12 入职满12个月
@ExcelAttribute(name = "起缴日期", maxLength = 2) * 原:0 入职日期
@Length(max = 2, message = "起缴日期不能超过2个字符") */
@ExcelProperty("起缴日期") @ExcelAttribute(name = "起缴日期类型", maxLength = 2)
@Schema(description = "起缴日期:0 入职日期") @Length(max = 2, message = "起缴日期类型不能超过2个字符")
@ExcelProperty("起缴日期类型")
@Schema(description = "起缴日期类型:0 入职日期 1 入职满个月 2 入职满2个月 3 入职满3个月 4 入职满4个月 5 入职满5个月 6 入职满6个月 7 入职满7个月 8 入职满8个月 9 入职满9个月 10 入职满10个月 11 入职满11个月 12 入职满12个月")
private String socialDateType; private String socialDateType;
/** /**
* 缴纳类型:0最低、1自定义、2最高 * 缴纳类型:0最低、1自定义、2最高
......
...@@ -270,14 +270,25 @@ public class TDispatchInfoPreVo extends RowIndex implements Serializable { ...@@ -270,14 +270,25 @@ public class TDispatchInfoPreVo extends RowIndex implements Serializable {
private String registerId; private String registerId;
/** /**
* 起缴日期类型:0 入职日期 1 入职满1年次月 2 人员自定义 * 起缴日期类型:0 入职日期 1 入职满1个月 2 入职满2个月 3 入职满3个月 4 入职满4个月 5 入职满5个月 6 入职满6个月 7 入职满7个月 8 入职满8个月 9 入职满9个月 10 入职满10个月 11 入职满11个月 12 入职满12个月
* 原:0 入职日期 1 入职满1年次月 2 人员自定义
*/ */
@ExcelAttribute(name = "起缴日期类型", maxLength = 2) @ExcelAttribute(name = "起缴日期类型", maxLength = 2)
@Length(max = 2, message = "起缴日期类型不能超过2个字符") @Length(max = 2, message = "起缴日期类型不能超过2个字符")
@ExcelProperty("起缴日期类型") @ExcelProperty("起缴日期类型")
@Schema(description = "起缴日期类型:0 入职日期 1 入职满1年次月 2 人员自定义") @Schema(description = "起缴日期类型:0 入职日期 1 入职满1个月 2 入职满2个月 3 入职满3个月 4 入职满4个月 5 入职满5个月 6 入职满6个月 7 入职满7个月 8 入职满8个月 9 入职满9个月 10 入职满10个月 11 入职满11个月 12 入职满12个月")
private String fundDateType; private String fundDateType;
/**
* 起缴日期类型:0 入职日期 1 入职满1个月 2 入职满2个月 3 入职满3个月 4 入职满4个月 5 入职满5个月 6 入职满6个月 7 入职满7个月 8 入职满8个月 9 入职满9个月 10 入职满10个月 11 入职满11个月 12 入职满12个月
* 原:0 入职日期 1 入职满1年次月 2 人员自定义
*/
@ExcelAttribute(name = "起缴日期类型", maxLength = 2)
@Length(max = 2, message = "起缴日期类型不能超过2个字符")
@ExcelProperty("起缴日期类型")
@Schema(description = "起缴日期类型:0 入职日期 1 入职满1个月 2 入职满2个月 3 入职满3个月 4 入职满4个月 5 入职满5个月 6 入职满6个月 7 入职满7个月 8 入职满8个月 9 入职满9个月 10 入职满10个月 11 入职满11个月 12 入职满12个月")
private String socialDateType;
/** /**
* 公积金单位个人比例是否一致(0-是,1-否) * 公积金单位个人比例是否一致(0-是,1-否)
*/ */
......
...@@ -1090,10 +1090,31 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe ...@@ -1090,10 +1090,31 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
preVo.setTypeSub(CommonConstants.ZERO_STRING); preVo.setTypeSub(CommonConstants.ZERO_STRING);
preVo.setProcessStatus(CommonConstants.ZERO_STRING); preVo.setProcessStatus(CommonConstants.ZERO_STRING);
preVo.setDispatchItem("养老、医疗、生育、失业、工伤、大病"); preVo.setDispatchItem("养老、医疗、生育、失业、工伤、大病");
if (CommonConstants.ZERO_STRING.equals(preVo.getIsCreateDate()) && Common.isEmpty(preVo.getSocialStartDate())) { if (CommonConstants.ZERO_STRING.equals(preVo.getIsCreateDate())) {
//原社保起缴日期类型为 0 入职日期 新:0 入职日期 1 入职满1个月 2 入职满2个月 3 入职满3个月 4 入职满4个月 5 入职满5个月
// 6 入职满6个月 7 入职满7个月 8 入职满8个月 9 入职满9个月 10 入职满10个月 11 入职满11个月 12 入职满12个月
if (Common.isEmpty(preVo.getSocialStartDate())) {
if (Common.isNotNull(preVo.getSocialDateType())){
TEmployeeContractDateVo vo = new TEmployeeContractDateVo();
vo.setMonthAfter(Integer.parseInt(preVo.getSocialDateType()));
vo.setYearAfter(0);
vo.setRegistDate(pre.getJoinLeaveDate());
Date date = this.addYearsMonths(vo);
preVo.setSocialStartDate(date);
}else {
preVo.setSocialStartDate(pre.getJoinLeaveDate()); preVo.setSocialStartDate(pre.getJoinLeaveDate());
} }
} }
preVo.setBigailmentStart(preVo.getSocialStartDate());
preVo.setPensionStart(preVo.getSocialStartDate());
preVo.setMedicalStart(preVo.getSocialStartDate());
preVo.setBirthStart(preVo.getSocialStartDate());
preVo.setWorkInjuryStart(preVo.getSocialStartDate());
preVo.setUnemployStart(preVo.getSocialStartDate());
preVo.setSocialStartDate(preVo.getSocialStartDate());
}
}
//公积金待购买数据初始化 //公积金待购买数据初始化
private void initFundPreInfo(EmployeeRegistrationPreVo pre, TDispatchInfoPreVo preVo, private void initFundPreInfo(EmployeeRegistrationPreVo pre, TDispatchInfoPreVo preVo,
......
...@@ -1892,6 +1892,38 @@ public class DateUtil { ...@@ -1892,6 +1892,38 @@ public class DateUtil {
} }
} }
/**
* 设置日期中的天
*
* @param date 原始日期
* @param day 要设置的天数
* @return 修改后的日期
*/
public static Date setDayByDate(Date date, int day) {
Calendar cal = Calendar.getInstance();
if (date != null) {
cal.setTime(date);
} else {
log.warn("Input date is null, will use current date");
return null;
}
// 对day参数进行基本的有效性检查
if (day < 1 || day > 31) {
log.warn("Day must be between 1 and 31, but found: " + day);
return null;
}
// 如果day大于当月最大天数,则将day设置为当月最大天数,如2月为28日,但是day为31,则将day设置为当月最大天数28
int maxDayOfMonth = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
if (day > maxDayOfMonth) {
day = maxDayOfMonth;
}
cal.set(Calendar.DAY_OF_MONTH, day);
return cal.getTime();
}
public static boolean isDate(String dateText) { public static boolean isDate(String dateText) {
if (dateText == null) { if (dateText == null) {
return true; return true;
...@@ -1937,4 +1969,18 @@ public class DateUtil { ...@@ -1937,4 +1969,18 @@ public class DateUtil {
} }
return false; return false;
} }
/**
* @Author fxj
* @Description 判断 日期 date 是否在 registDate 之后,在返回true,否则返回false
* @Date 15:10 2025/12/12
* @Param
* @return
**/
public static boolean isAfter(Date date, Date registDate) {
if (date.getTime() > registDate.getTime()) {
return true;
}
return false;
}
} }
...@@ -58,4 +58,8 @@ public class BaseSearchVO implements Serializable { ...@@ -58,4 +58,8 @@ public class BaseSearchVO implements Serializable {
private String resultIdFour; private String resultIdFour;
private String resultIdFourStatus; private String resultIdFourStatus;
private String name;
private String type;
} }
...@@ -432,4 +432,19 @@ public class SocialDaprUtils { ...@@ -432,4 +432,19 @@ public class SocialDaprUtils {
return res; return res;
} }
/**
* @Author fxj
* @Description 通过户名称及类型 获取到截止日,然后看是否为工作日,如果不是工作日则往前推,知道找到工作日,然后返回工作日
* @Date 14:22 2025/12/12
* @Param
* @return
**/
public R<THouseHoldLimitInnerVo> getWorkDayByDeadLineDay(BaseSearchVO paramVo) {
R<THouseHoldLimitInnerVo> res = HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId()
,"/thouseholdlimit/inner/checkCanBeHandleByDeadLineDay", paramVo, THouseHoldLimitInnerVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res)){
return R.failed("查询截止日对应的工作日信息失败!");
}
return res;
}
} }
...@@ -35,6 +35,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.ClientNameConstants; ...@@ -35,6 +35,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.ClientNameConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseSearchVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.UserPermissionVo; import com.yifu.cloud.plus.v1.yifu.common.core.vo.UserPermissionVo;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties; import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
...@@ -47,6 +48,7 @@ import com.yifu.cloud.plus.v1.yifu.insurances.vo.TEmployeeInsurancePreVo; ...@@ -47,6 +48,7 @@ import com.yifu.cloud.plus.v1.yifu.insurances.vo.TEmployeeInsurancePreVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TEmployeeInsuranceSelectVo; import com.yifu.cloud.plus.v1.yifu.insurances.vo.TEmployeeInsuranceSelectVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.SysBaseSetInfoVo; import com.yifu.cloud.plus.v1.yifu.social.vo.SysBaseSetInfoVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TEmployeeInsuranceWorkDayVo; import com.yifu.cloud.plus.v1.yifu.social.vo.TEmployeeInsuranceWorkDayVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.THouseHoldLimitInnerVo;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -63,6 +65,7 @@ import java.net.URLEncoder; ...@@ -63,6 +65,7 @@ import java.net.URLEncoder;
import java.text.ParseException; import java.text.ParseException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
...@@ -774,7 +777,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -774,7 +777,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
return R.ok(); return R.ok();
} }
private void initFundPreInfo(EmployeeRegistration registration, TDispatchInfoPreVo preVo, YifuUser user, String id) { private void initFundPreInfo(EmployeeRegistration registration, TDispatchInfoPreVo preVo, YifuUser user, String id) throws ParseException {
preVo.setRegisterId(id); preVo.setRegisterId(id);
preVo.setCustomerUsername(registration.getCustomerUsernameNew()); preVo.setCustomerUsername(registration.getCustomerUsernameNew());
preVo.setCustomerUserLoginName(null != registration.getCustomerUserLoginNameNew() preVo.setCustomerUserLoginName(null != registration.getCustomerUserLoginNameNew()
...@@ -794,97 +797,131 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -794,97 +797,131 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
preVo.setProcessStatus(CommonConstants.ZERO_STRING); preVo.setProcessStatus(CommonConstants.ZERO_STRING);
preVo.setDispatchItem("公积金"); preVo.setDispatchItem("公积金");
//如果公积金起缴日期为空需要初始化--只有批量确认时才会走到这里 //如果公积金起缴日期为空需要初始化--只有批量确认时才会走到这里
initFundStartDate(registration, preVo); initFundStartDate(preVo);
//如果自动触发派增为是,计算派单发起时间和派单确认时间 //如果自动触发派增为是,计算派单发起时间和派单确认时间
if (Common.isNotNull(preVo.getIsAutoDis()) && CommonConstants.ZERO_STRING.equals(preVo.getIsAutoDis()) if (Common.isNotNull(preVo.getIsAutoDis()) && CommonConstants.ZERO_STRING.equals(preVo.getIsAutoDis())
&& Common.isNotNull(preVo.getExpectedCollectionType())) { && Common.isNotNull(preVo.getExpectedCollectionType())
TEmployeeContractDateVo vo = new TEmployeeContractDateVo(); && null == preVo.getExpectedCollectionTime()
&& null == preVo.getExpectedConfirmTime()) {
//接收方式 0项目配置 1自定义 initExpectedCollectionTime(preVo.getProvidentHouseholdName(), preVo.getFundStartDate(), preVo);
if (CommonConstants.ONE_STRING.equals(preVo.getReceiveType())){
vo.setMonthAfter(CommonConstants.ZERO_INT);
vo.setYearAfter(0);
vo.setRegistDate(preVo.getFundStartDate());
}else {
if (null == preVo.getFundStartDate()){
//先计算起缴日期
if (CommonConstants.ZERO_STRING.equals(preVo.getFundDateType())){
//用户选择起缴日期类型为入职日期,以入职日期为基准
vo.setMonthAfter(CommonConstants.ZERO_INT);
vo.setYearAfter(0);
vo.setRegistDate(registration.getJoinLeaveDate());
}else if (CommonConstants.ONE_STRING.equals(preVo.getFundDateType())){
//用户选择起缴日期类型为入职满一年次月,以入职日期为基准 加上年月调整
vo.setMonthAfter(CommonConstants.ONE_INT);
vo.setYearAfter(CommonConstants.ONE_INT);
vo.setRegistDate(registration.getJoinLeaveDate());
}else if (CommonConstants.TWO_STRING.equals(preVo.getFundDateType())){
//用户自定义取值用户填写的起缴日期为基准
vo.setMonthAfter(CommonConstants.ZERO_INT);
vo.setYearAfter(0);
vo.setRegistDate(preVo.getFundStartDate());
}
}else {
vo.setMonthAfter(CommonConstants.ZERO_INT);
vo.setYearAfter(0);
vo.setRegistDate(preVo.getFundStartDate());
} }
} }
Date date = this.addYearsMonths(vo);
if (CommonConstants.ONE_STRING.equals(preVo.getFundDateType())){ /**
date = DateUtil.getFirstDay(date); * @Author fxj
* @Description 初始化预计派单发起时间、预计派单确认时间
* @Date 17:06 2025/12/12
**/
private void initExpectedCollectionTime(String houseName, Date startDate, TDispatchInfoPreVo preVo2) throws ParseException {
//获取当前月是否可办理状态:获取办理截止日往前最近的工昨日,当前日及截止日前(含截止日)有工作日就是可办理
BaseSearchVO paramVo = new BaseSearchVO();
paramVo.setName(houseName);
paramVo.setType(CommonConstants.ZERO_STRING);
THouseHoldLimitInnerVo innerVo = null;
R<THouseHoldLimitInnerVo> resultR = socialDaprUtils.getWorkDayByDeadLineDay(paramVo);
if (!Common.isNotNull(resultR) && !Common.isNotNull(resultR.getData())){
throw new RuntimeException("获取截止日信息失败");
}else {
innerVo = resultR.getData();
}
boolean canBeHandle = innerVo.getCanBeHandle();
LocalTime currentTime = LocalTime.now();
LocalTime thresholdTime = LocalTime.of(15, 20);
boolean isBeforeThreshold = currentTime.isBefore(thresholdTime) || currentTime.equals(thresholdTime);
// 时间格式常量
String collectionTimeFormat = " 15:20";
String confirmTimeFormat = " 09:00";
//获取次月1号日期
Date nextMonthFirstDay = DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1);
nextMonthFirstDay = DateUtil.setDayByDate(nextMonthFirstDay, 1);
//获取起缴月份1号
Date startDateFirstDay = DateUtil.addDayByDate(startDate, 0);
startDateFirstDay = DateUtil.setDayByDate(startDateFirstDay, 1);
//获取起缴月-1日期
Date startDatePrevMonth = DateUtil.addMonthByDate(startDateFirstDay, -1);
//获取次日
Date tomorrow = DateUtil.getDateByDayNum(1);
//1.起缴月份为当月及之前的月份
if (!DateUtil.isAfter(startDate, DateUtil.getDateByDayNum(0))){
if (canBeHandle){
//发起时间不看工作日
if (isBeforeThreshold) {
Date today = new Date();
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
today, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
today, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
} else {
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
tomorrow, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
tomorrow, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
} }
TEmployeeInsuranceWorkDayVo dayVo = new TEmployeeInsuranceWorkDayVo();
dayVo.setType(CommonConstants.TWO_STRING);
dayVo.setRegistDate(date);
dayVo.setRegistType(0);
R<TEmployeeInsuranceWorkDayVo> dataR = socialDaprUtils.getContractAfterWorkDay(dayVo);
if (Common.isNotNull(dataR) && Common.isNotNull(dataR.getData())
&& Common.isNotNull(dataR.getData().getRegistDate())) {
preVo.setExpectedCollectionTime(dataR.getData().getRegistDate());
preVo.setExpectedConfirmTime(dataR.getData().getRegistDate());
} else { } else {
preVo.setExpectedCollectionTime(date); preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
preVo.setExpectedConfirmTime(date); nextMonthFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
nextMonthFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
}
}
//2.起缴月份为次月
else if (preVo2.getSocialStartDate().getTime() == DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1).getTime()){
//当月办次月生效
if (CommonConstants.ONE_STRING.equals(innerVo.getAddHandleRule())){
if (canBeHandle && isBeforeThreshold){
Date today = new Date();
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
today, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
today, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
} else {
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
nextMonthFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
nextMonthFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
} }
try { //当月办当月生效
preVo.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString( } else if (CommonConstants.ZERO_STRING.equals(innerVo.getAddHandleRule())){
preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 15:20", DateUtil.DATETIME_PATTERN_MINUTE)); preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
preVo.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString( nextMonthFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 09:00", DateUtil.DATETIME_PATTERN_MINUTE)); preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
} catch (ParseException e) { nextMonthFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
log.error("初始化预计派单日期异常!", e);
throw new RuntimeException("初始化预计派单日期异常!"+e.getMessage());
} }
} }
//3.起缴月份为次月之后的月份
else if (preVo2.getSocialStartDate().getTime() > DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1).getTime()){
//当月办次月生效
if (CommonConstants.ONE_STRING.equals(innerVo.getAddHandleRule())){
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
startDatePrevMonth, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
startDatePrevMonth, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
} else if (CommonConstants.ZERO_STRING.equals(innerVo.getAddHandleRule())){
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
startDateFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
startDateFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
}
}
} }
private void initFundStartDate(EmployeeRegistration registration, TDispatchInfoPreVo preVo) { private void initFundStartDate(TDispatchInfoPreVo preVo) {
if (null == preVo.getFundStartDate()) { if (null == preVo.getFundStartDate()) {
TEmployeeContractDateVo initDate = new TEmployeeContractDateVo(); TEmployeeContractDateVo initDate = new TEmployeeContractDateVo();
//先计算起缴日期 接收方式 0项目配置 自定义必须填写起缴日期 //先计算起缴日期 接收方式 0项目配置 自定义必须填写起缴日期
if (CommonConstants.ZERO_STRING.equals(preVo.getFundDateType())){ //0 入职日期 1 入职满个月 2 入职满2个月 3 入职满3个月 4 入职满4个月 5 入职满5个月 6 入职满6个月 7 入职满7个月
//用户选择起缴日期类型为入职日期,以入职日期为基准 //8 入职满8个月 9 入职满9个月 10 入职满10个月 11 入职满11个月 12 入职满12个月
initDate.setMonthAfter(CommonConstants.ZERO_INT); initDate.setMonthAfter(Integer.parseInt(preVo.getFundDateType()));
initDate.setYearAfter(0);
initDate.setRegistDate(registration.getJoinLeaveDate());
}else if (CommonConstants.ONE_STRING.equals(preVo.getFundDateType())){
//用户选择起缴日期类型为入职满一年次月,以入职日期为基准 加上年月调整
initDate.setMonthAfter(CommonConstants.ONE_INT);
initDate.setYearAfter(CommonConstants.ONE_INT);
initDate.setRegistDate(registration.getJoinLeaveDate());
}else if (CommonConstants.TWO_STRING.equals(preVo.getFundDateType())){
//用户自定义取值用户填写的起缴日期为基准
initDate.setMonthAfter(CommonConstants.ZERO_INT);
initDate.setYearAfter(0); initDate.setYearAfter(0);
initDate.setRegistDate(preVo.getFundStartDate()); initDate.setRegistDate(preVo.getJoinLeaveDate());
}
Date date = this.addYearsMonths(initDate); Date date = this.addYearsMonths(initDate);
if (CommonConstants.ONE_STRING.equals(preVo.getFundDateType())){
date = DateUtil.getFirstDay(date);
}
preVo.setFundStartDate(date); preVo.setFundStartDate(date);
} }
} }
...@@ -2030,40 +2067,36 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -2030,40 +2067,36 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
preVo.setProcessStatus(CommonConstants.ZERO_STRING); preVo.setProcessStatus(CommonConstants.ZERO_STRING);
preVo.setDispatchItem("养老、医疗、生育、失业、工伤、大病"); preVo.setDispatchItem("养老、医疗、生育、失业、工伤、大病");
if (CommonConstants.ZERO_STRING.equals(preVo.getIsCreateDate()) && Common.isEmpty(preVo.getSocialStartDate())) { if (CommonConstants.ZERO_STRING.equals(preVo.getIsCreateDate())) {
preVo.setBigailmentStart(registration.getJoinLeaveDate()); //原社保起缴日期类型为 0 入职日期 新:0 入职日期 1 入职满1个月 2 入职满2个月 3 入职满3个月 4 入职满4个月 5 入职满5个月
preVo.setPensionStart(registration.getJoinLeaveDate()); // 6 入职满6个月 7 入职满7个月 8 入职满8个月 9 入职满9个月 10 入职满10个月 11 入职满11个月 12 入职满12个月
preVo.setMedicalStart(registration.getJoinLeaveDate()); if (Common.isEmpty(preVo.getSocialStartDate())) {
preVo.setBirthStart(registration.getJoinLeaveDate()); if (Common.isNotNull(preVo.getSocialDateType())){
preVo.setWorkInjuryStart(registration.getJoinLeaveDate());
preVo.setUnemployStart(registration.getJoinLeaveDate());
preVo.setSocialStartDate(registration.getJoinLeaveDate());
}
//如果自动触发派增为是,计算派单发起时间和派单确认时间
if (Common.isNotNull(preVo.getIsAutoDis()) && CommonConstants.ZERO_STRING.equals(preVo.getIsAutoDis())
&& Common.isNotNull(preVo.getExpectedCollectionType())) {
TEmployeeContractDateVo vo = new TEmployeeContractDateVo(); TEmployeeContractDateVo vo = new TEmployeeContractDateVo();
vo.setMonthAfter(Integer.parseInt(preVo.getExpectedCollectionType())); vo.setMonthAfter(Integer.parseInt(preVo.getSocialDateType()));
vo.setYearAfter(0); vo.setYearAfter(0);
vo.setRegistDate(registration.getJoinLeaveDate()); vo.setRegistDate(registration.getJoinLeaveDate());
Date date = this.addYearsMonths(vo); Date date = this.addYearsMonths(vo);
TEmployeeInsuranceWorkDayVo dayVo = new TEmployeeInsuranceWorkDayVo(); preVo.setSocialStartDate(date);
dayVo.setType(CommonConstants.TWO_STRING); }else {
dayVo.setRegistDate(date); preVo.setSocialStartDate(registration.getJoinLeaveDate());
dayVo.setRegistType(0);
R<TEmployeeInsuranceWorkDayVo> dataR = socialDaprUtils.getContractAfterWorkDay(dayVo);
if (Common.isNotNull(dataR) && Common.isNotNull(dataR.getData())
&& Common.isNotNull(dataR.getData().getRegistDate())) {
preVo.setExpectedCollectionTime(dataR.getData().getRegistDate());
preVo.setExpectedConfirmTime(dataR.getData().getRegistDate());
} else {
preVo.setExpectedCollectionTime(date);
preVo.setExpectedConfirmTime(date);
} }
preVo.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString( }
preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 15:20", DateUtil.DATETIME_PATTERN_MINUTE)); preVo.setBigailmentStart(preVo.getSocialStartDate());
preVo.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString( preVo.setPensionStart(preVo.getSocialStartDate());
preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 09:00", DateUtil.DATETIME_PATTERN_MINUTE)); preVo.setMedicalStart(preVo.getSocialStartDate());
preVo.setBirthStart(preVo.getSocialStartDate());
preVo.setWorkInjuryStart(preVo.getSocialStartDate());
preVo.setUnemployStart(preVo.getSocialStartDate());
preVo.setSocialStartDate(preVo.getSocialStartDate());
}
//如果自动触发派增为是,计算派单发起时间和派单确认时间,因为前端可以修改,所以只有没有值的时候才后端结算
if (Common.isNotNull(preVo.getIsAutoDis()) && CommonConstants.ZERO_STRING.equals(preVo.getIsAutoDis())
&& Common.isNotNull(preVo.getExpectedCollectionType())
&& null == preVo.getExpectedCollectionTime()
&& null == preVo.getExpectedConfirmTime()) {
//获取当前月是否可办理状态:获取办理截止日往前最近的工昨日,当前日及截止日前(含截止日)有工作日就是可办理
initExpectedCollectionTime(preVo.getSocialHouseholdName(), preVo.getSocialStartDate(), preVo);
} }
} }
......
...@@ -255,7 +255,7 @@ public class TEmployeeInsurancePreController { ...@@ -255,7 +255,7 @@ public class TEmployeeInsurancePreController {
* @date 2025-04-11 10:46:12 * @date 2025-04-11 10:46:12
* @return void * @return void
*/ */
@SysLog("每天下午三点二十推送待派单数据") @SysLog("每天下午三点二十或上午11点推送待派单数据")
@Inner @Inner
@PostMapping("/inner/pushDisConfrimInsurances") @PostMapping("/inner/pushDisConfrimInsurances")
public void pushDisConfrimInsurances() { public void pushDisConfrimInsurances() {
......
...@@ -649,7 +649,8 @@ public class TDispatchInfoPre extends BaseEntity { ...@@ -649,7 +649,8 @@ public class TDispatchInfoPre extends BaseEntity {
private String fundPerFlag; private String fundPerFlag;
/** /**
* 起缴日期:0 入职日期 * 起缴日期类型:0 入职日期 1 入职满1个月 2 入职满2个月 3 入职满3个月 4 入职满4个月 5 入职满5个月 6 入职满6个月 7 入职满7个月 8 入职满8个月 9 入职满9个月 10 入职满10个月 11 入职满11个月 12 入职满12个月
* 原:0 入职日期 1 入职满1年次月 2 人员自定义
*/ */
@Length(max = 2, message = "起缴日期:0 入职日期 不能超过2 个字符") @Length(max = 2, message = "起缴日期:0 入职日期 不能超过2 个字符")
@ExcelAttribute(name = "起缴日期:0 入职日期", maxLength = 2) @ExcelAttribute(name = "起缴日期:0 入职日期", maxLength = 2)
...@@ -666,4 +667,14 @@ public class TDispatchInfoPre extends BaseEntity { ...@@ -666,4 +667,14 @@ public class TDispatchInfoPre extends BaseEntity {
@Schema(description = "公积金户ID") @Schema(description = "公积金户ID")
private String configHouseId; private String configHouseId;
/**
* 起缴日期类型:0 入职日期 1 入职满1个月 2 入职满2个月 3 入职满3个月 4 入职满4个月 5 入职满5个月 6 入职满6个月 7 入职满7个月 8 入职满8个月 9 入职满9个月 10 入职满10个月 11 入职满11个月 12 入职满12个月
* 原:0 入职日期
*/
@ExcelAttribute(name = "起缴日期类型", maxLength = 2)
@Length(max = 2, message = "起缴日期类型不能超过2个字符")
@ExcelProperty("起缴日期类型")
@Schema(description = "起缴日期类型:0 入职日期 1 入职满个月 2 入职满2个月 3 入职满3个月 4 入职满4个月 5 入职满5个月 6 入职满6个月 7 入职满7个月 8 入职满8个月 9 入职满9个月 10 入职满10个月 11 入职满11个月 12 入职满12个月")
private String socialDateType;
} }
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* 户截止日配置表
*
* @author fxj
* @date 2025-12-11 14:19:54
*/
@Data
@TableName("t_house_hold_limit")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "户截止日配置表")
public class THouseHoldLimit extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("主键")
@Schema(description = "主键")
private String id;
/**
* 户名
*/
@ExcelAttribute(name = "户名", maxLength = 50)
@Length(max = 50, message = "户名不能超过50个字符")
@ExcelProperty("户名")
@Schema(description = "户名")
private String name;
/**
* 户类型:0社保 1公积金
*/
@ExcelAttribute(name = "户类型:0社保 1公积金", isNotEmpty = true, errorInfo = "户类型:0社保 1公积金不能为空", maxLength = 255)
@NotBlank(message = "户类型:0社保 1公积金不能为空")
@Length(max = 255, message = "户类型:0社保 1公积金不能超过255个字符")
@ExcelProperty("户类型:0社保 1公积金")
@Schema(description = "户类型:0社保 1公积金")
private String type;
/**
* 缴纳地-省
*/
@ExcelAttribute(name = "缴纳地-省", maxLength = 10)
@Length(max = 10, message = "缴纳地-省不能超过10个字符")
@ExcelProperty("缴纳地-省")
@Schema(description = "缴纳地-省")
private String province;
/**
* 缴纳地-市
*/
@ExcelAttribute(name = "缴纳地-市", maxLength = 10)
@Length(max = 10, message = "缴纳地-市不能超过10个字符")
@ExcelProperty("缴纳地-市")
@Schema(description = "缴纳地-市")
private String city;
/**
* 缴纳地-县
*/
@ExcelAttribute(name = "缴纳地-县", maxLength = 10)
@Length(max = 10, message = "缴纳地-县不能超过10个字符")
@ExcelProperty("缴纳地-县")
@Schema(description = "缴纳地-县")
private String town;
/**
* 户ID
*/
@ExcelAttribute(name = "户ID", maxLength = 32)
@Length(max = 32, message = "户ID不能超过32个字符")
@ExcelProperty("户ID")
@Schema(description = "户ID")
private String houseHoldId;
/**
* 派增截止(日)
*/
@ExcelAttribute(name = "派增截止(日)", isNotEmpty = true, errorInfo = "派增截止(日)不能为空", maxLength = 2)
@NotBlank(message = "派增截止(日)不能为空")
@Length(max = 2, message = "派增截止(日)不能超过2个字符")
@ExcelProperty("派增截止(日)")
@Schema(description = "派增截止(日)")
private String deadLineDay;
/**
* 派增办理规则:0当月办当月生效 1 当月办次月生效
*/
@ExcelAttribute(name = "派增办理规则:0当月办当月生效 1 当月办次月生效", isNotEmpty = true, errorInfo = "派增办理规则:0当月办当月生效 1 当月办次月生效不能为空", maxLength = 2)
@NotBlank(message = "派增办理规则:0当月办当月生效 1 当月办次月生效不能为空")
@Length(max = 2, message = "派增办理规则:0当月办当月生效 1 当月办次月生效不能超过2个字符")
@ExcelProperty("派增办理规则:0当月办当月生效 1 当月办次月生效")
@Schema(description = "派增办理规则:0当月办当月生效 1 当月办次月生效")
private String addHandleRule;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 户截止日配置表
*
* @author fxj
* @date 2025-12-11 14:19:54
*/
@Data
@Schema(description = "户截止日配置表")
public class THouseHoldLimitExportVo implements Serializable {
/**
* 户名
*/
@ExcelAttribute(name = "户名")
@HeadFontStyle(fontHeightInPoints = 11)
@ColumnWidth(10)
@ExcelProperty("户名")
@Schema(description = "户名")
private String name;
/**
* 户类型:0社保 1公积金
*/
@ExcelAttribute(name = "户类型", isDataId = true,readConverterExp = "0=社保,1=公积金")
@HeadFontStyle(fontHeightInPoints = 11)
@ColumnWidth(10)
@ExcelProperty("户类型")
@Schema(description = "户类型")
private String type;
/**
* 缴纳地
*/
@ExcelAttribute(name = "缴纳地")
@HeadFontStyle(fontHeightInPoints = 11)
@ColumnWidth(10)
@ExcelProperty("缴纳地")
@Schema(description = "缴纳地")
private String province;
/**
* 派增截止(日)
*/
@ExcelAttribute(name = "派增截止(日)")
@HeadFontStyle(fontHeightInPoints = 11)
@ColumnWidth(15)
@ExcelProperty("派增截止(日)")
@Schema(description = "派增截止(日)")
private String deadLineDay;
/**
* 派增办理规则:0当月办当月生效 1 当月办次月生效
*/
@ExcelAttribute(name = "派增办理规则", isDataId = true,readConverterExp = "0=当月办当月生效,1=当月办次月生效")
@ExcelProperty("派增办理规则")
@HeadFontStyle(fontHeightInPoints = 11)
@ColumnWidth(15)
@Schema(description = "派增办理规则")
private String addHandleRule;
/**
* 创建者-姓名
*/
@Schema(description = "配置人")
@HeadFontStyle(fontHeightInPoints = 11)
@ColumnWidth(10)
@ExcelProperty("配置人")
private String createName;
/**
* 更新时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@HeadFontStyle(fontHeightInPoints = 11)
@ColumnWidth(20)
@ExcelProperty("最后一次更新时间")
@Schema(description = "最后一次更新时间")
private LocalDateTime updateTime;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 户截止日配置表
*
* @author fxj
* @date 2025-12-11 14:19:54
*/
@Data
public class THouseHoldLimitInnerVo extends RowIndex implements Serializable {
/**
* 户名
*/
private String name;
/**
* 户类型:0社保 1公积金
*/
private String type;
/**
* 派增截止(日)
*/
private String deadLineDay;
/**
* 派增办理规则:0当月办当月生效 1 当月办次月生效
*/
private String addHandleRule;
/**
* date
*/
private Date wordDate;
/**
* 是否可办理 true:可办理 false:不可办理
*/
private Boolean canBeHandle;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.yifu.cloud.plus.v1.yifu.social.entity.THouseHoldLimit;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 户截止日配置表
*
* @author fxj
* @date 2025-12-11 14:19:54
*/
@Data
public class THouseHoldLimitSearchVo extends THouseHoldLimit {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,多个逗号分割")
private String ids;
/**
* 更新时间区间 [开始时间,结束时间]
*/
@Schema(description = "更新时间起")
private LocalDateTime updateTimeStart;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema(description = "更新时间止")
private LocalDateTime updateTimeEnd;
/**
* @Author fxj
* 查询数据起
**/
@Schema(description = "查询limit 开始")
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
@Schema(description = "查询limit 数据条数")
private int limitEnd;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 户截止日配置表
*
* @author fxj
* @date 2025-12-11 14:19:54
*/
@Data
public class THouseHoldLimitVo extends RowIndex implements Serializable {
/**
* 户名
*/
@ExcelAttribute(name = "户名",isNotEmpty = true, maxLength = 50)
@Schema(description = "户名")
@ExcelProperty("户名")
private String name;
/**
* 户类型:0社保 1公积金
*/
@ExcelAttribute(name = "户类型", isNotEmpty = true, errorInfo = "户类型不能为空", isDataId = true,readConverterExp = "0=社保,1=公积金")
@Schema(description = "户类型:0社保 1公积金")
@ExcelProperty("户类型")
private String type;
/**
* 派增截止(日)
*/
@ExcelAttribute(name = "派增截止(日)",isInteger = true, isNotEmpty = true, errorInfo = "派增截止(日)不能为空", maxLength = 2)
@Schema(description = "派增截止(日)")
@ExcelProperty("派增截止(日)")
private String deadLineDay;
/**
* 派增办理规则:0当月办当月生效 1 当月办次月生效
*/
@ExcelAttribute(name = "派增办理规则", isNotEmpty = true, errorInfo = "派增办理规则不能为空", isDataId = true,readConverterExp = "0=当月办当月生效,1=当月办次月生效")
@Schema(description = "派增办理规则:0当月办当月生效 1 当月办次月生效")
@ExcelProperty("派增办理规则")
private String addHandleRule;
}
...@@ -371,12 +371,12 @@ public class TDispatchInfoPreController { ...@@ -371,12 +371,12 @@ public class TDispatchInfoPreController {
} }
/** /**
* 每天下午三点二十推送待购买数据 公积金可以通用 * 每天下午三点二十或三点或上午11点推送待购买数据 公积金可以通用
* @author huych * @author huych
* @date 2025-10-11 18:51:58 * @date 2025-10-11 18:51:58
* @return void * @return void
*/ */
@SysLog("每天下午三点二十推送待购买数据") @SysLog("每天下午三点二十或三点或上午11点推送待购买数据")
@Inner @Inner
@PostMapping("/inner/pushDisConfrimSocial") @PostMapping("/inner/pushDisConfrimSocial")
public void pushDisConfrimSocial() { public void pushDisConfrimSocial() {
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseSearchVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.entity.THouseHoldLimit;
import com.yifu.cloud.plus.v1.yifu.social.service.THouseHoldLimitService;
import com.yifu.cloud.plus.v1.yifu.social.vo.TEmployeeInsuranceWorkDayVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.THouseHoldLimitExportVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.THouseHoldLimitInnerVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.THouseHoldLimitSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 户截止日配置表
*
* @author fxj
* @date 2025-12-11 14:19:54
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/thouseholdlimit")
@Tag(name = "户截止日配置表管理")
public class THouseHoldLimitController {
private final THouseHoldLimitService tHouseHoldLimitService;
private final static String ADD_UPDATE_REPEAT_ERROR = "对应户名及户类型的配置已存在!";
/**
* 简单分页查询
*
* @param page 分页对象
* @param tHouseHoldLimit 户截止日配置表
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<THouseHoldLimit>> getTHouseHoldLimitPage(Page<THouseHoldLimit> page, THouseHoldLimitSearchVo tHouseHoldLimit) {
return new R<>(tHouseHoldLimitService.getTHouseHoldLimitPage(page, tHouseHoldLimit));
}
/**
* 通过id查询户截止日配置表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('social_thouseholdlimit_get')")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('social_thouseholdlimit_get')")
public R<THouseHoldLimit> getById(@PathVariable("id") String id) {
return R.ok(tHouseHoldLimitService.getById(id));
}
/**
* 通过户名称及类型查询到具体截止日期后去看是否为工作日,如果不是工作日则往前推,知道找到工作日,然后返回工作日
* 如果找不到对应截止日期,则返回null
* @param paramVo:户名称 type: 0 社保、1 公积金
* @return R
*/
@Operation(summary = "户名称及类型查询可用的截止日期", description = "通过户名称及类型查询到具体截止日期后去查询是否为工作日,如果不是工作日则往前推,直到找到工作日,然后返回工作日")
@PostMapping("/getWorkDayByDeadLineDay")
public R<THouseHoldLimitInnerVo> getWorkDayByDeadLineDay(@RequestBody BaseSearchVO paramVo) {
return R.ok(tHouseHoldLimitService.getWorkDayByDeadLineDay(paramVo));
}
/**
* 通过户名称及类型查询到具体截止日期后判断是否为工作日,如果不是工作往前推,直到找到工作日,
* 然后和当前日期进行比较,如果当前日期大于截止日期则返回false,否则返回true
* @param paramVo:name 户名称 type: 0 社保、1 公积金
* @return R
*/
@Inner
@Operation(summary = "户名称及类型查询可用的截止日期", description = "通过户名称及类型查询到具体截止日期后去查询是否为工作日,如果不是工作日则往前推,直到找到工作日,然后返回工作日")
@PostMapping("/inner/getWorkDayByDeadLineDay")
public THouseHoldLimitInnerVo getWorkDayByDeadLineDayInner(@RequestBody BaseSearchVO paramVo) {
return tHouseHoldLimitService.getWorkDayByDeadLineDay(paramVo);
}
/**
* 新增户截止日配置表
*
* @param tHouseHoldLimit 户截止日配置表
* @return R
*/
@Operation(summary = "新增户截止日配置表", description = "新增户截止日配置表:hasPermission('social_thouseholdlimit_add')")
@SysLog("新增户截止日配置表")
@PostMapping
@PreAuthorize("@pms.hasPermission('social_thouseholdlimit_add')")
public R<Boolean> save(@RequestBody THouseHoldLimit tHouseHoldLimit) {
//先查验是否已存在对应户名称和户类型的数据
THouseHoldLimit houseHoldLimit = tHouseHoldLimitService
.getOne(Wrappers.<THouseHoldLimit>query().lambda()
.eq(THouseHoldLimit::getName, tHouseHoldLimit.getName())
.eq(THouseHoldLimit::getType, tHouseHoldLimit.getType())
.last(CommonConstants.LAST_ONE_SQL));
if (null != houseHoldLimit){
return R.failed(ADD_UPDATE_REPEAT_ERROR);
}
return R.ok(tHouseHoldLimitService.save(tHouseHoldLimit));
}
/**
* 修改户截止日配置表
*
* @param tHouseHoldLimit 户截止日配置表
* @return R
*/
@Operation(summary = "修改户截止日配置表", description = "修改户截止日配置表:hasPermission('social_thouseholdlimit_edit')")
@SysLog("修改户截止日配置表")
@PutMapping
@PreAuthorize("@pms.hasPermission('social_thouseholdlimit_edit')")
public R<Boolean> updateById(@RequestBody THouseHoldLimit tHouseHoldLimit) {
if (tHouseHoldLimit.getId() == null){
return R.failed(CommonConstants.PARAM_INFO_ERROR);
}
//先查验是否已存在对应户名称和户类型的数据
THouseHoldLimit houseHoldLimit = tHouseHoldLimitService
.getOne(Wrappers.<THouseHoldLimit>query().lambda()
.eq(THouseHoldLimit::getName, tHouseHoldLimit.getName())
.eq(THouseHoldLimit::getType, tHouseHoldLimit.getType())
.ne(THouseHoldLimit::getId, tHouseHoldLimit.getId())
.last(CommonConstants.LAST_ONE_SQL));
if (null != houseHoldLimit){
return R.failed(ADD_UPDATE_REPEAT_ERROR);
}
return R.ok(tHouseHoldLimitService.updateById(tHouseHoldLimit));
}
/**
* 通过id删除户截止日配置表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id删除户截止日配置表", description = "通过id删除户截止日配置表:hasPermission('social_thouseholdlimit_del')")
@SysLog("通过id删除户截止日配置表")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('social_thouseholdlimit_del')")
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(tHouseHoldLimitService.removeById(id));
}
/**
* 户截止日配置表 批量导入
*
* @author fxj
* @date 2025-12-11 14:19:54
**/
@SneakyThrows
@Operation(description = "批量新增户截止日配置表 hasPermission('social_thouseholdlimit-batch-import')")
@SysLog("批量新增户截止日配置表")
@PostMapping("/importListAdd")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
return tHouseHoldLimitService.importDiy(file.getInputStream(),user);
}
/**
* 户截止日配置表 批量导出
*
* @author fxj
* @date 2025-12-11 14:19:54
**/
@Operation(description = "导出户截止日配置表 hasPermission('social_thouseholdlimit-export')")
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody THouseHoldLimitSearchVo searchVo) {
tHouseHoldLimitService.listExport(response, searchVo);
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.social.entity.THouseHoldLimit;
import com.yifu.cloud.plus.v1.yifu.social.vo.THouseHoldLimitExportVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.THouseHoldLimitSearchVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 户截止日配置表
*
* @author fxj
* @date 2025-12-11 14:19:54
*/
@Mapper
public interface THouseHoldLimitMapper extends BaseMapper<THouseHoldLimit> {
/**
* 户截止日配置表简单分页查询
*
* @param tHouseHoldLimit 户截止日配置表
* @return
*/
IPage<THouseHoldLimit> getTHouseHoldLimitPage(Page<THouseHoldLimit> page, @Param("tHouseHoldLimit") THouseHoldLimit tHouseHoldLimit);
List<THouseHoldLimitExportVo> exportDiy(@Param("tHouseHoldLimit")THouseHoldLimitSearchVo searchVo);
int exportCountDiy(@Param("tHouseHoldLimit")THouseHoldLimitSearchVo searchVo);
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseSearchVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.social.entity.THouseHoldLimit;
import com.yifu.cloud.plus.v1.yifu.social.vo.TEmployeeInsuranceWorkDayVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.THouseHoldLimitExportVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.THouseHoldLimitInnerVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.THouseHoldLimitSearchVo;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List;
/**
* 户截止日配置表
*
* @author fxj
* @date 2025-12-11 14:19:54
*/
public interface THouseHoldLimitService extends IService<THouseHoldLimit> {
/**
* 户截止日配置表简单分页查询
*
* @param tHouseHoldLimit 户截止日配置表
* @return
*/
IPage<THouseHoldLimit> getTHouseHoldLimitPage(Page<THouseHoldLimit> page, THouseHoldLimitSearchVo tHouseHoldLimit);
R<List<ErrorMessage>> importDiy(InputStream inputStream, YifuUser user);
void listExport(HttpServletResponse response, THouseHoldLimitSearchVo searchVo);
THouseHoldLimitInnerVo getWorkDayByDeadLineDay(BaseSearchVO paramVo);
}
...@@ -16,6 +16,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.ClientNameConstants; ...@@ -16,6 +16,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.ClientNameConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseSearchVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil; import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils; import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils;
...@@ -38,7 +39,9 @@ import org.springframework.web.client.RestTemplate; ...@@ -38,7 +39,9 @@ import org.springframework.web.client.RestTemplate;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.ParseException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -74,6 +77,9 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap ...@@ -74,6 +77,9 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
private final TSocialAutoLogService socialAutoLogService; private final TSocialAutoLogService socialAutoLogService;
@Autowired
private final THouseHoldLimitService houseHoldLimitService;
/** /**
* 社保待购买表简单分页查询 * 社保待购买表简单分页查询
* @param tDispatchInfoPre 社保待购买表 * @param tDispatchInfoPre 社保待购买表
...@@ -215,26 +221,8 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap ...@@ -215,26 +221,8 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
socialPreDetailService.remove(Wrappers.<TSocialPreDetail>lambdaQuery() socialPreDetailService.remove(Wrappers.<TSocialPreDetail>lambdaQuery()
.eq(TSocialPreDetail::getRegisterId, preVo.getRegisterId())); .eq(TSocialPreDetail::getRegisterId, preVo.getRegisterId()));
try { try {
// if (Common.isNotNull(preVo) && Common.isNotNull(preVo.getId())) {
// //更新逻辑 if (Common.isNotNull(preVo)) {
// TDispatchInfoPre pre = new TDispatchInfoPre();
// BeanUtils.copyProperties(preVo, pre);
// //时间格式转化
// if (Common.isNotNull(preVo.getExpectedCollectionTime())) {
// preVo.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
// preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 15:20", DateUtil.DATETIME_PATTERN_MINUTE));
// pre.setExpectedCollectionTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedCollectionTime()));
// }
// if (Common.isNotNull(preVo.getExpectedConfirmTime())) {
// preVo.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
// preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 09:00", DateUtil.DATETIME_PATTERN_MINUTE));
// pre.setExpectedConfirmTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedConfirmTime()));
// }
// baseMapper.updateById(pre);
// }
if (Common.isNotNull(preVo)
// && Common.isEmpty(preVo.getId())
) {
//判断是否存在社保待购买信息 //判断是否存在社保待购买信息
TDispatchInfoPre preExit = baseMapper.selectOne(Wrappers.<TDispatchInfoPre>query().lambda() TDispatchInfoPre preExit = baseMapper.selectOne(Wrappers.<TDispatchInfoPre>query().lambda()
.eq(TDispatchInfoPre::getRegisterId, preVo.getRegisterId()) .eq(TDispatchInfoPre::getRegisterId, preVo.getRegisterId())
...@@ -260,30 +248,9 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap ...@@ -260,30 +248,9 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
} }
//如果自动触发派增为是,计算派单发起时间和派单确认时间 //如果自动触发派增为是,计算派单发起时间和派单确认时间
if (Common.isNotNull(preVo.getIsAutoDis()) && CommonConstants.ZERO_STRING.equals(preVo.getIsAutoDis()) if (Common.isNotNull(preVo.getIsAutoDis()) && CommonConstants.ZERO_STRING.equals(preVo.getIsAutoDis())
&& Common.isNotNull(preVo.getExpectedCollectionType()) && Common.isEmpty(preVo.getExpectedCollectionTime())) { && Common.isNotNull(preVo.getExpectedCollectionType())
TEmployeeContractDateVo vo = new TEmployeeContractDateVo(); && Common.isEmpty(preVo.getExpectedCollectionTime())) {
vo.setMonthAfter(Integer.parseInt(preVo.getExpectedCollectionType())); initExpectedCollectionTime(preVo.getSocialHouseholdName(), preVo.getSocialStartDate(), preVo);
vo.setYearAfter(0);
vo.setRegistDate(preVo.getJoinLeaveDate());
Date date = this.addYearsMonths(vo);
TEmployeeInsuranceWorkDayVo dayVo = new TEmployeeInsuranceWorkDayVo();
dayVo.setType(CommonConstants.TWO_STRING);
dayVo.setRegistDate(date);
dayVo.setRegistType(0);
TEmployeeInsuranceWorkDayVo dataR = tHolidayInfoService.selectBeforeOrAfterWorkDayCommon(dayVo);
if (Common.isNotNull(dataR) && Common.isNotNull(dataR.getPriDisDate())) {
preVo.setExpectedCollectionTime(dataR.getRegistDate());
preVo.setExpectedConfirmTime(dataR.getRegistDate());
} else {
preVo.setExpectedCollectionTime(date);
preVo.setExpectedConfirmTime(date);
}
preVo.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 15:20", DateUtil.DATETIME_PATTERN_MINUTE));
preVo.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 09:00", DateUtil.DATETIME_PATTERN_MINUTE));
pre.setExpectedCollectionTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedCollectionTime()));
pre.setExpectedConfirmTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedConfirmTime()));
} }
if (Common.isNotNull(preExit)) { if (Common.isNotNull(preExit)) {
pre.setId(preExit.getId()); pre.setId(preExit.getId());
...@@ -356,8 +323,10 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap ...@@ -356,8 +323,10 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
} }
//如果自动触发派增为是,计算派单发起时间和派单确认时间 //如果自动触发派增为是,计算派单发起时间和派单确认时间
if (Common.isNotNull(preVo.getIsAutoDis()) && CommonConstants.ZERO_STRING.equals(preVo.getIsAutoDis()) if (Common.isNotNull(preVo.getIsAutoDis()) && CommonConstants.ZERO_STRING.equals(preVo.getIsAutoDis())
&& Common.isNotNull(preVo.getExpectedCollectionType())) { && Common.isNotNull(preVo.getExpectedCollectionType())
TEmployeeContractDateVo vo = new TEmployeeContractDateVo(); && Common.isEmpty(preVo.getExpectedCollectionTime())) {
initExpectedCollectionTime(preVo.getProvidentHouseholdName(), preVo.getFundStartDate(), preVo);
/*TEmployeeContractDateVo vo = new TEmployeeContractDateVo();
//接收方式 0项目配置 1自定义 //接收方式 0项目配置 1自定义
if (CommonConstants.ONE_STRING.equals(preVo.getReceiveType())){ if (CommonConstants.ONE_STRING.equals(preVo.getReceiveType())){
vo.setMonthAfter(CommonConstants.ZERO_INT); vo.setMonthAfter(CommonConstants.ZERO_INT);
...@@ -410,7 +379,7 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap ...@@ -410,7 +379,7 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
preVo.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString( preVo.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 09:00", DateUtil.DATETIME_PATTERN_MINUTE)); preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 09:00", DateUtil.DATETIME_PATTERN_MINUTE));
pre.setExpectedCollectionTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedCollectionTime())); pre.setExpectedCollectionTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedCollectionTime()));
pre.setExpectedConfirmTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedConfirmTime())); pre.setExpectedConfirmTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedConfirmTime()));*/
} }
if (Common.isNotNull(preExit)) { if (Common.isNotNull(preExit)) {
pre.setId(preExit.getId()); pre.setId(preExit.getId());
...@@ -1029,4 +998,105 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap ...@@ -1029,4 +998,105 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
} }
return false; return false;
} }
/**
* @Author fxj
* @Description 初始化预计派单发起时间、预计派单确认时间
* @Date 17:06 2025/12/12
**/
private void initExpectedCollectionTime(String houseName, Date startDate, TDispatchInfoPreVo preVo2) throws ParseException {
//获取当前月是否可办理状态:获取办理截止日往前最近的工昨日,当前日及截止日前(含截止日)有工作日就是可办理
BaseSearchVO paramVo = new BaseSearchVO();
paramVo.setName(houseName);
paramVo.setType(CommonConstants.ZERO_STRING);
THouseHoldLimitInnerVo innerVo = houseHoldLimitService.getWorkDayByDeadLineDay(paramVo);
if (Common.isEmpty(innerVo)){
throw new RuntimeException("获取截止日信息失败");
}
boolean canBeHandle = innerVo.getCanBeHandle();
LocalTime currentTime = LocalTime.now();
LocalTime thresholdTime = LocalTime.of(15, 20);
boolean isBeforeThreshold = currentTime.isBefore(thresholdTime) || currentTime.equals(thresholdTime);
// 时间格式常量
String collectionTimeFormat = " 15:20";
String confirmTimeFormat = " 09:00";
//获取次月1号日期
Date nextMonthFirstDay = DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1);
nextMonthFirstDay = DateUtil.setDayByDate(nextMonthFirstDay, 1);
//获取起缴月份1号
Date startDateFirstDay = DateUtil.addDayByDate(startDate, 0);
startDateFirstDay = DateUtil.setDayByDate(startDateFirstDay, 1);
//获取起缴月-1日期
Date startDatePrevMonth = DateUtil.addMonthByDate(startDateFirstDay, -1);
//获取次日
Date tomorrow = DateUtil.getDateByDayNum(1);
//1.起缴月份为当月及之前的月份
if (!DateUtil.isAfter(startDate, DateUtil.getDateByDayNum(0))){
if (canBeHandle){
//发起时间不看工作日
if (isBeforeThreshold) {
Date today = new Date();
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
today, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
today, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
} else {
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
tomorrow, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
tomorrow, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
}
} else {
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
nextMonthFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
nextMonthFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
}
}
//2.起缴月份为次月
else if (preVo2.getSocialStartDate().getTime() == DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1).getTime()){
//当月办次月生效
if (CommonConstants.ONE_STRING.equals(innerVo.getAddHandleRule())){
if (canBeHandle && isBeforeThreshold){
Date today = new Date();
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
today, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
today, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
} else {
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
nextMonthFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
nextMonthFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
}
//当月办当月生效
} else if (CommonConstants.ZERO_STRING.equals(innerVo.getAddHandleRule())){
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
nextMonthFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
nextMonthFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
}
}
//3.起缴月份为次月之后的月份
else if (preVo2.getSocialStartDate().getTime() > DateUtil.addMonthByDate(DateUtil.getDateByDayNum(0), 1).getTime()){
//当月办次月生效
if (CommonConstants.ONE_STRING.equals(innerVo.getAddHandleRule())){
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
startDatePrevMonth, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
startDatePrevMonth, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
} else if (CommonConstants.ZERO_STRING.equals(innerVo.getAddHandleRule())){
preVo2.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
startDateFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + collectionTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
preVo2.setExpectedConfirmTime(DateUtil.parseDate(DateUtil.dateToString(
startDateFirstDay, DateUtil.ISO_EXPANDED_DATE_FORMAT) + confirmTimeFormat, DateUtil.DATETIME_PATTERN_MINUTE));
}
}
}
} }
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.exception.ExcelAnalysisException;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.BaseSearchVO;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysHouseHoldInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.THouseHoldLimit;
import com.yifu.cloud.plus.v1.yifu.social.mapper.SysHouseHoldInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.THouseHoldLimitMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.THolidayInfoService;
import com.yifu.cloud.plus.v1.yifu.social.service.THouseHoldLimitService;
import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
/**
* 户截止日配置表
*
* @author fxj
* @date 2025-12-11 14:19:54
*/
@Log4j2
@Service
public class THouseHoldLimitServiceImpl extends ServiceImpl<THouseHoldLimitMapper, THouseHoldLimit> implements THouseHoldLimitService {
@Autowired
private SysHouseHoldInfoMapper sysHouseHoldInfoMapper;
@Autowired
private THolidayInfoService holidayInfoService;
/**
* 户截止日配置表简单分页查询
*
* @param tHouseHoldLimit 户截止日配置表
* @return
*/
@Override
public IPage<THouseHoldLimit> getTHouseHoldLimitPage(Page<THouseHoldLimit> page, THouseHoldLimitSearchVo tHouseHoldLimit) {
return baseMapper.getTHouseHoldLimitPage(page, tHouseHoldLimit);
}
/**
* 户截止日配置表批量导出
*
* @param searchVo 户截止日配置表
* @return
*/
@Override
public void listExport(HttpServletResponse response, THouseHoldLimitSearchVo searchVo) {
String fileName = "户截止日配置表批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<THouseHoldLimitExportVo> list = new ArrayList<>();
long count = exportCountDiy(searchVo);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter excelWriter = EasyExcel.write(out, THouseHoldLimitExportVo.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; ) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = exportDiy(searchVo);
if (Common.isNotNull(list)) {
ExcelUtil<THouseHoldLimitExportVo> util = new ExcelUtil<>(THouseHoldLimitExportVo.class);
for (THouseHoldLimitExportVo vo : list) {
util.convertEntity(vo, null, null, null);
}
}
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("户截止日配置表" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
if (Common.isNotNull(list)) {
list.clear();
}
}
} else {
WriteSheet writeSheet = EasyExcel.writerSheet("户截止日配置表" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
list.clear();
}
out.flush();
excelWriter.finish();
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
public List<THouseHoldLimitExportVo> exportDiy(THouseHoldLimitSearchVo searchVo) {
return baseMapper.exportDiy(searchVo);
}
private int exportCountDiy(THouseHoldLimitSearchVo searchVo) {
return baseMapper.exportCountDiy(searchVo);
}
@Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream,YifuUser user) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
//记录所有已存在的户名+户类型,包括EXCEL本身的
Map<String,String> map = new HashMap<>();
ExcelUtil<THouseHoldLimitVo> util1 = new ExcelUtil<>(THouseHoldLimitVo.class);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
EasyExcel.read(inputStream, THouseHoldLimitVo.class, new ReadListener<THouseHoldLimitVo>() {
/**
* 单次缓存的数据量
*/
public static final int BATCH_COUNT = CommonConstants.BATCH_COUNT;
/**
*临时存储
*/
private List<THouseHoldLimitVo> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
/**
* 验证表头
**/
@Override
public void invokeHead(Map<Integer, ReadCellData<?>> headMap, AnalysisContext context) {
// 定义期望的表头
Map<Integer, String> expectedHead = new HashMap<>();
expectedHead.put(0, "户名");
expectedHead.put(1, "户类型");
expectedHead.put(2, "派增截止(日)");
expectedHead.put(3, "派增办理规则");
// 验证表头
for (Map.Entry<Integer, String> entry : expectedHead.entrySet()) {
String actualValue = headMap.get(entry.getKey()).getStringValue();
if (null != headMap && null != headMap.get(entry.getKey())) {
actualValue = headMap.get(entry.getKey()).getStringValue();
}
String expectedValue = entry.getValue();
if (!expectedValue.equals(actualValue)) {
errorMessageList.add(new ErrorMessage(entry.getKey() + 1,
String.format("第%d列表头验证失败,期望:'%s',实际:'%s'",
entry.getKey() + 1, expectedValue, actualValue)));
throw new ExcelAnalysisException(
String.format("第%d列表头验证失败,期望:'%s',实际:'%s'",
entry.getKey() + 1, expectedValue, actualValue)
);
}
}
}
@Override
public void invoke(THouseHoldLimitVo data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)) {
errorMessageList.add(errorMessage);
} else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
}
/**
* 加上存储数据库
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importTHouseHoldLimit(cachedDataList, errorMessageList,map,user);
log.info("存储数据库成功!");
}
}).sheet().doRead();
} catch (Exception e) {
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
if (Common.isNotKong(errorMessageList)){
return R.failed(errorMessageList.get(0).getMessage());
}else{
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
}finally {
if (Common.isNotNull(map)){
map.clear();
}
}
return this.judgeAllMessage1(errorMessageList);
}
/**
* @Author fxj
* @Description 全部成功就返回成功
* @Date 15:22 2025/12/11
* @Param
* @return
**/
private R<List<ErrorMessage>> judgeAllMessage1(List<ErrorMessage> errorMessageList) {
if (!errorMessageList.isEmpty()) {
if(errorMessageList.stream().allMatch(e-> CommonConstants.SAVE_SUCCESS.equals(e.getMessage()))) {
return R.ok();
} else {
return R.failed(errorMessageList);
}
}
return R.ok();
}
private void importTHouseHoldLimit(List<THouseHoldLimitVo> excelVOList,
List<ErrorMessage> errorMessageList,
Map<String,String> map, YifuUser user) {
// 个性化校验逻辑
ErrorMessage errorMsg;
//获取户数据(启用)
Map<String,SysHouseHoldInfo> houseHoldMap = new HashMap<>();
List<SysHouseHoldInfo> houseHoldInfoList = sysHouseHoldInfoMapper
.selectList(Wrappers.<SysHouseHoldInfo>query().lambda()
.eq(SysHouseHoldInfo::getDelFlag,CommonConstants.ZERO_STRING));
if(Common.isNotNull(houseHoldInfoList)) {
for (SysHouseHoldInfo houseHoldInfo : houseHoldInfoList) {
houseHoldMap.put(houseHoldInfo.getName()+houseHoldInfo.getType(),houseHoldInfo);
}
}
THouseHoldLimit holdLimit = null;
SysHouseHoldInfo houseHold = null;
String houseLimitRowIndex = null;
THouseHoldLimit limitInsert = null;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
THouseHoldLimitVo excel = excelVOList.get(i);
houseHold = houseHoldMap.get(excel.getName()+excel.getType());
if(!Common.isNotNull(houseHold)) {
errorMsg = new ErrorMessage(excel.getRowIndex(), "未找到该户名及户类型的数据", excel);
errorMessageList.add(errorMsg);
continue;
}
houseLimitRowIndex = map.get(excel.getName()+excel.getType());
if (Common.isNotNull(houseLimitRowIndex)){
errorMsg = new ErrorMessage(excel.getRowIndex(), "该户名及户类型已存在EXCEL第"+houseLimitRowIndex+"行,请勿重复导入", excel);
errorMessageList.add(errorMsg);
continue;
}
holdLimit = baseMapper.selectOne(Wrappers.<THouseHoldLimit>query().lambda()
.eq(THouseHoldLimit::getType,excel.getType())
.eq(THouseHoldLimit::getName,excel.getName())
.last(CommonConstants.LAST_ONE_SQL));
if (null != holdLimit){
errorMsg = new ErrorMessage(excel.getRowIndex(), "该户名及户类型已存在", excel);
errorMessageList.add(errorMsg);
continue;
}
if (Common.isNotNull(excel.getDeadLineDay())){
if (!Common.isNumber(excel.getDeadLineDay())){
errorMsg = new ErrorMessage(excel.getRowIndex(), "派增截止(日)只能是数字", excel);
errorMessageList.add(errorMsg);
continue;
}
if (Integer.parseInt(excel.getDeadLineDay()) > 31 || Integer.parseInt(excel.getDeadLineDay()) < 1){
errorMsg = new ErrorMessage(excel.getRowIndex(), "派增截止(日)只能是1-31的数字", excel);
errorMessageList.add(errorMsg);
continue;
}
}
if (Common.isNotNull(excel.getAddHandleRule())){
if (!CommonConstants.ZERO_STRING.equals(excel.getAddHandleRule()) && !CommonConstants.ONE_STRING.equals(excel.getAddHandleRule())){
errorMsg = new ErrorMessage(excel.getRowIndex(), "派增办理规则只能是'当月办当月生效'或'当月办次月生效'", excel);
errorMessageList.add(errorMsg);
continue;
}
}
if (Common.isNotNull(excel.getType())){
if (!CommonConstants.ZERO_STRING.equals(excel.getType()) && !CommonConstants.ONE_STRING.equals(excel.getType())){
errorMsg = new ErrorMessage(excel.getRowIndex(), "户类型只能是'社保'或'公积金'", excel);
errorMessageList.add(errorMsg);
continue;
}
}
limitInsert = new THouseHoldLimit();
limitInsert.setHouseHoldId(houseHold.getId());
limitInsert.setType(excel.getType());
limitInsert.setDeadLineDay(excel.getDeadLineDay());
limitInsert.setAddHandleRule(excel.getAddHandleRule());
limitInsert.setName(excel.getName());
limitInsert.setCreateBy(user.getId());
limitInsert.setUpdateBy(user.getId());
limitInsert.setCreateTime(LocalDateTime.now());
limitInsert.setUpdateTime(LocalDateTime.now());
limitInsert.setCreateName(user.getNickname());
limitInsert.setProvince(houseHold.getProvince());
limitInsert.setCity(houseHold.getCity());
limitInsert.setTown(houseHold.getTown());
map.put(excel.getName()+excel.getType(),excel.getRowIndex().toString());
// 插入
if (!insertExcel(limitInsert)){
errorMsg = new ErrorMessage(excel.getRowIndex(), "导入异常", excel);
errorMessageList.add(errorMsg);
continue;
}
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), CommonConstants.SAVE_SUCCESS, excel));
}
}
/**
* 插入excel record
*/
private boolean insertExcel(THouseHoldLimit insert) {
return baseMapper.insert(insert) >= 1;
}
/**
* 通过户名称及类型查询到具体截止日期后去看是否为工作日,如果不是工作日则往前推,知道找到工作日,然后返回工作日
* 如果找不到对应截止日期,则返回null
* @param paramVo:户名称 type: 0 社保、1 公积金
* @return R true 当月能办理 false 当月不能办理
*/
@Override
public THouseHoldLimitInnerVo getWorkDayByDeadLineDay(BaseSearchVO paramVo) {
THouseHoldLimit houseHoldLimit = baseMapper.selectOne(Wrappers.<THouseHoldLimit>query().lambda()
.eq(THouseHoldLimit::getName,paramVo.getName())
.eq(THouseHoldLimit::getType,paramVo.getType())
.last(CommonConstants.LAST_ONE_SQL));
if (null == houseHoldLimit){
return null;
}
THouseHoldLimitInnerVo limitInnerVo = null;
String deadLineDay = houseHoldLimit.getDeadLineDay();
if (Common.isNotNull(deadLineDay)) {
try {
TEmployeeInsuranceWorkDayVo vo = new TEmployeeInsuranceWorkDayVo();
// 设置RegistDate为当前月份对应的截止日期deadLineDay
Date registDate = DateUtil.setDayByDate(new Date(), Integer.parseInt(deadLineDay));
if (null == registDate) {
return null;
}
vo.setRegistDate(registDate);
vo.setType(CommonConstants.ONE_STRING);
holidayInfoService.selectBeforeOrAfterWorkDay(vo);
limitInnerVo = new THouseHoldLimitInnerVo();
limitInnerVo.setCanBeHandle(false);
limitInnerVo.setDeadLineDay(deadLineDay);
limitInnerVo.setName(houseHoldLimit.getName());
limitInnerVo.setType(houseHoldLimit.getType());
limitInnerVo.setWordDate(vo.getRegistDate());
limitInnerVo.setAddHandleRule(houseHoldLimit.getAddHandleRule());
// 判断当前日期是否在截止日期之后
// 如果当前时间在截止日之后,则表示不可以办理,返回false,否则返回true
if (vo.getRegistDate() != null) {
LocalTime currentTime = LocalTime.now();
LocalTime thresholdTime = LocalTime.of(15, 20);
int dayOffset = (currentTime.isBefore(thresholdTime) || currentTime.equals(thresholdTime)) ? 0 : 1;
if (!DateUtil.isAfter(DateUtil.getDateByDayNum(dayOffset), vo.getRegistDate())) {
limitInnerVo.setCanBeHandle(true);
}
}
} catch (NumberFormatException e) {
// 截止日期不是有效数字,返回null表示无法确定
return null;
}
}
return limitInnerVo;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.social.mapper.THouseHoldLimitMapper">
<resultMap id="tHouseHoldLimitMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.THouseHoldLimit">
<id property="id" column="ID"/>
<result property="name" column="NAME"/>
<result property="type" column="TYPE"/>
<result property="province" column="PROVINCE"/>
<result property="city" column="CITY"/>
<result property="town" column="TOWN"/>
<result property="houseHoldId" column="HOUSE_HOLD_ID"/>
<result property="deadLineDay" column="DEAD_LINE_DAY"/>
<result property="addHandleRule" column="ADD_HANDLE_RULE"/>
<result property="createBy" column="CREATE_BY"/>
<result property="updateBy" column="UPDATE_BY"/>
<result property="createTime" column="CREATE_TIME"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="createName" column="CREATE_NAME"/>
</resultMap>
<resultMap id="tHouseHoldLimitExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.THouseHoldLimitExportVo">
<result property="name" column="NAME"/>
<result property="type" column="TYPE"/>
<result property="province" column="PROVINCE"/>
<result property="deadLineDay" column="DEAD_LINE_DAY"/>
<result property="addHandleRule" column="ADD_HANDLE_RULE"/>
<result property="updateTime" column="UPDATE_TIME"/>
<result property="createName" column="CREATE_NAME"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.NAME,
a.TYPE,
a.PROVINCE,
a.CITY,
a.TOWN,
a.HOUSE_HOLD_ID,
a.DEAD_LINE_DAY,
a.ADD_HANDLE_RULE,
a.CREATE_BY,
a.UPDATE_BY,
a.CREATE_TIME,
a.UPDATE_TIME,
a.CREATE_NAME
</sql>
<sql id="tHouseHoldLimit_where">
<if test="tHouseHoldLimit != null">
<if test="tHouseHoldLimit.id != null and tHouseHoldLimit.id.trim() != ''">
AND a.ID = #{tHouseHoldLimit.id}
</if>
<if test="tHouseHoldLimit.name != null and tHouseHoldLimit.name.trim() != ''">
AND a.NAME = #{tHouseHoldLimit.name}
</if>
<if test="tHouseHoldLimit.type != null and tHouseHoldLimit.type.trim() != ''">
AND a.TYPE = #{tHouseHoldLimit.type}
</if>
<if test="tHouseHoldLimit.province != null and tHouseHoldLimit.province.trim() != ''">
AND a.PROVINCE = #{tHouseHoldLimit.province}
</if>
<if test="tHouseHoldLimit.city != null and tHouseHoldLimit.city.trim() != ''">
AND a.CITY = #{tHouseHoldLimit.city}
</if>
<if test="tHouseHoldLimit.town != null and tHouseHoldLimit.town.trim() != ''">
AND a.TOWN = #{tHouseHoldLimit.town}
</if>
<if test="tHouseHoldLimit.houseHoldId != null and tHouseHoldLimit.houseHoldId.trim() != ''">
AND a.HOUSE_HOLD_ID = #{tHouseHoldLimit.houseHoldId}
</if>
<if test="tHouseHoldLimit.deadLineDay != null and tHouseHoldLimit.deadLineDay.trim() != ''">
AND a.DEAD_LINE_DAY = #{tHouseHoldLimit.deadLineDay}
</if>
<if test="tHouseHoldLimit.addHandleRule != null and tHouseHoldLimit.addHandleRule.trim() != ''">
AND a.ADD_HANDLE_RULE = #{tHouseHoldLimit.addHandleRule}
</if>
<if test="tHouseHoldLimit.createBy != null and tHouseHoldLimit.createBy.trim() != ''">
AND a.CREATE_BY = #{tHouseHoldLimit.createBy}
</if>
<if test="tHouseHoldLimit.updateBy != null and tHouseHoldLimit.updateBy.trim() != ''">
AND a.UPDATE_BY = #{tHouseHoldLimit.updateBy}
</if>
<if test="tHouseHoldLimit.createTime != null">
AND a.CREATE_TIME = #{tHouseHoldLimit.createTime}
</if>
<if test="tHouseHoldLimit.updateTime != null">
AND a.UPDATE_TIME = #{tHouseHoldLimit.updateTime}
</if>
<if test="tHouseHoldLimit.updateTimeEnd != null">
AND a.UPDATE_TIME <![CDATA[<=]]> #{tHouseHoldLimit.updateTimeEnd}
</if>
<if test="tHouseHoldLimit.updateTimeStart != null">
AND a.UPDATE_TIME <![CDATA[>=]]> #{tHouseHoldLimit.updateTimeStart}
</if>
<if test="tHouseHoldLimit.createName != null and tHouseHoldLimit.createName.trim() != ''">
AND a.CREATE_NAME = #{tHouseHoldLimit.createName}
</if>
</if>
</sql>
<!--tHouseHoldLimit简单分页查询-->
<select id="getTHouseHoldLimitPage" resultMap="tHouseHoldLimitMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_house_hold_limit a
<where>
1=1
<include refid="tHouseHoldLimit_where"/>
</where>
</select>
<select id="exportCountDiy" resultType="int">
SELECT
count(1)
FROM t_house_hold_limit a
<where>
1=1
<include refid="tHouseHoldLimit_where"/>
</where>
</select>
<select id="exportDiy" resultMap="tHouseHoldLimitExportMap">
SELECT
a.NAME,
a.TYPE,
CONCAT_WS('-',p.AREA_NAME,c.AREA_NAME,t.AREA_NAME) as 'PROVINCE',
a.DEAD_LINE_DAY,
a.ADD_HANDLE_RULE,
a.UPDATE_TIME,
a.CREATE_NAME
FROM t_house_hold_limit a
LEFT JOIN sys_area p on p.id=a.PROVINCE
LEFT JOIN sys_area c on c.id=a.CITY
LEFT JOIN sys_area t on t.id=a.TOWN
<where>
1=1
<include refid="tHouseHoldLimit_where"/>
<if test="tHouseHoldLimit != null">
<if test="tHouseHoldLimit.limitStart != null">
limit #{tHouseHoldLimit.limitStart},#{tHouseHoldLimit.limitEnd}
</if>
</if>
</where>
</select>
</mapper>
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