Commit 9ab8583c authored by hongguangwu's avatar hongguangwu

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

parents cc939d66 5769ac07
...@@ -76,6 +76,9 @@ public class EmployeeRegistrationPreVo implements Serializable { ...@@ -76,6 +76,9 @@ public class EmployeeRegistrationPreVo implements Serializable {
@Schema(description = "推送时间") @Schema(description = "推送时间")
private String pushDate; private String pushDate;
//0入职日期 1 入职前第3个工作日、2 入职前第5个工作日
@Schema(description = "推送日期类型")
private String pushType;
@Schema(description = "状态,0短信待发送,1信息待填写,2信息待审核,3拒绝入职,4已完成") @Schema(description = "状态,0短信待发送,1信息待填写,2信息待审核,3拒绝入职,4已完成")
private String processStatus; private String processStatus;
......
...@@ -1347,6 +1347,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -1347,6 +1347,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
updatePre = baseMapper.selectOne(Wrappers.<EmployeeRegistrationPre>query() updatePre = baseMapper.selectOne(Wrappers.<EmployeeRegistrationPre>query()
.lambda().eq(EmployeeRegistrationPre::getId, updateVo.getId()) .lambda().eq(EmployeeRegistrationPre::getId, updateVo.getId())
.in(EmployeeRegistrationPre::getProcessStatus, CommonConstants.processStatus) .in(EmployeeRegistrationPre::getProcessStatus, CommonConstants.processStatus)
.eq(EmployeeRegistrationPre::getIsRefuse,CommonConstants.ONE_STRING)
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(updatePre)) { if (Common.isNotNull(updatePre)) {
if (CommonConstants.ZERO_STRING.equals(updatePre.getProcessStatus())) { if (CommonConstants.ZERO_STRING.equals(updatePre.getProcessStatus())) {
...@@ -1398,6 +1399,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -1398,6 +1399,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
.eq(EmployeeRegistrationPre::getEmpIdcard, info.getEmpIdcard()) .eq(EmployeeRegistrationPre::getEmpIdcard, info.getEmpIdcard())
.eq(EmployeeRegistrationPre::getDeptId, updateVo.getDeptId()) .eq(EmployeeRegistrationPre::getDeptId, updateVo.getDeptId())
.eq(EmployeeRegistrationPre::getProcessStatus, CommonConstants.ZERO_STRING) .eq(EmployeeRegistrationPre::getProcessStatus, CommonConstants.ZERO_STRING)
.eq(EmployeeRegistrationPre::getIsRefuse,CommonConstants.ONE_STRING)
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(updatePre)) { if (Common.isNotNull(updatePre)) {
updatePre.setProcessStatus(CommonConstants.ONE_STRING); updatePre.setProcessStatus(CommonConstants.ONE_STRING);
......
...@@ -633,7 +633,7 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon ...@@ -633,7 +633,7 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
} }
} }
if (CommonConstants.TWENTY_STRING.equals(preVo.getContractType())){ if (CommonConstants.TWENTY_STRING.equals(preVo.getContractType())){
//处理劳务协议: 先看上一份合同是否为劳务协议,如果是取值上一份合同的劳务协议结束日期 //处理务派遣合同: 先看上一份合同是否为劳务协议,如果是取值上一份合同的劳务协议结束日期
Date initDate = contract.getContractEnd(); Date initDate = contract.getContractEnd();
if (Common.isNotNull(contract.getPreNewId())){ if (Common.isNotNull(contract.getPreNewId())){
TEmployeeContractPreNew preNew = baseMapper.selectOne(Wrappers.<TEmployeeContractPreNew>query().lambda() TEmployeeContractPreNew preNew = baseMapper.selectOne(Wrappers.<TEmployeeContractPreNew>query().lambda()
...@@ -652,6 +652,22 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon ...@@ -652,6 +652,22 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
} }
preVo.setDispatchPeriodStart(DateUtil.addDayByDate(initDate,1)); preVo.setDispatchPeriodStart(DateUtil.addDayByDate(initDate,1));
if (Common.isNotNull(preVo.getDispatchPeriodYear()) && Common.isNotNull(preVo.getDispatchPeriodMonth())){ if (Common.isNotNull(preVo.getDispatchPeriodYear()) && Common.isNotNull(preVo.getDispatchPeriodMonth())){
//校验劳务派遣的派遣年限必须为两年
final int REQUIRED_SERVICE_YEARS = 2;
int year = 0;
try {
year = Integer.parseInt(Common.isEmpty(preVo.getDispatchPeriodYear()) ? "0" : preVo.getDispatchPeriodYear().trim());
} catch (NumberFormatException e) {
return "劳务派遣的派遣年限格式不正确";
}
String dispatchMonth = preVo.getDispatchPeriodMonth();
if ("12".equals(dispatchMonth)) {
year = year + 1;
}
if (year < REQUIRED_SERVICE_YEARS) {
return "劳务派遣合同的合同年限不能小于2年,请检查";
}
vo = new TEmployeeContractDateVo(); vo = new TEmployeeContractDateVo();
vo.setMonthAfter(Integer.parseInt(Common.isEmpty(preVo.getDispatchPeriodMonth()) ? "0": preVo.getDispatchPeriodMonth())); vo.setMonthAfter(Integer.parseInt(Common.isEmpty(preVo.getDispatchPeriodMonth()) ? "0": preVo.getDispatchPeriodMonth()));
vo.setYearAfter(Integer.parseInt(Common.isEmpty(preVo.getDispatchPeriodYear()) ? "0": preVo.getDispatchPeriodYear())); vo.setYearAfter(Integer.parseInt(Common.isEmpty(preVo.getDispatchPeriodYear()) ? "0": preVo.getDispatchPeriodYear()));
...@@ -663,6 +679,15 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon ...@@ -663,6 +679,15 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
return "派遣结束日期需大于等于派遣开始日期"; return "派遣结束日期需大于等于派遣开始日期";
} }
} }
//合同开始时间、合同截止时间 与派遣的合同开始时间、合同截止时间一致
if (Common.isNotNull(preVo.getContractStart()) && Common.isNotNull(preVo.getDispatchPeriodStart())
&& !preVo.getContractStart().equals(preVo.getDispatchPeriodStart())){
return "合同开始日期与派遣开始日期不一致";
}
if (Common.isNotNull(preVo.getContractEnd()) && Common.isNotNull(preVo.getDispatchPeriodEnd())
&& !preVo.getContractEnd().equals(preVo.getDispatchPeriodEnd())){
return "合同截止日期与派遣截止日期不一致";
}
} }
//同商务合同一直 要 验证时间 截止时间大于等于开始时间、时间交叉 //同商务合同一直 要 验证时间 截止时间大于等于开始时间、时间交叉
if (Common.isNotNull(preVo.getContractStart()) && Common.isNotNull(preVo.getContractEnd())){ if (Common.isNotNull(preVo.getContractStart()) && Common.isNotNull(preVo.getContractEnd())){
......
...@@ -308,7 +308,7 @@ ...@@ -308,7 +308,7 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM t_employee_contract_pre a FROM t_employee_contract_pre a
<where> <where>
1=1 1=1 and a.IS_REFUSE ='1'
<include refid="tEmployeeContractPre_where"/> <include refid="tEmployeeContractPre_where"/>
</where> </where>
order by a.create_time desc order by a.create_time desc
......
...@@ -43,6 +43,7 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.util.*; ...@@ -43,6 +43,7 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.util.*;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TEmployeeInsurancePre; import com.yifu.cloud.plus.v1.yifu.insurances.entity.TEmployeeInsurancePre;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail; import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.util.LocalDateUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil; import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TEmployeeInsurancePreVo; 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;
...@@ -2129,10 +2130,29 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -2129,10 +2130,29 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
preVo.setCreateName(user.getNickname()); preVo.setCreateName(user.getNickname());
preVo.setUpdateBy(user.getId()); preVo.setUpdateBy(user.getId());
preVo.setProcessStatus(status); preVo.setProcessStatus(status);
if (Common.isNotNull(preVo.getPushDate())) { // 预计收集时间为空且配置的推送时间不为空 计算预计收集时间
preVo.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString( if (null == preVo.getExpectedCollectionTime() && Common.isNotNull(preVo.getPushDate())) {
registration.getJoinLeaveDate(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " " + preVo.getPushDate(), DateUtil.DATETIME_PATTERN_MINUTE)); String pushType = preVo.getPushType();
try {
// 推送日期类型:0 入职日期
if (CommonConstants.ZERO_STRING.equals(pushType)) {
preVo.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
registration.getJoinLeaveDate(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " " + preVo.getPushDate(),
DateUtil.DATETIME_PATTERN_MINUTE));
}
// 推送日期类型:1 入职前第 3 个工作日--含入职日期;2 入职前第 5 个工作日--含入职日期
else if ((CommonConstants.ONE_STRING.equals(pushType) || CommonConstants.TWO_STRING.equals(pushType))
&& registration.getJoinLeaveDate() != null) {
int workDaysBefore = CommonConstants.ONE_STRING.equals(pushType) ? 3 : 5;
LocalDate tempDate = parseContractEndDate(registration.getJoinLeaveDate(), preVo.getPushDate());
tempDate = calculateReminderWorkDaysBefore(tempDate, workDaysBefore, 1);
preVo.setExpectedCollectionTime(DateUtil.getDateByLocalDate(tempDate));
}
} catch (Exception e){
throw new RuntimeException("预期收款日期计算失败");
}
} }
//附件赋值 //附件赋值
List<TCspAttaInfo> attaInfoList = tAttaInfoService.list(Wrappers.<TCspAttaInfo>query().lambda().eq(TCspAttaInfo::getDomainId, registration.getId())); List<TCspAttaInfo> attaInfoList = tAttaInfoService.list(Wrappers.<TCspAttaInfo>query().lambda().eq(TCspAttaInfo::getDomainId, registration.getId()));
if (attaInfoList != null && !attaInfoList.isEmpty()) { if (attaInfoList != null && !attaInfoList.isEmpty()) {
...@@ -2639,4 +2659,59 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -2639,4 +2659,59 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
} }
} }
/**
* 解析合同结束日期
*/
private LocalDate parseContractEndDate(Date contractEnd,String pushDate) {
try {
return LocalDateUtil.parseLocalDate(DateUtil.dateToString(contractEnd, DateUtil.ISO_EXPANDED_DATE_FORMAT) + " " + pushDate);
} catch (Exception e) {
return null;
}
}
/**
* @Author fxj
* @Description 往前找指定个工作日 含当前日期 --- 不好提炼为工具类
* @param type 0 往前 1 往后
* @Date 19:24 2026/2/26
* @return
**/
private LocalDate calculateReminderWorkDaysBefore(LocalDate lastDay,int count,int type) {
LocalDate currentDate = lastDay;
int workDayCount = 0;
// 往前找3个工作日
while (workDayCount < count) {
// 检查当前日期是否为工作日
if (isWorkDay(currentDate)) {
workDayCount++;
}
if (workDayCount == count){
return currentDate;
}
// 往前一天
currentDate = currentDate.minusDays(0==type?1:-1);
}
return currentDate;
}
/**
* 判断指定日期是否为工作日
* @param date 要检查的日期
* @return true-工作日,false-非工作日
*/
private boolean isWorkDay(LocalDate date) {
TEmployeeInsuranceWorkDayVo workDayVo = new TEmployeeInsuranceWorkDayVo();
workDayVo.setRegistDate(LocalDateTimeUtils.convertLDToDate(date));
// 使用 THolidayInfoService 的 checkIsWorkDay 方法判断是否为假期
// 如果是假期则不是工作日,否则是工作日
R<Boolean> res = socialDaprUtils.checkIsWorkDay(workDayVo);
// 添加空值检查,避免 NPE,并提高代码可读性
if (res == null || res.getData() == null) {
log.warn("checkIsWorkDay 返回结果为空,默认视为非工作日");
return false;
}
// res.getData() 为 true 表示是假期(非工作日),为 false 表示是工作日
return !res.getData();
}
} }
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM t_employee_insurance_pre a FROM t_employee_insurance_pre a
<where> <where>
1=1 1=1 and a.IS_REFUSE ='1'
<include refid="tEmployeeInsurancePre_where"/> <include refid="tEmployeeInsurancePre_where"/>
</where> </where>
order by a.create_time desc order by a.create_time desc
......
...@@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.util.List; import java.util.List;
...@@ -276,4 +277,20 @@ public class THolidayInfoController { ...@@ -276,4 +277,20 @@ public class THolidayInfoController {
return tHolidayInfoService.getOneMonthDay(); return tHolidayInfoService.getOneMonthDay();
} }
/**
* @Author fxj
* @Description 获取某天之后的指定数量的工作日
* @Date 11:31 2026/3/16
* @Param date 指定天 count 指定天数 type: 0 后一个工作日 1 前一个工作日
* @return
**/
@GetMapping("/calculateReminderWorkDays")
public R calculateReminderWorkDays(@RequestParam(required = true) LocalDate date,
@RequestParam(required = true)int count,
@RequestParam(required = true)int type) {
if (date == null) {
date = LocalDate.now();
}
return R.ok(tHolidayInfoService.calculateReminderWorkDays(date, count, type));
}
} }
...@@ -29,6 +29,7 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.THolidayInfoSearchVo; ...@@ -29,6 +29,7 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.THolidayInfoSearchVo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.InputStream; import java.io.InputStream;
import java.time.LocalDate;
import java.util.List; import java.util.List;
/** /**
...@@ -80,4 +81,5 @@ public interface THolidayInfoService extends IService<THolidayInfo> { ...@@ -80,4 +81,5 @@ public interface THolidayInfoService extends IService<THolidayInfo> {
List<THolidayInfo> noPageDiy(THolidayInfoSearchVo searchVo); List<THolidayInfo> noPageDiy(THolidayInfoSearchVo searchVo);
LocalDate calculateReminderWorkDays(LocalDate lastDay, int count, int type);
} }
...@@ -4415,7 +4415,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -4415,7 +4415,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
} }
// isAutoFlag:是否社保士兵的自动办理,true :是 // isAutoFlag:是否社保士兵的自动办理,true :是
@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class) 在具体for循环中添加过事务注解,这个地方不需要事务注解
@ShardingTransactionType(TransactionType.BASE) @ShardingTransactionType(TransactionType.BASE)
@Override @Override
public R<List<ErrorMessage>> addApplyHandle(List<String> ids, String typeSub, String handleStatus public R<List<ErrorMessage>> addApplyHandle(List<String> ids, String typeSub, String handleStatus
......
...@@ -555,5 +555,49 @@ public class THolidayInfoServiceImpl extends ServiceImpl<THolidayInfoMapper, THo ...@@ -555,5 +555,49 @@ public class THolidayInfoServiceImpl extends ServiceImpl<THolidayInfoMapper, THo
} }
return R.ok("success"); return R.ok("success");
} }
/**
* @Author fxj
* @Description 往前找指定个工作日 含当前日期
* @param type 0 往前 1 往后
* @Date 19:24 2026/2/26
* @return
**/
@Override
public LocalDate calculateReminderWorkDays(LocalDate lastDay, int count, int type) {
LocalDate currentDate = lastDay;
int workDayCount = 0;
// 往前找3个工作日
while (workDayCount < count) {
// 检查当前日期是否为工作日
if (isWorkDay(currentDate)) {
workDayCount++;
}
if (workDayCount == count){
return currentDate;
}
// 往前一天
currentDate = currentDate.minusDays(0==type?1:-1);
}
return currentDate;
}
/**
* 判断指定日期是否为工作日
* @param date 要检查的日期
* @return true-工作日,false-非工作日
*/
private boolean isWorkDay(LocalDate date) {
TEmployeeInsuranceWorkDayVo workDayVo = new TEmployeeInsuranceWorkDayVo();
workDayVo.setRegistDate(LocalDateTimeUtils.convertLDToDate(date));
// 使用 THolidayInfoService 的 checkIsWorkDay 方法判断是否为假期
// 如果是假期则不是工作日,否则是工作日
Boolean res = checkIsWorkDay(workDayVo);
// 添加空值检查,避免 NPE,并提高代码可读性
if (res == null ) {
log.warn("checkIsWorkDay 返回结果为空,默认视为非工作日");
return false;
}
// res.getData() 为 true 表示是假期(非工作日),为 false 表示是工作日
return !res.booleanValue();
}
} }
...@@ -602,7 +602,7 @@ ...@@ -602,7 +602,7 @@
FROM t_dispatch_info_pre a FROM t_dispatch_info_pre a
left join view_contract b on a.EMP_IDCARD = b.EMP_IDCARD and a.DEPT_NO = b.DEPT_NO left join view_contract b on a.EMP_IDCARD = b.EMP_IDCARD and a.DEPT_NO = b.DEPT_NO
<where> <where>
a.DELETE_FLAG = '0' a.DELETE_FLAG = '0' and a.IS_REFUSE ='1'
<include refid="tDispatchInfoPre_other_where"/> <include refid="tDispatchInfoPre_other_where"/>
</where> </where>
GROUP BY a.id GROUP BY a.id
...@@ -617,7 +617,7 @@ ...@@ -617,7 +617,7 @@
,a.FUND_START_DATE ,a.FUND_START_DATE
FROM t_dispatch_info_pre a FROM t_dispatch_info_pre a
<where> <where>
a.DELETE_FLAG = '0' a.DELETE_FLAG = '0' and a.IS_REFUSE ='1'
<include refid="tDispatchInfoPre_other_where"/> <include refid="tDispatchInfoPre_other_where"/>
</where> </where>
order by a.create_time desc order by a.create_time desc
......
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