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

基金bug修复

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