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
49f140b8
Commit
49f140b8
authored
Jun 04, 2021
by
郑建
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加执行天间隔逻辑 防止单周期内数据量太大执行失败
parent
44d05d95
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
29 deletions
+44
-29
ManualToolController.java
...cn/quantgroup/report/controller/ManualToolController.java
+7
-2
BaiHangFileReportService.java
...roup/report/service/baihang/BaiHangFileReportService.java
+37
-27
No files found.
src/main/java/cn/quantgroup/report/controller/ManualToolController.java
View file @
49f140b8
...
@@ -159,8 +159,13 @@ public class ManualToolController {
...
@@ -159,8 +159,13 @@ public class ManualToolController {
}
}
@RequestMapping
(
"/createFile"
)
@RequestMapping
(
"/createFile"
)
public
void
testD2Repost
(
String
type
,
String
startDate
,
String
endDate
){
public
String
testD2Repost
(
String
type
,
String
startDate
,
String
endDate
,
Integer
daySpilt
){
fileReportService
.
createReportFile
(
type
,
startDate
+
"T00:00:00"
,
endDate
+
"T00:00:00"
);
try
{
fileReportService
.
createReportFile
(
type
,
startDate
,
endDate
,
daySpilt
);
return
"SUCCESS"
;
}
catch
(
Exception
e
){
return
e
.
getMessage
();
}
}
}
}
}
src/main/java/cn/quantgroup/report/service/baihang/BaiHangFileReportService.java
View file @
49f140b8
...
@@ -27,10 +27,7 @@ import org.springframework.stereotype.Service;
...
@@ -27,10 +27,7 @@ import org.springframework.stereotype.Service;
import
java.io.File
;
import
java.io.File
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.UUID
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
...
@@ -65,38 +62,53 @@ public class BaiHangFileReportService {
...
@@ -65,38 +62,53 @@ public class BaiHangFileReportService {
/**
/**
* 创建报送文件 通常用于存量报送
* 创建报送文件 通常用于存量报送
* @param type 报送类型 A1:申请信息 D2:放款信息 D3:还款信息
* @param type 报送类型 A1:申请信息 D2:放款信息 D3:还款信息
* @param start
Date
报送区间的开始时间 格式:"2019-05-07T00:00:00"
* @param start 报送区间的开始时间 格式:"2019-05-07T00:00:00"
* @param end
Date
报送区间的截止时间 格式:"2019-05-07T00:00:00"
* @param end 报送区间的截止时间 格式:"2019-05-07T00:00:00"
*/
*/
public
void
createReportFile
(
String
type
,
String
startDate
,
String
endDate
)
{
@Async
if
(
StringUtils
.
isAnyBlank
(
type
,
startDate
,
endDate
))
{
public
void
createReportFile
(
String
type
,
String
start
,
String
end
,
int
daySplitCount
)
{
if
(
StringUtils
.
isAnyBlank
(
type
,
start
,
end
))
{
throw
new
QGException
(
COMMON_ILLEGAL_PARAM_TOAST
,
"存在为空参数"
);
throw
new
QGException
(
COMMON_ILLEGAL_PARAM_TOAST
,
"存在为空参数"
);
}
}
if
(
startDate
.
length
()
!=
19
||
endDate
.
length
()
!=
19
||
!
startDate
.
contains
(
"T"
)
||
!
endDate
.
contains
(
"T"
))
{
String
dateFormat
=
"yyyy-MM-dd"
;
log
.
warn
(
"日期格式有误, startDate : {} , endDate : {} "
,
startDate
,
endDate
);
Date
stepStartDate
=
DateUtils
.
parseDate
(
dateFormat
,
start
);
throw
new
QGException
(
COMMON_ILLEGAL_PARAM_TOAST
,
"日期格式错误"
);
Date
stepEndDate
=
org
.
apache
.
commons
.
lang3
.
time
.
DateUtils
.
addDays
(
stepStartDate
,
daySplitCount
);
Date
endDate
=
DateUtils
.
parseDate
(
dateFormat
,
end
);
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
while
(
stepEndDate
.
getTime
()
<=
endDate
.
getTime
()){
createReportFile
(
type
,
stepStartDate
,
stepEndDate
);
stepStartDate
=
new
Date
(
stepEndDate
.
getTime
());
stepEndDate
=
org
.
apache
.
commons
.
lang3
.
time
.
DateUtils
.
addDays
(
stepEndDate
,
daySplitCount
);
}
}
String
starTime
=
LocalDateTime
.
parse
(
startDate
).
format
(
DateTimeFormatter
.
ISO_DATE
);
log
.
info
(
"当前 {} -- {}--{} 任务执行结束 总耗时 : {}"
,
type
,
start
,
end
,
stopwatch
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
String
endTime
=
LocalDateTime
.
parse
(
endDate
).
format
(
DateTimeFormatter
.
ISO_DATE
);
if
(
stepEndDate
.
getTime
()
>
endDate
.
getTime
()){
if
(
"A1"
.
equalsIgnoreCase
(
type
))
{
createReportFile
(
type
,
stepStartDate
,
endDate
);
reportA1
(
starTime
,
endTime
);
}
else
if
(
"D2"
.
equalsIgnoreCase
(
type
))
{
reportD2
(
starTime
,
endTime
);
}
else
if
(
"D3"
.
equalsIgnoreCase
(
type
))
{
reportD3
(
starTime
,
endTime
);
}
else
{
throw
new
QGException
(
COMMON_ILLEGAL_PARAM_TOAST
,
"报送类型不正确"
);
}
}
}
}
private
void
createReportFile
(
String
type
,
Date
startDate
,
Date
endDate
)
{
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
String
starTime
=
DateUtils
.
formatDate
(
startDate
,
"yyyy-MM-dd hh:mm:ss"
);
String
endTime
=
DateUtils
.
formatDate
(
endDate
,
"yyyy-MM-dd hh:mm:ss"
);
log
.
info
(
"开始生成报送文件{}----- {} -- {}"
,
type
,
starTime
,
endTime
);
// if ("A1".equalsIgnoreCase(type)) {
// reportA1(starTime,endTime);
// } else if ("D2".equalsIgnoreCase(type)) {
// reportD2(starTime,endTime);
// } else if ("D3".equalsIgnoreCase(type)) {
// reportD3(starTime,endTime);
// } else {
// throw new QGException(COMMON_ILLEGAL_PARAM_TOAST,"报送类型不正确");
// }
log
.
info
(
"生成报送文件结束{}----- {} -- {},耗时 {}"
,
type
,
starTime
,
endTime
,
stopwatch
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
}
/**
/**
* 贷款申请信息(A1) 暂时不支持A1报送
* 贷款申请信息(A1) 暂时不支持A1报送
* @param starTime 开始时间
* @param starTime 开始时间
* @param endTime 截止时间
* @param endTime 截止时间
*/
*/
@Async
private
void
reportA1
(
String
starTime
,
String
endTime
){
public
void
reportA1
(
String
starTime
,
String
endTime
){
throw
new
QGException
(
COMMON_ILLEGAL_PARAM_TOAST
,
"报送类型暂不支持"
);
throw
new
QGException
(
COMMON_ILLEGAL_PARAM_TOAST
,
"报送类型暂不支持"
);
}
}
...
@@ -105,8 +117,7 @@ public class BaiHangFileReportService {
...
@@ -105,8 +117,7 @@ public class BaiHangFileReportService {
* @param starTime 开始时间
* @param starTime 开始时间
* @param endTime 截至时间
* @param endTime 截至时间
*/
*/
@Async
private
void
reportD2
(
String
starTime
,
String
endTime
)
{
public
void
reportD2
(
String
starTime
,
String
endTime
)
{
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
try
{
try
{
List
<
LoanInfoZhuDai
>
loanInfozdList
=
loanInfoMapper
.
queryStockLoanInfoZhuDai
(
BaiHangTimeRecord
.
builder
().
startTime
(
starTime
).
endTime
(
endTime
).
build
());
List
<
LoanInfoZhuDai
>
loanInfozdList
=
loanInfoMapper
.
queryStockLoanInfoZhuDai
(
BaiHangTimeRecord
.
builder
().
startTime
(
starTime
).
endTime
(
endTime
).
build
());
...
@@ -170,8 +181,7 @@ public class BaiHangFileReportService {
...
@@ -170,8 +181,7 @@ public class BaiHangFileReportService {
* @param startTime 开始时间
* @param startTime 开始时间
* @param endTime 截止时间
* @param endTime 截止时间
*/
*/
@Async
private
void
reportD3
(
String
startTime
,
String
endTime
)
{
public
void
reportD3
(
String
startTime
,
String
endTime
)
{
for
(
int
j
=
0
;
j
<
2
;
j
++)
{
for
(
int
j
=
0
;
j
<
2
;
j
++)
{
List
<
String
>
reportList
=
new
ArrayList
<>();
List
<
String
>
reportList
=
new
ArrayList
<>();
reportList
.
add
(
"#singleLoanRepayInfo"
);
reportList
.
add
(
"#singleLoanRepayInfo"
);
...
...
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