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
2bf861b8
Commit
2bf861b8
authored
Dec 23, 2019
by
郝彦辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
D3筛选替换reqId
parent
37965533
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
0 deletions
+91
-0
ManualToolController.java
...cn/quantgroup/report/controller/ManualToolController.java
+6
-0
ManualToolService.java
...antgroup/report/service/manualTool/ManualToolService.java
+85
-0
No files found.
src/main/java/cn/quantgroup/report/controller/ManualToolController.java
View file @
2bf861b8
...
...
@@ -130,4 +130,10 @@ public class ManualToolController {
return
manualToolService
.
check_D2loanId_InD3WanJie
(
d3LoanIdFile
,
d2File
,
notWJFileName
);
}
@RequestMapping
(
"/newD3ReplaceReqId"
)
public
String
newD3ReplaceReqId
(
String
newD3FilePath
,
String
newD3FileNames
,
String
oldD3ReqIdFile
,
String
newD3InFileName
,
String
newD3NotInFileName
){
manualToolService
.
newD3ReplaceReqId
(
newD3FilePath
,
newD3FileNames
,
oldD3ReqIdFile
,
newD3InFileName
,
newD3NotInFileName
);
return
"调用结束"
;
}
}
src/main/java/cn/quantgroup/report/service/manualTool/ManualToolService.java
View file @
2bf861b8
...
...
@@ -1812,6 +1812,91 @@ public class ManualToolService implements CommonSuperService {
}
public
void
newD3ReplaceReqId
(
String
newD3FilePath
,
String
newD3FileNames
,
String
oldD3ReqIdFile
,
String
newD3InFileName
,
String
newD3NotInFileName
)
{
try
{
List
<
String
>
oldD3ReqIdFileList
=
ReadOrWriteTxt
.
readTxtList
(
oldD3ReqIdFile
);
Map
<
String
,
String
>
oldD3_reqIdMap
=
new
HashMap
<>(
oldD3ReqIdFileList
.
size
());
String
[]
tmpArry
=
null
;
for
(
String
reqIdMsg
:
oldD3ReqIdFileList
){
//SP117934268911419343386834|2|2018-07-18T00:00:00|ts:normal|ls:1=bcc7c1b0a39a4c79a8622adc7c735bea
if
(
reqIdMsg
.
length
()<
5
){
continue
;
}
tmpArry
=
reqIdMsg
.
split
(
"[=]"
);
oldD3_reqIdMap
.
put
(
tmpArry
[
1
],
tmpArry
[
0
]);
}
log
.
info
(
"newD3ReplaceReqId listSize: {} , mapSize: {} "
,
oldD3ReqIdFileList
.
size
(),
oldD3_reqIdMap
.
size
());
oldD3ReqIdFileList
=
null
;
String
[]
all_id3_fileNames
=
newD3FileNames
.
split
(
","
);
List
<
String
>
d3lineList
=
null
;
RepaymentInfoZhuDai
repaymentLoanInfo
=
null
;
for
(
String
fileName
:
all_id3_fileNames
){
if
(!
newD3FilePath
.
endsWith
(
"/"
)){
newD3FilePath
=
newD3FilePath
+
"/"
;
}
d3lineList
=
ReadOrWriteTxt
.
readTxtList
(
newD3FilePath
+
fileName
);
int
have
=
0
,
notHave
=
0
,
listSize
=
d3lineList
.
size
();
log
.
info
(
fileName
+
" lineList size:"
+
d3lineList
.
size
());
for
(
int
i
=
0
;
i
<
d3lineList
.
size
();
i
++){
try
{
String
d3JsonStr
=
d3lineList
.
get
(
i
);
if
(
d3JsonStr
.
length
()<
30
){
//#singleLoanRepayInfo
continue
;
}
repaymentLoanInfo
=
new
Gson
().
fromJson
(
d3JsonStr
,
new
TypeToken
<
RepaymentInfoZhuDai
>(){}.
getType
());
String
key_replace
=
repaymentLoanInfo
.
getLoanId
()+
"|"
+
repaymentLoanInfo
.
getTermNo
()+
"|"
+
repaymentLoanInfo
.
getStatusConfirmAt
()
+
"|ts:"
+
repaymentLoanInfo
.
getTermStatus
()+
"|ls:"
+
repaymentLoanInfo
.
getLoanStatus
();
if
(
oldD3_reqIdMap
.
containsKey
(
key_replace
)){
//找到了
have
++;
repaymentLoanInfo
.
setReqID
(
oldD3_reqIdMap
.
get
(
key_replace
));
repaymentLoanInfo
.
setOpCode
(
"M"
);
//是要删除,D3_035
FileUtils
.
write
(
new
File
(
newD3InFileName
),
JSON
.
toJSONString
(
repaymentLoanInfo
)+
"\r\n"
,
"UTF-8"
,
true
);
oldD3_reqIdMap
.
remove
(
key_replace
);
}
else
{
notHave
++;
FileUtils
.
write
(
new
File
(
newD3NotInFileName
),
JSON
.
toJSONString
(
repaymentLoanInfo
)+
"\r\n"
,
"UTF-8"
,
true
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
fileName
+
":筛选替换 error,"
,
e
);
}
}
log
.
info
(
fileName
+
":筛选替换 end, listSize: {} , have: {} , notHave: {} , 合计: {} "
,
listSize
,
have
,
notHave
,(
have
+
notHave
));
d3lineList
=
null
;
repaymentLoanInfo
=
null
;
have
=
0
;
notHave
=
0
;
listSize
=
0
;
Thread
.
sleep
(
1500
);
}
if
(
oldD3_reqIdMap
.
size
()>
0
){
log
.
warn
(
"oldD3_reqIdMap IS NOT EMPTY:"
+
oldD3_reqIdMap
.
size
());
int
wr
=
0
;
for
(
String
key
:
oldD3_reqIdMap
.
keySet
()){
log
.
info
(
"oldD3_reqIdMap wr:"
+(
wr
++));
try
{
FileUtils
.
write
(
new
File
(
newD3FilePath
+
"oldD3_reqIdMap.txt"
),
oldD3_reqIdMap
.
get
(
key
)+
"="
+
oldD3_reqIdMap
+
"\r\n"
,
"UTF-8"
,
true
);
}
catch
(
IOException
e
)
{
log
.
error
(
"oldD3_reqIdMap 写入 error "
,
e
);
}
}
}
}
catch
(
Exception
e
){
log
.
error
(
"newD3ReplaceReqId Error"
,
e
);
}
log
.
info
(
"All newD3ReplaceReqId() end."
);
}
public
static
void
main
(
String
[]
args
)
{
...
...
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