Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
pdstask
Project
Project
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
曲欣亮
pdstask
Commits
e676dd19
Commit
e676dd19
authored
Nov 09, 2020
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
7c27fdd2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
64 deletions
+66
-64
ProductsTask.java
src/main/java/com/egolm/pds/schedule/ProductsTask.java
+66
-64
No files found.
src/main/java/com/egolm/pds/schedule/ProductsTask.java
View file @
e676dd19
...
@@ -41,21 +41,24 @@ public class ProductsTask {
...
@@ -41,21 +41,24 @@ public class ProductsTask {
@Scheduled
(
cron
=
"${pds.cron.products_download}"
)
@Scheduled
(
cron
=
"${pds.cron.products_download}"
)
public
void
execute
()
{
public
void
execute
()
{
log
.
debug
(
DateUtil
.
format
(
new
Date
())
+
" PdsProductsUpdateTask RUN"
);
log
.
debug
(
DateUtil
.
format
(
new
Date
())
+
" PdsProductsUpdateTask RUN START"
);
boolean
boo
=
true
;
this
.
executeUpdateTask
();
int
loopCount
=
0
;
log
.
debug
(
DateUtil
.
format
(
new
Date
())
+
" PdsProductsUpdateTask RUN END"
);
while
(
boo
)
{
boo
=
executeUpdateTask
()
>
0
&&
loopCount
++
<
10
;
}
}
}
private
int
executeUpdateTask
()
{
private
void
executeUpdateTask
()
{
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
authKey
,
authValue
);
headers
.
put
(
authKey
,
authValue
);
boolean
isFinishd
=
false
;
while
(!
isFinishd
)
{
String
responseBody
=
HttpUtil
.
get
(
urlQuery
,
headers
);
String
responseBody
=
HttpUtil
.
get
(
urlQuery
,
headers
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
responseBody
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
responseBody
);
JSONArray
jsonArray
=
jsonObject
.
getJSONArray
(
"data"
);
JSONArray
jsonArray
=
jsonObject
.
getJSONArray
(
"data"
);
if
(
jsonArray
!=
null
)
{
if
(
jsonArray
==
null
||
jsonArray
.
size
()
==
0
)
{
isFinishd
=
true
;
}
else
{
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
productJsonObject
=
jsonArray
.
getJSONObject
(
i
);
JSONObject
productJsonObject
=
jsonArray
.
getJSONObject
(
i
);
String
article_description
=
productJsonObject
.
getString
(
"article_description"
);
String
article_description
=
productJsonObject
.
getString
(
"article_description"
);
...
@@ -110,8 +113,7 @@ public class ProductsTask {
...
@@ -110,8 +113,7 @@ public class ProductsTask {
}
}
}
}
}
}
}
return
jsonArray
==
null
?
0
:
jsonArray
.
size
();
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
...
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