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
078e4e2d
Commit
078e4e2d
authored
Dec 11, 2021
by
陈宏杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据校验
parent
0f3c0fb7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
0 deletions
+58
-0
pom.xml
pom.xml
+6
-0
ManualToolController.java
...cn/quantgroup/report/controller/ManualToolController.java
+10
-0
BaiHangFileReportService.java
...roup/report/service/baihang/BaiHangFileReportService.java
+42
-0
No files found.
pom.xml
View file @
078e4e2d
...
@@ -281,6 +281,12 @@
...
@@ -281,6 +281,12 @@
<artifactId>
spring-cloud-starter-eureka-server
</artifactId>
<artifactId>
spring-cloud-starter-eureka-server
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
5.4.1
</version>
</dependency>
</dependencies>
</dependencies>
<dependencyManagement>
<dependencyManagement>
...
...
src/main/java/cn/quantgroup/report/controller/ManualToolController.java
View file @
078e4e2d
...
@@ -195,4 +195,14 @@ public class ManualToolController {
...
@@ -195,4 +195,14 @@ public class ManualToolController {
}
}
}
}
@RequestMapping
(
"/fileDataCheck"
)
public
String
fileDataCheck
(
String
type
,
String
collectFileName
,
String
fieldNames
){
try
{
fileReportService
.
fileDataCheck
(
type
,
collectFileName
,
fieldNames
);
return
"SUCCESS"
;
}
catch
(
Exception
e
){
return
e
.
getMessage
();
}
}
}
}
src/main/java/cn/quantgroup/report/service/baihang/BaiHangFileReportService.java
View file @
078e4e2d
package
cn
.
quantgroup
.
report
.
service
.
baihang
;
package
cn
.
quantgroup
.
report
.
service
.
baihang
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.quantgroup.report.domain.baihang.*
;
import
cn.quantgroup.report.domain.baihang.*
;
import
cn.quantgroup.report.error.QGException
;
import
cn.quantgroup.report.error.QGException
;
import
cn.quantgroup.report.mapper.baihang.ApplyLoanInfoMapper
;
import
cn.quantgroup.report.mapper.baihang.ApplyLoanInfoMapper
;
...
@@ -849,4 +850,45 @@ public class BaiHangFileReportService {
...
@@ -849,4 +850,45 @@ public class BaiHangFileReportService {
}
}
}
}
@Async
public
void
fileDataCheck
(
String
type
,
String
collectFileName
,
String
fieldNames
)
throws
Exception
{
if
(
StringUtils
.
isBlank
(
collectFileName
))
{
return
;
}
log
.
info
(
"{}文件数据校验开始..."
,
collectFileName
);
List
<
String
>
checkResult
=
new
ArrayList
();
File
collectFile
=
new
File
(
HOST_PATH
+
collectFileName
);
File
subFile
=
null
;
StringBuffer
sBuffer
=
null
;
if
(
collectFile
.
exists
())
{
List
<
String
>
fileNameList
=
FileUtils
.
readLines
(
collectFile
,
"utf-8"
);
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"
);
for
(
String
dataInfo
:
dataList
)
{
if
(
"A1"
.
equalsIgnoreCase
(
type
)
||
"A1Refuse"
.
equalsIgnoreCase
(
type
))
{
ApplyLoanInfoZhuDai
applyLoanInfoZhuDai
=
JSONObject
.
parseObject
(
dataInfo
,
ApplyLoanInfoZhuDai
.
class
);
sBuffer
=
new
StringBuffer
(
fileName
).
append
(
","
);
sBuffer
.
append
(
applyLoanInfoZhuDai
.
getApplyId
()).
append
(
","
);
List
<
String
>
fieldNameList
=
Arrays
.
asList
(
fieldNames
.
split
(
","
));
for
(
String
fieldName
:
fieldNameList
)
{
Object
property
=
BeanUtil
.
getProperty
(
applyLoanInfoZhuDai
,
fieldName
);
if
(
Objects
.
isNull
(
property
))
{
sBuffer
.
append
(
fieldName
).
append
(
"is null"
).
append
(
","
);
}
}
}
checkResult
.
add
(
sBuffer
.
append
(
"\\r\\n"
).
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
);
}
}
}
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