Commit 3e88e890 authored by 张亚辉's avatar 张亚辉

基金bug修复

parent ad25b855
...@@ -779,10 +779,14 @@ public class ProductServiceImpl implements ProductService, Constant { ...@@ -779,10 +779,14 @@ public class ProductServiceImpl implements ProductService, Constant {
if (i < fundNavs.size() - 1) { if (i < fundNavs.size() - 1) {
FundNav pre = fundNavs.get(i + 1); FundNav pre = fundNavs.get(i + 1);
if (pre.getNav().compareTo(BigDecimal.ZERO) == 1) { if (pre.getCumulativeNavWithdrawal() != null && f.getCumulativeNavWithdrawal() != null) {
BigDecimal dailyIncrease = f.getNav().subtract(pre.getNav()).divide(pre.getNav(), 4, BigDecimal.ROUND_HALF_UP); if (pre.getCumulativeNavWithdrawal().compareTo(BigDecimal.ZERO) == 1) {
BigDecimal dailyIncrease = f.getCumulativeNavWithdrawal().subtract(pre.getCumulativeNavWithdrawal()).divide(pre.getCumulativeNavWithdrawal(), 4, BigDecimal.ROUND_HALF_UP);
vo.setDailyIncrease(BigDecimalUtil.multiply100(dailyIncrease)); vo.setDailyIncrease(BigDecimalUtil.multiply100(dailyIncrease));
} }
} else {
vo.setDailyIncrease("--");
}
} }
} }
...@@ -878,9 +882,13 @@ public class ProductServiceImpl implements ProductService, Constant { ...@@ -878,9 +882,13 @@ public class ProductServiceImpl implements ProductService, Constant {
String fundId = managerMappingList.get(0).getFundId(); String fundId = managerMappingList.get(0).getFundId();
vo.setId(fundId); vo.setId(fundId);
if (infoMap != null) {
if (infoMap.containsKey(fundId)) {
FundInfo info = infoMap.get(fundId); FundInfo info = infoMap.get(fundId);
vo.setFundName(info.getFundShortName()); vo.setFundName(info.getFundShortName());
vo.setRatioId(ProductEnums.IndexEnum.getValue(info.getPrimaryBenchmarkId())); vo.setRatioId(ProductEnums.IndexEnum.getValue(info.getPrimaryBenchmarkId()));
}
FundCount fundCount = fundCountMap.get(fundId); FundCount fundCount = fundCountMap.get(fundId);
if (fundCount != null) { if (fundCount != null) {
vo.setRetIncep(multiply100(fundCount.getRetIncep())); vo.setRetIncep(multiply100(fundCount.getRetIncep()));
...@@ -893,6 +901,7 @@ public class ProductServiceImpl implements ProductService, Constant { ...@@ -893,6 +901,7 @@ public class ProductServiceImpl implements ProductService, Constant {
vo.setTime(timeLong(fundInfo.getRegisterDate())); vo.setTime(timeLong(fundInfo.getRegisterDate()));
vo.setInceptionDate(timeLong(fundInfo.getInceptionDate())); vo.setInceptionDate(timeLong(fundInfo.getInceptionDate()));
} }
}
// 设置代表基金id 其他基金信息 // 设置代表基金id 其他基金信息
getDelegateById(i.getId(), map, infoMap, fundCountMap, vo); getDelegateById(i.getId(), map, infoMap, fundCountMap, vo);
} }
...@@ -1410,10 +1419,9 @@ public class ProductServiceImpl implements ProductService, Constant { ...@@ -1410,10 +1419,9 @@ public class ProductServiceImpl implements ProductService, Constant {
detailResp.setRegisterNumber(fundInfo.getRegisterNumber()); detailResp.setRegisterNumber(fundInfo.getRegisterNumber());
if (CollectionUtils.isNotEmpty(fundCountList)) { if (CollectionUtils.isNotEmpty(fundCountList)) {
detailResp.setNear1YearProfit(BigDecimalUtil.toString(fundCountList.get(0).getRet1y(), 2)); detailResp.setNear1YearProfit(BigDecimalUtil.multiply100(fundCountList.get(0).getRet1y()));
detailResp.setRet1y(BigDecimalUtil.toString(fundCountList.get(0).getRet1y(), 2)); detailResp.setRet1y(BigDecimalUtil.multiply100(fundCountList.get(0).getRet1y()));
detailResp.setRetYtd(BigDecimalUtil.toString(fundCountList.get(0).getRetYtd(), 2)); detailResp.setRetYtd(BigDecimalUtil.multiply100(fundCountList.get(0).getRetYtd()));
} }
//子策略名称 //子策略名称
...@@ -1474,15 +1482,41 @@ public class ProductServiceImpl implements ProductService, Constant { ...@@ -1474,15 +1482,41 @@ public class ProductServiceImpl implements ProductService, Constant {
Collectors.toCollection(() -> Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(IfaImportedFundNav::getPriceDate))), ArrayList::new)); new TreeSet<>(Comparator.comparing(IfaImportedFundNav::getPriceDate))), ArrayList::new));
return new Page<>(page, startPage.getTotal(), fundNavs.stream() //计算 日涨幅=(今日净值-前一日净值)/前一日净值
.sorted(Comparator.comparing(IfaImportedFundNav::getPriceDate).reversed()) List<TrackNetVO> list = new ArrayList<>();
.map(f -> { for (int i = 0; i < fundNavs.size(); i++) {
IfaImportedFundNav f = fundNavs.get(i);
TrackNetVO vo = new TrackNetVO(); TrackNetVO vo = new TrackNetVO();
vo.setDailyIncrease("0.00");
//日涨幅
{
if (i < fundNavs.size() - 1) {
IfaImportedFundNav pre = fundNavs.get(i + 1);
if (pre.getCumulativeNav() != null && f.getCumulativeNav() != null) {
if (pre.getCumulativeNav().compareTo(BigDecimal.ZERO) == 1) {
BigDecimal dailyIncrease = f.getCumulativeNav().subtract(pre.getCumulativeNav()).divide(pre.getCumulativeNav(), 4, BigDecimal.ROUND_HALF_UP);
vo.setDailyIncrease(BigDecimalUtil.multiply100(dailyIncrease));
}
} else {
vo.setDailyIncrease("--");
}
}
}
vo.setPriceDate(DateUtil.format(f.getPriceDate(), DatePattern.NORM_DATE_PATTERN)); vo.setPriceDate(DateUtil.format(f.getPriceDate(), DatePattern.NORM_DATE_PATTERN));
vo.setNav(BigDecimalUtil.toString(f.getNav(), 4)); vo.setNav(BigDecimalUtil.toString(f.getNav(), 4));
vo.setCumulativeNav(BigDecimalUtil.toString(f.getCumulativeNav(), 4)); vo.setCumulativeNav(BigDecimalUtil.toString(f.getCumulativeNav(), 4));
return vo; vo.setCumulativeNavWithdrawal(BigDecimalUtil.toString(f.getCumulativeNav(), 4));
}).collect(Collectors.toList())); list.add(vo);
}
if (list.size() > page.getPageSize()) {
//移除最后一条
list.remove(list.size() - 1);
}
return new Page<>(page, startPage.getTotal(), list);
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment