|
@@ -1,5 +1,16 @@
|
|
|
package com.smppw.constants;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.smppw.common.cache.CaffeineLocalCache;
|
|
|
+import com.smppw.common.pojo.enums.strategy.IStrategy;
|
|
|
+import com.smppw.utils.StrategyHandleUtils;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
public class SecType {
|
|
|
/**
|
|
|
* 私募基金
|
|
@@ -33,12 +44,10 @@ public class SecType {
|
|
|
* 三方指数
|
|
|
*/
|
|
|
public final static String THIRD_INDEX_FUND = "THRID_INDEX_FUND";
|
|
|
-
|
|
|
/**
|
|
|
* 无风险
|
|
|
*/
|
|
|
public final static String RISK_OF_FREE = "RISK_OF_FREE";
|
|
|
-
|
|
|
/**
|
|
|
* 组合
|
|
|
*/
|
|
@@ -67,4 +76,76 @@ public class SecType {
|
|
|
* 投顾池曲线拟合
|
|
|
*/
|
|
|
public final static String ADVISORY_POOL_CURVE = "ADVISORY_POOL_CURVE";
|
|
|
+
|
|
|
+ private static final String HF = "HF";
|
|
|
+ private static final String MF = "MF";
|
|
|
+ private static final String CF = "CF";
|
|
|
+ private static final String FA = "FA";
|
|
|
+ private static final String CI = "CI";
|
|
|
+ private static final String CO = "CO";
|
|
|
+ private static final String PL = "PL";
|
|
|
+ private static final String PO = "PO";
|
|
|
+ private static final String IN = "IN";
|
|
|
+ private static final String AP = "AP";
|
|
|
+
|
|
|
+ public static String getSecType(String secId, List<String> rzIndexes) {
|
|
|
+ if (secId == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (secId.startsWith(HF)) {
|
|
|
+ return SecType.PRIVATELY_OFFERED_FUND;
|
|
|
+ } else if (secId.startsWith(MF)) {
|
|
|
+ return SecType.PUBLICLY_OFFERED_FUNDS;
|
|
|
+ } else if (secId.startsWith(CF)) {
|
|
|
+ return SecType.PRIVATE_FUND;
|
|
|
+ } else if (secId.startsWith(FA)) {
|
|
|
+ return SecType.FACTOR;
|
|
|
+ } else if (secId.startsWith(CI)) {
|
|
|
+ return SecType.UDF_INDEX;
|
|
|
+ } else if (secId.startsWith(CO)) {
|
|
|
+ return SecType.COMPANY;
|
|
|
+ } else if (secId.startsWith(PL)) {
|
|
|
+ return SecType.MANAGER;
|
|
|
+ } else if (secId.startsWith(PO)) {
|
|
|
+ return SecType.COMBINATION;
|
|
|
+ } else if (StrUtil.isNumeric(secId)) {
|
|
|
+ IStrategy strategy = StrategyHandleUtils.getStrategy(secId);
|
|
|
+ if (strategy != null) {
|
|
|
+ return SecType.STRATEGY;
|
|
|
+ }
|
|
|
+ } else if (secId.startsWith(IN)) {
|
|
|
+ List<String> thirdIndexes = CaffeineLocalCache.getThirdIndexes();
|
|
|
+ if (thirdIndexes != null && thirdIndexes.contains(secId)) {
|
|
|
+ return SecType.THIRD_INDEX_FUND;
|
|
|
+ }
|
|
|
+ List<String> riskOfFreeIdList = CaffeineLocalCache.getRiskOfFreeId();
|
|
|
+ if (riskOfFreeIdList != null && riskOfFreeIdList.contains(secId)) {
|
|
|
+ return SecType.RISK_OF_FREE;
|
|
|
+ }
|
|
|
+ if (CollUtil.isEmpty(rzIndexes) || !rzIndexes.contains(secId)) {
|
|
|
+ return SecType.INDEX_FUND;
|
|
|
+ } else {
|
|
|
+ return SecType.RONGZHI_INDEX;
|
|
|
+ }
|
|
|
+ } else if (secId.startsWith(AP)) {
|
|
|
+ return SecType.ADVISORY_POOL_CURVE;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Map<String, List<String>> getTypeSecMap(List<String> secIdList, List<String> rzIndexes) {
|
|
|
+ Map<String, List<String>> secIdTypeMap = new HashMap<>(10);
|
|
|
+ for (String secId : secIdList) {
|
|
|
+ String secIdType = getSecType(secId, rzIndexes);
|
|
|
+ if (secIdTypeMap.containsKey(secIdType)) {
|
|
|
+ List<String> list = secIdTypeMap.get(secIdType);
|
|
|
+ list.add(secId);
|
|
|
+ } else {
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
+ list.add(secId);
|
|
|
+ secIdTypeMap.put(secIdType, list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return secIdTypeMap;
|
|
|
+ }
|
|
|
}
|