修改指标,登记

This commit is contained in:
zhuyy 2023-06-16 15:04:29 +08:00
parent ab5b421bf1
commit 72ff161ca6
27 changed files with 570 additions and 221 deletions

View File

@ -0,0 +1,31 @@
package com.ydool.staff.controller;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.ydool.common.base.BaseController;
import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.AuditLogDto;
import com.ydool.staff.service.impl.AuditLogServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(UrlConstant.ALTERATION)
@Api(tags = "人事日志", value = "人事日志")
@ApiSupport(order = 12)
public class AuditLogControoller extends BaseController {
@Autowired
AuditLogServiceImpl auditLogService;
@GetMapping("/log")
@ApiOperation(value = "人事日志", response = AuditLogDto.class)
public AjaxResult audtiLog() {
return auditLogService.auditLog(getPage());
}
}

View File

@ -4,14 +4,13 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.ydool.common.base.BaseController;
import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.CompanyNameDto;
import com.ydool.staff.service.ICompanyNameService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@ -36,4 +35,10 @@ public class CompanyNameController extends BaseController {
return companyNameService.companyName(id);
}
@PutMapping("/update")
@ApiOperation(value = "修改总指标人数")
public AjaxResult update(@RequestBody CompanyNameDto companyNameDto) {
return companyNameService.update(companyNameDto);
}
}

View File

@ -13,6 +13,7 @@ import com.ydool.staff.entity.Organization;
import com.ydool.staff.request.OrganizationSearch;
import com.ydool.staff.service.*;
import com.ydool.system.request.IdsRequest;
import com.ydool.system.service.impl.ConfigServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@ -28,6 +29,8 @@ public class OrganizationController extends BaseController {
@Autowired
IOrganizationService organizationService;
@Autowired
ConfigServiceImpl configService;
@GetMapping("/selectOrganizationPersonnelIndicatorsList")
@ApiOperation(value = "人员招聘登记人员指标申报列表")
@ -44,6 +47,12 @@ public class OrganizationController extends BaseController {
return organizationService.deleteOrganization(id);
}
@GetMapping(value = "/approval")
@ApiOperation(value = "招聘单号")
public AjaxResult approval() {
return organizationService.approval();
}
@GetMapping("/submitRecruitment")
@ApiOperation(value = "人员招聘登记送审")
@ApiImplicitParams({@ApiImplicitParam(value = "登记id", name = "id")})
@ -57,4 +66,5 @@ public class OrganizationController extends BaseController {
public AjaxResult submitPersonnelIndicators(String id) {
return organizationService.submitRecruitment(id, ArgsConst.PERSONNEL_INDICATORS);
}
}

View File

@ -1,5 +1,6 @@
package com.ydool.staff.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
@ -8,7 +9,9 @@ import com.ydool.common.base.BaseController;
import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.RecruitmentDto;
import com.ydool.staff.entity.Audit;
import com.ydool.staff.request.RecruitmentRequest;
import com.ydool.staff.service.IAuditService;
import com.ydool.staff.service.IRecruitmentService;
import com.ydool.system.request.IdsRequest;
import io.swagger.annotations.Api;
@ -26,6 +29,8 @@ public class RecruitmentController extends BaseController {
@Autowired
IRecruitmentService recruitmentService;
@Autowired
IAuditService auditService;
@GetMapping("/selectCompanyNameById")
@ApiOperation(value = "人员招聘登记详情")
@ -48,4 +53,16 @@ public class RecruitmentController extends BaseController {
return recruitmentService.deleteRecruitment(id);
}
// @GetMapping(value = "/submit")
// @ApiOperation(value = "已提交审批")
// public AjaxResult submit() {
// return auditService.submitAudit(getPage());
// }
@GetMapping(value = "/waiting")
@ApiOperation(value = "待我审批")
public AjaxResult waiting() {
return auditService.waitingAudit(getPage());
}
}

View File

@ -0,0 +1,14 @@
package com.ydool.staff.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class CompanyNameDto {
@ApiModelProperty(value = "id")
private String id;
@ApiModelProperty(value = "总指标人数")
private Long checkNumber;
}

View File

@ -0,0 +1,11 @@
package com.ydool.staff.dto;
import lombok.Data;
@Data
public class PlacesDto {
private String id;
private String odd;
}

View File

@ -47,6 +47,9 @@ public class CompanyName extends BaseEntity {
@ApiModelProperty(value = "本次核准后总指标人数")
private Long thisApprovalNumber;
@ApiModelProperty(value = "核定用工指标人数")
private Long recruit;
@ApiModelProperty(value = "类型 登记organization 申报personnel_indicators")
private String type;

View File

@ -42,6 +42,9 @@ public class Organization extends BaseEntity{
@ApiModelProperty(value = "核定用工人数")
private Long checkNumber;
@ApiModelProperty(value = "剩余指标人数")
private Long addNumber;
@ApiModelProperty(value = "剩余指标人数")
private Long residualNumber;

View File

@ -0,0 +1,23 @@
package com.ydool.staff.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.common.base.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("t_lc_places")
public class Places extends BaseEntity {
@ApiModelProperty(value = "登记id")
private String organizationId;
@ApiModelProperty(value = "单号")
private String odd;
@ApiModelProperty(value = "状态")
private Boolean status;
}

View File

@ -1,8 +1,11 @@
package com.ydool.staff.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.ydool.staff.entity.PersonnelIndicators;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
/**
@ -29,6 +32,6 @@ public interface PersonnelIndicatorsMapper extends MPJBaseMapper<PersonnelIndica
* @param id
* @return
*/
@Select("SELECT sum(add_number) add_number FROM `t_lc_personnel_indicators` where organization_id = '#{id}'")
Long personnelIndicatorsAddNumber(String id);
@Select("SELECT sum(add_number) add_number FROM `t_lc_personnel_indicators` ${ew.customSqlSegment}")
Long personnelIndicatorsAddNumber(@Param(Constants.WRAPPER) QueryWrapper<PersonnelIndicators> wrapper);
}

View File

@ -0,0 +1,15 @@
package com.ydool.staff.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.github.yulichang.base.MPJBaseMapper;
import com.ydool.staff.entity.Places;
import com.ydool.staff.entity.Recruitment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface PlacesMapper extends MPJBaseMapper<Places> {
}

View File

@ -1,5 +1,7 @@
package com.ydool.staff.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.ydool.staff.entity.Recruitment;
import com.github.yulichang.base.MPJBaseMapper;
import com.ydool.staff.request.CompanyNameRequest;
@ -27,6 +29,6 @@ public interface RecruitmentMapper extends MPJBaseMapper<Recruitment> {
List<CompanyNameRequest> recruitmentList();
@Select("SELECT SUM(places) places FROM `t_lc_recruitment` WHERE company_id = #{companyId}")
Long recruitmentPlaces(String companyId);
@Select("SELECT SUM(places) places FROM `t_lc_recruitment` ${ew.customSqlSegment}")
Long recruitmentPlaces(@Param(Constants.WRAPPER) QueryWrapper<Recruitment> wrapper);
}

View File

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

View File

@ -21,6 +21,9 @@ public class OrganizationRequest implements Serializable {
@ApiModelProperty(value = "核定用工人数")
private Long checkNumber;
@ApiModelProperty(value = "核定用工人数")
private Long addNumber;
@ApiModelProperty(value = "在职人数")
private Long activeStaff;

View File

@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;
@ -18,10 +20,15 @@ import java.util.List;
@Data
public class PersonnelIndicatorsRequest implements Serializable {
@ApiModelProperty(value = "保存preserve/送审approval")
@NotBlank(message = "类型不能为空")
private String type;
@ApiModelProperty(value = "人员指标")
@Valid
private OrganizationRequest organizationRequest;
@ApiModelProperty(value = "人员指标申报")
@NotEmpty(message = "人员指标申报不能为空")
private List<PersonnelIndicators> personnelIndicators;
}

View File

@ -5,17 +5,24 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;
@Data
public class RecruitmentRequest implements Serializable {
@ApiModelProperty(value = "保存preserve/送审approval")
@NotBlank(message = "类型不能为空")
private String type;
@ApiModelProperty(value = "招聘登记")
@Valid
private OrganizationRequest organizationRequest;
@ApiModelProperty(value = "人员招聘登记")
@NotEmpty(message = "人员登记不能为空")
private List<Recruitment> recruitments;
}

View File

@ -1,5 +1,6 @@
package com.ydool.staff.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.data.dto.AjaxResult;
/**
@ -13,5 +14,7 @@ import com.ydool.common.data.dto.AjaxResult;
public interface IAuditLogService {
AjaxResult auditLog(String id, String personnelType);
AjaxResult auditLog(Page page);
}

View File

@ -2,6 +2,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.entity.Audit;
import com.ydool.staff.request.AuditRequest;
/**
@ -25,5 +26,9 @@ public interface IAuditService {
AjaxResult submitRecruitmentAudit(AuditRequest auditRequest);
AjaxResult submitPersonnelIndicatorsAudit(AuditRequest auditRequest);
AjaxResult submitAudit(Page page);
AjaxResult waitingAudit(Page page);
}

View File

@ -1,6 +1,7 @@
package com.ydool.staff.service;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.CompanyNameDto;
import com.ydool.staff.dto.EnterpriseIndicatorsExportDto;
import com.ydool.staff.dto.PersonnelReportExportDto;
import com.ydool.staff.dto.PersonnelStatementDto;
@ -40,5 +41,7 @@ public interface ICompanyNameService {
AjaxResult getEntityParam();
void export(ExcelPersonnelStatementRequest personnelParam, HttpServletResponse response);
AjaxResult update(CompanyNameDto companyNameDto);
}

View File

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

View File

@ -1,8 +1,12 @@
package com.ydool.staff.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.base.BaseService;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
@ -13,10 +17,12 @@ import com.ydool.staff.mapper.AuditLogMapper;
import com.ydool.staff.service.IAuditLogService;
import com.ydool.system.entity.User;
import com.ydool.system.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
@ -44,5 +50,19 @@ public class AuditLogServiceImpl extends BaseService<AuditLogMapper, AuditLog> i
}
return AjaxResult.ok().data(auditLogDtos);
}
@Override
public AjaxResult auditLog(Page page) {
Page selectPage = page(page, Wrappers.lambdaQuery(AuditLog.class).orderByDesc(AuditLog::getCreatedAt));
List<AuditLog> records = selectPage.getRecords();
for (AuditLog record : records) {
User userName = userMapper.selectById(record.getApprover());
if (ObjectUtil.isNotNull(userName)) {
record.setApprover(userName.getUserName());
}
}
selectPage.setRecords(records);
return AjaxResult.ok().data(selectPage);
}
}

View File

@ -1,14 +1,20 @@
package com.ydool.staff.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.oa.workFlow.data.entity.WorkFlowNotice;
import com.ydool.oa.workFlow.service.WorkFlowNoticeService;
import com.ydool.staff.entity.*;
import com.ydool.staff.mapper.*;
import com.ydool.staff.request.AuditRequest;
@ -26,6 +32,8 @@ import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* <p>
@ -38,6 +46,7 @@ import java.util.List;
@Service
public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements IAuditService {
private static final AtomicInteger counter = new AtomicInteger(0);
@Resource
private ConfigMapper configMapper;
@Resource
@ -65,6 +74,16 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
CompanyNameMapper companyNameMapper;
@Autowired
RecruitmentMapper recruitmentMapper;
@Autowired
PlacesMapper placesMapper;
@Autowired
WorkFlowNoticeService workFlowNoticeService;
public static String getNextId() {
int value = counter.incrementAndGet();
return String.format("%04d", value);
}
@Override
public AjaxResult getAuditList(Page page) {
@ -243,6 +262,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
auditLog.setAuditState(auditSate);
return auditLogMapper.insert(auditLog);
}
public void updateByPer(Integer num, String afterId, Personnel personnel, String type, String auditOpinion) {
delete(afterId);
if (1 == num) {
@ -271,7 +291,6 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
@Transactional(rollbackFor = Exception.class)
public AjaxResult submitRecruitmentAudit(AuditRequest auditRequest) {
Organization organization = organizationMapper.selectById(auditRequest.getPersonnelId());
if (3 == organization.getAuditState()) {
return AjaxResult.fail().msg("已拒绝请勿重复审批!");
}
@ -281,72 +300,85 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
return AjaxResult.fail().msg("该用户不能审批!");
}
// 人事部负责人
Config director = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
// 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));
User byId = userMapper.selectById(one.getApprover());
// 同意
if ("2".equals(auditRequest.getStatus())) {
// 人事初审批同意
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 (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);
// }
// saveAuditLog(auditRequest.getPersonnelId(), loginId, "organization", "人事审批通过", auditRequest.getAuditOpinion());
// 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();
Long quota = companyName.getResidualNumber() - places;
// 剩余指标人数 = 剩余指标人数 - 名额
if(quota < 0){
return AjaxResult.fail().msg("招聘人数不能大于剩余人数!");
}
// 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);
one.setApproverTime(new Date());
boolean update = updateById(one);
if (update) {
// 剩余指标人数 = 原核定用工指标人数 - 名额
companyName.setResidualNumber(quota);
companyName.setThisApprovalNumber(organization.getThisApprovalNumber());
companyNameMapper.updateById(companyName);
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()));
companyNameMapper.update(null, new LambdaUpdateWrapper<CompanyName>().set(CompanyName::getResidualNumber, companyName.getResidualNumber() - places)
// .set(CompanyName::getResidualNumber, companyName.getResidualNumber() - addNumber)
// .set(CompanyName::getRecruit, companyName.getCheckNumber() - companyName.getThisApprovalNumber())
.eq(CompanyName::getId, companyName.getId()));
organization.setAuditState(3);
organization.setResidualNumber(companyName.getResidualNumber());
organization.setLastTime(new Date());
organization.setLastInstance(auditRequest.getAuditOpinion());
organizationMapper.updateById(organization);
}
List<Recruitment> recruitments = recruitmentMapper.selectList(Wrappers.lambdaQuery(Recruitment.class).eq(Recruitment::getCompanyId, organization.getId()));
List<Long> list = recruitments.stream().map(Recruitment::getPlaces).collect(Collectors.toList());
for (Long aLong : list) {
for (int i = 0; i < aLong.intValue(); i++) {
Places places = new Places();
places.setStatus(Boolean.FALSE);
places.setOrganizationId(organization.getId());
places.setOdd(DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss" + getNextId()));
placesMapper.insert(places);
}
}
saveAuditLog(auditRequest.getPersonnelId(), loginId, ArgsConst.ORGANIZATION, "领导审批通过", auditRequest.getAuditOpinion());
return update ? AjaxResult.ok().msg("领导审批成功!") : AjaxResult.fail().msg("领导审批失败!");
}
} else {
// 人事初审批拒绝
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 (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);
// }
// saveAuditLog(auditRequest.getPersonnelId(), loginId, "organization", "人事审批拒绝", auditRequest.getAuditOpinion());
// return update ? AjaxResult.ok().msg("人事审批拒绝!") : AjaxResult.fail().msg("人事审批失败!");
// }
// 领导终审批拒绝
if (leadership.getParamValue().equals(byId.getLoginName())) {
one.setAuditOrder(ArgsConst.LAST);
one.setAuditState(ArgsConst.REJECT);
one.setApproverTime(new Date());
boolean update = updateById(one);
if (update) {
organization.setAuditState(4);
@ -354,6 +386,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
organization.setLastInstance(auditRequest.getAuditOpinion());
organizationMapper.updateById(organization);
}
saveAuditLog(auditRequest.getPersonnelId(), loginId, ArgsConst.ORGANIZATION, "领导审批拒绝", auditRequest.getAuditOpinion());
return update ? AjaxResult.ok().msg("领导审批拒绝!") : AjaxResult.fail().msg("领导审批失败!");
}
}
@ -370,7 +403,6 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
@Transactional(rollbackFor = Exception.class)
public AjaxResult submitPersonnelIndicatorsAudit(AuditRequest auditRequest) {
Organization organization = organizationMapper.selectById(auditRequest.getPersonnelId());
if (3 == organization.getAuditState()) {
return AjaxResult.fail().msg("已拒绝请勿重复审批!");
}
@ -380,75 +412,82 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
return AjaxResult.fail().msg("该用户不能审批!");
}
// 人事部负责人
Config director = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
// 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 ("2".equals(auditRequest.getStatus())) {
// // 人事初审批同意
// 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);
// }
// saveAuditLog(auditRequest.getPersonnelId(), loginId, "personnel_indicators", "人事审批通过", auditRequest.getAuditOpinion());
// 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()));
// 统计要求增加指标人数
QueryWrapper<PersonnelIndicators> queryWrapper = new QueryWrapper<PersonnelIndicators>().eq("organization_id", organization.getId());
Long addNumber = personnelIndicatorsMapper.personnelIndicatorsAddNumber(queryWrapper);
// Long thisApprovalNumber = organizationMapper.selectOne(new MPJQueryWrapper<Organization>().select(" SUM(this_approval_number) thisApprovalNumber ").eq("company_id", organization.getCompanyId()).eq("type", ArgsConst.PERSONNEL_INDICATORS)).getThisApprovalNumber();
one.setAuditOrder(ArgsConst.LAST);
one.setAuditState(ArgsConst.PASS);
one.setApproverTime(new Date());
boolean update = updateById(one);
if (update) {
//原核定用工指标人数
companyName.setCheckNumber(addNumber + companyName.getCheckNumber());
// 指标加了剩余人数也加
companyName.setResidualNumber(standardNumber + companyName.getResidualNumber());
//本次核准后总指标人数
companyName.setThisApprovalNumber(standardNumber + companyName.getThisApprovalNumber());
companyNameMapper.updateById(companyName);
organization.setCheckNumber(companyName.getCheckNumber());
organization.setThisApprovalNumber(thisApprovalNumber);
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::getRecruit, companyName.getRecruit() + addNumber)
.eq(CompanyName::getId, companyName.getId()));
organization.setAuditState(3);
organization.setLastTime(new Date());
organization.setLastInstance(auditRequest.getAuditOpinion());
organizationMapper.updateById(organization);
}
// WorkFlowNotice workFlowNotice = new WorkFlowNotice();
// workFlowNotice.setStatus(Boolean.FALSE);
// workFlowNotice.setFlowType(ArgsConst.PERSONNEL_INDICATORS);
// workFlowNotice.setUserId(one.getApprover());
// workFlowNotice.setTitle(byId.getUserName() + "的指标申报待你审批");
// workFlowNotice.setFlowId(auditRequest.getPersonnelId());
// workFlowNoticeService.save(workFlowNotice);
saveAuditLog(auditRequest.getPersonnelId(), loginId, ArgsConst.PERSONNEL_INDICATORS, "领导审批通过", auditRequest.getAuditOpinion());
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("人事审批失败!");
}
// 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);
// }
// saveAuditLog(auditRequest.getPersonnelId(), loginId, "personnel_indicators", "人事审批拒绝", auditRequest.getAuditOpinion());
// return update ? AjaxResult.ok().msg("人事审批拒绝!") : AjaxResult.fail().msg("人事审批失败!");
// }
// 领导终审批拒绝
if (leadership.getParamValue().equals(byId.getLoginName())) {
one.setAuditOrder(ArgsConst.LAST);
one.setAuditState(ArgsConst.REJECT);
one.setApproverTime(new Date());
boolean update = updateById(one);
if (update) {
organization.setAuditState(4);
@ -456,6 +495,14 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
organization.setLastInstance(auditRequest.getAuditOpinion());
organizationMapper.updateById(organization);
}
// WorkFlowNotice workFlowNotice = new WorkFlowNotice();
// workFlowNotice.setStatus(Boolean.FALSE);
// workFlowNotice.setFlowType(ArgsConst.PERSONNEL_INDICATORS);
// workFlowNotice.setUserId(one.getApprover());
// workFlowNotice.setTitle(byId.getUserName() + "的指标申报已驳回");
// workFlowNotice.setFlowId(auditRequest.getPersonnelId());
// workFlowNoticeService.save(workFlowNotice);
saveAuditLog(auditRequest.getPersonnelId(), loginId, ArgsConst.PERSONNEL_INDICATORS, "领导审批拒绝", auditRequest.getAuditOpinion());
return update ? AjaxResult.ok().msg("领导审批拒绝!") : AjaxResult.fail().msg("领导审批失败!");
}
}
@ -482,31 +529,32 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
return AjaxResult.fail().msg("该用户不能审批!");
}
// 人事部负责人
Config director = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
// 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));
User byId = userMapper.selectById(audit.getApprover());
if ("2".equals(auditRequest.getStatus())) {
// 人事初审批同意
if (director.getParamValue().equals(byId.getLoginName())) {
audit.setAuditOrder(ArgsConst.FIRST);
audit.setAuditState(ArgsConst.PASS);
boolean update = updateById(audit);
if (update) {
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);
}
return update ? AjaxResult.ok().msg("人事审批成功!") : AjaxResult.fail().msg("人事审批失败!");
}
// if (director.getParamValue().equals(byId.getLoginName())) {
// audit.setAuditOrder(ArgsConst.FIRST);
// audit.setAuditState(ArgsConst.PASS);
// boolean update = updateById(audit);
// if (update) {
// 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);
// }
// return update ? AjaxResult.ok().msg("人事审批成功!") : AjaxResult.fail().msg("人事审批失败!");
// }
// 领导终审批同意
if (leadership.getParamValue().equals(byId.getLoginName())) {
audit.setAuditOrder(ArgsConst.LAST);
audit.setAuditState(ArgsConst.PASS);
audit.setApproverTime(new Date());
boolean update = updateById(audit);
if (update) {
recruitment.setAuditState(3);
@ -514,26 +562,28 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
recruitment.setLastInstance(auditRequest.getAuditOpinion());
directorsSupervisorsMapper.updateById(recruitment);
}
saveAuditLog(auditRequest.getPersonnelId(), loginId, ArgsConst.DIRECTORS, "领导审批通过", auditRequest.getAuditOpinion());
return update ? AjaxResult.ok().msg("领导审批成功!") : AjaxResult.fail().msg("领导审批失败!");
}
} else {
// 人事初审批拒绝
if (director.getParamValue().equals(byId.getLoginName())) {
audit.setAuditOrder(ArgsConst.FIRST);
audit.setAuditState(ArgsConst.REJECT);
boolean update = updateById(audit);
if (update) {
recruitment.setAuditState(4);
recruitment.setFirstTime(new Date());
recruitment.setFirstTrial(auditRequest.getAuditOpinion());
directorsSupervisorsMapper.updateById(recruitment);
}
return update ? AjaxResult.ok().msg("人事审批拒绝!") : AjaxResult.fail().msg("人事审批失败!");
}
// if (director.getParamValue().equals(byId.getLoginName())) {
// audit.setAuditOrder(ArgsConst.FIRST);
// audit.setAuditState(ArgsConst.REJECT);
// boolean update = updateById(audit);
// if (update) {
// recruitment.setAuditState(4);
// recruitment.setFirstTime(new Date());
// recruitment.setFirstTrial(auditRequest.getAuditOpinion());
// directorsSupervisorsMapper.updateById(recruitment);
// }
// return update ? AjaxResult.ok().msg("人事审批拒绝!") : AjaxResult.fail().msg("人事审批失败!");
// }
// 领导终审批拒绝
if (leadership.getParamValue().equals(byId.getLoginName())) {
audit.setAuditOrder(ArgsConst.LAST);
audit.setAuditState(ArgsConst.REJECT);
audit.setApproverTime(new Date());
boolean update = updateById(audit);
if (update) {
recruitment.setAuditState(4);
@ -541,6 +591,7 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
recruitment.setLastInstance(auditRequest.getAuditOpinion());
directorsSupervisorsMapper.updateById(recruitment);
}
saveAuditLog(auditRequest.getPersonnelId(), loginId, ArgsConst.DIRECTORS, "领导审批拒绝", auditRequest.getAuditOpinion());
return update ? AjaxResult.ok().msg("领导审批拒绝!") : AjaxResult.fail().msg("领导审批失败!");
}
}
@ -548,5 +599,31 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
}
/**
* 已提交审批
*
* @param page
* @return
*/
@Override
public AjaxResult submitAudit(Page page) {
Page selectPage = auditMapper.selectPage(page, Wrappers.lambdaQuery(Audit.class)
.eq(Audit::getAuditState, "submit").eq(Audit::getApprover, StpUtil.getLoginIdAsString()));
return AjaxResult.ok().data(selectPage);
}
/**
* 待我审批日志
*
* @param page
* @return
*/
@Override
public AjaxResult waitingAudit(Page page) {
Page selectPage = auditMapper.selectPage(page, Wrappers.lambdaQuery(Audit.class)
.eq(Audit::getAuditOrder, "waiting").eq(Audit::getApprover, StpUtil.getLoginIdAsString()));
return AjaxResult.ok().data(selectPage);
}
}

View File

@ -5,10 +5,14 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.yulichang.query.MPJQueryWrapper;
import com.ydool.common.base.BaseService;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.utils.EasyExcelAlibabaUtil;
import com.ydool.staff.dto.CompanyNameDto;
import com.ydool.staff.dto.EnterpriseIndicatorsExportDto;
import com.ydool.staff.dto.PersonnelReportExportDto;
import com.ydool.staff.dto.PersonnelStatementDto;
@ -179,7 +183,6 @@ public class CompanyNameServiceImpl extends BaseService<CompanyNameMapper, Compa
}
@Override
public AjaxResult getEntityParam() {
Field[] declaredFields = ExcelPersonnelStatement.class.getDeclaredFields();
@ -203,6 +206,13 @@ public class CompanyNameServiceImpl extends BaseService<CompanyNameMapper, Compa
EasyExcelAlibabaUtil.exportDownload(response, ExcelPersonnelStatement.class, statement, fileName, includeColumnFiledNames);
}
@Override
public AjaxResult update(CompanyNameDto companyNameDto) {
int i = companyNameMapper.update(null, new UpdateWrapper<CompanyName>().set("check_number", companyNameDto.getCheckNumber()).eq("id", companyNameDto.getId()));
if (i > 0) {
return AjaxResult.ok().msg("修改成功!");
}
return AjaxResult.fail().msg("修改失败!");
}
}

View File

@ -7,16 +7,14 @@ import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.DirectorsSupervisorsDto;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.Audit;
import com.ydool.staff.entity.CompanyName;
import com.ydool.staff.entity.DirectorsSupervisors;
import com.ydool.staff.entity.*;
import com.ydool.common.base.BaseService;
import com.ydool.staff.mapper.AttachmentMapper;
import com.ydool.staff.mapper.AuditMapper;
@ -156,12 +154,16 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
@Override
public AjaxResult submitDirectorsSupervisors(String id, String type) {
Integer count = directorsSupervisorsMapper.selectCount(Wrappers.lambdaQuery(DirectorsSupervisors.class).eq(DirectorsSupervisors::getAuditState, 2));
if (count > 0) {
return AjaxResult.fail("当前有未审批的董监申报!");
}
String loginId = StpUtil.getLoginIdAsString();
DirectorsSupervisors directorsSupervisors = get(id);
if (1 == directorsSupervisors.getAuditState()) {
return AjaxResult.fail().msg("该数据已送审,请勿重复操作!");
}
for (int i = 0; i <= 2; i++) {
for (int i = 0; i <= 1; i++) {
Audit audit = new Audit();
audit.setPersonnelId(id);
audit.setPerType(type);
@ -171,26 +173,25 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
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(user1.getId());
audit.setApproverTime(new Date());
directorsSupervisors.setFirstId(user1.getUserName());
// } 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(user1.getId());
// audit.setApproverTime(new Date());
// directorsSupervisors.setFirstId(user1.getUserName());
} else {
// 领导
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.setAuditOrder(ArgsConst.WAITING);
audit.setApprover(user2.getId());
audit.setApproverTime(new Date());
directorsSupervisors.setLastId(user2.getUserName());
}
auditMapper.insert(audit);
}
directorsSupervisors.setAuditState(1);
directorsSupervisors.setAuditState(2);
return updateById(directorsSupervisors) ? AjaxResult.ok().msg("送审成功!") : AjaxResult.fail().msg("送审失败!");
}
}

View File

@ -1,19 +1,23 @@
package com.ydool.staff.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.cache.ConfigCache;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.oa.workFlow.data.entity.WorkFlowNotice;
import com.ydool.oa.workFlow.service.WorkFlowNoticeService;
import com.ydool.staff.dto.PlacesDto;
import com.ydool.staff.entity.*;
import com.ydool.common.base.BaseService;
import com.ydool.staff.mapper.*;
import com.ydool.staff.request.OrganizationSearch;
import com.ydool.staff.service.IAuditService;
import com.ydool.staff.service.IOrganizationService;
import com.ydool.system.entity.Config;
import com.ydool.system.entity.User;
@ -53,6 +57,10 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
ConfigMapper configMapper;
@Autowired
UserMapper userMapper;
@Autowired
PlacesMapper placesMapper;
@Autowired
WorkFlowNoticeService workFlowNoticeService;
@Override
public AjaxResult selectOrganizationList(Page<Organization> page, OrganizationSearch organizationSearch) {
@ -104,11 +112,12 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
@Override
public AjaxResult submitRecruitment(String id, String type) {
String loginId = StpUtil.getLoginIdAsString();
User user = userMapper.selectById(loginId);
Organization organization = get(id);
if (1 == organization.getAuditState()) {
return AjaxResult.fail().msg("该数据已送审,请勿重复操作!");
}
for (int i = 0; i <= 2; i++) {
for (int i = 0; i <= 1; i++) {
Audit audit = new Audit();
audit.setPersonnelId(id);
audit.setPerType(type);
@ -118,28 +127,40 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
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(user1.getId());
audit.setApproverTime(new Date());
organization.setFirstId(user1.getUserName());
// } 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(user1.getId());
// audit.setApproverTime(new Date());
// organization.setFirstId(user1.getUserName());
} else {
// 领导
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.setAuditOrder(ArgsConst.WAITING);
audit.setApprover(user2.getId());
audit.setApproverTime(new Date());
organization.setLastId(user2.getUserName());
WorkFlowNotice workFlowNotice = new WorkFlowNotice();
workFlowNotice.setStatus(Boolean.FALSE);
workFlowNotice.setFlowType(ArgsConst.PERSONNEL_INDICATORS);
workFlowNotice.setUserId(user2.getId());
workFlowNotice.setTitle(user.getUserName() + "的指标申报待你审批");
workFlowNotice.setFlowId(organization.getId());
workFlowNoticeService.save(workFlowNotice);
}
auditMapper.insert(audit);
}
organization.setAuditState(1);
organization.setAuditState(2);
return updateById(organization) ? AjaxResult.ok().msg("送审成功!") : AjaxResult.ok().msg("送审失败!");
}
@Override
public AjaxResult approval() {
List<Places> places = placesMapper.selectList(Wrappers.lambdaQuery(Places.class).eq(Places::getStatus, Boolean.FALSE).orderByAsc(Places::getOdd));
return AjaxResult.ok().data(BeanUtil.copyToList(places, PlacesDto.class));
}
}

View File

@ -1,10 +1,14 @@
package com.ydool.staff.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.PersonnelIndicatorsDto;
@ -17,11 +21,13 @@ import com.ydool.staff.mapper.PersonnelIndicatorsMapper;
import com.ydool.staff.mapper.PersonnelMapper;
import com.ydool.staff.request.OrganizationRequest;
import com.ydool.staff.request.PersonnelIndicatorsRequest;
import com.ydool.staff.service.IOrganizationService;
import com.ydool.staff.service.IPersonnelIndicatorsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
@ -35,25 +41,44 @@ import java.util.stream.Collectors;
@Service
public class PersonnelIndicatorsServiceImpl extends BaseService<PersonnelIndicatorsMapper, PersonnelIndicators> implements IPersonnelIndicatorsService {
private static final AtomicInteger counter = new AtomicInteger(0);
@Autowired
PersonnelIndicatorsMapper personnelIndicatorsMapper;
@Autowired
OrganizationMapper organizationMapper;
@Autowired
CompanyNameMapper companyNameMapper;
@Autowired
IOrganizationService organizationService;
public static String getNextId() {
int value = counter.incrementAndGet();
return String.format("%04d", value);
}
@Override
public AjaxResult savePersonnelIndicators(PersonnelIndicatorsRequest personnelIndicatorsRequest) {
Integer count = organizationMapper.selectCount(Wrappers.lambdaQuery(Organization.class).in(Organization::getAuditState, 0, 2).eq(Organization::getType, ArgsConst.PERSONNEL_INDICATORS));
if (count > 0) {
return AjaxResult.fail("当前有未审批的指标申请!");
}
OrganizationRequest organizationRequest = personnelIndicatorsRequest.getOrganizationRequest();
Organization organization = BeanUtil.copyProperties(organizationRequest, Organization.class);
// organization.setApprovalNumber(DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss" + getNextId()));
organization.setType(ArgsConst.PERSONNEL_INDICATORS);
int i = organizationMapper.insert(organization);
if (i > 0) {
List<PersonnelIndicators> personnelIndicators = personnelIndicatorsRequest.getPersonnelIndicators();
for (PersonnelIndicators personnelIndicator : personnelIndicators) {
personnelIndicator.setOrganizationId(organization.getId());
if (CollUtil.isEmpty(personnelIndicators)) {
return AjaxResult.fail("人员指标申报不能为空!");
}
personnelIndicators.forEach(e -> e.setOrganizationId(organization.getId()));
saveBatch(personnelIndicators);
// 保存并且送审
if ("approval".equals(personnelIndicatorsRequest.getType())) {
return organizationService.submitRecruitment(organization.getId(), ArgsConst.PERSONNEL_INDICATORS);
}
return AjaxResult.ok().msg("添加成功!");
}
return AjaxResult.fail().msg("添加失败!");

View File

@ -1,24 +1,22 @@
package com.ydool.staff.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
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.staff.entity.*;
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;
import com.ydool.staff.mapper.*;
import com.ydool.staff.request.OrganizationRequest;
import com.ydool.staff.request.RecruitmentRequest;
import com.ydool.staff.service.IOrganizationService;
import com.ydool.staff.service.IRecruitmentService;
import com.ydool.system.request.IdsRequest;
import org.springframework.beans.factory.annotation.Autowired;
@ -27,6 +25,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* <p>
@ -39,26 +39,55 @@ import java.util.List;
@Service
public class RecruitmentServiceImpl extends BaseService<RecruitmentMapper, Recruitment> implements IRecruitmentService {
private static final AtomicInteger counter = new AtomicInteger(0);
@Autowired
RecruitmentMapper recruitmentMapper;
@Autowired
CompanyNameMapper companyNameMapper;
@Autowired
OrganizationMapper organizationMapper;
@Autowired
IOrganizationService organizationService;
@Autowired
PlacesMapper placesMapper;
public static String getNextId() {
int value = counter.incrementAndGet();
return String.format("%04d", value);
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult saveRecruitment(RecruitmentRequest recruitmentRequest) {
Integer count = organizationMapper.selectCount(Wrappers.lambdaQuery(Organization.class).in(Organization::getAuditState, 0, 2).eq(Organization::getType, ArgsConst.PERSONNEL_INDICATORS));
if (count > 0) {
return AjaxResult.fail("当前有未审批的招聘登记!");
}
OrganizationRequest organizationRequest = recruitmentRequest.getOrganizationRequest();
Organization organization = BeanUtil.copyProperties(organizationRequest, Organization.class);
// organization.setApprovalNumber(DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss" + getNextId()));
organization.setType(ArgsConst.ORGANIZATION);
int i = organizationMapper.insert(organization);
if (i > 0) {
List<Recruitment> recruitments = recruitmentRequest.getRecruitments();
for (Recruitment recruitment : recruitments) {
recruitment.setCompanyId(organization.getId());
if (CollUtil.isEmpty(recruitments)) {
return AjaxResult.fail("人员登记不能为空!");
}
recruitments.forEach(e -> e.setCompanyId(organization.getId()));
saveBatch(recruitments);
// List<Long> list = recruitments.stream().map(Recruitment::getPlaces).collect(Collectors.toList());
// for (int j = 0; j < list.size(); j++) {
// Places places = new Places();
// places.setStatus(Boolean.FALSE);
// places.setOrganizationId(organization.getId());
// places.setOdd(DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss" + getNextId()));
// placesMapper.insert(places);
// }
// 保存并且送审
if ("approval".equals(recruitmentRequest.getType())) {
return organizationService.submitRecruitment(organization.getId(), ArgsConst.RECRUITMENT);
}
return AjaxResult.ok().msg("添加成功!");
}
return AjaxResult.fail().msg("添加失败!");