修改状态

This commit is contained in:
mash 2024-12-03 11:04:55 +08:00
parent 9f855314d6
commit 825674398f
1 changed files with 30 additions and 12 deletions

View File

@ -943,39 +943,57 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Override
public AjaxResult updatePersonnelRetire(String id) {
Personnel personnel = getById(id);
// if (!"退休".equals(personnel.getWorkState())) {
// return AjaxResult.fail("该人员未办理退休变更,请先办理退休变更!");
// }
if (personnel == null) {
return AjaxResult.fail("人员不存在!");
}
if ("离职".equals(personnel.getWorkState())) {
return AjaxResult.fail("该人员已办理离职!");
}
if (BooleanUtil.isTrue(personnel.getIsInfo())) {
return AjaxResult.fail("请勿重复办理!");
}
personnel.setWorkState("退休");
personnel.setIsInfo(true);
boolean b = updateById(personnel);
boolean updated = updateById(personnel);
CompanyName companyName = companyNameMapper.selectById(personnel.getCompanyName());
if (companyName == null) {
return AjaxResult.fail("公司信息不存在!");
}
companyName.setResidualNumber(companyName.getResidualNumber() + 1);
companyNameMapper.updateById(companyName);
return b ? AjaxResult.ok().msg("处理成功!") : AjaxResult.fail("处理失败!");
return updated ? AjaxResult.ok().msg("处理成功!") : AjaxResult.fail("处理失败!");
}
@Override
public AjaxResult handlingResignationEvents(String id) {
Personnel personnel = getById(id);
// if (!"离职".equals(personnel.getWorkState())) {
// return AjaxResult.fail("该人员未办理离职变更,请先办理离职变更!");
// }
if (personnel == null) {
return AjaxResult.fail("人员不存在!");
}
if ("退休".equals(personnel.getWorkState())) {
return AjaxResult.fail("该人员已办理退休!");
}
if (BooleanUtil.isTrue(personnel.getWhetherIsQuit())) {
return AjaxResult.fail("请勿重复办理!");
}
personnel.setWorkState("离职");
personnel.setWhetherIsQuit(true);
personnel.setPersonnelType("指标外");
personnel.setResignationTime(LocalDate.now());
boolean b = updateById(personnel);
boolean updated = updateById(personnel);
CompanyName companyName = companyNameMapper.selectById(personnel.getCompanyName());
companyName.setResidualNumber(companyName.getResidualNumber() + 1);
companyNameMapper.updateById(companyName);
return b ? AjaxResult.ok().msg("处理成功!") : AjaxResult.fail("处理失败!");
if (companyName != null) {
companyName.setResidualNumber(companyName.getResidualNumber() + 1);
companyNameMapper.updateById(companyName);
}
return updated ? AjaxResult.ok().msg("处理成功!") : AjaxResult.fail("处理失败!");
}
@Override