Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tamp_fund
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周鹏
tamp_fund
Commits
3e88e890
Commit
3e88e890
authored
Mar 18, 2021
by
张亚辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
基金bug修复
parent
ad25b855
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
29 deletions
+63
-29
ProductServiceImpl.java
.../java/com/tanpu/fund/service/impl/ProductServiceImpl.java
+63
-29
No files found.
src/main/java/com/tanpu/fund/service/impl/ProductServiceImpl.java
View file @
3e88e890
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment