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
9def1fe8
You need to sign in or sign up before continuing.
Commit
9def1fe8
authored
May 18, 2026
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.7.23-16周岁
parent
957b4481
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
132 additions
and
55 deletions
+132
-55
age_limit_plan.md
.trae/documents/MVP1.7.23/age_limit_plan.md
+91
-0
入职确认信息历史归档改造计划.md
.trae/documents/MVP1.7.23/入职确认信息历史归档改造计划.md
+0
-0
TCheckIdCardServiceImpl.java
...d/plus/v1/check/service/impl/TCheckIdCardServiceImpl.java
+2
-27
CommonConstants.java
...ud/plus/v1/yifu/common/core/constant/CommonConstants.java
+5
-0
Common.java
.../com/yifu/cloud/plus/v1/yifu/common/core/util/Common.java
+27
-0
EmployeeRegistrationServiceImpl.java
.../v1/csp/service/impl/EmployeeRegistrationServiceImpl.java
+4
-0
TSalaryEmployeeServiceImpl.java
.../yifu/salary/service/impl/TSalaryEmployeeServiceImpl.java
+3
-28
No files found.
.trae/documents/MVP1.7.23/age_limit_plan.md
0 → 100644
View file @
9def1fe8
# 16周岁限制功能实现计划
## 需求分析
1.
**入离职登记-入职登记**
:限制16周岁以下员工录入(离职不限制)
2.
**批量入离职-入职**
:限制16周岁以下员工录入(离职不限制)
3.
**公共方法提取**
:将
`isNot16Age`
方法提取到公共工具类
`Common.java`
中
## 代码现状分析
### 现有 `isNot16Age` 方法位置
1.
`yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryEmployeeServiceImpl.java`
(第1501行)
2.
`yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/service/impl/TCheckIdCardServiceImpl.java`
(第590行)
### 入离职登记校验位置
-
`yifu-csp/yifu-csp-biz/src/main/java/com/yifu/cloud/plus/v1/csp/service/impl/EmployeeRegistrationServiceImpl.java`
-
`registCheck`
方法(第2120行):单个新增和导入校验
## 实施步骤
### 步骤1:在 Common 工具类中添加公共方法
**文件**
:
`yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/util/Common.java`
添加方法:
```
java
/**
* 判断是否未满16周岁
* 未满16周岁的,返回true,表示需要返回错误信息
*
* @param idCard 身份证号
* @param nowDay 当前日期(格式:yyyyMMdd)
* @return 未满16周岁返回true,否则返回false
*/
public
static
boolean
isNot16Age
(
String
idCard
,
int
nowDay
)
{
try
{
if
(
Common
.
isNotNull
(
idCard
)
&&
(
idCard
.
length
()
==
15
||
idCard
.
length
()
==
18
))
{
int
birthDay
;
if
(
idCard
.
length
()
==
18
)
{
// 18位身份证:第7-14位是出生年月日 (YYYYMMDD)
birthDay
=
Integer
.
parseInt
(
idCard
.
substring
(
6
,
14
));
}
else
{
// 15位身份证年份需要补全19xx年(15位身份证都是19开头的)
birthDay
=
Integer
.
parseInt
(
"19"
+
idCard
.
substring
(
6
,
12
));
}
birthDay
+=
160000
;
return
birthDay
>=
nowDay
;
}
else
{
// 其他情况不判断16周岁
return
false
;
}
}
catch
(
Exception
e
)
{
// 特殊或错误身份证,不判断16周岁
return
false
;
}
}
```
### 步骤2:修改入离职登记校验逻辑
**文件**
:
`yifu-csp/yifu-csp-biz/src/main/java/com/yifu/cloud/plus/v1/csp/service/impl/EmployeeRegistrationServiceImpl.java`
在
`registCheck`
方法中添加16周岁限制(仅对入职登记):
```
java
// 入职登记时判断是否未满16周岁
if
(
CommonConstants
.
ONE_STRING
.
equals
(
registration
.
getFeedbackType
()))
{
int
nowDay
=
Integer
.
parseInt
(
DateUtil
.
getThisDay
());
if
(
Common
.
isNot16Age
(
registration
.
getEmpIdcard
(),
nowDay
))
{
return
"人员未满16周岁,禁用童工"
;
}
}
```
### 步骤3:更新现有引用使用公共方法(可选优化)
**文件**
:
`yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryEmployeeServiceImpl.java`
**文件**
:
`yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/service/impl/TCheckIdCardServiceImpl.java`
将原有的
`isNot16Age`
方法替换为调用
`Common.isNot16Age()`
## 风险评估
1.
**兼容性风险**
:现有调用
`isNot16Age`
的代码需要确认参数类型是否一致
2.
**业务风险**
:离职登记不应受年龄限制,需确保条件判断正确
## 测试验证
1.
测试入职登记:未满16周岁应提示错误
2.
测试离职登记:未满16周岁应允许操作
3.
测试批量导入:未满16周岁的入职记录应被拒绝
## 任务清单
1.
[
]
在 Common 类中添加 isNot16Age 方法
2.
[
]
在 EmployeeRegistrationServiceImpl 的 registCheck 方法中添加年龄校验
3.
[
]
更新 TSalaryEmployeeServiceImpl 使用公共方法
4.
[
]
更新 TCheckIdCardServiceImpl 使用公共方法
5.
[
]
验证修改后代码编译通过
\ No newline at end of file
.trae/documents/入职确认信息历史归档改造计划.md
→
.trae/documents/
MVP1.7.23/
入职确认信息历史归档改造计划.md
View file @
9def1fe8
File moved
yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/service/impl/TCheckIdCardServiceImpl.java
View file @
9def1fe8
...
@@ -497,9 +497,9 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
...
@@ -497,9 +497,9 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
if
(
Common
.
isNotNull
(
c
.
getIdCard
())
&&
Common
.
isNotNull
(
c
.
getName
()))
{
if
(
Common
.
isNotNull
(
c
.
getIdCard
())
&&
Common
.
isNotNull
(
c
.
getName
()))
{
// 仅工资导入需要判断16周岁,其他的不需要
// 仅工资导入需要判断16周岁,其他的不需要
if
(
Common
.
isNotNull
(
judgeAgeType
)
&&
CommonConstants
.
ONE_INT
==
judgeAgeType
if
(
Common
.
isNotNull
(
judgeAgeType
)
&&
CommonConstants
.
ONE_INT
==
judgeAgeType
&&
isNot16Age
(
c
.
getIdCard
(),
nowDay
))
{
&&
Common
.
isNot16Age
(
c
.
getIdCard
(),
nowDay
))
{
c
.
setIsTrue
(
0
);
c
.
setIsTrue
(
0
);
c
.
setReason
(
"人员未满16周岁,禁用童工"
);
c
.
setReason
(
CommonConstants
.
UNDER_16_ERROR
);
}
else
{
}
else
{
lastCard
=
idCardMap
.
get
(
c
.
getIdCard
());
lastCard
=
idCardMap
.
get
(
c
.
getIdCard
());
if
(
lastCard
!=
null
)
{
if
(
lastCard
!=
null
)
{
...
@@ -585,31 +585,6 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
...
@@ -585,31 +585,6 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
return
R
.
failed
(
"数据为空!"
);
return
R
.
failed
(
"数据为空!"
);
}
}
// 判断是否未满16周岁(只有一种:身份证格式正确,且+16年大于等于当前日期
// 未满16周岁的,返回true,表示需要返回错误信息
public
static
boolean
isNot16Age
(
String
idCard
,
int
nowDay
)
{
try
{
if
(
Common
.
isNotNull
(
idCard
)
&&
(
idCard
.
length
()
==
15
||
idCard
.
length
()
==
18
))
{
int
birthDay
;
if
(
idCard
.
length
()
==
18
)
{
// 18位身份证:第7-14位是出生年月日 (YYYYMMDD)
birthDay
=
Integer
.
parseInt
(
idCard
.
substring
(
6
,
14
));
}
else
{
// 15位身份证年份需要补全19xx年(15位身份证都是19开头的)
birthDay
=
Integer
.
parseInt
(
"19"
+
idCard
.
substring
(
6
,
12
));
}
birthDay
+=
160000
;
return
birthDay
>=
nowDay
;
}
else
{
// 其他情况不判断16周岁
return
false
;
}
}
catch
(
Exception
e
)
{
// 特殊或错误身份证,不判断16周岁-2026-04-20同倩倩确认
return
false
;
}
}
/**
/**
* @Description: 预入职导入使用的批量姓名身份证校验
* @Description: 预入职导入使用的批量姓名身份证校验
* @Author: hgw
* @Author: hgw
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/constant/CommonConstants.java
View file @
9def1fe8
...
@@ -701,4 +701,9 @@ public interface CommonConstants {
...
@@ -701,4 +701,9 @@ public interface CommonConstants {
// 前端客服角色ID(全服管理者)
// 前端客服角色ID(全服管理者)
long
CS_ROLE_ID
=
1839501715787390978L
;
long
CS_ROLE_ID
=
1839501715787390978L
;
/**
* 未满16周岁错误提示
*/
String
UNDER_16_ERROR
=
"人员未满16周岁,禁用童工"
;
}
}
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/util/Common.java
View file @
9def1fe8
...
@@ -833,4 +833,31 @@ public class Common {
...
@@ -833,4 +833,31 @@ public class Common {
return
null
;
return
null
;
}
}
}
}
/**
* 判断是否未满16周岁
* 未满16周岁的,返回true,表示需要返回错误信息
*
* @param idCard 身份证号
* @param nowDay 当前日期(格式:yyyyMMdd)
* @return 未满16周岁返回true,否则返回false
*/
public
static
boolean
isNot16Age
(
String
idCard
,
int
nowDay
)
{
try
{
if
(
Common
.
isNotNull
(
idCard
)
&&
(
idCard
.
length
()
==
15
||
idCard
.
length
()
==
18
))
{
int
birthDay
;
if
(
idCard
.
length
()
==
18
)
{
birthDay
=
Integer
.
parseInt
(
idCard
.
substring
(
6
,
14
));
}
else
{
birthDay
=
Integer
.
parseInt
(
"19"
+
idCard
.
substring
(
6
,
12
));
}
birthDay
+=
160000
;
return
birthDay
>=
nowDay
;
}
else
{
return
false
;
}
}
catch
(
Exception
e
)
{
return
false
;
}
}
}
}
yifu-csp/yifu-csp-biz/src/main/java/com/yifu/cloud/plus/v1/csp/service/impl/EmployeeRegistrationServiceImpl.java
View file @
9def1fe8
...
@@ -2157,6 +2157,10 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
...
@@ -2157,6 +2157,10 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
}
//针对入职的判断是否存在流程中的合同待签订数据
//针对入职的判断是否存在流程中的合同待签订数据
if
(
CommonConstants
.
ONE_STRING
.
equals
(
registration
.
getFeedbackType
()))
{
if
(
CommonConstants
.
ONE_STRING
.
equals
(
registration
.
getFeedbackType
()))
{
int
nowDay
=
Integer
.
parseInt
(
DateUtil
.
getThisDay
());
if
(
Common
.
isNot16Age
(
registration
.
getEmpIdcard
(),
nowDay
))
{
return
CommonConstants
.
UNDER_16_ERROR
;
}
EmpProjectStatusVo
vo
=
new
EmpProjectStatusVo
();
EmpProjectStatusVo
vo
=
new
EmpProjectStatusVo
();
vo
.
setEmpIdcard
(
registration
.
getEmpIdcard
());
vo
.
setEmpIdcard
(
registration
.
getEmpIdcard
());
vo
.
setDeptNo
(
registration
.
getDeptNo
());
vo
.
setDeptNo
(
registration
.
getDeptNo
());
...
...
yifu-salary/yifu-salary-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/salary/service/impl/TSalaryEmployeeServiceImpl.java
View file @
9def1fe8
...
@@ -1158,7 +1158,7 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
...
@@ -1158,7 +1158,7 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
int
nowDay
=
Integer
.
parseInt
(
DateUtil
.
getThisDay
());
int
nowDay
=
Integer
.
parseInt
(
DateUtil
.
getThisDay
());
for
(
TSalaryEmployee
emp
:
excelVOList
)
{
for
(
TSalaryEmployee
emp
:
excelVOList
)
{
if
(
Common
.
isNotNull
(
emp
.
getEmpIdcard
()))
{
if
(
Common
.
isNotNull
(
emp
.
getEmpIdcard
()))
{
if
(!
isNot16Age
(
emp
.
getEmpIdcard
(),
nowDay
))
{
if
(!
Common
.
isNot16Age
(
emp
.
getEmpIdcard
(),
nowDay
))
{
idCardCheck
=
new
TCheckIdCard
();
idCardCheck
=
new
TCheckIdCard
();
idCardCheck
.
setIdCard
(
emp
.
getEmpIdcard
());
idCardCheck
.
setIdCard
(
emp
.
getEmpIdcard
());
idCardCheck
.
setName
(
emp
.
getEmpName
());
idCardCheck
.
setName
(
emp
.
getEmpName
());
...
@@ -1394,8 +1394,8 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
...
@@ -1394,8 +1394,8 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
errorMessageList
.
add
(
new
ErrorMessage
((
i
),
"新增员工,除了支行,其他必填"
));
errorMessageList
.
add
(
new
ErrorMessage
((
i
),
"新增员工,除了支行,其他必填"
));
continue
;
continue
;
}
else
{
}
else
{
if
(
isNot16Age
(
idCard
,
nowDay
))
{
if
(
Common
.
isNot16Age
(
idCard
,
nowDay
))
{
errorMessageList
.
add
(
new
ErrorMessage
((
i
),
"人员未满16周岁,禁用童工"
));
errorMessageList
.
add
(
new
ErrorMessage
((
i
),
CommonConstants
.
UNDER_16_ERROR
));
continue
;
continue
;
}
}
if
(
excel
.
getTaxMonth
().
length
()
==
6
)
{
if
(
excel
.
getTaxMonth
().
length
()
==
6
)
{
...
@@ -1496,31 +1496,6 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
...
@@ -1496,31 +1496,6 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
}
}
}
}
// 判断是否未满16周岁(只有一种:身份证格式正确,且+16年大于等于当前日期
// 未满16周岁的,返回true,表示需要返回错误信息
public
static
boolean
isNot16Age
(
String
idCard
,
int
nowDay
)
{
try
{
if
(
Common
.
isNotNull
(
idCard
)
&&
(
idCard
.
length
()
==
15
||
idCard
.
length
()
==
18
))
{
int
birthDay
;
if
(
idCard
.
length
()
==
18
)
{
// 18位身份证:第7-14位是出生年月日 (YYYYMMDD)
birthDay
=
Integer
.
parseInt
(
idCard
.
substring
(
6
,
14
));
}
else
{
// 15位身份证年份需要补全19xx年(15位身份证都是19开头的)
birthDay
=
Integer
.
parseInt
(
"19"
+
idCard
.
substring
(
6
,
12
));
}
birthDay
+=
160000
;
return
birthDay
>=
nowDay
;
}
else
{
// 其他情况不判断16周岁
return
false
;
}
}
catch
(
Exception
e
)
{
// 特殊或错误身份证,不判断16周岁-2026-04-20同倩倩确认
return
false
;
}
}
/**
/**
* 同步ekp薪酬人员信息
* 同步ekp薪酬人员信息
*
*
...
...
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