From b8651bb3b8b209164072990de0231a2e2d11bbc0 Mon Sep 17 00:00:00 2001 From: zhuyy Date: Mon, 19 Jun 2023 14:53:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ydool/staff/entity/AuditLog.java | 2 +- .../ydool/staff/request/AuditLogRequest.java | 20 ++++++++++++ .../service/impl/AuditLogServiceImpl.java | 31 ++++++++++++++----- 3 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/ydool/staff/request/AuditLogRequest.java diff --git a/src/main/java/com/ydool/staff/entity/AuditLog.java b/src/main/java/com/ydool/staff/entity/AuditLog.java index 93b1b4a..d648651 100644 --- a/src/main/java/com/ydool/staff/entity/AuditLog.java +++ b/src/main/java/com/ydool/staff/entity/AuditLog.java @@ -35,7 +35,7 @@ public class AuditLog extends BaseEntity{ @ApiModelProperty(value = "处理意见") private String opinion; - @ApiModelProperty(value = "日志类型:personnel 人员 change:变更 ") + @ApiModelProperty(value = "日志类型 personnel:人员 change:变更 directors:董监 organization:招聘 personnel_indicators:指标") private String type; } diff --git a/src/main/java/com/ydool/staff/request/AuditLogRequest.java b/src/main/java/com/ydool/staff/request/AuditLogRequest.java new file mode 100644 index 0000000..0496881 --- /dev/null +++ b/src/main/java/com/ydool/staff/request/AuditLogRequest.java @@ -0,0 +1,20 @@ +package com.ydool.staff.request; + +import com.ydool.staff.entity.AuditLog; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class AuditLogRequest extends AuditLog { + + @ApiModelProperty(value = "类型") + private String typeName; + + @ApiModelProperty(value = "发布人") + private String createdName; + + @ApiModelProperty(value = "修改人") + private String updatedName; +} diff --git a/src/main/java/com/ydool/staff/service/impl/AuditLogServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/AuditLogServiceImpl.java index 38abb95..2a2a875 100644 --- a/src/main/java/com/ydool/staff/service/impl/AuditLogServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/AuditLogServiceImpl.java @@ -1,9 +1,7 @@ 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; @@ -12,17 +10,15 @@ import com.ydool.common.constant.ArgsConst; import com.ydool.common.data.dto.AjaxResult; import com.ydool.staff.dto.AuditLogDto; import com.ydool.staff.entity.AuditLog; -import com.ydool.staff.entity.Personnel; import com.ydool.staff.mapper.AuditLogMapper; +import com.ydool.staff.request.AuditLogRequest; 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; /** *

@@ -54,14 +50,33 @@ public class AuditLogServiceImpl extends BaseService i @Override public AjaxResult auditLog(Page page) { Page selectPage = page(page, Wrappers.lambdaQuery(AuditLog.class).orderByDesc(AuditLog::getCreatedAt)); - List records = selectPage.getRecords(); - for (AuditLog record : records) { + List auditLogRequests = BeanUtil.copyToList(selectPage.getRecords(), AuditLogRequest.class); + for (AuditLogRequest record : auditLogRequests) { + if (ArgsConst.DIRECTORS.equals(record.getType())) { + record.setTypeName("董监申报"); + } else if (ArgsConst.ORGANIZATION.equals(record.getType())) { + record.setTypeName("招聘登记"); + } else if (ArgsConst.PERSONNEL_INDICATORS.equals(record.getType())) { + record.setTypeName("指标申报"); + } else if (ArgsConst.PERSONNEL.equals(record.getType())) { + record.setTypeName("人员申报"); + } else if (ArgsConst.CHANGE.equals(record.getType())) { + record.setTypeName("人员变更"); + } + User created = userMapper.selectById(record.getCreatedId()); + if (ObjectUtil.isNotNull(created)) { + record.setCreatedName(created.getUserName()); + } + User updated = userMapper.selectById(record.getUpdatedId()); + if (ObjectUtil.isNotNull(updated)) { + record.setUpdatedName(updated.getUserName()); + } User userName = userMapper.selectById(record.getApprover()); if (ObjectUtil.isNotNull(userName)) { record.setApprover(userName.getUserName()); } } - selectPage.setRecords(records); + selectPage.setRecords(auditLogRequests); return AjaxResult.ok().data(selectPage); } }