Commit bf46168c authored by 张亚辉's avatar 张亚辉

私募基金搜索

parent 22028f6a
......@@ -55,6 +55,6 @@ public interface FundInfoCustomMapper {
@Select("select t.id as id, t.fund_name as `value` from ifa_imported_fund_info t where t.id in(${list}) and t.delete_tag=0")
List<Type> getSimplePrivateFundList(@Param("list") String list);
@Select("select t.id as id,t.fund_short_name as value from fund_info t where t.fund_short_name like #{productName} and t.delete_tag=0")
@Select("select t.id as id,t.fund_short_name as value, t.fund_code as fundCode from fund_info t where t.fund_short_name like #{productName} and t.delete_tag=0")
List<Type> getFundInfoLikeName(@Param("productName") String productName);
}
......@@ -15,6 +15,7 @@ import com.tanpu.common.enums.BizEnums;
import com.tanpu.common.enums.Constant;
import com.tanpu.common.enums.SysConstEnums;
import com.tanpu.common.enums.product.ProductEnums;
import com.tanpu.common.enums.product.ProductTypeEnum;
import com.tanpu.common.model.Page;
import com.tanpu.common.model.Pageable;
import com.tanpu.common.model.adm.req.IfaNetImportReq;
......@@ -2488,7 +2489,42 @@ public class ProductServiceImpl implements ProductService, Constant {
public List<Type> getFundLikeShortName(String productName, Pageable page) {
PageMethod.startPage(page.getPageNumber(), page.getPageSize());
return this.fundInfoCustomMapper.getFundInfoLikeName("%" + productName + "%");
final List<Type> fundInfoList = this.fundInfoCustomMapper.getFundInfoLikeName("%" + productName + "%");
if (CollectionUtils.isNotEmpty(fundInfoList)) {
// 查询基金收益
FundCountExample countExample = new FundCountExample();
countExample.createCriteria().andFundIdIn(fundInfoList.stream().map(Type::getId).collect(Collectors.toList()))
.andDeleteTagEqualTo(BizEnums.DeleteTag.tag_init);
final List<FundCount> fundCounts = fundCountMapper.selectByExample(countExample);
Map<String, FundCount> fundCountMap = null;
if (CollectionUtils.isNotEmpty(fundCounts)) {
fundCountMap = fundCounts.stream().collect(Collectors.toMap(FundCount::getFundId, c -> c));
}
// 查询基金最新净值
List<FundNav> fundInfoNewNet = fundInfoCustomMapper.getFundInfoNewNet(fundInfoList.stream().map(Type::getId).collect(Collectors.toList()));
Map<String, FundNav> fundNavMap = null;
if (CollectionUtils.isNotEmpty(fundInfoNewNet)) {
fundNavMap = fundInfoNewNet.stream().collect(Collectors.toMap(FundNav::getFundId, c -> c));
}
Map<String, FundCount> finalFundCountMap = fundCountMap;
Map<String, FundNav> finalFundNavMap = fundNavMap;
fundInfoList.forEach(c -> {
c.setFundType(ProductTypeEnum.TAMP.type);
if (finalFundCountMap.containsKey(c.getId())) {
c.setRet1y(finalFundCountMap.get(c.getId()).getRet1y());
}
if (finalFundNavMap.containsKey(c.getId())) {
c.setNet(BigDecimalUtil.toString(finalFundNavMap.get(c.getId()).getNav(), 4));
c.setNetDate(DateUtil.formatDate(finalFundNavMap.get(c.getId()).getPriceDate()));
}
});
}
return fundInfoList;
}
@Override
......
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