Commit 88db936d authored by 张亚辉's avatar 张亚辉

基金详情

parent e20f4ccd
...@@ -65,6 +65,10 @@ public interface ProductApi { ...@@ -65,6 +65,10 @@ public interface ProductApi {
@GetMapping("/track/record") @GetMapping("/track/record")
CommonResp<List<TrackRecordVO>> getTrackRecordInfo(@ApiParam("产品id") @RequestParam("id") String id); CommonResp<List<TrackRecordVO>> getTrackRecordInfo(@ApiParam("产品id") @RequestParam("id") String id);
@ApiOperation("历史业绩 对比指数")
@GetMapping("/track/recor/index")
CommonResp<List<TrackRecordVO>> getTrackRecordInfoIndex(@ApiParam("对比指数ID") @RequestParam("indexId") String indexId);
@ApiOperation("历史净值") @ApiOperation("历史净值")
@GetMapping("/track/net") @GetMapping("/track/net")
CommonResp<Page<TrackNetVO>> getTrackNetListInfo(@ApiParam("产品id") @RequestParam("id") String id, @ApiParam("分页对象") Pageable page); CommonResp<Page<TrackNetVO>> getTrackNetListInfo(@ApiParam("产品id") @RequestParam("id") String id, @ApiParam("分页对象") Pageable page);
...@@ -124,4 +128,12 @@ public interface ProductApi { ...@@ -124,4 +128,12 @@ public interface ProductApi {
@ApiOperation(value = "根据Id查询私有产品基本信息") @ApiOperation(value = "根据Id查询私有产品基本信息")
@PostMapping(value = "/privateFundInfo/simpleList", produces = {"application/json"}) @PostMapping(value = "/privateFundInfo/simpleList", produces = {"application/json"})
CommonResp<List<FundInfoSimpleListResp>> privateSimpleList(@RequestBody List<String> idList); CommonResp<List<FundInfoSimpleListResp>> privateSimpleList(@RequestBody List<String> idList);
@ApiOperation("对比指数")
@GetMapping("/fund/indexes")
CommonResp<List<FundIndexBasicResp>> fundIndexes();
@ApiOperation("查询同类基金")
@GetMapping("/query/samefund")
CommonResp<List<FundSameResp>> querySamefund(@RequestParam("fundId") String fundId);
} }
...@@ -8,6 +8,7 @@ import com.tanpu.common.model.product.req.ProductListReq; ...@@ -8,6 +8,7 @@ import com.tanpu.common.model.product.req.ProductListReq;
import com.tanpu.common.model.product.resp.*; import com.tanpu.common.model.product.resp.*;
import com.tanpu.common.resp.CommonResp; import com.tanpu.common.resp.CommonResp;
import com.tanpu.fund.api.ProductApi; import com.tanpu.fund.api.ProductApi;
import com.tanpu.fund.feign.publicfund.FeignClientForPublicfund;
import com.tanpu.fund.service.ProductService; import com.tanpu.fund.service.ProductService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -22,6 +23,8 @@ public class ProductController implements ProductApi { ...@@ -22,6 +23,8 @@ public class ProductController implements ProductApi {
@Resource @Resource
private ProductService productService; private ProductService productService;
@Resource
private FeignClientForPublicfund feignClientForPublicfund;
@Override @Override
public CommonResp<Page<ProductInfoVO>> getProductInfo(ProductInfoReq req) { public CommonResp<Page<ProductInfoVO>> getProductInfo(ProductInfoReq req) {
...@@ -68,6 +71,11 @@ public class ProductController implements ProductApi { ...@@ -68,6 +71,11 @@ public class ProductController implements ProductApi {
return CommonResp.success(this.productService.getTrackRecord(id)); return CommonResp.success(this.productService.getTrackRecord(id));
} }
@Override
public CommonResp<List<TrackRecordVO>> getTrackRecordInfoIndex(String indexId) {
return feignClientForPublicfund.getTrackRecordInfoIndex(indexId);
}
@Override @Override
public CommonResp<Page<TrackNetVO>> getTrackNetListInfo(String id, Pageable page) { public CommonResp<Page<TrackNetVO>> getTrackNetListInfo(String id, Pageable page) {
return CommonResp.success(this.productService.getTrackNetList(id, page)); return CommonResp.success(this.productService.getTrackNetList(id, page));
...@@ -156,4 +164,14 @@ public class ProductController implements ProductApi { ...@@ -156,4 +164,14 @@ public class ProductController implements ProductApi {
public CommonResp<List<FundInfoSimpleListResp>> privateSimpleList(List<String> idList) { public CommonResp<List<FundInfoSimpleListResp>> privateSimpleList(List<String> idList) {
return CommonResp.success(productService.getPrivateSimpleList(idList)); return CommonResp.success(productService.getPrivateSimpleList(idList));
} }
@Override
public CommonResp<List<FundIndexBasicResp>> fundIndexes() {
return feignClientForPublicfund.fundIndexes();
}
@Override
public CommonResp<List<FundSameResp>> querySamefund(String fundId) {
return CommonResp.success(this.productService.querySamefund(fundId));
}
} }
package com.tanpu.fund.feign.publicfund;
import com.tanpu.common.model.product.resp.FundIndexBasicResp;
import com.tanpu.common.model.product.resp.TrackRecordVO;
import com.tanpu.common.resp.CommonResp;
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;
@FeignClient(value = "service-public-fund", fallbackFactory = FeignbackForPublicfund.class, path = "/fundpublic")
public interface FeignClientForPublicfund {
@ApiOperation("对比指数")
@GetMapping("/fund/indexes")
CommonResp<List<FundIndexBasicResp>> fundIndexes();
@ApiOperation("历史业绩 对比指数")
@GetMapping("/track/recor/index")
CommonResp<List<TrackRecordVO>> getTrackRecordInfoIndex(@ApiParam("对比指数ID") @RequestParam("indexId") String indexId);
}
package com.tanpu.fund.feign.publicfund;
import com.tanpu.common.model.product.resp.FundIndexBasicResp;
import com.tanpu.common.model.product.resp.TrackRecordVO;
import com.tanpu.common.resp.CommonResp;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
@Slf4j
@Component
public class FeignbackForPublicfund implements FallbackFactory<FeignClientForPublicfund> {
@Override
public FeignClientForPublicfund create(Throwable throwable) {
return new FeignClientForPublicfund() {
@Override
public CommonResp<List<FundIndexBasicResp>> fundIndexes() {
log.error("请求信息", throwable);
log.error("FeignClientForPublicfund.fundIndexes 查询指数失败");
return null;
}
@Override
public CommonResp<List<TrackRecordVO>> getTrackRecordInfoIndex(String indexId) {
log.error("请求信息", throwable);
log.error("FeignClientForPublicfund.getTrackRecordInfoIndex 历史业绩 对比指数:{}", indexId);
return null;
}
};
}
}
...@@ -4,6 +4,8 @@ import com.tanpu.fund.entity.generator.FundCompanyInfo; ...@@ -4,6 +4,8 @@ import com.tanpu.fund.entity.generator.FundCompanyInfo;
import com.tanpu.fund.entity.generator.FundCount; import com.tanpu.fund.entity.generator.FundCount;
import com.tanpu.fund.entity.generator.FundPersonnelInfo; import com.tanpu.fund.entity.generator.FundPersonnelInfo;
import java.util.List;
/** /**
* @author: zyh * @author: zyh
*/ */
...@@ -13,5 +15,5 @@ public interface ProductCommonService { ...@@ -13,5 +15,5 @@ public interface ProductCommonService {
FundCompanyInfo getFundCompanyInfo(String companyId); FundCompanyInfo getFundCompanyInfo(String companyId);
FundPersonnelInfo getFundManager(String fundId); List<FundPersonnelInfo> getFundManager(String fundId);
} }
...@@ -64,4 +64,6 @@ public interface ProductService { ...@@ -64,4 +64,6 @@ public interface ProductService {
List<FundInfoSimpleListResp> getSimpleList(List<String> idList); List<FundInfoSimpleListResp> getSimpleList(List<String> idList);
List<FundInfoSimpleListResp> getPrivateSimpleList(List<String> idList); List<FundInfoSimpleListResp> getPrivateSimpleList(List<String> idList);
List<FundSameResp> querySamefund(String fundId);
} }
...@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author: zyh * @author: zyh
...@@ -59,7 +60,7 @@ public class ProductCommonServiceImpl implements ProductCommonService { ...@@ -59,7 +60,7 @@ public class ProductCommonServiceImpl implements ProductCommonService {
} }
@Override @Override
public FundPersonnelInfo getFundManager(String fundId) { public List<FundPersonnelInfo> getFundManager(String fundId) {
if (StringUtils.isEmpty(fundId)) { if (StringUtils.isEmpty(fundId)) {
return null; return null;
} }
...@@ -67,9 +68,15 @@ public class ProductCommonServiceImpl implements ProductCommonService { ...@@ -67,9 +68,15 @@ public class ProductCommonServiceImpl implements ProductCommonService {
FundManagerMappingExample example = new FundManagerMappingExample(); FundManagerMappingExample example = new FundManagerMappingExample();
example.createCriteria().andFundIdEqualTo(fundId); example.createCriteria().andFundIdEqualTo(fundId);
List<FundManagerMapping> fundManagerMappings = fundManagerMappingMapper.selectByExample(example); List<FundManagerMapping> fundManagerMappings = fundManagerMappingMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(fundManagerMappings) if (CollectionUtils.isNotEmpty(fundManagerMappings)) {
&& StringUtils.isNotEmpty(fundManagerMappings.get(0).getFundManagerId())) {
return fundPersonnelInfoMapper.selectByPrimaryKey(fundManagerMappings.get(0).getFundManagerId()); List<String> list = fundManagerMappings.stream().filter(item -> StringUtils.isNotEmpty(item.getFundManagerId()))
.map(FundManagerMapping::getFundManagerId).collect(Collectors.toList());
FundPersonnelInfoExample fundPersonnelInfoExample = new FundPersonnelInfoExample();
fundPersonnelInfoExample.createCriteria().andPersonnelIdIn(list);
return fundPersonnelInfoMapper.selectByExample(fundPersonnelInfoExample);
} }
return null; return null;
} }
......
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