人员选调审核1.0

This commit is contained in:
mash 2023-02-22 17:32:51 +08:00
parent cfdf59fd4b
commit 62c729fa9e
14 changed files with 148 additions and 59 deletions

View File

@ -7,6 +7,7 @@ import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.ExchangePageDto;
import com.ydool.staff.dto.PersonnelByExchangeDto;
import com.ydool.staff.request.ExchangeRequest;
import com.ydool.staff.request.GiveAuditRequest;
import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.service.IExchangeService;
import com.ydool.staff.service.IPersonnelService;
@ -79,4 +80,5 @@ public class ExchangeController extends BaseController {
}
}

View File

@ -52,4 +52,7 @@ public class ExchangePageDto {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@ApiModelProperty(value = "填报时间")
private LocalDateTime createdAt;
@ApiModelProperty(value = "审批状态 0 未送审 1 待人事审批2 待领导审批3已通过4已拒绝 ")
private String auditState;
}

View File

@ -42,6 +42,15 @@ public class PersonnelDto {
@ApiModelProperty(value = "审批状态 0 未审批 1 待审批2已通过3已拒绝")
private Integer auditState;
@ApiModelProperty(value = "变更表变更标志: 0未变更 1变更中 2变更完成")
private String changeAlterationSign;
@ApiModelProperty(value = "变更表审批状态 0 未送审 1 待人事审批2 待领导审批3已通过4已拒绝")
private Integer changeAuditState;
@ApiModelProperty(value = "工作状态")
private String workState;
}

View File

@ -51,7 +51,10 @@ public class Exchange extends BaseEntity{
@ApiModelProperty(value = "选调相关附件")
private String excFile;
@ApiModelProperty(value = "审批状态")
@ApiModelProperty(value = "审批状态 0 未送审 1 待人事审批2 待领导审批3已通过4已拒绝 ")
private String auditState;
@ApiModelProperty(value = "数据状态0历史数据 1当前数据")
private String state;
}

View File

@ -26,7 +26,7 @@ public class AuditRequest {
@ApiModelProperty(value = "审批意见")
private String auditOpinion;
@ApiModelProperty(value = "人员类型personnel人员 change变更")
@ApiModelProperty(value = "人员类型personnel人员 change变更 exchange:选调")
private String type;

View File

@ -17,6 +17,7 @@ public class GiveAuditRequest {
@ApiModelProperty(value = "人员类型personnel 变更change")
private String type;
@ApiModelProperty(value = "修改数据")
private PersonnelUpdateRequest request;
}

View File

@ -18,7 +18,7 @@ public interface IAuditService {
AjaxResult audit(AuditRequest auditRequest);
Integer saveAuditLog(String personnelId,String approverId,String type,String auditSate);
Integer saveAuditLog(String personnelId,String approverId,String type,String auditSate,String opinion);
AjaxResult submitDirectorsSupervisorsAudit(AuditRequest auditRequest);

View File

@ -3,6 +3,7 @@ package com.ydool.staff.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.request.ExchangeRequest;
import com.ydool.staff.request.GiveAuditRequest;
import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.request.PersonnelUpdateRequest;
@ -23,5 +24,6 @@ public interface IExchangeService {
AjaxResult deleteExchangeById(PersonnelDeleteRequest request);
AjaxResult selectById(String id);
}

View File

@ -30,7 +30,7 @@ public class AuditLogServiceImpl extends BaseService<AuditLogMapper, AuditLog> i
@Override
public AjaxResult auditLog(String id) {
List<AuditLog> list = list(new LambdaQueryWrapper<AuditLog>().eq(AuditLog::getPersonnelId, id));
List<AuditLog> list = list(new LambdaQueryWrapper<AuditLog>().eq(AuditLog::getPersonnelId, id).orderByDesc(AuditLog::getCreatedAt));
List<AuditLogDto> auditLogDtos = BeanUtil.copyToList(list, AuditLogDto.class);
for (AuditLogDto auditLogDto : auditLogDtos) {
User user = userMapper.selectById(auditLogDto.getApprover());

View File

@ -50,6 +50,9 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
@Resource
private AuditMapper auditMapper;
@Resource
private ExchangeMapper exchangeMapper;
@Resource
private PersonnelMapper personnelMapper;
@Resource
@ -71,21 +74,18 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
.eq(Audit::getPerType,auditRequest.getType())
.eq(Audit::getAuditOrder, ArgsConst.WAITING)
.eq(Audit::getApprover, loginId));
System.out.println("one = " + one);
one.setOpinion(auditRequest.getAuditOpinion());
one.setApproverTime(new Date());
if(ObjectUtil.isEmpty(one)){
return AjaxResult.fail().msg("该用户不能审批!");
}
if(ArgsConst.PASS.equals(one.getAuditState())){
return AjaxResult.fail().msg("用户已审批,请勿重复操作!");
}
one.setOpinion(auditRequest.getAuditOpinion());
one.setApproverTime(new Date());
//同意
if ("2".equals(auditRequest.getStatus())){
Config director = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
System.out.println("director = " + director);
if (loginUser.getLoginName().equals(director.getParamValue())){
System.out.println("111111111111111");
one.setAuditOrder(ArgsConst.FIRST);
one.setAuditState(ArgsConst.PASS);
boolean update = updateById(one);
@ -96,46 +96,64 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
Audit auditOne = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getApprover, user.getId()).eq(Audit::getPersonnelId, auditRequest.getPersonnelId()));
auditOne.setAuditOrder(ArgsConst.WAITING);
updateById(auditOne);
Personnel personnel = personnelMapper.selectById(auditOne.getPersonnelId());
if (ArgsConst.PERSONNEL.equals(auditRequest.getType())){
personnel.setAuditState(2);
}else if (ArgsConst.CHANGE.equals(auditRequest.getType())){
personnel.setChangeAuditState(2);
if (ArgsConst.PERSONNEL.equals(auditRequest.getType())||ArgsConst.CHANGE.equals(auditRequest.getType())){
Personnel personnel = personnelMapper.selectById(auditOne.getPersonnelId());
if (ArgsConst.PERSONNEL.equals(auditRequest.getType())){
personnel.setAuditState(2);
}else if (ArgsConst.CHANGE.equals(auditRequest.getType())){
personnel.setChangeAuditState(2);
}
personnelMapper.updateById(personnel);
}else if(ArgsConst.EXCHANGE.equals(auditRequest.getType())){
Exchange exchange = exchangeMapper.selectById(auditOne.getPersonnelId());
exchange.setAuditState("2");
exchangeMapper.updateById(exchange);
}
personnelMapper.updateById(personnel);
saveAuditLog(auditRequest.getPersonnelId(),loginId,auditRequest.getType(),"一般初审通过");
saveAuditLog(auditRequest.getPersonnelId(),loginId,auditRequest.getType(),"一般初审通过",auditRequest.getAuditOpinion());
}
return update ? AjaxResult.ok().msg("审批成功!"):AjaxResult.fail().msg("审批成功!");
}
Config leadership = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
System.out.println("leadership = " + leadership);
if (leadership.getParamValue().equals(loginUser.getLoginName())){
System.out.println("22222222222222");
one.setAuditOrder(ArgsConst.LAST);
one.setAuditState(ArgsConst.PASS);
boolean update = updateById(one);
if (update){
saveAuditLog(auditRequest.getPersonnelId(),loginId,auditRequest.getType(),"一般终审通过");
Personnel personnel = personnelMapper.selectById(auditRequest.getPersonnelId());
PersonnelMiddle middle = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>().eq(PersonnelMiddle::getBeforeId, personnel.getId()).eq(PersonnelMiddle::getState, "1"));
Personnel personnelOne = personnelMapper.selectById(middle.getAfterId());
String id = personnelOne.getId();
personnelOne.setState("2");
if (ArgsConst.PERSONNEL.equals(auditRequest.getType())){
personnelOne.setAlterationSign("2");
personnelOne.setAuditState(3);
saveAuditLog(auditRequest.getPersonnelId(),loginId,auditRequest.getType(),"一般终审通过",auditRequest.getAuditOpinion());
if (ArgsConst.PERSONNEL.equals(auditRequest.getType())||ArgsConst.CHANGE.equals(auditRequest.getType())){
Personnel personnel = personnelMapper.selectById(auditRequest.getPersonnelId());
PersonnelMiddle middle = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>().eq(PersonnelMiddle::getBeforeId, personnel.getId()).eq(PersonnelMiddle::getState, "1"));
Personnel personnelOne = personnelMapper.selectById(middle.getAfterId());
String id = personnelOne.getId();
personnelOne.setState("2");
if (ArgsConst.PERSONNEL.equals(auditRequest.getType())){
personnelOne.setAlterationSign("2");
personnelOne.setAuditState(3);
}
if (ArgsConst.CHANGE.equals(auditRequest.getType())){
personnelOne.setChangeAlterationSign("2");
personnelOne.setChangeAuditState(3);
}
personnelOne.setId(personnel.getId());
personnel.setId(id);
personnel.setState("0");
middle.setState("0");
personnelMapper.updateById(personnelOne);
personnelMapper.updateById(personnel);
personnelMiddleMapper.updateById(middle);
}else if (ArgsConst.EXCHANGE.equals(auditRequest.getType())){
Exchange exchange = exchangeMapper.selectOne(new LambdaQueryWrapper<Exchange>().eq(Exchange::getState,"1").eq(Exchange::getId,auditRequest.getPersonnelId()));
exchange.setAuditState("3");
exchange.setState("0");
Personnel personnel = personnelMapper.selectById(exchange.getPersonnelId());
personnel.setCompanyName(exchange.getWillCompanyId());
personnel.setPresentDept(exchange.getWillDept());
personnel.setPosition(exchange.getWillPosition());
exchangeMapper.updateById(exchange);
personnelMapper.updateById(personnel);
}
if (ArgsConst.CHANGE.equals(auditRequest.getType())){
personnelOne.setChangeAlterationSign("2");
personnelOne.setChangeAuditState(3);
}
personnelOne.setId(personnel.getId());
personnel.setId(id);
personnel.setState("0");
middle.setState("0");
personnelMapper.updateById(personnelOne);
personnelMapper.updateById(personnel);
personnelMiddleMapper.updateById(middle);
}
return update ? AjaxResult.ok().msg("审批成功!"):AjaxResult.fail().msg("审批成功!");
}
@ -147,14 +165,22 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
PersonnelMiddle middle = personnelMiddleMapper.selectOne(new LambdaQueryWrapper<PersonnelMiddle>().eq(PersonnelMiddle::getBeforeId, auditRequest.getPersonnelId()).eq(PersonnelMiddle::getState, "1"));
Personnel afterPersonnel = personnelMapper.selectById(middle.getAfterId());
Personnel personnel = personnelMapper.selectById(auditRequest.getPersonnelId());
Exchange exchange = exchangeMapper.selectById(auditRequest.getPersonnelId());
if (loginUser.getLoginName().equals(director.getParamValue())){
one.setAuditOrder(ArgsConst.REJECT);
one.setOpinion(auditRequest.getAuditOpinion());
boolean update = updateById(one);
if (update){
saveAuditLog(auditRequest.getPersonnelId(),loginId,auditRequest.getType(),"一般初审拒绝");
updateByPer(afterPersonnel.getId(),personnel,auditRequest.getType());
saveAuditLog(auditRequest.getPersonnelId(),loginId,auditRequest.getType(),"一般初审拒绝",auditRequest.getAuditOpinion());
if (ArgsConst.PERSONNEL.equals(auditRequest.getType())||ArgsConst.CHANGE.equals(auditRequest.getType())){
updateByPer(afterPersonnel.getId(),personnel,auditRequest.getType());
}
if(ArgsConst.EXCHANGE.equals(auditRequest.getType())){
exchange.setAuditState("4");
exchange.setState("0");
exchangeMapper.updateById(exchange);
}
for (Audit auditOne : auditList) {
delete(auditOne.getId());
}
@ -167,8 +193,14 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
one.setOpinion(auditRequest.getAuditOpinion());
boolean update = updateById(one);
if (update){
saveAuditLog(auditRequest.getPersonnelId(),loginId,auditRequest.getType(),"一般终审拒绝");
updateByPer(afterPersonnel.getId(),personnel,auditRequest.getType());
saveAuditLog(auditRequest.getPersonnelId(),loginId,auditRequest.getType(),"一般终审拒绝",auditRequest.getAuditOpinion());
if (ArgsConst.PERSONNEL.equals(auditRequest.getType())||ArgsConst.CHANGE.equals(auditRequest.getType())){
updateByPer(afterPersonnel.getId(),personnel,auditRequest.getType());
}else if(ArgsConst.EXCHANGE.equals(auditRequest.getType())){
exchange.setAuditState("4");
exchange.setState("0");
exchangeMapper.updateById(exchange);
}
for (Audit auditOne : auditList) {
delete(auditOne.getId());
}
@ -178,10 +210,11 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
return null;
}
public Integer saveAuditLog(String personnelId,String approverId,String type,String auditSate){
public Integer saveAuditLog(String personnelId,String approverId,String type,String auditSate,String opinion){
AuditLog auditLog = new AuditLog();
auditLog.setPersonnelId(personnelId);
auditLog.setType(type);
auditLog.setOpinion(opinion);
auditLog.setApprover(approverId);
auditLog.setAuditState(auditSate);
return auditLogMapper.insert(auditLog);

View File

@ -179,7 +179,7 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
}
directorsSupervisors.setAuditState(1);
updateById(directorsSupervisors);
Integer a = auditService.saveAuditLog(id, loginId, type,"送审");
Integer a = auditService.saveAuditLog(id, loginId, type,"送审","");
return a > 0 ? AjaxResult.ok().msg("送审成功!") : AjaxResult.fail().msg("送审失败!");
}
}

View File

@ -9,12 +9,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.base.BaseService;
import com.ydool.common.cache.ConfigCache;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.AttachmentDto;
import com.ydool.staff.dto.ExchangeOneDto;
import com.ydool.staff.dto.ExchangePageDto;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.Audit;
import com.ydool.staff.entity.CompanyName;
import com.ydool.staff.entity.Exchange;
import com.ydool.staff.entity.Personnel;
@ -23,10 +25,13 @@ import com.ydool.staff.mapper.CompanyNameMapper;
import com.ydool.staff.mapper.ExchangeMapper;
import com.ydool.staff.mapper.PersonnelMapper;
import com.ydool.staff.request.ExchangeRequest;
import com.ydool.staff.request.GiveAuditRequest;
import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.service.IExchangeService;
import com.ydool.system.entity.Config;
import com.ydool.system.entity.Dept;
import com.ydool.system.entity.User;
import com.ydool.system.mapper.ConfigMapper;
import com.ydool.system.mapper.DeptMapper;
import com.ydool.system.mapper.UserMapper;
import org.springframework.stereotype.Service;
@ -36,6 +41,7 @@ import org.thymeleaf.util.StringUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@ -64,10 +70,13 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
private CompanyNameMapper companyNameMapper;
@Resource
private UserMapper userMapper;
@Resource
private ConfigMapper configMapper;
@Override
public AjaxResult exchangePage(Page page,String userName,String numberId,String willCompanyName,String companyName,String receipts) {
QueryWrapper<Exchange> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(StrUtil.isNotBlank(willCompanyName),Exchange::getWillCompanyId,willCompanyName)
wrapper.lambda().eq(StrUtil.isNotBlank(willCompanyName),Exchange::getWillCompanyId,willCompanyName).eq(Exchange::getState,"1")
.exists(StrUtil.isNotBlank(companyName),
"select p.id from t_lc_personnel p where t_lc_exchange.personnel_id = p.id and p.company_name = " +"'"+ companyName+"'")
.exists(StrUtil.isNotBlank(receipts),
@ -185,5 +194,6 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
return AjaxResult.ok().data(exchangeOneDto);
}
}

View File

@ -105,7 +105,7 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
extracted(id, type, loginId);
organization.setAuditState(1);
updateById(organization);
Integer i = auditService.saveAuditLog(id, loginId, type,"送审");
Integer i = auditService.saveAuditLog(id, loginId, type,"送审","");
return i > 0 ? AjaxResult.ok().msg("送审成功!") : AjaxResult.ok().msg("送审失败!");
}
@ -153,7 +153,7 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
extracted(id, type, loginId);
organization.setAuditState(1);
personnelIndicatorsMapper.updateById(organization);
Integer i = auditService.saveAuditLog(id, loginId, type,"送审");
Integer i = auditService.saveAuditLog(id, loginId, type,"送审","");
return i > 0 ? AjaxResult.ok().msg("送审成功!") : AjaxResult.ok().msg("送审失败!");
}
}

View File

@ -24,6 +24,7 @@ import com.ydool.staff.entity.Alteration;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.Audit;
import com.ydool.staff.entity.CompanyName;
import com.ydool.staff.entity.Exchange;
import com.ydool.staff.entity.Personnel;
import com.ydool.staff.entity.PersonnelMiddle;
import com.ydool.staff.entity.SelectRequest;
@ -34,6 +35,7 @@ import com.ydool.staff.mapper.AlterationMapper;
import com.ydool.staff.mapper.AuditLogMapper;
import com.ydool.staff.mapper.AuditMapper;
import com.ydool.staff.mapper.CompanyNameMapper;
import com.ydool.staff.mapper.ExchangeMapper;
import com.ydool.staff.mapper.PersonnelMapper;
import com.ydool.staff.mapper.PersonnelMiddleMapper;
import com.ydool.staff.request.AttachmentRequest;
@ -109,6 +111,8 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
private IPersonnelMiddleService personnelMiddleService;
@Resource
private PersonnelMiddleMapper personnelMiddleMapper;
@Resource
private ExchangeMapper exchangeMapper;
/**
@ -126,6 +130,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
CompanyName companyName = companyNameMapper.selectById(e.getCompanyName());
Dept dept = deptMapper.selectById(e.getPresentDept());
dto.setAlterationSign("0".equals(e.getAlterationSign())?"未变更":("1".equals(e.getAlterationSign())?"变更中":"变更完成"));
dto.setChangeAlterationSign("0".equals(e.getChangeAlterationSign())?"未变更":("1".equals(e.getChangeAlterationSign())?"变更中":"变更完成"));
if (ObjectUtil.isNotNull(companyName)){
dto.setCompanyName(companyName.getCompanyName());
}
@ -521,7 +526,10 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Transactional(rollbackFor = Exception.class)
public AjaxResult giveAudit(GiveAuditRequest request) {
String[] ids = request.getIds();
verifyIds(ids,request.getType());
String s = verifyIds(ids, request.getType());
if (StrUtil.isNotBlank(s)){
return AjaxResult.fail().msg(s);
}
String loginId = (String) StpUtil.getLoginId();
for (String id : ids) {
for(int i=0;i<=2;i++ ){
@ -547,10 +555,17 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
}
auditMapper.insert(audit);
}
Personnel personnel = get(id);
personnel.setAuditState(1);
updateById(personnel);
auditService.saveAuditLog(id, loginId,request.getType(), "一般送审提交");
if (ArgsConst.PERSONNEL.equals(request.getType())||ArgsConst.CHANGE.equals(request.getType())){
Personnel personnel = get(id);
personnel.setAuditState(1);
updateById(personnel);
}
if (ArgsConst.EXCHANGE.equals(request.getType())){
Exchange exchange = exchangeMapper.selectById(id);
exchange.setAuditState("1");
exchangeMapper.updateById(exchange);
}
auditService.saveAuditLog(id, loginId,request.getType(), "一般送审提交","");
}
if (ids.length==1){
@ -581,26 +596,37 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
}
public AjaxResult verifyIds(String[] ids,String type){
public String verifyIds(String[] ids,String type){
String message = "";
for (String id : ids) {
Personnel personnel = get(id);
if (ArgsConst.PERSONNEL.equals(type)){
Personnel personnel = get(id);
if (1 == (personnel.getAuditState())) {
return AjaxResult.fail().msg("该数据已送审请勿重复操作!");
return message="该数据已送审请勿重复操作!";
}
if ("0".equals(personnel.getAlterationSign())) {
return AjaxResult.fail().msg("变更数据未保存,不能送审!");
return message="变更数据未保存,不能送审!";
}
}else if (ArgsConst.CHANGE.equals(type)){
Personnel personnel = get(id);
if (1 == (personnel.getChangeAuditState())) {
return AjaxResult.fail().msg("该数据已送审请勿重复操作!");
return message="该数据已送审请勿重复操作!";
}
if ("0".equals(personnel.getChangeAlterationSign())) {
return AjaxResult.fail().msg("变更数据未保存,不能送审!");
return message="变更数据未保存,不能送审!";
}
}else if (ArgsConst.EXCHANGE.equals(type)) {
Exchange exchange = exchangeMapper.selectById(id);
Personnel personnel = get(exchange.getPersonnelId());
if ("1".equals(personnel.getAlterationSign())||"1".equals(personnel.getChangeAlterationSign())){
return message="该人员有变更数据,不能进行选调!";
}
if ("1".equals(exchange.getAuditState())) {
return message="该数据已送审请勿重复操作!";
}
}
}
return null;
return message;
}