From 1bf73bd6615d9ae9b3059f598958d784d6106f29 Mon Sep 17 00:00:00 2001
From: zhangyh <zhangyahui@wealthgrow.cn>
Date: Wed, 3 Mar 2021 15:00:55 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8C=87=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../impl/ProductPrivateServiceImpl.java       | 56 +++----------------
 .../fund/service/impl/ProductServiceImpl.java | 12 ++--
 2 files changed, 15 insertions(+), 53 deletions(-)

diff --git a/src/main/java/com/tanpu/fund/service/impl/ProductPrivateServiceImpl.java b/src/main/java/com/tanpu/fund/service/impl/ProductPrivateServiceImpl.java
index 631a810..3d0535e 100644
--- a/src/main/java/com/tanpu/fund/service/impl/ProductPrivateServiceImpl.java
+++ b/src/main/java/com/tanpu/fund/service/impl/ProductPrivateServiceImpl.java
@@ -5,6 +5,7 @@ import com.github.pagehelper.page.PageMethod;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import com.tanpu.common.enums.Constant;
+import com.tanpu.common.enums.product.ProductEnums;
 import com.tanpu.common.model.Page;
 import com.tanpu.common.model.Pageable;
 import com.tanpu.common.model.product.FundInfoVO;
@@ -12,47 +13,13 @@ import com.tanpu.common.model.product.req.ExternalReq;
 import com.tanpu.common.model.product.req.NetReq;
 import com.tanpu.common.model.product.req.ProductInfoReq;
 import com.tanpu.common.model.product.req.ProductListReq;
-import com.tanpu.common.model.product.resp.BonusRatioVO;
-import com.tanpu.common.model.product.resp.DynamicRetreatVO;
-import com.tanpu.common.model.product.resp.FundCompanyVO;
-import com.tanpu.common.model.product.resp.FundInfoSimpleListResp;
-import com.tanpu.common.model.product.resp.FundManagerVO;
-import com.tanpu.common.model.product.resp.FundRecordVO;
-import com.tanpu.common.model.product.resp.FundSameResp;
-import com.tanpu.common.model.product.resp.Net;
-import com.tanpu.common.model.product.resp.NetVO;
-import com.tanpu.common.model.product.resp.ProductInfoVO;
-import com.tanpu.common.model.product.resp.RiskRatingVO;
-import com.tanpu.common.model.product.resp.TrackNetVO;
-import com.tanpu.common.model.product.resp.TrackRecordVO;
-import com.tanpu.common.model.product.resp.UnitNetVO;
+import com.tanpu.common.model.product.resp.*;
 import com.tanpu.common.model.tanpuroom.Type;
 import com.tanpu.common.utils.BigDecimalUtil;
-import com.tanpu.fund.entity.generator.CompanyInfo;
-import com.tanpu.fund.entity.generator.CompanyTnaPersonnel;
-import com.tanpu.fund.entity.generator.CompanyTnaPersonnelExample;
-import com.tanpu.fund.entity.generator.FundCount;
-import com.tanpu.fund.entity.generator.FundCountExample;
-import com.tanpu.fund.entity.generator.FundDistribution;
-import com.tanpu.fund.entity.generator.FundDistributionExample;
-import com.tanpu.fund.entity.generator.FundInfo;
-import com.tanpu.fund.entity.generator.FundInfoExample;
-import com.tanpu.fund.entity.generator.FundManagerMapping;
-import com.tanpu.fund.entity.generator.FundManagerMappingExample;
-import com.tanpu.fund.entity.generator.PersonCompanyPositionMapping;
-import com.tanpu.fund.entity.generator.PersonCompanyPositionMappingExample;
-import com.tanpu.fund.entity.generator.PersonnelInfo;
-import com.tanpu.fund.entity.generator.PersonnelInfoExample;
+import com.tanpu.fund.entity.generator.*;
 import com.tanpu.fund.enums.ProTypeEnums;
 import com.tanpu.fund.feign.diagnose.FeignClientForDiagnose;
-import com.tanpu.fund.mapper.generator.CompanyInfoMapper;
-import com.tanpu.fund.mapper.generator.CompanyTnaPersonnelMapper;
-import com.tanpu.fund.mapper.generator.FundCountMapper;
-import com.tanpu.fund.mapper.generator.FundDistributionMapper;
-import com.tanpu.fund.mapper.generator.FundInfoMapper;
-import com.tanpu.fund.mapper.generator.FundManagerMappingMapper;
-import com.tanpu.fund.mapper.generator.PersonCompanyPositionMappingMapper;
-import com.tanpu.fund.mapper.generator.PersonnelInfoMapper;
+import com.tanpu.fund.mapper.generator.*;
 import com.tanpu.fund.service.ProductPrivateService;
 import com.tanpu.fund.utils.LongUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -62,12 +29,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
 import static com.tanpu.common.utils.BigDecimalUtil.multiply100;
@@ -260,7 +222,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
 
                 FundInfo info = infoMap.get(fundId);
                 vo.setFundName(info.getFundShortName());
-                vo.setRatioId(info.getPrimaryBenchmarkId());
+                vo.setRatioId(ProductEnums.IndexEnum.getValue(info.getPrimaryBenchmarkId()));
                 FundCount fundCount = fundCountMap.get(fundId);
                 if (fundCount != null) {
                     vo.setRetIncep(multiply100(fundCount.getRetIncep()));
@@ -308,7 +270,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
                 if (infoMap.get(fundId) != null) {
                     FundInfo fundInfo = infoMap.get(fundId);
                     infoVO.setFundName(fundInfo.getFundShortName());
-                    infoVO.setRatioId(fundInfo.getPrimaryBenchmarkId());
+                    infoVO.setRatioId(ProductEnums.IndexEnum.getValue(fundInfo.getPrimaryBenchmarkId()));
                     if (fundInfo.getInceptionDate() != null) {
                         infoVO.setInceptionDate(fundInfo.getInceptionDate().getTime());
                     }
@@ -430,7 +392,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
                 FundInfo info = mapFundInfo.get(fundCount.getFundId());
                 vo.setTime(info.getRegisterDate() == null ? null : info.getRegisterDate().getTime());
                 vo.setFundId(fundCount.getFundId());
-                vo.setRatioId(info.getPrimaryBenchmarkId());
+                vo.setRatioId(ProductEnums.IndexEnum.getValue(info.getPrimaryBenchmarkId()));
                 vo.setInceptionDate(info.getInceptionDate() == null ? null : info.getInceptionDate().getTime());
                 vo.setFundName(info.getFundShortName());
                 vo.setNet(new Net(fundCount.getEndDate().getTime(), BigDecimalUtil.toString(fundCount.getCumulativeNav(), 4), BigDecimalUtil.toString(fundCount.getCumulativeNav(), 4)));
@@ -457,7 +419,7 @@ public class ProductPrivateServiceImpl implements ProductPrivateService, Constan
 
                     vo1.setRet1y(multiply100(f.getRet1y()));
 
-                    vo1.setRatioId(info.getPrimaryBenchmarkId());
+                    vo1.setRatioId(ProductEnums.IndexEnum.getValue(info.getPrimaryBenchmarkId()));
 
                     return vo1;
                 }).collect(Collectors.toList()));
diff --git a/src/main/java/com/tanpu/fund/service/impl/ProductServiceImpl.java b/src/main/java/com/tanpu/fund/service/impl/ProductServiceImpl.java
index f2222d8..94e5d76 100644
--- a/src/main/java/com/tanpu/fund/service/impl/ProductServiceImpl.java
+++ b/src/main/java/com/tanpu/fund/service/impl/ProductServiceImpl.java
@@ -559,7 +559,7 @@ public class ProductServiceImpl implements ProductService, Constant {
 
         FundInfo fundInfo = infoMap.get(f.getFundId());
         netVO.setProductName(fundInfo.getFundShortName());
-        netVO.setRatioId(fundInfo.getPrimaryBenchmarkId());
+        netVO.setRatioId(ProductEnums.IndexEnum.getValue(fundInfo.getPrimaryBenchmarkId()));
 
         netVO.setAboutYearProfit(multiply100(f.getRet6m()));
         netVO.setWeekProfit(multiply100(f.getRet1w()));
@@ -691,7 +691,7 @@ public class ProductServiceImpl implements ProductService, Constant {
                 if (infoMap.get(fundId) != null) {
                     FundInfo fundInfo = infoMap.get(fundId);
                     infoVO.setFundName(fundInfo.getFundShortName());
-                    infoVO.setRatioId(fundInfo.getPrimaryBenchmarkId());
+                    infoVO.setRatioId(ProductEnums.IndexEnum.getValue(fundInfo.getPrimaryBenchmarkId()));
                 }
                 infoVO.setRetIncep(multiply100(l.getRetIncep()));
                 infoVO.setYearProfit(multiply100(l.getRetIncepA()));
@@ -875,7 +875,7 @@ public class ProductServiceImpl implements ProductService, Constant {
 
                 FundInfo info = infoMap.get(fundId);
                 vo.setFundName(info.getFundShortName());
-                vo.setRatioId(info.getPrimaryBenchmarkId());
+                vo.setRatioId(ProductEnums.IndexEnum.getValue(info.getPrimaryBenchmarkId()));
                 FundCount fundCount = fundCountMap.get(fundId);
                 if (fundCount != null) {
                     vo.setRetIncep(multiply100(fundCount.getRetIncep()));
@@ -1067,7 +1067,7 @@ public class ProductServiceImpl implements ProductService, Constant {
                 FundInfo info = mapFundInfo.get(fundCount.getFundId());
                 vo.setTime(info.getRegisterDate() == null ? null : info.getRegisterDate().getTime());
                 vo.setFundId(fundCount.getFundId());
-                vo.setRatioId(info.getPrimaryBenchmarkId());
+                vo.setRatioId(ProductEnums.IndexEnum.getValue(info.getPrimaryBenchmarkId()));
                 vo.setInceptionDate(info.getInceptionDate() == null ? null : info.getInceptionDate().getTime());
                 vo.setFundName(info.getFundShortName());
                 vo.setNet(new Net(fundCount.getEndDate().getTime(), BigDecimalUtil.toString(fundCount.getCumulativeNav(), 4), BigDecimalUtil.toString(fundCount.getCumulativeNav(), 4)));
@@ -1082,7 +1082,7 @@ public class ProductServiceImpl implements ProductService, Constant {
                     vo1.setYearProfit(yearProfit == null ? "0" : yearProfit);
                     vo1.setFundName(mapFundInfo.get(f.getFundId()).getFundShortName());
                     vo1.setFundId(f.getFundId());
-                    vo1.setRatioId(info.getPrimaryBenchmarkId());
+                    vo1.setRatioId(ProductEnums.IndexEnum.getValue(info.getPrimaryBenchmarkId()));
                     return vo1;
                 }).collect(Collectors.toList()));
             }
@@ -1192,7 +1192,7 @@ public class ProductServiceImpl implements ProductService, Constant {
             FundInfo fundInfo = fundInfoMap.get(fundId);
 
             // 指数id
-            vo.setRatioId(fundInfo.getPrimaryBenchmarkId());
+            vo.setRatioId(ProductEnums.IndexEnum.getValue(fundInfo.getPrimaryBenchmarkId()));
             vo.setProductName(fundInfo.getFundShortName());
             // getProductCode(indexIdMap, vo, fundInfo);
             vo.setOpenDay(fundInfo.getOpenDay());
-- 
2.18.1