Commit 9c532829 authored by 张亚辉's avatar 张亚辉

私募

parent 4bc264b8
......@@ -29,6 +29,14 @@ public interface FundInfoCustomMapper {
List<FundNav> getFundInfoLastNet(@Param("list") List<String> fundIdList);
/**
* 获取基金最新净值
*
* @param fundIdList
* @return
*/
List<FundNav> getFundInfoNewNet(@Param("list") List<String> fundIdList);
@Select("select t.id as fileId,t.logical_path as previewUrl from fund_file_record t where t.id in(${list})")
List<FilePreviewResp> getFilePreviewUrl(@Param("list") String list);
}
......@@ -1173,7 +1173,18 @@ public class ProductServiceImpl implements ProductService, Constant {
// 查询研报信息是否有研报
// Map<String, Object> fundInfoReport = getFundReport(Lists.newArrayList(fundInfoMap.keySet()));
return fundInfos.stream().map(p -> getProductInfoVO(fundCountMap, rateMappingMap, p, null, productType))
//查询净值
Map<String, FundNav> fundNavMap;
{
List<FundNav> navList = fundInfoCustomMapper.getFundInfoNewNet(list);
if (CollectionUtils.isNotEmpty(navList)) {
fundNavMap = navList.stream().collect(Collectors.toMap(FundNav::getFundId, c -> c));
} else {
fundNavMap = null;
}
}
return fundInfos.stream().map(p -> getProductInfoVO(fundCountMap, rateMappingMap, p, null, productType, fundNavMap))
.collect(Collectors.toList());
}
......@@ -1182,45 +1193,49 @@ public class ProductServiceImpl implements ProductService, Constant {
// return fundInfoCustomMapper.getFundInfoReport(ids);
// }
private ProductInfoVO getProductInfoVO(Map<String, FundInfo> fundCountMap, Map<String, FundRateMapping> rateMappingMap,
private ProductInfoVO getProductInfoVO(Map<String, FundCount> fundCountMap, Map<String, FundRateMapping> rateMappingMap,
FundInfo fundInfo,
Set<String> fundInfoReports, Integer productType) {
Set<String> fundInfoReports, Integer productType, Map<String, FundNav> fundNavMap) {
ProductInfoVO vo = new ProductInfoVO();
if (fundCountMap.containsKey(fundInfo.getId())) {
FundCount fundCount = fundCountMap.get(fundInfo.getId());
BeanUtils.copyProperties(fundCount, vo);
vo.setRet1m(multiply100(fundCount.getRet1m()));
vo.setRet1y(multiply100(fundCount.getRet1y()));
vo.setRetIncep(multiply100(fundCount.getRetIncep()));
vo.setCumulativeProfit(BigDecimalUtil.toString(fundCount.getCumulativeNav()));
}
vo.setProductType(productType);
vo.setRet1m(multiply100(fundCount.getRet1m()));
vo.setRet1y(multiply100(fundCount.getRet1y()));
String fundId = fundCount.getFundId();
String fundId = fundInfo.getId();
vo.setFundId(fundId);
vo.setRetIncep(multiply100(fundCount.getRetIncep()));
vo.setCumulativeProfit(BigDecimalUtil.toString(fundCount.getCumulativeNav()));
if (fundInfoMap.get(fundId) != null) {
FundInfo fundInfo = fundInfoMap.get(fundId);
// 指数id
vo.setRatioId(ProductEnums.IndexEnum.getValue(fundInfo.getPrimaryBenchmarkId()));
vo.setProductName(fundInfo.getFundShortName());
// getProductCode(indexIdMap, vo, fundInfo);
vo.setOpenDay(fundInfo.getOpenDay());
vo.setDesc(fundInfo.getDescInfo());
// 指数id
vo.setRatioId(ProductEnums.IndexEnum.getValue(fundInfo.getPrimaryBenchmarkId()));
vo.setProductName(fundInfo.getFundShortName());
// getProductCode(indexIdMap, vo, fundInfo);
vo.setOpenDay(fundInfo.getOpenDay());
vo.setDesc(fundInfo.getDescInfo());
// 风险等级
vo.setRiskLevel(fundInfo.getRiskLevel());
}
// 风险等级
vo.setRiskLevel(fundInfo.getRiskLevel());
if (fundInfoReports != null && fundInfoReports.contains(fundId)) {
vo.setIsReport(1);
} else {
vo.setIsReport(0);
}
vo.setIsAppoint(fundCount.getType());
vo.setIsAppoint(fundInfo.getType());
// 最新净值
vo.setNet(new Net(fundCount.getEndDate().getTime(), BigDecimalUtil.toString(fundCount.getNetNav(), 4), BigDecimalUtil.toString(fundCount.getCumulativeNav(), 4)));
if (fundNavMap.containsKey(fundId)) {
FundNav fundNav = fundNavMap.get(fundId);
vo.setNet(new Net(fundNav.getPriceDate().getTime(),
BigDecimalUtil.toString(fundNav.getNav(), 4),
BigDecimalUtil.toString(fundNav.getCumulativeNavWithdrawal(), 4)));
}
getMinInvestmentShare(rateMappingMap, fundCount.getFundId(), vo);
getMinInvestmentShare(rateMappingMap, fundInfo.getId(), vo);
return vo;
}
......
......@@ -30,4 +30,15 @@
AND delete_tag = 0
</select>
<select id="getFundInfoNewNet" parameterType="java.lang.String" resultType="com.tanpu.fund.entity.generator.FundNav">
select res.* from
(SELECT * FROM tamp_product.fund_nav WHERE fund_id in
<foreach close=")" collection="list" item="fundId" open="(" separator=",">
#{fundId}
</foreach>
order BY price_date desc) res
GROUP BY res.fund_id;
AND delete_tag = 0
</select>
</mapper>
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