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
610e8fd6
Commit
610e8fd6
authored
Dec 23, 2019
by
郝彦辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
D3筛选工具开发
parent
d830390e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
247 additions
and
1 deletion
+247
-1
ManualToolController.java
...cn/quantgroup/report/controller/ManualToolController.java
+14
-0
ManualToolService.java
...antgroup/report/service/manualTool/ManualToolService.java
+233
-1
No files found.
src/main/java/cn/quantgroup/report/controller/ManualToolController.java
View file @
610e8fd6
...
@@ -116,4 +116,18 @@ public class ManualToolController {
...
@@ -116,4 +116,18 @@ public class ManualToolController {
return
manualToolService
.
dealWithExcelData
(
filePath
,
type
);
return
manualToolService
.
dealWithExcelData
(
filePath
,
type
);
}
}
@RequestMapping
(
"/removeD3LoanIdChunfu"
)
public
String
remove_D3_loanId_chunfu
(
String
oldDataFile
,
String
cfLoanIdLogFile
,
String
newFileName
,
String
rmIdFileName
,
String
rmPhoneFileName
){
return
manualToolService
.
remove_D3_loanId_chunfu
(
oldDataFile
,
cfLoanIdLogFile
,
newFileName
,
rmIdFileName
,
rmPhoneFileName
);
}
@RequestMapping
(
"/checkD3loanIdInD2"
)
public
String
check_D3loanId_InD2
(
String
d3LoanIdFile
,
String
d2File
,
String
inFileName
,
String
notInFileName
){
return
manualToolService
.
check_D3loanId_InD2
(
d3LoanIdFile
,
d2File
,
inFileName
,
notInFileName
);
}
@RequestMapping
(
"/checkD2loanIdInD3WanJie"
)
public
String
check_D2loanId_InD3WanJie
(
String
d3LoanIdFile
,
String
d2File
,
String
notWJFileName
){
return
manualToolService
.
check_D2loanId_InD3WanJie
(
d3LoanIdFile
,
d2File
,
notWJFileName
);
}
}
}
src/main/java/cn/quantgroup/report/service/manualTool/ManualToolService.java
View file @
610e8fd6
...
@@ -1083,6 +1083,232 @@ public class ManualToolService implements CommonSuperService {
...
@@ -1083,6 +1083,232 @@ public class ManualToolService implements CommonSuperService {
}
}
/**
* 描述: 删除掉D3中本LoanId一样,本次还款金额 实际还款时间 为空的一条 <br/>
* |awk -F ',"' '{print $1 $17 "\"" $14}' |awk -F '"' '{print $4 $6"_"$9}' |sort |uniq -c |awk '$1 > 1 {print $1}' |more
* 参数: [oldDataFile, cfLoanIdLogFile, newDataFile] <br/>
* 返回值: java.lang.String <br/>
* 创建人: yanhui.Hao <br/>
* 创建时间: 2019.12.22 <br/>
*/
public
static
String
remove_D3_loanId_chunfu
(
String
oldDataFile
,
String
cfLoanIdLogFile
,
String
newFileName
,
String
rmIdFileName
,
String
rmPhoneFileName
)
{
List
<
String
>
logicerrorList
=
ReadOrWriteTxt
.
readTxtList
(
cfLoanIdLogFile
);
Map
<
String
,
String
>
err_log_loanIdMap
=
new
HashMap
<>(
logicerrorList
.
size
());
for
(
String
strs
:
logicerrorList
){
//2 SP290206392723262586192081:11_2019-11-03T00:00:00
if
(
strs
.
trim
().
length
()<
10
){
log
.
info
(
"remove_D3_loanId_chunfu warn strs="
+
strs
);
continue
;
}
String
[]
tmpArr
=
strs
.
trim
().
split
(
"[ ]"
);
tmpArr
=
tmpArr
[
1
].
split
(
"[_]"
);
//SP290206392723262586192081,11,2019-11-03T00:00:00
err_log_loanIdMap
.
put
(
tmpArr
[
0
].
replace
(
":"
,
","
)+
","
+
tmpArr
[
1
],
strs
.
trim
());
}
logicerrorList
=
null
;
log
.
info
(
"remove_D3_loanId_chunfu err_log_loanIdMap 大小:"
+
err_log_loanIdMap
.
size
());
List
<
String
>
lineList
=
ReadOrWriteTxt
.
readTxtList
(
oldDataFile
);
log
.
info
(
"remove_D3_loanId_chunfu lineList:"
+
lineList
.
size
());
int
totalCount
=
0
,
removeCount
=
0
,
removeCount2
=
0
;
for
(
int
i
=
0
;
i
<
lineList
.
size
();
i
++){
log
.
info
(
"START:"
+
i
);
String
JsonStr
=
lineList
.
get
(
i
);
if
(
JsonStr
.
length
()
<
30
){
//#singleLoanRepayInfo
continue
;
}
RepaymentInfoZhuDai
repaymentLoanInfo
=
new
Gson
().
fromJson
(
JsonStr
,
new
TypeToken
<
RepaymentInfoZhuDai
>(){}.
getType
());
String
loanId
=
repaymentLoanInfo
.
getLoanId
();
String
key
=
loanId
+
","
+
repaymentLoanInfo
.
getTermNo
()+
","
+
repaymentLoanInfo
.
getStatusConfirmAt
();
//"errorCode":"D3_041"
if
(
err_log_loanIdMap
.
containsKey
(
key
))
{
//100011189,9,2019-02-22T00:00:00
//删掉 本次还款金额 实际还款时间 为空的一条 "realRepayment":0,"realRepaymentDate":""
if
(
repaymentLoanInfo
.
getRealRepayment
()
==
null
||
repaymentLoanInfo
.
getRealRepayment
().
intValue
()
==
0
)
{
if
(
repaymentLoanInfo
.
getRealRepaymentDate
()
==
null
||
repaymentLoanInfo
.
getRealRepaymentDate
().
equals
(
""
))
{
writeLogByName
(
rmIdFileName
,
JsonStr
);
removeCount
++;
continue
;
}
}
}
//{"errorCode":"ERR_30003"
if
(
repaymentLoanInfo
.
getMobile
()==
null
||
repaymentLoanInfo
.
getMobile
().
length
()!=
11
){
writeLogByName
(
rmPhoneFileName
,
JsonStr
);
removeCount2
++;
continue
;
}
try
{
FileUtils
.
write
(
new
File
(
newFileName
),
JsonStr
+
"\r\n"
,
"UTF-8"
,
true
);
}
catch
(
IOException
e
)
{
log
.
error
(
"remove_D3_loanId_chunfu write newD3 data error,"
+
e
);
}
totalCount
++;
}
log
.
info
(
"remove_D3_loanId_chunfu end, lineList="
+
lineList
.
size
()+
",totalCount="
+
totalCount
+
",removeCount="
+
removeCount
+
",removeCount2="
+
removeCount2
+
", 合="
+(
totalCount
+
removeCount
+
removeCount2
));
return
"lineList="
+
lineList
.
size
()+
",totalCount="
+
totalCount
+
",removeCount="
+
removeCount
+
",removeCount2="
+
removeCount2
+
", 合="
+(
totalCount
+
removeCount
+
removeCount2
);
}
/**
* 描述: 监测D3中的loanId是否在D2中 <br/>
* 参数: [d3LoanIdFile, d2File, inFileName, notInFileName] <br/>
* 返回值: java.lang.String <br/>
* 创建人: yanhui.Hao <br/>
* 创建时间: 2019.12.22 <br/>
*/
public
static
String
check_D3loanId_InD2
(
String
d3LoanIdFile
,
String
d2File
,
String
inFileName
,
String
notInFileName
)
{
List
<
String
>
d2DataList
=
ReadOrWriteTxt
.
readTxtList
(
d2File
);
Map
<
String
,
String
>
d2_loanIdMap
=
new
HashMap
<>(
d2DataList
.
size
());
int
d2size
=
0
;
for
(
String
strs
:
d2DataList
){
/* if(strs.trim().length()<30){
log.info("check_D3loanId_InD2 warn strs="+strs);
continue;
}
JSONObject d2Json = JSONObject.parseObject(strs);
d2_loanIdMap.put(d2Json.getString("loanId"), d2Json.getString("reqID"));*/
if
(
strs
.
trim
().
length
()<
1
){
log
.
info
(
"check_D3loanId_InD2 warn strs="
+
strs
);
continue
;
}
//key=loanId
d2_loanIdMap
.
put
(
strs
.
trim
(),
""
+(
d2size
++));
}
d2DataList
=
null
;
log
.
info
(
"check_D3loanId_InD2 d2DataList大小: {} , d2_loanIdMap大小: {} "
,
d2DataList
.
size
(),
d2_loanIdMap
.
size
());
//cat lhp_D3.txt |grep -v '#singleLoanRepayInfo' |awk -F '"loanId":"' '{print $2}' |awk -F '","' '{print $1}' |sort |uniq -c |more
List
<
String
>
d3LoanIdList
=
ReadOrWriteTxt
.
readTxtList
(
d3LoanIdFile
);
log
.
info
(
"check_D3loanId_InD2 d3LoanIdList:"
+
d3LoanIdList
.
size
());
int
in
=
0
,
notin
=
0
;
for
(
int
i
=
0
;
i
<
d3LoanIdList
.
size
();
i
++){
if
(
d3LoanIdList
.
get
(
i
).
trim
().
length
()<
1
){
log
.
info
(
"check_D3loanId_InD2 warn strs="
+
d3LoanIdList
.
get
(
i
).
trim
());
continue
;
}
// 2 SP12323232
String
[]
tmpArr
=
d3LoanIdList
.
get
(
i
).
trim
().
split
(
"[ ]"
);
if
(
d2_loanIdMap
.
containsKey
(
tmpArr
[
1
])){
try
{
FileUtils
.
write
(
new
File
(
inFileName
),
d3LoanIdList
.
get
(
i
).
trim
()+
"\r\n"
,
"UTF-8"
,
true
);
}
catch
(
IOException
e
)
{
log
.
error
(
"check_D3loanId_InD2 write in data error,"
+
e
);
}
in
++;
}
else
{
try
{
FileUtils
.
write
(
new
File
(
notInFileName
),
d3LoanIdList
.
get
(
i
).
trim
()+
"\r\n"
,
"UTF-8"
,
true
);
}
catch
(
IOException
e
)
{
log
.
error
(
"check_D3loanId_InD2 write notin data error,"
+
e
);
}
notin
++;
}
}
log
.
info
(
"d3LoanIdList="
+
d3LoanIdList
.
size
()+
",d2_loanIdMap="
+
d2_loanIdMap
.
size
()+
",in="
+
in
+
",notin="
+
notin
);
return
"d3LoanIdList="
+
d3LoanIdList
.
size
()+
",d2_loanIdMap="
+
d2_loanIdMap
.
size
()+
",in="
+
in
+
",notin="
+
notin
;
}
/**
* 描述: 监测D2中的loanId是否在D3中已完结 <br/>
* 参数: [d3LoanIdFile, d2File, inFileName, notInFileName] <br/>
* 返回值: java.lang.String <br/>
* 创建人: yanhui.Hao <br/>
* 创建时间: 2019.12.22 <br/>
*/
public
static
String
check_D2loanId_InD3WanJie
(
String
d3LoanIdFile
,
String
d2File
,
String
notWJFileName
)
{
List
<
String
>
d2DataList
=
ReadOrWriteTxt
.
readTxtList
(
d2File
);
Map
<
String
,
String
>
d2_loanIdMap
=
new
HashMap
<>(
d2DataList
.
size
());
int
d2size
=
0
;
for
(
String
strs
:
d2DataList
){
/*if(strs.trim().length()<30){
log.info("check_D2loanId_InD3WanJie warn strs="+strs);
continue;
}
JSONObject d2Json = JSONObject.parseObject(strs);
d2_loanIdMap.put(d2Json.getString("loanId"), ""+d2Json.getIntValue("totalTerm"));*/
if
(
strs
.
trim
().
length
()<
1
){
log
.
info
(
"check_D2loanId_InD3WanJie warn strs="
+
strs
);
continue
;
}
//key=loanId
d2_loanIdMap
.
put
(
strs
.
trim
(),
""
+(
d2size
++));
}
log
.
info
(
"check_D2loanId_InD3WanJie d2DataList大小: {}, d2_loanIdMap大小: {} "
,
d2DataList
.
size
(),
d2_loanIdMap
.
size
());
d2DataList
=
null
;
//cat lhp_D3.txt |grep '"loanStatus":3,' |awk -F '"loanId":"' '{print $2}' |awk -F '","' '{print $1}' |sort |uniq -c |more
List
<
String
>
d3LoanIdList
=
ReadOrWriteTxt
.
readTxtList
(
d3LoanIdFile
);
log
.
info
(
"check_D2loanId_InD3WanJie d3LoanIdList:"
+
d3LoanIdList
.
size
());
int
d2rmCount
=
0
,
d2_loanIdMapSize
=
d2_loanIdMap
.
size
();
for
(
int
i
=
0
;
i
<
d3LoanIdList
.
size
();
i
++){
/*if(d3LoanIdList.get(i).length()<30){
log.info("check_D2loanId_InD3WanJie warn strs="+d3LoanIdList.get(i));
continue;
}
JSONObject d3Json = JSONObject.parseObject(d3LoanIdList.get(i));
if(d3Json.containsKey("loanStatus") && d3Json.getIntValue("loanStatus")==3){
if(d2_loanIdMap.containsKey(d3Json.getString("loanId"))){
log.info("CHECK_D2LOANID_IND3WANJIE IN d2Map rm>>"+d3Json.getString("loanId")+","+d2_loanIdMap.get(d3Json.getString("loanId")));
d2_loanIdMap.remove(d3Json.getString("loanId"));
d2rmCount++;
}else{
log.error("CHECK_D2LOANID_IND3WANJIE not IN d2Map d3Msg>>>"+d3LoanIdList.get(i));
}
}*/
if
(
d3LoanIdList
.
get
(
i
).
length
()<
1
){
log
.
info
(
"check_D2loanId_InD3WanJie warn d3Sort="
+
d3LoanIdList
.
get
(
i
));
continue
;
}
// 2 SP12323232
String
[]
tmpArr
=
d3LoanIdList
.
get
(
i
).
trim
().
split
(
"[ ]"
);
if
(
tmpArr
.
length
>=
2
){
if
(
d2_loanIdMap
.
containsKey
(
tmpArr
[
1
])){
log
.
info
(
"CHECK_D2LOANID_IND3WANJIE IN d2Map rm>>"
+
tmpArr
[
1
]+
","
+
d2_loanIdMap
.
get
(
tmpArr
[
1
]));
d2_loanIdMap
.
remove
(
tmpArr
[
1
]);
d2rmCount
++;
}
else
{
log
.
error
(
"CHECK_D2LOANID_IND3WANJIE not IN d2Map d3Msg>>>"
+
d3LoanIdList
.
get
(
i
));
}
}
else
{
log
.
error
(
"CHECK_D2LOANID_IND3WANJIE d3Sort !length>=2 :"
+
d3LoanIdList
.
get
(
i
));
}
}
d3LoanIdList
=
null
;
log
.
info
(
"check_D2loanId_InD3WanJie d2_loanIdMapSize:"
+
d2_loanIdMapSize
+
",d2rmCount="
+
d2rmCount
+
",d2have="
+
d2_loanIdMap
.
size
());
if
(
d2_loanIdMap
.
size
()>
0
){
for
(
Map
.
Entry
<
String
,
String
>
d2Id_totalTerm
:
d2_loanIdMap
.
entrySet
()){
String
msg
=
d2Id_totalTerm
.
getKey
()+
","
+
d2Id_totalTerm
.
getValue
();
try
{
FileUtils
.
write
(
new
File
(
notWJFileName
),
msg
+
"\r\n"
,
"UTF-8"
,
true
);
}
catch
(
IOException
e
)
{
log
.
error
(
"check_D2loanId_InD3WanJie notWJFile error,"
+
e
);
}
}
}
return
"check_D2loanId_InD3WanJie d2_loanIdMapSize:"
+
d2_loanIdMapSize
+
",d2rmCount="
+
d2rmCount
+
",d2have="
+
d2_loanIdMap
.
size
();
}
public
static
void
buildA1_uploadTs
(
String
newJsonFile
,
String
oldJsonFile
)
{
public
static
void
buildA1_uploadTs
(
String
newJsonFile
,
String
oldJsonFile
)
{
...
@@ -1543,7 +1769,13 @@ public class ManualToolService implements CommonSuperService {
...
@@ -1543,7 +1769,13 @@ public class ManualToolService implements CommonSuperService {
//d3_logicerror_fengxi2();
//d3_logicerror_fengxi2();
d3_logicerror_fengxi3
();
//d3_logicerror_fengxi3();
remove_D3_loanId_chunfu
(
"D:\\JavaTeam\\test\\sc_D3_20161101_20180801_1.txt"
,
"D:\\JavaTeam\\test\\errLoand.txt"
,
"D:\\JavaTeam\\test\\ok1_sc_D3.txt"
,
"D:\\JavaTeam\\test\\rm_byId_err.txt"
,
"D:\\JavaTeam\\test\\rm_byPhone_err.txt"
);
}
}
...
...
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