From 66ce0bda91c53ae41008fcefb3b460377f7d6c5b Mon Sep 17 00:00:00 2001 From: zhuyy Date: Tue, 21 Feb 2023 16:21:45 +0800 Subject: [PATCH] update --- .../DirectorsSupervisorsController.java | 8 +++ .../service/IDirectorsSupervisorsService.java | 2 + .../staff/service/impl/AuditServiceImpl.java | 2 +- .../impl/DirectorsSupervisorsServiceImpl.java | 49 +++++++++++++++++++ 4 files changed, 60 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/ydool/staff/controller/DirectorsSupervisorsController.java b/src/main/java/com/ydool/staff/controller/DirectorsSupervisorsController.java index 3c2a24f..96ed303 100644 --- a/src/main/java/com/ydool/staff/controller/DirectorsSupervisorsController.java +++ b/src/main/java/com/ydool/staff/controller/DirectorsSupervisorsController.java @@ -3,6 +3,7 @@ package com.ydool.staff.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.xiaoymin.knife4j.annotations.ApiSupport; import com.ydool.common.base.BaseController; +import com.ydool.common.constant.ArgsConst; import com.ydool.common.constant.UrlConstant; import com.ydool.common.data.dto.AjaxResult; import com.ydool.staff.dto.DirectorsSupervisorsDto; @@ -63,4 +64,11 @@ public class DirectorsSupervisorsController extends BaseController { public AjaxResult deleteDirectorsSupervisors(@RequestBody IdsRequest ids) { return directorsSupervisorsService.deleteDirectorsSupervisors(ids); } + + @GetMapping("/submitDirectorsSupervisors") + @ApiOperation(value = "董监任免申报送审") + @ApiImplicitParams({@ApiImplicitParam(value = "董监id", name = "id")}) + public AjaxResult submitDirectorsSupervisors(String id) { + return directorsSupervisorsService.submitDirectorsSupervisors(id, ArgsConst.DIRECTORS); + } } diff --git a/src/main/java/com/ydool/staff/service/IDirectorsSupervisorsService.java b/src/main/java/com/ydool/staff/service/IDirectorsSupervisorsService.java index 910c47a..deb5bd6 100644 --- a/src/main/java/com/ydool/staff/service/IDirectorsSupervisorsService.java +++ b/src/main/java/com/ydool/staff/service/IDirectorsSupervisorsService.java @@ -28,5 +28,7 @@ public interface IDirectorsSupervisorsService { AjaxResult selectDirectorsSupervisorsById(String id); AjaxResult selectDirectorsSupervisorsFile(Page page, String id); + + AjaxResult submitDirectorsSupervisors(String id, String directors); } diff --git a/src/main/java/com/ydool/staff/service/impl/AuditServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/AuditServiceImpl.java index 7b59e35..925b9c6 100644 --- a/src/main/java/com/ydool/staff/service/impl/AuditServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/AuditServiceImpl.java @@ -205,7 +205,7 @@ public class AuditServiceImpl extends BaseService implements one.setAuditState(ArgsConst.PASS); boolean update = updateById(one); if (update) { - Audit one1 = getOne(new LambdaQueryWrapper().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getApprover, loginId).eq(Audit::getAuditOrder, ArgsConst.LAST)); + Audit one1 = getOne(new LambdaQueryWrapper().eq(Audit::getPersonnelId, auditRequest.getPersonnelId()).eq(Audit::getAuditOrder, ArgsConst.LAST)); one1.setAuditOrder(ArgsConst.WAITING); updateById(one1); recruitment.setFirstTrial(auditRequest.getAuditOpinion()); diff --git a/src/main/java/com/ydool/staff/service/impl/DirectorsSupervisorsServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/DirectorsSupervisorsServiceImpl.java index a3bdb13..a3cbedd 100644 --- a/src/main/java/com/ydool/staff/service/impl/DirectorsSupervisorsServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/DirectorsSupervisorsServiceImpl.java @@ -1,5 +1,6 @@ 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.IdcardUtil; @@ -7,6 +8,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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; @@ -20,7 +22,12 @@ import com.ydool.staff.mapper.AttachmentMapper; import com.ydool.staff.mapper.AuditMapper; import com.ydool.staff.mapper.CompanyNameMapper; import com.ydool.staff.mapper.DirectorsSupervisorsMapper; +import com.ydool.staff.service.IAuditService; import com.ydool.staff.service.IDirectorsSupervisorsService; +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 com.ydool.system.request.IdsRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,6 +37,7 @@ import org.thymeleaf.util.StringUtils; import javax.validation.constraints.NotEmpty; import java.util.ArrayList; import java.util.Arrays; +import java.util.Date; import java.util.List; /** @@ -51,6 +59,12 @@ public class DirectorsSupervisorsServiceImpl extends BaseService page, DirectorsSupervisorsDto directorsSupervisorsDto) { @@ -133,5 +147,40 @@ public class DirectorsSupervisorsServiceImpl extends BaseService attachmentPage = attachmentMapper.selectPage(page, new LambdaQueryWrapper().eq(Attachment::getTargetId, id).eq(Attachment::getTargetType, ArgsConst.DIRECTORS)); return AjaxResult.ok().data(attachmentPage); } + + @Override + public AjaxResult submitDirectorsSupervisors(String id, String type) { + String loginId = StpUtil.getLoginIdAsString(); + DirectorsSupervisors directorsSupervisors = get(id); + if (1 == directorsSupervisors.getAuditState()) { + return AjaxResult.fail().msg("该数据已送审,请勿重复操作!"); + } + for (int i = 0; i <= 2; i++) { + Audit audit = new Audit(); + 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().eq(Config::getParamKey, ConfigCache.SYS_USER_PERSONNEL_DIRECTOR)); + audit.setAuditOrder(ArgsConst.WAITING); + audit.setApprover(userMapper.selectOne(new LambdaQueryWrapper().eq(User::getLoginName, config.getParamValue())).getId()); + audit.setApproverTime(new Date()); + } else if (i == 2) { + Config config = configMapper.selectOne(new LambdaQueryWrapper().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP)); + audit.setAuditOrder(ArgsConst.LAST); + audit.setApprover(userMapper.selectOne(new LambdaQueryWrapper().eq(User::getLoginName, config.getParamValue())).getId()); + audit.setApproverTime(new Date()); + } + auditMapper.insert(audit); + } + directorsSupervisors.setAuditState(1); + updateById(directorsSupervisors); + Integer a = auditService.saveAuditLog(id, loginId, "送审"); + return a > 0 ? AjaxResult.ok().msg("送审成功!") : AjaxResult.fail().msg("送审失败!"); + } }