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
9e0ccc01
Commit
9e0ccc01
authored
Apr 29, 2021
by
郑建
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件报送手动模式
parent
045a3689
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
17 deletions
+65
-17
ManualToolController.java
...cn/quantgroup/report/controller/ManualToolController.java
+47
-0
BaiHangZhuDaiService.java
...antgroup/report/service/baihang/BaiHangZhuDaiService.java
+14
-13
BaihangReportApplicationTests.java
...a/cn/quantgroup/report/BaihangReportApplicationTests.java
+4
-4
No files found.
src/main/java/cn/quantgroup/report/controller/ManualToolController.java
View file @
9e0ccc01
package
cn
.
quantgroup
.
report
.
controller
;
package
cn
.
quantgroup
.
report
.
controller
;
import
cn.quantgroup.report.response.GlobalResponse
;
import
cn.quantgroup.report.response.GlobalResponse
;
import
cn.quantgroup.report.service.baihang.BaiHangZhuDaiService
;
import
cn.quantgroup.report.service.common.CommonQueryService
;
import
cn.quantgroup.report.service.common.CommonQueryService
;
import
cn.quantgroup.report.service.manualTool.CleanningTransactionLogService
;
import
cn.quantgroup.report.service.manualTool.CleanningTransactionLogService
;
import
cn.quantgroup.report.service.manualTool.ManualToolService
;
import
cn.quantgroup.report.service.manualTool.ManualToolService
;
import
cn.quantgroup.report.utils.DateUtils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.base.Stopwatch
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.ImmutableMap
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
@Slf4j
@Slf4j
@RestController
@RestController
...
@@ -21,6 +26,9 @@ public class ManualToolController {
...
@@ -21,6 +26,9 @@ public class ManualToolController {
@Autowired
@Autowired
private
ManualToolService
manualToolService
;
private
ManualToolService
manualToolService
;
@Autowired
BaiHangZhuDaiService
zhuDaiService
;
@Autowired
@Autowired
private
CommonQueryService
queryService
;
private
CommonQueryService
queryService
;
...
@@ -150,5 +158,44 @@ public class ManualToolController {
...
@@ -150,5 +158,44 @@ public class ManualToolController {
}
}
}
}
@RequestMapping
(
"/createFile"
)
public
void
testD2Repost
(){
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
D2
();
log
.
info
(
"跑了 {}"
,
stopwatch
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
}
//2020-07-01
private
void
D2
(){
String
startTime
=
"2020-06-12"
,
endTime
=
"2020-07-01"
;
Date
startDate
;
Date
endDate
=
DateUtils
.
parseDate
(
"yyyy-MM-dd"
,
endTime
);
while
(
endDate
.
getTime
()
<
System
.
currentTimeMillis
()){
log
.
info
(
"开始报送D2----- {} -- {}"
,
startTime
,
endTime
);
zhuDaiService
.
apiSend
(
"D2"
,
startTime
+
"T00:00:00"
,
endTime
+
"T00:00:00"
);
log
.
info
(
"报送D2结束----- {} -- {}"
,
startTime
,
endTime
);
startDate
=
new
Date
(
endDate
.
getTime
());
endDate
=
org
.
apache
.
commons
.
lang3
.
time
.
DateUtils
.
addMonths
(
endDate
,
1
);
startTime
=
DateUtils
.
formatDate
(
startDate
,
"yyyy-MM-dd"
);
endTime
=
DateUtils
.
formatDate
(
endDate
,
"yyyy-MM-dd"
);
}
}
private
void
D3
(){
String
startTime
=
"2020-06-12"
,
endTime
=
"2020-07-01"
;
Date
startDate
;
Date
endDate
=
DateUtils
.
parseDate
(
"yyyy-MM-dd"
,
endTime
);
while
(
endDate
.
getTime
()
<
System
.
currentTimeMillis
()){
log
.
info
(
"开始报送D3----- {} -- {}"
,
startTime
,
endTime
);
zhuDaiService
.
apiSend
(
"D3"
,
startTime
+
"T00:00:00"
,
endTime
+
"T00:00:00"
);
log
.
info
(
"报送D3结束----- {} -- {}"
,
startTime
,
endTime
);
startDate
=
new
Date
(
endDate
.
getTime
());
endDate
=
org
.
apache
.
commons
.
lang3
.
time
.
DateUtils
.
addDays
(
endDate
,
10
);
startTime
=
DateUtils
.
formatDate
(
startDate
,
"yyyy-MM-dd"
);
endTime
=
DateUtils
.
formatDate
(
endDate
,
"yyyy-MM-dd"
);
}
}
}
}
src/main/java/cn/quantgroup/report/service/baihang/BaiHangZhuDaiService.java
View file @
9e0ccc01
...
@@ -150,7 +150,7 @@ public class BaiHangZhuDaiService {
...
@@ -150,7 +150,7 @@ public class BaiHangZhuDaiService {
try
{
try
{
long
log_stUtc1
=
System
.
currentTimeMillis
();
long
log_stUtc1
=
System
.
currentTimeMillis
();
baihang_zhudai_publickey
=
BHRSAUtils
.
readRSAPublicKey
(
"/baihang/rsa_public_key
_test
.pem"
);
baihang_zhudai_publickey
=
BHRSAUtils
.
readRSAPublicKey
(
"/baihang/rsa_public_key.pem"
);
log
.
info
(
"初始化百行助贷PublicKey实例完成, 耗时: {} "
,
System
.
currentTimeMillis
()
-
log_stUtc1
);
log
.
info
(
"初始化百行助贷PublicKey实例完成, 耗时: {} "
,
System
.
currentTimeMillis
()
-
log_stUtc1
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"初始化百行助贷PublicKey实例"
,
e
);
log
.
error
(
"初始化百行助贷PublicKey实例"
,
e
);
...
@@ -160,7 +160,7 @@ public class BaiHangZhuDaiService {
...
@@ -160,7 +160,7 @@ public class BaiHangZhuDaiService {
public
static
PublicKey
getBaihangZDPublickey
()
{
public
static
PublicKey
getBaihangZDPublickey
()
{
if
(
baihang_zhudai_publickey
==
null
)
{
if
(
baihang_zhudai_publickey
==
null
)
{
try
{
try
{
baihang_zhudai_publickey
=
BHRSAUtils
.
readRSAPublicKey
(
"/baihang/rsa_public_key
_test
.pem"
);
baihang_zhudai_publickey
=
BHRSAUtils
.
readRSAPublicKey
(
"/baihang/rsa_public_key.pem"
);
log
.
info
(
"初始化百行助贷PublicKey实例完成"
);
log
.
info
(
"初始化百行助贷PublicKey实例完成"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"初始化百行助贷PublicKey实例"
,
e
);
log
.
error
(
"初始化百行助贷PublicKey实例"
,
e
);
...
@@ -1598,7 +1598,7 @@ public class BaiHangZhuDaiService {
...
@@ -1598,7 +1598,7 @@ public class BaiHangZhuDaiService {
LoanInfoZhuDai
record
=
new
LoanInfoZhuDai
();
LoanInfoZhuDai
record
=
new
LoanInfoZhuDai
();
BeanUtils
.
copyProperties
(
loanInfo
,
record
);
BeanUtils
.
copyProperties
(
loanInfo
,
record
);
record
.
setRecordId
(
id
);
record
.
setRecordId
(
id
);
//
loanInfoDbMapper.saveLoanInfoRecordLog(record);
loanInfoDbMapper
.
saveLoanInfoRecordLog
(
record
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"量化派助贷TO百行报送-放款申请保存记录失败"
,
e
);
log
.
error
(
"量化派助贷TO百行报送-放款申请保存记录失败"
,
e
);
}
}
...
@@ -1611,7 +1611,7 @@ public class BaiHangZhuDaiService {
...
@@ -1611,7 +1611,7 @@ public class BaiHangZhuDaiService {
loanInfoVo
.
setName
(
tuomin
(
loanInfo
.
getName
()));
loanInfoVo
.
setName
(
tuomin
(
loanInfo
.
getName
()));
loanInfoVo
.
setPid
(
tuomin
(
loanInfo
.
getPid
()));
loanInfoVo
.
setPid
(
tuomin
(
loanInfo
.
getPid
()));
loanInfoVo
.
setMobile
(
tuomin
(
loanInfo
.
getMobile
()));
loanInfoVo
.
setMobile
(
tuomin
(
loanInfo
.
getMobile
()));
if
(
DateUtils
.
parseDate
(
"yyyy-MM-dd'T'
hh:mm:ss"
,
loanInfoVo
.
getIssueDate
()).
getTime
()
<
DateUtils
.
parseDate
(
"yyyy-MM-dd'T'hh
:mm:ss"
,
loanInfoVo
.
getAccountOpenDate
()).
getTime
()){
if
(
DateUtils
.
parseDate
(
"yyyy-MM-dd'T'
HH:mm:ss"
,
loanInfoVo
.
getIssueDate
()).
getTime
()
<
DateUtils
.
parseDate
(
"yyyy-MM-dd'T'HH
:mm:ss"
,
loanInfoVo
.
getAccountOpenDate
()).
getTime
()){
loanInfoVo
.
setAccountOpenDate
(
loanInfoVo
.
getIssueDate
());
loanInfoVo
.
setAccountOpenDate
(
loanInfoVo
.
getIssueDate
());
loanInfoVo
.
setApplyDate
(
loanInfoVo
.
getIssueDate
());
loanInfoVo
.
setApplyDate
(
loanInfoVo
.
getIssueDate
());
}
}
...
@@ -1629,7 +1629,7 @@ public class BaiHangZhuDaiService {
...
@@ -1629,7 +1629,7 @@ public class BaiHangZhuDaiService {
log
.
error
(
"量化派助贷TO百行报送-放款信息异常, recordId: {} , loanId: {} "
,
id
,
loanInfo
.
getLoanId
(),
e
);
log
.
error
(
"量化派助贷TO百行报送-放款信息异常, recordId: {} , loanId: {} "
,
id
,
loanInfo
.
getLoanId
(),
e
);
}
}
}
}
File
file
=
new
File
(
"
F:\\9_QFNEW\\baihang-report\\D3
\\量子数科科技有限公司_D2_"
+
endTime
.
split
(
"T"
)[
0
].
replaceAll
(
"-"
,
""
)+
"_0002"
+
".txt"
);
File
file
=
new
File
(
"
D3-3S
\\量子数科科技有限公司_D2_"
+
endTime
.
split
(
"T"
)[
0
].
replaceAll
(
"-"
,
""
)+
"_0002"
+
".txt"
);
FileUtils
.
writeLines
(
file
,
reportList
);
FileUtils
.
writeLines
(
file
,
reportList
);
createFile
(
file
.
getName
());
createFile
(
file
.
getName
());
log
.
info
(
"量化派助贷TO百行报送-放款申请完成, 实际大小: {} , 报送成功大小: {} , 耗时: {} "
,
loanInfozdList
.
size
(),
atomicInteger
.
get
(),
sendWatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
log
.
info
(
"量化派助贷TO百行报送-放款申请完成, 实际大小: {} , 报送成功大小: {} , 耗时: {} "
,
loanInfozdList
.
size
(),
atomicInteger
.
get
(),
sendWatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
...
@@ -1671,7 +1671,7 @@ public class BaiHangZhuDaiService {
...
@@ -1671,7 +1671,7 @@ public class BaiHangZhuDaiService {
RepaymentInfoZhuDai
record
=
new
RepaymentInfoZhuDai
();
RepaymentInfoZhuDai
record
=
new
RepaymentInfoZhuDai
();
BeanUtils
.
copyProperties
(
repaymentLoanInfo
,
record
);
BeanUtils
.
copyProperties
(
repaymentLoanInfo
,
record
);
record
.
setRecordId
(
id
);
record
.
setRecordId
(
id
);
repaymentLoanInfoDbMapper
.
saveRepaymentLoanInfoLog
(
record
);
//
repaymentLoanInfoDbMapper.saveRepaymentLoanInfoLog(record);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"量化派助贷TO百行报送-实时还款保存记录异常"
,
e
);
log
.
error
(
"量化派助贷TO百行报送-实时还款保存记录异常"
,
e
);
}
}
...
@@ -1694,7 +1694,7 @@ public class BaiHangZhuDaiService {
...
@@ -1694,7 +1694,7 @@ public class BaiHangZhuDaiService {
}
}
}
}
File
file
=
new
File
(
"
F:\\9_QFNEW\\baihang-report\\D3\\量子数科科技有限公司_D3_"
+
endTime
.
split
(
"T"
)[
0
].
replaceAll
(
"-"
,
""
)+
"_"
+
UUID
.
randomUUID
().
toString
()
+
".txt"
);
File
file
=
new
File
(
"
D3-3S\\量子数科科技有限公司_D3_"
+
endTime
.
split
(
"T"
)[
0
].
replaceAll
(
"-"
,
""
)+
"_"
+
"0003"
+
".txt"
);
FileUtils
.
writeLines
(
file
,
reportList
);
FileUtils
.
writeLines
(
file
,
reportList
);
createFile
(
file
.
getName
());
createFile
(
file
.
getName
());
log
.
info
(
"量化派助贷TO百行报送-还款申请完成 J: {} , 开始时间: {} , 结束时间: {} , 实际大小: {} , 报送成功大小: {} , 耗时: {} "
,
j
,
starTime
,
endTime
,
repaymentLoanInfos
.
size
(),
atomicInteger
.
get
(),
sendWatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
log
.
info
(
"量化派助贷TO百行报送-还款申请完成 J: {} , 开始时间: {} , 结束时间: {} , 实际大小: {} , 报送成功大小: {} , 耗时: {} "
,
j
,
starTime
,
endTime
,
repaymentLoanInfos
.
size
(),
atomicInteger
.
get
(),
sendWatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
...
@@ -2429,7 +2429,7 @@ public class BaiHangZhuDaiService {
...
@@ -2429,7 +2429,7 @@ public class BaiHangZhuDaiService {
private
static
void
createFile
(
String
fileName
){
private
static
void
createFile
(
String
fileName
){
String
HOST
=
"
F:\\9_QFNEW\\baihang-report\\D3
\\"
;
String
HOST
=
"
D3-3S
\\"
;
File
host
=
new
File
(
HOST
);
File
host
=
new
File
(
HOST
);
if
(!
host
.
exists
()){
if
(!
host
.
exists
()){
host
.
mkdir
();
host
.
mkdir
();
...
@@ -2456,11 +2456,12 @@ public class BaiHangZhuDaiService {
...
@@ -2456,11 +2456,12 @@ public class BaiHangZhuDaiService {
}
}
private
static
String
tuomin
(
String
s
){
private
static
String
tuomin
(
String
s
){
if
(
StringUtils
.
isNumeric
(
s
)
||
s
.
contains
(
"X"
)
||
s
.
contains
(
"x"
)){
// if (StringUtils.isNumeric(s) || s.contains("X") || s.contains("x")){
return
s
.
substring
(
0
,
s
.
length
()-
4
)+
"0000"
;
// return s.substring(0,s.length()-4)+"0000";
}
else
{
// }else {
return
s
.
substring
(
0
,
1
)+
"零"
;
// return s.substring(0,1)+"零";
}
// }
return
s
;
}
}
}
}
...
...
src/test/java/cn/quantgroup/report/BaihangReportApplicationTests.java
View file @
9e0ccc01
...
@@ -44,10 +44,10 @@ public class BaihangReportApplicationTests {
...
@@ -44,10 +44,10 @@ public class BaihangReportApplicationTests {
//2020-07-01
//2020-07-01
private
void
D2
(){
private
void
D2
(){
String
startTime
=
"2020-0
7-01
"
,
endTime
=
"2020-07-01"
;
String
startTime
=
"2020-0
6-12
"
,
endTime
=
"2020-07-01"
;
Date
startDate
;
Date
startDate
;
Date
endDate
=
DateUtils
.
parseDate
(
"yyyy-MM-dd"
,
endTime
);
Date
endDate
=
DateUtils
.
parseDate
(
"yyyy-MM-dd"
,
endTime
);
while
(
endDate
.
getTime
()
<
System
.
currentTimeMillis
()){
while
(
endDate
.
getTime
()
<
DateUtils
.
parseDate
(
"yyyy-MM-dd"
,
"2020-07-02"
).
getTime
()){
log
.
info
(
"开始报送D2----- {} -- {}"
,
startTime
,
endTime
);
log
.
info
(
"开始报送D2----- {} -- {}"
,
startTime
,
endTime
);
zhuDaiService
.
apiSend
(
"D2"
,
startTime
+
"T00:00:00"
,
endTime
+
"T00:00:00"
);
zhuDaiService
.
apiSend
(
"D2"
,
startTime
+
"T00:00:00"
,
endTime
+
"T00:00:00"
);
startDate
=
new
Date
(
endDate
.
getTime
());
startDate
=
new
Date
(
endDate
.
getTime
());
...
@@ -58,14 +58,14 @@ public class BaihangReportApplicationTests {
...
@@ -58,14 +58,14 @@ public class BaihangReportApplicationTests {
}
}
private
void
D3
(){
private
void
D3
(){
String
startTime
=
"2020-0
7-01
"
,
endTime
=
"2020-07-01"
;
String
startTime
=
"2020-0
6-12
"
,
endTime
=
"2020-07-01"
;
Date
startDate
;
Date
startDate
;
Date
endDate
=
DateUtils
.
parseDate
(
"yyyy-MM-dd"
,
endTime
);
Date
endDate
=
DateUtils
.
parseDate
(
"yyyy-MM-dd"
,
endTime
);
while
(
endDate
.
getTime
()
<
System
.
currentTimeMillis
()){
while
(
endDate
.
getTime
()
<
System
.
currentTimeMillis
()){
log
.
info
(
"开始报送D3----- {} -- {}"
,
startTime
,
endTime
);
log
.
info
(
"开始报送D3----- {} -- {}"
,
startTime
,
endTime
);
zhuDaiService
.
apiSend
(
"D3"
,
startTime
+
"T00:00:00"
,
endTime
+
"T00:00:00"
);
zhuDaiService
.
apiSend
(
"D3"
,
startTime
+
"T00:00:00"
,
endTime
+
"T00:00:00"
);
startDate
=
new
Date
(
endDate
.
getTime
());
startDate
=
new
Date
(
endDate
.
getTime
());
endDate
=
org
.
apache
.
commons
.
lang3
.
time
.
DateUtils
.
add
Months
(
endDate
,
1
);
endDate
=
org
.
apache
.
commons
.
lang3
.
time
.
DateUtils
.
add
Days
(
endDate
,
10
);
startTime
=
DateUtils
.
formatDate
(
startDate
,
"yyyy-MM-dd"
);
startTime
=
DateUtils
.
formatDate
(
startDate
,
"yyyy-MM-dd"
);
endTime
=
DateUtils
.
formatDate
(
endDate
,
"yyyy-MM-dd"
);
endTime
=
DateUtils
.
formatDate
(
endDate
,
"yyyy-MM-dd"
);
}
}
...
...
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