Commit 83e7a581 authored by fangxinjiang's avatar fangxinjiang

提示优化-fxj

parent a621cfbc
...@@ -661,7 +661,7 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon ...@@ -661,7 +661,7 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
try { try {
year = Integer.parseInt(Common.isEmpty(preVo.getDispatchPeriodYear()) ? "0" : preVo.getDispatchPeriodYear().trim()); year = Integer.parseInt(Common.isEmpty(preVo.getDispatchPeriodYear()) ? "0" : preVo.getDispatchPeriodYear().trim());
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
errorMessages.add("劳务派遣的派遣年限格式不正确"); return "劳务派遣的派遣年限格式不正确";
} }
String dispatchMonth = preVo.getDispatchPeriodMonth(); String dispatchMonth = preVo.getDispatchPeriodMonth();
if ("12".equals(dispatchMonth)) { if ("12".equals(dispatchMonth)) {
...@@ -669,7 +669,7 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon ...@@ -669,7 +669,7 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
} }
if (year < REQUIRED_SERVICE_YEARS) { if (year < REQUIRED_SERVICE_YEARS) {
errorMessages.add("劳务派遣合同的合同年限不能小于 2 年,请检查"); 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()));
...@@ -679,8 +679,8 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon ...@@ -679,8 +679,8 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
} }
if (Common.isNotNull(preVo.getDispatchPeriodStart()) if (Common.isNotNull(preVo.getDispatchPeriodStart())
&& Common.isNotNull(preVo.getDispatchPeriodEnd())){ && Common.isNotNull(preVo.getDispatchPeriodEnd())){
if (preVo.getDispatchPeriodEnd().before(preVo.getDispatchPeriodStart())){ if (!preVo.getDispatchPeriodEnd().after(preVo.getDispatchPeriodStart())){
errorMessages.add("派遣结束日期需大于等于派遣开始日期"); return "派遣结束日期需大于派遣开始日期";
} }
} }
//合同开始时间、合同截止时间 与派遣的合同开始时间、合同截止时间一致 //合同开始时间、合同截止时间 与派遣的合同开始时间、合同截止时间一致
...@@ -698,12 +698,45 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon ...@@ -698,12 +698,45 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
if (CommonConstants.ONE_STRING.equals(preVo.getContractTerm())){ if (CommonConstants.ONE_STRING.equals(preVo.getContractTerm())){
if (!preVo.getContractDurationYear().equals(preVo.getDispatchPeriodYear()) if (!preVo.getContractDurationYear().equals(preVo.getDispatchPeriodYear())
|| !preVo.getContractDurationMonth().equals(preVo.getDispatchPeriodMonth())){ || !preVo.getContractDurationMonth().equals(preVo.getDispatchPeriodMonth())){
errorMessages.add("劳务派遣合同年限需要和标准合同年限一致"); errorMessages.add("合同的年限同派遣的期限不一致");
} }
} }
// 如果有错误信息,一起返回 // 如果有错误信息,根据具体错误项动态生成提示
if (!errorMessages.isEmpty()) { if (!errorMessages.isEmpty()) {
return "合同的年限、开始日期、截止日期同派遣的期限、开始日期、截止日期不一致,请调整!"; // 筛选出需要组合提示的错误项
List<String> contractDispatchErrors = new ArrayList<>();
for (String errorMsg : errorMessages) {
if (errorMsg.contains("合同的年限同派遣的期限不一致")
|| errorMsg.contains("合同开始日期与派遣开始日期不一致")
|| errorMsg.contains("合同截止日期与派遣截止日期不一致")) {
contractDispatchErrors.add(errorMsg);
}
}
// 如果存在合同与派遣相关的错误,生成组合提示
if (!contractDispatchErrors.isEmpty()) {
List<String> contractItems = new ArrayList<>();
List<String> dispatchItems = new ArrayList<>();
for (String error : contractDispatchErrors) {
if (error.contains("年限")) {
contractItems.add("年限");
dispatchItems.add("期限");
}
if (error.contains("开始日期")) {
contractItems.add("开始日期");
dispatchItems.add("开始日期");
}
if (error.contains("截止日期")) {
contractItems.add("截止日期");
dispatchItems.add("截止日期");
}
}
String contractStr = String.join("、", contractItems);
String dispatchStr = String.join("、", dispatchItems);
return "派遣的" + dispatchStr + "同合同的" + contractStr + "不一致,请调整!";
}
} }
} }
//同商务合同一直 要 验证时间 截止时间大于等于开始时间、时间交叉 //同商务合同一直 要 验证时间 截止时间大于等于开始时间、时间交叉
......
...@@ -1164,7 +1164,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -1164,7 +1164,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
try { try {
dispatchYears = Integer.parseInt(employeeContractPreVo.getDispatchPeriodYear().trim()); dispatchYears = Integer.parseInt(employeeContractPreVo.getDispatchPeriodYear().trim());
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
allErrorMessages.add("劳务派遣的派遣年限格式不正确"); return "劳务派遣的派遣年限格式不正确";
} }
// 将派遣月份转换为年的小数部分(例如:6 个月=0.5 年) // 将派遣月份转换为年的小数部分(例如:6 个月=0.5 年)
...@@ -1172,20 +1172,20 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -1172,20 +1172,20 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
try { try {
dispatchMonths = Integer.parseInt(employeeContractPreVo.getDispatchPeriodMonth().trim()); dispatchMonths = Integer.parseInt(employeeContractPreVo.getDispatchPeriodMonth().trim());
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
allErrorMessages.add("劳务派遣的派遣月份格式不正确"); 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) {
allErrorMessages.add("劳务派遣合同的合同年限不能小于 2 年,请检查"); return "劳务派遣合同的合同年限不能小于 2 年,请检查";
} }
} }
if (Common.isNotNull(employeeContractPreVo.getDispatchPeriodStart()) if (Common.isNotNull(employeeContractPreVo.getDispatchPeriodStart())
&& Common.isNotNull(employeeContractPreVo.getDispatchPeriodEnd())) { && Common.isNotNull(employeeContractPreVo.getDispatchPeriodEnd())) {
if (employeeContractPreVo.getDispatchPeriodEnd().before(employeeContractPreVo.getDispatchPeriodStart())) { if (employeeContractPreVo.getDispatchPeriodEnd().before(employeeContractPreVo.getDispatchPeriodStart())) {
allErrorMessages.add("派遣结束日期需大于等于派遣开始日期"); return "派遣结束日期需大于等于派遣开始日期";
} }
} }
// 合同开始时间、合同截止时间应与派遣的合同开始时间、合同截止时间一致 // 合同开始时间、合同截止时间应与派遣的合同开始时间、合同截止时间一致
...@@ -1216,13 +1216,13 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -1216,13 +1216,13 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
try { try {
tryPeriodMonths = Integer.parseInt(employeeContractPreVo.getTryPeriodNum().trim()); tryPeriodMonths = Integer.parseInt(employeeContractPreVo.getTryPeriodNum().trim());
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
allErrorMessages.add("试用期月份格式不正确"); return "试用期月份格式不正确";
} }
// 无固定期限合同校验(contractTerm = "2") // 无固定期限合同校验(contractTerm = "2")
if (CommonConstants.TWO_STRING.equals(employeeContractPreVo.getContractTerm())) { if (CommonConstants.TWO_STRING.equals(employeeContractPreVo.getContractTerm())) {
if (tryPeriodMonths > 6) { if (tryPeriodMonths > 6) {
allErrorMessages.add("无固定期限时试用期不得超过 6 个月"); return "无固定期限时试用期不得超过 6 个月";
} }
} }
// 固定期限合同校验(contractTerm = "1") // 固定期限合同校验(contractTerm = "1")
...@@ -1259,17 +1259,17 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -1259,17 +1259,17 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
if (totalContractMonths < 12) { if (totalContractMonths < 12) {
// 合同期限不满 1 年,试用期不得超过 1 个月 // 合同期限不满 1 年,试用期不得超过 1 个月
if (tryPeriodMonths > 1) { if (tryPeriodMonths > 1) {
allErrorMessages.add("固定期限时合同年限不满一年的,试用期不得超过 1 个月"); return "固定期限时合同年限不满一年的,试用期不得超过 1 个月";
} }
} else if (totalContractMonths >= 12 && totalContractMonths < 36) { } else if (totalContractMonths >= 12 && totalContractMonths < 36) {
// 合同期限 1 年以上不满 3 年,试用期不得超过 2 个月 // 合同期限 1 年以上不满 3 年,试用期不得超过 2 个月
if (tryPeriodMonths > 2) { if (tryPeriodMonths > 2) {
allErrorMessages.add("固定期限时合同年限 1 年以上不满 3 年的,试用期不得超过 2 个月"); return "固定期限时合同年限 1 年以上不满 3 年的,试用期不得超过 2 个月";
} }
} else { } else {
// 合同期限 3 年以上,试用期不得超过 6 个月 // 合同期限 3 年以上,试用期不得超过 6 个月
if (tryPeriodMonths > 6) { if (tryPeriodMonths > 6) {
allErrorMessages.add("固定期限时合同年限 3 年以上的,试用期不得超过 6 个月"); return "固定期限时合同年限 3 年以上的,试用期不得超过 6 个月";
} }
} }
} }
...@@ -1282,12 +1282,45 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -1282,12 +1282,45 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
&& CommonConstants.ONE_STRING.equals(employeeContractPreVo.getContractTerm())){ && CommonConstants.ONE_STRING.equals(employeeContractPreVo.getContractTerm())){
if (!employeeContractPreVo.getContractDurationYear().equals(employeeContractPreVo.getDispatchPeriodYear()) if (!employeeContractPreVo.getContractDurationYear().equals(employeeContractPreVo.getDispatchPeriodYear())
|| !employeeContractPreVo.getContractDurationMonth().equals(employeeContractPreVo.getDispatchPeriodMonth())){ || !employeeContractPreVo.getContractDurationMonth().equals(employeeContractPreVo.getDispatchPeriodMonth())){
allErrorMessages.add("劳务派遣合同年限需要和标准合同年限一致"); allErrorMessages.add("合同的年限同派遣的期限不一致");
} }
} }
// 如果有错误信息,一起返回 // 如果有错误信息,根据具体错误项动态生成提示
if (!allErrorMessages.isEmpty()) { if (!allErrorMessages.isEmpty()) {
return "合同的年限、开始日期、截止日期同派遣的期限、开始日期、截止日期不一致,请调整!"; // 筛选出需要组合提示的错误项
List<String> contractDispatchErrors = new ArrayList<>();
for (String errorMsg : allErrorMessages) {
if (errorMsg.contains("合同的年限同派遣的期限不一致")
|| errorMsg.contains("合同开始日期与派遣开始日期不一致")
|| errorMsg.contains("合同截止日期与派遣截止日期不一致")) {
contractDispatchErrors.add(errorMsg);
}
}
// 如果存在合同与派遣相关的错误,生成组合提示
if (!contractDispatchErrors.isEmpty()) {
List<String> contractItems = new ArrayList<>();
List<String> dispatchItems = new ArrayList<>();
for (String error : contractDispatchErrors) {
if (error.contains("年限")) {
contractItems.add("年限");
dispatchItems.add("期限");
}
if (error.contains("开始日期")) {
contractItems.add("开始日期");
dispatchItems.add("开始日期");
}
if (error.contains("截止日期")) {
contractItems.add("截止日期");
dispatchItems.add("截止日期");
}
}
String contractStr = String.join("、", contractItems);
String dispatchStr = String.join("、", dispatchItems);
return "派遣的" + dispatchStr + "同合同的" + contractStr + "不一致,请调整!";
}
} }
// 校验合同有效期:合同截止日期不得早于合同开始日期 // 校验合同有效期:合同截止日期不得早于合同开始日期
if (Common.isNotNull(employeeContractPreVo.getContractStart()) if (Common.isNotNull(employeeContractPreVo.getContractStart())
......
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