| | |
| | | import java.io.IOException; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.stream.Stream; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | |
| | | Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId)); |
| | | // 1.2 获取距离进入公海的时间 |
| | | Map<Long, Long> poolDayMap = getPoolDayMap(list); |
| | | // 1.3 获取所属上级经销商名称 |
| | | Set<Long> parentDealerIds = convertSet(list, CrmCustomerDO::getParentDealerId); |
| | | parentDealerIds.remove(null); |
| | | Map<Long, CrmCustomerDO> parentDealerMap = CollUtil.isEmpty(parentDealerIds) |
| | | ? Collections.emptyMap() : customerService.getCustomerMap(parentDealerIds); |
| | | // 2. 转换成 VO |
| | | return BeanUtils.toBean(list, CrmCustomerRespVO.class, customerVO -> { |
| | | customerVO.setAreaName(AreaUtils.format(customerVO.getAreaId())); |
| | | MapUtils.findAndThen(parentDealerMap, customerVO.getParentDealerId(), |
| | | dealer -> customerVO.setParentDealerName(dealer.getName())); |
| | | // 2.1 设置创建人、负责人名称 |
| | | MapUtils.findAndThen(userMap, NumberUtils.parseLong(customerVO.getCreator()), |
| | | user -> customerVO.setCreatorName(user.getNickname())); |