审批流程及审批日志1.1
This commit is contained in:
parent
30e1eba3af
commit
ecc71b73a5
|
@ -8,7 +8,6 @@ import com.ydool.common.constant.CacheConst;
|
||||||
import com.ydool.common.constant.GrapeConst;
|
import com.ydool.common.constant.GrapeConst;
|
||||||
import com.ydool.common.utils.CacheUtil;
|
import com.ydool.common.utils.CacheUtil;
|
||||||
import com.ydool.system.entity.Config;
|
import com.ydool.system.entity.Config;
|
||||||
import com.ydool.system.service.IConfigService;
|
|
||||||
import com.ydool.system.service.impl.ConfigServiceImpl;
|
import com.ydool.system.service.impl.ConfigServiceImpl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -28,6 +27,10 @@ public class ConfigCache {
|
||||||
*/
|
*/
|
||||||
public static final String USER_INIT_PASSWORD = "sys.user.initPassword";
|
public static final String USER_INIT_PASSWORD = "sys.user.initPassword";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String SYS_USER_LEADERSHIP = "sys.user.leadership";
|
||||||
|
public static final String SYS_USER_PERSONNEL_DIRECTOR= "sys.user.personnel.director";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图片验证码
|
* 图片验证码
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -71,6 +71,10 @@ public class ArgsConst {
|
||||||
* 拒绝
|
* 拒绝
|
||||||
*/
|
*/
|
||||||
public static final String REJECT = "reject";
|
public static final String REJECT = "reject";
|
||||||
|
/**
|
||||||
|
* 待处理
|
||||||
|
*/
|
||||||
|
public static final String WAITING = "waiting";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 送审
|
* 送审
|
||||||
|
|
|
@ -4,6 +4,8 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
import com.ydool.common.base.BaseController;
|
import com.ydool.common.base.BaseController;
|
||||||
import com.ydool.common.constant.UrlConstant;
|
import com.ydool.common.constant.UrlConstant;
|
||||||
import com.ydool.common.data.dto.AjaxResult;
|
import com.ydool.common.data.dto.AjaxResult;
|
||||||
|
import com.ydool.staff.dto.AuditLogDto;
|
||||||
|
import com.ydool.staff.request.AuditRequest;
|
||||||
import com.ydool.staff.service.IAuditLogService;
|
import com.ydool.staff.service.IAuditLogService;
|
||||||
import com.ydool.staff.service.IAuditService;
|
import com.ydool.staff.service.IAuditService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
@ -11,6 +13,8 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@ -43,9 +47,19 @@ public class AuditController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("audtiLog")
|
@GetMapping("audtiLog")
|
||||||
@ApiOperation(value = "处理日志")
|
@ApiOperation(value = "处理日志",response = AuditLogDto.class)
|
||||||
@ApiImplicitParam(name = "id",value = "员工id")
|
@ApiImplicitParam(name = "id",value = "员工id")
|
||||||
public AjaxResult audtiLog(String id){
|
public AjaxResult audtiLog(String id){
|
||||||
return auditLogService.auditLog(id);
|
return auditLogService.auditLog(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("addAudit")
|
||||||
|
@ApiOperation(value = "同意/驳回审批")
|
||||||
|
public AjaxResult addAudit(@RequestBody AuditRequest auditRequest) {
|
||||||
|
if ("2".equals(auditRequest.getStatus()) || "3".equals(auditRequest.getStatus())) {
|
||||||
|
return auditService.audit(auditRequest);
|
||||||
|
}
|
||||||
|
return AjaxResult.fail().msg("审批状态错误");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.ydool.staff.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
* @author msh
|
||||||
|
* @since 2023-02-16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AuditLogDto{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "人员id")
|
||||||
|
private String personnelId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "审批人")
|
||||||
|
private String approver;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "审批状态")
|
||||||
|
private String auditState;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "处理意见")
|
||||||
|
private String opinion;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
@ApiModelProperty(value = "处理时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.ydool.staff.request;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author msh
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2022/10/14 14:18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AuditRequest {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "人员id")
|
||||||
|
@NotBlank(message = "id不能为空")
|
||||||
|
private String personnelId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "审批状态 2:同意 3:拒绝 ")
|
||||||
|
@NotBlank(message = "审批状态不能为空")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "审批意见")
|
||||||
|
private String auditOpinion;
|
||||||
|
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package com.ydool.staff.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ydool.common.data.dto.AjaxResult;
|
import com.ydool.common.data.dto.AjaxResult;
|
||||||
|
import com.ydool.staff.request.AuditRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -14,5 +15,10 @@ import com.ydool.common.data.dto.AjaxResult;
|
||||||
public interface IAuditService {
|
public interface IAuditService {
|
||||||
|
|
||||||
AjaxResult getAuditList(Page page);
|
AjaxResult getAuditList(Page page);
|
||||||
|
|
||||||
|
AjaxResult audit(AuditRequest auditRequest);
|
||||||
|
|
||||||
|
Integer saveAuditLog(String personnelId,String approverId,String auditSate);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
package com.ydool.staff.service.impl;
|
package com.ydool.staff.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.ydool.common.base.BaseService;
|
import com.ydool.common.base.BaseService;
|
||||||
import com.ydool.common.data.dto.AjaxResult;
|
import com.ydool.common.data.dto.AjaxResult;
|
||||||
|
import com.ydool.staff.dto.AuditLogDto;
|
||||||
import com.ydool.staff.entity.AuditLog;
|
import com.ydool.staff.entity.AuditLog;
|
||||||
import com.ydool.staff.mapper.AuditLogMapper;
|
import com.ydool.staff.mapper.AuditLogMapper;
|
||||||
import com.ydool.staff.service.IAuditLogService;
|
import com.ydool.staff.service.IAuditLogService;
|
||||||
|
import com.ydool.system.entity.User;
|
||||||
|
import com.ydool.system.mapper.UserMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,12 +25,18 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class AuditLogServiceImpl extends BaseService<AuditLogMapper, AuditLog> implements IAuditLogService {
|
public class AuditLogServiceImpl extends BaseService<AuditLogMapper, AuditLog> implements IAuditLogService {
|
||||||
|
@Resource
|
||||||
|
private UserMapper userMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult auditLog(String id) {
|
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));
|
||||||
return AjaxResult.ok().data(list);
|
List<AuditLogDto> auditLogDtos = BeanUtil.copyToList(list, AuditLogDto.class);
|
||||||
|
for (AuditLogDto auditLogDto : auditLogDtos) {
|
||||||
|
User user = userMapper.selectById(auditLogDto.getApprover());
|
||||||
|
auditLogDto.setApprover(user.getUserName());
|
||||||
|
}
|
||||||
|
return AjaxResult.ok().data(auditLogDtos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,30 @@
|
||||||
package com.ydool.staff.service.impl;
|
package com.ydool.staff.service.impl;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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.common.data.dto.AjaxResult;
|
||||||
import com.ydool.staff.entity.Audit;
|
import com.ydool.staff.entity.Audit;
|
||||||
import com.ydool.common.base.BaseService;
|
import com.ydool.staff.entity.AuditLog;
|
||||||
|
import com.ydool.staff.entity.Personnel;
|
||||||
|
import com.ydool.staff.mapper.AuditLogMapper;
|
||||||
import com.ydool.staff.mapper.AuditMapper;
|
import com.ydool.staff.mapper.AuditMapper;
|
||||||
|
import com.ydool.staff.mapper.PersonnelMapper;
|
||||||
|
import com.ydool.staff.request.AuditRequest;
|
||||||
import com.ydool.staff.service.IAuditService;
|
import com.ydool.staff.service.IAuditService;
|
||||||
|
import com.ydool.system.entity.Config;
|
||||||
|
import com.ydool.system.entity.User;
|
||||||
|
import com.ydool.system.mapper.ConfigMapper;
|
||||||
|
import com.ydool.system.mapper.UserMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -20,10 +37,114 @@ import org.springframework.stereotype.Service;
|
||||||
@Service
|
@Service
|
||||||
public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements IAuditService {
|
public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements IAuditService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ConfigMapper configMapper;
|
||||||
|
@Resource
|
||||||
|
private UserMapper userMapper;
|
||||||
|
@Resource
|
||||||
|
private AuditLogMapper auditLogMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PersonnelMapper personnelMapper;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult getAuditList(Page page) {
|
public AjaxResult getAuditList(Page page) {
|
||||||
Page AuditPage = page(page, new LambdaQueryWrapper<Audit>().eq(Audit::getAuditState, "submit"));
|
Page AuditPage = page(page, new LambdaQueryWrapper<Audit>().eq(Audit::getAuditState, "submit"));
|
||||||
return AjaxResult.ok().data(AuditPage);
|
return AjaxResult.ok().data(AuditPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult audit(AuditRequest auditRequest) {
|
||||||
|
String loginId = (String) StpUtil.getLoginId();
|
||||||
|
Audit one = getOne(new LambdaQueryWrapper<Audit>()
|
||||||
|
.eq(Audit::getPersonnelId, auditRequest.getPersonnelId())
|
||||||
|
.eq(Audit::getAuditOrder, ArgsConst.WAITING).eq(Audit::getApprover, loginId));
|
||||||
|
if (ObjectUtil.isEmpty(one)){
|
||||||
|
return AjaxResult.fail().msg("该用户不能审批!");
|
||||||
|
}
|
||||||
|
List<Audit> list = list(new LambdaQueryWrapper<Audit>().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()));
|
||||||
|
//同意
|
||||||
|
if ("2".equals(auditRequest.getStatus())){
|
||||||
|
for (Audit audit : list) {
|
||||||
|
User byId = userMapper.selectById(audit.getAuditOrder());
|
||||||
|
Config director = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
|
||||||
|
if (byId.getLoginName().equals(director.getParamValue())){
|
||||||
|
one.setAuditOrder(ArgsConst.PASS);
|
||||||
|
boolean update = updateById(one);
|
||||||
|
if (update){
|
||||||
|
User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
|
||||||
|
.eq(User::getLoginName, configMapper.selectOne(new LambdaQueryWrapper<Config>()
|
||||||
|
.eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP)).getParamValue()));
|
||||||
|
Audit auditOne = getOne(new LambdaQueryWrapper<Audit>().eq(Audit::getApprover, user.getId()).eq(Audit::getPersonnelId, auditRequest.getPersonnelId()));
|
||||||
|
auditOne.setAuditOrder(ArgsConst.WAITING);
|
||||||
|
updateById(auditOne);
|
||||||
|
saveAuditLog(auditRequest.getPersonnelId(),loginId,"一般初审通过");
|
||||||
|
}
|
||||||
|
return update ? AjaxResult.ok().msg("审批成功!"):AjaxResult.fail().msg("审批成功!");
|
||||||
|
}
|
||||||
|
Config leadership = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
|
||||||
|
if (leadership.getParamValue().equals(byId.getLoginName())){
|
||||||
|
one.setAuditOrder(ArgsConst.PASS);
|
||||||
|
boolean update = updateById(one);
|
||||||
|
if (update){
|
||||||
|
saveAuditLog(auditRequest.getPersonnelId(),loginId,"一般终审通过");
|
||||||
|
Personnel personnel = personnelMapper.selectById(auditRequest.getPersonnelId());
|
||||||
|
personnel.setAuditState(2);
|
||||||
|
personnel.setAlterationSign("2");
|
||||||
|
personnelMapper.updateById(personnel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return update ? AjaxResult.ok().msg("审批成功!"):AjaxResult.fail().msg("审批成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//拒绝
|
||||||
|
for (Audit audit : list) {
|
||||||
|
User byId = userMapper.selectById(audit.getAuditOrder());
|
||||||
|
Config director = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
|
||||||
|
if (byId.getLoginName().equals(director.getParamValue())){
|
||||||
|
one.setAuditOrder(ArgsConst.REJECT);
|
||||||
|
one.setOpinion(audit.getOpinion());
|
||||||
|
boolean update = updateById(one);
|
||||||
|
if (update){
|
||||||
|
|
||||||
|
saveAuditLog(auditRequest.getPersonnelId(),loginId,"一般初审拒绝");
|
||||||
|
Personnel personnel = personnelMapper.selectById(auditRequest.getPersonnelId());
|
||||||
|
personnel.setAuditState(3);
|
||||||
|
personnel.setAlterationSign("2");
|
||||||
|
personnelMapper.updateById(personnel);
|
||||||
|
}
|
||||||
|
return update ? AjaxResult.ok().msg("审批成功!"):AjaxResult.fail().msg("审批成功!");
|
||||||
|
}
|
||||||
|
Config leadership = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
|
||||||
|
if (leadership.getParamValue().equals(byId.getLoginName())){
|
||||||
|
one.setAuditOrder(ArgsConst.REJECT);
|
||||||
|
one.setOpinion(audit.getOpinion());
|
||||||
|
boolean update = updateById(one);
|
||||||
|
if (update){
|
||||||
|
saveAuditLog(auditRequest.getPersonnelId(),loginId,"一般终审拒绝");
|
||||||
|
Personnel personnel = personnelMapper.selectById(auditRequest.getPersonnelId());
|
||||||
|
personnel.setAuditState(3);
|
||||||
|
personnel.setAlterationSign("2");
|
||||||
|
personnelMapper.updateById(personnel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return update ? AjaxResult.ok().msg("审批成功!"):AjaxResult.fail().msg("审批成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public Integer saveAuditLog(String personnelId,String approverId,String auditSate){
|
||||||
|
AuditLog auditLog = new AuditLog();
|
||||||
|
auditLog.setPersonnelId(personnelId);
|
||||||
|
auditLog.setApprover(approverId);
|
||||||
|
auditLog.setAuditState(auditSate);
|
||||||
|
return auditLogMapper.insert(auditLog);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,11 @@ import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.IdcardUtil;
|
import cn.hutool.core.util.IdcardUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
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.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.ydool.common.base.BaseService;
|
import com.ydool.common.base.BaseService;
|
||||||
|
import com.ydool.common.cache.ConfigCache;
|
||||||
import com.ydool.common.constant.ArgsConst;
|
import com.ydool.common.constant.ArgsConst;
|
||||||
import com.ydool.common.data.dto.AjaxResult;
|
import com.ydool.common.data.dto.AjaxResult;
|
||||||
import com.ydool.common.utils.ColumnUtil;
|
import com.ydool.common.utils.ColumnUtil;
|
||||||
|
@ -22,7 +23,6 @@ import com.ydool.staff.dto.PersonnelUpdateDto;
|
||||||
import com.ydool.staff.entity.Alteration;
|
import com.ydool.staff.entity.Alteration;
|
||||||
import com.ydool.staff.entity.Attachment;
|
import com.ydool.staff.entity.Attachment;
|
||||||
import com.ydool.staff.entity.Audit;
|
import com.ydool.staff.entity.Audit;
|
||||||
import com.ydool.staff.entity.AuditLog;
|
|
||||||
import com.ydool.staff.entity.CompanyName;
|
import com.ydool.staff.entity.CompanyName;
|
||||||
import com.ydool.staff.entity.Personnel;
|
import com.ydool.staff.entity.Personnel;
|
||||||
import com.ydool.staff.entity.SelectRequest;
|
import com.ydool.staff.entity.SelectRequest;
|
||||||
|
@ -40,9 +40,14 @@ import com.ydool.staff.request.PersonnelDeleteRequest;
|
||||||
import com.ydool.staff.request.PersonnelRequest;
|
import com.ydool.staff.request.PersonnelRequest;
|
||||||
import com.ydool.staff.request.PersonnelUpdateRequest;
|
import com.ydool.staff.request.PersonnelUpdateRequest;
|
||||||
import com.ydool.staff.service.IAttachmentService;
|
import com.ydool.staff.service.IAttachmentService;
|
||||||
|
import com.ydool.staff.service.IAuditService;
|
||||||
import com.ydool.staff.service.IPersonnelService;
|
import com.ydool.staff.service.IPersonnelService;
|
||||||
|
import com.ydool.system.entity.Config;
|
||||||
import com.ydool.system.entity.Dept;
|
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.DeptMapper;
|
||||||
|
import com.ydool.system.mapper.UserMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
@ -81,6 +86,21 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
||||||
@Resource
|
@Resource
|
||||||
private DeptMapper deptMapper;
|
private DeptMapper deptMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserMapper userMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AuditLogMapper auditLogMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AuditMapper auditMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IAuditService auditService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ConfigMapper configMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人员列表
|
* 人员列表
|
||||||
|
@ -96,6 +116,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
||||||
PersonnelDto dto = BeanUtil.copyProperties(e, PersonnelDto.class);
|
PersonnelDto dto = BeanUtil.copyProperties(e, PersonnelDto.class);
|
||||||
CompanyName companyName = companyNameMapper.selectById(e.getCompanyName());
|
CompanyName companyName = companyNameMapper.selectById(e.getCompanyName());
|
||||||
Dept dept = deptMapper.selectById(e.getPresentDept());
|
Dept dept = deptMapper.selectById(e.getPresentDept());
|
||||||
|
dto.setAlterationSign("0".equals(e.getAlterationSign())?"未变更":("1".equals(e.getAlterationSign())?"变更中":"变更完成"));
|
||||||
if (ObjectUtil.isNotNull(companyName)){
|
if (ObjectUtil.isNotNull(companyName)){
|
||||||
dto.setCompanyName(companyName.getCompanyName());
|
dto.setCompanyName(companyName.getCompanyName());
|
||||||
}
|
}
|
||||||
|
@ -179,8 +200,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
||||||
String card = StringUtils.join(saveFilePath(cardFile, ArgsConst.CARD_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
|
String card = StringUtils.join(saveFilePath(cardFile, ArgsConst.CARD_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
|
||||||
String education = StringUtils.join(saveFilePath(educationFile, ArgsConst.EDUCATION_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
|
String education = StringUtils.join(saveFilePath(educationFile, ArgsConst.EDUCATION_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
|
||||||
String audit = StringUtils.join(saveFilePath(auditFile, ArgsConst.AUDIT_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
|
String audit = StringUtils.join(saveFilePath(auditFile, ArgsConst.AUDIT_FILE, ArgsConst.UPDATE, updateRequest.getId()), ',');
|
||||||
System.out.println("per = " + per);
|
if ("1".equals(per.getAlterationSign())) {
|
||||||
if (per.getAuditState().equals(0) || per.getAuditState().equals(1)) {
|
|
||||||
return AjaxResult.fail().msg("该人员修改的资料未审批完成,请联系管理员!");
|
return AjaxResult.fail().msg("该人员修改的资料未审批完成,请联系管理员!");
|
||||||
}
|
}
|
||||||
String type = ArgsConst.PERSONNEL;
|
String type = ArgsConst.PERSONNEL;
|
||||||
|
@ -196,7 +216,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
||||||
saveAlteration("学历证书附件更改", per.getEducationFile(), education, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getEducationFile));
|
saveAlteration("学历证书附件更改", per.getEducationFile(), education, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getEducationFile));
|
||||||
saveAlteration("审批资料附件更改", per.getAuditFile(), audit, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getAuditFile));
|
saveAlteration("审批资料附件更改", per.getAuditFile(), audit, type, updateRequest.getId(), ColumnUtil.getFieldName(Personnel::getAuditFile));
|
||||||
|
|
||||||
per.setAuditState(0);
|
per.setAlterationSign("1");
|
||||||
boolean update = updateById(per);
|
boolean update = updateById(per);
|
||||||
saveAttachment(cardFile, ArgsConst.CARD_FILE, updateRequest.getId(), ArgsConst.UPDATE);
|
saveAttachment(cardFile, ArgsConst.CARD_FILE, updateRequest.getId(), ArgsConst.UPDATE);
|
||||||
saveAttachment(educationFile, ArgsConst.EDUCATION_FILE, updateRequest.getId(), ArgsConst.UPDATE);
|
saveAttachment(educationFile, ArgsConst.EDUCATION_FILE, updateRequest.getId(), ArgsConst.UPDATE);
|
||||||
|
@ -212,7 +232,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
||||||
List<AttachmentRequest> engageFiles = request.getEngageFiles();
|
List<AttachmentRequest> engageFiles = request.getEngageFiles();
|
||||||
List<AttachmentRequest> educationFiles = request.getEducationFiles();
|
List<AttachmentRequest> educationFiles = request.getEducationFiles();
|
||||||
List<AttachmentRequest> auditFiles = request.getAuditFiles();
|
List<AttachmentRequest> auditFiles = request.getAuditFiles();
|
||||||
if (per.getAuditState().equals(0) || per.getAuditState().equals(1)) {
|
if ("1".equals(per.getAlterationSign())) {
|
||||||
return AjaxResult.fail().msg("该人员修改的资料未审批完成,请联系管理员!");
|
return AjaxResult.fail().msg("该人员修改的资料未审批完成,请联系管理员!");
|
||||||
}
|
}
|
||||||
String type = ArgsConst.CHANGE;
|
String type = ArgsConst.CHANGE;
|
||||||
|
@ -235,7 +255,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
||||||
saveAlteration("职称证书附件更改",per.getJobTitleFile(),engage,type,request.getId(),ColumnUtil.getFieldName(Personnel::getJobTitleFile));
|
saveAlteration("职称证书附件更改",per.getJobTitleFile(),engage,type,request.getId(),ColumnUtil.getFieldName(Personnel::getJobTitleFile));
|
||||||
saveAlteration("学历证书附件更改",per.getEducationFile(),education,type,request.getId(),ColumnUtil.getFieldName(Personnel::getEducationFile));
|
saveAlteration("学历证书附件更改",per.getEducationFile(),education,type,request.getId(),ColumnUtil.getFieldName(Personnel::getEducationFile));
|
||||||
saveAlteration("审批资料附件更改",per.getAuditFile(),audit,type,request.getId(),ColumnUtil.getFieldName(Personnel::getAuditFile));
|
saveAlteration("审批资料附件更改",per.getAuditFile(),audit,type,request.getId(),ColumnUtil.getFieldName(Personnel::getAuditFile));
|
||||||
per.setAuditState(0);
|
per.setAlterationSign("0");
|
||||||
boolean update = updateById(per);
|
boolean update = updateById(per);
|
||||||
saveAttachment(cardFiles, ArgsConst.CARD_FILE, request.getId(), ArgsConst.UPDATE);
|
saveAttachment(cardFiles, ArgsConst.CARD_FILE, request.getId(), ArgsConst.UPDATE);
|
||||||
saveAttachment(jobTitleFiles, ArgsConst.JOBTITLE_FILE, request.getId(), ArgsConst.UPDATE);
|
saveAttachment(jobTitleFiles, ArgsConst.JOBTITLE_FILE, request.getId(), ArgsConst.UPDATE);
|
||||||
|
@ -412,7 +432,8 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
||||||
failList.add(failMsgVO);
|
failList.add(failMsgVO);
|
||||||
} else {
|
} else {
|
||||||
//转义
|
//转义
|
||||||
Personnel personnel = interpretPersonnelExportVO(personnelExportVO);
|
Personnel personnel = BeanUtil.copyProperties(personnelExportVO, Personnel.class);
|
||||||
|
personnel.setFreshGraduate("是".equals(personnelExportVO.getFreshGraduate()) ? "1" : "0");
|
||||||
//保存
|
//保存
|
||||||
failMsgVO.setFailMsg(failMsgVO.getFailMsg() + (save(personnel) ? "导入成功" : "导入失败"));
|
failMsgVO.setFailMsg(failMsgVO.getFailMsg() + (save(personnel) ? "导入成功" : "导入失败"));
|
||||||
failList.add(failMsgVO);
|
failList.add(failMsgVO);
|
||||||
|
@ -433,31 +454,44 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
||||||
for (Field declaredField : declaredFields) {
|
for (Field declaredField : declaredFields) {
|
||||||
list.add(declaredField.getName());
|
list.add(declaredField.getName());
|
||||||
}
|
}
|
||||||
return AjaxResult.ok().data(list);
|
return AjaxResult.ok().data(list).msg("查询成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult giveAudit(String id, String type) {
|
public AjaxResult giveAudit(String id, String type) {
|
||||||
AuditMapper auditMapper = SpringUtil.getBean(AuditMapper.class);
|
|
||||||
AuditLogMapper auditLogMapper = SpringUtil.getBean(AuditLogMapper.class);
|
|
||||||
String loginId = (String) StpUtil.getLoginId();
|
String loginId = (String) StpUtil.getLoginId();
|
||||||
Audit audit = new Audit();
|
|
||||||
AuditLog auditLog = new AuditLog();
|
for(int i=0;i<2;i++ ){
|
||||||
audit.setPersonnelId(id);
|
Audit audit = new Audit();
|
||||||
audit.setPerType(type);
|
audit.setPersonnelId(id);
|
||||||
audit.setAuditState(ArgsConst.SUBMIT);
|
audit.setPerType(type);
|
||||||
audit.setAuditOrder(ArgsConst.GIVE_AUDIT);
|
if(i==0){
|
||||||
audit.setApprover(loginId);
|
audit.setAuditState(ArgsConst.SUBMIT);
|
||||||
audit.setApproverTime(new Date());
|
audit.setAuditOrder(ArgsConst.GIVE_AUDIT);
|
||||||
int i = auditMapper.insert(audit);
|
audit.setApprover(loginId);
|
||||||
if(i>0){
|
audit.setApproverTime(new Date());
|
||||||
auditLog.setPersonnelId(audit.getPersonnelId());
|
}else if(i==1){
|
||||||
auditLog.setApprover(audit.getApprover());
|
audit.setAuditOrder(ArgsConst.FIRST);
|
||||||
auditLog.setAuditState("一般送审提交");
|
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR));
|
||||||
auditLogMapper.insert(auditLog);
|
audit.setAuditOrder(ArgsConst.WAITING);
|
||||||
|
User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue()));
|
||||||
|
audit.setApprover(user.getId());
|
||||||
|
}else {
|
||||||
|
audit.setAuditOrder(ArgsConst.LAST);
|
||||||
|
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
|
||||||
|
User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue()));
|
||||||
|
audit.setApprover(user.getId());
|
||||||
|
}
|
||||||
|
auditMapper.insert(audit);
|
||||||
}
|
}
|
||||||
return i>0 ? AjaxResult.ok().msg("送审成功!") : AjaxResult.fail().msg("送审失败!");
|
|
||||||
|
Personnel personnel = get(id);
|
||||||
|
personnel.setAuditState(1);
|
||||||
|
personnel.setAlterationSign("1");
|
||||||
|
updateById(personnel);
|
||||||
|
Integer a = auditService.saveAuditLog(id, loginId, "一般送审提交");
|
||||||
|
return a>0 ? AjaxResult.ok().msg("送审成功!") : AjaxResult.fail().msg("送审失败!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public PersonnelFailMsgVO checkPersonnelExportVO(PersonnelExportVO personnelExportVO) {
|
public PersonnelFailMsgVO checkPersonnelExportVO(PersonnelExportVO personnelExportVO) {
|
||||||
|
@ -479,11 +513,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
||||||
return failMsgVO;
|
return failMsgVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Personnel interpretPersonnelExportVO(PersonnelExportVO personnelExportVO) {
|
|
||||||
Personnel personnel = BeanUtil.copyProperties(personnelExportVO, Personnel.class);
|
|
||||||
personnel.setFreshGraduate("是".equals(personnelExportVO.getFreshGraduate()) ? "1" : "0");
|
|
||||||
return personnel;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue