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
d2f94560
Commit
d2f94560
authored
Dec 12, 2021
by
陈宏杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
结果校验
parent
6d8e6f7e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
27 deletions
+35
-27
BaiHangFileReportService.java
...roup/report/service/baihang/BaiHangFileReportService.java
+35
-27
No files found.
src/main/java/cn/quantgroup/report/service/baihang/BaiHangFileReportService.java
View file @
d2f94560
...
...
@@ -875,29 +875,32 @@ public class BaiHangFileReportService {
}
@Async
public
void
singleFileDataCheck
(
String
type
,
String
singleFileName
,
String
f
ieldNames
)
throws
Exception
{
public
void
singleFileDataCheck
(
String
type
,
String
singleFileName
,
String
checkF
ieldNames
)
throws
Exception
{
log
.
info
(
"{}文件数据校验开始..."
,
singleFileName
);
List
<
String
>
checkResult
=
new
ArrayList
();
File
subFile
=
null
;
Boolean
noError
=
null
;
StringBuffer
sBuffer
=
null
;
List
<
String
>
fileNameList
=
Arrays
.
asList
(
singleFileName
);
for
(
String
fileName
:
fileNameList
)
{
subFile
=
new
File
(
HOST_PATH
+
fileName
.
replace
(
"-R.cry"
,
".txt"
));
List
<
String
>
dataList
=
FileUtils
.
readLines
(
subFile
,
"utf-8"
);
List
<
String
>
fieldNameList
=
Arrays
.
asList
(
fieldNames
.
split
(
","
));
for
(
String
dataInfo
:
dataList
)
{
Boolean
noError
=
Boolean
.
TRUE
;
sBuffer
=
new
StringBuffer
(
fileName
).
append
(
","
);
String
dataStr
=
null
;
BufferedReader
bis
=
null
;
try
{
List
<
String
>
checkFieldNameList
=
Arrays
.
asList
(
checkFieldNames
.
split
(
","
));
bis
=
new
BufferedReader
(
new
FileReader
(
HOST_PATH
+
singleFileName
.
replace
(
"-R.cry"
,
".txt"
)));
while
(
null
!=
(
dataStr
=
bis
.
readLine
()))
{
if
(
StringUtils
.
isBlank
(
dataStr
)
||
StringUtils
.
equals
(
dataStr
,
"#applyInfo"
)
||
StringUtils
.
equals
(
dataStr
,
"#singleLoanAccountInfo"
)
||
StringUtils
.
equals
(
dataStr
,
"#singleLoanRepayInfo"
))
{
}
else
{
sBuffer
=
new
StringBuffer
(
singleFileName
).
append
(
","
);
noError
=
Boolean
.
TRUE
;
if
(
"A1"
.
equalsIgnoreCase
(
type
)
||
"A1Refuse"
.
equalsIgnoreCase
(
type
))
{
ApplyLoanInfoZhuDai
applyLoanInfoZhuDai
=
JSONObject
.
parseObject
(
dataInfo
,
ApplyLoanInfoZhuDai
.
class
);
ApplyLoanInfoZhuDai
applyLoanInfoZhuDai
=
JSONUtil
.
toBean
(
dataStr
,
ApplyLoanInfoZhuDai
.
class
);
log
.
info
(
"数据 {} 正在校验..."
,
applyLoanInfoZhuDai
.
getApplyId
());
sBuffer
.
append
(
applyLoanInfoZhuDai
.
getApplyId
()).
append
(
","
);
for
(
String
fieldName
:
f
ieldNameList
)
{
Field
declaredField
=
ApplyLoanInfoZhuDai
.
class
.
getDeclaredField
(
f
ieldName
);
Object
property
=
BeanUtil
.
getProperty
(
applyLoanInfoZhuDai
,
f
ieldName
);
if
(
Objects
.
isNull
(
property
)
||
Objects
.
isNull
(
declaredField
))
{
for
(
String
checkFieldName
:
checkF
ieldNameList
)
{
Field
declaredField
=
ApplyLoanInfoZhuDai
.
class
.
getDeclaredField
(
checkF
ieldName
);
Object
property
=
BeanUtil
.
getProperty
(
applyLoanInfoZhuDai
,
checkF
ieldName
);
if
(
Objects
.
isNull
(
property
)
||
Objects
.
isNull
(
declaredField
)
||
StringUtils
.
isBlank
(
property
.
toString
()
))
{
noError
=
Boolean
.
FALSE
;
sBuffer
.
append
(
f
ieldName
).
append
(
","
);
sBuffer
.
append
(
checkF
ieldName
).
append
(
","
);
}
}
}
...
...
@@ -910,6 +913,11 @@ public class BaiHangFileReportService {
File
file
=
new
File
(
HOST_PATH
+
type
+
"_fileDataCheck_"
+
DateUtils
.
formatDate
(
new
Date
(),
"yyyyMMddHHmmsss"
)
+
".txt"
);
FileUtils
.
writeLines
(
file
,
checkResult
,
Boolean
.
TRUE
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"{}文件数据校验异常"
,
singleFileName
,
e
);
}
finally
{
IoUtil
.
close
(
bis
);
}
log
.
info
(
"{}文件数据校验结束"
,
singleFileName
);
}
...
...
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