Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
baihang-report
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-spider
baihang-report
Commits
452c26c0
Commit
452c26c0
authored
Aug 05, 2021
by
陈宏杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
集合分组
parent
c098b7a8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
21 deletions
+22
-21
BaiHangFileReportService.java
...roup/report/service/baihang/BaiHangFileReportService.java
+22
-21
No files found.
src/main/java/cn/quantgroup/report/service/baihang/BaiHangFileReportService.java
View file @
452c26c0
...
...
@@ -17,6 +17,7 @@ import cn.quantgroup.report.utils.DateUtils;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.base.Stopwatch
;
import
com.google.common.collect.Lists
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -66,6 +67,9 @@ public class BaiHangFileReportService {
private
static
final
Integer
D3_INITIAL_CAPACITY
=
5000
;
private
static
final
Integer
LISTS_PARTITION_SIZE
=
5000
;
/**
* 创建报送文件 通常用于存量报送
* @param type 报送类型 A1:申请信息 D2:放款信息 D3:还款信息
...
...
@@ -390,13 +394,7 @@ public class BaiHangFileReportService {
log
.
error
(
"量化派助贷TO百行报送(D3)-逾期记录处理异常, recordId: {} , loanId: {} "
,
id
,
repaymentLoanInfo
.
getLoanId
(),
e
);
}
}
try
{
Stopwatch
saveStopwatch
=
Stopwatch
.
createStarted
();
repaymentLoanInfoDbMapper
.
batchSaveRepaymentLoanInfoLog
(
recordList
);
log
.
info
(
"量化派助贷TO百行报送(D3)-逾期记录批量插入结束, startTime: {} , endTime: {} , 大小: {} , 耗时: {} "
,
startTime
,
endTime
,
recordList
.
size
(),
(
saveStopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
)
/
1000
)
+
".s"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"量化派助贷TO百行报送(D3)-逾期记录保存异常"
,
e
);
}
saveRepaymentLoanInfoLog
(
recordList
,
startTime
,
endTime
);
File
file
=
new
File
(
HOST_PATH
+
"量子数科科技有限公司_D3O_"
+
fileNameReplaceAll
(
startTime
.
split
(
"T"
)[
0
])+
"_"
+
fileNameReplaceAll
(
endTime
.
split
(
"T"
)[
0
])+
"_"
+
String
.
format
(
"%06d"
,
new
Random
().
nextInt
(
999999
))+
".txt"
);
FileUtils
.
writeLines
(
file
,
reportList
);
if
(
reportList
.
size
()<=
1
)
{
...
...
@@ -464,13 +462,7 @@ public class BaiHangFileReportService {
log
.
error
(
"量化派助贷TO百行报送(D3)-每30天逾期记录处理异常, recordId: {} , loanId: {} "
,
id
,
repaymentLoanInfo
.
getLoanId
(),
e
);
}
}
try
{
Stopwatch
saveStopwatch
=
Stopwatch
.
createStarted
();
repaymentLoanInfoDbMapper
.
batchSaveRepaymentLoanInfoLog
(
recordList
);
log
.
info
(
"量化派助贷TO百行报送(D3)-每30天逾期记录批量插入结束, startTime: {} , endTime: {} , 大小: {} , 耗时: {} "
,
startTime
,
endTime
,
recordList
.
size
(),
(
saveStopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
)
/
1000
)
+
".s"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"量化派助贷TO百行报送(D3)-每30天逾期记录保存异常"
,
e
);
}
saveRepaymentLoanInfoLog
(
recordList
,
startTime
,
endTime
);
File
file
=
new
File
(
HOST_PATH
+
"量子数科科技有限公司_D3O30_"
+
fileNameReplaceAll
(
startTime
.
split
(
"T"
)[
0
])+
"_"
+
fileNameReplaceAll
(
endTime
.
split
(
"T"
)[
0
])+
"_"
+
String
.
format
(
"%06d"
,
new
Random
().
nextInt
(
999999
))+
".txt"
);
FileUtils
.
writeLines
(
file
,
reportList
);
if
(
reportList
.
size
()<=
1
)
{
...
...
@@ -520,13 +512,7 @@ public class BaiHangFileReportService {
log
.
error
(
"量化派助贷TO百行报送(D3)-还款记录处理异常, recordId: {} , loanId: {} "
,
id
,
repaymentLoanInfo
.
getLoanId
(),
e
);
}
}
try
{
Stopwatch
saveStopwatch
=
Stopwatch
.
createStarted
();
repaymentLoanInfoDbMapper
.
batchSaveRepaymentLoanInfoLog
(
recordList
);
log
.
info
(
"量化派助贷TO百行报送(D3)-还款记录批量插入结束, startTime: {} , endTime: {} , 大小: {} , 耗时: {} "
,
startTime
,
endTime
,
recordList
.
size
(),
(
saveStopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
)
/
1000
)
+
".s"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"量化派助贷TO百行报送(D3)-还款记录保存异常"
,
e
);
}
saveRepaymentLoanInfoLog
(
recordList
,
startTime
,
endTime
);
File
file
=
new
File
(
HOST_PATH
+
"量子数科科技有限公司_D3R_"
+
fileNameReplaceAll
(
startTime
.
split
(
"T"
)[
0
])+
"_"
+
fileNameReplaceAll
(
endTime
.
split
(
"T"
)[
0
])+
"_"
+
String
.
format
(
"%06d"
,
new
Random
().
nextInt
(
999999
))+
".txt"
);
FileUtils
.
writeLines
(
file
,
reportList
);
if
(
reportList
.
size
()<=
1
)
{
...
...
@@ -550,4 +536,19 @@ public class BaiHangFileReportService {
}
}
private
void
saveRepaymentLoanInfoLog
(
List
<
RepaymentInfoZhuDai
>
recordList
,
String
startTime
,
String
endTime
)
{
if
(!
CollectionUtils
.
isEmpty
(
recordList
))
{
try
{
List
<
List
<
RepaymentInfoZhuDai
>>
allList
=
Lists
.
partition
(
recordList
,
LISTS_PARTITION_SIZE
);
Stopwatch
saveStopwatch
=
Stopwatch
.
createStarted
();
allList
.
stream
().
forEach
(
pRecordList
->
{
repaymentLoanInfoDbMapper
.
batchSaveRepaymentLoanInfoLog
(
pRecordList
);
});
log
.
info
(
"量化派助贷TO百行报送(D3)批量插入结束, startTime: {} , endTime: {} , 大小: {} , 耗时: {} "
,
startTime
,
endTime
,
recordList
.
size
(),
(
saveStopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
)
/
1000
)
+
".s"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"量化派助贷TO百行报送(D3)保存异常"
,
e
);
}
}
}
}
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