招聘董监审批

This commit is contained in:
zhuyy 2023-02-21 15:57:42 +08:00
parent 14a302a050
commit 8bbd3177c6
8 changed files with 308 additions and 9 deletions

View File

@ -47,6 +47,14 @@ public class ArgsConst {
* 附件所属内设机构 * 附件所属内设机构
*/ */
public static final String ORGANIZATION = "organization"; public static final String ORGANIZATION = "organization";
/**
* 登记
*/
public static final String RECRUITMENT = "recruitment";
/**
* 送审
*/
public static final String PERSONNEL_INDICATORS = "personnel_indicators";
/** /**
* 附件所属董监 * 附件所属董监
*/ */

View File

@ -63,6 +63,22 @@ public class AuditController extends BaseController {
return AjaxResult.fail().msg("审批状态错误"); return AjaxResult.fail().msg("审批状态错误");
} }
@PostMapping("submitDirectorsSupervisorsAudit")
@ApiOperation(value = "董监任免申报审批 同意/拒绝")
public AjaxResult submitDirectorsSupervisorsAudit(@RequestBody AuditRequest auditRequest) {
if ("2".equals(auditRequest.getStatus()) || "3".equals(auditRequest.getStatus())) {
return auditService.submitDirectorsSupervisorsAudit(auditRequest);
}
return AjaxResult.fail().msg("审批状态错误");
}
@PostMapping("submitRecruitmentAudit")
@ApiOperation(value = "人员招聘登记审批 同意/拒绝")
public AjaxResult submitRecruitmentAudit(@RequestBody AuditRequest auditRequest) {
if ("2".equals(auditRequest.getStatus()) || "3".equals(auditRequest.getStatus())) {
return auditService.submitRecruitmentAudit(auditRequest);
}
return AjaxResult.fail().msg("审批状态错误");
}
} }

View File

@ -6,6 +6,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter; import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters; import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.common.base.BaseController; import com.ydool.common.base.BaseController;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.constant.UrlConstant; import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult; import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.Organization; import com.ydool.staff.entity.Organization;
@ -42,4 +43,18 @@ public class OrganizationController extends BaseController {
public AjaxResult deleteOrganization(@RequestBody IdsRequest id) { public AjaxResult deleteOrganization(@RequestBody IdsRequest id) {
return organizationService.deleteOrganization(id); return organizationService.deleteOrganization(id);
} }
@GetMapping("/submitRecruitment")
@ApiOperation(value = "人员招聘登记送审")
@ApiImplicitParams({@ApiImplicitParam(value = "登记id", name = "id")})
public AjaxResult submitRecruitment(String id) {
return organizationService.submitRecruitment(id, ArgsConst.RECRUITMENT);
}
@GetMapping("/submitPersonnelIndicators")
@ApiOperation(value = "人员指标申报送审")
@ApiImplicitParams({@ApiImplicitParam(value = "申报id", name = "id")})
public AjaxResult submitPersonnelIndicators(String id) {
return organizationService.submitPersonnelIndicators(id, ArgsConst.PERSONNEL_INDICATORS);
}
} }

View File

@ -61,6 +61,15 @@ public class Organization extends BaseEntity{
@ApiModelProperty(value = "单据状态") @ApiModelProperty(value = "单据状态")
private String documentStatus; private String documentStatus;
@ApiModelProperty(value = "审批状态 0 未审批 1 待审批2已通过3已拒绝\n")
private Integer auditState;
@ApiModelProperty(value = "初审意见")
private String firstTrial;
@ApiModelProperty(value = "终审意见")
private String lastInstance;
@ApiModelProperty(value = "修改人") @ApiModelProperty(value = "修改人")
@TableField(exist = false) @TableField(exist = false)
private String updatedName; private String updatedName;

View File

@ -20,7 +20,8 @@ public interface IAuditService {
Integer saveAuditLog(String personnelId,String approverId,String auditSate); Integer saveAuditLog(String personnelId,String approverId,String auditSate);
AjaxResult submitDirectorsSupervisorsAudit(AuditRequest auditRequest);
AjaxResult submitRecruitmentAudit(AuditRequest auditRequest);
} }

View File

@ -21,5 +21,8 @@ public interface IOrganizationService {
AjaxResult deleteOrganization(IdsRequest id); AjaxResult deleteOrganization(IdsRequest id);
AjaxResult submitRecruitment(String id, String type);
AjaxResult submitPersonnelIndicators(String id, String type);
} }

View File

@ -1,20 +1,15 @@
package com.ydool.staff.service.impl; package com.ydool.staff.service.impl;
import cn.dev33.satoken.stp.StpUtil; import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.base.BaseService; import com.ydool.common.base.BaseService;
import com.ydool.common.cache.ConfigCache; import com.ydool.common.cache.ConfigCache;
import com.ydool.common.constant.ArgsConst; import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult; import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.Audit; import com.ydool.staff.entity.*;
import com.ydool.staff.entity.AuditLog; import com.ydool.staff.mapper.*;
import com.ydool.staff.entity.Personnel;
import com.ydool.staff.entity.PersonnelMiddle;
import com.ydool.staff.mapper.AuditLogMapper;
import com.ydool.staff.mapper.AuditMapper;
import com.ydool.staff.mapper.PersonnelMapper;
import com.ydool.staff.mapper.PersonnelMiddleMapper;
import com.ydool.staff.request.AuditRequest; import com.ydool.staff.request.AuditRequest;
import com.ydool.staff.service.IAuditService; import com.ydool.staff.service.IAuditService;
import com.ydool.staff.service.IPersonnelService; import com.ydool.staff.service.IPersonnelService;
@ -22,6 +17,7 @@ import com.ydool.system.entity.Config;
import com.ydool.system.entity.User; import com.ydool.system.entity.User;
import com.ydool.system.mapper.ConfigMapper; import com.ydool.system.mapper.ConfigMapper;
import com.ydool.system.mapper.UserMapper; import com.ydool.system.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -56,6 +52,10 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
private PersonnelMapper personnelMapper; private PersonnelMapper personnelMapper;
@Resource @Resource
private PersonnelMiddleMapper personnelMiddleMapper; private PersonnelMiddleMapper personnelMiddleMapper;
@Autowired
DirectorsSupervisorsMapper directorsSupervisorsMapper;
@Autowired
OrganizationMapper organizationMapper;
@Override @Override
public AjaxResult getAuditList(Page page) { public AjaxResult getAuditList(Page page) {
@ -158,6 +158,8 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
} }
return null; return null;
} }
@Override
public Integer saveAuditLog(String personnelId,String approverId,String auditSate){ public Integer saveAuditLog(String personnelId,String approverId,String auditSate){
AuditLog auditLog = new AuditLog(); AuditLog auditLog = new AuditLog();
auditLog.setPersonnelId(personnelId); auditLog.setPersonnelId(personnelId);
@ -165,6 +167,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
auditLog.setAuditState(auditSate); auditLog.setAuditState(auditSate);
return auditLogMapper.insert(auditLog); return auditLogMapper.insert(auditLog);
} }
public void updateByPer(String afterId,Personnel personnel){ public void updateByPer(String afterId,Personnel personnel){
delete(afterId); delete(afterId);
personnel.setAuditState(0); personnel.setAuditState(0);
@ -172,6 +175,164 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
personnelMapper.updateById(personnel); personnelMapper.updateById(personnel);
} }
/**
* 招聘登记
* @param auditRequest
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult submitRecruitmentAudit(AuditRequest auditRequest) {
Organization recruitment = organizationMapper.selectById(auditRequest.getPersonnelId());
if (3 == recruitment.getAuditState()) {
return AjaxResult.fail().msg("已拒绝请勿重复审批!");
}
String loginId = StpUtil.getLoginIdAsString();
Audit one = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getAuditOrder, ArgsConst.WAITING).eq(Audit::getApprover, loginId));
if (ObjectUtil.isNull(one)) {
return AjaxResult.fail().msg("该用户不能审批!");
}
// 人事部负责人
Config director = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
// 领导
Config leadership = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
// 同意
if ("2".equals(auditRequest.getStatus())) {
User byId = userMapper.selectById(one.getApprover());
// 人事初审批同意
if (director.getParamValue().equals(byId.getLoginName())) {
one.setAuditOrder(ArgsConst.FIRST);
one.setAuditState(ArgsConst.PASS);
boolean update = updateById(one);
if (update) {
Audit one1 = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getApprover, loginId).eq(Audit::getAuditOrder, ArgsConst.LAST));
one1.setAuditOrder(ArgsConst.WAITING);
updateById(one1);
recruitment.setFirstTrial(auditRequest.getAuditOpinion());
organizationMapper.updateById(recruitment);
}
return update ? AjaxResult.ok().msg("人事审批成功!") : AjaxResult.fail().msg("人事审批失败!");
}
// 领导终审批同意
if (leadership.getParamValue().equals(byId.getLoginName())) {
one.setAuditOrder(ArgsConst.LAST);
one.setAuditState(ArgsConst.PASS);
boolean update = updateById(one);
if (update) {
recruitment.setAuditState(2);
recruitment.setLastInstance(auditRequest.getAuditOpinion());
organizationMapper.updateById(recruitment);
}
return update ? AjaxResult.ok().msg("领导审批成功!") : AjaxResult.fail().msg("领导审批失败!");
}
} else {
// 人事初审批拒绝
User byId = userMapper.selectById(one.getApprover());
if (director.getParamValue().equals(byId.getLoginName())) {
one.setAuditOrder(ArgsConst.FIRST);
one.setAuditState(ArgsConst.REJECT);
boolean update = updateById(one);
if (update) {
recruitment.setAuditState(3);
recruitment.setFirstTrial(auditRequest.getAuditOpinion());
organizationMapper.updateById(recruitment);
}
return update ? AjaxResult.ok().msg("人事审批拒绝!") : AjaxResult.fail().msg("人事审批失败!");
}
// 领导终审批拒绝
if (leadership.getParamValue().equals(byId.getLoginName())) {
one.setAuditOrder(ArgsConst.LAST);
one.setAuditState(ArgsConst.REJECT);
boolean update = updateById(one);
if (update) {
recruitment.setAuditState(3);
recruitment.setLastInstance(auditRequest.getAuditOpinion());
organizationMapper.updateById(recruitment);
}
return update ? AjaxResult.ok().msg("领导审批拒绝!") : AjaxResult.fail().msg("领导审批失败!");
}
}
return null;
}
/**
* 董监审批
*
* @param auditRequest
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult submitDirectorsSupervisorsAudit(AuditRequest auditRequest) {
DirectorsSupervisors recruitment = directorsSupervisorsMapper.selectById(auditRequest.getPersonnelId());
if (3 == recruitment.getAuditState()) {
return AjaxResult.fail().msg("审批已拒绝请勿重复操作!");
}
String loginId = StpUtil.getLoginIdAsString();
Audit audit = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getAuditOrder, ArgsConst.WAITING).eq(Audit::getApprover, loginId));
if (ObjectUtil.isNull(audit)) {
return AjaxResult.fail().msg("该用户不能审批!");
}
// 人事部负责人
Config director = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
// 领导
Config leadership = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
User byId = userMapper.selectById(audit.getApprover());
if ("2".equals(auditRequest.getStatus())) {
// 人事初审批同意
if (director.getParamValue().equals(byId.getLoginName())) {
audit.setAuditOrder(ArgsConst.FIRST);
audit.setAuditState(ArgsConst.PASS);
boolean update = updateById(audit);
if (update) {
Audit one1 = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getAuditOrder, ArgsConst.LAST));
one1.setAuditOrder(ArgsConst.WAITING);
updateById(one1);
recruitment.setFirstTrial(auditRequest.getAuditOpinion());
directorsSupervisorsMapper.updateById(recruitment);
}
return update ? AjaxResult.ok().msg("人事审批成功!") : AjaxResult.fail().msg("人事审批失败!");
}
// 领导终审批同意
if (leadership.getParamValue().equals(byId.getLoginName())) {
audit.setAuditOrder(ArgsConst.LAST);
audit.setAuditState(ArgsConst.PASS);
boolean update = updateById(audit);
if (update) {
recruitment.setAuditState(2);
recruitment.setLastInstance(auditRequest.getAuditOpinion());
directorsSupervisorsMapper.updateById(recruitment);
}
return update ? AjaxResult.ok().msg("领导审批成功!") : AjaxResult.fail().msg("领导审批失败!");
}
} else {
// 人事初审批拒绝
if (director.getParamValue().equals(byId.getLoginName())) {
audit.setAuditOrder(ArgsConst.FIRST);
audit.setAuditState(ArgsConst.REJECT);
boolean update = updateById(audit);
if (update) {
recruitment.setAuditState(3);
recruitment.setFirstTrial(auditRequest.getAuditOpinion());
directorsSupervisorsMapper.updateById(recruitment);
}
return update ? AjaxResult.ok().msg("人事审批拒绝!") : AjaxResult.fail().msg("人事审批失败!");
}
// 领导终审批拒绝
if (leadership.getParamValue().equals(byId.getLoginName())) {
audit.setAuditOrder(ArgsConst.LAST);
audit.setAuditState(ArgsConst.REJECT);
boolean update = updateById(audit);
if (update) {
recruitment.setAuditState(3);
recruitment.setLastInstance(auditRequest.getAuditOpinion());
directorsSupervisorsMapper.updateById(recruitment);
}
return update ? AjaxResult.ok().msg("领导审批拒绝!") : AjaxResult.fail().msg("领导审批失败!");
}
}
return null;
}
} }

View File

@ -1,21 +1,30 @@
package com.ydool.staff.service.impl; package com.ydool.staff.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.cache.ConfigCache;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult; import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.*; import com.ydool.staff.entity.*;
import com.ydool.common.base.BaseService; import com.ydool.common.base.BaseService;
import com.ydool.staff.mapper.*; import com.ydool.staff.mapper.*;
import com.ydool.staff.request.OrganizationSearch; import com.ydool.staff.request.OrganizationSearch;
import com.ydool.staff.service.IAuditService;
import com.ydool.staff.service.IOrganizationService; import com.ydool.staff.service.IOrganizationService;
import com.ydool.system.entity.Config;
import com.ydool.system.entity.User;
import com.ydool.system.mapper.ConfigMapper;
import com.ydool.system.mapper.UserMapper;
import com.ydool.system.request.IdsRequest; import com.ydool.system.request.IdsRequest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -37,6 +46,14 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
PersonnelIndicatorsMapper personnelIndicatorsMapper; PersonnelIndicatorsMapper personnelIndicatorsMapper;
@Autowired @Autowired
RecruitmentMapper recruitmentMapper; RecruitmentMapper recruitmentMapper;
@Autowired
AuditMapper auditMapper;
@Autowired
ConfigMapper configMapper;
@Autowired
UserMapper userMapper;
@Autowired
IAuditService auditService;
@Override @Override
public AjaxResult selectOrganizationList(Page<Organization> page, OrganizationSearch organizationSearch) { public AjaxResult selectOrganizationList(Page<Organization> page, OrganizationSearch organizationSearch) {
@ -70,5 +87,74 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
return AjaxResult.fail().msg("删除失败!"); return AjaxResult.fail().msg("删除失败!");
} }
} }
/**
* 人员招聘登记
* @param id
* @param type
* @return
*/
@Override
public AjaxResult submitRecruitment(String id, String type) {
String loginId = StpUtil.getLoginIdAsString();
Organization organization = get(id);
if (1 == organization.getAuditState()) {
return AjaxResult.fail().msg("该数据已送审,请勿重复操作!");
}
extracted(id, type, loginId);
organization.setAuditState(1);
updateById(organization);
Integer i = auditService.saveAuditLog(id, loginId, "送审");
return i > 0 ? AjaxResult.ok().msg("送审成功!") : AjaxResult.ok().msg("送审失败!");
}
private void extracted(String id, String type, String loginId) {
for (int i = 0; i <= 2; i++) {
Audit audit = new Audit();
audit.setPersonnelId(id);
audit.setPerType(type);
if (i == 0) {
// 未审批
audit.setAuditState(ArgsConst.SUBMIT);
audit.setAuditOrder(ArgsConst.GIVE_AUDIT);
audit.setApprover(loginId);
audit.setApproverTime(new Date());
} else if (i == 1) {
// 待审批 人事部负责人
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
audit.setAuditOrder(ArgsConst.WAITING);
audit.setApprover(userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue())).getId());
audit.setApproverTime(new Date());
} else if (i == 2) {
// 领导
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
audit.setAuditOrder(ArgsConst.LAST);
audit.setApprover(userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue())).getId());
audit.setApproverTime(new Date());
}
auditMapper.insert(audit);
}
}
/**
* 人员指标申报
* @param id
* @param type
* @return
*/
@Override
public AjaxResult submitPersonnelIndicators(String id, String type) {
String loginId = StpUtil.getLoginIdAsString();
PersonnelIndicators organization = personnelIndicatorsMapper.selectById(id);
if (1 == organization.getAuditState()) {
return AjaxResult.fail().msg("该数据已送审,请勿重复操作!");
}
extracted(id, type, loginId);
organization.setAuditState(1);
personnelIndicatorsMapper.updateById(organization);
Integer i = auditService.saveAuditLog(id, loginId, "送审");
return i > 0 ? AjaxResult.ok().msg("送审成功!") : AjaxResult.ok().msg("送审失败!");
}
} }