|
@@ -7,16 +7,13 @@ import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.map.MapUtil;
|
|
import cn.hutool.core.map.MapUtil;
|
|
import cn.hutool.core.text.CharSequenceUtil;
|
|
import cn.hutool.core.text.CharSequenceUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
-import com.smppw.analysis.application.dto.info.*;
|
|
|
|
|
|
+import com.smppw.analysis.application.dto.info.FundSimilarReq;
|
|
|
|
+import com.smppw.analysis.application.dto.info.ManualFundNoticeReq;
|
|
import com.smppw.analysis.domain.dataobject.FundArchivesInfoDO;
|
|
import com.smppw.analysis.domain.dataobject.FundArchivesInfoDO;
|
|
import com.smppw.analysis.domain.dataobject.FundFeeDo;
|
|
import com.smppw.analysis.domain.dataobject.FundFeeDo;
|
|
-import com.smppw.analysis.domain.dataobject.ManualFundNoticeInfoDO;
|
|
|
|
import com.smppw.analysis.domain.dataobject.FundSimilarDo;
|
|
import com.smppw.analysis.domain.dataobject.FundSimilarDo;
|
|
|
|
+import com.smppw.analysis.domain.dataobject.ManualFundNoticeInfoDO;
|
|
import com.smppw.analysis.domain.dto.info.*;
|
|
import com.smppw.analysis.domain.dto.info.*;
|
|
-import com.smppw.analysis.domain.dto.performance.IndicatorParams;
|
|
|
|
-import com.smppw.analysis.domain.manager.performance.Performance;
|
|
|
|
-import com.smppw.analysis.domain.manager.performance.PerformanceConstants;
|
|
|
|
-import com.smppw.analysis.domain.manager.performance.PerformanceFactory;
|
|
|
|
import com.smppw.analysis.domain.service.BaseIndicatorServiceV2;
|
|
import com.smppw.analysis.domain.service.BaseIndicatorServiceV2;
|
|
import com.smppw.analysis.domain.service.BaseInfoService;
|
|
import com.smppw.analysis.domain.service.BaseInfoService;
|
|
import com.smppw.analysis.domain.service.NavService;
|
|
import com.smppw.analysis.domain.service.NavService;
|
|
@@ -26,8 +23,10 @@ import com.smppw.common.pojo.NewSubStrategy;
|
|
import com.smppw.common.pojo.dto.DateValue;
|
|
import com.smppw.common.pojo.dto.DateValue;
|
|
import com.smppw.common.pojo.dto.calc.IndicatorCalcPropertyDto;
|
|
import com.smppw.common.pojo.dto.calc.IndicatorCalcPropertyDto;
|
|
import com.smppw.common.pojo.dto.calc.IndicatorCalcTimeRangeDto;
|
|
import com.smppw.common.pojo.dto.calc.IndicatorCalcTimeRangeDto;
|
|
-import com.smppw.common.pojo.enums.*;
|
|
|
|
-import com.smppw.constants.Consts;
|
|
|
|
|
|
+import com.smppw.common.pojo.enums.Frequency;
|
|
|
|
+import com.smppw.common.pojo.enums.NavType;
|
|
|
|
+import com.smppw.common.pojo.enums.TimeRange;
|
|
|
|
+import com.smppw.common.pojo.enums.Visibility;
|
|
import com.smppw.constants.DateConst;
|
|
import com.smppw.constants.DateConst;
|
|
import com.smppw.core.IndicatorService;
|
|
import com.smppw.core.IndicatorService;
|
|
import com.smppw.utils.BigDecimalUtils;
|
|
import com.smppw.utils.BigDecimalUtils;
|
|
@@ -43,21 +42,9 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
public class FundInfoService {
|
|
public class FundInfoService {
|
|
- private final NavService navService;
|
|
|
|
- private final PerformanceFactory factory;
|
|
|
|
- private final BaseInfoService baseInfoService;
|
|
|
|
- private final BaseIndicatorServiceV2 baseIndicatorServiceV2;
|
|
|
|
private static final Map<String, String> ACCRUED_FREQUENCY = MapUtil.newHashMap();
|
|
private static final Map<String, String> ACCRUED_FREQUENCY = MapUtil.newHashMap();
|
|
private static final Map<String, String> ACCRUED_METHOD = MapUtil.newHashMap();
|
|
private static final Map<String, String> ACCRUED_METHOD = MapUtil.newHashMap();
|
|
|
|
|
|
- public FundInfoService(NavService navService, PerformanceFactory factory,
|
|
|
|
- BaseInfoService baseInfoService, BaseIndicatorServiceV2 baseIndicatorServiceV2) {
|
|
|
|
- this.factory = factory;
|
|
|
|
- this.navService = navService;
|
|
|
|
- this.baseInfoService = baseInfoService;
|
|
|
|
- this.baseIndicatorServiceV2 = baseIndicatorServiceV2;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
static {
|
|
static {
|
|
ACCRUED_FREQUENCY.put("1", "月");
|
|
ACCRUED_FREQUENCY.put("1", "月");
|
|
ACCRUED_FREQUENCY.put("2", "季");
|
|
ACCRUED_FREQUENCY.put("2", "季");
|
|
@@ -69,59 +56,16 @@ public class FundInfoService {
|
|
ACCRUED_METHOD.put("3", "单客户高水位");
|
|
ACCRUED_METHOD.put("3", "单客户高水位");
|
|
}
|
|
}
|
|
|
|
|
|
- public PrivatelyFundHeadInfoVO headInfo(HeadInfoReq params) {
|
|
|
|
- return new PrivatelyFundHeadInfoVO();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public CommonInfoVO commonInfo(CommonInfoReq params) {
|
|
|
|
-// CommonInfoVO res = new CommonInfoVO();
|
|
|
|
-// IStrategy strategy = StrategyHandleUtils.getStrategy(params.getStrategy());
|
|
|
|
-// String secId = params.getSecId();
|
|
|
|
-// Byte raiseType = null;
|
|
|
|
-// List<Frequency> result = CollectionUtil.newArrayList();
|
|
|
|
-// String fundType = this.baseInfoService.getFundType(secId);
|
|
|
|
-// List<IStrategy> originStrategy = CollectionUtil.newArrayList();
|
|
|
|
-// // 获取频率
|
|
|
|
-// CmBigDataFundInfoDo fundHeadInfo = fundHeadInfoBaseService.getFundHeadInfo(secId);
|
|
|
|
-// if (fundHeadInfo == null) {
|
|
|
|
-// throw new APIException("");
|
|
|
|
-// }
|
|
|
|
-// raiseType = fundHeadInfo.getRaiseType();
|
|
|
|
-// Frequency navFrequency = fundInformationDao.getNavFrequency(secId);
|
|
|
|
-// result.add(navFrequency);
|
|
|
|
-// // 将频率转换一道 取最小频率
|
|
|
|
-// List<Frequency> frequencies = fundInformationDao.toFrequencyList(result);
|
|
|
|
-// if (raiseType == 2) {
|
|
|
|
-// frequencies.removeIf(p -> p.getId() == Frequency.Default.getId());
|
|
|
|
-// }
|
|
|
|
-// List<ValueLabelVO> frequencyValueLabel = trans2ValueLabel(frequencies);
|
|
|
|
-// res.setFrequency(frequencyValueLabel);
|
|
|
|
-// // 净值类型
|
|
|
|
-// List<ValueLabelVO> navType = Arrays.stream(NavType.values())
|
|
|
|
-// .filter(p -> !NavType.All.equals(p) && !NavType.UnitAndCumulativeNav.equals(p))
|
|
|
|
-// .map(p -> new ValueLabelVO(p.name(), p.getDesc())).collect(Collectors.toList());
|
|
|
|
-// res.setNavType(navType);
|
|
|
|
-// // 策略曲线
|
|
|
|
-// RaiseType realRaiseType = RaiseType.getRaiseType(raiseType);
|
|
|
|
-// handleTimeRange(strategy, res, secId, companyOrManager, realRaiseType);
|
|
|
|
-// // 获取常用指数
|
|
|
|
-//// List<ValueLabelVO> benchmarkList = userCommonIndexService.getByUser(-1);
|
|
|
|
-//// handleBenchmark(strategy, res, secId, fundType, originStrategy, companyOrManager, benchmarkList);
|
|
|
|
- return new CommonInfoVO();
|
|
|
|
- }
|
|
|
|
|
|
+ private final NavService navService;
|
|
|
|
+ private final BaseInfoService baseInfoService;
|
|
|
|
+ private final BaseIndicatorServiceV2 baseIndicatorServiceV2;
|
|
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
|
|
- public HeadIndicatorVO headIndicator(HeadIndicatorReq req) {
|
|
|
|
- IndicatorParams params = req.convert();
|
|
|
|
- Performance<IndicatorParams, Map<String, Object>> instance = this.factory.getInstance(PerformanceConstants.INDICATOR);
|
|
|
|
- Map<String, Object> dataset = instance.execute(params);
|
|
|
|
- Map<String, Object> indicatorMap = MapUtil.get(dataset, req.getSecId(), Map.class);
|
|
|
|
- HeadIndicatorVO vo = new HeadIndicatorVO();
|
|
|
|
- vo.setAnnualReturn(MapUtil.getStr(indicatorMap, Indicator.AnnualReturn.name()));
|
|
|
|
- vo.setAnnualStdDev(MapUtil.getStr(indicatorMap, Indicator.AnnualStdDev.name()));
|
|
|
|
- vo.setMaxDrawdown(MapUtil.getStr(indicatorMap, Indicator.MaxDrawdown.name()));
|
|
|
|
- vo.setSharpeRatio(MapUtil.getStr(indicatorMap, Indicator.SharpeRatio.name()));
|
|
|
|
- return vo;
|
|
|
|
|
|
+ public FundInfoService(NavService navService,
|
|
|
|
+ BaseInfoService baseInfoService,
|
|
|
|
+ BaseIndicatorServiceV2 baseIndicatorServiceV2) {
|
|
|
|
+ this.navService = navService;
|
|
|
|
+ this.baseInfoService = baseInfoService;
|
|
|
|
+ this.baseIndicatorServiceV2 = baseIndicatorServiceV2;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -134,7 +78,7 @@ public class FundInfoService {
|
|
List<String> refIds = ListUtil.toLinkedList(req.getRefId());
|
|
List<String> refIds = ListUtil.toLinkedList(req.getRefId());
|
|
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(refIds,
|
|
- null, null, Visibility.Both, NavType.CumulativeNav, MapUtil.empty());
|
|
|
|
|
|
+ null, null, Visibility.Both, NavType.CumulativeNav);
|
|
List<IndicatorCalcTimeRangeDto> secTimeRanges = IndicatorService.getInstance().getSecTimeRange(req.getRefId(), Frequency.Monthly, secNavMap);
|
|
List<IndicatorCalcTimeRangeDto> secTimeRanges = IndicatorService.getInstance().getSecTimeRange(req.getRefId(), Frequency.Monthly, secNavMap);
|
|
String startDate = null;
|
|
String startDate = null;
|
|
String endDate = null;
|
|
String endDate = null;
|
|
@@ -155,7 +99,7 @@ public class FundInfoService {
|
|
refIds.addAll(fundIds);
|
|
refIds.addAll(fundIds);
|
|
}
|
|
}
|
|
Map<String, List<DateValue>> allNavMap = this.navService.getSecIdDateValueNavListMapByDb(refIds,
|
|
Map<String, List<DateValue>> allNavMap = this.navService.getSecIdDateValueNavListMapByDb(refIds,
|
|
- startDate, endDate, Visibility.Both, NavType.CumulativeNav, MapUtil.empty());
|
|
|
|
|
|
+ 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(),
|
|
refIds, 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);
|