|
@@ -4,15 +4,16 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.ListUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
+import com.smppw.analysis.application.dto.position.*;
|
|
|
+import com.smppw.analysis.domain.dao.PubliclyFundPositionDao;
|
|
|
+import com.smppw.analysis.domain.dataobject.PubliclyFundStockChangeDO;
|
|
|
+import com.smppw.analysis.domain.dataobject.SwSecIndustryInfoDO;
|
|
|
import com.smppw.analysis.domain.dto.position.*;
|
|
|
import com.smppw.analysis.domain.dto.position.stock.*;
|
|
|
import com.smppw.analysis.domain.manager.position.BizHandler;
|
|
|
import com.smppw.analysis.domain.manager.position.BizHandlerFactory;
|
|
|
import com.smppw.analysis.domain.manager.position.stock.BarraSensitivityComponent;
|
|
|
import com.smppw.analysis.domain.manager.position.stock.IndustryAllocationPreferenceComponent;
|
|
|
-import com.smppw.analysis.domain.dao.PubliclyFundPositionDao;
|
|
|
-import com.smppw.analysis.domain.dataobject.PubliclyFundStockChangeDO;
|
|
|
-import com.smppw.analysis.domain.dataobject.SwSecIndustryInfoDO;
|
|
|
import com.smppw.analysis.domain.persistence.BaseUnderlyingMapper;
|
|
|
import com.smppw.common.pojo.ValueLabelVO;
|
|
|
import com.smppw.common.pojo.dto.NewDateValue;
|
|
@@ -60,7 +61,8 @@ public class StockPositionAnalysis {
|
|
|
this.industryAllocationPreference = industryAllocationPreference;
|
|
|
}
|
|
|
|
|
|
- public List<MajorChangeVO> getMajorChangeList(MajorChangeParams params) {
|
|
|
+ public List<MajorChangeVO> getMajorChangeList(MajorChangeReq req) {
|
|
|
+ MajorChangeParams params = req.convert();
|
|
|
List<SwSecIndustryInfoDO> industryList = this.baseUnderlyingMapper.querySecIndustryInfo();
|
|
|
List<MajorChangeVO> resultList = ListUtil.list(false);
|
|
|
List<PubliclyFundStockChangeDO> dataList = this.fundPositionBaseService.mfStockChangeList(params.getFundId(),
|
|
@@ -83,7 +85,8 @@ public class StockPositionAnalysis {
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
- public Map<String, Object> getConcentration(ConcentrationParams params) {
|
|
|
+ public Map<String, Object> getConcentration(ConcentrationReq req) {
|
|
|
+ ConcentrationParams params = req.convert();
|
|
|
Map<String, Object> dataset = MapUtil.newHashMap();
|
|
|
BizHandler<ConcentrationParams, List<ConcentrationVO>> bizHandler = this.factor.getBizHandlerInstance(STOCK_CONCENTRATION);
|
|
|
List<ConcentrationVO> dataList = bizHandler.bizHandle(params);
|
|
@@ -119,7 +122,8 @@ public class StockPositionAnalysis {
|
|
|
.put("productNameMapping", POSITION_NAME).put("table", dataList).build();
|
|
|
}
|
|
|
|
|
|
- public List<ChangeNumberVO> getChangeNumber(ChangeNumberParams params) {
|
|
|
+ public List<ChangeNumberVO> getChangeNumber(ChangeNumberReq req) {
|
|
|
+ ChangeNumberParams params = req.convert();
|
|
|
BizHandler<ChangeNumberParams, List<ChangeNumberVO>> bizHandler = this.factor.getBizHandlerInstance(CHANGE_NUMBER);
|
|
|
List<ChangeNumberVO> dataList = bizHandler.bizHandle(params);
|
|
|
if (CollUtil.isEmpty(dataList)) {
|
|
@@ -128,13 +132,15 @@ public class StockPositionAnalysis {
|
|
|
return dataList;
|
|
|
}
|
|
|
|
|
|
- public Map<String, Object> getIndustryAllocation(StockAllocationParams params) {
|
|
|
+ public Map<String, Object> getIndustryAllocation(StockAllocationReq req) {
|
|
|
+ StockAllocationParams params = req.convert();
|
|
|
BizHandler<StockAllocationParams, List<StockAllocationVO>> bizHandler = this.factor.getBizHandlerInstance(INDUSTRY_ALLOCATION);
|
|
|
List<StockAllocationVO> dataList = bizHandler.bizHandle(params);
|
|
|
return this.convertDataset(dataList);
|
|
|
}
|
|
|
|
|
|
- public Map<String, Object> getIndustryAllocationPreference(StockAllocationParams params) {
|
|
|
+ public Map<String, Object> getIndustryAllocationPreference(StockAllocationReq req) {
|
|
|
+ StockAllocationParams params = req.convert();
|
|
|
List<IndustryAllocationPreferenceVO> dataList = this.industryAllocationPreference.bizHandle(params);
|
|
|
if (CollUtil.isEmpty(dataList)) {
|
|
|
return MapUtil.empty();
|
|
@@ -153,13 +159,15 @@ public class StockPositionAnalysis {
|
|
|
return MapUtil.<String, Object>builder().put("dataset", dataset).put("productNameMapping", industryList).build();
|
|
|
}
|
|
|
|
|
|
- public Map<String, Object> getStyleAllocation(StockAllocationParams params) {
|
|
|
+ public Map<String, Object> getStyleAllocation(StockAllocationReq req) {
|
|
|
+ StockAllocationParams params = req.convert();
|
|
|
BizHandler<StockAllocationParams, List<StockAllocationVO>> bizHandler = this.factor.getBizHandlerInstance(STYLE_ALLOCATION);
|
|
|
List<StockAllocationVO> dataList = bizHandler.bizHandle(params);
|
|
|
return this.convertDataset(dataList);
|
|
|
}
|
|
|
|
|
|
- public Map<String, Object> getLiquidityAllocation(StockAllocationParams params) {
|
|
|
+ public Map<String, Object> getLiquidityAllocation(StockAllocationReq req) {
|
|
|
+ StockAllocationParams params = req.convert();
|
|
|
BizHandler<StockAllocationParams, List<StockAllocationVO>> bizHandler = this.factor.getBizHandlerInstance(LIQUIDITY_ALLOCATION);
|
|
|
List<StockAllocationVO> dataList = bizHandler.bizHandle(params);
|
|
|
List<ValueLabelVO> categoryList = Arrays.stream(PositionLiquidityEnum.values())
|
|
@@ -167,41 +175,13 @@ public class StockPositionAnalysis {
|
|
|
return this.convertDataset(dataList, categoryList);
|
|
|
}
|
|
|
|
|
|
- public Map<String, Object> getBarraSensitivity(BarraSensitivityParams params) {
|
|
|
+ public Map<String, Object> getBarraSensitivity(BarraSensitivityReq req) {
|
|
|
+ BarraSensitivityParams params = req.convert();
|
|
|
return this.barraSensitivity.bizHandle(params);
|
|
|
}
|
|
|
|
|
|
- public Map<String, Object> getRiskExposure(RiskExposureParams params) {
|
|
|
- BizHandler<RiskExposureParams, List<RiskExposureVO>> bizHandler = this.factor.getBizHandlerInstance(RISK_EXPOSURE);
|
|
|
- List<RiskExposureVO> dataList = bizHandler.bizHandle(params);
|
|
|
- if (CollUtil.isEmpty(dataList)) {
|
|
|
- return MapUtil.empty();
|
|
|
- }
|
|
|
- Map<String, Object> dataset = MapUtil.newHashMap();
|
|
|
- for (RiskExposureEnum value : RiskExposureEnum.values()) {
|
|
|
- List<MarketValueRatio> tempList = ListUtil.list(true);
|
|
|
- for (RiskExposureVO temp : dataList) {
|
|
|
- RefMarketValueRatio ratio = temp.getMvr().stream().filter(e -> value.name()
|
|
|
- .equals(e.getRef().getValue())).findFirst().orElse(null);
|
|
|
- if (ratio == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- MarketValueRatio mvr = new MarketValueRatio();
|
|
|
- mvr.setDate(temp.getDate());
|
|
|
- mvr.setMarketValue(ratio.getMarketValue());
|
|
|
- mvr.setRatio(ratio.getRatio());
|
|
|
- tempList.add(mvr);
|
|
|
- }
|
|
|
- tempList.sort(Comparator.comparing(MarketValueRatio::getDate));
|
|
|
- dataset.put(value.name(), tempList);
|
|
|
- }
|
|
|
- List<ValueLabelVO> collect = Arrays.stream(RiskExposureEnum.values()).map(e -> new ValueLabelVO(e.name(), e.getDesc()))
|
|
|
- .collect(Collectors.toList());
|
|
|
- return MapUtil.<String, Object>builder().put("dataset", dataset)
|
|
|
- .put("productNameMapping", collect).put("table", dataList).build();
|
|
|
- }
|
|
|
-
|
|
|
- public Map<String, Object> getPerformanceAttribution(StockPerformanceAttributionParams params) {
|
|
|
+ public Map<String, Object> getPerformanceAttribution(StockPerformanceAttributionReq req) {
|
|
|
+ StockPerformanceAttributionParams params = req.convert();
|
|
|
boolean ifAnnualized = params.getIfAnnualized() != null && params.getIfAnnualized();
|
|
|
List<ValueLabelVO> effects = ListUtil.list(true);
|
|
|
effects.add(new ValueLabelVO("allocation", "配置效应"));
|