Commit fcb78861 authored by fangxinjiang's avatar fangxinjiang

试用期相关优化-fxj

parent 51c6f926
...@@ -615,6 +615,12 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon ...@@ -615,6 +615,12 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
} }
} }
} }
//同商务合同一直 要 验证时间 截止时间大于等于开始时间、时间交叉
if (Common.isNotNull(preVo.getContractStart()) && Common.isNotNull(preVo.getContractEnd())){
if (!preVo.getContractEnd().after(preVo.getContractStart())){
return "合同截止日期需大于合同开始日期";
}
}
if (CommonConstants.FIVE_STRING.equals(preVo.getContractType())){ if (CommonConstants.FIVE_STRING.equals(preVo.getContractType())){
//处理实习协议 //处理实习协议
preVo.setInternshipPeriodStart(DateUtil.addDayByDate(contract.getContractEnd(),1)); preVo.setInternshipPeriodStart(DateUtil.addDayByDate(contract.getContractEnd(),1));
...@@ -633,12 +639,7 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon ...@@ -633,12 +639,7 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
} }
} }
} }
//同商务合同一直 要 验证时间 截止时间大于等于开始时间、时间交叉
if (Common.isNotNull(preVo.getContractStart()) && Common.isNotNull(preVo.getContractEnd())){
if (!preVo.getContractEnd().after(preVo.getContractStart())){
return "合同截止日期需大于合同开始日期";
}
}
if (CommonConstants.TWENTY_STRING.equals(preVo.getContractType())){ if (CommonConstants.TWENTY_STRING.equals(preVo.getContractType())){
//处理务派遣合同: 先看上一份合同是否为劳务协议,如果是取值上一份合同的劳务协议结束日期 //处理务派遣合同: 先看上一份合同是否为劳务协议,如果是取值上一份合同的劳务协议结束日期
Date initDate = contract.getContractEnd(); Date initDate = contract.getContractEnd();
...@@ -660,23 +661,29 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon ...@@ -660,23 +661,29 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
preVo.setDispatchPeriodStart(DateUtil.addDayByDate(initDate,1)); preVo.setDispatchPeriodStart(DateUtil.addDayByDate(initDate,1));
List<String> errorMessages = new ArrayList<>(); List<String> errorMessages = new ArrayList<>();
if (Common.isNotNull(preVo.getDispatchPeriodYear()) && Common.isNotNull(preVo.getDispatchPeriodMonth())){ if (Common.isNotNull(preVo.getContractDurationYear())
&& Common.isNotNull(preVo.getContractDurationMonth())
&& CommonConstants.ZERO_STRING.equals(preVo.getSignType())
&& CommonConstants.ONE_STRING.equals(preVo.getContractTerm())){
//校验劳务派遣的派遣年限必须为两年 //校验劳务派遣的派遣年限必须为两年
final int REQUIRED_SERVICE_YEARS = 2; final int REQUIRED_SERVICE_YEARS = 2;
int year = 0; int year = 0;
try { try {
year = Integer.parseInt(Common.isEmpty(preVo.getDispatchPeriodYear()) ? "0" : preVo.getDispatchPeriodYear().trim()); year = Integer.parseInt(Common.isEmpty(preVo.getContractDurationYear()) ? "0" : preVo.getContractDurationYear().trim());
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
return "劳务派遣的派遣年限格式不正确"; return "合同年限格式不正确";
} }
String dispatchMonth = preVo.getDispatchPeriodMonth(); String dispatchMonth = preVo.getContractDurationMonth();
if ("12".equals(dispatchMonth)) { if ("12".equals(dispatchMonth)) {
year = year + 1; year = year + 1;
} }
if (year < REQUIRED_SERVICE_YEARS) { if (year < REQUIRED_SERVICE_YEARS) {
return "劳务派遣合同的合同年限不能小于 2 年,请检查"; //电子签 且 是劳务派遣合同 且 签订期限为固定期限的 合同年前置的合同不能小于 2 年,请检查";
return "合同的合同年限不能小于 2 年,请检查";
} }
}
if (Common.isNotNull(preVo.getDispatchPeriodMonth()) && Common.isNotNull(preVo.getDispatchPeriodYear())) {
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()));
......
...@@ -1151,35 +1151,46 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -1151,35 +1151,46 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
employeeContractPreVo.setContractDurationMonth(CommonConstants.ZERO_STRING); employeeContractPreVo.setContractDurationMonth(CommonConstants.ZERO_STRING);
} }
} }
// 校验合同有效期:合同截止日期不得早于合同开始日期
if (Common.isNotNull(employeeContractPreVo.getContractStart())
&& Common.isNotNull(employeeContractPreVo.getContractEnd())) {
if (!employeeContractPreVo.getContractEnd().after(employeeContractPreVo.getContractStart())) {
return "合同截止日期需大于合同开始日期";
}
}
//劳务派遣合同相关校验 //劳务派遣合同相关校验
List<String> allErrorMessages = new ArrayList<>(); List<String> allErrorMessages = new ArrayList<>();
if (CommonConstants.TWENTY_STRING.equals(employeeContractPreVo.getContractType()) if (CommonConstants.TWENTY_STRING.equals(employeeContractPreVo.getContractType())
|| "劳务派遣合同".equals(employeeContractPreVo.getContractType())) { || "劳务派遣合同".equals(employeeContractPreVo.getContractType())) {
if (Common.isNotNull(employeeContractPreVo.getDispatchPeriodYear()) if (Common.isNotNull(employeeContractPreVo.getContractDurationYear())
&& Common.isNotNull(employeeContractPreVo.getDispatchPeriodMonth())) { && Common.isNotNull(employeeContractPreVo.getContractDurationMonth())
&& CommonConstants.ZERO_STRING.equals(employeeContractPreVo.getSignType())
&& CommonConstants.ONE_STRING.equals(employeeContractPreVo.getContractTerm())) {
// 校验劳务派遣的派遣年限必须为两年 // 校验劳务派遣的派遣年限必须为两年
final int REQUIRED_SERVICE_YEARS = 2; final int REQUIRED_SERVICE_YEARS = 2;
int dispatchYears = 0; int dispatchYears = 0;
try { try {
dispatchYears = Integer.parseInt(employeeContractPreVo.getDispatchPeriodYear().trim()); dispatchYears = Integer.parseInt(employeeContractPreVo.getContractDurationYear().trim());
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
return "劳务派遣的派遣年限格式不正确"; return "合同年限格式不正确";
} }
// 将派遣月份转换为年的小数部分(例如:6 个月=0.5 年) // 将派遣月份转换为年的小数部分(例如:6 个月=0.5 年)
int dispatchMonths = 0; int dispatchMonths = 0;
try { try {
dispatchMonths = Integer.parseInt(employeeContractPreVo.getDispatchPeriodMonth().trim()); dispatchMonths = Integer.parseInt(employeeContractPreVo.getContractDurationMonth().trim());
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
return "劳务派遣的派遣月份格式不正确"; return "合同月份格式不正确";
} }
// 计算总派遣年限(年 + 月/12) // 计算总派遣年限(年 + 月/12)
double totalDispatchYears = dispatchYears + (dispatchMonths / 12.0); double totalDispatchYears = dispatchYears + (dispatchMonths / 12.0);
if (totalDispatchYears < REQUIRED_SERVICE_YEARS) { if (totalDispatchYears < REQUIRED_SERVICE_YEARS) {
return "劳务派遣合同的合同年限不能小于 2 年,请检查"; ////电子签 且 是劳务派遣合同 且 签订期限为固定期限的 合同年前置的合同不能小于 2 年,请检查";
return "合同的合同年限不能小于 2 年,请检查";
} }
} }
if (Common.isNotNull(employeeContractPreVo.getDispatchPeriodStart()) if (Common.isNotNull(employeeContractPreVo.getDispatchPeriodStart())
...@@ -1210,7 +1221,8 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -1210,7 +1221,8 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
// 检查必要字段是否为空 关键字段不为空才校验 // 检查必要字段是否为空 关键字段不为空才校验
if (!Common.isEmpty(employeeContractPreVo.getContractTerm()) if (!Common.isEmpty(employeeContractPreVo.getContractTerm())
&& !Common.isEmpty(employeeContractPreVo.getTryPeriodNum())) { && !Common.isEmpty(employeeContractPreVo.getTryPeriodNum())
&& CommonConstants.ZERO_STRING.equals(employeeContractPreVo.getTryPeriodType())) {
// 安全解析试用期月数 // 安全解析试用期月数
int tryPeriodMonths = 0; int tryPeriodMonths = 0;
try { try {
...@@ -1285,14 +1297,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -1285,14 +1297,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
allErrorMessages.add("合同的年限同派遣的期限不一致"); allErrorMessages.add("合同的年限同派遣的期限不一致");
} }
} }
// 校验合同有效期:合同截止日期不得早于合同开始日期
if (Common.isNotNull(employeeContractPreVo.getContractStart())
&& Common.isNotNull(employeeContractPreVo.getContractEnd())) {
if (!employeeContractPreVo.getContractEnd().after(employeeContractPreVo.getContractStart())) {
return "合同截止日期需大于合同开始日期";
}
}
// 如果有错误信息,根据具体错误项动态生成提示 // 如果有错误信息,根据具体错误项动态生成提示
if (!allErrorMessages.isEmpty()) { if (!allErrorMessages.isEmpty()) {
// 筛选出需要组合提示的错误项 // 筛选出需要组合提示的错误项
......
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