|
@@ -88,11 +88,11 @@ public class FundInfoService {
|
|
* @return /
|
|
* @return /
|
|
*/
|
|
*/
|
|
public List<FundSimilarVO> getFundSimilarList(FundSimilarReq req) {
|
|
public List<FundSimilarVO> getFundSimilarList(FundSimilarReq req) {
|
|
- List<String> refIds = ListUtil.toLinkedList(req.getRefId());
|
|
|
|
|
|
+ List<String> secIds = ListUtil.toLinkedList(req.getSecId());
|
|
IStrategy strategy = StrategyHandleUtils.getStrategy(req.getStrategy());
|
|
IStrategy strategy = StrategyHandleUtils.getStrategy(req.getStrategy());
|
|
- Map<String, List<DateValue>> secNavMap = this.navService.getSecIdDateValueNavListMapByDb(refIds,
|
|
|
|
|
|
+ Map<String, List<DateValue>> secNavMap = this.navService.getSecIdDateValueNavListMapByDb(secIds,
|
|
null, null, Visibility.Both, NavType.CumulativeNav);
|
|
null, null, Visibility.Both, NavType.CumulativeNav);
|
|
- List<IndicatorCalcTimeRangeDto> secTimeRanges = IndicatorService.getInstance().getSecTimeRange(req.getRefId(), Frequency.Monthly, secNavMap);
|
|
|
|
|
|
+ List<IndicatorCalcTimeRangeDto> secTimeRanges = IndicatorService.getInstance().getSecTimeRange(req.getSecId(), Frequency.Monthly, secNavMap);
|
|
String startDate = null;
|
|
String startDate = null;
|
|
String endDate = null;
|
|
String endDate = null;
|
|
if (CollUtil.isNotEmpty(secTimeRanges)) {
|
|
if (CollUtil.isNotEmpty(secTimeRanges)) {
|
|
@@ -109,16 +109,16 @@ public class FundInfoService {
|
|
List<FundSimilarDo> dataList = this.baseInfoService.getFundSimilarList(params);
|
|
List<FundSimilarDo> dataList = this.baseInfoService.getFundSimilarList(params);
|
|
List<String> fundIds = dataList.stream().map(FundSimilarDo::getFundId).collect(Collectors.toList());
|
|
List<String> fundIds = dataList.stream().map(FundSimilarDo::getFundId).collect(Collectors.toList());
|
|
if (CollUtil.isNotEmpty(fundIds)) {
|
|
if (CollUtil.isNotEmpty(fundIds)) {
|
|
- refIds.addAll(fundIds);
|
|
|
|
|
|
+ secIds.addAll(fundIds);
|
|
}
|
|
}
|
|
- Map<String, List<DateValue>> allNavMap = this.navService.getSecIdDateValueNavListMapByDb(refIds,
|
|
|
|
|
|
+ Map<String, List<DateValue>> allNavMap = this.navService.getSecIdDateValueNavListMapByDb(secIds,
|
|
startDate, endDate, Visibility.Both, NavType.CumulativeNav);
|
|
startDate, endDate, Visibility.Both, NavType.CumulativeNav);
|
|
Map<String, List<IndicatorCalcPropertyDto>> multiSecRetListNew = this.baseIndicatorServiceV2.getMultiSecRetListNew(
|
|
Map<String, List<IndicatorCalcPropertyDto>> multiSecRetListNew = this.baseIndicatorServiceV2.getMultiSecRetListNew(
|
|
- refIds, ListUtil.empty(), Frequency.Monthly, Frequency.Daily, startDate, endDate, false, params.getBenchmarkId(),
|
|
|
|
|
|
+ secIds, ListUtil.empty(), Frequency.Monthly, Frequency.Daily, startDate, endDate, false, params.getBenchmarkId(),
|
|
params.getRaiseType(), strategy, Visibility.Both, NavType.CumulativeNav, allNavMap);
|
|
params.getRaiseType(), strategy, Visibility.Both, NavType.CumulativeNav, allNavMap);
|
|
- List<Map<String, Object>> initRetList = NavUtil.handleNextStepNew(refIds, ListUtil.empty(), multiSecRetListNew, false);
|
|
|
|
|
|
+ List<Map<String, Object>> initRetList = NavUtil.handleNextStepNew(secIds, ListUtil.empty(), multiSecRetListNew, false);
|
|
Map<String, Map<String, Double>> retMap = this.transfer2TwoDimensionMap(initRetList);
|
|
Map<String, Map<String, Double>> retMap = this.transfer2TwoDimensionMap(initRetList);
|
|
- Double[][] corArr = CalcUtils.getCorrelationMatrix(retMap, ListUtil.toList(params.getRefId()), refIds);
|
|
|
|
|
|
+ Double[][] corArr = CalcUtils.getCorrelationMatrix(retMap, ListUtil.toList(params.getSecId()), secIds);
|
|
List<FundSimilarVO> resultList = ListUtil.list(true);
|
|
List<FundSimilarVO> resultList = ListUtil.list(true);
|
|
for (FundSimilarDo map : dataList) {
|
|
for (FundSimilarDo map : dataList) {
|
|
FundSimilarVO similarVO = BeanUtil.copyProperties(map, FundSimilarVO.class);
|
|
FundSimilarVO similarVO = BeanUtil.copyProperties(map, FundSimilarVO.class);
|
|
@@ -162,7 +162,7 @@ public class FundInfoService {
|
|
|
|
|
|
public List<ManualFundNoticeInfoVO> noticeList(ManualFundNoticeReq params) {
|
|
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();
|
|
Map<String, String> typeMapper = MapUtil.builder("1", "10").put("2", "20").put("3", "30").put("4", "50, 70, 90, 91").build();
|
|
- String fundId = params.getRefId();
|
|
|
|
|
|
+ String fundId = params.getSecId();
|
|
String title = params.getTitle();
|
|
String title = params.getTitle();
|
|
// type 逗号拆分 转list,直接数据库in查询
|
|
// type 逗号拆分 转list,直接数据库in查询
|
|
List<String> typeList = ListUtil.list(false);
|
|
List<String> typeList = ListUtil.list(false);
|
|
@@ -183,9 +183,9 @@ public class FundInfoService {
|
|
return resultList;
|
|
return resultList;
|
|
}
|
|
}
|
|
|
|
|
|
- public ManualFundInvestInfoVO investInfo(String refId) {
|
|
|
|
|
|
+ public ManualFundInvestInfoVO investInfo(String secId) {
|
|
ManualFundInvestInfoVO fundInvestInfoVO = new ManualFundInvestInfoVO();
|
|
ManualFundInvestInfoVO fundInvestInfoVO = new ManualFundInvestInfoVO();
|
|
- FundArchivesInfoDO fundArchivesInfo = this.baseInfoService.queryFundArchives(refId);
|
|
|
|
|
|
+ FundArchivesInfoDO fundArchivesInfo = this.baseInfoService.queryFundArchives(secId);
|
|
if (fundArchivesInfo == null) {
|
|
if (fundArchivesInfo == null) {
|
|
return fundInvestInfoVO;
|
|
return fundInvestInfoVO;
|
|
}
|
|
}
|
|
@@ -195,8 +195,8 @@ public class FundInfoService {
|
|
return fundInvestInfoVO;
|
|
return fundInvestInfoVO;
|
|
}
|
|
}
|
|
|
|
|
|
- public FundBaseFeeVO getFundFee(String refId) {
|
|
|
|
- FundFeeDo fundFee = this.baseInfoService.getFundFee(refId);
|
|
|
|
|
|
+ public FundBaseFeeVO getFundFee(String secId) {
|
|
|
|
+ FundFeeDo fundFee = this.baseInfoService.getFundFee(secId);
|
|
DateFormatUtils.format(new Date(), DateConst.YYYY, TimeZone.getDefault());
|
|
DateFormatUtils.format(new Date(), DateConst.YYYY, TimeZone.getDefault());
|
|
//数字格式处理
|
|
//数字格式处理
|
|
FundFeeDo fundFees = numberFormat(fundFee);
|
|
FundFeeDo fundFees = numberFormat(fundFee);
|
|
@@ -328,9 +328,9 @@ public class FundInfoService {
|
|
return this.handleFee(dataList, type, function).stream().findFirst().orElse(null);
|
|
return this.handleFee(dataList, type, function).stream().findFirst().orElse(null);
|
|
}
|
|
}
|
|
|
|
|
|
- public List<FundManagerInfoVo> getHFManagerInfo(String refId) {
|
|
|
|
|
|
+ public List<FundManagerInfoVo> getHFManagerInfo(String secId) {
|
|
List<FundManagerInfoVo> resultList = ListUtil.list(true);
|
|
List<FundManagerInfoVo> resultList = ListUtil.list(true);
|
|
- List<PersonnelInformationDo> managerInfoList = this.baseInfoService.getFundManagerInfo(refId);
|
|
|
|
|
|
+ List<PersonnelInformationDo> managerInfoList = this.baseInfoService.getFundManagerInfo(secId);
|
|
if (CollUtil.isEmpty(managerInfoList)) {
|
|
if (CollUtil.isEmpty(managerInfoList)) {
|
|
return resultList;
|
|
return resultList;
|
|
}
|
|
}
|
|
@@ -367,9 +367,9 @@ public class FundInfoService {
|
|
}
|
|
}
|
|
|
|
|
|
public List<ManualFundManagerChangeVO> managerChangeList(ManualFundManagerParams params) {
|
|
public List<ManualFundManagerChangeVO> managerChangeList(ManualFundManagerParams params) {
|
|
- String refId = params.getRefId();
|
|
|
|
|
|
+ String secId = params.getSecId();
|
|
String benchmarkId = params.getBenchmarkId();
|
|
String benchmarkId = params.getBenchmarkId();
|
|
- List<ManualFundManagerChangeDo> dataList = this.baseInfoService.listFundManagerChangeHistory(refId);
|
|
|
|
|
|
+ List<ManualFundManagerChangeDo> dataList = this.baseInfoService.listFundManagerChangeHistory(secId);
|
|
|
|
|
|
dataList = dataList.stream().filter(e -> e.getStartDate() != null).collect(Collectors.toList());
|
|
dataList = dataList.stream().filter(e -> e.getStartDate() != null).collect(Collectors.toList());
|
|
// 按基金经理+开始任职时间分组每个经理只取一条数据
|
|
// 按基金经理+开始任职时间分组每个经理只取一条数据
|
|
@@ -396,13 +396,13 @@ public class FundInfoService {
|
|
vo.setEmployDayNum(DateUtil.between(DateUtil.parseDate(data.getStartDate()), date, DateUnit.DAY) + "");
|
|
vo.setEmployDayNum(DateUtil.between(DateUtil.parseDate(data.getStartDate()), date, DateUnit.DAY) + "");
|
|
// 指标计算
|
|
// 指标计算
|
|
Map<String, Map<String, String>> indicatorValue =
|
|
Map<String, Map<String, String>> indicatorValue =
|
|
- this.getIndicatorValue(refId, benchmarkId, data.getStartDate(), data.getEndDate(), indicatorList);
|
|
|
|
- if (indicatorValue.get(refId) != null) {
|
|
|
|
- vo.setFundRet(indicatorValue.get(refId).get(Indicator.IntervalReturn.name()));
|
|
|
|
- vo.setAnnualRet(indicatorValue.get(refId).get(Indicator.AnnualReturn.name()));
|
|
|
|
- vo.setMaxDrawdown(indicatorValue.get(refId).get(Indicator.MaxDrawdown.name()));
|
|
|
|
- vo.setCalmar(indicatorValue.get(refId).get(Indicator.CalmarRatio.name()));
|
|
|
|
- vo.setSortino(indicatorValue.get(refId).get(Indicator.SortinoRatio.name()));
|
|
|
|
|
|
+ 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);
|
|
resultList.add(vo);
|
|
});
|
|
});
|
|
@@ -413,21 +413,21 @@ public class FundInfoService {
|
|
/**
|
|
/**
|
|
* 计算公募基金和其基准区间内的指标
|
|
* 计算公募基金和其基准区间内的指标
|
|
*
|
|
*
|
|
- * @param refId 公募基金
|
|
|
|
|
|
+ * @param secId 公募基金
|
|
* @param benchmarkId 基准
|
|
* @param benchmarkId 基准
|
|
* @param startDate 开始日期
|
|
* @param startDate 开始日期
|
|
* @param endDate 结束日期
|
|
* @param endDate 结束日期
|
|
* @param indicatorList 计算指标
|
|
* @param indicatorList 计算指标
|
|
* @return /
|
|
* @return /
|
|
*/
|
|
*/
|
|
- private Map<String, Map<String, String>> getIndicatorValue(String refId, String benchmarkId, String startDate, String endDate, List<Indicator> indicatorList) {
|
|
|
|
|
|
+ private Map<String, Map<String, String>> getIndicatorValue(String secId, String benchmarkId, String startDate, String endDate, List<Indicator> indicatorList) {
|
|
DateIntervalDto dateIntervalDto = DateIntervalDto.builder()
|
|
DateIntervalDto dateIntervalDto = DateIntervalDto.builder()
|
|
.id(DateIntervalType.CustomInterval.name()).startDate(startDate).endDate(endDate)
|
|
.id(DateIntervalType.CustomInterval.name()).startDate(startDate).endDate(endDate)
|
|
.dateIntervalType(DateIntervalType.CustomInterval).frequency(Frequency.Default).build();
|
|
.dateIntervalType(DateIntervalType.CustomInterval).frequency(Frequency.Default).build();
|
|
- Map<String, List<DateIntervalDto>> dateIntervalMap = MapUtil.builder(refId, ListUtil.of(dateIntervalDto)).build();
|
|
|
|
- Map<String, String> benchmarkIdMap = MapUtil.builder(refId, benchmarkId).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()
|
|
CalcMultipleSecMultipleTimeRangeIndicatorReq req = CalcMultipleSecMultipleTimeRangeIndicatorReq.builder()
|
|
- .mainSecIdList(ListUtil.of(refId))
|
|
|
|
|
|
+ .mainSecIdList(ListUtil.of(secId))
|
|
.secBenchmarkIdMap(benchmarkIdMap)
|
|
.secBenchmarkIdMap(benchmarkIdMap)
|
|
.indexIdList(ListUtil.of(benchmarkId))
|
|
.indexIdList(ListUtil.of(benchmarkId))
|
|
.raiseType(RaiseType.Both)
|
|
.raiseType(RaiseType.Both)
|
|
@@ -446,21 +446,21 @@ public class FundInfoService {
|
|
|
|
|
|
// DateIntervalType.CustomInterval 类型下每个标的只会返回一个维度下的指标计算结果,所以只获取第一条记录的指标计算结果
|
|
// DateIntervalType.CustomInterval 类型下每个标的只会返回一个维度下的指标计算结果,所以只获取第一条记录的指标计算结果
|
|
Map<String, Map<String, String>> result = MapUtil.newHashMap();
|
|
Map<String, Map<String, String>> result = MapUtil.newHashMap();
|
|
- Map<String, String> valueMap = Optional.ofNullable(indicatorValueMap).map(e -> e.get(refId)).orElse(ListUtil.empty()).stream().findFirst()
|
|
|
|
|
|
+ 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(IndicatorCalcPropertyDto::getSecData).map(IndicatorCalcSecDataDto::getIndicatorValueMap).orElse(MapUtil.empty());
|
|
- Map<String, String> valueBenchmarkMap = Optional.ofNullable(indicatorValueMap).map(e -> e.get(refId)).orElse(ListUtil.empty()).stream().findFirst()
|
|
|
|
|
|
+ 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());
|
|
.map(IndicatorCalcPropertyDto::getIndexData).map(IndicatorCalcIndexDataDto::getIndexIndicatorValueMap).map(e -> e.get(benchmarkId)).orElse(MapUtil.empty());
|
|
- result.put(refId, valueMap);
|
|
|
|
|
|
+ result.put(secId, valueMap);
|
|
result.put(benchmarkId, valueBenchmarkMap);
|
|
result.put(benchmarkId, valueBenchmarkMap);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
public List<ManualFundManagerInfoVO> managerList(ManualFundManagerParams params) {
|
|
public List<ManualFundManagerInfoVO> managerList(ManualFundManagerParams params) {
|
|
- String refId = params.getRefId();
|
|
|
|
|
|
+ String secId = params.getSecId();
|
|
String benchmarkId = params.getBenchmarkId();
|
|
String benchmarkId = params.getBenchmarkId();
|
|
List<ManualFundManagerInfoVO> resultList = ListUtil.list(true);
|
|
List<ManualFundManagerInfoVO> resultList = ListUtil.list(true);
|
|
//1.先获取基金下的现任基金经理基本信息
|
|
//1.先获取基金下的现任基金经理基本信息
|
|
- List<PersonnelInformationDo> managerInfoList = this.baseInfoService.getFundPresentManagerInfo(refId);
|
|
|
|
|
|
+ List<PersonnelInformationDo> managerInfoList = this.baseInfoService.getFundPresentManagerInfo(secId);
|
|
if (CollUtil.isEmpty(managerInfoList)) {
|
|
if (CollUtil.isEmpty(managerInfoList)) {
|
|
return resultList;
|
|
return resultList;
|
|
}
|
|
}
|
|
@@ -478,7 +478,7 @@ public class FundInfoService {
|
|
manualFundManagerInfoDo.setAvatar2(e.getAvatar2());
|
|
manualFundManagerInfoDo.setAvatar2(e.getAvatar2());
|
|
List<MfManagerFundNumDo> mfManagerFundNumDos = listMap.get(managerId);
|
|
List<MfManagerFundNumDo> mfManagerFundNumDos = listMap.get(managerId);
|
|
if (CollUtil.isNotEmpty(mfManagerFundNumDos)) {
|
|
if (CollUtil.isNotEmpty(mfManagerFundNumDos)) {
|
|
- mfManagerFundNumDos.stream().filter(k -> refId.equals(k.getFundId())).findFirst()
|
|
|
|
|
|
+ mfManagerFundNumDos.stream().filter(k -> secId.equals(k.getFundId())).findFirst()
|
|
.ifPresent(mfManagerFundNumDo -> manualFundManagerInfoDo.setStartDate(mfManagerFundNumDo.getStartDate()));
|
|
.ifPresent(mfManagerFundNumDo -> manualFundManagerInfoDo.setStartDate(mfManagerFundNumDo.getStartDate()));
|
|
long publicProductNumAll = mfManagerFundNumDos.stream().filter(v -> v.getFundId().startsWith("MF")).count();
|
|
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();
|
|
long publicProductNumRunning = mfManagerFundNumDos.stream().filter(w -> Objects.equals(2, w.getStatus()) && w.getEndDate() == null).count();
|
|
@@ -518,11 +518,11 @@ public class FundInfoService {
|
|
vo.setRunningScale(String.valueOf(total));
|
|
vo.setRunningScale(String.valueOf(total));
|
|
}
|
|
}
|
|
// 指标计算结果处理
|
|
// 指标计算结果处理
|
|
- Map<String, Map<String, String>> indicatorValue = this.getIndicatorValue(refId, benchmarkId, data.getStartDate(), data.getEndDate(), indicatorList);
|
|
|
|
- if (indicatorValue.get(refId) != null) {
|
|
|
|
- vo.setNavChange(indicatorValue.get(refId).get(Indicator.IntervalReturn.name()));
|
|
|
|
- vo.setAnnualRet(indicatorValue.get(refId).get(Indicator.AnnualReturn.name()));
|
|
|
|
- vo.setSharpe(indicatorValue.get(refId).get(Indicator.SharpeRatio.name()));
|
|
|
|
|
|
+ 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) {
|
|
if (indicatorValue.get(benchmarkId) != null) {
|
|
vo.setBenchmarkRet(indicatorValue.get(benchmarkId).get(Indicator.IntervalReturn.name()));
|
|
vo.setBenchmarkRet(indicatorValue.get(benchmarkId).get(Indicator.IntervalReturn.name()));
|