From c6643ee103b9e074bd528a3462f78d94eb6e7e73 Mon Sep 17 00:00:00 2001 From: mash Date: Mon, 20 Feb 2023 13:30:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=89=B9=E6=95=B0=E6=8D=AE=E6=94=B9?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ydool/common/gen/Generator.java | 2 +- .../ydool/staff/dto/PersonnelUpdateDto.java | 3 + .../com/ydool/staff/entity/Alteration.java | 1 + .../com/ydool/staff/entity/Personnel.java | 8 +- .../ydool/staff/entity/PersonnelMiddle.java | 36 +++++++ .../staff/mapper/PersonnelMiddleMapper.java | 18 ++++ .../service/IPersonnelMiddleService.java | 14 +++ .../staff/service/impl/AuditServiceImpl.java | 17 +++- .../impl/PersonnelMiddleServiceImpl.java | 21 ++++ .../service/impl/PersonnelServiceImpl.java | 97 +++++++++++++------ .../resources/templates/serviceImpl.java.btl | 4 +- 11 files changed, 181 insertions(+), 40 deletions(-) create mode 100644 src/main/java/com/ydool/staff/entity/PersonnelMiddle.java create mode 100644 src/main/java/com/ydool/staff/mapper/PersonnelMiddleMapper.java create mode 100644 src/main/java/com/ydool/staff/service/IPersonnelMiddleService.java create mode 100644 src/main/java/com/ydool/staff/service/impl/PersonnelMiddleServiceImpl.java diff --git a/src/main/java/com/ydool/common/gen/Generator.java b/src/main/java/com/ydool/common/gen/Generator.java index 6f87997..bb2d3f9 100644 --- a/src/main/java/com/ydool/common/gen/Generator.java +++ b/src/main/java/com/ydool/common/gen/Generator.java @@ -27,7 +27,7 @@ public class Generator { public static void main(String[] args) { //表名 - String tableName = "t_lc_audit_log"; + String tableName = "t_lc_personnel_middle"; //表前缀 String tablePrefix = "t_lc_"; //作者— diff --git a/src/main/java/com/ydool/staff/dto/PersonnelUpdateDto.java b/src/main/java/com/ydool/staff/dto/PersonnelUpdateDto.java index 713043a..641358f 100644 --- a/src/main/java/com/ydool/staff/dto/PersonnelUpdateDto.java +++ b/src/main/java/com/ydool/staff/dto/PersonnelUpdateDto.java @@ -132,4 +132,7 @@ public class PersonnelUpdateDto { @ApiModelProperty(value = "审批资料附件") private List auditFiles; + + @ApiModelProperty(value = "审批按钮") + private Boolean auditBtn = false; } diff --git a/src/main/java/com/ydool/staff/entity/Alteration.java b/src/main/java/com/ydool/staff/entity/Alteration.java index ba0274b..98ba442 100644 --- a/src/main/java/com/ydool/staff/entity/Alteration.java +++ b/src/main/java/com/ydool/staff/entity/Alteration.java @@ -47,4 +47,5 @@ public class Alteration extends BaseEntity{ + } diff --git a/src/main/java/com/ydool/staff/entity/Personnel.java b/src/main/java/com/ydool/staff/entity/Personnel.java index 7315213..fe006b4 100644 --- a/src/main/java/com/ydool/staff/entity/Personnel.java +++ b/src/main/java/com/ydool/staff/entity/Personnel.java @@ -4,15 +4,14 @@ package com.ydool.staff.entity; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import com.ydool.common.base.BaseEntity; - -import java.time.LocalDate; - import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; +import java.time.LocalDate; + /** *

* 人员表 @@ -154,4 +153,7 @@ public class Personnel extends BaseEntity { @ApiModelProperty(value = "单据状态") private String receipts; + @ApiModelProperty(value = "数据状态:0:历史数据 ,1:暂存数据,2:当前数据") + private String state; + } diff --git a/src/main/java/com/ydool/staff/entity/PersonnelMiddle.java b/src/main/java/com/ydool/staff/entity/PersonnelMiddle.java new file mode 100644 index 0000000..f9a5d4e --- /dev/null +++ b/src/main/java/com/ydool/staff/entity/PersonnelMiddle.java @@ -0,0 +1,36 @@ +package com.ydool.staff.entity; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ydool.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +/** + *

+ * 人员修改中间表 + *

+ * + * @author msh + * @since 2023-02-20 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("t_lc_personnel_middle") +@ApiModel(value="PersonnelMiddle对象", description="人员修改中间表") +public class PersonnelMiddle extends BaseEntity{ + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "变更前id") + private String beforeId; + + @ApiModelProperty(value = "变更后id") + private String afterId; + + @ApiModelProperty(value = "数据状态:0:历史数据 ,1:待定数据") + private String state; + + +} diff --git a/src/main/java/com/ydool/staff/mapper/PersonnelMiddleMapper.java b/src/main/java/com/ydool/staff/mapper/PersonnelMiddleMapper.java new file mode 100644 index 0000000..0202bd3 --- /dev/null +++ b/src/main/java/com/ydool/staff/mapper/PersonnelMiddleMapper.java @@ -0,0 +1,18 @@ +package com.ydool.staff.mapper; + +import com.ydool.staff.entity.PersonnelMiddle; +import com.github.yulichang.base.MPJBaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *

+ * 人员修改中间表 Mapper 接口 + *

+ * + * @author msh + * @since 2023-02-20 + */ +@Mapper +public interface PersonnelMiddleMapper extends MPJBaseMapper { + +} diff --git a/src/main/java/com/ydool/staff/service/IPersonnelMiddleService.java b/src/main/java/com/ydool/staff/service/IPersonnelMiddleService.java new file mode 100644 index 0000000..1918b99 --- /dev/null +++ b/src/main/java/com/ydool/staff/service/IPersonnelMiddleService.java @@ -0,0 +1,14 @@ +package com.ydool.staff.service; + +/** + *

+ * 人员修改中间表 服务类 + *

+ * + * @author msh + * @since 2023-02-20 + */ +public interface IPersonnelMiddleService { + +} + 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 dfb9472..b7b84c0 100644 --- a/src/main/java/com/ydool/staff/service/impl/AuditServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/AuditServiceImpl.java @@ -11,9 +11,11 @@ import com.ydool.common.data.dto.AjaxResult; import com.ydool.staff.entity.Audit; import com.ydool.staff.entity.AuditLog; import com.ydool.staff.entity.Personnel; +import com.ydool.staff.entity.PersonnelMiddle; import com.ydool.staff.mapper.AuditLogMapper; import com.ydool.staff.mapper.AuditMapper; import com.ydool.staff.mapper.PersonnelMapper; +import com.ydool.staff.mapper.PersonnelMiddleMapper; import com.ydool.staff.request.AuditRequest; import com.ydool.staff.service.IAuditService; import com.ydool.system.entity.Config; @@ -46,7 +48,8 @@ public class AuditServiceImpl extends BaseService implements @Resource private PersonnelMapper personnelMapper; - + @Resource + private PersonnelMiddleMapper personnelMiddleMapper; @Override public AjaxResult getAuditList(Page page) { @@ -64,6 +67,7 @@ public class AuditServiceImpl extends BaseService implements if (ObjectUtil.isEmpty(one)){ return AjaxResult.fail().msg("该用户不能审批!"); } + List list = list(new LambdaQueryWrapper().eq(Audit::getPersonnelId, auditRequest.getPersonnelId())); //同意 if ("2".equals(auditRequest.getStatus())){ @@ -91,8 +95,15 @@ public class AuditServiceImpl extends BaseService implements if (update){ saveAuditLog(auditRequest.getPersonnelId(),loginId,"一般终审通过"); Personnel personnel = personnelMapper.selectById(auditRequest.getPersonnelId()); - personnel.setAuditState(2); - personnel.setAlterationSign("2"); + PersonnelMiddle middle = personnelMiddleMapper.selectOne(new LambdaQueryWrapper().eq(PersonnelMiddle::getBeforeId, personnel.getId()).eq(PersonnelMiddle::getState, "1")); + System.out.println("middle = " + middle); + Personnel personnel1 = personnelMapper.selectById(middle.getAfterId()); + String id = personnel1.getId(); + personnel1.setState("2"); + personnel1.setId(personnel.getId()); + personnel.setId(id); + personnel.setState("0"); + personnelMapper.updateById(personnel1); personnelMapper.updateById(personnel); } diff --git a/src/main/java/com/ydool/staff/service/impl/PersonnelMiddleServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/PersonnelMiddleServiceImpl.java new file mode 100644 index 0000000..0a26e53 --- /dev/null +++ b/src/main/java/com/ydool/staff/service/impl/PersonnelMiddleServiceImpl.java @@ -0,0 +1,21 @@ +package com.ydool.staff.service.impl; + +import com.ydool.staff.entity.PersonnelMiddle; +import com.ydool.common.base.BaseService; +import com.ydool.staff.mapper.PersonnelMiddleMapper; +import com.ydool.staff.service.IPersonnelMiddleService; +import org.springframework.stereotype.Service; + +/** + *

+ * 人员修改中间表 服务类 + *

+ * + * @author msh + * @since 2023-02-20 + */ +@Service +public class PersonnelMiddleServiceImpl extends BaseService implements IPersonnelMiddleService { + +} + diff --git a/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java index 319b164..3fec385 100644 --- a/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java @@ -25,6 +25,7 @@ import com.ydool.staff.entity.Attachment; import com.ydool.staff.entity.Audit; import com.ydool.staff.entity.CompanyName; import com.ydool.staff.entity.Personnel; +import com.ydool.staff.entity.PersonnelMiddle; import com.ydool.staff.entity.SelectRequest; import com.ydool.staff.excel.ExcelPersonnel; import com.ydool.staff.excel.PersonnelExportVO; @@ -34,6 +35,7 @@ import com.ydool.staff.mapper.AuditLogMapper; import com.ydool.staff.mapper.AuditMapper; import com.ydool.staff.mapper.CompanyNameMapper; import com.ydool.staff.mapper.PersonnelMapper; +import com.ydool.staff.mapper.PersonnelMiddleMapper; import com.ydool.staff.request.AttachmentRequest; import com.ydool.staff.request.ChangeRequest; import com.ydool.staff.request.PersonnelDeleteRequest; @@ -56,6 +58,7 @@ import org.thymeleaf.util.StringUtils; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.lang.reflect.Field; +import java.time.LocalDate; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; @@ -100,6 +103,8 @@ public class PersonnelServiceImpl extends BaseService list = auditMapper.selectList(new LambdaQueryWrapper() + .eq(Audit::getPersonnelId, personnel.getId()) + .eq(Audit::getApprover,StpUtil.getLoginIdAsString())); + for (Audit audit : list) { + if (ArgsConst.WAITING.equals(audit.getAuditOrder())){ + personnelUpdateDto.setAuditBtn(true); + } + } + personnelUpdateDto.setCardFiles(nameAndPath(personnel.getCardFile(), personnel.getId())); personnelUpdateDto.setEngageFiles(nameAndPath(personnel.getEngageFile(), personnel.getId())); personnelUpdateDto.setEducationFiles(nameAndPath(personnel.getEducationFile(), personnel.getId())); personnelUpdateDto.setJobTitleFiles(nameAndPath(personnel.getJobTitleFile(), personnel.getId())); personnelUpdateDto.setAuditFiles(nameAndPath(personnel.getAuditFile(), personnel.getId())); + return AjaxResult.ok().data(personnelUpdateDto); } return AjaxResult.fail().msg("查询失败!"); @@ -193,6 +208,7 @@ public class PersonnelServiceImpl extends BaseService cardFile = updateRequest.getCardFile(); List educationFile = updateRequest.getEducationFile(); @@ -204,20 +220,25 @@ public class PersonnelServiceImpl extends BaseService cardFiles = request.getCardFiles(); List jobTitleFiles = request.getJobTitleFiles(); List engageFiles = request.getEngageFiles(); @@ -241,22 +264,30 @@ public class PersonnelServiceImpl extends BaseService nameAndPath(String file, String id) { @@ -366,6 +399,7 @@ public class PersonnelServiceImpl extends BaseService