Przeglądaj źródła

fix:策略,币种,基金类型等字段映射为对应的字符串返回

mozuwen 1 rok temu
rodzic
commit
990938b7f8

+ 79 - 4
src/main/java/com/smppw/analysis/application/service/info/FundInfoService.java

@@ -12,6 +12,7 @@ import cn.hutool.core.util.StrUtil;
 import com.smppw.analysis.application.dto.info.FundSimilarReq;
 import com.smppw.analysis.application.dto.info.ManualFundManagerParams;
 import com.smppw.analysis.application.dto.info.ManualFundNoticeReq;
+import com.smppw.analysis.domain.dao.CompanyInformationDao;
 import com.smppw.analysis.domain.dataobject.*;
 import com.smppw.analysis.domain.dto.info.*;
 import com.smppw.analysis.domain.service.BaseIndicatorServiceV2;
@@ -49,6 +50,9 @@ public class FundInfoService {
     private static final Map<String, String> ACCRUED_FREQUENCY = MapUtil.newHashMap(5);
     private static final Map<String, String> ACCRUED_METHOD = MapUtil.newHashMap(3);
     private static final Map<Integer, String> EDUCATION_NAME_MAP = MapUtil.newHashMap(8);
+    private static final Map<Integer, String> FUND_STATUS_MAP = MapUtil.newHashMap(11);
+    private static final Map<Integer, String> FUND_TYPE_MAP = MapUtil.newHashMap(11);
+    private static final Map<Integer, String> BASE_CURRENCY_MAP = MapUtil.newHashMap(5);
 
     static {
         ACCRUED_FREQUENCY.put("1", "月");
@@ -59,6 +63,7 @@ public class FundInfoService {
         ACCRUED_METHOD.put("1", "高水位");
         ACCRUED_METHOD.put("2", "高水位+赎回时补充");
         ACCRUED_METHOD.put("3", "单客户高水位");
+
         EDUCATION_NAME_MAP.put(1, "小学");
         EDUCATION_NAME_MAP.put(2, "中学");
         EDUCATION_NAME_MAP.put(3, "大专");
@@ -67,18 +72,53 @@ public class FundInfoService {
         EDUCATION_NAME_MAP.put(6, "博士");
         EDUCATION_NAME_MAP.put(7, "博士后");
         EDUCATION_NAME_MAP.put(-1, "其他");
+        BASE_CURRENCY_MAP.put(1, "人民币");
+        BASE_CURRENCY_MAP.put(3, "港币");
+        BASE_CURRENCY_MAP.put(3, "美元");
+        BASE_CURRENCY_MAP.put(4, "份");
+        BASE_CURRENCY_MAP.put(-1, "其他");
+
+        FUND_STATUS_MAP.put(1, "募集中");
+        FUND_STATUS_MAP.put(2, "开放运行");
+        FUND_STATUS_MAP.put(4, "提前清算");
+        FUND_STATUS_MAP.put(5, "到期清算");
+        FUND_STATUS_MAP.put(6, "发行失败");
+        FUND_STATUS_MAP.put(7, "投顾协议已终止");
+        FUND_STATUS_MAP.put(8, "延期清算");
+        FUND_STATUS_MAP.put(9, "非正常清算");
+        FUND_STATUS_MAP.put(10, "已终止");
+        FUND_STATUS_MAP.put(11, "已作废 ");
+        FUND_STATUS_MAP.put(-1, "其他");
+
+        FUND_TYPE_MAP.put(1, "信托计划");
+        FUND_TYPE_MAP.put(3, "券商资管");
+        FUND_TYPE_MAP.put(4, "公募专户");
+        FUND_TYPE_MAP.put(5, "单账户");
+        FUND_TYPE_MAP.put(6, "证券投资基金");
+        FUND_TYPE_MAP.put(7, "海外基金");
+        FUND_TYPE_MAP.put(8, "期货资管");
+        FUND_TYPE_MAP.put(9, "保险资管");
+        FUND_TYPE_MAP.put(10, "创业投资基金");
+        FUND_TYPE_MAP.put(11, "股权投资基金 ");
+        FUND_TYPE_MAP.put(12, "银行理财 ");
+        FUND_TYPE_MAP.put(14, "私募资产配置基金 ");
+        FUND_TYPE_MAP.put(15, "公募基金 ");
+        FUND_TYPE_MAP.put(-1, "其他");
+
     }
 
     private final NavService navService;
     private final BaseInfoService baseInfoService;
     private final BaseIndicatorServiceV2 baseIndicatorServiceV2;
+    private final CompanyInformationDao companyInformationDao;
 
     public FundInfoService(NavService navService,
                            BaseInfoService baseInfoService,
-                           BaseIndicatorServiceV2 baseIndicatorServiceV2) {
+                           BaseIndicatorServiceV2 baseIndicatorServiceV2, CompanyInformationDao companyInformationDao) {
         this.navService = navService;
         this.baseInfoService = baseInfoService;
         this.baseIndicatorServiceV2 = baseIndicatorServiceV2;
+        this.companyInformationDao = companyInformationDao;
     }
 
     /**
@@ -535,18 +575,53 @@ public class FundInfoService {
     public PrivatelyFundBaseInfoVO getFundBaseInfo(String fundId) {
         PrivatelyFundBaseInfoVO privatelyFundBaseInfoVO = new PrivatelyFundBaseInfoVO();
         //私募基金基本信息
-        PrivatelyFundBaseInfoDo privatelyFundInfo = this.baseInfoService.listPrivatelyFundInfo(fundId);
-        if (privatelyFundInfo == null) {
+        PrivatelyFundBaseInfoDo fundInfo = this.baseInfoService.listPrivatelyFundInfo(fundId);
+        if (fundInfo == null) {
             return privatelyFundBaseInfoVO;
         }
-        privatelyFundBaseInfoVO = BeanUtil.copyProperties(privatelyFundInfo, PrivatelyFundBaseInfoVO.class);
+        privatelyFundBaseInfoVO = BeanUtil.copyProperties(fundInfo, PrivatelyFundBaseInfoVO.class);
+        privatelyFundBaseInfoVO.setBaseCurrency(fundInfo.getBaseCurrency() != null ? BASE_CURRENCY_MAP.get(Integer.valueOf(fundInfo.getBaseCurrency())) : null);
+        privatelyFundBaseInfoVO.setUmbrellaFund(fundInfo.getUmbrellaFund() == 1 ? "是" : "否");
+        privatelyFundBaseInfoVO.setIstiered(fundInfo.getIstiered() == 1 ? "是" : "否");
+        privatelyFundBaseInfoVO.setFundTypeValue(fundInfo.getFundType() != null ? FUND_TYPE_MAP.get(Integer.valueOf(fundInfo.getFundType())) : null);
         //获取基金的基金经理
         List<FundManagerInfoDo> fundManagerInfoList = this.baseInfoService.listFundManagerByFundId(fundId);
         if (CollUtil.isNotEmpty(fundManagerInfoList)) {
             privatelyFundBaseInfoVO.setFundManager(fundManagerInfoList.stream()
                     .map(FundManagerInfoDo::getManagerName).collect(Collectors.joining(",")));
         }
+        //处理投资顾问,基金管理人,基金托管人
+        List<String> companyIdList = CollUtil.newArrayList();
+        List<CompanyInformationDo> companyInformationDos;
+        String trustId = fundInfo.getTrustId();
+        if (StrUtil.isNotBlank(trustId)) {
+            companyIdList.add(trustId);
+        }
+        String custodianId = fundInfo.getCustodianId();
+        if (StrUtil.isNotBlank(custodianId)) {
+            companyIdList.add(custodianId);
+        }
+        String advisorId = fundInfo.getAdvisorId();
+        if (StrUtil.isNotBlank(advisorId)) {
+            companyIdList.add(advisorId);
+        }
+        if (CollUtil.isNotEmpty(companyIdList)) {
+            companyInformationDos = companyInformationDao.listCompany(companyIdList);
+            if (CollUtil.isNotEmpty(companyInformationDos)) {
+                Map<String, CompanyInformationDo> companyInfoMap = companyInformationDos.stream().collect(Collectors.toMap(k -> k.getCompanyId(), v -> v));
+                privatelyFundBaseInfoVO.setTrustName(companyInfoMap.get(trustId) != null ? companyInfoMap.get(trustId).getCompanyShortName() : null);
+                privatelyFundBaseInfoVO.setTrustFullName(companyInfoMap.get(trustId) != null ? companyInfoMap.get(trustId).getCompanyName() : null);
+                privatelyFundBaseInfoVO.setCustodianName(companyInfoMap.get(custodianId) != null ? companyInfoMap.get(custodianId).getCompanyName() : null);
+                privatelyFundBaseInfoVO.setAdvisorName(companyInfoMap.get(advisorId) != null ? companyInfoMap.get(advisorId).getCompanyShortName() : null);
+            }
+        }
         //处理基金策略
+        Integer strategy = fundInfo.getStrategy();
+        Integer subStrategy = fundInfo.getSubstrategy();
+        Integer thirdStrategy = fundInfo.getThirdStrategy();
+        privatelyFundBaseInfoVO.setStrategy(StrategyHandleUtils.getStrategyById(strategy).getStrategyNameDesc());
+        privatelyFundBaseInfoVO.setSubstrategy(StrategyHandleUtils.getStrategyById(subStrategy).getStrategyNameDesc());
+        privatelyFundBaseInfoVO.setThirdStrategy(StrategyHandleUtils.getStrategyById(thirdStrategy).getStrategyNameDesc());
         return privatelyFundBaseInfoVO;
     }
 }

+ 10 - 0
src/main/java/com/smppw/analysis/domain/dataobject/PrivatelyFundBaseInfoDo.java

@@ -30,6 +30,11 @@ public class PrivatelyFundBaseInfoDo {
     private String fundTypeValue;
 
     /**
+     * 基金id
+     */
+    private String fundType;
+
+    /**
      * 基金经理
      */
     private String fundManager;
@@ -102,6 +107,11 @@ public class PrivatelyFundBaseInfoDo {
     /**
      * 托管银行
      */
+    private String custodianId;
+
+    /**
+     * 托管银行
+     */
     private String custodianName;
 
     /**

+ 2 - 1
src/main/resources/mapping/core/FundInformationMapper.xml

@@ -406,7 +406,8 @@
                t1.fund_short_name as fundShortName,
                t1.fund_name       as fundName,
                t1.fund_type       as fundType,
-               t1.register_date   as registerDate,
+               t1.register_number   as registerNumber,
+               t1.inception_date   as inceptionDate,
                t2.first_strategy  as strategy,
                t2.second_strategy as substrategy,
                t2.third_strategy  as thirdStrategy,