This commit is contained in:
zhuyy 2023-06-21 17:28:54 +08:00
parent fb30a7257f
commit d756a79241
6 changed files with 78 additions and 32 deletions

View File

@ -1,5 +1,6 @@
package com.ydool.staff.entity; package com.ydool.staff.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.common.base.BaseEntity; import com.ydool.common.base.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -32,7 +33,7 @@ public class Audit extends BaseEntity{
@ApiModelProperty(value = "审批类型 personnel一般人员 change变更人员, exchange :人员选调") @ApiModelProperty(value = "审批类型 personnel一般人员 change变更人员, exchange :人员选调")
private String perType; private String perType;
@ApiModelProperty(value = "审批状态submit提交 pass通过 reject拒绝") @ApiModelProperty(value = "审批状态submit提交 待处理waiting pass通过 reject拒绝")
private String auditState; private String auditState;
@ApiModelProperty(value = "审批顺序giveAudit送审 first初审 last终审") @ApiModelProperty(value = "审批顺序giveAudit送审 first初审 last终审")
@ -47,4 +48,14 @@ public class Audit extends BaseEntity{
@ApiModelProperty(value = "处理意见") @ApiModelProperty(value = "处理意见")
private String opinion; private String opinion;
@TableField(exist = false)
private String userName;
@TableField(exist = false)
private String typeName;
@TableField(exist = false)
private String statusName;
} }

View File

@ -1,6 +1,7 @@
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.bean.BeanUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -97,7 +98,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
Audit one = getOne(new LambdaQueryWrapper<Audit>() Audit one = getOne(new LambdaQueryWrapper<Audit>()
.eq(Audit::getPersonnelId, auditRequest.getPersonnelId()) .eq(Audit::getPersonnelId, auditRequest.getPersonnelId())
.eq(Audit::getPerType, auditRequest.getType()) .eq(Audit::getPerType, auditRequest.getType())
.eq(Audit::getAuditOrder, ArgsConst.WAITING) .eq(Audit::getAuditState, ArgsConst.WAITING)
.eq(Audit::getApprover, loginId)); .eq(Audit::getApprover, loginId));
System.out.println("one = " + one); System.out.println("one = " + one);
if (ObjectUtil.isEmpty(one)) { if (ObjectUtil.isEmpty(one)) {
@ -221,6 +222,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
return null; return null;
} }
public void workFlow(String createdId, String type, String personnelId, String args, Boolean flag) { public void workFlow(String createdId, String type, String personnelId, String args, Boolean flag) {
WorkFlowNotice workFlowNotice = new WorkFlowNotice(); WorkFlowNotice workFlowNotice = new WorkFlowNotice();
workFlowNotice.setStatus(Boolean.FALSE); workFlowNotice.setStatus(Boolean.FALSE);
@ -235,6 +237,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
workFlowNotice.setFlowId(personnelId); workFlowNotice.setFlowId(personnelId);
workFlowNoticeService.save(workFlowNotice); workFlowNoticeService.save(workFlowNotice);
} }
public Integer saveAuditLog(String personnelId, String approverId, String type, String auditSate, String opinion) { public Integer saveAuditLog(String personnelId, String approverId, String type, String auditSate, String opinion) {
AuditLog auditLog = new AuditLog(); AuditLog auditLog = new AuditLog();
auditLog.setPersonnelId(personnelId); auditLog.setPersonnelId(personnelId);
@ -282,7 +285,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
return AjaxResult.fail().msg("已拒绝请勿重复审批!"); return AjaxResult.fail().msg("已拒绝请勿重复审批!");
} }
String loginId = StpUtil.getLoginIdAsString(); String loginId = StpUtil.getLoginIdAsString();
Audit one = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getAuditOrder, ArgsConst.WAITING).eq(Audit::getApprover, loginId)); Audit one = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getAuditState, ArgsConst.WAITING).eq(Audit::getApprover, loginId));
if (ObjectUtil.isNull(one)) { if (ObjectUtil.isNull(one)) {
return AjaxResult.fail().msg("该用户不能审批!"); return AjaxResult.fail().msg("该用户不能审批!");
} }
@ -304,9 +307,9 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
if (update) { if (update) {
QueryWrapper<Recruitment> queryWrapper = new QueryWrapper<Recruitment>().eq("company_id", organization.getId()); QueryWrapper<Recruitment> queryWrapper = new QueryWrapper<Recruitment>().eq("company_id", organization.getId());
Long places = recruitmentMapper.recruitmentPlaces(queryWrapper); Long places = recruitmentMapper.recruitmentPlaces(queryWrapper);
// companyNameMapper.update(null, new LambdaUpdateWrapper<CompanyName>().set(CompanyName::getThisApprovalNumber, companyName.getThisApprovalNumber() - places).eq(CompanyName::getId, companyName.getId())); Integer count = personnelMapper.selectCount(new LambdaQueryWrapper<Personnel>().eq(Personnel::getWorkState, "在职").eq(Personnel::getPersonnelType, "指标内").eq(Personnel::getCompanyName, companyName.getId()));
companyNameMapper.update(null, new LambdaUpdateWrapper<CompanyName>().set(CompanyName::getResidualNumber, companyName.getResidualNumber() - places) companyNameMapper.update(null, new LambdaUpdateWrapper<CompanyName>().set(CompanyName::getResidualNumber, companyName.getResidualNumber() - places)
// .set(CompanyName::getResidualNumber, companyName.getResidualNumber() - addNumber) .set(CompanyName::getActiveStaff, count)
// .set(CompanyName::getRecruit, companyName.getCheckNumber() - companyName.getThisApprovalNumber()) // .set(CompanyName::getRecruit, companyName.getCheckNumber() - companyName.getThisApprovalNumber())
.eq(CompanyName::getId, companyName.getId())); .eq(CompanyName::getId, companyName.getId()));
organization.setAuditState(3); organization.setAuditState(3);
@ -376,7 +379,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
return AjaxResult.fail().msg("已拒绝请勿重复审批!"); return AjaxResult.fail().msg("已拒绝请勿重复审批!");
} }
String loginId = StpUtil.getLoginIdAsString(); String loginId = StpUtil.getLoginIdAsString();
Audit one = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getAuditOrder, ArgsConst.WAITING).eq(Audit::getApprover, loginId)); Audit one = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getAuditState, ArgsConst.WAITING).eq(Audit::getApprover, loginId));
if (ObjectUtil.isNull(one)) { if (ObjectUtil.isNull(one)) {
return AjaxResult.fail().msg("该用户不能审批!"); return AjaxResult.fail().msg("该用户不能审批!");
} }
@ -398,9 +401,10 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
one.setApproverTime(new Date()); one.setApproverTime(new Date());
boolean update = updateById(one); boolean update = updateById(one);
if (update) { if (update) {
Integer count = personnelMapper.selectCount(new LambdaQueryWrapper<Personnel>().eq(Personnel::getWorkState, "在职").eq(Personnel::getPersonnelType, "指标内").eq(Personnel::getCompanyName, companyName.getId()));
companyNameMapper.update(null, new LambdaUpdateWrapper<CompanyName>().set(CompanyName::getThisApprovalNumber, companyName.getThisApprovalNumber() - addNumber) companyNameMapper.update(null, new LambdaUpdateWrapper<CompanyName>().set(CompanyName::getThisApprovalNumber, companyName.getThisApprovalNumber() - addNumber)
.set(CompanyName::getResidualNumber, companyName.getResidualNumber() + addNumber) .set(CompanyName::getResidualNumber, companyName.getResidualNumber() + addNumber)
// .set(CompanyName::getResidualNumber, companyName.getResidualNumber() + addNumber) .set(CompanyName::getActiveStaff, count)
.set(CompanyName::getRecruit, companyName.getRecruit() + addNumber) .set(CompanyName::getRecruit, companyName.getRecruit() + addNumber)
.eq(CompanyName::getId, companyName.getId())); .eq(CompanyName::getId, companyName.getId()));
organization.setAuditState(3); organization.setAuditState(3);
@ -460,7 +464,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
return AjaxResult.fail().msg("审批已拒绝请勿重复操作!"); return AjaxResult.fail().msg("审批已拒绝请勿重复操作!");
} }
String loginId = StpUtil.getLoginIdAsString(); String loginId = StpUtil.getLoginIdAsString();
Audit audit = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getAuditOrder, ArgsConst.WAITING).eq(Audit::getApprover, loginId)); Audit audit = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getAuditState, ArgsConst.WAITING).eq(Audit::getApprover, loginId));
if (ObjectUtil.isNull(audit)) { if (ObjectUtil.isNull(audit)) {
return AjaxResult.fail().msg("该用户不能审批!"); return AjaxResult.fail().msg("该用户不能审批!");
} }
@ -485,7 +489,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
WorkFlowNotice workFlowNotice = new WorkFlowNotice(); WorkFlowNotice workFlowNotice = new WorkFlowNotice();
workFlowNotice.setStatus(Boolean.FALSE); workFlowNotice.setStatus(Boolean.FALSE);
workFlowNotice.setFlowType(ArgsConst.DIRECTORS); workFlowNotice.setFlowType(ArgsConst.DIRECTORS);
workFlowNotice.setUserId(byId.getCreatedId()); workFlowNotice.setUserId(recruitment.getCreatedId());
workFlowNotice.setTitle("您的董监申报已通过"); workFlowNotice.setTitle("您的董监申报已通过");
workFlowNotice.setFlowId(auditRequest.getPersonnelId()); workFlowNotice.setFlowId(auditRequest.getPersonnelId());
workFlowNoticeService.save(workFlowNotice); workFlowNoticeService.save(workFlowNotice);
@ -508,7 +512,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
WorkFlowNotice workFlowNotice = new WorkFlowNotice(); WorkFlowNotice workFlowNotice = new WorkFlowNotice();
workFlowNotice.setStatus(Boolean.FALSE); workFlowNotice.setStatus(Boolean.FALSE);
workFlowNotice.setFlowType(ArgsConst.DIRECTORS); workFlowNotice.setFlowType(ArgsConst.DIRECTORS);
workFlowNotice.setUserId(byId.getCreatedId()); workFlowNotice.setUserId(recruitment.getCreatedId());
workFlowNotice.setTitle("您的董监申报已驳回"); workFlowNotice.setTitle("您的董监申报已驳回");
workFlowNotice.setFlowId(auditRequest.getPersonnelId()); workFlowNotice.setFlowId(auditRequest.getPersonnelId());
workFlowNoticeService.save(workFlowNotice); workFlowNoticeService.save(workFlowNotice);
@ -543,7 +547,36 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
@Override @Override
public AjaxResult waitingAudit(Page page) { public AjaxResult waitingAudit(Page page) {
Page selectPage = auditMapper.selectPage(page, Wrappers.lambdaQuery(Audit.class) Page selectPage = auditMapper.selectPage(page, Wrappers.lambdaQuery(Audit.class)
.eq(Audit::getAuditOrder, ArgsConst.WAITING).eq(Audit::getApprover, StpUtil.getLoginIdAsString())); .eq(Audit::getAuditState, ArgsConst.WAITING)
.eq(Audit::getApprover, StpUtil.getLoginIdAsString()));
List<Audit> records = selectPage.getRecords();
records.forEach(e -> {
User user = userMapper.selectById(e.getCreatedId());
if (ObjectUtil.isNotNull(user)) {
e.setUserName(user.getUserName());
}
if (ArgsConst.DIRECTORS.equals(e.getPerType())) {
e.setTypeName("董监申报");
} else if (ArgsConst.RECRUITMENT.equals(e.getPerType())) {
e.setTypeName("招聘登记");
} else if (ArgsConst.PERSONNEL_INDICATORS.equals(e.getPerType())) {
e.setTypeName("指标申报");
} else if (ArgsConst.PERSONNEL.equals(e.getPerType())) {
e.setTypeName("人员申报");
} else if (ArgsConst.CHANGE.equals(e.getPerType())) {
e.setTypeName("人员变更");
}
if (ArgsConst.WAITING.equals(e.getAuditState())) {
e.setStatusName("待处理");
} else if (ArgsConst.SUBMIT.equals(e.getPerType())) {
e.setStatusName("提交");
} else if (ArgsConst.PASS.equals(e.getPerType())) {
e.setStatusName("通过");
} else if (ArgsConst.REJECT.equals(e.getPerType())) {
e.setStatusName("拒绝");
}
});
selectPage.setRecords(records);
return AjaxResult.ok().data(selectPage); return AjaxResult.ok().data(selectPage);
} }
@ -551,7 +584,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
@Override @Override
public Integer counts() { public Integer counts() {
return auditMapper.selectCount(Wrappers.lambdaQuery(Audit.class) return auditMapper.selectCount(Wrappers.lambdaQuery(Audit.class)
.eq(Audit::getAuditOrder, ArgsConst.WAITING).eq(Audit::getApprover, StpUtil.getLoginIdAsString())); .eq(Audit::getAuditState, ArgsConst.WAITING).eq(Audit::getApprover, StpUtil.getLoginIdAsString()));
} }
} }

View File

@ -198,7 +198,8 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
// 领导 // 领导
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP)); Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
User user2 = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue())); User user2 = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue()));
audit.setAuditOrder(ArgsConst.WAITING); audit.setAuditState(ArgsConst.WAITING);
audit.setAuditOrder(ArgsConst.LAST);
audit.setApprover(user2.getId()); audit.setApprover(user2.getId());
directorsSupervisors.setLastId(user2.getUserName()); directorsSupervisors.setLastId(user2.getUserName());
WorkFlowNotice workFlowNotice = new WorkFlowNotice(); WorkFlowNotice workFlowNotice = new WorkFlowNotice();

View File

@ -131,7 +131,8 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
// 领导 // 领导
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP)); Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
User user2 = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue())); User user2 = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue()));
audit.setAuditOrder(ArgsConst.WAITING); audit.setAuditState(ArgsConst.WAITING);
audit.setAuditOrder(ArgsConst.LAST);
audit.setApprover(user2.getId()); audit.setApprover(user2.getId());
organization.setLastId(user2.getUserName()); organization.setLastId(user2.getUserName());
if (ArgsConst.PERSONNEL_INDICATORS.equals(type)) { if (ArgsConst.PERSONNEL_INDICATORS.equals(type)) {

View File

@ -182,7 +182,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
.eq(Audit::getPersonnelId, id) .eq(Audit::getPersonnelId, id)
.eq(Audit::getPerType,personnelType) .eq(Audit::getPerType,personnelType)
.eq(Audit::getApprover, StpUtil.getLoginIdAsString()) .eq(Audit::getApprover, StpUtil.getLoginIdAsString())
.eq(Audit::getAuditOrder, ArgsConst.WAITING); .eq(Audit::getAuditState, ArgsConst.WAITING);
Audit audit = auditMapper.selectOne(wrapper); Audit audit = auditMapper.selectOne(wrapper);
if (ObjectUtil.isNotEmpty(audit)){ if (ObjectUtil.isNotEmpty(audit)){
personnelUpdateDto.setAuditBtn(true); personnelUpdateDto.setAuditBtn(true);