Commit 4ee1acf9 authored by 张亚辉's avatar 张亚辉

基金详情

parent 95fa0f41
package com.tanpu.fund.feign.diagnose;
import com.tanpu.common.resp.CommonResp;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;
@FeignClient(value = "service-diagnose", fallbackFactory = FeignbackForDiagnose.class, path = "/diagnose")
//@FeignClient(value = "service-diagnose", fallbackFactory = FeignbackForDiagnose.class, url = "http://127.0.0.1:8201/diagnose")
public interface FeignClientForDiagnose {
@ApiOperation("是否加入了自选")
@PostMapping("/fund/collect")
CommonResp<List<String>> getFundCollectInfo(@Valid @NotEmpty(message = "基金id不能为空") @RequestBody List<String> ids);
}
package com.tanpu.fund.feign.diagnose;
import com.alibaba.fastjson.JSON;
import com.tanpu.common.resp.CommonResp;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;
@Slf4j
@Component
public class FeignbackForDiagnose implements FallbackFactory<FeignClientForDiagnose> {
@Override
public FeignClientForDiagnose create(Throwable throwable) {
return new FeignClientForDiagnose() {
@Override
public CommonResp<List<String>> getFundCollectInfo(@Valid @NotEmpty(message = "基金id不能为空") List<String> ids) {
log.error("请求信息", throwable);
log.error("FeignClientForDiagnose.getFundCollectInfo 基金 收藏信息:{}", JSON.toJSONString(ids));
return null;
}
};
}
}
......@@ -21,6 +21,7 @@ import com.tanpu.common.utils.BigDecimalUtil;
import com.tanpu.fund.entity.generator.*;
import com.tanpu.fund.enums.FilterTypeEnum;
import com.tanpu.fund.enums.ProStrategyEnums;
import com.tanpu.fund.feign.diagnose.FeignClientForDiagnose;
import com.tanpu.fund.feign.user.FeignClientForFatools;
import com.tanpu.fund.mapper.generator.*;
import com.tanpu.fund.mapper.generator.custom.FundInfoCustomMapper;
......@@ -102,6 +103,9 @@ public class ProductServiceImpl implements ProductService, Constant {
@Resource
private FeignClientForFatools fatools;
@Resource
private FeignClientForDiagnose feignClientForDiagnose;
@Override
public Page<ProductInfoVO> getProductList(ProductInfoReq req) {
......@@ -1547,14 +1551,17 @@ public class ProductServiceImpl implements ProductService, Constant {
infoExample.createCriteria().andIdIn(fundIdList);
Map<String, String> fundMap = fundInfoMapper.selectByExample(infoExample).stream().collect(Collectors.toMap(FundInfo::getId, FundInfo::getFundShortName));
List<String> checkFundIdList = feignClientForDiagnose.getFundCollectInfo(fundIdList).getAttributes();
return fundCounts.stream().map(item -> FundSameResp.builder()
.fundId(item.getFundId())
.fundName(fundMap.get(item.getFundId()))
.ret1y(BigDecimalUtil.toString(item.getRet1y(), 2))
.ret1y(multiply100(item.getRet1y()))
.isCheck(checkFundIdList.contains(item.getFundId()) ? 1 : 0)
.build()).collect(Collectors.toList());
}
return null;
return new ArrayList<>(0);
}
@Override
......@@ -1576,10 +1583,13 @@ public class ProductServiceImpl implements ProductService, Constant {
fundCountMap = null;
}
List<String> checkFundIdList = feignClientForDiagnose.getFundCollectInfo(fundIdList).getAttributes();
importedFundInfoList.stream().map(item -> {
FundSameResp p = FundSameResp.builder()
.fundId(item.getId())
.fundName(item.getFundName())
.isCheck(checkFundIdList.contains(item.getId()) ? 1 : 0)
.build();
if (fundCountMap != null && fundCountMap.containsKey(item.getId())) {
......@@ -1589,7 +1599,7 @@ public class ProductServiceImpl implements ProductService, Constant {
return p;
}).collect(Collectors.toList());
return null;
return new ArrayList<>(0);
}
private ArrayList<TrackRecordVO> getPrivateFundTrackRecordVOS(IfaImportedFundCount fundCount) {
......
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