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
80949aa3
Commit
80949aa3
authored
Apr 03, 2026
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
错误信息返回优化-fxj
parent
c05990ae
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
29 deletions
+43
-29
TEmployeeContractPreNewServiceImpl.java
...ives/service/impl/TEmployeeContractPreNewServiceImpl.java
+19
-9
EmployeeRegistrationServiceImpl.java
.../v1/csp/service/impl/EmployeeRegistrationServiceImpl.java
+24
-20
No files found.
yifu-archives/yifu-archives-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/archives/service/impl/TEmployeeContractPreNewServiceImpl.java
View file @
80949aa3
...
@@ -652,6 +652,8 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
...
@@ -652,6 +652,8 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
}
}
}
}
preVo
.
setDispatchPeriodStart
(
DateUtil
.
addDayByDate
(
initDate
,
1
));
preVo
.
setDispatchPeriodStart
(
DateUtil
.
addDayByDate
(
initDate
,
1
));
List
<
String
>
errorMessages
=
new
ArrayList
<>();
if
(
Common
.
isNotNull
(
preVo
.
getDispatchPeriodYear
())
&&
Common
.
isNotNull
(
preVo
.
getDispatchPeriodMonth
())){
if
(
Common
.
isNotNull
(
preVo
.
getDispatchPeriodYear
())
&&
Common
.
isNotNull
(
preVo
.
getDispatchPeriodMonth
())){
//校验劳务派遣的派遣年限必须为两年
//校验劳务派遣的派遣年限必须为两年
final
int
REQUIRED_SERVICE_YEARS
=
2
;
final
int
REQUIRED_SERVICE_YEARS
=
2
;
...
@@ -659,7 +661,7 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
...
@@ -659,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
)
{
return
"劳务派遣的派遣年限格式不正确"
;
errorMessages
.
add
(
"劳务派遣的派遣年限格式不正确"
)
;
}
}
String
dispatchMonth
=
preVo
.
getDispatchPeriodMonth
();
String
dispatchMonth
=
preVo
.
getDispatchPeriodMonth
();
if
(
"12"
.
equals
(
dispatchMonth
))
{
if
(
"12"
.
equals
(
dispatchMonth
))
{
...
@@ -667,7 +669,7 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
...
@@ -667,7 +669,7 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
}
}
if
(
year
<
REQUIRED_SERVICE_YEARS
)
{
if
(
year
<
REQUIRED_SERVICE_YEARS
)
{
return
"劳务派遣合同的合同年限不能小于2年,请检查"
;
errorMessages
.
add
(
"劳务派遣合同的合同年限不能小于 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
()));
...
@@ -675,19 +677,27 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
...
@@ -675,19 +677,27 @@ public class TEmployeeContractPreNewServiceImpl extends ServiceImpl<TEmployeeCon
vo
.
setRegistDate
(
preVo
.
getDispatchPeriodStart
());
vo
.
setRegistDate
(
preVo
.
getDispatchPeriodStart
());
preVo
.
setDispatchPeriodEnd
(
this
.
addYearsMonths
(
vo
));
preVo
.
setDispatchPeriodEnd
(
this
.
addYearsMonths
(
vo
));
}
}
if
(
Common
.
isNotNull
(
preVo
.
getDispatchPeriodStart
())
&&
Common
.
isNotNull
(
preVo
.
getDispatchPeriodEnd
())){
if
(
Common
.
isNotNull
(
preVo
.
getDispatchPeriodStart
())
&&
Common
.
isNotNull
(
preVo
.
getDispatchPeriodEnd
())){
if
(
preVo
.
getDispatchPeriodEnd
().
before
(
preVo
.
getDispatchPeriodStart
())){
if
(
preVo
.
getDispatchPeriodEnd
().
before
(
preVo
.
getDispatchPeriodStart
())){
return
"派遣结束日期需大于等于派遣开始日期"
;
errorMessages
.
add
(
"派遣结束日期需大于等于派遣开始日期"
)
;
}
}
}
}
//合同开始时间、合同截止时间 与派遣的合同开始时间、合同截止时间一致
//合同开始时间、合同截止时间 与派遣的合同开始时间、合同截止时间一致
if
(
Common
.
isNotNull
(
preVo
.
getContractStart
())
&&
Common
.
isNotNull
(
preVo
.
getDispatchPeriodStart
())
if
(
Common
.
isNotNull
(
preVo
.
getContractStart
())
&&
Common
.
isNotNull
(
preVo
.
getDispatchPeriodStart
())
&&
!
preVo
.
getContractStart
().
equals
(
preVo
.
getDispatchPeriodStart
())){
&&
!
preVo
.
getContractStart
().
equals
(
preVo
.
getDispatchPeriodStart
())){
return
"合同开始日期与派遣开始日期不一致"
;
errorMessages
.
add
(
"合同开始日期与派遣开始日期不一致"
)
;
}
}
if
(
Common
.
isNotNull
(
preVo
.
getContractEnd
())
&&
Common
.
isNotNull
(
preVo
.
getDispatchPeriodEnd
())
if
(
Common
.
isNotNull
(
preVo
.
getContractEnd
())
&&
Common
.
isNotNull
(
preVo
.
getDispatchPeriodEnd
())
&&
!
preVo
.
getContractEnd
().
equals
(
preVo
.
getDispatchPeriodEnd
())){
&&
!
preVo
.
getContractEnd
().
equals
(
preVo
.
getDispatchPeriodEnd
())){
return
"合同截止日期与派遣截止日期不一致"
;
errorMessages
.
add
(
"合同截止日期与派遣截止日期不一致"
);
}
// 如果有错误信息,一起返回
if
(!
errorMessages
.
isEmpty
())
{
return
String
.
join
(
";"
,
errorMessages
);
}
}
}
}
//同商务合同一直 要 验证时间 截止时间大于等于开始时间、时间交叉
//同商务合同一直 要 验证时间 截止时间大于等于开始时间、时间交叉
...
...
yifu-csp/yifu-csp-biz/src/main/java/com/yifu/cloud/plus/v1/csp/service/impl/EmployeeRegistrationServiceImpl.java
View file @
80949aa3
...
@@ -1152,6 +1152,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
...
@@ -1152,6 +1152,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
}
}
}
//劳务派遣合同相关校验
//劳务派遣合同相关校验
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
()))
{
...
@@ -1163,7 +1164,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
...
@@ -1163,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
)
{
return
"劳务派遣的派遣年限格式不正确"
;
allErrorMessages
.
add
(
"劳务派遣的派遣年限格式不正确"
)
;
}
}
// 将派遣月份转换为年的小数部分(例如:6 个月=0.5 年)
// 将派遣月份转换为年的小数部分(例如:6 个月=0.5 年)
...
@@ -1171,40 +1172,32 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
...
@@ -1171,40 +1172,32 @@ 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
)
{
return
"劳务派遣的派遣月份格式不正确"
;
allErrorMessages
.
add
(
"劳务派遣的派遣月份格式不正确"
)
;
}
}
// 计算总派遣年限(年 + 月/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 年,请检查"
;
allErrorMessages
.
add
(
"劳务派遣合同的合同年限不能小于 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
()))
{
return
"派遣结束日期需大于等于派遣开始日期"
;
allErrorMessages
.
add
(
"派遣结束日期需大于等于派遣开始日期"
)
;
}
}
}
}
// 合同开始时间、合同截止时间应与派遣的合同开始时间、合同截止时间一致
// 合同开始时间、合同截止时间应与派遣的合同开始时间、合同截止时间一致
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getContractStart
())
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getContractStart
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodStart
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodStart
())
&&
!
employeeContractPreVo
.
getContractStart
().
equals
(
employeeContractPreVo
.
getDispatchPeriodStart
()))
{
&&
!
employeeContractPreVo
.
getContractStart
().
equals
(
employeeContractPreVo
.
getDispatchPeriodStart
()))
{
return
"合同开始日期与派遣开始日期不一致"
;
allErrorMessages
.
add
(
"合同开始日期与派遣开始日期不一致"
)
;
}
}
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getContractEnd
())
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getContractEnd
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodEnd
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getDispatchPeriodEnd
())
&&
!
employeeContractPreVo
.
getContractEnd
().
equals
(
employeeContractPreVo
.
getDispatchPeriodEnd
()))
{
&&
!
employeeContractPreVo
.
getContractEnd
().
equals
(
employeeContractPreVo
.
getDispatchPeriodEnd
()))
{
return
"合同截止日期与派遣截止日期不一致"
;
allErrorMessages
.
add
(
"合同截止日期与派遣截止日期不一致"
);
}
}
// 校验合同有效期:合同截止日期不得早于合同开始日期
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getContractStart
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getContractEnd
()))
{
if
(
employeeContractPreVo
.
getContractEnd
().
before
(
employeeContractPreVo
.
getContractStart
()))
{
return
"合同截止日期需大于等于合同开始日期"
;
}
}
}
}
...
@@ -1219,17 +1212,17 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
...
@@ -1219,17 +1212,17 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
if
(!
Common
.
isEmpty
(
employeeContractPreVo
.
getContractTerm
())
if
(!
Common
.
isEmpty
(
employeeContractPreVo
.
getContractTerm
())
&&
!
Common
.
isEmpty
(
employeeContractPreVo
.
getTryPeriodNum
()))
{
&&
!
Common
.
isEmpty
(
employeeContractPreVo
.
getTryPeriodNum
()))
{
// 安全解析试用期月数
// 安全解析试用期月数
int
tryPeriodMonths
;
int
tryPeriodMonths
=
0
;
try
{
try
{
tryPeriodMonths
=
Integer
.
parseInt
(
employeeContractPreVo
.
getTryPeriodNum
().
trim
());
tryPeriodMonths
=
Integer
.
parseInt
(
employeeContractPreVo
.
getTryPeriodNum
().
trim
());
}
catch
(
NumberFormatException
e
)
{
}
catch
(
NumberFormatException
e
)
{
return
"试用期月份格式不正确"
;
allErrorMessages
.
add
(
"试用期月份格式不正确"
)
;
}
}
// 无固定期限合同校验(contractTerm = "2")
// 无固定期限合同校验(contractTerm = "2")
if
(
CommonConstants
.
TWO_STRING
.
equals
(
employeeContractPreVo
.
getContractTerm
()))
{
if
(
CommonConstants
.
TWO_STRING
.
equals
(
employeeContractPreVo
.
getContractTerm
()))
{
if
(
tryPeriodMonths
>
6
)
{
if
(
tryPeriodMonths
>
6
)
{
return
"无固定期限时试用期不得超过 6 个月"
;
allErrorMessages
.
add
(
"无固定期限时试用期不得超过 6 个月"
)
;
}
}
}
}
// 固定期限合同校验(contractTerm = "1")
// 固定期限合同校验(contractTerm = "1")
...
@@ -1266,24 +1259,35 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
...
@@ -1266,24 +1259,35 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
if
(
totalContractMonths
<
12
)
{
if
(
totalContractMonths
<
12
)
{
// 合同期限不满 1 年,试用期不得超过 1 个月
// 合同期限不满 1 年,试用期不得超过 1 个月
if
(
tryPeriodMonths
>
1
)
{
if
(
tryPeriodMonths
>
1
)
{
return
"固定期限时合同年限不满一年的,试用期不得超过 1 个月"
;
allErrorMessages
.
add
(
"固定期限时合同年限不满一年的,试用期不得超过 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
)
{
return
"固定期限时合同年限 1 年以上不满 3 年的,试用期不得超过 2 个月"
;
allErrorMessages
.
add
(
"固定期限时合同年限 1 年以上不满 3 年的,试用期不得超过 2 个月"
)
;
}
}
}
else
{
}
else
{
// 合同期限 3 年以上,试用期不得超过 6 个月
// 合同期限 3 年以上,试用期不得超过 6 个月
if
(
tryPeriodMonths
>
6
)
{
if
(
tryPeriodMonths
>
6
)
{
return
"固定期限时合同年限 3 年以上的,试用期不得超过 6 个月"
;
allErrorMessages
.
add
(
"固定期限时合同年限 3 年以上的,试用期不得超过 6 个月"
)
;
}
}
}
}
}
}
}
}
}
}
}
}
// 如果有错误信息,一起返回
if
(!
allErrorMessages
.
isEmpty
())
{
return
String
.
join
(
";"
,
allErrorMessages
);
}
// 校验合同有效期:合同截止日期不得早于合同开始日期
if
(
Common
.
isNotNull
(
employeeContractPreVo
.
getContractStart
())
&&
Common
.
isNotNull
(
employeeContractPreVo
.
getContractEnd
()))
{
if
(
employeeContractPreVo
.
getContractEnd
().
before
(
employeeContractPreVo
.
getContractStart
()))
{
allErrorMessages
.
add
(
"合同截止日期需大于等于合同开始日期"
);
}
}
return
null
;
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