|
@@ -79,469 +79,12 @@ public class FundInfoService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- // private final NavService navService;
|
|
|
private final BaseInfoService baseInfoService;
|
|
|
-// private final BaseIndicatorServiceV2 baseIndicatorServiceV2;
|
|
|
-// private final CompanyInformationDao companyInformationDao;
|
|
|
|
|
|
public FundInfoService(BaseInfoService baseInfoService) {
|
|
|
-// this.navService = navService;
|
|
|
this.baseInfoService = baseInfoService;
|
|
|
-// this.baseIndicatorServiceV2 = baseIndicatorServiceV2;
|
|
|
-// this.companyInformationDao = companyInformationDao;
|
|
|
}
|
|
|
|
|
|
-// /**
|
|
|
-// * 私募基金相似产品,计算相关性时代码可以优化(参考基金相关性)
|
|
|
-// *
|
|
|
-// * @param req /
|
|
|
-// * @return /
|
|
|
-// */
|
|
|
-// public List<FundSimilarVO> getFundSimilarList(FundSimilarReq req) {
|
|
|
-// List<String> secIds = ListUtil.toLinkedList(req.getSecId());
|
|
|
-// IStrategy strategy = StrategyHandleUtils.getStrategy(req.getStrategy());
|
|
|
-// Map<String, List<DateValue>> secNavMap = this.navService.getSecIdDateValueNavListMapByDb(secIds,
|
|
|
-// null, null, Visibility.Both, NavType.CumulativeNav);
|
|
|
-// List<IndicatorCalcTimeRangeDto> secTimeRanges = IndicatorService.getInstance().getSecTimeRange(req.getSecId(), Frequency.Monthly, secNavMap);
|
|
|
-// String startDate = null;
|
|
|
-// String endDate = null;
|
|
|
-// if (CollUtil.isNotEmpty(secTimeRanges)) {
|
|
|
-// for (IndicatorCalcTimeRangeDto secTimeRange : secTimeRanges) {
|
|
|
-// if (TimeRange.Last1Year == secTimeRange.getTimeRange()) {
|
|
|
-// startDate = secTimeRange.getStartDate();
|
|
|
-// endDate = secTimeRange.getEndDate();
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// FundSimilarParams params = req.convert();
|
|
|
-// params.setStartDate(startDate);
|
|
|
-// List<FundSimilarDo> dataList = this.baseInfoService.getFundSimilarList(params);
|
|
|
-// List<String> fundIds = dataList.stream().map(FundSimilarDo::getFundId).collect(Collectors.toList());
|
|
|
-// if (CollUtil.isNotEmpty(fundIds)) {
|
|
|
-// secIds.addAll(fundIds);
|
|
|
-// }
|
|
|
-// Map<String, List<DateValue>> allNavMap = this.navService.getSecIdDateValueNavListMapByDb(secIds,
|
|
|
-// startDate, endDate, Visibility.Both, NavType.CumulativeNav);
|
|
|
-// Map<String, List<IndicatorCalcPropertyDto>> multiSecRetListNew = this.baseIndicatorServiceV2.getMultiSecRetListNew(
|
|
|
-// secIds, ListUtil.empty(), Frequency.Monthly, Frequency.Daily, startDate, endDate, false, params.getBenchmarkId(),
|
|
|
-// params.getRaiseType(), strategy, Visibility.Both, NavType.CumulativeNav, allNavMap);
|
|
|
-// List<Map<String, Object>> initRetList = NavUtil.handleNextStepNew(secIds, ListUtil.empty(), multiSecRetListNew, false);
|
|
|
-// Map<String, Map<String, Double>> retMap = this.transfer2TwoDimensionMap(initRetList);
|
|
|
-// Double[][] corArr = CalcUtils.getCorrelationMatrix(retMap, ListUtil.toList(params.getSecId()), secIds);
|
|
|
-// List<FundSimilarVO> resultList = ListUtil.list(true);
|
|
|
-// for (FundSimilarDo map : dataList) {
|
|
|
-// FundSimilarVO similarVO = BeanUtil.copyProperties(map, FundSimilarVO.class);
|
|
|
-// // 因为第一个基金是当前基金,所以需要 + 1 来取该基金与当前基金的相关性
|
|
|
-// int i = fundIds.indexOf(map.getFundId()) + 1;
|
|
|
-// similarVO.setSimilar(corArr[0][i]);
|
|
|
-// similarVO.setStrategy(StrategyHandleUtils.getStrategy(map.getStrategy()).getStrategyNameDesc());
|
|
|
-// similarVO.setSubStrategy(this.getStrategyName(map.getSubStrategy()));
|
|
|
-// similarVO.setThirdStrategy(this.getStrategyName(map.getThirdStrategy()));
|
|
|
-// resultList.add(similarVO);
|
|
|
-// }
|
|
|
-// return resultList.stream().filter(e -> e.getSimilar() != null && e.getSimilar() >= Double.parseDouble(params.getThreshold())).collect(Collectors.toList());
|
|
|
-// }
|
|
|
-
|
|
|
-// private String getStrategyName(String strategyKey) {
|
|
|
-// IStrategy strategy = StrategyHandleUtils.getStrategy(strategyKey);
|
|
|
-// if (strategy == null || strategy == NewSubStrategy.OtherStrategy || strategy.getStrategyId() == -1) {
|
|
|
-// return "--";
|
|
|
-// }
|
|
|
-// return strategy.getStrategyNameDesc();
|
|
|
-// }
|
|
|
-//
|
|
|
-// private Map<String, Map<String, Double>> transfer2TwoDimensionMap(List<Map<String, Object>> initRetList) {
|
|
|
-// Map<String, Map<String, Double>> map = new TreeMap<>();
|
|
|
-// for (Map<String, Object> unit : initRetList) {
|
|
|
-// if (unit != null) {
|
|
|
-// String id = unit.get("fund_id").toString();
|
|
|
-// if (!map.containsKey(id)) {
|
|
|
-// map.put(id, new TreeMap<>());
|
|
|
-// }
|
|
|
-// Object t = unit.get("ret_range");
|
|
|
-// if (t == null) {
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// map.get(id).put(unit.get("end_date").toString(), Double.valueOf(unit.get("ret_range").toString()));
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
-// return map;
|
|
|
-// }
|
|
|
-
|
|
|
-// public List<ManualFundNoticeInfoVO> noticeList(ManualFundNoticeReq params) {
|
|
|
-// Map<String, String> typeMapper = MapUtil.builder("1", "10").put("2", "20").put("3", "30").put("4", "50, 70, 90, 91").build();
|
|
|
-// String fundId = params.getSecId();
|
|
|
-// String title = params.getTitle();
|
|
|
-// // type 逗号拆分 转list,直接数据库in查询
|
|
|
-// List<String> typeList = ListUtil.list(false);
|
|
|
-// if (CharSequenceUtil.isNotBlank(params.getType())) {
|
|
|
-// String s = typeMapper.get(params.getType());
|
|
|
-// typeList.addAll(StrUtil.split(s, ","));
|
|
|
-// }
|
|
|
-// List<ManualFundNoticeInfoDO> dataList = this.baseInfoService.queryFundAnnounce(fundId, typeList, title);
|
|
|
-// List<ManualFundNoticeInfoVO> resultList = ListUtil.list(true);
|
|
|
-// // key value互换
|
|
|
-// Map<String, String> reverse = MapUtil.reverse(typeMapper);
|
|
|
-// for (ManualFundNoticeInfoDO temp : dataList) {
|
|
|
-// ManualFundNoticeInfoVO vo = BeanUtil.copyProperties(temp, ManualFundNoticeInfoVO.class);
|
|
|
-// vo.setType(reverse.getOrDefault(vo.getType(), "4"));
|
|
|
-// vo.setDate(DateUtil.formatDate(temp.getDate()));
|
|
|
-// resultList.add(vo);
|
|
|
-// }
|
|
|
-// return resultList;
|
|
|
-// }
|
|
|
-//
|
|
|
-// public ManualFundInvestInfoVO investInfo(String secId) {
|
|
|
-// ManualFundInvestInfoVO fundInvestInfoVO = new ManualFundInvestInfoVO();
|
|
|
-// FundArchivesInfoDO fundArchivesInfo = this.baseInfoService.queryFundArchives(secId);
|
|
|
-// if (fundArchivesInfo == null) {
|
|
|
-// return fundInvestInfoVO;
|
|
|
-// }
|
|
|
-// fundInvestInfoVO.setInvestmentObjective(fundArchivesInfo.getInvestmentObjective());
|
|
|
-// fundInvestInfoVO.setStrategyDescription(fundArchivesInfo.getStrategyDescription());
|
|
|
-// fundInvestInfoVO.setInvestmentScope(fundArchivesInfo.getInvestmentScope());
|
|
|
-// return fundInvestInfoVO;
|
|
|
-// }
|
|
|
-//
|
|
|
-// public FundBaseFeeVO getFundFee(String secId) {
|
|
|
-// FundFeeDo fundFee = this.baseInfoService.getFundFee(secId);
|
|
|
-// DateFormatUtils.format(new Date(), DateConst.YYYY, TimeZone.getDefault());
|
|
|
-// //数字格式处理
|
|
|
-// FundFeeDo fundFees = numberFormat(fundFee);
|
|
|
-// FundBaseFeeVO fee = BeanUtil.copyProperties(fundFees, FundBaseFeeVO.class);
|
|
|
-// String frequency = Optional.ofNullable(fundFees.getAccruedFrequency()).map(e -> StrUtil.subBetween(e, "[", "]"))
|
|
|
-// .map(e -> StrUtil.split(e, ",")).orElse(ListUtil.empty()).stream().filter(StrUtil::isNotBlank)
|
|
|
-// .map(ACCRUED_FREQUENCY::get).collect(Collectors.joining(","));
|
|
|
-// fee.setAccruedFrequency(frequency);
|
|
|
-// String method = Optional.ofNullable(fundFees.getAccruedMethod()).map(e -> StrUtil.subBetween(e, "[", "]"))
|
|
|
-// .map(e -> StrUtil.split(e, ",")).orElse(ListUtil.empty()).stream().filter(StrUtil::isNotBlank)
|
|
|
-// .map(ACCRUED_METHOD::get).collect(Collectors.joining(","));
|
|
|
-// fee.setAccruedMethod(method);
|
|
|
-// return fee;
|
|
|
-// }
|
|
|
-//
|
|
|
-// private FundFeeDo numberFormat(FundFeeDo fundFees) {
|
|
|
-// String minInvestmentShare = fundFees.getMinInvestmentShare();
|
|
|
-// fundFees.setMinInvestmentShare(NumberUtil.isNumber(minInvestmentShare) ? BigDecimalUtils.toBigDecimal(minInvestmentShare)
|
|
|
-// .setScale(2, RoundingMode.HALF_DOWN) + "万" : minInvestmentShare);
|
|
|
-//
|
|
|
-// String managementFeeBank = fundFees.getManagementFeeBank();
|
|
|
-// fundFees.setManagementFeeBank(NumberUtil.isNumber(managementFeeBank) ? BigDecimalUtils.toBigDecimal(managementFeeBank)
|
|
|
-// .setScale(2, RoundingMode.HALF_DOWN) + "%" : managementFeeBank);
|
|
|
-//
|
|
|
-// String subscriptionFee = fundFees.getSubscriptionFee();
|
|
|
-// fundFees.setSubscriptionFee(NumberUtil.isNumber(subscriptionFee) ? BigDecimalUtils.toBigDecimal(subscriptionFee)
|
|
|
-// .setScale(2, RoundingMode.HALF_DOWN) + "%" : subscriptionFee);
|
|
|
-//
|
|
|
-// String redemptionFee = fundFees.getRedemptionFee();
|
|
|
-// fundFees.setRedemptionFee(NumberUtil.isNumber(redemptionFee) ? BigDecimalUtils.toBigDecimal(redemptionFee)
|
|
|
-// .setScale(2, RoundingMode.HALF_DOWN) + "%" : redemptionFee);
|
|
|
-//
|
|
|
-// String managementFee = fundFees.getManagementFee();
|
|
|
-// fundFees.setManagementFee(NumberUtil.isNumber(managementFee) ? BigDecimalUtils.toBigDecimal(managementFee)
|
|
|
-// .setScale(2, RoundingMode.HALF_DOWN) + "%" : managementFee);
|
|
|
-//
|
|
|
-// String managementFeeConsult = fundFees.getManagementFeeConsult();
|
|
|
-// fundFees.setManagementFeeConsult(NumberUtil.isNumber(managementFeeConsult) ? BigDecimalUtils.toBigDecimal(managementFeeConsult)
|
|
|
-// .setScale(2, RoundingMode.HALF_DOWN) + "%" : managementFeeConsult);
|
|
|
-//
|
|
|
-// String performanceFee = fundFees.getPerformanceFee();
|
|
|
-// fundFees.setPerformanceFee(NumberUtil.isNumber(performanceFee) ? BigDecimalUtils.toBigDecimal(performanceFee)
|
|
|
-// .setScale(2, RoundingMode.HALF_DOWN) + "%" : performanceFee);
|
|
|
-//
|
|
|
-// String guardLine = fundFees.getGuardLine();
|
|
|
-// fundFees.setGuardLine(NumberUtil.isNumber(guardLine) ? BigDecimalUtils.toBigDecimal(guardLine)
|
|
|
-// .setScale(2, RoundingMode.HALF_DOWN) + "%" : guardLine);
|
|
|
-//
|
|
|
-// String subsequentInvestmentShare = fundFees.getSubsequentInvestmentShare();
|
|
|
-// fundFees.setSubsequentInvestmentShare(NumberUtil.isNumber(subsequentInvestmentShare) ? BigDecimalUtils.toBigDecimal(subsequentInvestmentShare)
|
|
|
-// .setScale(2, RoundingMode.HALF_DOWN) + "万" : subsequentInvestmentShare);
|
|
|
-//
|
|
|
-// String stopLossLine = fundFees.getStopLossLine();
|
|
|
-// fundFees.setStopLossLine(NumberUtil.isNumber(stopLossLine) ? BigDecimalUtils.toBigDecimal(stopLossLine)
|
|
|
-// .setScale(2, RoundingMode.HALF_DOWN) + "%" : stopLossLine);
|
|
|
-// return fundFees;
|
|
|
-// }
|
|
|
-
|
|
|
-// public ManualFundFeeInfoVO getMfFundFee(String fundId) {
|
|
|
-// List<ManualFundFeeDo> dataList = this.baseInfoService.getManualFundFee(fundId);
|
|
|
-// ManualFundFeeInfoVO result = new ManualFundFeeInfoVO();
|
|
|
-// // 数据库 费率 类型与中文映射
|
|
|
-// Map<String, String> typeMapper = MapUtil.builder("10210", "认购金额").put("11210", "申购金额").put("11010", "申购金额")
|
|
|
-// .put("12200", "持有期限").put("12000", "持有期限").build();
|
|
|
-// // 费率类型 与 单位映射
|
|
|
-// Map<String, String> unitMapper = MapUtil.builder("10210", "万元").put("11210", "万元").put("11010", "万元")
|
|
|
-// .put("12200", "日").put("12000", "日").build();
|
|
|
-// // 记录映射函数,返回一个包含最大最小的范围
|
|
|
-// Function<ManualFundFeeDo, ValueLabelVO> function = e -> {
|
|
|
-// ValueLabelVO vo = new ValueLabelVO();
|
|
|
-// vo.setValue(e.getChargeRateDes());
|
|
|
-// String label = typeMapper.get(e.getChargeRateType());
|
|
|
-// // 最小值不为0和null时,设置为起始数据
|
|
|
-// if (e.getStDivStand1() != null && !Double.valueOf(0.0d).equals(e.getStDivStand1())) {
|
|
|
-// label = NumberUtil.roundStr(e.getStDivStand1(), 0) + unitMapper.get(e.getChargeRateType()) + " <= " + label;
|
|
|
-// }
|
|
|
-// // 最大值不为null时设置截止范围数据
|
|
|
-// if (e.getEnDivStand1() != null) {
|
|
|
-// label += " < " + NumberUtil.roundStr(e.getEnDivStand1(), 0) + unitMapper.get(e.getChargeRateType());
|
|
|
-// }
|
|
|
-// vo.setLabel(label);
|
|
|
-// return vo;
|
|
|
-// };
|
|
|
-// // 认购费
|
|
|
-// List<ValueLabelVO> subscriptionFee = this.handleFee(dataList, "10210", function);
|
|
|
-// result.setSubscriptionFee(subscriptionFee);
|
|
|
-// // 申购费,先取场外
|
|
|
-// List<ValueLabelVO> applyFee = this.handleFee(dataList, "11210", function);
|
|
|
-// if (applyFee.isEmpty()) {
|
|
|
-// applyFee = this.handleFee(dataList, "11010", function);
|
|
|
-// }
|
|
|
-// result.setApplyFee(applyFee);
|
|
|
-// // 赎回费,先取场外
|
|
|
-// List<ValueLabelVO> redemptionFee = this.handleFee(dataList, "12200", function);
|
|
|
-// if (redemptionFee.isEmpty()) {
|
|
|
-// redemptionFee = this.handleFee(dataList, "12000", function);
|
|
|
-// }
|
|
|
-// result.setRedemptionFee(redemptionFee);
|
|
|
-// // 管理费、托管费和营销费
|
|
|
-// result.setManagementFeeTrust(this.handleOneFee(dataList, "15000", ManualFundFeeDo::getChargeRateDes));
|
|
|
-// result.setManagementFeeBank(this.handleOneFee(dataList, "16000", ManualFundFeeDo::getChargeRateDes));
|
|
|
-// result.setSaleFee(this.handleOneFee(dataList, "19000", ManualFundFeeDo::getChargeRateDes));
|
|
|
-// return result;
|
|
|
-// }
|
|
|
-
|
|
|
-// /**
|
|
|
-// * 费率处理工具,返回一个列表
|
|
|
-// *
|
|
|
-// * @param dataList 费率数据
|
|
|
-// * @param type 过滤的关键字
|
|
|
-// * @param function 转换函数
|
|
|
-// * @param <T> 类型参数
|
|
|
-// * @return /
|
|
|
-// */
|
|
|
-// private <T> List<T> handleFee(List<ManualFundFeeDo> dataList, String type, Function<ManualFundFeeDo, T> function) {
|
|
|
-// return dataList.stream().filter(e -> type.equals(e.getChargeRateType())).map(function).collect(Collectors.toList());
|
|
|
-// }
|
|
|
-
|
|
|
-// /**
|
|
|
-// * 费率处理工具,返回一个对象
|
|
|
-// *
|
|
|
-// * @param dataList 费率数据
|
|
|
-// * @param type 过滤的关键字
|
|
|
-// * @param function 转换函数
|
|
|
-// * @param <T> 类型参数
|
|
|
-// * @return /
|
|
|
-// */
|
|
|
-// private <T> T handleOneFee(List<ManualFundFeeDo> dataList, String type, Function<ManualFundFeeDo, T> function) {
|
|
|
-// return this.handleFee(dataList, type, function).stream().findFirst().orElse(null);
|
|
|
-// }
|
|
|
-
|
|
|
-// public List<FundManagerInfoVo> getHFManagerInfo(String secId) {
|
|
|
-// List<FundManagerInfoVo> resultList = ListUtil.list(true);
|
|
|
-// List<PersonnelInformationDo> managerInfoList = this.baseInfoService.getFundManagerInfo(secId);
|
|
|
-// if (CollUtil.isEmpty(managerInfoList)) {
|
|
|
-// return resultList;
|
|
|
-// }
|
|
|
-// List<String> managerIdList = managerInfoList.stream().map(PersonnelInformationDo::getPersonnelId).collect(Collectors.toList());
|
|
|
-// List<PersonnelWorkExperienceDo> workExperienceList = this.baseInfoService.listPersonnelWorkExperience(managerIdList);
|
|
|
-// //过滤掉任职开始日期和任职结束日期为空的数据
|
|
|
-// if (CollUtil.isNotEmpty(workExperienceList)) {
|
|
|
-// workExperienceList = workExperienceList.stream()
|
|
|
-// .filter(e -> !(StrUtil.isEmpty(e.getStartDate()) && StrUtil.isEmpty(e.getEndDate()))).collect(Collectors.toList());
|
|
|
-// }
|
|
|
-// if (CollUtil.isNotEmpty(workExperienceList)) {
|
|
|
-// Map<String, List<PersonnelWorkExperienceDo>> personnelIdWorkExperienceMap = workExperienceList.stream()
|
|
|
-// .collect(Collectors.groupingBy(PersonnelWorkExperienceDo::getPersonnelId));
|
|
|
-// for (PersonnelInformationDo fundManagerInfo : managerInfoList) {
|
|
|
-// FundManagerInfoVo result = new FundManagerInfoVo();
|
|
|
-// result.setManagerId(fundManagerInfo.getPersonnelId());
|
|
|
-// result.setManagerName(fundManagerInfo.getPersonnelName());
|
|
|
-// result.setAvatar(fundManagerInfo.getAvatar());
|
|
|
-// result.setAvatar2(fundManagerInfo.getAvatar2());
|
|
|
-// result.setEducation(EDUCATION_NAME_MAP.get(fundManagerInfo.getEducation()));
|
|
|
-// result.setProfile(fundManagerInfo.getProfile());
|
|
|
-// List<PersonnelWorkExperienceDo> workExperienceDoList = personnelIdWorkExperienceMap.get(fundManagerInfo.getPersonnelId());
|
|
|
-// if (CollUtil.isNotEmpty(workExperienceDoList)) {
|
|
|
-// String latestPosition = workExperienceDoList.stream().filter(e -> e.getEndDate() == null)
|
|
|
-// .sorted(Comparator.comparing(PersonnelWorkExperienceDo::getStartDate).reversed())
|
|
|
-// .map(PersonnelWorkExperienceDo::getPosition).findFirst().orElse(null);
|
|
|
-// result.setManagerWorkExperienceList(workExperienceDoList);
|
|
|
-// result.setLatestPosition(latestPosition);
|
|
|
-// }
|
|
|
-// resultList.add(result);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// return resultList;
|
|
|
-// }
|
|
|
-//
|
|
|
-// public List<ManualFundManagerChangeVO> managerChangeList(ManualFundManagerParams params) {
|
|
|
-// String secId = params.getSecId();
|
|
|
-// String benchmarkId = params.getBenchmarkId();
|
|
|
-// List<ManualFundManagerChangeDo> dataList = this.baseInfoService.listFundManagerChangeHistory(secId);
|
|
|
-//
|
|
|
-// dataList = dataList.stream().filter(e -> e.getStartDate() != null).collect(Collectors.toList());
|
|
|
-// // 按基金经理+开始任职时间分组每个经理只取一条数据
|
|
|
-// Map<String, ManualFundManagerChangeDo> managerInfoMap = MapUtil.newHashMap();
|
|
|
-// Map<String, List<ManualFundManagerChangeDo>> collect = dataList.stream().collect(Collectors.groupingBy(e -> e.getManagerId() + e.getStartDate(), Collectors.toList()));
|
|
|
-// collect.forEach((k, v) -> {
|
|
|
-// ManualFundManagerChangeDo temp = v.stream().findFirst().orElse(null);
|
|
|
-// managerInfoMap.put(k, temp);
|
|
|
-// });
|
|
|
-//
|
|
|
-// List<ManualFundManagerChangeVO> resultList = ListUtil.list(true);
|
|
|
-// List<Indicator> indicatorList = ListUtil.of(Indicator.IntervalReturn, Indicator.AnnualReturn, Indicator.MaxDrawdown,
|
|
|
-// Indicator.SortinoRatio, Indicator.CalmarRatio);
|
|
|
-// managerInfoMap.forEach((k, data) -> {
|
|
|
-// ManualFundManagerChangeVO vo = new ManualFundManagerChangeVO();
|
|
|
-// vo.setManagerId(data.getManagerId());
|
|
|
-// vo.setManagerName(data.getManagerName());
|
|
|
-// // 任职日期和天数计算
|
|
|
-// vo.setEmployDate(data.getStartDate() + "~" + (CharSequenceUtil.isBlank(data.getEndDate()) ? "至今" : data.getEndDate()));
|
|
|
-// Date date = new Date();
|
|
|
-// if (CharSequenceUtil.isNotBlank(data.getEndDate())) {
|
|
|
-// date = DateUtil.parseDate(data.getEndDate());
|
|
|
-// }
|
|
|
-// vo.setEmployDayNum(DateUtil.between(DateUtil.parseDate(data.getStartDate()), date, DateUnit.DAY) + "");
|
|
|
-// // 指标计算
|
|
|
-// Map<String, Map<String, String>> indicatorValue =
|
|
|
-// this.getIndicatorValue(secId, benchmarkId, data.getStartDate(), data.getEndDate(), indicatorList);
|
|
|
-// if (indicatorValue.get(secId) != null) {
|
|
|
-// vo.setFundRet(indicatorValue.get(secId).get(Indicator.IntervalReturn.name()));
|
|
|
-// vo.setAnnualRet(indicatorValue.get(secId).get(Indicator.AnnualReturn.name()));
|
|
|
-// vo.setMaxDrawdown(indicatorValue.get(secId).get(Indicator.MaxDrawdown.name()));
|
|
|
-// vo.setCalmar(indicatorValue.get(secId).get(Indicator.CalmarRatio.name()));
|
|
|
-// vo.setSortino(indicatorValue.get(secId).get(Indicator.SortinoRatio.name()));
|
|
|
-// }
|
|
|
-// resultList.add(vo);
|
|
|
-// });
|
|
|
-// return resultList;
|
|
|
-// }
|
|
|
-
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 计算公募基金和其基准区间内的指标
|
|
|
-// *
|
|
|
-// * @param secId 公募基金
|
|
|
-// * @param benchmarkId 基准
|
|
|
-// * @param startDate 开始日期
|
|
|
-// * @param endDate 结束日期
|
|
|
-// * @param indicatorList 计算指标
|
|
|
-// * @return /
|
|
|
-// */
|
|
|
-// private Map<String, Map<String, String>> getIndicatorValue(String secId, String benchmarkId, String startDate, String endDate, List<Indicator> indicatorList) {
|
|
|
-// DateIntervalDto dateIntervalDto = DateIntervalDto.builder()
|
|
|
-// .id(DateIntervalType.CustomInterval.name()).startDate(startDate).endDate(endDate)
|
|
|
-// .dateIntervalType(DateIntervalType.CustomInterval).frequency(Frequency.Default).build();
|
|
|
-// Map<String, List<DateIntervalDto>> dateIntervalMap = MapUtil.builder(secId, ListUtil.of(dateIntervalDto)).build();
|
|
|
-// Map<String, String> benchmarkIdMap = MapUtil.builder(secId, benchmarkId).build();
|
|
|
-// CalcMultipleSecMultipleTimeRangeIndicatorReq req = CalcMultipleSecMultipleTimeRangeIndicatorReq.builder()
|
|
|
-// .mainSecIdList(ListUtil.of(secId))
|
|
|
-// .secBenchmarkIdMap(benchmarkIdMap)
|
|
|
-// .indexIdList(ListUtil.of(benchmarkId))
|
|
|
-// .raiseType(RaiseType.Both)
|
|
|
-// .strategy(Strategy.All)
|
|
|
-// .visibility(Visibility.Both)
|
|
|
-// .dataFrequency(Frequency.Default)
|
|
|
-// .navType(NavType.CumulativeNav)
|
|
|
-// .secDateIntervalDtoListMap(dateIntervalMap)
|
|
|
-// .indicatorList(indicatorList)
|
|
|
-// .geoExtraindicatorList(ListUtil.empty())
|
|
|
-// .ifAnnualize(true)
|
|
|
-// .riskOfFreeId(Consts.RISK_OF_FREE)
|
|
|
-// .calcIndexRetIndicatorValue(true)
|
|
|
-// .ifConvertPerformanceConsistencyWord(true).build();
|
|
|
-// Map<String, List<IndicatorCalcPropertyDto>> indicatorValueMap = this.baseIndicatorServiceV2.calcMultipleSecMultipleTimeRangeIndicator(req);
|
|
|
-//
|
|
|
-// // DateIntervalType.CustomInterval 类型下每个标的只会返回一个维度下的指标计算结果,所以只获取第一条记录的指标计算结果
|
|
|
-// Map<String, Map<String, String>> result = MapUtil.newHashMap();
|
|
|
-// Map<String, String> valueMap = Optional.ofNullable(indicatorValueMap).map(e -> e.get(secId)).orElse(ListUtil.empty()).stream().findFirst()
|
|
|
-// .map(IndicatorCalcPropertyDto::getSecData).map(IndicatorCalcSecDataDto::getIndicatorValueMap).orElse(MapUtil.empty());
|
|
|
-// Map<String, String> valueBenchmarkMap = Optional.ofNullable(indicatorValueMap).map(e -> e.get(secId)).orElse(ListUtil.empty()).stream().findFirst()
|
|
|
-// .map(IndicatorCalcPropertyDto::getIndexData).map(IndicatorCalcIndexDataDto::getIndexIndicatorValueMap).map(e -> e.get(benchmarkId)).orElse(MapUtil.empty());
|
|
|
-// result.put(secId, valueMap);
|
|
|
-// result.put(benchmarkId, valueBenchmarkMap);
|
|
|
-// return result;
|
|
|
-// }
|
|
|
-
|
|
|
-// public List<ManualFundManagerInfoVO> managerList(ManualFundManagerParams params) {
|
|
|
-// String secId = params.getSecId();
|
|
|
-// String benchmarkId = params.getBenchmarkId();
|
|
|
-// List<ManualFundManagerInfoVO> resultList = ListUtil.list(true);
|
|
|
-// //1.先获取基金下的现任基金经理基本信息
|
|
|
-// List<PersonnelInformationDo> managerInfoList = this.baseInfoService.getFundPresentManagerInfo(secId);
|
|
|
-// if (CollUtil.isEmpty(managerInfoList)) {
|
|
|
-// return resultList;
|
|
|
-// }
|
|
|
-// List<String> managerIdList = managerInfoList.stream().map(PersonnelInformationDo::getPersonnelId).collect(Collectors.toList());
|
|
|
-// //2.获取现任基金经理管理的产品
|
|
|
-// List<MfManagerFundNumDo> mfManagerFundNumList = this.baseInfoService.listMfManagerFundNumByManagerId(managerIdList);
|
|
|
-// Map<String, List<MfManagerFundNumDo>> listMap = mfManagerFundNumList.stream().collect(Collectors.groupingBy(MfManagerFundNumDo::getManagerId));
|
|
|
-// //3.不改变以前的处理逻辑,将PersonnelInformationDo转化为ManualFundManagerInfoDo
|
|
|
-// List<ManualFundManagerInfoDo> dataList = managerInfoList.stream().map(e -> {
|
|
|
-// ManualFundManagerInfoDo manualFundManagerInfoDo = new ManualFundManagerInfoDo();
|
|
|
-// String managerId = e.getPersonnelId();
|
|
|
-// manualFundManagerInfoDo.setManagerId(managerId);
|
|
|
-// manualFundManagerInfoDo.setManagerName(e.getPersonnelName());
|
|
|
-// manualFundManagerInfoDo.setAvatar(e.getAvatar());
|
|
|
-// manualFundManagerInfoDo.setAvatar2(e.getAvatar2());
|
|
|
-// List<MfManagerFundNumDo> mfManagerFundNumDos = listMap.get(managerId);
|
|
|
-// if (CollUtil.isNotEmpty(mfManagerFundNumDos)) {
|
|
|
-// mfManagerFundNumDos.stream().filter(k -> secId.equals(k.getFundId())).findFirst()
|
|
|
-// .ifPresent(mfManagerFundNumDo -> manualFundManagerInfoDo.setStartDate(mfManagerFundNumDo.getStartDate()));
|
|
|
-// long publicProductNumAll = mfManagerFundNumDos.stream().filter(v -> v.getFundId().startsWith("MF")).count();
|
|
|
-// long publicProductNumRunning = mfManagerFundNumDos.stream().filter(w -> Objects.equals(2, w.getStatus()) && w.getEndDate() == null).count();
|
|
|
-// manualFundManagerInfoDo.setPublicProductNumAll(String.valueOf(publicProductNumAll));
|
|
|
-// manualFundManagerInfoDo.setPublicProductNumRunning(String.valueOf(publicProductNumRunning));
|
|
|
-// }
|
|
|
-// return manualFundManagerInfoDo;
|
|
|
-// }).collect(Collectors.toList());
|
|
|
-// dataList = dataList.stream().filter(e -> e.getStartDate() != null).collect(Collectors.toList());
|
|
|
-// // 按基金经理分组每个经理只取一条数据
|
|
|
-// Map<String, ManualFundManagerInfoDo> managerInfoMap = MapUtil.newHashMap();
|
|
|
-// Map<String, List<ManualFundManagerInfoDo>> collect = dataList.stream().collect(Collectors.groupingBy(ManualFundManagerInfoDo::getManagerId, Collectors.toList()));
|
|
|
-// collect.forEach((k, v) -> {
|
|
|
-// ManualFundManagerInfoDo temp = v.stream().findFirst().orElse(null);
|
|
|
-// managerInfoMap.put(k, temp);
|
|
|
-// });
|
|
|
-// List<Indicator> indicatorList = ListUtil.of(Indicator.IntervalReturn, Indicator.AnnualReturn, Indicator.SharpeRatio);
|
|
|
-// managerInfoMap.forEach((k, data) -> {
|
|
|
-// ManualFundManagerInfoVO vo = new ManualFundManagerInfoVO();
|
|
|
-// vo.setManagerId(data.getManagerId());
|
|
|
-// vo.setManagerName(data.getManagerName());
|
|
|
-// vo.setAvatar(data.getAvatar());
|
|
|
-// vo.setAvatar2(data.getAvatar2());
|
|
|
-// vo.setGender(data.getGenderValue());
|
|
|
-// vo.setFundNum(data.getPublicProductNumAll());
|
|
|
-// vo.setRunningNum(data.getPublicProductNumRunning());
|
|
|
-// // 取经理的所有在管基金的最新资产值并求和
|
|
|
-// List<ManualFundAssetSizeDo> tempList = this.baseInfoService.getAssetSizeList(data.getManagerId());
|
|
|
-// if (CollUtil.isNotEmpty(tempList)) {
|
|
|
-// List<String> fundIds = tempList.stream().map(ManualFundAssetSizeDo::getFundId).distinct().collect(Collectors.toList());
|
|
|
-// Double total = 0d;
|
|
|
-// for (String fundId : fundIds) {
|
|
|
-// Double aDouble = tempList.stream().filter(e -> e.getFundId().equals(fundId)).max(Comparator.comparing(ManualFundAssetSizeDo::getDate))
|
|
|
-// .map(ManualFundAssetSizeDo::getFundAssetSize).orElse(0d);
|
|
|
-// total += aDouble;
|
|
|
-// }
|
|
|
-// vo.setRunningScale(String.valueOf(total));
|
|
|
-// }
|
|
|
-// // 指标计算结果处理
|
|
|
-// Map<String, Map<String, String>> indicatorValue = this.getIndicatorValue(secId, benchmarkId, data.getStartDate(), data.getEndDate(), indicatorList);
|
|
|
-// if (indicatorValue.get(secId) != null) {
|
|
|
-// vo.setNavChange(indicatorValue.get(secId).get(Indicator.IntervalReturn.name()));
|
|
|
-// vo.setAnnualRet(indicatorValue.get(secId).get(Indicator.AnnualReturn.name()));
|
|
|
-// vo.setSharpe(indicatorValue.get(secId).get(Indicator.SharpeRatio.name()));
|
|
|
-// }
|
|
|
-// if (indicatorValue.get(benchmarkId) != null) {
|
|
|
-// vo.setBenchmarkRet(indicatorValue.get(benchmarkId).get(Indicator.IntervalReturn.name()));
|
|
|
-// }
|
|
|
-// resultList.add(vo);
|
|
|
-// });
|
|
|
-// return resultList;
|
|
|
-// }
|
|
|
-
|
|
|
public PrivatelyFundBaseInfoVO getFundBaseInfo(String fundId) {
|
|
|
PrivatelyFundBaseInfoVO privatelyFundBaseInfoVO = new PrivatelyFundBaseInfoVO();
|
|
|
//私募基金基本信息
|
|
@@ -646,73 +189,4 @@ public class FundInfoService {
|
|
|
// handleFundScale(publiclyFundBaseInfoVO, fundId);
|
|
|
return publiclyFundBaseInfoVO;
|
|
|
}
|
|
|
-
|
|
|
-// private void handleOpenDayAndRedeemType(PubliclyFundBaseInfoVO publiclyFundBaseInfoVO, String fundId) {
|
|
|
-// List<ManualFundPurchaseRedeemDO> tempList = this.baseInfoService.getMFundPurchaseRedeemList(fundId);
|
|
|
-// if (CollUtil.isNotEmpty(tempList)) {
|
|
|
-// String type = null;
|
|
|
-// String applyingType = tempList.get(0).getApplyingType();
|
|
|
-// if (CharSequenceUtil.isNotBlank(applyingType)) {
|
|
|
-// // 限大额 -> 限大额申购
|
|
|
-// if ("限大额".equals(applyingType)) {
|
|
|
-// applyingType = applyingType + "申购";
|
|
|
-// }
|
|
|
-// type = applyingType;
|
|
|
-// }
|
|
|
-// String redeemType = tempList.get(0).getRedeemType();
|
|
|
-// if (CharSequenceUtil.isNotBlank(redeemType)) {
|
|
|
-// type = type + "," + redeemType;
|
|
|
-// }
|
|
|
-// publiclyFundBaseInfoVO.setApplyRedemType(type);
|
|
|
-// publiclyFundBaseInfoVO.setOpenDays(this.findAndBuildOpenDay(tempList));
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// private List<FundOpenDayVO> findAndBuildOpenDay(List<ManualFundPurchaseRedeemDO> dataList) {
|
|
|
-// dataList.sort(Comparator.comparing(ManualFundPurchaseRedeemDO::getEndDate).reversed());
|
|
|
-// FundOpenDayVO apply = this.buildOpenDay(dataList, "可申购");
|
|
|
-// FundOpenDayVO redeem = this.buildOpenDay(dataList, "可赎回");
|
|
|
-// return ListUtil.of(apply, redeem);
|
|
|
-// }
|
|
|
-
|
|
|
-// private FundOpenDayVO buildOpenDay(List<ManualFundPurchaseRedeemDO> dataList, String type) {
|
|
|
-// Map<String, String> typeMapper = MapUtil.builder("可申购", "applyingType").put("可赎回", "redeemType").build();
|
|
|
-// ManualFundPurchaseRedeemDO purchaseRedeemDO = dataList.get(dataList.size() - 1);
|
|
|
-// String startDate = null;
|
|
|
-// for (ManualFundPurchaseRedeemDO data : dataList) {
|
|
|
-// // 小于结束日期的第一个不满足type约束的日期为开始日期
|
|
|
-// Object typeValue = ReflectUtil.getFieldValue(data, typeMapper.get(type));
|
|
|
-// if (typeValue != null && !Objects.equals(type, typeValue)) {
|
|
|
-// break;
|
|
|
-// }
|
|
|
-// startDate = data.getEndDate();
|
|
|
-// }
|
|
|
-// // 开始日为最后一天且value不为可申赎时置为null
|
|
|
-// Object fieldValue = ReflectUtil.getFieldValue(purchaseRedeemDO, typeMapper.get(type));
|
|
|
-// if (purchaseRedeemDO.getEndDate().equals(startDate) && !Objects.equals(type, fieldValue)) {
|
|
|
-// startDate = null;
|
|
|
-// }
|
|
|
-// return FundOpenDayVO.builder().type(type).startDate(startDate).build();
|
|
|
-// }
|
|
|
-
|
|
|
-// private void handleFundScale(PubliclyFundBaseInfoVO publiclyFundBaseInfoVO, String fundId) {
|
|
|
-// List<FundInitLatestAssetSizeDO> initLatest = this.baseInfoService.getFundInitLatestAssetSize(fundId);
|
|
|
-// if (CollUtil.isNotEmpty(initLatest)) {
|
|
|
-// NewDateValue initScale = initLatest.stream().filter(e -> "0".equals(e.getType())).map(e -> new NewDateValue(e.getDate(), e.getAssetSize())).findFirst().orElse(null);
|
|
|
-// NewDateValue latestScale = initLatest.stream().filter(e -> "1".equals(e.getType())).map(e -> new NewDateValue(e.getDate(), e.getAssetSize())).findFirst().orElse(null);
|
|
|
-// publiclyFundBaseInfoVO.setInitScale(initScale);
|
|
|
-// publiclyFundBaseInfoVO.setLatestScale(latestScale);
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// private void handleFundArchivesInfo(PubliclyFundBaseInfoVO publiclyFundBaseInfoVO, String fundId) {
|
|
|
-// FundArchivesInfoDO fundArchivesInfoDO = this.baseInfoService.queryFundArchives(fundId);
|
|
|
-// publiclyFundBaseInfoVO.setApplyingMarket(fundArchivesInfoDO.getApplyingMarket() != null
|
|
|
-// ? APPLYING_MARKET_MAP.get(Integer.valueOf(fundArchivesInfoDO.getApplyingMarket())) : APPLYING_MARKET_MAP.get(2));
|
|
|
-// publiclyFundBaseInfoVO.setLowestApplyAmount(fundArchivesInfoDO.getLowestApplyAmount());
|
|
|
-// publiclyFundBaseInfoVO.setLowestSumRedemption(fundArchivesInfoDO.getLowestSumRedemption());
|
|
|
-// NewDateValue initShare = new NewDateValue(fundArchivesInfoDO.getInitialDate(), fundArchivesInfoDO.getInitialShare());
|
|
|
-// publiclyFundBaseInfoVO.setInitShare(initShare);
|
|
|
-// }
|
|
|
-
|
|
|
}
|