feat(REQ-2106): 日志操作内容拼接调整
This commit is contained in:
parent
f6bd654b59
commit
c0f75fbb52
@ -42,7 +42,12 @@ public class PageBannerOperationLogResp {
|
||||
/**
|
||||
* 操作人
|
||||
*/
|
||||
private String updateBy;
|
||||
private Long updateBy;
|
||||
|
||||
/**
|
||||
* 操作人名称
|
||||
*/
|
||||
private String updateByName;
|
||||
|
||||
/**
|
||||
* 操作类型
|
||||
|
||||
@ -1,14 +1,10 @@
|
||||
package cn.axzo.nanopart.server.service.impl;
|
||||
|
||||
import cn.axzo.basics.common.BeanMapper;
|
||||
import cn.axzo.basics.profiles.dto.basic.BasicDto;
|
||||
import cn.axzo.basics.profiles.dto.basic.PersonProfileDto;
|
||||
import cn.axzo.nanopart.api.request.CreateBannerOperationLogReq;
|
||||
import cn.axzo.nanopart.api.request.PageBannerOperationLogReq;
|
||||
import cn.axzo.nanopart.api.response.PageBannerOperationLogResp;
|
||||
import cn.axzo.nanopart.server.domain.BannerOperationLog;
|
||||
import cn.axzo.nanopart.server.mapper.BannerOperationLogDao;
|
||||
import cn.axzo.nanopart.server.rpc.ProfileGateway;
|
||||
import cn.axzo.nanopart.server.service.BannerOperationLogService;
|
||||
import cn.axzo.pokonyan.dao.converter.PageConverter;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
@ -19,11 +15,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author chenwenjian
|
||||
@ -35,8 +27,6 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
public class BannerOperationLogServiceImpl extends ServiceImpl<BannerOperationLogDao, BannerOperationLog> implements BannerOperationLogService {
|
||||
|
||||
private final ProfileGateway profileGateway;
|
||||
|
||||
@Override
|
||||
public Long create(CreateBannerOperationLogReq req) {
|
||||
BannerOperationLog bannerOperationLog = BeanUtil.copyProperties(req, BannerOperationLog.class);
|
||||
@ -57,17 +47,7 @@ public class BannerOperationLogServiceImpl extends ServiceImpl<BannerOperationLo
|
||||
if (Objects.isNull(logPage) || logPage.getTotal() == 0) {
|
||||
return new Page<>();
|
||||
}
|
||||
List<Long> personIds = logPage.getRecords().stream()
|
||||
.map(BannerOperationLog::getUpdateBy)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<PersonProfileDto> profiles = profileGateway.getProfiles(personIds);
|
||||
Map<Long, PersonProfileDto> personProfileDtoMap = profiles.stream().collect(Collectors.toMap(BasicDto::getId, Function.identity()));
|
||||
return PageConverter.convert(logPage, record -> BeanMapper.copyBean(record, PageBannerOperationLogResp.class, (source, target) -> {
|
||||
PersonProfileDto person = personProfileDtoMap.get(source.getUpdateBy());
|
||||
target.setUpdateBy(Objects.isNull(person.getRealName())? "-" : person.getRealName());
|
||||
}));
|
||||
return PageConverter.convert(logPage, record -> BeanUtil.copyProperties(record, PageBannerOperationLogResp.class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user