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
2a96f9cf
Commit
2a96f9cf
authored
Aug 09, 2021
by
陈宏杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
请勿重复操作
parent
fa329ad4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
BaiHangFileReportService.java
...roup/report/service/baihang/BaiHangFileReportService.java
+31
-1
Constant.java
.../quantgroup/report/service/baihang/constant/Constant.java
+12
-0
No files found.
src/main/java/cn/quantgroup/report/service/baihang/BaiHangFileReportService.java
View file @
2a96f9cf
...
...
@@ -9,6 +9,7 @@ import cn.quantgroup.report.mapper.master.ApplyLoanInfoZhuDaiMapper;
import
cn.quantgroup.report.mapper.master.LoanInfoDbMapper
;
import
cn.quantgroup.report.mapper.master.RepaymentLoanInfoDbMapper
;
import
cn.quantgroup.report.service.baihang.client.BhFileCreditApiClient
;
import
cn.quantgroup.report.service.baihang.constant.Constant
;
import
cn.quantgroup.report.service.baihang.request.FileUploadRequest
;
import
cn.quantgroup.report.service.baihang.response.FileUploadResponse
;
import
cn.quantgroup.report.service.baihang.util.TuoMinUtils
;
...
...
@@ -24,6 +25,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -69,6 +71,9 @@ public class BaiHangFileReportService {
private
static
final
Integer
LISTS_PARTITION_SIZE
=
5000
;
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
/**
* 创建报送文件 通常用于存量报送
...
...
@@ -196,6 +201,11 @@ public class BaiHangFileReportService {
* @param endTime 截至时间
*/
private
void
reportD2
(
String
starTime
,
String
endTime
)
{
if
(!
increment
(
Constant
.
QG_ZHU_DAI_REPORT_STOCK_D2_LOCK_KEY
))
{
log
.
info
(
"量化派助贷TO百行报送(D2)-放款信息已开始报送...请勿重复操作"
);
return
;
}
redisTemplate
.
expire
(
Constant
.
QG_ZHU_DAI_REPORT_STOCK_D2_LOCK_KEY
,
5
,
TimeUnit
.
MINUTES
);
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
try
{
List
<
LoanInfoZhuDai
>
loanInfozdList
=
loanInfoMapper
.
queryStockLoanInfoZhuDai
(
BaiHangTimeRecord
.
builder
().
startTime
(
starTime
).
endTime
(
endTime
).
build
());
...
...
@@ -245,7 +255,7 @@ public class BaiHangFileReportService {
log
.
error
(
"量化派助贷TO百行报送-放款信息异常, recordId: {} , loanId: {} "
,
id
,
loanInfo
.
getLoanId
(),
e
);
}
}
File
file
=
new
File
(
HOST_PATH
+
"量子数科科技有限公司_D2_"
+
endTime
.
split
(
"T"
)[
0
].
replaceAll
(
"-"
,
""
)+
"_0002"
+
".txt"
);
File
file
=
new
File
(
HOST_PATH
+
"量子数科科技有限公司_D2_"
+
fileNameReplaceAll
(
starTime
.
split
(
"T"
)[
0
])+
"_"
+
fileNameReplaceAll
(
endTime
.
split
(
"T"
)[
0
])+
"_"
+
String
.
format
(
"%06d"
,
new
Random
().
nextInt
(
999999
))
+
".txt"
);
FileUtils
.
writeLines
(
file
,
reportList
);
if
(
reportList
.
size
()<=
1
)
{
log
.
info
(
"量化派助贷TO百行报送-放款信息为空,加密文件不生成!starTime={},endTime={}"
,
starTime
,
endTime
);
...
...
@@ -377,6 +387,11 @@ public class BaiHangFileReportService {
* @param endTime 截止时间
*/
private
void
reportD3O
(
String
startTime
,
String
endTime
)
{
if
(!
increment
(
Constant
.
QG_ZHU_DAI_REPORT_STOCK_D3O_LOCK_KEY
))
{
log
.
info
(
"量化派助贷TO百行报送(D3)-逾期记录已开始报送...请勿重复操作"
);
return
;
}
redisTemplate
.
expire
(
Constant
.
QG_ZHU_DAI_REPORT_STOCK_D3O_LOCK_KEY
,
5
,
TimeUnit
.
MINUTES
);
List
<
RepaymentInfoZhuDai
>
repaymentLoanInfos
=
null
,
recordList
=
new
ArrayList
<>(
D3_INITIAL_CAPACITY
);
List
<
String
>
reportList
=
new
ArrayList
<>(
D3_INITIAL_CAPACITY
);
reportList
.
add
(
"#singleLoanRepayInfo"
);
...
...
@@ -425,6 +440,11 @@ public class BaiHangFileReportService {
* 应还款日次日起,每30天的次日报送一次逾期记录,直至结清或转出
*/
private
void
reportD3OFor30Day
(
String
startTime
,
String
endTime
)
{
if
(!
increment
(
Constant
.
QG_ZHU_DAI_REPORT_STOCK_D3O30_LOCK_KEY
))
{
log
.
info
(
"量化派助贷TO百行报送(D3)-每30天逾期记录已开始报送...请勿重复操作"
);
return
;
}
redisTemplate
.
expire
(
Constant
.
QG_ZHU_DAI_REPORT_STOCK_D3O30_LOCK_KEY
,
5
,
TimeUnit
.
MINUTES
);
List
<
LoanApplicationHistoryIdInfo
>
idInfos
=
null
;
LoanApplicationHistoryIdInfo
idInfo
=
null
;
List
<
RepaymentInfoZhuDai
>
repaymentLoanInfos
=
new
ArrayList
<>(
D3_INITIAL_CAPACITY
),
tempRepaymentLoanInfos
=
null
,
recordList
=
new
ArrayList
<>(
D3_INITIAL_CAPACITY
);
...
...
@@ -495,6 +515,11 @@ public class BaiHangFileReportService {
* @param endTime 截止时间
*/
private
void
reportD3R
(
String
startTime
,
String
endTime
,
String
loanStartTime
,
String
loanEndTime
)
{
if
(!
increment
(
Constant
.
QG_ZHU_DAI_REPORT_STOCK_D3R_LOCK_KEY
))
{
log
.
info
(
"量化派助贷TO百行报送(D3)-还款记录已开始报送...请勿重复操作"
);
return
;
}
redisTemplate
.
expire
(
Constant
.
QG_ZHU_DAI_REPORT_STOCK_D3R_LOCK_KEY
,
5
,
TimeUnit
.
MINUTES
);
List
<
RepaymentInfoZhuDai
>
repaymentLoanInfos
=
null
,
recordList
=
new
ArrayList
<>(
D3_INITIAL_CAPACITY
);
List
<
String
>
reportList
=
new
ArrayList
<>(
D3_INITIAL_CAPACITY
);
reportList
.
add
(
"#singleLoanRepayInfo"
);
...
...
@@ -565,4 +590,9 @@ public class BaiHangFileReportService {
}
}
private
Boolean
increment
(
String
key
){
Long
increment
=
redisTemplate
.
opsForValue
().
increment
(
key
,
1
);
return
increment
<=
1
;
}
}
src/main/java/cn/quantgroup/report/service/baihang/constant/Constant.java
View file @
2a96f9cf
...
...
@@ -8,4 +8,16 @@ public class Constant {
public
static
final
String
XYQB_HISTORY_DAI_REPORT_LOCK_KEY
=
"XYQB_HISTORY_DAI_REPORT_LOCK_KEY"
;
/** 存量D2 */
public
static
final
String
QG_ZHU_DAI_REPORT_STOCK_D2_LOCK_KEY
=
"QG_ZHU_DAI_REPORT_STOCK_D2_LOCK_KEY"
;
/** 存量D3 逾期记录 */
public
static
final
String
QG_ZHU_DAI_REPORT_STOCK_D3O_LOCK_KEY
=
"QG_ZHU_DAI_REPORT_STOCK_D3O_LOCK_KEY"
;
/** 存量D3 每30天报送 */
public
static
final
String
QG_ZHU_DAI_REPORT_STOCK_D3O30_LOCK_KEY
=
"QG_ZHU_DAI_REPORT_STOCK_D3O30_LOCK_KEY"
;
/** 存量D3 还款记录 */
public
static
final
String
QG_ZHU_DAI_REPORT_STOCK_D3R_LOCK_KEY
=
"QG_ZHU_DAI_REPORT_STOCK_D3R_LOCK_KEY"
;
}
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