|
|
|
@ -1,14 +1,27 @@
|
|
|
|
|
package com.logpm.report.reader; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
import cn.hutool.core.convert.Convert; |
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.logpm.report.constant.ReportConstants; |
|
|
|
|
import com.logpm.report.mapper.ReportBillLoadingMapper; |
|
|
|
|
import com.logpm.report.service.ExportReader; |
|
|
|
|
import org.apache.poi.ss.formula.functions.T; |
|
|
|
|
import com.logpm.report.vo.BillLoadingDetailsVO; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.system.entity.User; |
|
|
|
|
import org.springblade.system.feign.IUserClient; |
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.util.HashSet; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.Set; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @author zhaoqiaobo |
|
|
|
@ -19,6 +32,8 @@ public class BillLoadingDetailsReader implements ExportReader {
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private ReportBillLoadingMapper billLoadingMapper; |
|
|
|
|
@Resource |
|
|
|
|
private IUserClient userClient; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Long getCount(Wrapper query) { |
|
|
|
@ -28,8 +43,34 @@ public class BillLoadingDetailsReader implements ExportReader {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<T> findList(Page page, Wrapper query) { |
|
|
|
|
return billLoadingMapper.getDetailsPage(page, query); |
|
|
|
|
public List<BillLoadingDetailsVO> findList(Page page, Wrapper query) { |
|
|
|
|
List<BillLoadingDetailsVO> detailsPage = billLoadingMapper.getDetailsPage(page, query); |
|
|
|
|
if (CollUtil.isNotEmpty(detailsPage)) { |
|
|
|
|
// 组装数据批量去查询用户名称
|
|
|
|
|
Set<String> userIds = new HashSet<>(); |
|
|
|
|
for (BillLoadingDetailsVO detailsVO : detailsPage) { |
|
|
|
|
if (StrUtil.isNotBlank(detailsVO.getScanUser())) { |
|
|
|
|
userIds.add(detailsVO.getScanUser()); |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotBlank(detailsVO.getExamineUser())) { |
|
|
|
|
userIds.add(detailsVO.getExamineUser()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
R<List<User>> listR = userClient.userInfoByIds(AuthUtil.getTenantId(), CollUtil.join(userIds, ",")); |
|
|
|
|
if (ObjectUtil.equal(ReportConstants.HTTP_SUCCESS_CODE, listR.getCode())) { |
|
|
|
|
List<User> data = listR.getData(); |
|
|
|
|
Map<Long, String> collect = data.stream().collect(Collectors.toMap(User::getId, User::getName)); |
|
|
|
|
for (BillLoadingDetailsVO detailsVO : detailsPage) { |
|
|
|
|
if (StrUtil.isNotEmpty(detailsVO.getScanUser())) { |
|
|
|
|
detailsVO.setScanUser(collect.get(Convert.toLong(detailsVO.getScanUser()))); |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotEmpty(detailsVO.getExamineUser())) { |
|
|
|
|
detailsVO.setExamineUser(collect.get(Convert.toLong(detailsVO.getExamineUser()))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return detailsPage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|