Commit 07dbf80d authored by 张辰's avatar 张辰
parents 30e71043 b6b27099
package com.tanpu.community.feign.fund;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.api.beans.vo.feign.course.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNewChief;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoOrg;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp;
import com.tanpu.community.api.beans.vo.feign.fund.FundCompanySimpleVO;
import com.tanpu.community.api.beans.vo.feign.user.FileQueryResp;
import com.tanpu.community.api.beans.vo.feign.user.UserInfoVo;
import com.tanpu.community.config.FeignConfiguration;
import com.tanpu.community.feign.fatools.FeignbackForFatools;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
import java.util.Set;
@FeignClient(value = "service-fund", fallbackFactory = FeignbackForFund.class, url = "http://tp-fund-svc", path = "/fund")
//@FeignClient(value = "service-fund",configuration = FeignConfiguration.class, fallbackFactory = FeignbackForFund.class,url = "http://127.0.0.1:8199/fund", path = "/fund")
public interface FeignClientForFund {
@ApiOperation("基金公司-简单信息")
@GetMapping("/fund/companyInfoSimple")
CommonResp<FundCompanySimpleVO> getFundCompanyInfoSimple(@ApiParam("基金公司id") @RequestParam("id") String id);
@ApiOperation("私募类型基金公司-持有产品数")
@GetMapping("/fund/companyFundCount")
CommonResp<FundCompanySimpleVO> getCompanyFundCount(@ApiParam("基金公司id") @RequestParam("id") String id);
}
package com.tanpu.community.feign.fund;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.fund.FundCompanySimpleVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class FeignbackForFund implements FallbackFactory<FeignClientForFund> {
@Override
public FeignClientForFund create(Throwable throwable) {
return new FeignClientForFund() {
@Override
public CommonResp<FundCompanySimpleVO> getFundCompanyInfoSimple(String id) {
log.info("FeignbackForFund.getFundCompanyInfoSimple 调用失败 id:{}", id);
log.error("FeignbackForFund.getFundCompanyInfoSimple 调用失败", throwable);
return CommonResp.error();
}
@Override
public CommonResp<FundCompanySimpleVO> getCompanyFundCount(String id) {
log.info("FeignbackForFund.getCompanyFundCount 调用失败 id:{}", id);
log.error("FeignbackForFund.getCompanyFundCount 调用失败", throwable);
return CommonResp.error();
}
};
}
}
package com.tanpu.community.feign.product;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.fund.FundCompanySimpleVO;
import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......@@ -26,4 +27,12 @@ public interface FeignForFund {
@ApiOperation("获取非净值产品")
@GetMapping("/product/not/net")
CommonResp<List<ProductInfoVO>> getProductListNotNetInfo(@ApiParam("产品id") @RequestParam("ids") List<String> ids);
@ApiOperation("基金公司-简单信息")
@GetMapping("/fund/companyInfoSimple")
CommonResp<FundCompanySimpleVO> getFundCompanyInfoSimple(@ApiParam("基金公司id") @RequestParam("id") String id);
@ApiOperation("私募类型基金公司-持有产品数")
@GetMapping("/fund/companyFundCount")
CommonResp<FundCompanySimpleVO> getCompanyFundCount(@ApiParam("基金公司id") @RequestParam("id") String id);
}
package com.tanpu.community.feign.product;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.fund.FundCompanySimpleVO;
import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......@@ -17,4 +18,12 @@ public interface FeignForPublicFund {
@ApiOperation("获取产品详情")
@GetMapping("/product/list")
CommonResp<List<ProductInfoVO>> getProductList(@ApiParam("产品id") @RequestParam("ids") List<String> ids);
@ApiOperation("基金公司-简单信息")
@GetMapping("/publicFund/companyInfoSimple")
CommonResp<FundCompanySimpleVO> getFundCompanyInfoSimple(@ApiParam("基金公司id") @RequestParam("id") String id);
@ApiOperation("私募类型基金公司-持有产品数")
@GetMapping("/publicFund/companyFundCount")
CommonResp<FundCompanySimpleVO> getCompanyFundCount(@ApiParam("基金公司id") @RequestParam("id") String id);
}
package com.tanpu.community.feign.product;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.fund.FundCompanySimpleVO;
import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
......@@ -31,6 +32,19 @@ public class FeignbackForFund implements FallbackFactory<FeignForFund> {
log.error("FeignbackForFund.getProductListNotNetInfo", throwable);
return CommonResp.failed("查询无净值产品");
}
@Override
public CommonResp<FundCompanySimpleVO> getFundCompanyInfoSimple(String id) {
log.info("FeignForFund.getFundCompanyInfoSimple 调用失败 id:{}", id);
log.error("FeignForFund.getFundCompanyInfoSimple 调用失败", throwable);
return CommonResp.error();
}
@Override
public CommonResp<FundCompanySimpleVO> getCompanyFundCount(String id) {
log.info("FeignForFund.getCompanyFundCount 调用失败 id:{}", id);
log.error("FeignForFund.getCompanyFundCount 调用失败", throwable);
return CommonResp.error();
}
};
}
}
package com.tanpu.community.feign.product;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.fund.FundCompanySimpleVO;
import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
......@@ -20,6 +21,19 @@ public class FeignbackForPublicFund implements FallbackFactory<FeignForPublicFun
log.error("getProductList.getProductList");
return CommonResp.failed("调用公募详情失败");
}
@Override
public CommonResp<FundCompanySimpleVO> getFundCompanyInfoSimple(String id) {
log.info("FeignForPublicFund.getFundCompanyInfoSimple 调用失败 id:{}", id);
log.error("FeignForPublicFund.getFundCompanyInfoSimple 调用失败", throwable);
return CommonResp.error();
}
@Override
public CommonResp<FundCompanySimpleVO> getCompanyFundCount(String id) {
log.info("FeignForPublicFund.getCompanyFundCount 调用失败 id:{}", id);
log.error("FeignForPublicFund.getCompanyFundCount 调用失败", throwable);
return CommonResp.error();
}
};
}
}
package com.tanpu.community.feign.publicFund;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.fund.FundCompanySimpleVO;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(value = "service-fundpublic", fallbackFactory = FeignbackForPublicFund.class, url = "http://tp-fundpublic-svc", path = "/fundpublic")
//@FeignClient(value = "service-fundpublic",configuration = FeignConfiguration.class, fallbackFactory = FeignbackForPublicFund.class,url = "http://127.0.0.1:8200/fundpublic", path = "/fundpublic")
public interface FeignClientForPublicFund {
@ApiOperation("基金公司-简单信息")
@GetMapping("/publicFund/companyInfoSimple")
CommonResp<FundCompanySimpleVO> getFundCompanyInfoSimple(@ApiParam("基金公司id") @RequestParam("id") String id);
@ApiOperation("私募类型基金公司-持有产品数")
@GetMapping("/publicFund/companyFundCount")
CommonResp<FundCompanySimpleVO> getCompanyFundCount(@ApiParam("基金公司id") @RequestParam("id") String id);
}
package com.tanpu.community.feign.publicFund;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.fund.FundCompanySimpleVO;
import com.tanpu.community.feign.fund.FeignClientForFund;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class FeignbackForPublicFund implements FallbackFactory<FeignClientForPublicFund> {
@Override
public FeignClientForPublicFund create(Throwable throwable) {
return new FeignClientForPublicFund() {
@Override
public CommonResp<FundCompanySimpleVO> getFundCompanyInfoSimple(String id) {
log.info("FeignClientForPublicFund.getFundCompanyInfoSimple 调用失败 id:{}", id);
log.error("FeignClientForPublicFund.getFundCompanyInfoSimple 调用失败", throwable);
return CommonResp.error();
}
@Override
public CommonResp<FundCompanySimpleVO> getCompanyFundCount(String id) {
log.info("FeignClientForPublicFund.getCompanyFundCount 调用失败 id:{}", id);
log.error("FeignClientForPublicFund.getCompanyFundCount 调用失败", throwable);
return CommonResp.error();
}
};
}
}
......@@ -20,8 +20,8 @@ import com.tanpu.community.dao.mapper.community.FollowRelMapper;
import com.tanpu.community.feign.course.FeignClientForCourse;
import com.tanpu.community.feign.diagnose.FeignClientForDiagnose;
import com.tanpu.community.feign.fatools.FeignClientForFatools;
import com.tanpu.community.feign.fund.FeignClientForFund;
import com.tanpu.community.feign.publicFund.FeignClientForPublicFund;
import com.tanpu.community.feign.product.FeignForFund;
import com.tanpu.community.feign.product.FeignForPublicFund;
import com.tanpu.community.service.FollowRelService;
import com.tanpu.community.util.ConvertUtil;
import com.tanpu.community.util.PageUtils;
......@@ -49,9 +49,9 @@ public class HomePageManager {
@Resource
private FeignClientForCourse feignClientForCourse;
@Resource
private FeignClientForFund feignClientForFund;
private FeignForFund feignForFund;
@Resource
private FeignClientForPublicFund feignClientForPublicFund;
private FeignForPublicFund feignForPublicFund;
//查询 个人中心 相关信息
public UserInfoResp queryUsersInfo(String userIdMyself, String userId) {
......@@ -97,10 +97,10 @@ public class HomePageManager {
userInfoNew.setPersonalCenterType(PersonalCenterTypeEnum.ORG.getCode());
if (FundCompanyTypeEnum.PUBLIC.getCode() == userInfoNew.getUserInfoNewOrg().getBelongOrgType() && StringUtils.isNotBlank(userInfoNew.getUserInfoNewOrg().getBelongOrgId())) { // 公募
// 设置 基金数
CommonResp<FundCompanySimpleVO> companyFundCount = feignClientForPublicFund.getCompanyFundCount(userInfoNew.getUserInfoNewOrg().getBelongOrgId());
CommonResp<FundCompanySimpleVO> companyFundCount = feignForPublicFund.getCompanyFundCount(userInfoNew.getUserInfoNewOrg().getBelongOrgId());
userInfoNew.setFundNumber(companyFundCount.isSuccess() ? companyFundCount.getData().getFundCount() : 0);
// 设置成立时间 和 备案编号(公募没有备案编号)
CommonResp<FundCompanySimpleVO> fundCompanyInfoSimple = feignClientForPublicFund.getFundCompanyInfoSimple(userInfoNew.getUserInfoNewOrg().getBelongOrgId());
CommonResp<FundCompanySimpleVO> fundCompanyInfoSimple = feignForPublicFund.getFundCompanyInfoSimple(userInfoNew.getUserInfoNewOrg().getBelongOrgId());
if (fundCompanyInfoSimple.isSuccess()) {
FundCompanySimpleVO data = fundCompanyInfoSimple.getData();
userInfoNew.setFounded(data.getEstablishDate());
......@@ -109,14 +109,14 @@ public class HomePageManager {
}
if (FundCompanyTypeEnum.PRIVATE.getCode() == userInfoNew.getUserInfoNewOrg().getBelongOrgType() && StringUtils.isNotBlank(userInfoNew.getUserInfoNewOrg().getBelongOrgId())) { // 私募
// 设置成立时间 和 备案编号
CommonResp<FundCompanySimpleVO> fundCompanyInfoSimple = feignClientForFund.getFundCompanyInfoSimple(userInfoNew.getUserInfoNewOrg().getBelongOrgId());
CommonResp<FundCompanySimpleVO> fundCompanyInfoSimple = feignForFund.getFundCompanyInfoSimple(userInfoNew.getUserInfoNewOrg().getBelongOrgId());
if (fundCompanyInfoSimple.isSuccess()) {
FundCompanySimpleVO data = fundCompanyInfoSimple.getData();
userInfoNew.setFounded(data.getEstablishDate());
userInfoNew.setRecordNumber(data.getRegisterNumber());
}
// 设置 基金数
CommonResp<FundCompanySimpleVO> companyFundCount = feignClientForFund.getCompanyFundCount(userInfoNew.getUserInfoNewOrg().getBelongOrgId());
CommonResp<FundCompanySimpleVO> companyFundCount = feignForFund.getCompanyFundCount(userInfoNew.getUserInfoNewOrg().getBelongOrgId());
userInfoNew.setFundNumber(companyFundCount.isSuccess() ? companyFundCount.getData().getFundCount() : 0);
}
//设置团队成员
......
......@@ -73,8 +73,6 @@ public class BatchFeignCallService {
@Resource
private TopicService topicService;
@Resource
private UserInfoService userInfoService;
public void getAttachDetail(ThemeQo themeQo) {
......@@ -193,7 +191,7 @@ public class BatchFeignCallService {
if (!CollectionUtils.isEmpty(shortVideoIds)) {
// 短视频列表
List<ShortVideoBaseInfoResp> list = feignService.batchGetShortVideoBaseInfo(setToList(shortVideoIds));
shortVideoMap.putAll(list.stream().collect(Collectors.toMap(ShortVideoBaseInfoResp::getSourceId, item -> item)));
shortVideoMap.putAll(list.stream().collect(Collectors.toMap(ShortVideoBaseInfoResp::getSourceId, item -> item,(oldValue,newValue)->oldValue)));
}
if (!CollectionUtils.isEmpty(curriculumIds)) {
// 课程列表
......@@ -201,7 +199,7 @@ public class BatchFeignCallService {
feignClientForFatools.getCurriculumByColumnRelId(setToList(curriculumIds));
if (commonResp != null && !CollectionUtils.isEmpty(commonResp)) {
curriculumMap.putAll(commonResp.stream()
.collect(Collectors.toMap(ShortVideoBaseInfoResp::getColumnRelId, item -> item)));
.collect(Collectors.toMap(ShortVideoBaseInfoResp::getColumnRelId, item -> item,(oldValue,newValue)->oldValue)));
}
}
if (!CollectionUtils.isEmpty(courseIds)) {
......@@ -209,7 +207,7 @@ public class BatchFeignCallService {
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)));
courseMap.putAll(commonResp.getData().stream().collect(Collectors.toMap(CourseSimpleResp::getCourseId, item -> item,(oldValue,newValue)->oldValue)));
}
}
if (!CollectionUtils.isEmpty(zhiboIds)) {
......@@ -217,7 +215,7 @@ public class BatchFeignCallService {
CommonResp<List<ZhiboListResp>> commonResp =
feignClientForZhibo.simpleList(setToList(zhiboIds));
if (commonResp.isSuccess() && !CollectionUtils.isEmpty(commonResp.getData())) {
zhiboMap.putAll(commonResp.getData().stream().collect(Collectors.toMap(ZhiboListResp::getId, item -> item)));
zhiboMap.putAll(commonResp.getData().stream().collect(Collectors.toMap(ZhiboListResp::getId, item -> item,(oldValue,newValue)->oldValue)));
}
}
if (!CollectionUtils.isEmpty(imageIds)) {
......
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