Commit 4f0e0713 authored by hongguangwu's avatar hongguangwu

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

parents 4e220519 e9f1951e
...@@ -361,7 +361,50 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra ...@@ -361,7 +361,50 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra
return stats; return stats;
}); });
customerStats.setInitiatedCount(customerStats.getInitiatedCount() + 1); customerStats.setInitiatedCount(customerStats.getInitiatedCount() + 1);
//电子签必填项校验
// 1、"合同类型"为"标准合或劳务派遣合同","工资形式"为"计时工资、计件工资",对应的"计时工资标准(元/月)、计件工资单价(元)"必填
//2、"合同类型"为"劳务协议","劳务费(元/月)"必填;
//3、"合同类型"为"非全日制","工资形式"只有"计时工资",对应的"计时工资标准(元/月)"设置为 必填;
//4、"合同类型"为"实习协议"的"工资形式"只有"其他"因此无需调整,项目配置处保持"必填"
String validationError = validateElectronicSignRequiredFields(contractPre);
if (validationError != null) {
// 校验失败,统计错误并更新状态
customerStats.setFailedCount(customerStats.getFailedCount() + 1);
customerStats.setElectronicSignFailedCount(customerStats.getElectronicSignFailedCount() + 1);
// 更新processStatus为电子签发起失败
LambdaUpdateWrapper<TEmployeeContractPre> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TEmployeeContractPre::getId, contractPre.getId())
.set(TEmployeeContractPre::getProcessStatus, CommonConstants.FIVE_STRING)
.set(TEmployeeContractPre::getErrorInfo, validationError)
.set(TEmployeeContractPre::getChangeTypeUser, type.equals("1") ? "自动化手动—" + contractPre.getCustomerUsername()
: "自动化自动—" + contractPre.getCustomerUsername())
.set(TEmployeeContractPre::getChangeTypeReason, validationError)
.set(TEmployeeContractPre::getChangeTypeTime, LocalDateTimeUtils.convertLDToDate(LocalDate.now()))
.set(TEmployeeContractPre::getSignType, CommonConstants.ZERO_STRING)
.set(TEmployeeContractPre::getErrorTime, LocalDateTime.now());
this.update(updateWrapper);
if ("2".equals(type)) {
//生成快照数据
TContractAutoLog contractAutoLog = new TContractAutoLog();
contractAutoLog.setContractId(loginNameMap.get(contractPre.getCustomerUserLoginname()));
contractAutoLog.setEmpName(contractPre.getEmployeeName());
contractAutoLog.setEmpIdcard(contractPre.getEmpIdcard());
contractAutoLog.setMainId(contractPre.getId());
contractAutoLog.setErrorInfo(validationError);
contractAutoLogService.save(contractAutoLog);
}
// 添加错误信息
ErrorMessage<EmployeeContractVO> errorMessage = new ErrorMessage<>(contractVO.getRowIndex(), validationError);
errorMessage.setData(contractVO);
errorMessageListAll.add(errorMessage);
// 跳过当前合同,继续处理下一条
continue;
}
LocalDate localDate = contractPre.getJoinLeaveDate().toInstant() LocalDate localDate = contractPre.getJoinLeaveDate().toInstant()
.atZone(ZoneId.systemDefault()) .atZone(ZoneId.systemDefault())
.toLocalDate(); .toLocalDate();
...@@ -1373,4 +1416,61 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra ...@@ -1373,4 +1416,61 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra
return true; return true;
} }
/**
* 电子签必填项校验
*
* @param contractPre 合同待派单数据
* @return 错误信息,如果为空表示校验通过
*/
private String validateElectronicSignRequiredFields(TEmployeeContractPre contractPre) {
String contractType = contractPre.getContractType();
String salaryType = contractPre.getSalaryType();
// 规则1:标准合同(1)或劳务派遣合同(20),工资形式为计时/计件时,对应字段必填
// 兼容中文和数字两种格式
boolean isStandardOrDispatch = ("1".equals(contractType) || "20".equals(contractType)
|| "标准合同".equals(contractType) || "劳务派遣合同".equals(contractType));
if (isStandardOrDispatch) {
if ("1".equals(salaryType)) {
// 计时工资:计时工资标准必填
if (Common.isEmpty(contractPre.getSalaryStandardPerHour())) {
return "标准合同/劳务派遣合同的计时工资形式,计时工资标准不能为空,请至“入职确认信息”点击修改补充完整";
}
} else if ("2".equals(salaryType)) {
// 计件工资:计件工资单价必填
if (Common.isEmpty(contractPre.getSalaryStandardPerPiece())) {
return "标准合同/劳务派遣合同的计件工资形式,计件工资单价不能为空,请至“入职确认信息”点击修改补充完整";
}
}
}
// 规则2:劳务协议(3),劳务费必填
if ("3".equals(contractType) || "劳务协议".equals(contractType)) {
if (Common.isEmpty(contractPre.getLaborCost())) {
return "劳务协议的劳务费不能为空,请至“入职确认信息”点击修改补充完整";
}
}
// 规则3:非全日制(8),工资形式必须为计时工资(1),且计时工资标准必填
if ("8".equals(contractType) || "非全日制".equals(contractType)) {
if (!"1".equals(salaryType)) {
return "非全日制合同的工资形式必须为计时工资,请至“入职确认信息”点击修改补充完整";
}
if (Common.isEmpty(contractPre.getSalaryStandardPerHour())) {
return "非全日制合同的计时工资标准不能为空,请至“入职确认信息”点击修改补充完整";
}
}
// 规则4:实习协议(5),工资形式只能为其他(3),项目配置处已保持"必填",无需额外校验
// 如果需要严格校验,可以添加:
// if ("5".equals(contractType) || "实习协议".equals(contractType)) {
// if (!"3".equals(salaryType)) {
// return "实习协议的工资形式必须为其他";
// }
// }
return null; // 校验通过
}
} }
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