|
@@ -6,12 +6,10 @@ import cn.hutool.core.collection.ListUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
import cn.hutool.core.text.CharSequenceUtil;
|
|
|
+import cn.hutool.core.util.NumberUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.smppw.analysis.application.dto.info.*;
|
|
|
-import com.smppw.analysis.domain.dataobject.FundArchivesInfoDO;
|
|
|
-import com.smppw.analysis.domain.dataobject.FundFeeDo;
|
|
|
-import com.smppw.analysis.domain.dataobject.ManualFundNoticeInfoDO;
|
|
|
-import com.smppw.analysis.domain.dataobject.FundSimilarDo;
|
|
|
+import com.smppw.analysis.domain.dataobject.*;
|
|
|
import com.smppw.analysis.domain.dto.info.*;
|
|
|
import com.smppw.analysis.domain.dto.performance.IndicatorParams;
|
|
|
import com.smppw.analysis.domain.manager.performance.Performance;
|
|
@@ -23,11 +21,11 @@ import com.smppw.analysis.domain.service.NavService;
|
|
|
import com.smppw.analysis.infrastructure.utils.StringUtil;
|
|
|
import com.smppw.common.pojo.IStrategy;
|
|
|
import com.smppw.common.pojo.NewSubStrategy;
|
|
|
+import com.smppw.common.pojo.ValueLabelVO;
|
|
|
import com.smppw.common.pojo.dto.DateValue;
|
|
|
import com.smppw.common.pojo.dto.calc.IndicatorCalcPropertyDto;
|
|
|
import com.smppw.common.pojo.dto.calc.IndicatorCalcTimeRangeDto;
|
|
|
import com.smppw.common.pojo.enums.*;
|
|
|
-import com.smppw.constants.Consts;
|
|
|
import com.smppw.constants.DateConst;
|
|
|
import com.smppw.core.IndicatorService;
|
|
|
import com.smppw.utils.BigDecimalUtils;
|
|
@@ -39,6 +37,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@@ -300,4 +299,77 @@ public class FundInfoService {
|
|
|
return fundFeeDo;
|
|
|
}
|
|
|
|
|
|
+ public ManualFundFeeInfoVO getMfFundFee(String fundId) {
|
|
|
+ List<ManualFundFeeDo> dataList = this.baseInfoService.getManualFundFee(fundId);
|
|
|
+ ManualFundFeeInfoVO result = new ManualFundFeeInfoVO();
|
|
|
+ // 数据库 费率 类型与中文映射
|
|
|
+ Map<String, String> typeMapper = MapUtil.builder("10210", "认购金额").put("11210", "申购金额").put("11010", "申购金额")
|
|
|
+ .put("12200", "持有期限").put("12000", "持有期限").build();
|
|
|
+ // 费率类型 与 单位映射
|
|
|
+ Map<String, String> unitMapper = MapUtil.builder("10210", "万元").put("11210", "万元").put("11010", "万元")
|
|
|
+ .put("12200", "日").put("12000", "日").build();
|
|
|
+ // 记录映射函数,返回一个包含最大最小的范围
|
|
|
+ Function<ManualFundFeeDo, ValueLabelVO> function = e -> {
|
|
|
+ ValueLabelVO vo = new ValueLabelVO();
|
|
|
+ vo.setValue(e.getChargeRateDes());
|
|
|
+ String label = typeMapper.get(e.getChargeRateType());
|
|
|
+ // 最小值不为0和null时,设置为起始数据
|
|
|
+ if (e.getStDivStand1() != null && !Double.valueOf(0.0d).equals(e.getStDivStand1())) {
|
|
|
+ label = NumberUtil.roundStr(e.getStDivStand1(), 0) + unitMapper.get(e.getChargeRateType()) + " <= " + label;
|
|
|
+ }
|
|
|
+ // 最大值不为null时设置截止范围数据
|
|
|
+ if (e.getEnDivStand1() != null) {
|
|
|
+ label += " < " + NumberUtil.roundStr(e.getEnDivStand1(), 0) + unitMapper.get(e.getChargeRateType());
|
|
|
+ }
|
|
|
+ vo.setLabel(label);
|
|
|
+ return vo;
|
|
|
+ };
|
|
|
+ // 认购费
|
|
|
+ List<ValueLabelVO> subscriptionFee = this.handleFee(dataList, "10210", function);
|
|
|
+ result.setSubscriptionFee(subscriptionFee);
|
|
|
+ // 申购费,先取场外
|
|
|
+ List<ValueLabelVO> applyFee = this.handleFee(dataList, "11210", function);
|
|
|
+ if (applyFee.isEmpty()) {
|
|
|
+ applyFee = this.handleFee(dataList, "11010", function);
|
|
|
+ }
|
|
|
+ result.setApplyFee(applyFee);
|
|
|
+ // 赎回费,先取场外
|
|
|
+ List<ValueLabelVO> redemptionFee = this.handleFee(dataList, "12200", function);
|
|
|
+ if (redemptionFee.isEmpty()) {
|
|
|
+ redemptionFee = this.handleFee(dataList, "12000", function);
|
|
|
+ }
|
|
|
+ result.setRedemptionFee(redemptionFee);
|
|
|
+ // 管理费、托管费和营销费
|
|
|
+ result.setManagementFeeTrust(this.handleOneFee(dataList, "15000", ManualFundFeeDo::getChargeRateDes));
|
|
|
+ result.setManagementFeeBank(this.handleOneFee(dataList, "16000", ManualFundFeeDo::getChargeRateDes));
|
|
|
+ result.setSaleFee(this.handleOneFee(dataList, "19000", ManualFundFeeDo::getChargeRateDes));
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 费率处理工具,返回一个列表
|
|
|
+ *
|
|
|
+ * @param dataList 费率数据
|
|
|
+ * @param type 过滤的关键字
|
|
|
+ * @param function 转换函数
|
|
|
+ * @param <T> 类型参数
|
|
|
+ * @return /
|
|
|
+ */
|
|
|
+ private <T> List<T> handleFee(List<ManualFundFeeDo> dataList, String type, Function<ManualFundFeeDo, T> function) {
|
|
|
+ return dataList.stream().filter(e -> type.equals(e.getChargeRateType())).map(function).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 费率处理工具,返回一个对象
|
|
|
+ *
|
|
|
+ * @param dataList 费率数据
|
|
|
+ * @param type 过滤的关键字
|
|
|
+ * @param function 转换函数
|
|
|
+ * @param <T> 类型参数
|
|
|
+ * @return /
|
|
|
+ */
|
|
|
+ private <T> T handleOneFee(List<ManualFundFeeDo> dataList, String type, Function<ManualFundFeeDo, T> function) {
|
|
|
+ return this.handleFee(dataList, type, function).stream().findFirst().orElse(null);
|
|
|
+ }
|
|
|
+
|
|
|
}
|