|
|
|
@@ -1,6 +1,8 @@ |
|
|
|
package com.iformall.service.invest.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.iformall.domain.dto.InvestDemandDto; |
|
|
|
import com.iformall.domain.po.*; |
|
|
|
import com.iformall.domain.po.invest.InvestCustomerEntity; |
|
|
|
@@ -44,13 +46,14 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
private MallUserInfoService userInfoService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public InvestPageResult<InvestDemandVo> queryPageDemand(InvestPageQuery<InvestDemandEntity> params) { |
|
|
|
InvestPageResult<InvestDemandEntity> demandPage = demandService.queryPage(params); |
|
|
|
public InvestPageResult<InvestDemandVo> queryPageDemand(InvestPageQuery<InvestDemandDto> params) { |
|
|
|
InvestDemandDto queryDemand = params.getQueryData(); |
|
|
|
InvestPageResult<InvestDemandEntity> demandPage = demandService.queryPage(new InvestPageQuery<>(queryDemand)); |
|
|
|
InvestPageResult<InvestDemandVo> investPage = new InvestPageResult<>(); |
|
|
|
if (CollectionUtils.isEmpty(demandPage.getRecords())) { |
|
|
|
return investPage; |
|
|
|
} |
|
|
|
List<InvestDemandVo> resultList = getTargeInfoList(demandPage); |
|
|
|
List<InvestDemandVo> resultList = getTargeInfoList(demandPage, queryDemand.getCustomer()); |
|
|
|
BeanUtils.copyProperties(demandPage, investPage); |
|
|
|
investPage.setRecords(resultList); |
|
|
|
return investPage; |
|
|
|
@@ -107,14 +110,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
for (InvestFollowRecordEntity item : recordList) { |
|
|
|
InvestCustomerEntity customerEntity = customerMap.get(item.getCustomerId()); |
|
|
|
WxBrand brand = brandMap.get(customerEntity.getBrandId()); |
|
|
|
List<MallUserInfo> ownerInfo = getMallUserInfos(usersMap, item); |
|
|
|
InvestFollowRecordVo followRecordVo = new InvestFollowRecordVo(); |
|
|
|
followRecordVo.setCustomer(customerEntity); |
|
|
|
followRecordVo.setMemberInfo(ownerInfo); |
|
|
|
followRecordVo.setBrand(brand); |
|
|
|
followRecordVo.setOwnerInfo(usersMap.get(item.getOwner())); |
|
|
|
BeanUtils.copyProperties(item, followRecordVo); |
|
|
|
resultList.add(followRecordVo); |
|
|
|
resultList.add(buildFollowRecordItem(usersMap, item, customerEntity, brand)); |
|
|
|
} |
|
|
|
|
|
|
|
BeanUtils.copyProperties(recordPage, investPage); |
|
|
|
@@ -189,6 +185,27 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
return buildTaskItem(taskEntity, shop, usersMap); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public InvestFollowRecordVo findFollowRecordById(Long id) { |
|
|
|
Map<Long, MallUserInfo> usersMap = getUserInfoMap(); |
|
|
|
InvestFollowRecordEntity followRecordEntity = followRecordService.getByIdNotNull(id); |
|
|
|
InvestCustomerEntity customerEntity = customerService.getByIdNotNull(followRecordEntity.getCustomerId()); |
|
|
|
WxBrand brand = brandService.getById(customerEntity.getBrandId()); |
|
|
|
InvestFollowRecordVo followRecordVo = buildFollowRecordItem(usersMap, followRecordEntity, customerEntity, brand); |
|
|
|
return followRecordVo; |
|
|
|
} |
|
|
|
|
|
|
|
private InvestFollowRecordVo buildFollowRecordItem(Map<Long, MallUserInfo> usersMap, InvestFollowRecordEntity item, InvestCustomerEntity customerEntity, WxBrand brand) { |
|
|
|
List<MallUserInfo> ownerInfo = getMallUserInfos(usersMap, item); |
|
|
|
InvestFollowRecordVo followRecordVo = new InvestFollowRecordVo(); |
|
|
|
followRecordVo.setCustomer(customerEntity); |
|
|
|
followRecordVo.setMemberInfo(ownerInfo); |
|
|
|
followRecordVo.setBrand(brand); |
|
|
|
followRecordVo.setOwnerInfo(usersMap.get(item.getOwner())); |
|
|
|
BeanUtils.copyProperties(item, followRecordVo); |
|
|
|
return followRecordVo; |
|
|
|
} |
|
|
|
|
|
|
|
private InvestDemandVo buildDemindItem(InvestDemandEntity item, InvestCustomerEntity customer, WxBrand brand, WxShop shop, Map<Long, MallUserInfo> usersMap) { |
|
|
|
InvestDemandVo resultItemVo = new InvestDemandVo(); |
|
|
|
resultItemVo.setBrand(brand); |
|
|
|
@@ -224,10 +241,12 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
return ownerInfo; |
|
|
|
} |
|
|
|
|
|
|
|
private List<InvestDemandVo> getTargeInfoList(InvestPageResult<InvestDemandEntity> demandPage) { |
|
|
|
private List<InvestDemandVo> getTargeInfoList(InvestPageResult<InvestDemandEntity> demandPage, InvestCustomerEntity queryCustomer) { |
|
|
|
List<InvestDemandEntity> demandList = demandPage.getRecords(); |
|
|
|
//2、客户信息 |
|
|
|
Collection<InvestCustomerEntity> customers = getCustomers(demandList.stream().map(InvestDemandEntity::getCustomerId)); |
|
|
|
LambdaQueryWrapper<InvestCustomerEntity> customerWrapper = new LambdaQueryWrapper<>(queryCustomer); |
|
|
|
customerWrapper.in(InvestCustomerEntity::getId, demandList.stream().map(InvestDemandEntity::getCustomerId)); |
|
|
|
Collection<InvestCustomerEntity> customers = customerService.list(new QueryWrapper<>(queryCustomer)); |
|
|
|
Map<Long, InvestCustomerEntity> customersMap = getCustomerMap(customers); |
|
|
|
|
|
|
|
//3、目标信息 |
|
|
|
|