Commit 5a502a16 authored by fangxinjiang's avatar fangxinjiang

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

parents 9984d27e 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
# 实现计划:保存草稿时同步更新作业自动化状态
## 需求分析
用户要求在保存草稿(`saveDraftPreEmpMain`)时,如果作业自动化 `EmployeeRegistrationPre` 的状态为 **"2信息待审核"**,需要将其状态同步更新为 **"1信息待填写"**
当前保存(`savePreEmpMain`)时的行为是正确的,不需要修改。
## 代码分析
### 当前实现逻辑
`TPreEmpMainServiceImpl.saveBase()` 方法中:
- `saveDraftPreEmpMain` 调用 `saveBase(vo, CommonConstants.ZERO_STRING)`
- `savePreEmpMain` 调用 `saveBase(vo, CommonConstants.ONE_STRING)`
第 1592-1613 行处理保存时的状态变更:
```java
if (pre != null && Common.isNotNull(pre.getId()) && CommonConstants.ONE_STRING.equals(status)) {
main.setStatus(CommonConstants.TWO_STRING);
registrationPreService.updatePreStatusToTwo(main.getDeptId(), idCard);
// ...
}
```
### 已有方法
`EmployeeRegistrationPreService` 接口已提供:
- `updatePreStatusToTwo(String deptId, String empIdCard)` - 将状态从"1"更新为"2"
- `updatePreStatusToOne(String deptNo, String empIdcard)` - 将状态从"2"更新为"1"
## 修改方案
`saveBase` 方法的状态处理逻辑中,添加草稿保存时的状态同步逻辑:
`status == ZERO_STRING`(草稿保存)且 `pre != null && pre.getProcessStatus() == TWO_STRING`(待审核状态)时:
1. 调用 `registrationPreService.updatePreStatusToOne()` 将作业自动化状态更新为"1信息待填写"
## 文件修改
| 文件 | 修改内容 |
|------|----------|
| `TPreEmpMainServiceImpl.java` | 在 `saveBase` 方法中添加草稿保存时的状态同步逻辑 |
## 实施步骤
1.`saveBase` 方法中,在现有的状态处理逻辑之前或之后添加草稿保存的状态同步逻辑
2. 确保只在 `pre != null``pre.getProcessStatus() == TWO_STRING` 时才进行更新
## 代码修改位置
文件:`e:\mvp_workspace2025\yifu\yifu-archives\yifu-archives-biz\src\main\java\com\yifu\cloud\plus\v1\yifu\archives\service\impl\TPreEmpMainServiceImpl.java`
修改位置:第 1590 行附近的状态处理逻辑
## 预期效果
- 保存草稿时,如果作业自动化状态为"2信息待审核",自动更新为"1信息待填写"
- 保存正式提交时的行为保持不变
\ No newline at end of file
...@@ -1611,6 +1611,10 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE ...@@ -1611,6 +1611,10 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
updateToEmployeeByPre(vo, isSimpleBoo); updateToEmployeeByPre(vo, isSimpleBoo);
} }
} }
// 草稿保存时,若作业自动化状态为待审核,同步更新为待填写
if (pre != null && Common.isNotNull(pre.getId()) && CommonConstants.ZERO_STRING.equals(status)) {
registrationPreService.updatePreStatusToOne(main.getDeptNo(), idCard);
}
main.setCreateBy(user.getId()); main.setCreateBy(user.getId());
main.setCreateName(user.getNickname()); main.setCreateName(user.getNickname());
main.setCreateTime(LocalDateTime.now()); main.setCreateTime(LocalDateTime.now());
......
...@@ -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
......
...@@ -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周岁,禁用童工";
} }
...@@ -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;
}
}
} }
...@@ -2175,6 +2175,10 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -2175,6 +2175,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());
......
...@@ -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薪酬人员信息
* *
......
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