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

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

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