Commit 9cb8264b authored by huyuchen's avatar huyuchen

huych-入离职登记增加修改功能

parent 28da4633
......@@ -131,6 +131,19 @@ public class EmployeeRegistrationController {
return employeeRegistrationService.updateRegist(employeeRegistration);
}
/**
* 单个更新,更新入离职日期和手机号码
*
* @param employeeRegistration 入离职登记表
* @return R
*/
@Operation(summary = "单个更新,更新入离职日期和手机号码等")
@SysLog("单个更新,更新入离职日期和手机号码等")
@PostMapping("/updateEmpRegistInfo")
public R updateEmpRegistInfo(@RequestBody EmployeeRegistration employeeRegistration) {
return employeeRegistrationService.updateEmpRegistInfo(employeeRegistration);
}
/**
* 入离职登记表确认接收
*
......
......@@ -80,6 +80,13 @@ public interface EmployeeRegistrationService extends IService<EmployeeRegistrati
*/
R updateRegist(EmployeeRegistration registration);
/**
* 单个更新,更新入离职日期和手机号码
* @param registration 入离职登记
* @return
*/
R updateEmpRegistInfo(EmployeeRegistration registration);
/**
* 导出
* @param searchVo 入离职登记
......
......@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.csp.config.WxConfig;
import com.yifu.cloud.plus.v1.csp.constants.RegistConstants;
import com.yifu.cloud.plus.v1.csp.entity.EmployeeRegistration;
import com.yifu.cloud.plus.v1.csp.entity.EmployeeRegistrationLeave;
import com.yifu.cloud.plus.v1.csp.entity.TCspAttaInfo;
import com.yifu.cloud.plus.v1.csp.entity.TOperationLog;
import com.yifu.cloud.plus.v1.csp.mapper.EmployeeRegistrationMapper;
......@@ -1382,6 +1383,49 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
return R.ok();
}
@Override
public R updateEmpRegistInfo(EmployeeRegistration registration) {
EmployeeRegistration registrationNow = baseMapper.selectById(registration.getId());
if (Common.isEmpty(registrationNow) ) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
//入职状态校验
if (CommonConstants.ONE_STRING.equals(registrationNow.getFeedbackType()) &&
CommonConstants.ZERO_STRING.equals(registrationNow.getProcessStatus())) {
return R.failed(RegistConstants.NO_DATA_TO_HANDLE);
}
//离职状态校验
if (CommonConstants.TWO_STRING.equals(registrationNow.getFeedbackType())) {
EmployeeRegistrationLeave registrationLeave = employeeRegistrationLeaveService.getById(registration.getId());
if (Common.isNotNull(registrationLeave) && !CommonConstants.ZERO_STRING.equals(registrationLeave.getLeaveStatus())) {
return R.failed(RegistConstants.NO_DATA_TO_HANDLE);
}
}
//手机号和身份证验证
if (Common.isNotNull(registration.getEmpPhone())
&& !registration.getEmpPhone().equals(registrationNow.getEmpPhone())) {
if (!ValidityUtil.validateEmpPhone(registration.getEmpPhone())) {
return R.failed(RegistConstants.PHONE_FORMAT_ERROR);
}
//姓名、身份证+手机号真实性校验
R<Boolean> checkRes = checkDaprUtil.checkIdCardAndMobile(registration.getEmployeeName(),
registration.getEmpIdcard(),registration.getEmpPhone());
if (Common.isEmpty(checkRes) || checkRes.getCode() != CommonConstants.SUCCESS){
return R.failed(checkRes.getMsg());
}
}
//更新入离职日期和手机号
if (Common.isNotNull(registration.getJoinLeaveDate())) {
registrationNow.setJoinLeaveDate(registration.getJoinLeaveDate());
}
if (Common.isNotNull(registration.getEmpPhone())) {
registrationNow.setEmpPhone(registration.getEmpPhone());
}
baseMapper.updateById(registrationNow);
return R.ok();
}
@Override
public R batchUpdatePreById(List<EmployeeRegistrationReceiveVo> employeeRegistList) {
YifuUser user = SecurityUtils.getUser();
......
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