This commit is contained in:
zhuyy 2023-02-23 17:37:30 +08:00
parent b3fece6fc3
commit 765676b2fe
1 changed files with 7 additions and 1 deletions

View File

@ -301,11 +301,17 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
CompanyName companyName = companyNameMapper.selectOne(new LambdaQueryWrapper<CompanyName>().eq(CompanyName::getId, organization.getCompanyId())); CompanyName companyName = companyNameMapper.selectOne(new LambdaQueryWrapper<CompanyName>().eq(CompanyName::getId, organization.getCompanyId()));
// 名额 // 名额
Long places = recruitmentMapper.selectOne(new MPJQueryWrapper<Recruitment>().select(" SUM(places) places ").eq("company_id", organization.getId())).getPlaces(); Long places = recruitmentMapper.selectOne(new MPJQueryWrapper<Recruitment>().select(" SUM(places) places ").eq("company_id", organization.getId())).getPlaces();
Long quota = companyName.getResidualNumber() - places;
// 剩余指标人数 = 剩余指标人数 - 名额
if(quota < 0){
return AjaxResult.fail().msg("招聘人数不能大于剩余人数!");
}
one.setAuditOrder(ArgsConst.LAST); one.setAuditOrder(ArgsConst.LAST);
one.setAuditState(ArgsConst.PASS); one.setAuditState(ArgsConst.PASS);
boolean update = updateById(one); boolean update = updateById(one);
if (update) { if (update) {
companyName.setResidualNumber(companyName.getCheckNumber() - places); // 剩余指标人数 = 原核定用工指标人数 - 名额
companyName.setResidualNumber(quota);
companyName.setThisApprovalNumber(organization.getThisApprovalNumber()); companyName.setThisApprovalNumber(organization.getThisApprovalNumber());
companyNameMapper.updateById(companyName); companyNameMapper.updateById(companyName);
organization.setAuditState(3); organization.setAuditState(3);