This commit is contained in:
parent
2246904236
commit
b8651bb3b8
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -54,14 +50,33 @@ public class AuditLogServiceImpl extends BaseService<AuditLogMapper, AuditLog> i
|
|||
@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) {
|
||||
List<AuditLogRequest> 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue