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;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.common.base.BaseEntity;
import io.swagger.annotations.ApiModel;
@ -32,7 +33,7 @@ public class Audit extends BaseEntity{
@ApiModelProperty(value = "审批类型 personnel一般人员 change变更人员, exchange :人员选调")
private String perType;
@ApiModelProperty(value = "审批状态submit提交 pass通过 reject拒绝")
@ApiModelProperty(value = "审批状态submit提交 待处理waiting pass通过 reject拒绝")
private String auditState;
@ApiModelProperty(value = "审批顺序giveAudit送审 first初审 last终审")
@ -47,4 +48,14 @@ public class Audit extends BaseEntity{
@ApiModelProperty(value = "处理意见")
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;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
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>()
.eq(Audit::getPersonnelId, auditRequest.getPersonnelId())
.eq(Audit::getPerType, auditRequest.getType())
.eq(Audit::getAuditOrder, ArgsConst.WAITING)
.eq(Audit::getAuditState, ArgsConst.WAITING)
.eq(Audit::getApprover, loginId));
System.out.println("one = " + one);
if (ObjectUtil.isEmpty(one)) {
@ -221,6 +222,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
return null;
}
public void workFlow(String createdId, String type, String personnelId, String args, Boolean flag) {
WorkFlowNotice workFlowNotice = new WorkFlowNotice();
workFlowNotice.setStatus(Boolean.FALSE);
@ -235,6 +237,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
workFlowNotice.setFlowId(personnelId);
workFlowNoticeService.save(workFlowNotice);
}
public Integer saveAuditLog(String personnelId, String approverId, String type, String auditSate, String opinion) {
AuditLog auditLog = new AuditLog();
auditLog.setPersonnelId(personnelId);
@ -282,7 +285,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
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));
Audit one = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getAuditState, ArgsConst.WAITING).eq(Audit::getApprover, loginId));
if (ObjectUtil.isNull(one)) {
return AjaxResult.fail().msg("该用户不能审批!");
}
@ -304,9 +307,9 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
if (update) {
QueryWrapper<Recruitment> queryWrapper = new QueryWrapper<Recruitment>().eq("company_id", organization.getId());
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)
// .set(CompanyName::getResidualNumber, companyName.getResidualNumber() - addNumber)
.set(CompanyName::getActiveStaff, count)
// .set(CompanyName::getRecruit, companyName.getCheckNumber() - companyName.getThisApprovalNumber())
.eq(CompanyName::getId, companyName.getId()));
organization.setAuditState(3);
@ -376,7 +379,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
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));
Audit one = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getAuditState, ArgsConst.WAITING).eq(Audit::getApprover, loginId));
if (ObjectUtil.isNull(one)) {
return AjaxResult.fail().msg("该用户不能审批!");
}
@ -398,9 +401,10 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
one.setApproverTime(new Date());
boolean update = updateById(one);
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)
.set(CompanyName::getResidualNumber, companyName.getResidualNumber() + addNumber)
// .set(CompanyName::getResidualNumber, companyName.getResidualNumber() + addNumber)
.set(CompanyName::getActiveStaff, count)
.set(CompanyName::getRecruit, companyName.getRecruit() + addNumber)
.eq(CompanyName::getId, companyName.getId()));
organization.setAuditState(3);
@ -460,7 +464,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
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));
Audit audit = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getAuditState, ArgsConst.WAITING).eq(Audit::getApprover, loginId));
if (ObjectUtil.isNull(audit)) {
return AjaxResult.fail().msg("该用户不能审批!");
}
@ -485,7 +489,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
WorkFlowNotice workFlowNotice = new WorkFlowNotice();
workFlowNotice.setStatus(Boolean.FALSE);
workFlowNotice.setFlowType(ArgsConst.DIRECTORS);
workFlowNotice.setUserId(byId.getCreatedId());
workFlowNotice.setUserId(recruitment.getCreatedId());
workFlowNotice.setTitle("您的董监申报已通过");
workFlowNotice.setFlowId(auditRequest.getPersonnelId());
workFlowNoticeService.save(workFlowNotice);
@ -508,7 +512,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
WorkFlowNotice workFlowNotice = new WorkFlowNotice();
workFlowNotice.setStatus(Boolean.FALSE);
workFlowNotice.setFlowType(ArgsConst.DIRECTORS);
workFlowNotice.setUserId(byId.getCreatedId());
workFlowNotice.setUserId(recruitment.getCreatedId());
workFlowNotice.setTitle("您的董监申报已驳回");
workFlowNotice.setFlowId(auditRequest.getPersonnelId());
workFlowNoticeService.save(workFlowNotice);
@ -543,7 +547,36 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
@Override
public AjaxResult waitingAudit(Page page) {
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);
}
@ -551,7 +584,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
@Override
public Integer counts() {
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));
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());
directorsSupervisors.setLastId(user2.getUserName());
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));
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());
organization.setLastId(user2.getUserName());
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::getPerType,personnelType)
.eq(Audit::getApprover, StpUtil.getLoginIdAsString())
.eq(Audit::getAuditOrder, ArgsConst.WAITING);
.eq(Audit::getAuditState, ArgsConst.WAITING);
Audit audit = auditMapper.selectOne(wrapper);
if (ObjectUtil.isNotEmpty(audit)){
personnelUpdateDto.setAuditBtn(true);