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
bba4e5b1
Commit
bba4e5b1
authored
Nov 08, 2019
by
郝彦辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
异步跑存量数据时,支持停止功能
parent
4eaa531e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
15 deletions
+71
-15
ExZhuDaiBaiHangReSendController.java
.../controller/external/ExZhuDaiBaiHangReSendController.java
+13
-9
BaiHangZhuDaiService.java
...antgroup/report/service/baihang/BaiHangZhuDaiService.java
+48
-4
DateUtils.java
src/main/java/cn/quantgroup/report/utils/DateUtils.java
+10
-2
No files found.
src/main/java/cn/quantgroup/report/controller/external/ExZhuDaiBaiHangReSendController.java
View file @
bba4e5b1
package
cn
.
quantgroup
.
report
.
controller
.
external
;
package
cn
.
quantgroup
.
report
.
controller
.
external
;
import
cn.quantgroup.report.domain.baihang.*
;
import
cn.quantgroup.report.response.GlobalResponse
;
import
cn.quantgroup.report.response.GlobalResponse
;
import
cn.quantgroup.report.service.baihang.BaiHangZhuDaiService
;
import
cn.quantgroup.report.service.baihang.BaiHangZhuDaiService
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.base.Stopwatch
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.UUID
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.atomic.AtomicInteger
;
/**
/**
* 百行征信报送出现错误的贷款记录信息重新报送
* 百行征信报送出现错误的贷款记录信息重新报送
...
@@ -231,4 +222,17 @@ public class ExZhuDaiBaiHangReSendController {
...
@@ -231,4 +222,17 @@ public class ExZhuDaiBaiHangReSendController {
return
"请求type="
+
type
+
",startDate="
+
startDate
+
",noEndDate="
+
noEndDate
+
",调度结束"
;
return
"请求type="
+
type
+
",startDate="
+
startDate
+
",noEndDate="
+
noEndDate
+
",调度结束"
;
}
}
@RequestMapping
(
"/manual/build/zhuDaiStockStop"
)
public
String
zhuDaiStockStop
(
String
type
,
String
value
)
{
if
(
StringUtils
.
isAnyBlank
(
type
))
{
return
"参数为空"
;
}
boolean
val
=
false
;
if
(
StringUtils
.
isNotBlank
(
value
)
&&
"true"
.
equals
(
value
)){
val
=
true
;
}
return
baiHangZhuDaiService
.
zhuDaiStockStop
(
type
,
val
);
}
}
}
src/main/java/cn/quantgroup/report/service/baihang/BaiHangZhuDaiService.java
View file @
bba4e5b1
...
@@ -43,6 +43,7 @@ import java.time.format.DateTimeFormatter;
...
@@ -43,6 +43,7 @@ import java.time.format.DateTimeFormatter;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
/**
/**
...
@@ -112,6 +113,10 @@ public class BaiHangZhuDaiService {
...
@@ -112,6 +113,10 @@ public class BaiHangZhuDaiService {
//联合贷产品上线时间,上线后才有数据
//联合贷产品上线时间,上线后才有数据
private
static
LocalDateTime
liang_he_dai_start
=
LocalDateTime
.
parse
(
"2019-10-25T00:00:00"
);
private
static
LocalDateTime
liang_he_dai_start
=
LocalDateTime
.
parse
(
"2019-10-25T00:00:00"
);
private
static
AtomicBoolean
A1_Stop
=
new
AtomicBoolean
(
false
);
private
static
AtomicBoolean
D2_Stop
=
new
AtomicBoolean
(
false
);
private
static
AtomicBoolean
D3_Stop
=
new
AtomicBoolean
(
false
);
@PostConstruct
@PostConstruct
public
void
init
(){
public
void
init
(){
...
@@ -564,6 +569,10 @@ public class BaiHangZhuDaiService {
...
@@ -564,6 +569,10 @@ public class BaiHangZhuDaiService {
long
sUtc1
=
System
.
currentTimeMillis
();
long
sUtc1
=
System
.
currentTimeMillis
();
while
(
true
)
{
while
(
true
)
{
if
(
A1_Stop
.
get
()){
log
.
error
(
"All申请存量数据查询STOP, A1_Stop: {} , endTime: {} "
,
A1_Stop
.
get
(),
erlyDate
.
plusDays
(
counter
).
format
(
DateTimeFormatter
.
ISO_DATE
));
break
;
}
counter
++;
counter
++;
if
(
erlyDate
.
plusDays
(
counter
).
compareTo
(
endDate
)
>
0
)
{
if
(
erlyDate
.
plusDays
(
counter
).
compareTo
(
endDate
)
>
0
)
{
break
;
break
;
...
@@ -647,6 +656,11 @@ public class BaiHangZhuDaiService {
...
@@ -647,6 +656,11 @@ public class BaiHangZhuDaiService {
int
counter
=
0
;
int
counter
=
0
;
log
.
info
(
"开始>>百行-助贷放款存量数据整理, startDate : {} , noEndDate : {} ......"
,
startDate
,
noEndDate
);
log
.
info
(
"开始>>百行-助贷放款存量数据整理, startDate : {} , noEndDate : {} ......"
,
startDate
,
noEndDate
);
while
(
true
)
{
while
(
true
)
{
if
(
D2_Stop
.
get
()){
log
.
error
(
"All放款存量数据查询STOP, D2_Stop: {} , endTime: {} "
,
D2_Stop
.
get
(),
erlyDate
.
plusDays
(
counter
).
format
(
DateTimeFormatter
.
ISO_DATE
));
break
;
}
counter
++;
counter
++;
if
(
erlyDate
.
plusDays
(
counter
).
compareTo
(
endDate
)
>
0
)
{
if
(
erlyDate
.
plusDays
(
counter
).
compareTo
(
endDate
)
>
0
)
{
break
;
break
;
...
@@ -754,6 +768,11 @@ public class BaiHangZhuDaiService {
...
@@ -754,6 +768,11 @@ public class BaiHangZhuDaiService {
int
counter
=
0
;
int
counter
=
0
;
log
.
info
(
"开始>>整理百行-助贷还款&逾期存量数据 startDate : {} , noEndDate : {} ......"
,
startDate
,
noEndDate
);
log
.
info
(
"开始>>整理百行-助贷还款&逾期存量数据 startDate : {} , noEndDate : {} ......"
,
startDate
,
noEndDate
);
while
(
true
)
{
while
(
true
)
{
if
(
D3_Stop
.
get
()){
log
.
error
(
"All还款&逾期存量数据查询STOP, D3_Stop: {} , endTime: {} "
,
D3_Stop
.
get
(),
erlyDate
.
plusDays
(
counter
).
format
(
DateTimeFormatter
.
ISO_DATE
));
break
;
}
counter
++;
counter
++;
if
(
erlyDate
.
plusDays
(
counter
).
compareTo
(
endDate
)
>
0
)
{
if
(
erlyDate
.
plusDays
(
counter
).
compareTo
(
endDate
)
>
0
)
{
break
;
break
;
...
@@ -1331,9 +1350,28 @@ public class BaiHangZhuDaiService {
...
@@ -1331,9 +1350,28 @@ public class BaiHangZhuDaiService {
}
}
}
}
public
String
zhuDaiStockStop
(
String
type
,
boolean
value
)
{
if
(
"A1"
.
equalsIgnoreCase
(
type
))
{
//贷款申请信息(A1)
A1_Stop
.
set
(
value
);
return
"A1_Stop="
+
A1_Stop
.
get
();
}
else
if
(
"D2"
.
equalsIgnoreCase
(
type
))
{
//非循环贷款账户数据信息(D2)
D2_Stop
.
set
(
value
);
return
"D2_Stop="
+
D2_Stop
.
get
();
}
else
if
(
"D3"
.
equalsIgnoreCase
(
type
))
{
//非循环贷款贷后数据信息(D3)
D3_Stop
.
set
(
value
);
return
"D3_Stop="
+
D3_Stop
.
get
();
}
else
{
log
.
warn
(
"Async zhuDaiStockStop 参数 type: {} 未知."
,
type
);
return
"未知type="
+
type
;
}
}
/*
public static void main(String[] args) {
public
static
void
main
(
String
[]
args
)
{
LocalDateTime erlyDate = LocalDateTime.parse("2019-05-01T00:00:00");
/*
LocalDateTime erlyDate = LocalDateTime.parse("2019-05-01T00:00:00");
LocalDateTime endDate = LocalDateTime.parse("2019-05-10T00:00:00");
LocalDateTime endDate = LocalDateTime.parse("2019-05-10T00:00:00");
int counter = 0;
int counter = 0;
...
@@ -1346,7 +1384,13 @@ public class BaiHangZhuDaiService {
...
@@ -1346,7 +1384,13 @@ public class BaiHangZhuDaiService {
String starTime = erlyDate.plusDays(counter - 1).format(DateTimeFormatter.ISO_DATE);
String starTime = erlyDate.plusDays(counter - 1).format(DateTimeFormatter.ISO_DATE);
String endTime = erlyDate.plusDays(counter).format(DateTimeFormatter.ISO_DATE);
String endTime = erlyDate.plusDays(counter).format(DateTimeFormatter.ISO_DATE);
System.out.println("starTime="+starTime+",endTime="+endTime);
System.out.println("starTime="+starTime+",endTime="+endTime);
}
}*/
}*/
AtomicBoolean
D2_Stop
=
new
AtomicBoolean
(
false
);
System
.
out
.
println
(
D2_Stop
.
get
());
D2_Stop
.
set
(
true
);
System
.
out
.
println
(
D2_Stop
.
get
());
}
}
}
src/main/java/cn/quantgroup/report/utils/DateUtils.java
View file @
bba4e5b1
...
@@ -954,7 +954,7 @@ public class DateUtils {
...
@@ -954,7 +954,7 @@ public class DateUtils {
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
DateFormat
df
=
new
SimpleDateFormat
(
"MM-dd"
);
/*
DateFormat df = new SimpleDateFormat("MM-dd");
// int currentTimeHour = getCurrentTimeHour();
// int currentTimeHour = getCurrentTimeHour();
// System.out.println(currentTimeHour);
// System.out.println(currentTimeHour);
Date startTime = DateUtils.getHistoryZeroDateByN(7);
Date startTime = DateUtils.getHistoryZeroDateByN(7);
...
@@ -963,7 +963,15 @@ public class DateUtils {
...
@@ -963,7 +963,15 @@ public class DateUtils {
System.out.println(formatDate(new Date(), "yyyy-MM-dd"));
System.out.println(formatDate(new Date(), "yyyy-MM-dd"));
System.out.println(DateUtils.getHistoryZeroDateByN(1));
System.out.println(DateUtils.getHistoryZeroDateByN(1));
System.out.println(today);
System.out.println(today);
System
.
out
.
println
(
df
.
format
(
startTime
));
System.out.println(df.format(startTime));*/
Date
date1
=
DateUtils
.
parseDate
(
"2017-05-29"
);
Date
date2
=
DateUtils
.
parseDate
(
"2019-10-25"
);
int
dff
=
DateUtils
.
differentDaysByMillisecond
(
date1
,
date2
);
System
.
out
.
println
(
"dff="
+
dff
+
",H="
+
dff
*
3
/
60
);
}
}
}
}
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