|
|
|
@@ -61,21 +61,17 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
InvestPageResult<InvestDemandVo> investPage = new InvestPageResult<>(); |
|
|
|
|
|
|
|
LambdaQueryWrapper<InvestDemandEntity> queryWrapperDemand = null; |
|
|
|
if (Objects.nonNull(customerParams)) { |
|
|
|
Collection<InvestCustomerEntity> customers = customerService.list(new QueryWrapper<>(customerParams)); |
|
|
|
if (CollectionUtils.isEmpty(customers)) { |
|
|
|
return investPage; |
|
|
|
} |
|
|
|
queryWrapperDemand = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapperDemand.in(InvestDemandEntity::getCustomerId, getIds(customers, InvestCustomerEntity::getId)); |
|
|
|
} |
|
|
|
|
|
|
|
InvestPageResult<InvestDemandEntity> demandPage = demandService.queryPage(buildPageQuery(params, demandParams), queryWrapperDemand); |
|
|
|
if (CollectionUtils.isEmpty(demandPage.getRecords())) { |
|
|
|
InvestPageResult<InvestCustomerEntity> customers = customerService.queryPage(buildPageQuery(params, customerParams)); |
|
|
|
if (CollectionUtils.isEmpty(customers.getRecords())) { |
|
|
|
return investPage; |
|
|
|
} |
|
|
|
List<InvestDemandVo> resultList = getTargeInfoList(demandPage); |
|
|
|
BeanUtils.copyProperties(demandPage, investPage); |
|
|
|
queryWrapperDemand = new LambdaQueryWrapper<>(demandParams); |
|
|
|
queryWrapperDemand.in(InvestDemandEntity::getCustomerId, getIds(customers.getRecords(), InvestCustomerEntity::getId)); |
|
|
|
|
|
|
|
List<InvestDemandEntity> demandList = demandService.list(queryWrapperDemand); |
|
|
|
|
|
|
|
List<InvestDemandVo> resultList = getTargeInfoList(demandList, customers.getRecords()); |
|
|
|
BeanUtils.copyProperties(customers, investPage); |
|
|
|
investPage.setRecords(resultList); |
|
|
|
return investPage; |
|
|
|
} |
|
|
|
@@ -395,10 +391,8 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
return ownerInfo; |
|
|
|
} |
|
|
|
|
|
|
|
private List<InvestDemandVo> getTargeInfoList(InvestPageResult<InvestDemandEntity> demandPage) { |
|
|
|
Collection<InvestDemandEntity> demandList = demandPage.getRecords(); |
|
|
|
Collection<InvestCustomerEntity> customers = customerService.listByIds(getIds(demandList, InvestDemandEntity::getCustomerId)); |
|
|
|
Map<Long, InvestCustomerEntity> customersMap = getMap(customers, InvestCustomerEntity::getId); |
|
|
|
private List<InvestDemandVo> getTargeInfoList(List<InvestDemandEntity> demandList, Collection<InvestCustomerEntity> customers) { |
|
|
|
Map<Long, InvestDemandEntity> demindsMap = getMap(demandList, InvestDemandEntity::getCustomerId); |
|
|
|
|
|
|
|
//3、目标信息 |
|
|
|
Collection<WxShop> shops = shopService.getByIds(getIds(demandList, InvestDemandEntity::getTargetId)); |
|
|
|
@@ -410,14 +404,11 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); |
|
|
|
|
|
|
|
List<InvestDemandVo> resultList = new ArrayList<>(); |
|
|
|
for (InvestDemandEntity item : demandList) { |
|
|
|
InvestCustomerEntity customer = customersMap.get(item.getCustomerId()); |
|
|
|
WxShop shop = shopsMap.get(item.getTargetId()); |
|
|
|
WxBrand brand = null; |
|
|
|
if (Objects.nonNull(customer)) { |
|
|
|
brand = brandMap.get(customer.getBrandId()); |
|
|
|
} |
|
|
|
resultList.add(buildDemindItem(item, customer, brand, shop, usersMap)); |
|
|
|
for (InvestCustomerEntity item : customers) { |
|
|
|
InvestDemandEntity demandItem = demindsMap.get(item.getId()); |
|
|
|
WxShop shop = shopsMap.get(demandItem.getTargetId()); |
|
|
|
WxBrand brand = brandMap.get(item.getBrandId()); |
|
|
|
resultList.add(buildDemindItem(demandItem, item, brand, shop, usersMap)); |
|
|
|
} |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|