|
|
|
@@ -128,9 +128,9 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
Collection<InvestTaskEntity> taskList = taskPage.getRecords(); |
|
|
|
//2、目标信息 |
|
|
|
Collection<WxShop> shops = shopService.getByIds(getIds(taskList, InvestTaskEntity::getTargetId)); |
|
|
|
HashMap<Long, WxShop> shopsMap = getMap(shops, WxShop::getId); |
|
|
|
Map<Long, WxShop> shopsMap = getMap(shops, WxShop::getId); |
|
|
|
//3、用户信息 |
|
|
|
HashMap<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); |
|
|
|
List<InvestTaskVo> resultList = new ArrayList<>(); |
|
|
|
for (InvestTaskEntity item : taskList) { |
|
|
|
WxShop shop = shopsMap.get(item.getTargetId()); |
|
|
|
@@ -182,13 +182,13 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
Collection<InvestFollowRecordEntity> recordList = recordPage.getRecords(); |
|
|
|
|
|
|
|
//2、用户信息 |
|
|
|
HashMap<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); |
|
|
|
|
|
|
|
//3、客户 |
|
|
|
Collection<InvestCustomerEntity> customers = customerService.listByIds(getIds(recordList, InvestFollowRecordEntity::getCustomerId)); |
|
|
|
HashMap<Long, InvestCustomerEntity> customerMap = getMap(customers, InvestCustomerEntity::getId); |
|
|
|
Map<Long, InvestCustomerEntity> customerMap = getMap(customers, InvestCustomerEntity::getId); |
|
|
|
//4、 品牌 |
|
|
|
HashMap<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId); |
|
|
|
Map<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId); |
|
|
|
|
|
|
|
List<InvestFollowRecordVo> resultList = new ArrayList<>(); |
|
|
|
for (InvestFollowRecordEntity item : recordList) { |
|
|
|
@@ -217,13 +217,13 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
} |
|
|
|
|
|
|
|
//2、用户信息 |
|
|
|
HashMap<Long, MallUserInfo> usersMap = getMap(userInfoService.getByIds(getIds(recordList, InvestRemindEntity::getOwner)), MallUserInfo::getId); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.getByIds(getIds(recordList, InvestRemindEntity::getOwner)), MallUserInfo::getId); |
|
|
|
|
|
|
|
//3、客户 |
|
|
|
Collection<InvestCustomerEntity> customers = customerService.listByIds(getIds(resultList, InvestRemindVo::getCustomerId)); |
|
|
|
HashMap<Long, InvestCustomerEntity> customerMap = getMap(customers, InvestCustomerEntity::getId); |
|
|
|
Map<Long, InvestCustomerEntity> customerMap = getMap(customers, InvestCustomerEntity::getId); |
|
|
|
//4、 品牌 |
|
|
|
HashMap<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId); |
|
|
|
Map<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId); |
|
|
|
|
|
|
|
for (InvestRemindVo remindVo : resultList) { |
|
|
|
InvestCustomerEntity customerEntity = customerMap.get(remindVo.getCustomerId()); |
|
|
|
@@ -244,7 +244,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
|
|
|
|
private List<MallUserInfo> getMallUserInfos(Map<Long, MallUserInfo> usersMap, InvestFollowRecordEntity item) { |
|
|
|
List<MallUserInfo> ownerInfo = null; |
|
|
|
HashMap contentMap = JSON.parseObject(item.getContent(), HashMap.class); |
|
|
|
Map contentMap = JSON.parseObject(item.getContent(), Map.class); |
|
|
|
if (MapUtils.isNotEmpty(contentMap)) { |
|
|
|
Object followMember = contentMap.get(InvestFollowRecordEntity.KEY_MEMBER); |
|
|
|
ownerInfo = getMallUserInfos(followMember, usersMap); |
|
|
|
@@ -291,7 +291,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
InvestCustomerEntity customerEntity = customerService.getByIdNotNull(demandEntity.getCustomerId()); |
|
|
|
WxBrand brand = brandService.getById(customerEntity.getBrandId()); |
|
|
|
WxShop shop = shopService.getById(demandEntity.getTargetId()); |
|
|
|
HashMap<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); |
|
|
|
return buildDemindItem(demandEntity, customerEntity, brand, shop, usersMap); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -299,7 +299,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
public InvestTaskVo findTaskById(Long id) { |
|
|
|
InvestTaskEntity taskEntity = taskService.getByIdNotNull(id); |
|
|
|
WxShop shop = shopService.getById(taskEntity.getTargetId()); |
|
|
|
HashMap<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); |
|
|
|
return buildTaskItem(taskEntity, shop, usersMap); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -321,7 +321,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
@Override |
|
|
|
public InvestFollowRecordVo findFollowRecordById(Long id) { |
|
|
|
InvestFollowRecordEntity followRecordEntity = followRecordService.getByIdNotNull(id); |
|
|
|
HashMap<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); |
|
|
|
InvestCustomerEntity customerEntity = customerService.getByIdNotNull(followRecordEntity.getCustomerId()); |
|
|
|
WxBrand brand = brandService.getById(customerEntity.getBrandId()); |
|
|
|
return buildFollowRecordItem(usersMap, followRecordEntity, customerEntity, brand); |
|
|
|
@@ -365,7 +365,7 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
private InvestRemindVo buildRemindItem(InvestRemindEntity remindEntity) { |
|
|
|
InvestRemindVo remindVo = new InvestRemindVo(); |
|
|
|
BeanUtils.copyProperties(remindEntity, remindVo); |
|
|
|
HashMap contentMap = JSON.parseObject(remindEntity.getContent(), HashMap.class); |
|
|
|
Map contentMap = JSON.parseObject(remindEntity.getContent(), Map.class); |
|
|
|
if (MapUtils.isNotEmpty(contentMap)) { |
|
|
|
Object customerId = contentMap.get(InvestRemindEntity.KEY_CUSTOMER); |
|
|
|
remindVo.setCustomerId(Objects.isNull(customerId) ? null : Long.parseLong((String) customerId)); |
|
|
|
@@ -392,16 +392,16 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
} |
|
|
|
|
|
|
|
private List<InvestDemandVo> getTargeInfoList(List<InvestDemandEntity> demandList, Collection<InvestCustomerEntity> customers) { |
|
|
|
HashMap<Long, InvestDemandEntity> demindsMap = getMap(demandList, InvestDemandEntity::getCustomerId); |
|
|
|
Map<Long, InvestDemandEntity> demindsMap = getMap(demandList, InvestDemandEntity::getCustomerId); |
|
|
|
|
|
|
|
//3、目标信息 |
|
|
|
Collection<WxShop> shops = shopService.getByIds(getIds(demandList, InvestDemandEntity::getTargetId)); |
|
|
|
HashMap<Long, WxShop> shopsMap = getMap(shops, WxShop::getId); |
|
|
|
Map<Long, WxShop> shopsMap = getMap(shops, WxShop::getId); |
|
|
|
|
|
|
|
//4、品牌 |
|
|
|
HashMap<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId); |
|
|
|
Map<Long, WxBrand> brandMap = getMap(brandService.getByIds(getIds(customers, InvestCustomerEntity::getBrandId)), WxBrand::getId); |
|
|
|
//5、用户 |
|
|
|
HashMap<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); |
|
|
|
Map<Long, MallUserInfo> usersMap = getMap(userInfoService.findList(null), MallUserInfo::getId); |
|
|
|
|
|
|
|
List<InvestDemandVo> resultList = new ArrayList<>(); |
|
|
|
for (InvestCustomerEntity costomerItem : customers) { |
|
|
|
@@ -430,9 +430,8 @@ public class InvestBizServiceImpl implements InvestBizService { |
|
|
|
return function.apply(params); |
|
|
|
} |
|
|
|
|
|
|
|
private <T, R> HashMap<R, T> getMap(Collection<T> dataList, Function<T, R> keyMapper) { |
|
|
|
Map<R, T> map = dataList.parallelStream().collect(Collectors.toMap(keyMapper, entity -> entity)); |
|
|
|
return new HashMap<>(map); |
|
|
|
private <T, R> Map<R, T> getMap(Collection<T> dataList, Function<T, R> keyMapper) { |
|
|
|
return dataList.parallelStream().collect(Collectors.toMap(keyMapper, entity -> entity)); |
|
|
|
} |
|
|
|
|
|
|
|
private <T, R> Collection<R> getIds(Collection<T> dataList, Function<? super T, R> mapper) { |
|
|
|
|