update
This commit is contained in:
parent
fb30a7257f
commit
d756a79241
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
@ -120,11 +121,11 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
|
|||
if (ArgsConst.PERSONNEL.equals(auditRequest.getType()) || ArgsConst.CHANGE.equals(auditRequest.getType())) {
|
||||
Personnel personnel = personnelMapper.selectById(auditRequest.getPersonnelId());
|
||||
LambdaQueryWrapper<PersonnelMiddle> wrapper = new LambdaQueryWrapper<PersonnelMiddle>()
|
||||
.eq(PersonnelMiddle::getBeforeId, personnel.getId()).eq(PersonnelMiddle::getType,auditRequest.getType())
|
||||
.eq(PersonnelMiddle::getBeforeId, personnel.getId()).eq(PersonnelMiddle::getType, auditRequest.getType())
|
||||
.eq(PersonnelMiddle::getState, "1");
|
||||
PersonnelMiddle middle = personnelMiddleMapper.selectOne(wrapper);
|
||||
System.out.println("middle = " + middle);
|
||||
if (ObjectUtil.isNotEmpty(middle)){
|
||||
if (ObjectUtil.isNotEmpty(middle)) {
|
||||
Personnel personnelOne = personnelMapper.selectById(middle.getAfterId());
|
||||
personnelOne.setState("2");
|
||||
System.out.println("personnelOne = " + personnelOne);
|
||||
|
@ -133,14 +134,14 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
|
|||
personnelOne.setFinalTrialRemark(auditRequest.getAuditOpinion());
|
||||
personnelOne.setAlterationSign("2");
|
||||
personnelOne.setAuditState(3);
|
||||
workFlow(personnel.getCreatedId(),ArgsConst.PERSONNEL,auditRequest.getPersonnelId(),"企业人员申报",true);
|
||||
workFlow(personnel.getCreatedId(), ArgsConst.PERSONNEL, auditRequest.getPersonnelId(), "企业人员申报", true);
|
||||
}
|
||||
if (ArgsConst.CHANGE.equals(auditRequest.getType())) {
|
||||
System.out.println(" =11111111111111 ");
|
||||
personnelOne.setFinalTrialRemark(auditRequest.getAuditOpinion());
|
||||
personnelOne.setChangeAlterationSign("2");
|
||||
personnelOne.setChangeAuditState(3);
|
||||
workFlow(personnel.getCreatedId(),ArgsConst.CHANGE,auditRequest.getPersonnelId(),"人员变更申报",true);
|
||||
workFlow(personnel.getCreatedId(), ArgsConst.CHANGE, auditRequest.getPersonnelId(), "人员变更申报", true);
|
||||
}
|
||||
String id = personnel.getId();
|
||||
String idOne = personnelOne.getId();
|
||||
|
@ -151,18 +152,18 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
|
|||
personnelMapper.updateById(personnelOne);
|
||||
personnelMapper.updateById(personnel);
|
||||
personnelMiddleMapper.updateById(middle);
|
||||
}else {
|
||||
} else {
|
||||
if (ArgsConst.PERSONNEL.equals(auditRequest.getType())) {
|
||||
personnel.setFinalTrialRemark(auditRequest.getAuditOpinion());
|
||||
personnel.setAlterationSign("2");
|
||||
personnel.setAuditState(3);
|
||||
workFlow(personnel.getCreatedId(),ArgsConst.PERSONNEL,auditRequest.getPersonnelId(),"企业人员申报",true);
|
||||
workFlow(personnel.getCreatedId(), ArgsConst.PERSONNEL, auditRequest.getPersonnelId(), "企业人员申报", true);
|
||||
}
|
||||
if (ArgsConst.CHANGE.equals(auditRequest.getType())) {
|
||||
personnel.setFinalTrialRemark(auditRequest.getAuditOpinion());
|
||||
personnel.setChangeAlterationSign("2");
|
||||
personnel.setChangeAuditState(3);
|
||||
workFlow(personnel.getCreatedId(),ArgsConst.CHANGE,auditRequest.getPersonnelId(),"人员变更申报",true);
|
||||
workFlow(personnel.getCreatedId(), ArgsConst.CHANGE, auditRequest.getPersonnelId(), "人员变更申报", true);
|
||||
}
|
||||
personnel.setState("2");
|
||||
personnelMapper.updateById(personnel);
|
||||
|
@ -179,7 +180,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
|
|||
personnel.setPosition(exchange.getWillPosition());
|
||||
exchangeMapper.updateById(exchange);
|
||||
personnelMapper.updateById(personnel);
|
||||
workFlow(exchange.getCreatedId(),ArgsConst.EXCHANGE,auditRequest.getPersonnelId(),"人员选调申报",true);
|
||||
workFlow(exchange.getCreatedId(), ArgsConst.EXCHANGE, auditRequest.getPersonnelId(), "人员选调申报", true);
|
||||
}
|
||||
}
|
||||
return update ? AjaxResult.ok().msg("审批成功!") : AjaxResult.fail().msg("审批成功!");
|
||||
|
@ -210,7 +211,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
|
|||
exchange.setState("0");
|
||||
exchange.setFinalTrialRemark(auditRequest.getAuditOpinion());
|
||||
exchangeMapper.updateById(exchange);
|
||||
workFlow(exchange.getCreatedId(),ArgsConst.EXCHANGE,exchange.getId(),"人员选调申报",false);
|
||||
workFlow(exchange.getCreatedId(), ArgsConst.EXCHANGE, exchange.getId(), "人员选调申报", false);
|
||||
}
|
||||
for (Audit auditOne : auditList) {
|
||||
delete(auditOne.getId());
|
||||
|
@ -221,20 +222,22 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
|
|||
|
||||
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.setStatus(Boolean.FALSE);
|
||||
workFlowNotice.setFlowType(type);
|
||||
workFlowNotice.setUserId(createdId);
|
||||
if (flag){
|
||||
workFlowNotice.setTitle("您的"+args+"已通过");
|
||||
}else {
|
||||
workFlowNotice.setTitle("您的"+args+"未通过");
|
||||
if (flag) {
|
||||
workFlowNotice.setTitle("您的" + args + "已通过");
|
||||
} else {
|
||||
workFlowNotice.setTitle("您的" + args + "未通过");
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -258,11 +261,11 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
|
|||
Places places = placesMapper.selectOne(new LambdaQueryWrapper<Places>().eq(Places::getOdd, personnel.getRecruitNumber()));
|
||||
places.setStatus(false);
|
||||
placesMapper.updateById(places);
|
||||
workFlow(personnel.getCreatedId(),ArgsConst.PERSONNEL,personnel.getId(),"企业人员申报",false);
|
||||
workFlow(personnel.getCreatedId(), ArgsConst.PERSONNEL, personnel.getId(), "企业人员申报", false);
|
||||
} else if (ArgsConst.CHANGE.equals(type)) {
|
||||
personnel.setChangeAuditState(4);
|
||||
personnel.setChangeAlterationSign("2");
|
||||
workFlow(personnel.getCreatedId(),ArgsConst.CHANGE,personnel.getId(),"人员变更申报",false);
|
||||
workFlow(personnel.getCreatedId(), ArgsConst.CHANGE, personnel.getId(), "人员变更申报", false);
|
||||
}
|
||||
|
||||
personnelMapper.updateById(personnel);
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue