Commit 7cb189b4 authored by 刘基明's avatar 刘基明

Merge remote-tracking branch 'origin/dev' into dev

parents 6cb5b693 667f4b45
......@@ -204,19 +204,14 @@ public class BatchFeignCallService {
}
if (!CollectionUtils.isEmpty(courseIds)) {
// 新版课程列表
CommonResp<List<CourseSimpleResp>> commonResp =
feignForCourse.getCourseSimpleList(setToList(courseIds));
if (commonResp.isSuccess() & !CollectionUtils.isEmpty(commonResp.getData())) {
courseMap.putAll(commonResp.getData().stream().collect(Collectors.toMap(CourseSimpleResp::getCourseId, item -> item,(oldValue,newValue)->oldValue)));
}
List<CourseSimpleResp> list = feignService.getCourseSimpleList(setToList(courseIds));
courseMap.putAll(list.stream().collect(Collectors.toMap(CourseSimpleResp::getCourseId, item -> item,(oldValue,newValue)->oldValue)));
}
if (!CollectionUtils.isEmpty(zhiboIds)) {
// 直播列表
CommonResp<List<ZhiboListResp>> commonResp =
List<ZhiboListResp> list = feignService.getZhiboSimpleList(setToList(zhiboIds));
feignClientForZhibo.simpleList(setToList(zhiboIds));
if (commonResp.isSuccess() && !CollectionUtils.isEmpty(commonResp.getData())) {
zhiboMap.putAll(commonResp.getData().stream().collect(Collectors.toMap(ZhiboListResp::getId, item -> item,(oldValue,newValue)->oldValue)));
}
zhiboMap.putAll(list.stream().collect(Collectors.toMap(ZhiboListResp::getId, item -> item,(oldValue,newValue)->oldValue)));
}
if (!CollectionUtils.isEmpty(imageIds)) {
// 查询图片
......@@ -239,7 +234,7 @@ public class BatchFeignCallService {
}
if (!CollectionUtils.isEmpty(userIds)) {
// 查询用户信息
List<UserInfoResp> queryUsersListNew = feignClientForFatools.queryUserListNew(setToList(userIds));
List<UserInfoResp> queryUsersListNew = feignService.getUserList(setToList(userIds));
if (!CollectionUtils.isEmpty(userIds)) {
userMap.putAll(queryUsersListNew.stream().collect(Collectors
.toMap(UserInfoResp::getUserId, o -> o)));
......@@ -273,16 +268,13 @@ public class BatchFeignCallService {
// .fundIds(Lists.newArrayList(tanpuFundIds))
// .build();
// 探普产品
CommonResp<List<ProductInfoVO>> commonResp =
feignForProduct.getProductInfoByIds(setToList(tanpuFundIds));
if (commonResp.isSuccess() && !CollectionUtils.isEmpty(commonResp.getData())) {
List<FundInfoBaseResp> fundInfoBaseRespList = commonResp.getData().stream().map(item -> {
FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
BeanUtils.copyProperties(item, fundInfoBaseResp);
return fundInfoBaseResp;
}).collect(Collectors.toList());
tampFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
}
List<ProductInfoVO> list = feignService.getProductInfoByIds(setToList(tanpuFundIds));
List<FundInfoBaseResp> fundInfoBaseRespList = list.stream().map(item -> {
FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
BeanUtils.copyProperties(item, fundInfoBaseResp);
return fundInfoBaseResp;
}).collect(Collectors.toList());
tampFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
if (tampFundMap != null && tampFundMap.size() > 0) {
fundMap.putAll(tampFundMap);
......@@ -291,16 +283,13 @@ public class BatchFeignCallService {
// 私募产品
if (!CollectionUtils.isEmpty(fundIds)) {
// 私募产品
CommonResp<List<ProductInfoVO>> fundResult =
feignForFund.getProductList(setToList(fundIds));
if (fundResult.isSuccess() && !CollectionUtils.isEmpty(fundResult.getData())) {
List<FundInfoBaseResp> fundInfoBaseRespList = fundResult.getData().stream().map(item -> {
FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
BeanUtils.copyProperties(item, fundInfoBaseResp);
return fundInfoBaseResp;
}).collect(Collectors.toList());
privateFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
}
List<ProductInfoVO> list = feignService.getFundList(setToList(fundIds));
List<FundInfoBaseResp> fundInfoBaseRespList = list.stream().map(item -> {
FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
BeanUtils.copyProperties(item, fundInfoBaseResp);
return fundInfoBaseResp;
}).collect(Collectors.toList());
privateFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
if (privateFundMap != null && privateFundMap.size() > 0) {
fundMap.putAll(privateFundMap);
......@@ -309,16 +298,14 @@ public class BatchFeignCallService {
// 理财师导入产品
if (!CollectionUtils.isEmpty(ifaFundIds)) {
CommonResp<List<ProductInfoVO>> ifaFundResult =
feignForFund.getPrivateFundList(setToList(ifaFundIds));
if (ifaFundResult.isSuccess() && !CollectionUtils.isEmpty(ifaFundResult.getData())) {
List<FundInfoBaseResp> fundInfoBaseRespList = ifaFundResult.getData().stream().map(item -> {
FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
BeanUtils.copyProperties(item, fundInfoBaseResp);
return fundInfoBaseResp;
}).collect(Collectors.toList());
ifaFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
}
List<ProductInfoVO> list = feignService.getPrivateFundList(setToList(ifaFundIds));
List<FundInfoBaseResp> fundInfoBaseRespList = list.stream().map(item -> {
FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
BeanUtils.copyProperties(item, fundInfoBaseResp);
return fundInfoBaseResp;
}).collect(Collectors.toList());
ifaFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
if (ifaFundMap != null && ifaFundMap.size() > 0) {
fundMap.putAll(ifaFundMap);
......@@ -327,16 +314,14 @@ public class BatchFeignCallService {
if (!CollectionUtils.isEmpty(publicFundIds)) {
// 公募产品
CommonResp<List<ProductInfoVO>> publicFundResult =
feignForPublicFund.getProductList(setToList(publicFundIds));
if (publicFundResult.isSuccess() && !CollectionUtils.isEmpty(publicFundResult.getData())) {
List<FundInfoBaseResp> fundInfoBaseRespList = publicFundResult.getData().stream().map(item -> {
FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
BeanUtils.copyProperties(item, fundInfoBaseResp);
return fundInfoBaseResp;
}).collect(Collectors.toList());
publicFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
}
List<ProductInfoVO> list = feignService.getPublicFundList(setToList(publicFundIds));
List<FundInfoBaseResp> fundInfoBaseRespList = list.stream().map(item -> {
FundInfoBaseResp fundInfoBaseResp = FundInfoBaseResp.builder().build();
BeanUtils.copyProperties(item, fundInfoBaseResp);
return fundInfoBaseResp;
}).collect(Collectors.toList());
publicFundMap = fundInfoBaseRespList.stream().collect(Collectors.toMap(FundInfoBaseResp::getFundId, item -> item));
if (publicFundMap != null && publicFundMap.size() > 0) {
fundMap.putAll(publicFundMap);
}
......
......@@ -3,8 +3,11 @@ package com.tanpu.community.service;
import com.alibaba.fastjson.JSON;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.vo.feign.course.CourseSimpleResp;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp;
import com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import com.tanpu.community.api.beans.vo.feign.zhibo.ZhiboListResp;
import com.tanpu.community.cache.LocalCache;
import com.tanpu.community.feign.course.FeignClientForCourse;
import com.tanpu.community.feign.fatools.FeignClientForFatools;
......@@ -76,6 +79,87 @@ public class FeignService {
});
}
public List<CourseSimpleResp> getCourseSimpleList(List<String> courseIds) {
return batchExecute("getCourseSimpleList_", courseIds, CourseSimpleResp.class,
CourseSimpleResp::getCourseId, ids -> {
CommonResp<List<CourseSimpleResp>> resp = feignForCourse.getCourseSimpleList(ids);
if (resp.isSuccess()) {
return resp.getData();
} else {
return new ArrayList<>();
}
});
}
public List<ZhiboListResp> getZhiboSimpleList(List<String> zhiboIds) {
return batchExecute("getZhiboSimpleList_", zhiboIds, ZhiboListResp.class,
ZhiboListResp::getId, ids -> {
CommonResp<List<ZhiboListResp>> resp = feignClientForZhibo.simpleList(ids);
if (resp.isSuccess()) {
return resp.getData();
} else {
return new ArrayList<>();
}
});
}
public List<UserInfoResp> getUserList(List<String> userIds) {
return batchExecute("getUserList_", userIds, UserInfoResp.class,
UserInfoResp::getUserId, ids -> {
return feignClientForFatools.queryUserListNew(ids);
});
}
public List<ProductInfoVO> getProductInfoByIds(List<String> fundIds) {
return batchExecute("getProductInfoByIds_", fundIds, ProductInfoVO.class,
ProductInfoVO::getFundId, ids -> {
CommonResp<List<ProductInfoVO>> resp = feignForProduct.getProductInfoByIds(ids);
if (resp.isSuccess()) {
return resp.getData();
} else {
return new ArrayList<>();
}
});
}
public List<ProductInfoVO> getFundList(List<String> fundIds) {
return batchExecute("getFundList", fundIds, ProductInfoVO.class,
ProductInfoVO::getFundId, ids -> {
CommonResp<List<ProductInfoVO>> resp = feignForFund.getProductList(ids);
if (resp.isSuccess()) {
return resp.getData();
} else {
return new ArrayList<>();
}
});
}
public List<ProductInfoVO> getPrivateFundList(List<String> fundIds) {
return batchExecute("getPrivateFundList", fundIds, ProductInfoVO.class,
ProductInfoVO::getFundId, ids -> {
CommonResp<List<ProductInfoVO>> resp = feignForFund.getPrivateFundList(ids);
if (resp.isSuccess()) {
return resp.getData();
} else {
return new ArrayList<>();
}
});
}
public List<ProductInfoVO> getPublicFundList(List<String> fundIds) {
return batchExecute("getPublicFundList", fundIds, ProductInfoVO.class,
ProductInfoVO::getFundId, ids -> {
CommonResp<List<ProductInfoVO>> resp = feignForPublicFund.getProductList(ids);
if (resp.isSuccess()) {
return resp.getData();
} else {
return new ArrayList<>();
}
});
}
private <T> List<T> batchExecute(String keyPrefix,
List<String> keys,
Class<T> clz,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment