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
9db0911c
Commit
9db0911c
authored
Dec 11, 2021
by
陈宏杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
单文件
parent
078e4e2d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
27 deletions
+55
-27
ManualToolController.java
...cn/quantgroup/report/controller/ManualToolController.java
+13
-3
BaiHangFileReportService.java
...roup/report/service/baihang/BaiHangFileReportService.java
+42
-24
No files found.
src/main/java/cn/quantgroup/report/controller/ManualToolController.java
View file @
9db0911c
...
@@ -195,10 +195,20 @@ public class ManualToolController {
...
@@ -195,10 +195,20 @@ public class ManualToolController {
}
}
}
}
@RequestMapping
(
"/fileDataCheck"
)
@RequestMapping
(
"/file
Collect
DataCheck"
)
public
String
fileDataCheck
(
String
type
,
String
collectFileName
,
String
fieldNames
){
public
String
file
Collect
DataCheck
(
String
type
,
String
collectFileName
,
String
fieldNames
){
try
{
try
{
fileReportService
.
fileDataCheck
(
type
,
collectFileName
,
fieldNames
);
fileReportService
.
fileCollectDataCheck
(
type
,
collectFileName
,
fieldNames
);
return
"SUCCESS"
;
}
catch
(
Exception
e
){
return
e
.
getMessage
();
}
}
@RequestMapping
(
"/singleFileDataCheck"
)
public
String
singleFileDataCheck
(
String
type
,
String
collectFileName
,
String
fieldNames
){
try
{
fileReportService
.
singleFileDataCheck
(
type
,
collectFileName
,
fieldNames
);
return
"SUCCESS"
;
return
"SUCCESS"
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
return
e
.
getMessage
();
return
e
.
getMessage
();
...
...
src/main/java/cn/quantgroup/report/service/baihang/BaiHangFileReportService.java
View file @
9db0911c
...
@@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
...
@@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.io.File
;
import
java.io.File
;
import
java.lang.reflect.Field
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
...
@@ -851,44 +852,61 @@ public class BaiHangFileReportService {
...
@@ -851,44 +852,61 @@ public class BaiHangFileReportService {
}
}
@Async
@Async
public
void
fileDataCheck
(
String
type
,
String
collectFileName
,
String
fieldNames
)
throws
Exception
{
public
void
fileCollectDataCheck
(
String
type
,
String
collectFileName
,
String
fieldNames
)
throws
Exception
{
log
.
info
(
"{}集合文件数据校验开始..."
,
collectFileName
);
if
(
StringUtils
.
isBlank
(
collectFileName
))
{
if
(
StringUtils
.
isBlank
(
collectFileName
))
{
return
;
return
;
}
}
log
.
info
(
"{}文件数据校验开始..."
,
collectFileName
);
List
<
String
>
checkResult
=
new
ArrayList
();
File
collectFile
=
new
File
(
HOST_PATH
+
collectFileName
);
File
collectFile
=
new
File
(
HOST_PATH
+
collectFileName
);
File
subFile
=
null
;
StringBuffer
sBuffer
=
null
;
if
(
collectFile
.
exists
())
{
if
(
collectFile
.
exists
())
{
List
<
String
>
fileNameList
=
FileUtils
.
readLines
(
collectFile
,
"utf-8"
);
List
<
String
>
fileNameList
=
FileUtils
.
readLines
(
collectFile
,
"utf-8"
);
for
(
String
fileName
:
fileNameList
)
{
for
(
String
fileName
:
fileNameList
)
{
if
(
StringUtils
.
isNotBlank
(
fileName
))
{
if
(
StringUtils
.
isNotBlank
(
fileName
))
{
subFile
=
new
File
(
HOST_PATH
+
fileName
.
replace
(
"-R.cry"
,
".txt"
));
singleFileDataCheck
(
type
,
fileName
,
fieldNames
);
List
<
String
>
dataList
=
FileUtils
.
readLines
(
subFile
,
"utf-8"
);
}
for
(
String
dataInfo
:
dataList
)
{
}
if
(
"A1"
.
equalsIgnoreCase
(
type
)
||
"A1Refuse"
.
equalsIgnoreCase
(
type
))
{
}
ApplyLoanInfoZhuDai
applyLoanInfoZhuDai
=
JSONObject
.
parseObject
(
dataInfo
,
ApplyLoanInfoZhuDai
.
class
);
log
.
info
(
"{}集合文件数据校验结束"
,
collectFileName
);
sBuffer
=
new
StringBuffer
(
fileName
).
append
(
","
);
}
sBuffer
.
append
(
applyLoanInfoZhuDai
.
getApplyId
()).
append
(
","
);
List
<
String
>
fieldNameList
=
Arrays
.
asList
(
fieldNames
.
split
(
","
));
@Async
for
(
String
fieldName
:
fieldNameList
)
{
public
void
singleFileDataCheck
(
String
type
,
String
singleFileName
,
String
fieldNames
)
throws
Exception
{
Object
property
=
BeanUtil
.
getProperty
(
applyLoanInfoZhuDai
,
fieldName
);
log
.
info
(
"{}文件数据校验开始..."
,
singleFileName
);
if
(
Objects
.
isNull
(
property
))
{
List
<
String
>
checkResult
=
new
ArrayList
();
sBuffer
.
append
(
fieldName
).
append
(
"is null"
).
append
(
","
);
File
subFile
=
null
;
}
StringBuffer
sBuffer
=
null
;
List
<
String
>
fileNameList
=
Arrays
.
asList
(
singleFileName
);
for
(
String
fileName
:
fileNameList
)
{
if
(
StringUtils
.
isNotBlank
(
fileName
))
{
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
(
","
);
if
(
"A1"
.
equalsIgnoreCase
(
type
)
||
"A1Refuse"
.
equalsIgnoreCase
(
type
))
{
ApplyLoanInfoZhuDai
applyLoanInfoZhuDai
=
JSONObject
.
parseObject
(
dataInfo
,
ApplyLoanInfoZhuDai
.
class
);
sBuffer
.
append
(
applyLoanInfoZhuDai
.
getApplyId
()).
append
(
","
);
for
(
String
fieldName
:
fieldNameList
)
{
Field
declaredField
=
ApplyLoanInfoZhuDai
.
class
.
getDeclaredField
(
fieldName
);
Object
property
=
BeanUtil
.
getProperty
(
applyLoanInfoZhuDai
,
fieldName
);
if
(
Objects
.
isNull
(
property
)
||
Objects
.
isNull
(
declaredField
))
{
noError
=
Boolean
.
FALSE
;
sBuffer
.
append
(
fieldName
).
append
(
","
);
}
}
}
}
checkResult
.
add
(
sBuffer
.
append
(
"\\r\\n"
).
toString
());
}
if
(!
noError
)
{
checkResult
.
add
(
sBuffer
.
append
(
System
.
getProperty
(
"line.separator"
)).
toString
());
}
}
}
}
}
}
if
(!
CollectionUtils
.
isEmpty
(
checkResult
))
{
File
file
=
new
File
(
HOST_PATH
+
type
+
"_fileDataCheck_"
+
DateUtils
.
formatDate
(
new
Date
(),
"yyyyMMddHHmmsss"
)
+
".txt"
);
FileUtils
.
writeLines
(
file
,
checkResult
,
Boolean
.
FALSE
);
}
}
}
log
.
info
(
"{}文件数据校验结束"
,
collectFileName
);
if
(!
CollectionUtils
.
isEmpty
(
checkResult
))
{
File
file
=
new
File
(
HOST_PATH
+
type
+
"_fileDataCheck_"
+
DateUtils
.
formatDate
(
new
Date
(),
"yyyyMMddHHmmsss"
)
+
".txt"
);
FileUtils
.
writeLines
(
file
,
checkResult
,
Boolean
.
TRUE
);
}
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