This commit is contained in:
zhuyy 2023-02-22 17:54:20 +08:00
parent 62c729fa9e
commit 59f90ca9a0
20 changed files with 271 additions and 77 deletions

View File

@ -81,4 +81,13 @@ public class AuditController extends BaseController {
return AjaxResult.fail().msg("审批状态错误");
}
@PostMapping("submitPersonnelIndicatorsAudit")
@ApiOperation(value = "人员指标申报审批 同意/拒绝")
public AjaxResult submitPersonnelIndicatorsAudit(@RequestBody AuditRequest auditRequest) {
if ("2".equals(auditRequest.getStatus()) || "3".equals(auditRequest.getStatus())) {
return auditService.submitPersonnelIndicatorsAudit(auditRequest);
}
return AjaxResult.fail().msg("审批状态错误");
}
}

View File

@ -55,6 +55,6 @@ public class OrganizationController extends BaseController {
@ApiOperation(value = "人员指标申报送审")
@ApiImplicitParams({@ApiImplicitParam(value = "申报id", name = "id")})
public AjaxResult submitPersonnelIndicators(String id) {
return organizationService.submitPersonnelIndicators(id, ArgsConst.PERSONNEL_INDICATORS);
return organizationService.submitRecruitment(id, ArgsConst.PERSONNEL_INDICATORS);
}
}

View File

@ -1,5 +1,6 @@
package com.ydool.staff.dto;
import com.ydool.staff.entity.CompanyName;
import com.ydool.staff.entity.Organization;
import com.ydool.staff.entity.PersonnelIndicators;
import io.swagger.annotations.ApiModelProperty;
@ -19,7 +20,7 @@ import java.util.List;
public class PersonnelIndicatorsDto implements Serializable {
@ApiModelProperty(value = "企业信息")
private Organization organization;
private CompanyName organization;
@ApiModelProperty(value = "人员指标申报")
private List<PersonnelIndicators> personnelIndicators;

View File

@ -1,5 +1,6 @@
package com.ydool.staff.dto;
import com.ydool.staff.entity.CompanyName;
import com.ydool.staff.entity.Organization;
import com.ydool.staff.entity.Recruitment;
import io.swagger.annotations.ApiModelProperty;
@ -12,7 +13,7 @@ import java.util.List;
public class RecruitmentDto implements Serializable {
@ApiModelProperty(value = "企业信息")
private Organization organization;
private CompanyName organization;
@ApiModelProperty(value = "人员招聘登记")
private List<Recruitment> recruitments;

View File

@ -35,7 +35,7 @@ public class CompanyName extends BaseEntity {
@ApiModelProperty(value = "审批单号")
private String approvalNumber;
@ApiModelProperty(value = "核定指标人数")
@ApiModelProperty(value = "核定用工指标人数")
private Long checkNumber;
@ApiModelProperty(value = "在职人数")
@ -44,7 +44,7 @@ public class CompanyName extends BaseEntity {
@ApiModelProperty(value = "剩余指标人数")
private Long residueNumber;
@ApiModelProperty(value = "本次核定总人数")
@ApiModelProperty(value = "本次核准后总指标人数")
private Long thisApprovalNumber;
@ApiModelProperty(value = "类型 登记organization 申报personnel_indicators")

View File

@ -2,6 +2,7 @@ package com.ydool.staff.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ydool.common.base.BaseEntity;
import java.util.Date;
@ -106,12 +107,26 @@ public class DirectorsSupervisors extends BaseEntity {
@ApiModelProperty(value = "单据状态")
private String documentStatus;
@ApiModelProperty(value = "初审人")
private String firstId;
@ApiModelProperty(value = "初审意见")
private String firstTrial;
@ApiModelProperty(value = "初审时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date firstTime;
@ApiModelProperty(value = "终审人")
private String lastId;
@ApiModelProperty(value = "终审意见")
private String lastInstance;
@ApiModelProperty(value = "终审时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date lastTime;
@ApiModelProperty(value = "审批状态 0 未审批 1 待审批2已通过3已拒绝")
private Integer auditState;

View File

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

View File

@ -1,6 +1,7 @@
package com.ydool.staff.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ydool.common.base.BaseEntity;
import com.ydool.staff.request.AttachmentRequest;
import io.swagger.annotations.ApiModel;
@ -9,6 +10,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
/**
@ -61,15 +63,29 @@ public class Organization extends BaseEntity{
@ApiModelProperty(value = "单据状态")
private String documentStatus;
@ApiModelProperty(value = "审批状态 0 未审批 1 待审批2已通过3已拒绝\n")
@ApiModelProperty(value = "审批状态 0 未送审 1 待人事审批2 待领导审批3 已通过4 已拒绝")
private Integer auditState;
@ApiModelProperty(value = "初审人")
private String firstId;
@ApiModelProperty(value = "初审意见")
private String firstTrial;
@ApiModelProperty(value = "初审时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date firstTime;
@ApiModelProperty(value = "终审人")
private String lastId;
@ApiModelProperty(value = "终审意见")
private String lastInstance;
@ApiModelProperty(value = "终审时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date lastTime;
@ApiModelProperty(value = "修改人")
@TableField(exist = false)
private String updatedName;

View File

@ -38,10 +38,10 @@ public class PersonnelIndicators extends BaseEntity {
private String indexExplain;
@ApiModelProperty(value = "标准指标人数")
private String standardNumber;
private Long standardNumber;
@ApiModelProperty(value = "增加指标人数")
private String addNumber;
private Long addNumber;
@ApiModelProperty(value = "初审意见")
private String firstTrial;

View File

@ -39,7 +39,7 @@ public class Recruitment extends BaseEntity {
private String position;
@ApiModelProperty(value = "名额")
private String places;
private Long places;
@ApiModelProperty(value = "条件要求")
private String requirements;

View File

@ -3,6 +3,7 @@ package com.ydool.staff.mapper;
import com.ydool.staff.entity.PersonnelIndicators;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
/**
* <p>
@ -15,4 +16,19 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface PersonnelIndicatorsMapper extends MPJBaseMapper<PersonnelIndicators> {
/**
* 统计要求增加指标人数
* @param id
* @return
*/
@Select("SELECT sum(standard_number) standard_number FROM `t_lc_personnel_indicators` where organization_id = '#{id}'")
Long personnelIndicatorsStandardNumber(String id);
/**
* 统计核准指标人数
* @param id
* @return
*/
@Select("SELECT sum(add_number) add_number FROM `t_lc_personnel_indicators` where organization_id = '#{id}'")
Long personnelIndicatorsAddNumber(String id);
}

View File

@ -5,6 +5,7 @@ import com.github.yulichang.base.MPJBaseMapper;
import com.ydool.staff.request.CompanyNameRequest;
import com.ydool.staff.request.RecruitmentRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@ -24,4 +25,8 @@ public interface RecruitmentMapper extends MPJBaseMapper<Recruitment> {
// + "from t_lc_company_name c ,t_lc_recruitment r where c.id = r.company_id")
@Select("select c.id,c.company_name,c.check_number,c.active_staff,c.residue_number from t_lc_company_name c,t_lc_recruitment r where c.id = r.company_id")
List<CompanyNameRequest> recruitmentList();
@Select("SELECT SUM(places) places FROM `t_lc_recruitment` WHERE company_id = #{companyId}")
Long recruitmentPlaces(String companyId);
}

View File

@ -23,5 +23,7 @@ public interface IAuditService {
AjaxResult submitDirectorsSupervisorsAudit(AuditRequest auditRequest);
AjaxResult submitRecruitmentAudit(AuditRequest auditRequest);
AjaxResult submitPersonnelIndicatorsAudit(AuditRequest auditRequest);
}

View File

@ -23,6 +23,5 @@ public interface IOrganizationService {
AjaxResult submitRecruitment(String id, String type);
AjaxResult submitPersonnelIndicators(String id, String type);
}

View File

@ -4,6 +4,7 @@ import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.query.MPJQueryWrapper;
import com.ydool.common.base.BaseService;
import com.ydool.common.cache.ConfigCache;
import com.ydool.common.constant.ArgsConst;
@ -12,7 +13,6 @@ import com.ydool.staff.entity.*;
import com.ydool.staff.mapper.*;
import com.ydool.staff.request.AuditRequest;
import com.ydool.staff.service.IAuditService;
import com.ydool.staff.service.IPersonnelService;
import com.ydool.system.entity.Config;
import com.ydool.system.entity.User;
import com.ydool.system.mapper.ConfigMapper;
@ -57,6 +57,12 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
private PersonnelMapper personnelMapper;
@Resource
private PersonnelMiddleMapper personnelMiddleMapper;
@Autowired
PersonnelIndicatorsMapper personnelIndicatorsMapper;
@Autowired
CompanyNameMapper companyNameMapper;
@Autowired
RecruitmentMapper recruitmentMapper;
@Override
public AjaxResult getAuditList(Page page) {
@ -106,7 +112,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
personnelMapper.updateById(personnel);
}else if(ArgsConst.EXCHANGE.equals(auditRequest.getType())){
Exchange exchange = exchangeMapper.selectById(auditOne.getPersonnelId());
exchange.setAuditState("2");
exchange.setAuditState(2);
exchangeMapper.updateById(exchange);
}
saveAuditLog(auditRequest.getPersonnelId(),loginId,auditRequest.getType(),"一般初审通过",auditRequest.getAuditOpinion());
@ -145,7 +151,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
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.setAuditState(3);
exchange.setState("0");
Personnel personnel = personnelMapper.selectById(exchange.getPersonnelId());
personnel.setCompanyName(exchange.getWillCompanyId());
@ -177,7 +183,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
updateByPer(afterPersonnel.getId(),personnel,auditRequest.getType());
}
if(ArgsConst.EXCHANGE.equals(auditRequest.getType())){
exchange.setAuditState("4");
exchange.setAuditState(4);
exchange.setState("0");
exchangeMapper.updateById(exchange);
}
@ -197,7 +203,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
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.setAuditState(4);
exchange.setState("0");
exchangeMapper.updateById(exchange);
}
@ -210,6 +216,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
return null;
}
public Integer saveAuditLog(String personnelId,String approverId,String type,String auditSate,String opinion){
AuditLog auditLog = new AuditLog();
auditLog.setPersonnelId(personnelId);
@ -219,6 +226,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
auditLog.setAuditState(auditSate);
return auditLogMapper.insert(auditLog);
}
public void updateByPer(String afterId,Personnel personnel,String type){
delete(afterId);
if (ArgsConst.PERSONNEL.equals(type)){
@ -234,14 +242,16 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
/**
* 招聘登记
*
* @param auditRequest
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult submitRecruitmentAudit(AuditRequest auditRequest) {
Organization recruitment = organizationMapper.selectById(auditRequest.getPersonnelId());
if (3 == recruitment.getAuditState()) {
Organization organization = organizationMapper.selectById(auditRequest.getPersonnelId());
if (3 == organization.getAuditState()) {
return AjaxResult.fail().msg("已拒绝请勿重复审批!");
}
String loginId = StpUtil.getLoginIdAsString();
@ -265,20 +275,29 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
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());
organizationMapper.updateById(recruitment);
organization.setAuditState(2);
organization.setFirstTime(new Date());
organization.setFirstTrial(auditRequest.getAuditOpinion());
organizationMapper.updateById(organization);
}
return update ? AjaxResult.ok().msg("人事审批成功!") : AjaxResult.fail().msg("人事审批失败!");
}
// 领导终审批同意
if (leadership.getParamValue().equals(byId.getLoginName())) {
CompanyName companyName = companyNameMapper.selectOne(new LambdaQueryWrapper<CompanyName>().eq(CompanyName::getId, organization.getCompanyId()));
Long places = recruitmentMapper.selectOne(new MPJQueryWrapper<Recruitment>().select(" SUM(places) places ").eq("company_id", organization.getId())).getPlaces();
one.setAuditOrder(ArgsConst.LAST);
one.setAuditState(ArgsConst.PASS);
boolean update = updateById(one);
if (update) {
recruitment.setAuditState(2);
recruitment.setLastInstance(auditRequest.getAuditOpinion());
organizationMapper.updateById(recruitment);
companyName.setResidueNumber(companyName.getCheckNumber() - places);
companyName.setThisApprovalNumber(organization.getThisApprovalNumber());
companyNameMapper.updateById(companyName);
organization.setAuditState(3);
organization.setResidualNumber(companyName.getResidueNumber());
organization.setLastTime(new Date());
organization.setLastInstance(auditRequest.getAuditOpinion());
organizationMapper.updateById(organization);
}
return update ? AjaxResult.ok().msg("领导审批成功!") : AjaxResult.fail().msg("领导审批失败!");
}
@ -290,9 +309,10 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
one.setAuditState(ArgsConst.REJECT);
boolean update = updateById(one);
if (update) {
recruitment.setAuditState(3);
recruitment.setFirstTrial(auditRequest.getAuditOpinion());
organizationMapper.updateById(recruitment);
organization.setAuditState(4);
organization.setFirstTime(new Date());
organization.setFirstTrial(auditRequest.getAuditOpinion());
organizationMapper.updateById(organization);
}
return update ? AjaxResult.ok().msg("人事审批拒绝!") : AjaxResult.fail().msg("人事审批失败!");
}
@ -302,9 +322,10 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
one.setAuditState(ArgsConst.REJECT);
boolean update = updateById(one);
if (update) {
recruitment.setAuditState(3);
recruitment.setLastInstance(auditRequest.getAuditOpinion());
organizationMapper.updateById(recruitment);
organization.setAuditState(4);
organization.setLastTime(new Date());
organization.setLastInstance(auditRequest.getAuditOpinion());
organizationMapper.updateById(organization);
}
return update ? AjaxResult.ok().msg("领导审批拒绝!") : AjaxResult.fail().msg("领导审批失败!");
}
@ -312,6 +333,107 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
return null;
}
/**
* 指标申报
*
* @param auditRequest
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult submitPersonnelIndicatorsAudit(AuditRequest auditRequest) {
Organization organization = organizationMapper.selectById(auditRequest.getPersonnelId());
if (3 == organization.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::getAuditOrder, ArgsConst.LAST));
one1.setAuditOrder(ArgsConst.WAITING);
updateById(one1);
organization.setAuditState(2);
organization.setFirstTime(new Date());
organization.setFirstTrial(auditRequest.getAuditOpinion());
organizationMapper.updateById(organization);
}
return update ? AjaxResult.ok().msg("人事审批成功!") : AjaxResult.fail().msg("人事审批失败!");
}
// 领导终审批同意
if (leadership.getParamValue().equals(byId.getLoginName())) {
//统计核准指标人数
Long addNumber = personnelIndicatorsMapper.selectOne(new MPJQueryWrapper<PersonnelIndicators>().select(" SUM(add_number) addNumber ").eq("organization_id", organization.getId())).getAddNumber();
//统计要求增加指标人数
Long standardNumber = personnelIndicatorsMapper.selectOne(new MPJQueryWrapper<PersonnelIndicators>().select(" SUM(standard_number) standardNumber ").eq("organization_id", organization.getId())).getStandardNumber();
Long thisApprovalNumber = organizationMapper.selectOne(new MPJQueryWrapper<Organization>().select(" SUM(this_approval_number) thisApprovalNumber ").eq("company_id", organization.getCompanyId()).eq("type", ArgsConst.PERSONNEL_INDICATORS)).getThisApprovalNumber();
CompanyName companyName = companyNameMapper.selectOne(new LambdaQueryWrapper<CompanyName>().eq(CompanyName::getId, organization.getCompanyId()));
one.setAuditOrder(ArgsConst.LAST);
one.setAuditState(ArgsConst.PASS);
boolean update = updateById(one);
if (update) {
//原核定用工指标人数
companyName.setCheckNumber(addNumber + companyName.getCheckNumber());
//本次核准后总指标人数
companyName.setThisApprovalNumber(standardNumber + companyName.getThisApprovalNumber());
companyNameMapper.updateById(companyName);
organization.setCheckNumber(companyName.getCheckNumber());
organization.setThisApprovalNumber(thisApprovalNumber);
organization.setAuditState(3);
organization.setLastTime(new Date());
organization.setLastInstance(auditRequest.getAuditOpinion());
organizationMapper.updateById(organization);
}
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) {
organization.setAuditState(4);
organization.setFirstTime(new Date());
organization.setFirstTrial(auditRequest.getAuditOpinion());
organizationMapper.updateById(organization);
}
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) {
organization.setAuditState(4);
organization.setLastTime(new Date());
organization.setLastInstance(auditRequest.getAuditOpinion());
organizationMapper.updateById(organization);
}
return update ? AjaxResult.ok().msg("领导审批拒绝!") : AjaxResult.fail().msg("领导审批失败!");
}
}
return null;
}
/**
* 董监审批
*
@ -345,6 +467,8 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
Audit one1 = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getAuditOrder, ArgsConst.LAST));
one1.setAuditOrder(ArgsConst.WAITING);
updateById(one1);
recruitment.setAuditState(2);
recruitment.setFirstTime(new Date());
recruitment.setFirstTrial(auditRequest.getAuditOpinion());
directorsSupervisorsMapper.updateById(recruitment);
}
@ -356,7 +480,8 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
audit.setAuditState(ArgsConst.PASS);
boolean update = updateById(audit);
if (update) {
recruitment.setAuditState(2);
recruitment.setAuditState(3);
recruitment.setLastTime(new Date());
recruitment.setLastInstance(auditRequest.getAuditOpinion());
directorsSupervisorsMapper.updateById(recruitment);
}
@ -369,7 +494,8 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
audit.setAuditState(ArgsConst.REJECT);
boolean update = updateById(audit);
if (update) {
recruitment.setAuditState(3);
recruitment.setAuditState(4);
recruitment.setFirstTime(new Date());
recruitment.setFirstTrial(auditRequest.getAuditOpinion());
directorsSupervisorsMapper.updateById(recruitment);
}
@ -381,7 +507,8 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
audit.setAuditState(ArgsConst.REJECT);
boolean update = updateById(audit);
if (update) {
recruitment.setAuditState(3);
recruitment.setAuditState(4);
recruitment.setLastTime(new Date());
recruitment.setLastInstance(auditRequest.getAuditOpinion());
directorsSupervisorsMapper.updateById(recruitment);
}

View File

@ -123,6 +123,8 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
return AjaxResult.fail().msg("Id不能为空");
} else {
int i = directorsSupervisorsMapper.deleteBatchIds(asList);
attachmentMapper.delete(new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetType, ArgsConst.DIRECTORS).in(Attachment::getTargetId, asList));
auditMapper.delete(new LambdaQueryWrapper<Audit>().eq(Audit::getPerType, ArgsConst.DIRECTORS).in(Audit::getPersonnelId, asList));
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
}
}
@ -145,6 +147,10 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
return AjaxResult.fail().msg("id不能为空");
}
Page<Attachment> attachmentPage = attachmentMapper.selectPage(page, new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, id).eq(Attachment::getTargetType, ArgsConst.DIRECTORS));
for (Attachment record : attachmentPage.getRecords()) {
record.setCreatedId(userMapper.selectById(record.getCreatedId()).getUserName());
record.setUpdatedId(userMapper.selectById(record.getUpdatedId()).getUserName());
}
return AjaxResult.ok().data(attachmentPage);
}
@ -160,20 +166,27 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
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));
User user1 = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue()));
audit.setAuditOrder(ArgsConst.WAITING);
audit.setApprover(userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue())).getId());
audit.setApprover(user1.getId());
audit.setApproverTime(new Date());
directorsSupervisors.setFirstId(user1.getUserName());
} else if (i == 2) {
// 领导
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.LAST);
audit.setApprover(userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue())).getId());
audit.setApprover(user2.getId());
audit.setApproverTime(new Date());
directorsSupervisors.setLastId(user2.getUserName());
}
auditMapper.insert(audit);
}

View File

@ -64,6 +64,7 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
organizationLambdaQueryWrapper.ge(StrUtil.isNotBlank(organizationSearch.getCreatedAt()), Organization::getCreatedAt, organizationSearch.getCreatedAt());
organizationLambdaQueryWrapper.le(StrUtil.isNotBlank(organizationSearch.getUpdatedAt()), Organization::getUpdatedAt, organizationSearch.getUpdatedAt());
organizationLambdaQueryWrapper.eq(Organization::getType, organizationSearch.getType());
organizationLambdaQueryWrapper.orderByDesc(Organization::getCreatedAt);
Page<Organization> selectPage = organizationMapper.selectPage(page, organizationLambdaQueryWrapper);
for (Organization record : selectPage.getRecords()) {
record.setCompanyId(companyNameMapper.selectById(record.getCompanyId()).getCompanyName());
@ -82,6 +83,8 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
if (i > 0) {
personnelIndicatorsMapper.delete(new LambdaQueryWrapper<PersonnelIndicators>().in(PersonnelIndicators::getOrganizationId, asList));
recruitmentMapper.delete(new LambdaQueryWrapper<Recruitment>().in(Recruitment::getCompanyId, asList));
auditMapper.delete(new LambdaQueryWrapper<Audit>().eq(Audit::getPerType, ArgsConst.RECRUITMENT).in(Audit::getPersonnelId, asList));
auditMapper.delete(new LambdaQueryWrapper<Audit>().eq(Audit::getPerType, ArgsConst.PERSONNEL_INDICATORS).in(Audit::getPersonnelId, asList));
return AjaxResult.ok().msg("删除成功!");
}
return AjaxResult.fail().msg("删除失败!");
@ -102,14 +105,14 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
if (1 == organization.getAuditState()) {
return AjaxResult.fail().msg("该数据已送审,请勿重复操作!");
}
extracted(id, type, loginId);
extracted(organization, id, type, loginId);
organization.setAuditState(1);
updateById(organization);
Integer i = auditService.saveAuditLog(id, loginId, type,"送审","");
return i > 0 ? AjaxResult.ok().msg("送审成功!") : AjaxResult.ok().msg("送审失败!");
}
private void extracted(String id, String type, String loginId) {
private void extracted(Organization organization, String id, String type, String loginId) {
for (int i = 0; i <= 2; i++) {
Audit audit = new Audit();
audit.setPersonnelId(id);
@ -123,38 +126,27 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
} else if (i == 1) {
// 待审批 人事部负责人
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
User user1 = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue()));
audit.setAuditOrder(ArgsConst.WAITING);
audit.setApprover(userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue())).getId());
audit.setApprover(user1.getId());
audit.setApproverTime(new Date());
organization.setFirstId(user1.getUserName());
} else if (i == 2) {
// 领导
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.LAST);
audit.setApprover(userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue())).getId());
audit.setApprover(user2.getId());
audit.setApproverTime(new Date());
organization.setLastId(user2.getUserName());
}
auditMapper.insert(audit);
}
// organization.setAuditState(1);
// updateById(organization);
// Integer i = auditService.saveAuditLog(id, loginId, "送审","送审","");
// return i > 0 ? AjaxResult.ok().msg("送审成功!") : AjaxResult.ok().msg("送审失败!");
}
/**
* 人员指标申报
* @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, type,"送审","");
return i > 0 ? AjaxResult.ok().msg("送审成功!") : AjaxResult.ok().msg("送审失败!");
}
}

View File

@ -5,11 +5,13 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.PersonnelIndicatorsDto;
import com.ydool.staff.entity.*;
import com.ydool.common.base.BaseService;
import com.ydool.staff.entity.PersonnelIndicators;
import com.ydool.staff.mapper.CompanyNameMapper;
import com.ydool.staff.mapper.OrganizationMapper;
import com.ydool.staff.mapper.PersonnelIndicatorsMapper;
import com.ydool.staff.mapper.PersonnelMapper;
@ -38,26 +40,21 @@ public class PersonnelIndicatorsServiceImpl extends BaseService<PersonnelIndicat
@Autowired
OrganizationMapper organizationMapper;
@Autowired
PersonnelMapper personnelMapper;
CompanyNameMapper companyNameMapper;
@Override
public AjaxResult savePersonnelIndicators(PersonnelIndicatorsRequest personnelIndicatorsRequest) {
OrganizationRequest organizationRequest = personnelIndicatorsRequest.getOrganizationRequest();
Organization organization = BeanUtil.copyProperties(organizationRequest, Organization.class);
organization.setType("personnel_indicators");
// organization.setDocumentStatus("国资审核");
organization.setType(ArgsConst.PERSONNEL_INDICATORS);
int i = organizationMapper.insert(organization);
if (i > 0) {
List<PersonnelIndicators> personnelIndicators = personnelIndicatorsRequest.getPersonnelIndicators();
List<String> list = personnelIndicators.stream().map(PersonnelIndicators::getAddNumber).collect(Collectors.toList());
for (PersonnelIndicators personnelIndicator : personnelIndicators) {
if (!NumberUtil.isNumber(personnelIndicator.getAddNumber()) || !NumberUtil.isNumber(personnelIndicator.getStandardNumber())){
return AjaxResult.fail().msg("指标人数输入不合法!");
}
personnelIndicator.setOrganizationId(organization.getId());
personnelIndicatorsMapper.insert(personnelIndicator);
return AjaxResult.ok().msg("添加成功!");
}
saveBatch(personnelIndicators);
return AjaxResult.ok().msg("添加成功!");
}
return AjaxResult.fail().msg("添加失败!");
}
@ -68,9 +65,10 @@ public class PersonnelIndicatorsServiceImpl extends BaseService<PersonnelIndicat
if (ObjectUtil.isNull(organization)) {
return AjaxResult.fail().msg("未找到相关信息!");
}
CompanyName companyName = companyNameMapper.selectById(organization.getCompanyId());
List<PersonnelIndicators> personnelIndicators = personnelIndicatorsMapper.selectList(new LambdaQueryWrapper<PersonnelIndicators>().eq(PersonnelIndicators::getOrganizationId, organization.getId()));
PersonnelIndicatorsDto recruitmentRequest = new PersonnelIndicatorsDto();
recruitmentRequest.setOrganization(organization);
recruitmentRequest.setOrganization(companyName);
recruitmentRequest.setPersonnelIndicators(personnelIndicators);
return AjaxResult.ok().data(recruitmentRequest);
}

View File

@ -562,7 +562,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
}
if (ArgsConst.EXCHANGE.equals(request.getType())){
Exchange exchange = exchangeMapper.selectById(id);
exchange.setAuditState("1");
exchange.setAuditState(1);
exchangeMapper.updateById(exchange);
}
auditService.saveAuditLog(id, loginId,request.getType(), "一般送审提交","");

View File

@ -5,12 +5,15 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.RecruitmentDto;
import com.ydool.staff.entity.CompanyName;
import com.ydool.staff.entity.Organization;
import com.ydool.staff.entity.Personnel;
import com.ydool.staff.entity.Recruitment;
import com.ydool.common.base.BaseService;
import com.ydool.staff.mapper.CompanyNameMapper;
import com.ydool.staff.mapper.OrganizationMapper;
import com.ydool.staff.mapper.PersonnelMapper;
import com.ydool.staff.mapper.RecruitmentMapper;
@ -39,7 +42,7 @@ public class RecruitmentServiceImpl extends BaseService<RecruitmentMapper, Recru
@Autowired
RecruitmentMapper recruitmentMapper;
@Autowired
PersonnelMapper personnelMapper;
CompanyNameMapper companyNameMapper;
@Autowired
OrganizationMapper organizationMapper;
@ -48,19 +51,15 @@ public class RecruitmentServiceImpl extends BaseService<RecruitmentMapper, Recru
public AjaxResult saveRecruitment(RecruitmentRequest recruitmentRequest) {
OrganizationRequest organizationRequest = recruitmentRequest.getOrganizationRequest();
Organization organization = BeanUtil.copyProperties(organizationRequest, Organization.class);
organization.setType("organization");
// organization.setDocumentStatus("国资审核");
organization.setType(ArgsConst.ORGANIZATION);
int i = organizationMapper.insert(organization);
if (i > 0) {
List<Recruitment> recruitments = recruitmentRequest.getRecruitments();
for (Recruitment recruitment : recruitments) {
if (!NumberUtil.isNumber(recruitment.getPlaces())){
return AjaxResult.fail().msg("名额输入不合法!");
}
recruitment.setCompanyId(organization.getId());
recruitmentMapper.insert(recruitment);
return AjaxResult.ok().msg("添加成功!");
}
saveBatch(recruitments);
return AjaxResult.ok().msg("添加成功!");
}
return AjaxResult.fail().msg("添加失败!");
}
@ -83,9 +82,10 @@ public class RecruitmentServiceImpl extends BaseService<RecruitmentMapper, Recru
if (ObjectUtil.isNull(organization)) {
return AjaxResult.fail().msg("未找到相关信息!");
}
CompanyName companyName = companyNameMapper.selectById(organization.getCompanyId());
List<Recruitment> recruitments = recruitmentMapper.selectList(new LambdaQueryWrapper<Recruitment>().eq(Recruitment::getCompanyId, organization.getId()));
RecruitmentDto recruitmentRequest = new RecruitmentDto();
recruitmentRequest.setOrganization(organization);
recruitmentRequest.setOrganization(companyName);
recruitmentRequest.setRecruitments(recruitments);
return AjaxResult.ok().data(recruitmentRequest);
}