Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
5bd21e21
Commit
5bd21e21
authored
Mar 27, 2026
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
入职确认接收优化-fxj
parent
911a80ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
111 additions
and
20 deletions
+111
-20
EmployeeRegistrationServiceImpl.java
.../v1/csp/service/impl/EmployeeRegistrationServiceImpl.java
+111
-20
No files found.
yifu-csp/yifu-csp-biz/src/main/java/com/yifu/cloud/plus/v1/csp/service/impl/EmployeeRegistrationServiceImpl.java
View file @
5bd21e21
...
...
@@ -1151,48 +1151,139 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
employeeContractPreVo
.
setContractDurationMonth
(
CommonConstants
.
ZERO_STRING
);
}
}
//劳务派遣合同相关校验
if
(
CommonConstants
.
TWENTY_STRING
.
equals
(
employeeContractPreVo
.
getContractType
())
||
"劳务派遣合同"
.
equals
(
employeeContractPreVo
.
getContractType
()))
{
||
"劳务派遣合同"
.
equals
(
employeeContractPreVo
.
getContractType
()))
{
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodYear
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodMonth
())){
//校验劳务派遣的派遣年限必须为两年
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodYear
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodMonth
()))
{
// 校验劳务派遣的派遣年限必须为两年
final
int
REQUIRED_SERVICE_YEARS
=
2
;
int
year
=
0
;
int
dispatchYears
=
0
;
try
{
year
=
Integer
.
parseInt
(
Common
.
isEmpty
(
employeeContractPreVo
.
getDispatchPeriodYear
())
?
"0"
:
employeeContractPreVo
.
getDispatchPeriodYear
().
trim
());
dispatchYears
=
Integer
.
parseInt
(
employeeContractPreVo
.
getDispatchPeriodYear
().
trim
());
}
catch
(
NumberFormatException
e
)
{
return
"劳务派遣的派遣年限格式不正确"
;
}
String
dispatchMonth
=
employeeContractPreVo
.
getDispatchPeriodMonth
();
if
(
"12"
.
equals
(
dispatchMonth
))
{
year
=
year
+
1
;
// 将派遣月份转换为年的小数部分(例如:6 个月=0.5 年)
int
dispatchMonths
=
0
;
try
{
dispatchMonths
=
Integer
.
parseInt
(
employeeContractPreVo
.
getDispatchPeriodMonth
().
trim
());
}
catch
(
NumberFormatException
e
)
{
return
"劳务派遣的派遣月份格式不正确"
;
}
if
(
year
<
REQUIRED_SERVICE_YEARS
)
{
return
"劳务派遣合同的合同年限不能小于2年,请检查"
;
// 计算总派遣年限(年 + 月/12)
double
totalDispatchYears
=
dispatchYears
+
(
dispatchMonths
/
12.0
);
if
(
totalDispatchYears
<
REQUIRED_SERVICE_YEARS
)
{
return
"劳务派遣合同的合同年限不能小于 2 年,请检查"
;
}
}
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodStart
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodEnd
())){
if
(
employeeContractPreVo
.
getDispatchPeriodEnd
().
before
(
employeeContractPreVo
.
getDispatchPeriodStart
())){
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodStart
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodEnd
()))
{
if
(
employeeContractPreVo
.
getDispatchPeriodEnd
().
before
(
employeeContractPreVo
.
getDispatchPeriodStart
()))
{
return
"派遣结束日期需大于等于派遣开始日期"
;
}
}
//合同开始时间、合同截止时间 与派遣的合同开始时间、合同截止时间一致
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getContractStart
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodStart
())
&&
!
employeeContractPreVo
.
getContractStart
().
equals
(
employeeContractPreVo
.
getDispatchPeriodStart
())){
// 合同开始时间、合同截止时间应与派遣的合同开始时间、合同截止时间一致
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getContractStart
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodStart
())
&&
!
employeeContractPreVo
.
getContractStart
().
equals
(
employeeContractPreVo
.
getDispatchPeriodStart
()))
{
return
"合同开始日期与派遣开始日期不一致"
;
}
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getContractEnd
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodEnd
())
&&
!
employeeContractPreVo
.
getContractEnd
().
equals
(
employeeContractPreVo
.
getDispatchPeriodEnd
())){
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getContractEnd
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodEnd
())
&&
!
employeeContractPreVo
.
getContractEnd
().
equals
(
employeeContractPreVo
.
getDispatchPeriodEnd
()))
{
return
"合同截止日期与派遣截止日期不一致"
;
}
}
//同商务合同一直 要 验证时间 截止时间大于等于开始时间、时间交叉
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getContractStart
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getContractEnd
())){
if
(
employeeContractPreVo
.
getContractEnd
().
before
(
employeeContractPreVo
.
getContractStart
())){
// 校验合同有效期:合同截止日期不得早于合同开始日期
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getContractStart
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getContractEnd
()))
{
if
(
employeeContractPreVo
.
getContractEnd
().
before
(
employeeContractPreVo
.
getContractStart
()))
{
return
"合同截止日期需大于等于合同开始日期"
;
}
}
//合同类型为 标准合同或劳务派遣合同时且试用期不为空时,无固定期限 时试用期不能大于6个月,提示“无固定期限时试用期不得超过6个月”
// 固定期限时 合同截止日期类型为合同年限推算或同商务合同一致或指定日期时 按1.“合同年限不满一年的,试用期不得超过1个月"
//2."合同年限1年以上不满3年的,试用期不得超过2个月" 3."合同年限3年以上的,试用期不得超过6个月" 限制
// 合同类型为劳务派遣合同或标准合同时,校验试用期合法性
if
(
"劳务派遣合同"
.
equals
(
employeeContractPreVo
.
getContractType
())
||
"标准合同"
.
equals
(
employeeContractPreVo
.
getContractType
()))
{
// 检查必要字段是否为空 关键字段不为空才校验
if
(!
Common
.
isEmpty
(
employeeContractPreVo
.
getContractTerm
())
&&
!
Common
.
isEmpty
(
employeeContractPreVo
.
getTryPeriodNum
()))
{
// 安全解析试用期月数
int
tryPeriodMonths
;
try
{
tryPeriodMonths
=
Integer
.
parseInt
(
employeeContractPreVo
.
getTryPeriodNum
().
trim
());
}
catch
(
NumberFormatException
e
)
{
return
"试用期月份格式不正确"
;
}
// 无固定期限合同校验(contractTerm = "2")
if
(
CommonConstants
.
TWO_STRING
.
equals
(
employeeContractPreVo
.
getContractTerm
()))
{
if
(
tryPeriodMonths
>
6
)
{
return
"无固定期限时试用期不得超过 6 个月"
;
}
}
// 固定期限合同校验(contractTerm = "1")
else
if
(
CommonConstants
.
ONE_STRING
.
equals
(
employeeContractPreVo
.
getContractTerm
()))
{
// 仅对特定合同截止日期类型进行校验
if
(
CommonConstants
.
ZERO_STRING
.
equals
(
employeeContractPreVo
.
getContractEndType
())
||
CommonConstants
.
ONE_STRING
.
equals
(
employeeContractPreVo
.
getContractEndType
())
||
CommonConstants
.
THREE_STRING
.
equals
(
employeeContractPreVo
.
getContractEndType
()))
{
// 安全解析合同年限
int
contractYears
=
0
;
int
contractMonths
=
0
;
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getContractDurationYear
()))
{
try
{
contractYears
=
Integer
.
parseInt
(
employeeContractPreVo
.
getContractDurationYear
().
trim
());
}
catch
(
NumberFormatException
e
)
{
contractYears
=
0
;
}
}
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getContractDurationMonth
()))
{
try
{
contractMonths
=
Integer
.
parseInt
(
employeeContractPreVo
.
getContractDurationMonth
().
trim
());
}
catch
(
NumberFormatException
e
)
{
contractMonths
=
0
;
}
}
// 计算合同总月数
int
totalContractMonths
=
contractYears
*
12
+
contractMonths
;
// 根据合同期限分段校验试用期(劳动合同法第 19 条规定)
if
(
totalContractMonths
<
12
)
{
// 合同期限不满 1 年,试用期不得超过 1 个月
if
(
tryPeriodMonths
>
1
)
{
return
"固定期限时合同年限不满一年的,试用期不得超过 1 个月"
;
}
}
else
if
(
totalContractMonths
>=
12
&&
totalContractMonths
<
36
)
{
// 合同期限 1 年以上不满 3 年,试用期不得超过 2 个月
if
(
tryPeriodMonths
>
2
)
{
return
"固定期限时合同年限 1 年以上不满 3 年的,试用期不得超过 2 个月"
;
}
}
else
{
// 合同期限 3 年以上,试用期不得超过 6 个月
if
(
tryPeriodMonths
>
6
)
{
return
"固定期限时合同年限 3 年以上的,试用期不得超过 6 个月"
;
}
}
}
}
}
}
return
null
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment