Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dc-java
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
huluobin
dc-java
Commits
34a59135
Commit
34a59135
authored
Jul 24, 2019
by
wutong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整try catch代码范围
parent
8866309e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
AmazonAdProductJob.java
...d/src/main/java/com/bailuntec/job/AmazonAdProductJob.java
+19
-10
No files found.
data-base/base-sync-amazon-ad/src/main/java/com/bailuntec/job/AmazonAdProductJob.java
View file @
34a59135
...
@@ -2,18 +2,18 @@ package com.bailuntec.job;
...
@@ -2,18 +2,18 @@ package com.bailuntec.job;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.bailuntec.domain.enumerate.CurrencyType
;
import
com.bailuntec.domain.pojo.AmazonAdAuth
;
import
com.bailuntec.domain.pojo.AmazonAdProduct
;
import
com.bailuntec.domain.pojo.AmazonAdReportLocationResult
;
import
com.bailuntec.domain.pojo.AmazonAdSuccessResult
;
import
com.bailuntec.domain.entity.DcBaseCompanyAccount
;
import
com.bailuntec.domain.entity.DcBaseCompanyAccount
;
import
com.bailuntec.domain.entity.DcBaseFinanceAmazonAdProduct
;
import
com.bailuntec.domain.entity.DcBaseFinanceAmazonAdProduct
;
import
com.bailuntec.domain.entity.JobAccountLog
;
import
com.bailuntec.domain.entity.JobAccountLog
;
import
com.bailuntec.domain.entity.JobPointLog
;
import
com.bailuntec.domain.entity.JobPointLog
;
import
com.bailuntec.domain.enumerate.CurrencyType
;
import
com.bailuntec.domain.example.DcBaseCompanyAccountExample
;
import
com.bailuntec.domain.example.DcBaseCompanyAccountExample
;
import
com.bailuntec.domain.example.DcBaseFinanceAmazonAdProductExample
;
import
com.bailuntec.domain.example.DcBaseFinanceAmazonAdProductExample
;
import
com.bailuntec.domain.example.JobAccountLogExample
;
import
com.bailuntec.domain.example.JobAccountLogExample
;
import
com.bailuntec.domain.pojo.AmazonAdAuth
;
import
com.bailuntec.domain.pojo.AmazonAdProduct
;
import
com.bailuntec.domain.pojo.AmazonAdReportLocationResult
;
import
com.bailuntec.domain.pojo.AmazonAdSuccessResult
;
import
com.bailuntec.mapper.DcBaseCompanyAccountMapper
;
import
com.bailuntec.mapper.DcBaseCompanyAccountMapper
;
import
com.bailuntec.mapper.DcBaseFinanceAmazonAdProductMapper
;
import
com.bailuntec.mapper.DcBaseFinanceAmazonAdProductMapper
;
import
com.bailuntec.mapper.JobAccountLogMapper
;
import
com.bailuntec.mapper.JobAccountLogMapper
;
...
@@ -32,7 +32,6 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -32,7 +32,6 @@ import org.apache.commons.lang3.StringUtils;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.lang.reflect.InvocationTargetException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
...
@@ -175,12 +174,16 @@ public class AmazonAdProductJob extends PointJob {
...
@@ -175,12 +174,16 @@ public class AmazonAdProductJob extends PointJob {
.
build
();
.
build
();
response
=
client
.
newCall
(
request
).
execute
();
response
=
client
.
newCall
(
request
).
execute
();
if
(
response
.
isSuccessful
())
{
if
(
response
.
isSuccessful
())
{
GZIPInputStream
gzin
=
new
GZIPInputStream
(
response
.
body
().
byteStream
());
GZIPInputStream
gzin
=
null
;
InputStreamReader
isr
=
new
InputStreamReader
(
gzin
,
"utf8"
);
InputStreamReader
isr
=
null
;
BufferedReader
bufferedReader
=
new
BufferedReader
(
isr
);
BufferedReader
bufferedReader
=
null
;
try
{
gzin
=
new
GZIPInputStream
(
response
.
body
().
byteStream
());
isr
=
new
InputStreamReader
(
gzin
,
"utf8"
);
bufferedReader
=
new
BufferedReader
(
isr
);
StringBuffer
sb
=
new
StringBuffer
();
StringBuffer
sb
=
new
StringBuffer
();
String
str
=
null
;
String
str
=
null
;
try
{
while
((
str
=
bufferedReader
.
readLine
())
!=
null
)
{
while
((
str
=
bufferedReader
.
readLine
())
!=
null
)
{
sb
.
append
(
str
);
sb
.
append
(
str
);
}
}
...
@@ -209,10 +212,16 @@ public class AmazonAdProductJob extends PointJob {
...
@@ -209,10 +212,16 @@ public class AmazonAdProductJob extends PointJob {
e
.
printStackTrace
();
e
.
printStackTrace
();
jobAccountLog
.
setMessage
(
"解析Gzip格式的Report错误:"
+
ExceptionUtil
.
transform
(
e
));
jobAccountLog
.
setMessage
(
"解析Gzip格式的Report错误:"
+
ExceptionUtil
.
transform
(
e
));
}
finally
{
}
finally
{
if
(
bufferedReader
!=
null
)
{
bufferedReader
.
close
();
bufferedReader
.
close
();
}
if
(
isr
!=
null
)
{
isr
.
close
();
isr
.
close
();
}
if
(
gzin
!=
null
)
{
gzin
.
close
();
gzin
.
close
();
}
}
}
/*
/*
* 今天只能拿到昨天的广告费, 不然不完整
* 今天只能拿到昨天的广告费, 不然不完整
* 如果开始时间比今天0点晚, 就设为22点(或者你随便减几个小时都可以)
* 如果开始时间比今天0点晚, 就设为22点(或者你随便减几个小时都可以)
...
...
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