Browse Source

新迁移算法

wangzaijun 1 year ago
parent
commit
b6bccf801a

+ 53 - 0
src/main/java/com/smppw/core/IndicatorService.java

@@ -243,6 +243,59 @@ public class IndicatorService {
         return indicatorCalcTimeRangeDtoList;
     }
 
+    public Map<String, List<IndicatorCalcPropertyDto>> getMultiSecRetListNew(List<String> mainSecIdList, List<String> indexIdList, Frequency frequency,
+                                                                             Frequency rollingFrequency, String startDate, String endDate,
+                                                                             boolean ifExcessReturn, String benchmarkId, RaiseType raiseType, IStrategy strategy,
+                                                                             Visibility visibility, NavType navType, Map<String, List<DateValue>> allNavMap, Map<String, Frequency> secFreqMap) {
+        List<DateIntervalDto> dateIntervalDtoList = new ArrayList<>();
+        DateIntervalDto defaultIntervalDto = new DateIntervalDto();
+        defaultIntervalDto.setStartDate(startDate);
+        defaultIntervalDto.setEndDate(endDate);
+        defaultIntervalDto.setDateIntervalType(DateIntervalType.DefaultRolling);
+        defaultIntervalDto.setFrequency(rollingFrequency);
+        dateIntervalDtoList.add(defaultIntervalDto);
+
+        List<Indicator> indicatorList = new ArrayList<>();
+        List<Indicator> geoExtraIndicatorList = new ArrayList<>();
+
+        indicatorList.add(Indicator.IntervalReturn);
+        if (ifExcessReturn) {
+            geoExtraIndicatorList.add(Indicator.IntervalReturn);
+        }
+
+        Map<String, String> secBenchmarkIdMap = new HashMap<>();
+        for (String mainSecId : mainSecIdList) {
+            secBenchmarkIdMap.put(mainSecId, benchmarkId);
+        }
+
+        Map<String, List<DateIntervalDto>> secDateIntervalDtoListMap = new HashMap<>();
+        for (String mainSecId : mainSecIdList) {
+            secDateIntervalDtoListMap.put(mainSecId, dateIntervalDtoList);
+        }
+
+        CalcMultipleSecMultipleTimeRangeIndicatorReq calcMultipleSecMultipleTimeRangeIndicatorReq = new CalcMultipleSecMultipleTimeRangeIndicatorReq();
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setMainSecIdList(mainSecIdList);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setSecBenchmarkIdMap(secBenchmarkIdMap);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setIndexIdList(indexIdList);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setRaiseType(raiseType);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setStrategy(strategy);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setVisibility(visibility);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setSecDateIntervalDtoListMap(secDateIntervalDtoListMap);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setDataFrequency(frequency);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setNavType(navType);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setIndicatorList(indicatorList);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setGeoExtraindicatorList(geoExtraIndicatorList);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setRiskOfFreeId(null);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setRiskOfFreeValue(null);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setIfAnnualize(true);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setCalcIndexRetIndicatorValue(true);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setNeedRet(false);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setNeedExtraRet(false);
+        calcMultipleSecMultipleTimeRangeIndicatorReq.setIfConvertPerformanceConsistencyWord(true);
+
+        return calcMultipleSecMultipleTimeRangeIndicator(calcMultipleSecMultipleTimeRangeIndicatorReq, allNavMap, secFreqMap);
+    }
+
 //
 //    public Map<Integer, Map<String, String>> calcMultipleSecMultipleTimeRangeIndicator(List<String> mainSecIdList, List<Integer> idList, Map<String, String> idBenchmarkMap, List<String> indexIdList,
 //                                                                                       Map<String, DateIntervalDto> idDateIntervalDtoMap, Map<String, Frequency> idNavFrequencyMap,

+ 0 - 12
src/main/java/com/smppw/fofapi/service/calc/CalcService.java

@@ -1,12 +0,0 @@
-package com.smppw.fofapi.service.calc;
-
-
-import com.smppw.common.pojo.dto.calc.IndicatorCalcPropertyDto;
-import com.smppw.common.pojo.dto.calc.IndicatorCalcReqPropertyDto;
-
-public interface CalcService {
-
-    IndicatorCalcPropertyDto indicatorCalc(IndicatorCalcReqPropertyDto indicatorCalcReq);
-
-    IndicatorCalcPropertyDto getTrend(IndicatorCalcReqPropertyDto indicatorCalcReq);
-}

+ 0 - 874
src/main/java/com/smppw/fofapi/service/indicator/BaseIndicatorServiceImplV2.java

@@ -1,874 +0,0 @@
-//package com.smppw.fofapi.service.indicator;
-//
-//import cn.hutool.core.collection.CollectionUtil;
-//import cn.hutool.core.collection.ListUtil;
-//import cn.hutool.core.map.MapUtil;
-//import com.smppw.fofapi.dao.info.FundInformationDao;
-//import com.smppw.common.pojo.IStrategy;
-//import com.smppw.common.pojo.dos.core.IndexesTradeDateDo;
-//import com.smppw.common.pojo.dto.Benchmark;
-//import com.smppw.common.pojo.dto.CompoundRet;
-//import com.smppw.common.pojo.dto.DateValue;
-//import com.smppw.common.pojo.dto.TimeInterval;
-//import com.smppw.common.pojo.dto.calc.IndicatorCalcPropertyDto;
-//import com.smppw.common.pojo.dto.calc.IndicatorCalcReqPropertyDto;
-//import com.smppw.common.pojo.dto.calc.IndicatorCalcTimeRangeDto;
-//import com.smppw.common.pojo.dto.indicator.CalcMultipleSecMultipleTimeRangeIndicatorReq;
-//import com.smppw.common.pojo.dto.indicator.DateIntervalDto;
-//import com.smppw.common.pojo.dto.nav.ExtractNavServiceReq;
-//import com.smppw.common.pojo.enums.*;
-//import com.smppw.fofapi.service.calc.CalcService;
-//import com.smppw.fofapi.service.nav.NavService;
-//import com.smppw.fofapi.util.*;
-//import org.apache.commons.lang3.StringUtils;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.stereotype.Service;
-//
-//import java.math.BigDecimal;
-//import java.util.ArrayList;
-//import java.util.HashMap;
-//import java.util.List;
-//import java.util.Map;
-//import java.util.stream.Collectors;
-//
-//@Service
-//public class BaseIndicatorServiceImplV2 implements BaseIndicatorServiceV2 {
-//
-//    @Autowired
-//    private CalcService calcService;
-//
-//    @Autowired
-//    private NavService navService;
-//
-//    @Autowired
-//    private FundInformationDao fundInformationDao;
-//
-//    @Override
-//    public Map<String, List<IndicatorCalcPropertyDto>> getMultipleSecTrend(List<String> mainSecIdList, Map<String, String> secBenchmarkIdMap, List<String> indexIdList,
-//                                                                           DateIntervalDto dateIntervalDto, Frequency dataFrequency, BigDecimal fixedIncome, BigDecimal initValue, RaiseType raiseType,
-//                                                                           IStrategy strategy, Visibility visibility, NavType navType, List<TrendType> trendTypeV2List, Boolean ifExtract, Integer userId) {
-//        List<String> benchmarkIdList = new ArrayList<>();
-//        for (Map.Entry<String, String> secBenchmarkIdMapEntry : secBenchmarkIdMap.entrySet()) {
-//            String benchmarkId = secBenchmarkIdMapEntry.getValue();
-//            if (StringUtils.isNotEmpty(benchmarkId)) {
-//                benchmarkIdList.add(benchmarkId);
-//            }
-//        }
-//        ExtractNavServiceReq extractNavServiceReq = new ExtractNavServiceReq();
-//        extractNavServiceReq.setUserId(UserUtils.getLoginUser().getUserid());
-//        extractNavServiceReq.setIfExtract(ifExtract);
-//
-//        CurveType curveType = CurveType.getCurveType(raiseType, strategy);
-//        Map<String, List<DateValue>> allNavMap = navService.getSecIdDateValueNavListMapFromRedisAndDB(mainSecIdList, benchmarkIdList, indexIdList,
-//                null, null, navType, visibility, curveType.getId(), strategy.getStrategyId(), new HashMap<>(), false, extractNavServiceReq);
-//
-//        Map<String, List<IndicatorCalcPropertyDto>> indicatorCalcPropertyDtoListMap = new HashMap<>();
-//        for (String mainSecId : mainSecIdList) {
-//            String benchmarkId = secBenchmarkIdMap.get(mainSecId);
-//
-//            Map<String, List<DateValue>> secAllNavMap = new HashMap();
-//            secAllNavMap.put(mainSecId, NavUtil.getNewNavList(allNavMap.get(mainSecId)));
-//            secAllNavMap.put(benchmarkId, NavUtil.getNewNavList(allNavMap.get(benchmarkId)));
-//            for (String indexId : indexIdList) {
-//                secAllNavMap.put(indexId, NavUtil.getNewNavList(allNavMap.get(indexId)));
-//            }
-//
-//            List<DateValue> mainSecIdNavList = secAllNavMap.get(mainSecId);
-//
-//            String theFirstNavDate = "";
-//            String theLastNavDate = "";
-//            if (mainSecIdNavList != null && mainSecIdNavList.size() > 0) {
-//                theFirstNavDate = mainSecIdNavList.get(0).getDate();
-//                theLastNavDate = mainSecIdNavList.get(mainSecIdNavList.size() - 1).getDate();
-//            }
-//
-//            List<IndexesTradeDateDo> indexesTradeDateDoList = TradeDateUtil.listInfoByDateInterval(theFirstNavDate, theLastNavDate);
-//
-//            Frequency navFrequency = dataFrequency == null || dataFrequency == Frequency.Default ? Frequency.Daily : dataFrequency;
-//
-//            Frequency calcFrequency = null;
-//            Frequency defaultFrequency = fundInformationDao.getNavFrequency(mainSecId);
-//            if (dataFrequency == Frequency.Default) {
-//                calcFrequency = defaultFrequency;
-//            } else {
-//                calcFrequency = dataFrequency;
-//            }
-//
-//            List<DateValue> validMainSecNavList = NavUtil.filterFrequencyNav(mainSecIdNavList, indexesTradeDateDoList, navFrequency);
-//            secAllNavMap.put(mainSecId, validMainSecNavList);
-//
-//            List<IndicatorCalcTimeRangeDto> indicatorCalcTimeRangeDtoList = DateIntervalUtil.getIndicatorCalcTimeRangeDto(dateIntervalDto, validMainSecNavList, indexesTradeDateDoList
-//                    , dateIntervalDto.getId());
-//
-//            List<IndicatorCalcPropertyDto> indicatorCalcPropertyDtoList = new ArrayList<>();
-//
-//            for (IndicatorCalcTimeRangeDto indicatorCalcTimeRangeDto : indicatorCalcTimeRangeDtoList) {
-//
-//                Map<String, List<DateValue>> dateSecAllNavMap = new HashMap();
-//                dateSecAllNavMap.put(mainSecId, NavUtil.getNewNavList(secAllNavMap.get(mainSecId)));
-//                dateSecAllNavMap.put(benchmarkId, NavUtil.getNewNavList(secAllNavMap.get(benchmarkId)));
-//                for (String indexId : indexIdList) {
-//                    dateSecAllNavMap.put(indexId, NavUtil.getNewNavList(secAllNavMap.get(indexId)));
-//                }
-//
-//                IndicatorCalcReqPropertyDto indicatorCalcReq = prepareTrendReq(mainSecId, benchmarkId, indexIdList, indicatorCalcTimeRangeDto,
-//                        dateSecAllNavMap, calcFrequency, defaultFrequency, trendTypeV2List, fixedIncome, initValue);
-//                if (validMainSecNavList != null && validMainSecNavList.size() > 0) {
-//                    IndicatorCalcPropertyDto trend = calcService.getTrend(indicatorCalcReq);
-//                    indicatorCalcPropertyDtoList.add(trend);
-//                } else {
-//                    IndicatorCalcPropertyDto indicatorCalcPropertyDto = new IndicatorCalcPropertyDto();
-//                    indicatorCalcPropertyDto.setIndicatorCalcReq(indicatorCalcReq);
-//                    indicatorCalcPropertyDtoList.add(indicatorCalcPropertyDto);
-//                }
-//            }
-//            indicatorCalcPropertyDtoListMap.put(mainSecId, indicatorCalcPropertyDtoList);
-//        }
-//        return indicatorCalcPropertyDtoListMap;
-//    }
-//
-//    @Override
-//    public Map<String, List<IndicatorCalcPropertyDto>> calcMultipleSecMultipleTimeRangeIndicator(CalcMultipleSecMultipleTimeRangeIndicatorReq req) {
-//
-//        List<String> mainSecIdList = req.getMainSecIdList();
-//        Map<String, String> secBenchmarkIdMap = req.getSecBenchmarkIdMap();
-//        List<String> indexIdList = req.getIndexIdList();
-//        RaiseType raiseType = req.getRaiseType();
-//        IStrategy strategy = req.getStrategy();
-//        Visibility visibility = req.getVisibility();
-//        Map<String, List<DateIntervalDto>> secDateIntervalDtoListMap = req.getSecDateIntervalDtoListMap();
-//        Frequency dataFrequency = req.getDataFrequency();
-//        NavType navType = req.getNavType();
-//        List<Indicator> indicatorList = req.getIndicatorList();
-//        List<Indicator> geoExtraindicatorList = req.getGeoExtraindicatorList();
-//        String riskOfFreeId = req.getRiskOfFreeId();
-//        Double riskOfFreeValue = req.getRiskOfFreeValue();
-//        boolean ifAnnualize = req.isIfAnnualize();
-//        boolean calcIndexRetIndicatorValue = req.isCalcIndexRetIndicatorValue();
-//        boolean needRet = req.isNeedRet();
-//        boolean needExtraRet = req.isNeedExtraRet();
-//        boolean ifConvertPerformanceConsistencyWord = req.isIfConvertPerformanceConsistencyWord();
-//
-//        boolean isExtract = req.isIfExtract();
-//        boolean isCombExtract = req.isCombExtract();
-//        Integer combExtractCombId = req.getCombExtractCombId();
-//        ExtractNavServiceReq extractNavServiceReq = new ExtractNavServiceReq();
-//        extractNavServiceReq.setIfExtract(isExtract);
-//        extractNavServiceReq.setUserId(UserUtils.getLoginUser().getUserid());
-//        extractNavServiceReq.setCombExtract(isCombExtract);
-//        extractNavServiceReq.setCombId(combExtractCombId);
-//
-//        List<String> benchmarkIdList = new ArrayList<>();
-//        for (Map.Entry<String, String> secBenchmarkIdMapEntry : secBenchmarkIdMap.entrySet()) {
-//            String benchmarkId = secBenchmarkIdMapEntry.getValue();
-//            if (StringUtils.isNotEmpty(benchmarkId)) {
-//                benchmarkIdList.add(benchmarkId);
-//            }
-//        }
-//        CurveType curveType = CurveType.getCurveType(raiseType, strategy);
-//        if (StringUtils.isNotEmpty(riskOfFreeId)) {
-//            benchmarkIdList.add(riskOfFreeId);
-//        }
-//        Map<String, List<DateValue>> allNavMap = navService.getSecIdDateValueNavListMapFromRedisAndDB(mainSecIdList, benchmarkIdList, indexIdList,
-//                null, null, navType, visibility, curveType.getId(), strategy.getStrategyId(), new HashMap<>(), false, extractNavServiceReq);
-//
-//        Frequency navFrequency = dataFrequency == null || dataFrequency == Frequency.Default ? Frequency.Daily : dataFrequency;
-//
-//        Map<String, List<IndicatorCalcPropertyDto>> indicatorCalcPropertyDtoListMap = new HashMap<>();
-//        for (String mainSecId : mainSecIdList) {
-//
-//            String benchmarkId = secBenchmarkIdMap.get(mainSecId);
-//            Map<String, List<DateValue>> secAllNavMap = new HashMap();
-//            secAllNavMap.put(mainSecId, NavUtil.getNewNavList(allNavMap.get(mainSecId)));
-//            secAllNavMap.put(benchmarkId, NavUtil.getNewNavList(allNavMap.get(benchmarkId)));
-//            for (String indexId : indexIdList) {
-//                secAllNavMap.put(indexId, NavUtil.getNewNavList(allNavMap.get(indexId)));
-//            }
-//            if (StringUtils.isNotEmpty(riskOfFreeId)) {
-//                secAllNavMap.put(riskOfFreeId, NavUtil.getNewNavList(allNavMap.get(riskOfFreeId)));
-//            }
-//
-//            List<IndicatorCalcPropertyDto> indicatorCalcPropertyDtoList = new ArrayList<>();
-//
-//            List<DateValue> mainSecIdNavList = secAllNavMap.get(mainSecId);
-//
-//            String theFirstNavDate = "";
-//            String theLastNavDate = "";
-//            if (mainSecIdNavList != null && mainSecIdNavList.size() > 0) {
-//                theFirstNavDate = mainSecIdNavList.get(0).getDate();
-//                theLastNavDate = mainSecIdNavList.get(mainSecIdNavList.size() - 1).getDate();
-//            }
-//            List<IndexesTradeDateDo> indexesTradeDateDoList = TradeDateUtil.listInfoByDateInterval(theFirstNavDate, theLastNavDate);
-//
-//            List<DateValue> validMainSecNavList = NavUtil.filterFrequencyNav(mainSecIdNavList, indexesTradeDateDoList, navFrequency);
-//            secAllNavMap.put(mainSecId, validMainSecNavList);
-//
-//            Frequency calcFrequency = null;
-//            Frequency defaultFrequency = fundInformationDao.getNavFrequency(mainSecId);
-//            if (dataFrequency == Frequency.Default) {
-//                calcFrequency = defaultFrequency;
-//            } else {
-//                calcFrequency = dataFrequency;
-//            }
-//
-//            List<DateIntervalDto> dateIntervalDtoList = new ArrayList<>();
-//            if (secDateIntervalDtoListMap != null && secDateIntervalDtoListMap.get(mainSecId) != null) {
-//                dateIntervalDtoList = secDateIntervalDtoListMap.get(mainSecId);
-//            }
-//
-//            for (DateIntervalDto dateIntervalDto : dateIntervalDtoList) {
-//
-//                rollFindStartDate(mainSecId, dateIntervalDto, indexesTradeDateDoList, allNavMap, defaultFrequency);
-//
-//                List<IndicatorCalcTimeRangeDto> indicatorCalcTimeRangeDtoList = DateIntervalUtil.getIndicatorCalcTimeRangeDto(dateIntervalDto, validMainSecNavList, indexesTradeDateDoList
-//                        , dateIntervalDto.getId());
-//
-//                for (IndicatorCalcTimeRangeDto indicatorCalcTimeRangeDto : indicatorCalcTimeRangeDtoList) {
-//
-//                    Map<String, List<DateValue>> dateSecAllNavMap = new HashMap();
-//                    dateSecAllNavMap.put(mainSecId, NavUtil.getNewNavList(secAllNavMap.get(mainSecId)));
-//                    dateSecAllNavMap.put(benchmarkId, NavUtil.getNewNavList(secAllNavMap.get(benchmarkId)));
-//                    for (String indexId : indexIdList) {
-//                        dateSecAllNavMap.put(indexId, NavUtil.getNewNavList(secAllNavMap.get(indexId)));
-//                    }
-//                    if (StringUtils.isNotEmpty(riskOfFreeId)) {
-//                        dateSecAllNavMap.put(riskOfFreeId, NavUtil.getNewNavList(secAllNavMap.get(riskOfFreeId)));
-//                    }
-//
-//                    IndicatorCalcReqPropertyDto indicatorCalcReq = prepareIndicatorCalcReq(mainSecId, benchmarkId, indexIdList, indicatorCalcTimeRangeDto,
-//                            dateSecAllNavMap, riskOfFreeId, riskOfFreeValue, null, calcFrequency, defaultFrequency, indicatorList, geoExtraindicatorList, ifAnnualize, calcIndexRetIndicatorValue,
-//                            needRet, needExtraRet, ifConvertPerformanceConsistencyWord);
-//
-//                    IndicatorCalcPropertyDto indicatorCalcPropertyDto = calcService.indicatorCalc(indicatorCalcReq);
-//                    indicatorCalcPropertyDtoList.add(indicatorCalcPropertyDto);
-//
-//                }
-//            }
-//
-//            indicatorCalcPropertyDtoListMap.put(mainSecId, indicatorCalcPropertyDtoList);
-//        }
-//
-//
-//        return indicatorCalcPropertyDtoListMap;
-//    }
-//
-//    @Override
-//    public Map<String, Map<Frequency, List<IndicatorCalcPropertyDto>>> calcMultipleSecMultipleTimeRangeIndicator(List<String> mainSecIdList, Map<String, String> secBenchmarkIdMap, List<String> indexIdList,
-//                                                                                                                 Integer curveTypeId, Integer strategyId, Visibility visibility, List<DateIntervalDto> dateIntervalDtoList,
-//                                                                                                                 List<Frequency> dataFrequencyList, NavType navType, Map<Frequency, List<Indicator>> dataFrequencyIndicatorListMap,
-//                                                                                                                 Map<Frequency, List<Indicator>> dataFrequencyGeoExtraIndicatorListMap, String riskOfFreeId, Double riskOfFreeValue,
-//                                                                                                                 boolean ifAnnualize, boolean calcIndexRetIndicatorValue, boolean needRet, boolean needExtraRet, String serverName, int leastRetNum) {
-//
-//        List<String> benchmarkIdList = new ArrayList<>();
-//        for (Map.Entry<String, String> secBenchmarkIdMapEntry : secBenchmarkIdMap.entrySet()) {
-//            String benchmarkId = secBenchmarkIdMapEntry.getValue();
-//            if (StringUtils.isNotEmpty(benchmarkId)) {
-//                benchmarkIdList.add(benchmarkId);
-//            }
-//        }
-//
-//        Map<String, Frequency> secFrequencyMap = new HashMap<>();
-//        for (String mainSecId : mainSecIdList) {
-//            if (dataFrequencyList.contains(Frequency.Weekly)) {
-//                secFrequencyMap.put(mainSecId, Frequency.Weekly);
-//            } else {
-//                secFrequencyMap.put(mainSecId, Frequency.Monthly);
-//            }
-//        }
-//
-//        if (StringUtils.isNotEmpty(riskOfFreeId)) {
-//            benchmarkIdList.add(riskOfFreeId);
-//        }
-//
-//        Map<String, List<DateValue>> allNavMap = navService.getSecIdDateValueNavListMapFromRedisAndDB(mainSecIdList, benchmarkIdList, indexIdList,
-//                null, null, navType, visibility, curveTypeId, strategyId, secFrequencyMap, false, null);
-//
-//        Map<String, Map<Frequency, List<IndicatorCalcPropertyDto>>> indicatorCalcPropertyDtoListMapMap = new HashMap<>();
-//        for (String mainSecId : mainSecIdList) {
-//
-//            String benchmarkId = secBenchmarkIdMap.get(mainSecId);
-//
-//            Map<Frequency, List<IndicatorCalcPropertyDto>> indicatorCalcPropertyDtoListMap = new HashMap<>();
-//            for (Frequency dataFrequency : dataFrequencyList) {
-//                Map<String, List<DateValue>> secAllNavMap = new HashMap();
-//                secAllNavMap.put(mainSecId, NavUtil.getNewNavList(allNavMap.get(mainSecId)));
-//                secAllNavMap.put(benchmarkId, NavUtil.getNewNavList(allNavMap.get(benchmarkId)));
-//                for (String indexId : indexIdList) {
-//                    secAllNavMap.put(indexId, NavUtil.getNewNavList(allNavMap.get(indexId)));
-//                }
-//                if (StringUtils.isNotEmpty(riskOfFreeId)) {
-//                    secAllNavMap.put(riskOfFreeId, NavUtil.getNewNavList(allNavMap.get(riskOfFreeId)));
-//                }
-//
-//                Frequency navFrequency = dataFrequency == null || dataFrequency == Frequency.Default ? Frequency.Daily : dataFrequency;
-//                List<DateValue> mainSecIdNavList = secAllNavMap.get(mainSecId);
-//
-//                String theFirstNavDate = "";
-//                String theLastNavDate = "";
-//                if (mainSecIdNavList != null && mainSecIdNavList.size() > 0) {
-//                    theFirstNavDate = mainSecIdNavList.get(0).getDate();
-//                    theLastNavDate = mainSecIdNavList.get(mainSecIdNavList.size() - 1).getDate();
-//                }
-//
-//                List<IndexesTradeDateDo> indexesTradeDateDoList = TradeDateUtil.listInfoByDateInterval(theFirstNavDate, theLastNavDate);
-//
-//                List<DateValue> validMainSecNavList = NavUtil.filterFrequencyNav(mainSecIdNavList, indexesTradeDateDoList, navFrequency);
-//                secAllNavMap.put(mainSecId, validMainSecNavList);
-//
-//                Frequency calcFrequency = null;
-//                Frequency defaultFrequency = fundInformationDao.getNavFrequency(mainSecId);
-//                if (dataFrequency == Frequency.Default) {
-//                    calcFrequency = defaultFrequency;
-//                } else {
-//                    calcFrequency = dataFrequency;
-//                }
-//
-//                List<Indicator> indicatorList = dataFrequencyIndicatorListMap.get(dataFrequency);
-//                List<Indicator> geoExtraIndicatorList = dataFrequencyGeoExtraIndicatorListMap.get(dataFrequency);
-//
-//                List<IndicatorCalcPropertyDto> indicatorCalcPropertyDtoList = new ArrayList<>();
-//                for (DateIntervalDto dateIntervalDto : dateIntervalDtoList) {
-//
-//                    rollFindStartDate(mainSecId, dateIntervalDto, indexesTradeDateDoList, allNavMap, defaultFrequency);
-//
-//                    List<IndicatorCalcTimeRangeDto> indicatorCalcTimeRangeDtoList = DateIntervalUtil.getIndicatorCalcTimeRangeDto(dateIntervalDto, validMainSecNavList, indexesTradeDateDoList
-//                            , dateIntervalDto.getId());
-//
-//                    for (IndicatorCalcTimeRangeDto indicatorCalcTimeRangeDto : indicatorCalcTimeRangeDtoList) {
-//
-//                        Map<String, List<DateValue>> dateSecAllNavMap = new HashMap();
-//                        dateSecAllNavMap.put(mainSecId, NavUtil.getNewNavList(secAllNavMap.get(mainSecId)));
-//                        dateSecAllNavMap.put(benchmarkId, NavUtil.getNewNavList(secAllNavMap.get(benchmarkId)));
-//                        for (String indexId : indexIdList) {
-//                            dateSecAllNavMap.put(indexId, NavUtil.getNewNavList(secAllNavMap.get(indexId)));
-//                        }
-//                        if (StringUtils.isNotEmpty(riskOfFreeId)) {
-//                            dateSecAllNavMap.put(riskOfFreeId, NavUtil.getNewNavList(secAllNavMap.get(riskOfFreeId)));
-//                        }
-//
-//                        if (validMainSecNavList != null && validMainSecNavList.size() > 0 &&
-//                                (indicatorCalcTimeRangeDto.getStartDate().compareTo(validMainSecNavList.get(0).getDate()) >= 0 || indicatorCalcTimeRangeDto.getTimeRange() == TimeRange.FromThisYear)) {
-//                            IndicatorCalcReqPropertyDto indicatorCalcReq = prepareIndicatorCalcReq(mainSecId, benchmarkId, indexIdList, indicatorCalcTimeRangeDto,
-//                                    dateSecAllNavMap, riskOfFreeId, riskOfFreeValue, null, calcFrequency, defaultFrequency, indicatorList, geoExtraIndicatorList, ifAnnualize, calcIndexRetIndicatorValue,
-//                                    needRet, needExtraRet, false);
-//                            indicatorCalcReq.setLeastRetNum(leastRetNum);
-//
-//                            IndicatorCalcPropertyDto indicatorCalcPropertyDto = calcService.indicatorCalc(indicatorCalcReq);
-//
-//                            indicatorCalcPropertyDto.getIndicatorCalcReq().setAllNavMap(null);
-//                            indicatorCalcPropertyDto.setRiskFreeData(null);
-//                            indicatorCalcPropertyDto.getSecData().setOriNavList(null);
-//                            indicatorCalcPropertyDto.getSecData().setExtraNavList(null);
-//                            indicatorCalcPropertyDto.getSecData().setRetList(null);
-//                            indicatorCalcPropertyDto.getSecData().setExtraRetGeoList(null);
-//                            indicatorCalcPropertyDto.getBenchmarkData().setBenchmarkNavList(null);
-//                            indicatorCalcPropertyDto.getBenchmarkData().setOriBenchmarkNavList(null);
-//                            indicatorCalcPropertyDto.getBenchmarkData().setBenchmarkRetList(null);
-//
-//                            indicatorCalcPropertyDtoList.add(indicatorCalcPropertyDto);
-//                        }
-//                    }
-//                }
-//
-//                indicatorCalcPropertyDtoListMap.put(dataFrequency, indicatorCalcPropertyDtoList);
-//            }
-//            indicatorCalcPropertyDtoListMapMap.put(mainSecId, indicatorCalcPropertyDtoListMap);
-//        }
-//
-//        return indicatorCalcPropertyDtoListMapMap;
-//    }
-//
-//    @Override
-//    public Map<Integer, Map<String, String>> calcMultipleSecMultipleTimeRangeIndicator(List<String> mainSecIdList, List<Integer> idList, Map<String, String> idBenchmarkMap, List<String> indexIdList,
-//                                                                                       Map<String, DateIntervalDto> idDateIntervalDtoMap, Map<String, Frequency> idNavFrequencyMap,
-//                                                                                       Map<String, Frequency> idCalcFrequencyMap, Map<String, NavType> idNavTypeMap,
-//                                                                                       Map<String, List<Indicator>> idIndicatorListMap, Map<String, List<Indicator>> idGeoExtraindicatorListMap,
-//                                                                                       Map<String, String> idRiskOfFreeIdMap, Map<String, Double> idRiskOfFreeValueMap, Map<String, Benchmark> benchmarkMap) {
-//
-//        List<String> benchmarkIdList = new ArrayList<>();
-//        for (Map.Entry<String, String> secBenchmarkIdMapEntry : idBenchmarkMap.entrySet()) {
-//            String benchmarkId = secBenchmarkIdMapEntry.getValue();
-//            if (BenchmarkConfig.rz_strategy.name().equals(benchmarkId)) {
-//                for (Map.Entry<String, Benchmark> benchmarkMapEntry : benchmarkMap.entrySet()) {
-//                    String bk = benchmarkMapEntry.getValue().getBenchmarkId();
-//                    if (StringUtils.isNotEmpty(bk) && !benchmarkIdList.contains(bk)) {
-//                        benchmarkIdList.add(bk);
-//                    }
-//                }
-//            } else if (BenchmarkConfig.rz_bfi.name().equals(benchmarkId)) {
-//                for (Map.Entry<String, Benchmark> benchmarkMapEntry : benchmarkMap.entrySet()) {
-//                    String bk = benchmarkMapEntry.getValue().getRZIndexId();
-//                    if (StringUtils.isNotEmpty(bk) && !benchmarkIdList.contains(bk)) {
-//                        benchmarkIdList.add(bk);
-//                    }
-//                }
-//            } else {
-//                if (StringUtils.isNotEmpty(benchmarkId) && !benchmarkIdList.contains(benchmarkId)) {
-//                    benchmarkIdList.add(benchmarkId);
-//                }
-//            }
-//        }
-//
-//        List<NavType> navTypeList = new ArrayList<>();
-//        Map<NavType, List<String>> navTypeIdListMap = new HashMap<>();
-//        for (Map.Entry<String, NavType> idNavTypeMapEntry : idNavTypeMap.entrySet()) {
-//            NavType value = idNavTypeMapEntry.getValue();
-//            if (!navTypeIdListMap.containsKey(value)) {
-//                List<String> list = new ArrayList<>();
-//                list.add(idNavTypeMapEntry.getKey());
-//                navTypeIdListMap.put(value, list);
-//            } else {
-//                navTypeIdListMap.get(value).add(idNavTypeMapEntry.getKey());
-//            }
-//        }
-//
-//        List<String> riskOfFreeIdList = new ArrayList<>();
-//        for (Map.Entry<String, String> idRiskOfFreeIdMapEntry : idRiskOfFreeIdMap.entrySet()) {
-//            String value = idRiskOfFreeIdMapEntry.getValue();
-//            if (StringUtils.isNotEmpty(value) && !riskOfFreeIdList.contains(value)) {
-//                riskOfFreeIdList.add(value);
-//            }
-//        }
-//        benchmarkIdList.addAll(riskOfFreeIdList);
-//
-//        Map<NavType, Map<String, List<DateValue>>> navTypeAllNavMapMap = new HashMap<>();
-//        for (Map.Entry<NavType, List<String>> navTypeIdListMapEntry : navTypeIdListMap.entrySet()) {
-//            Map<String, List<DateValue>> allNavList = navService.getSecIdDateValueNavListMapFromRedisAndDB(navTypeIdListMapEntry.getValue(), benchmarkIdList, indexIdList,
-//                    null, null, NavType.CumulativeNav, Visibility.Both, 1, 0, new HashMap<>(), false, null);
-//            navTypeAllNavMapMap.put(navTypeIdListMapEntry.getKey(), allNavList);
-//        }
-//
-//        Map<String, Frequency> secDefaultFrequency = fundInformationDao.getNavFrequency(mainSecIdList);
-//
-//        Map<String, Map<Frequency, List<DateValue>>> secFreValidMainSecNavListMapMap = new HashMap<>();
-//
-//        Map<Integer, Map<String, String>> result = new HashMap<>();
-//        for (Integer id : idList) {
-//            String idStr = id + "";
-//            String benchmarkId = idBenchmarkMap.get(idStr);
-//            NavType navType = idNavTypeMap.get(idStr);
-//            Map<String, List<DateValue>> allNavMap = navTypeAllNavMapMap.get(navType);
-//            String riskOfFreeId = idRiskOfFreeIdMap.get(idStr);
-//
-//            Double riskOfFreeValue = idRiskOfFreeValueMap.get(idStr);
-//
-//            Frequency navFrequency = idNavFrequencyMap.get(idStr);
-//            Frequency calcFrequency = idCalcFrequencyMap.get(idStr);
-//
-//            List<Indicator> indicatorList = idIndicatorListMap.get(idStr);
-//            List<Indicator> geoExtraindicatorList = idGeoExtraindicatorListMap.get(idStr);
-//
-//            Map<String, String> secIdValueMap = new HashMap<>();
-//            for (String mainSecId : mainSecIdList) {
-//                if (StringUtils.isNotEmpty(benchmarkId)) {
-//                    Benchmark benchmark = benchmarkMap.get(mainSecId);
-//                    if (BenchmarkConfig.rz_strategy.name().equals(benchmarkId)) {
-//                        if (benchmark != null) {
-//                            benchmarkId = benchmark.getBenchmarkId();
-//                        }
-//                    } else if (BenchmarkConfig.rz_bfi.name().equals(benchmarkId)) {
-//                        if (benchmark != null) {
-//                            benchmarkId = benchmark.getRZIndexId();
-//                        }
-//                    }
-//                }
-//
-//                Map<String, List<DateValue>> secAllNavMap = new HashMap();
-//                secAllNavMap.put(mainSecId, NavUtil.getNewNavList(allNavMap.get(mainSecId)));
-//                secAllNavMap.put(benchmarkId, NavUtil.getNewNavList(allNavMap.get(benchmarkId)));
-//                for (String indexId : indexIdList) {
-//                    secAllNavMap.put(indexId, NavUtil.getNewNavList(allNavMap.get(indexId)));
-//                }
-//                if (StringUtils.isNotEmpty(riskOfFreeId)) {
-//                    secAllNavMap.put(riskOfFreeId, NavUtil.getNewNavList(allNavMap.get(riskOfFreeId)));
-//                }
-//
-//                List<IndicatorCalcPropertyDto> indicatorCalcPropertyDtoList = new ArrayList<>();
-//
-//                List<DateValue> mainSecIdNavList = secAllNavMap.get(mainSecId);
-//
-//                String theFirstNavDate = "";
-//                String theLastNavDate = "";
-//                if (mainSecIdNavList != null && mainSecIdNavList.size() > 0) {
-//                    theFirstNavDate = mainSecIdNavList.get(0).getDate();
-//                    theLastNavDate = mainSecIdNavList.get(mainSecIdNavList.size() - 1).getDate();
-//                }
-//
-//                List<IndexesTradeDateDo> indexesTradeDateDoList = TradeDateUtil.listInfoByDateInterval(theFirstNavDate, theLastNavDate);
-//
-//                List<DateValue> validMainSecNavList = null;
-//                if (secFreValidMainSecNavListMapMap.containsKey(mainSecId)) {
-//                    Map<Frequency, List<DateValue>> frequencyListMap = secFreValidMainSecNavListMapMap.get(mainSecId);
-//                    if (frequencyListMap.containsKey(navFrequency)) {
-//                        validMainSecNavList = frequencyListMap.get(navFrequency);
-//                        secAllNavMap.put(mainSecId, NavUtil.getNewNavList(validMainSecNavList));
-//                    } else {
-//                        validMainSecNavList = NavUtil.filterFrequencyNav(mainSecIdNavList, indexesTradeDateDoList, navFrequency);
-//                        secAllNavMap.put(mainSecId, NavUtil.getNewNavList(validMainSecNavList));
-//                        frequencyListMap.put(navFrequency, validMainSecNavList);
-//                    }
-//                } else {
-//                    validMainSecNavList = NavUtil.filterFrequencyNav(mainSecIdNavList, indexesTradeDateDoList, navFrequency);
-//                    secAllNavMap.put(mainSecId, NavUtil.getNewNavList(validMainSecNavList));
-//                    Map<Frequency, List<DateValue>> freValidMainSecNavListMap = new HashMap<>();
-//                    freValidMainSecNavListMap.put(navFrequency, validMainSecNavList);
-//                    secFreValidMainSecNavListMapMap.put(mainSecId, freValidMainSecNavListMap);
-//                }
-//
-//                Frequency defaultFrequency = secDefaultFrequency.get(mainSecId);
-//
-//                DateIntervalDto dateIntervalDto = idDateIntervalDtoMap.get(idStr);
-//
-//                List<IndicatorCalcTimeRangeDto> indicatorCalcTimeRangeDtoList = DateIntervalUtil.getIndicatorCalcTimeRangeDto(dateIntervalDto, secAllNavMap.get(mainSecId), indexesTradeDateDoList
-//                        , dateIntervalDto.getId());
-//                for (IndicatorCalcTimeRangeDto indicatorCalcTimeRangeDto : indicatorCalcTimeRangeDtoList) {
-//
-//                    Map<String, List<DateValue>> dateSecAllNavMap = new HashMap();
-//                    dateSecAllNavMap.put(mainSecId, NavUtil.getNewNavList(secAllNavMap.get(mainSecId)));
-//                    dateSecAllNavMap.put(benchmarkId, NavUtil.getNewNavList(secAllNavMap.get(benchmarkId)));
-//                    for (String indexId : indexIdList) {
-//                        dateSecAllNavMap.put(indexId, NavUtil.getNewNavList(secAllNavMap.get(indexId)));
-//                    }
-//                    if (StringUtils.isNotEmpty(riskOfFreeId)) {
-//                        dateSecAllNavMap.put(riskOfFreeId, NavUtil.getNewNavList(secAllNavMap.get(riskOfFreeId)));
-//                    }
-//
-//                    IndicatorCalcReqPropertyDto indicatorCalcReq = prepareIndicatorCalcReq(mainSecId, benchmarkId, indexIdList, indicatorCalcTimeRangeDto,
-//                            dateSecAllNavMap, riskOfFreeId, riskOfFreeValue, null, calcFrequency, defaultFrequency, indicatorList, geoExtraindicatorList, true, true,
-//                            false, false, true);
-//
-//                    IndicatorCalcPropertyDto indicatorCalcPropertyDto = calcService.indicatorCalc(indicatorCalcReq);
-//
-//                    indicatorCalcPropertyDtoList.add(indicatorCalcPropertyDto);
-//                }
-//
-//                String value = null;
-//                if (indicatorCalcPropertyDtoList != null && indicatorCalcPropertyDtoList.size() > 0) {
-//                    IndicatorCalcPropertyDto indicatorCalcPropertyDto = indicatorCalcPropertyDtoList.get(0);
-//                    if (indicatorList.size() > 0) {
-//                        value = indicatorCalcPropertyDto.getSecData().getIndicatorValueMap().get(indicatorList.get(0).name());
-//                    } else {
-//                        value = indicatorCalcPropertyDto.getSecData().getExtraGeoIndicatorValueMap().get(geoExtraindicatorList.get(0).name());
-//                    }
-//                }
-//                secIdValueMap.put(mainSecId, value);
-//            }
-//
-//            result.put(id, secIdValueMap);
-//        }
-//
-//        return result;
-//    }
-//
-//    @Override
-//    public List<IndicatorCalcTimeRangeDto> getSecTimeRange(String mainSecId, RaiseType raiseType, IStrategy strategy, Visibility visibility) {
-//
-//        List<String> mainSecIdList = new ArrayList<>();
-//        mainSecIdList.add(mainSecId);
-//        CurveType curveType = CurveType.getCurveType(raiseType, strategy);
-//
-//        List<IndicatorCalcTimeRangeDto> indicatorCalcTimeRangeDtoList = CollectionUtil.newArrayList();
-//
-//        Map<String, List<DateValue>> allNavMap = navService.getSecIdDateValueNavListMapFromRedisAndDB(mainSecIdList, new ArrayList<>(), new ArrayList<>(),
-//                null, null, NavType.All, Visibility.Both, curveType.getId(), strategy.getStrategyId(), new HashMap<>(), false, null);
-//
-//        DateIntervalDto dateIntervalDto = new DateIntervalDto();
-//        dateIntervalDto.setDateIntervalType(DateIntervalType.DefaultInterval);
-//
-//        List<DateValue> validNavList = allNavMap.get(mainSecId);
-//
-//        if (CollectionUtil.isEmpty(validNavList)) {
-//            return indicatorCalcTimeRangeDtoList;
-//        }
-//
-//        for (DateValue dateValue : validNavList) {
-//            dateValue.setIsvalid(1);
-//        }
-//
-//        List<DateValue> mainSecIdNavList = allNavMap.get(mainSecId);
-//
-//        String theFirstNavDate = "";
-//        String theLastNavDate = "";
-//        if (mainSecIdNavList != null && mainSecIdNavList.size() > 0) {
-//            theFirstNavDate = mainSecIdNavList.get(0).getDate();
-//            theLastNavDate = mainSecIdNavList.get(mainSecIdNavList.size() - 1).getDate();
-//        }
-//
-//        List<IndexesTradeDateDo> indexesTradeDateDoList = TradeDateUtil.listInfoByDateInterval(theFirstNavDate, theLastNavDate);
-//
-//        indicatorCalcTimeRangeDtoList = DateIntervalUtil.getIndicatorCalcTimeRangeDto(dateIntervalDto, allNavMap.get(mainSecId), indexesTradeDateDoList
-//                , dateIntervalDto.getId());
-//
-//        Frequency frequency = fundInformationDao.getNavFrequency(mainSecId);
-//
-//        for (IndicatorCalcTimeRangeDto indicatorCalcTimeRangeDto : indicatorCalcTimeRangeDtoList) {
-//            if (frequency == Frequency.Monthly) {
-//                List<String> thisMonthAfter5Days = TradeDateUtil.getThisMonthAfter5Days(indicatorCalcTimeRangeDto.getStartDate(), indicatorCalcTimeRangeDto.getEndDate());
-//                indicatorCalcTimeRangeDto.setMonthPreDays(thisMonthAfter5Days);
-//                List<String> thisMonthBefore6Days = TradeDateUtil.getThisMonthBefore6Days(indicatorCalcTimeRangeDto.getStartDate(), indicatorCalcTimeRangeDto.getEndDate());
-//                indicatorCalcTimeRangeDto.setMonthLaterDays(thisMonthBefore6Days);
-//            } else {
-//                List<String> preFourTradeDays = TradeDateUtil.getBefore4TradeDate(indicatorCalcTimeRangeDto.getStartDate());
-//                indicatorCalcTimeRangeDto.setPreDays(preFourTradeDays);
-//            }
-//            List<DateValue> secIdValidNav = IndicatorCalcUtil.getSecIdValidNav(mainSecId, indicatorCalcTimeRangeDto, allNavMap, false, frequency);
-//
-//            if (secIdValidNav == null || secIdValidNav.size() == 0) {
-//                indicatorCalcTimeRangeDto.setStartDate(null);
-//            }
-//        }
-//
-//        return indicatorCalcTimeRangeDtoList;
-//    }
-//
-//
-//    private TimeInterval getFirstAndLastDate(Map<String, List<DateValue>> allNavMap, List<String> mainSecIdList) {
-//        String firstDate = "";
-//        String lastDate = "";
-//
-//        for (String mainSecId : mainSecIdList) {
-//            List<DateValue> allNavMapEntryValue = allNavMap.get(mainSecId);
-//            if (allNavMapEntryValue == null || allNavMapEntryValue.size() == 0) {
-//                continue;
-//            }
-//
-//            String entryFirstDate = allNavMapEntryValue.get(0).getDate();
-//            String entryLastDate = allNavMapEntryValue.get(allNavMapEntryValue.size() - 1).getDate();
-//
-//            if (StringUtils.isEmpty(firstDate) || entryFirstDate.compareTo(firstDate) < 0) {
-//                firstDate = entryFirstDate;
-//            }
-//
-//            if (StringUtils.isEmpty(lastDate) || lastDate.compareTo(entryLastDate) < 0) {
-//                lastDate = entryLastDate;
-//            }
-//        }
-//
-//        TimeInterval timeInterval = new TimeInterval();
-//        timeInterval.setStartDate(firstDate);
-//        timeInterval.setEndDate(lastDate);
-//
-//        return timeInterval;
-//    }
-//
-//    private IndicatorCalcReqPropertyDto prepareTrendReq(String mainSecId, String benchmarkId, List<String> indexList, IndicatorCalcTimeRangeDto indicatorCalcTimeRangeDto,
-//                                                        Map<String, List<DateValue>> allNavMap, Frequency frequency, Frequency defaultFrequency,
-//                                                        List<TrendType> trendTypeV2List, BigDecimal fixedIncome, BigDecimal initValue) {
-//
-//        IndicatorCalcReqPropertyDto indicatorCalcReq = new IndicatorCalcReqPropertyDto();
-//        indicatorCalcReq.setSecId(mainSecId);
-//        indicatorCalcReq.setBenchmarkId(benchmarkId);
-//        indicatorCalcReq.setIndexIdList(indexList);
-//        indicatorCalcReq.setAllNavMap(allNavMap);
-//        indicatorCalcReq.setTrendTypeList(trendTypeV2List);
-//        indicatorCalcReq.setFixedIncome(fixedIncome);
-//        indicatorCalcReq.setInitValue(initValue);
-//        indicatorCalcReq.setDefaultFrequency(defaultFrequency);
-//
-//        if (defaultFrequency == Frequency.Monthly) {
-//            List<String> thisMonthAfter5Days = TradeDateUtil.getThisMonthAfter5Days(indicatorCalcTimeRangeDto.getStartDate(), indicatorCalcTimeRangeDto.getEndDate());
-//            indicatorCalcTimeRangeDto.setMonthPreDays(thisMonthAfter5Days);
-//            List<String> thisMonthBefore6Days = TradeDateUtil.getThisMonthBefore6Days(indicatorCalcTimeRangeDto.getStartDate(), indicatorCalcTimeRangeDto.getEndDate());
-//            indicatorCalcTimeRangeDto.setMonthLaterDays(thisMonthBefore6Days);
-//        } else {
-//            List<String> preFourTradeDays = TradeDateUtil.getBefore4TradeDate(indicatorCalcTimeRangeDto.getStartDate());
-//            indicatorCalcTimeRangeDto.setPreDays(preFourTradeDays);
-//        }
-//
-//        indicatorCalcReq.setIndicatorCalcTimeRangeDto(indicatorCalcTimeRangeDto);
-//        return indicatorCalcReq;
-//    }
-//
-//    private IndicatorCalcReqPropertyDto prepareIndicatorCalcReq(String mainSecId, String benchmarkId, List<String> indexList,
-//                                                                IndicatorCalcTimeRangeDto indicatorCalcTimeRangeDto,
-//                                                                Map<String, List<DateValue>> allNavMap,
-//                                                                String riskOfFreeId, Double riskOfFreeValue, Map<String, CompoundRet> stgDateRetMap, Frequency frequency, Frequency defaultFrequency,
-//                                                                List<Indicator> indicatorList, List<Indicator> geoExtraindicatorList, boolean ifAnnualize, boolean calcIndexRetIndicatorValue,
-//                                                                boolean needRet, boolean needExtraRet, boolean ifConvertPerformanceConsistencyWord) {
-//        IndicatorCalcReqPropertyDto indicatorCalcReq = new IndicatorCalcReqPropertyDto();
-//        indicatorCalcReq.setSecId(mainSecId);
-//        if (indexList != null) {
-//            indicatorCalcReq.setIndexIdList(indexList);
-//        }
-//        indicatorCalcReq.setBenchmarkId(benchmarkId);
-//        indicatorCalcReq.setAllNavMap(allNavMap);
-//
-//        if (defaultFrequency == Frequency.Monthly) {
-//            List<String> thisMonthAfter5Days = TradeDateUtil.getThisMonthAfter5Days(indicatorCalcTimeRangeDto.getStartDate(), indicatorCalcTimeRangeDto.getEndDate());
-//            indicatorCalcTimeRangeDto.setMonthPreDays(thisMonthAfter5Days);
-//            List<String> thisMonthBefore6Days = TradeDateUtil.getThisMonthBefore6Days(indicatorCalcTimeRangeDto.getStartDate(), indicatorCalcTimeRangeDto.getEndDate());
-//            indicatorCalcTimeRangeDto.setMonthLaterDays(thisMonthBefore6Days);
-//        } else {
-//            List<String> preFourTradeDays = TradeDateUtil.getBefore4TradeDate(indicatorCalcTimeRangeDto.getStartDate());
-//            indicatorCalcTimeRangeDto.setPreDays(preFourTradeDays);
-//        }
-//
-//        indicatorCalcReq.setIndicatorCalcTimeRangeDto(indicatorCalcTimeRangeDto);
-//
-//        indicatorCalcReq.setStrategyDateRetMap(stgDateRetMap);
-//        indicatorCalcReq.setRiskOfFreeId(riskOfFreeId);
-//        indicatorCalcReq.setRiskOfFreeValue(riskOfFreeValue);
-//        indicatorCalcReq.setIndicatorList(indicatorList);
-//        indicatorCalcReq.setGeoIndicatorList(geoExtraindicatorList);
-//
-//        indicatorCalcReq.setFrequency(frequency);
-//        indicatorCalcReq.setDefaultFrequency(defaultFrequency);
-//
-//        indicatorCalcReq.setIfAnnualize(ifAnnualize);
-//
-//        indicatorCalcReq.setNeedRet(needRet);
-//
-//        indicatorCalcReq.setNeedExtraGeoRet(needExtraRet);
-//
-//        indicatorCalcReq.setCalcIndexRetIndicatorValue(calcIndexRetIndicatorValue);
-//
-//        indicatorCalcReq.setIfConvertPerformanceConsistencyWord(ifConvertPerformanceConsistencyWord);
-//
-//        return indicatorCalcReq;
-//    }
-//
-//    private TimeInterval getMaxTimeInterval(List<IndicatorCalcTimeRangeDto> indicatorCalcTimeRangeDtoList) {
-//        String firstStartDate = null;
-//        String lastEndDate = null;
-//        for (IndicatorCalcTimeRangeDto indicatorCalcTimeRangeDto : indicatorCalcTimeRangeDtoList) {
-//            String startDate = indicatorCalcTimeRangeDto.getStartDate();
-//            String endDate = indicatorCalcTimeRangeDto.getEndDate();
-//
-//            if (StringUtils.isEmpty(firstStartDate)) {
-//                firstStartDate = startDate;
-//            }
-//
-//            if (StringUtils.isEmpty(lastEndDate)) {
-//                lastEndDate = endDate;
-//            }
-//
-//            if (firstStartDate.compareTo(startDate) > 0) {
-//                firstStartDate = startDate;
-//            }
-//
-//            if (lastEndDate.compareTo(endDate) < 0) {
-//                lastEndDate = endDate;
-//            }
-//        }
-//
-//        TimeInterval timeInterval = new TimeInterval();
-//        timeInterval.setStartDate(firstStartDate);
-//        timeInterval.setEndDate(lastEndDate);
-//        return timeInterval;
-//    }
-//
-//    public void rollFindStartDate(String mainSecId, DateIntervalDto dateIntervalDto, List<IndexesTradeDateDo> indexesTradeDateDoList, Map<String, List<DateValue>> allNavMap, Frequency defaultFrequency) {
-//        if (dateIntervalDto.getDateIntervalType() == DateIntervalType.DefaultRolling || dateIntervalDto.getDateIntervalType() == DateIntervalType.CustomRolling) {
-//            DateIntervalDto defaultIntervalDateIntervalDto = new DateIntervalDto();
-//            defaultIntervalDateIntervalDto.setStartDate(dateIntervalDto.getStartDate());
-//            defaultIntervalDateIntervalDto.setEndDate(dateIntervalDto.getEndDate());
-//            defaultIntervalDateIntervalDto.setDateIntervalType(DateIntervalType.CustomInterval);
-//            defaultIntervalDateIntervalDto.setTimeRange(dateIntervalDto.getTimeRange());
-//
-//            List<DateValue> newNavList = NavUtil.getNewNavList(allNavMap.get(mainSecId));
-//            List<IndicatorCalcTimeRangeDto> indicatorCalcTimeRangeDtoList = DateIntervalUtil.getIndicatorCalcTimeRangeDto(defaultIntervalDateIntervalDto, newNavList, indexesTradeDateDoList
-//                    , dateIntervalDto.getId());
-//
-//            if (indicatorCalcTimeRangeDtoList != null && indicatorCalcTimeRangeDtoList.size() > 0) {
-//                IndicatorCalcTimeRangeDto indicatorCalcTimeRangeDto = indicatorCalcTimeRangeDtoList.get(0);
-//                if (defaultFrequency == Frequency.Monthly) {
-//                    List<String> thisMonthAfter5Days = TradeDateUtil.getThisMonthAfter5Days(indicatorCalcTimeRangeDto.getStartDate(), indicatorCalcTimeRangeDto.getEndDate());
-//                    indicatorCalcTimeRangeDto.setMonthPreDays(thisMonthAfter5Days);
-//                    List<String> thisMonthBefore6Days = TradeDateUtil.getThisMonthBefore6Days(indicatorCalcTimeRangeDto.getStartDate(), indicatorCalcTimeRangeDto.getEndDate());
-//                    indicatorCalcTimeRangeDto.setMonthLaterDays(thisMonthBefore6Days);
-//                } else {
-//                    List<String> preFourTradeDays = TradeDateUtil.getBefore4TradeDate(indicatorCalcTimeRangeDto.getStartDate());
-//                    indicatorCalcTimeRangeDto.setPreDays(preFourTradeDays);
-//                }
-//                Map<String, List<DateValue>> defaultIntervalNavMap = new HashMap<>();
-//                defaultIntervalNavMap.put(mainSecId, newNavList);
-//                List<DateValue> secIdValidNav = IndicatorCalcUtil.getSecIdValidNav(mainSecId, indicatorCalcTimeRangeDto, defaultIntervalNavMap, false, defaultFrequency);
-//                if (secIdValidNav != null && secIdValidNav.size() > 0) {
-//                    dateIntervalDto.setStartDate(secIdValidNav.get(0).getDate());
-//                }
-//            }
-//        }
-//    }
-//
-//    @Override
-//    public List<Map<String, Object>> getMultiSecRetList(List<String> mainSecIdList, List<String> indexIds, Frequency frequency, String strategyKey, RaiseType raiseType, String startDate, String endDate) {
-//        IStrategy strategy = StrategyHandleUtils.getStrategy(strategyKey);
-//        CurveType curveType = CurveType.getCurveType(raiseType, strategy);
-//        Map<String, Frequency> secFrequencyMap = MapUtil.newHashMap();
-//        for (String secId : mainSecIdList) {
-//            secFrequencyMap.put(secId, frequency);
-//        }
-//        Map<String, List<DateValue>> allNavMap = this.navService.getSecIdDateValueNavListMapFromRedisAndDB(mainSecIdList, ListUtil.empty(), indexIds,
-//                startDate, endDate, NavType.CumulativeNav, Visibility.Both, curveType.getId(), strategy.getStrategyId(),
-//                secFrequencyMap, false, null);
-//        List<Map<String, Object>> initRetList = ListUtil.list(true);
-//        for (String secId : mainSecIdList) {
-//            List<CompoundRet> ret = IndicatorCalcUtil.getRet(allNavMap.get(secId), null, null, null);
-//            List<Map<String, Object>> dataList = ret.stream().filter(e -> e.getRetOfFund() != null).map(e -> MapUtil.<String, Object>builder("end_date", e.getEndDate())
-//                    .put("fund_id", secId).put("ret_range", e.getRetOfFund()).build()).collect(Collectors.toList());
-//            initRetList.addAll(dataList);
-//        }
-//        for (String indexId : indexIds) {
-//            List<CompoundRet> indexRet = IndicatorCalcUtil.getRet(allNavMap.get(indexId), null, null, null);
-//            initRetList.addAll(indexRet.stream().filter(e -> e.getRetOfFund() != null).map(e -> MapUtil.<String, Object>builder("end_date", e.getEndDate()).put("fund_id", indexId).put("ret_range", e.getRetOfFund()).build()).collect(Collectors.toList()));
-//        }
-//        return initRetList;
-//    }
-//
-//
-//    @Override
-//    public Map<String, List<IndicatorCalcPropertyDto>> getMultiSecRetListNew(List<String> mainSecIdList, List<String> indexIdList, Frequency frequency,
-//                                                                             Frequency rollingFrequency, String startDate, String endDate,
-//                                                                             boolean ifExcessReturn, String benchmarkId, RaiseType raiseType, IStrategy strategy,
-//                                                                             Visibility visibility, NavType navType, boolean isExtract, Integer userId) {
-//        List<DateIntervalDto> dateIntervalDtoList = new ArrayList<>();
-//        DateIntervalDto defaultIntervalDto = new DateIntervalDto();
-//        defaultIntervalDto.setStartDate(startDate);
-//        defaultIntervalDto.setEndDate(endDate);
-//        defaultIntervalDto.setDateIntervalType(DateIntervalType.DefaultRolling);
-//        defaultIntervalDto.setFrequency(rollingFrequency);
-//        dateIntervalDtoList.add(defaultIntervalDto);
-//
-//        List<Indicator> indicatorList = new ArrayList<>();
-//        List<Indicator> geoExtraIndicatorList = new ArrayList<>();
-//
-//        indicatorList.add(Indicator.IntervalReturn);
-//        if (ifExcessReturn) {
-//            geoExtraIndicatorList.add(Indicator.IntervalReturn);
-//        }
-//
-//        Map<String, String> secBenchmarkIdMap = new HashMap<>();
-//        for (String mainSecId : mainSecIdList) {
-//            secBenchmarkIdMap.put(mainSecId, benchmarkId);
-//        }
-//
-//        Map<String, List<DateIntervalDto>> secDateIntervalDtoListMap = new HashMap<>();
-//        for (String mainSecId : mainSecIdList) {
-//            secDateIntervalDtoListMap.put(mainSecId, dateIntervalDtoList);
-//        }
-//
-//        CalcMultipleSecMultipleTimeRangeIndicatorReq calcMultipleSecMultipleTimeRangeIndicatorReq = new CalcMultipleSecMultipleTimeRangeIndicatorReq();
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setMainSecIdList(mainSecIdList);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setSecBenchmarkIdMap(secBenchmarkIdMap);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setIndexIdList(indexIdList);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setRaiseType(raiseType);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setStrategy(strategy);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setVisibility(visibility);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setSecDateIntervalDtoListMap(secDateIntervalDtoListMap);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setDataFrequency(frequency);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setNavType(navType);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setIndicatorList(indicatorList);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setGeoExtraindicatorList(geoExtraIndicatorList);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setRiskOfFreeId(null);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setRiskOfFreeValue(null);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setIfAnnualize(true);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setCalcIndexRetIndicatorValue(true);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setNeedRet(false);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setIfExtract(isExtract);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setUserId(userId);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setNeedExtraRet(false);
-//        calcMultipleSecMultipleTimeRangeIndicatorReq.setIfConvertPerformanceConsistencyWord(true);
-//
-//        return calcMultipleSecMultipleTimeRangeIndicator(calcMultipleSecMultipleTimeRangeIndicatorReq);
-//    }
-//}

+ 0 - 152
src/main/java/com/smppw/fofapi/service/indicator/BaseIndicatorServiceV2.java

@@ -1,152 +0,0 @@
-//package com.smppw.fofapi.service.indicator;
-//
-//
-//import cn.hutool.core.collection.CollectionUtil;
-//import cn.hutool.core.collection.ListUtil;
-//import cn.hutool.core.map.MapUtil;
-//import cn.hutool.core.util.StrUtil;
-//import com.smppw.constants.Consts;
-//import com.smppw.common.pojo.IStrategy;
-//import com.smppw.common.pojo.dto.Benchmark;
-//import com.smppw.common.pojo.dto.calc.IndicatorCalcPropertyDto;
-//import com.smppw.common.pojo.dto.calc.IndicatorCalcTimeRangeDto;
-//import com.smppw.common.pojo.dto.indicator.CalcMultipleSecMultipleTimeRangeIndicatorReq;
-//import com.smppw.common.pojo.dto.indicator.DateIntervalDto;
-//import com.smppw.common.pojo.enums.*;
-//import com.smppw.common.pojo.enums.strategy.Strategy;
-//
-//import java.math.BigDecimal;
-//import java.time.LocalDate;
-//import java.time.format.DateTimeFormatter;
-//import java.util.List;
-//import java.util.Map;
-//
-//public interface BaseIndicatorServiceV2 {
-//
-//    /**
-//     * 指标计算
-//     *
-//     * @return
-//     */
-//    Map<String, List<IndicatorCalcPropertyDto>> calcMultipleSecMultipleTimeRangeIndicator(CalcMultipleSecMultipleTimeRangeIndicatorReq req);
-//
-//    /**
-//     * 指标计算 - 多频率的
-//     *
-//     * @return
-//     */
-//    Map<String, Map<Frequency, List<IndicatorCalcPropertyDto>>> calcMultipleSecMultipleTimeRangeIndicator(List<String> mainSecIdList, Map<String, String> secBenchmarkIdMap, List<String> indexIdList,
-//                                                                                                          Integer raiseTypeId, Integer strategyId, Visibility visibility,
-//                                                                                                          List<DateIntervalDto> dateIntervalDtoList,
-//                                                                                                          List<Frequency> dataFrequencyList, NavType navType, Map<Frequency, List<Indicator>> dataFrequencyIndicatorListMap,
-//                                                                                                          Map<Frequency, List<Indicator>> dataFrequencyGeoExtraIndicatorListMap, String riskOfFreeId, Double riskOfFreeValue,
-//                                                                                                          boolean ifAnnualize, boolean calcIndexRetIndicatorValue, boolean needRet, boolean needExtraRet, String serverName, int leastRetNum);
-//
-//    /**
-//     * 指标计算 - 动态列的
-//     *
-//     * @return
-//     */
-//    Map<Integer, Map<String, String>> calcMultipleSecMultipleTimeRangeIndicator(List<String> mainSecIdList, List<Integer> idList, Map<String, String> idBenchmarkMap, List<String> indexIdList,
-//                                                                                Map<String, DateIntervalDto> idDateIntervalDtoMap, Map<String, Frequency> idNavFrequencyMap,
-//                                                                                Map<String, Frequency> idCalcFrequencyMap, Map<String, NavType> idNavTypeMap,
-//                                                                                Map<String, List<Indicator>> idIndicatorListMap, Map<String, List<Indicator>> idGeoExtraindicatorListMap,
-//                                                                                Map<String, String> idRiskOfFreeIdMap, Map<String, Double> idRiskOfFreeValueMap, Map<String, Benchmark> benchmarkMap);
-//
-//    /**
-//     * 走势
-//     *
-//     * @return
-//     */
-//    Map<String, List<IndicatorCalcPropertyDto>> getMultipleSecTrend(List<String> mainSecIdList, Map<String, String> secBenchmarkIdMap, List<String> indexIdList,
-//                                                                    DateIntervalDto dateIntervalDto, Frequency frequency, BigDecimal fixedIncome, BigDecimal initValue, RaiseType raiseType,
-//                                                                    IStrategy strategy, Visibility visibility, NavType navType, List<TrendType> trendTypeV2List, Boolean ifExtract, Integer userId);
-//
-//    /**
-//     * 根据时段获取开始结束时间
-//     *
-//     * @param secId     标的
-//     * @param raiseType 类型
-//     * @param timeRange 时段
-//     * @return 开始结束时间
-//     */
-//    default Map<String, String> getSecDateByTimeRange(String secId, RaiseType raiseType, TimeRange timeRange) {
-//        String endDate = null;
-//        String startDate = null;
-//        List<IndicatorCalcTimeRangeDto> secTimeRange = getSecTimeRange(secId, raiseType, Strategy.All, Visibility.Both);
-//        if (CollectionUtil.isNotEmpty(secTimeRange)) {
-//            for (IndicatorCalcTimeRangeDto dto : secTimeRange) {
-//                if (dto.getTimeRange() != timeRange) {
-//                    continue;
-//                }
-//                startDate = dto.getStartDate();
-//                endDate = dto.getEndDate();
-//            }
-//        }
-//        if (StrUtil.isBlank(startDate)) {
-//            startDate = Consts.START_DATE;
-//        }
-//        if (StrUtil.isBlank(endDate)) {
-//            endDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-//        }
-//        return MapUtil.<String, String>builder().put("startDate", startDate).put("endDate", endDate).build();
-//    }
-//
-//    /**
-//     * 获取标的的所有时段,包括开始结束日期,时段名称
-//     *
-//     * @param secId     标的
-//     * @param raiseType 类型
-//     * @return 所有时段
-//     */
-//    default List<Map<String, String>> getSecTimeRanges(String secId, RaiseType raiseType, IStrategy strategy, Visibility visibility) {
-//        List<Map<String, String>> timeRangeList = ListUtil.list(true);
-//        List<IndicatorCalcTimeRangeDto> secTimeRange = getSecTimeRange(secId, raiseType, strategy, visibility);
-//        if (secTimeRange == null || secTimeRange.isEmpty()) {
-//            return timeRangeList;
-//        }
-//        for (IndicatorCalcTimeRangeDto dto : secTimeRange) {
-//            Map<String, String> data = MapUtil.<String, String>builder()
-//                    .put("name", dto.getTimeRange().name())
-//                    .put("startDate", dto.getStartDate())
-//                    .put("endDate", dto.getEndDate())
-//                    .build();
-//            timeRangeList.add(data);
-//        }
-//        return timeRangeList;
-//    }
-//
-//
-//    /**
-//     * time-range
-//     *
-//     * @return
-//     */
-//    List<IndicatorCalcTimeRangeDto> getSecTimeRange(String mainSecId, RaiseType raiseType, IStrategy strategy, Visibility visibility);
-//
-//    default List<Map<String, Object>> getMultiSecRetList(List<String> mainSecIdList, List<String> indexIds, Frequency frequency, String strategyKey, RaiseType raiseType) {
-//        return this.getMultiSecRetList(mainSecIdList, indexIds, frequency, strategyKey, raiseType, null, null);
-//    }
-//
-//    /**
-//     * 获取标的 收益序列
-//     *
-//     * @param mainSecIdList 标的,可以多个
-//     * @param indexIds      指数,可以多个
-//     * @param strategyKey   策略 名称或id
-//     * @param frequency     净值频率
-//     * @param raiseType     类型
-//     * @return 收益序列 {fund_id, end_date, ret_range}
-//     */
-//    List<Map<String, Object>> getMultiSecRetList(List<String> mainSecIdList, List<String> indexIds, Frequency frequency, String strategyKey, RaiseType raiseType, String startDate, String endDate);
-//
-//
-//    default Map<String, List<IndicatorCalcPropertyDto>> getMultiSecRetListNew(List<String> mainSecIdList, List<String> indexIds, Frequency frequency, Frequency frequency1, String startDate, String endDate, boolean b, String benchmarkId, RaiseType raiseType, IStrategy strategy, Visibility visible, NavType navType){
-//        return getMultiSecRetListNew(mainSecIdList, indexIds, frequency, frequency1, startDate, endDate, b, benchmarkId, raiseType, strategy, visible, navType,false, null);
-//    }
-//
-//    Map<String, List<IndicatorCalcPropertyDto>> getMultiSecRetListNew(List<String> mainSecIdList, List<String> indexIds, Frequency frequency,
-//                                                                      Frequency frequency1, String startDate, String endDate, boolean b,
-//                                                                      String benchmarkId, RaiseType raiseType, IStrategy strategy,
-//                                                                      Visibility visible, NavType navType,boolean isExtract, Integer userId);
-//}