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
3e44d07d
Commit
3e44d07d
authored
Mar 22, 2021
by
zp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge
parent
b8a18a16
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
31 deletions
+44
-31
ProductApi.java
src/main/java/com/tanpu/fund/api/ProductApi.java
+1
-1
ProductServiceImpl.java
.../java/com/tanpu/fund/service/impl/ProductServiceImpl.java
+43
-30
No files found.
src/main/java/com/tanpu/fund/api/ProductApi.java
View file @
3e44d07d
...
...
@@ -168,7 +168,7 @@ public interface ProductApi {
CommonResp
<
List
<
FundSameResp
>>
querySamefund
(
@RequestParam
(
"fundId"
)
String
fundId
);
@ApiOperation
(
"理财师净值导入"
)
@
Ge
tMapping
(
"/ifa/net/import"
)
@
Pos
tMapping
(
"/ifa/net/import"
)
CommonResp
<
List
<
FundNavMessage
>>
importNetInfo
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
value
=
"fundId"
,
required
=
false
)
String
fundId
);
...
...
src/main/java/com/tanpu/fund/service/impl/ProductServiceImpl.java
View file @
3e44d07d
package
com
.
tanpu
.
fund
.
service
.
impl
;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.NumberUtil
;
import
cn.hutool.poi.excel.ExcelReader
;
...
...
@@ -1690,9 +1691,13 @@ public class ProductServiceImpl implements ProductService, Constant {
List
<
List
<
Object
>>
read
=
req
.
getFundNavMessages
().
stream
().
map
(
ls
->
{
List
<
Object
>
linkedList
=
new
LinkedList
<>();
linkedList
.
add
(
ls
.
getPriceDate
()
!=
null
?
ls
.
getPriceDate
().
getTime
()
:
""
);
if
(
StringUtils
.
isNotEmpty
(
ls
.
getPrice_date
()))
{
linkedList
.
add
(
DateTime
.
of
(
ls
.
getPrice_date
(),
"yyyy-MM-dd"
).
getTime
());
}
else
{
linkedList
.
add
(
""
);
}
linkedList
.
add
(
ls
.
getNav
());
linkedList
.
add
(
ls
.
getCumulative
N
av
());
linkedList
.
add
(
ls
.
getCumulative
_n
av
());
return
linkedList
;
}).
collect
(
Collectors
.
toList
());
...
...
@@ -1931,7 +1936,8 @@ public class ProductServiceImpl implements ProductService, Constant {
}
newResultMessage
.
sort
(
Comparator
.
comparing
(
FundNavMessage:
:
getPriceDate
).
reversed
());
return
CommonResp
.
error
(
"9999"
,
"数据错误,请您重新核对"
,
newResultMessage
);
//return CommonResp.error("0003", "数据错误,请您重新核对", newResultMessage);
return
CommonResp
.
success
(
newResultMessage
);
}
private
static
final
BigDecimal
compare02
=
new
BigDecimal
(
"0.2"
);
...
...
@@ -1939,11 +1945,6 @@ public class ProductServiceImpl implements ProductService, Constant {
@Override
public
CommonResp
<
List
<
FundNavMessage
>>
importNet
(
MultipartFile
file
,
String
fundId
)
{
FundInfo
fundInfo
=
this
.
fundInfoMapper
.
selectByPrimaryKey
(
fundId
);
if
(
fundInfo
==
null
)
{
return
CommonResp
.
error
(
"获取不到基金信息"
);
}
Map
<
Long
,
IfaImportedFundNav
>
ifaNavMap
;
if
(
StringUtils
.
isEmpty
(
fundId
))
{
ifaNavMap
=
new
HashMap
<>(
0
);
...
...
@@ -1957,11 +1958,11 @@ public class ProductServiceImpl implements ProductService, Constant {
int
size
=
reader
.
readAll
().
size
();
List
<
FundNavMessage
>
resultMessage
=
new
ArrayList
<>(
size
*
2
);
AtomicBoolean
errorStatus
=
new
AtomicBoolean
(
false
);
List
<
List
<
Object
>>
read
=
reader
.
read
(
2
,
size
-
1
);
List
<
List
<
Object
>>
read
=
reader
.
read
(
1
,
size
);
return
getListCommonResp
(
ifaNavMap
,
resultMessage
,
errorStatus
,
read
);
}
catch
(
IO
Exception
e
)
{
return
CommonResp
.
error
(
"文件格式错误,无法读取,请您重新下载导入模板"
);
}
catch
(
Exception
e
)
{
return
CommonResp
.
error
(
"
0004"
,
"
文件格式错误,无法读取,请您重新下载导入模板"
);
}
}
...
...
@@ -1993,15 +1994,27 @@ public class ProductServiceImpl implements ProductService, Constant {
read
.
forEach
(
ls
->
{
boolean
errorRow
=
false
;
FundNavMessage
message
=
new
FundNavMessage
();
String
row1
=
(
ls
.
get
(
0
)
+
""
).
trim
();
if
(
NumberUtil
.
isNumber
(
row1
))
{
String
row1
=
null
,
row2
,
row3
;
if
(
ls
.
get
(
0
)
==
null
)
{
errorRow
=
true
;
message
.
setMessage
(
"[
日期格式错误
]"
);
message
.
setMessage
(
"[
净值日期不能为空
]"
);
}
else
{
message
.
setPriceDate
(
DateUtil
.
date
(
Long
.
parseLong
(
row1
)));
row1
=
(
ls
.
get
(
0
)
+
""
).
trim
();
Date
date
=
null
;
try
{
date
=
DateUtil
.
parseDate
(
row1
);
}
catch
(
Exception
e
)
{
}
if
(
date
==
null
)
{
errorRow
=
true
;
message
.
setMessage
(
"[净值日期格式错误]"
);
}
else
{
message
.
setPrice_date
(
row1
);
message
.
setPriceDate
(
DateUtil
.
parseDate
(
row1
));
}
}
String
row2
=
(
ls
.
get
(
1
)
+
""
).
trim
();
if
(!
BigDecimalValidator
.
getInstance
().
isValid
(
row2
))
{
if
(
ls
.
get
(
1
)
==
null
||
!
BigDecimalValidator
.
getInstance
().
isValid
(
ls
.
get
(
1
)
+
""
))
{
errorRow
=
true
;
if
(
StringUtils
.
isEmpty
(
message
.
getMessage
()))
{
message
.
setMessage
(
"[单位净值为空或格式错误]"
);
...
...
@@ -2009,11 +2022,11 @@ public class ProductServiceImpl implements ProductService, Constant {
message
.
setMessage
(
message
.
getMessage
()
+
",[单位净值为空或格式错误]"
);
}
}
else
{
row2
=
(
ls
.
get
(
1
)
+
""
).
trim
();
message
.
setNav
(
new
BigDecimal
(
row2
));
}
String
row3
=
(
ls
.
get
(
2
)
+
""
).
trim
();
if
(!
BigDecimalValidator
.
getInstance
().
isValid
(
row3
))
{
if
(
ls
.
get
(
2
)
==
null
||
!
BigDecimalValidator
.
getInstance
().
isValid
(
ls
.
get
(
2
)
+
""
))
{
errorRow
=
true
;
if
(
StringUtils
.
isEmpty
(
message
.
getMessage
()))
{
message
.
setMessage
(
"[累计分红再投净值为空或格式错误]"
);
...
...
@@ -2021,14 +2034,15 @@ public class ProductServiceImpl implements ProductService, Constant {
message
.
setMessage
(
message
.
getMessage
()
+
",[累计分红再投净值为空或格式错误]"
);
}
}
else
{
message
.
setCumulativeNav
(
new
BigDecimal
(
row3
));
row3
=
(
ls
.
get
(
2
)
+
""
).
trim
();
message
.
setCumulative_nav
(
new
BigDecimal
(
row3
));
}
if
(
errorRow
)
{
message
.
setConfirmStatus
(
3
);
errorStatus
.
set
(
tru
e
);
}
else
if
(
StringUtils
.
isNotEmpty
(
row1
)
&&
ifaNavMap
.
containsKey
(
Long
.
parseLong
(
row1
)))
{
resultMessage
.
add
(
messag
e
);
}
else
if
(
StringUtils
.
isNotEmpty
(
row1
)
&&
ifaNavMap
.
containsKey
(
DateUtil
.
parse
(
row1
).
getTime
(
)))
{
message
.
setConfirmStatus
(
3
);
errorStatus
.
set
(
true
);
if
(
StringUtils
.
isEmpty
(
message
.
getMessage
()))
{
message
.
setMessage
(
"[相同日期存在重复数据]"
);
}
else
{
...
...
@@ -2038,10 +2052,9 @@ public class ProductServiceImpl implements ProductService, Constant {
BeanUtils
.
copyProperties
(
ifaNavMap
.
get
(
Long
.
parseLong
(
row1
)),
messageCopy
);
messageCopy
.
setConfirmStatus
(
3
);
resultMessage
.
add
(
messageCopy
);
}
else
{
resultMessage
.
add
(
message
);
}
resultMessage
.
add
(
message
);
});
}
...
...
@@ -2060,7 +2073,7 @@ public class ProductServiceImpl implements ProductService, Constant {
message
.
setMessage
(
"[单位净值]与上次对比相差超过20%"
);
}
BigDecimal
cumSubtract
=
subtractAbs
(
message
.
getCumulative
Nav
(),
messageAdd
.
getCumulativeN
av
());
BigDecimal
cumSubtract
=
subtractAbs
(
message
.
getCumulative
_nav
(),
messageAdd
.
getCumulative_n
av
());
if
(
compare02
.
compareTo
(
cumSubtract
)
<
0
)
{
message
.
setConfirmStatus
(
2
);
if
(
StringUtils
.
isNotEmpty
(
message
.
getMessage
()))
{
...
...
@@ -2069,12 +2082,12 @@ public class ProductServiceImpl implements ProductService, Constant {
message
.
setMessage
(
"[累计分红再投净值]与上次对比相差超过20%"
);
}
}
}
else
{
i
++;
}
newResultMessage
.
add
(
message
);
}
else
{
newResultMessage
.
add
(
message
);
}
newResultMessage
.
add
(
message
);
}
return
newResultMessage
;
}
...
...
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