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
1d2d9100
Commit
1d2d9100
authored
Jul 17, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
6adf7707
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
13 deletions
+3
-13
HttpUtil.java
src/main/java/com/egolm/pds/config/HttpUtil.java
+2
-10
PdsService.java
src/main/java/com/egolm/pds/schedule/service/PdsService.java
+1
-3
No files found.
src/main/java/com/egolm/pds/config/HttpUtil.java
View file @
1d2d9100
package
com
.
egolm
.
pds
.
config
;
import
java.io.PrintWriter
;
import
java.io.UnsupportedEncodingException
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
...
...
@@ -77,26 +76,19 @@ public class HttpUtil {
}
}
public
static
String
post
(
String
requestUrl
,
Map
<
String
,
Object
>
parameters
,
Map
<
String
,
String
>
headers
)
{
public
static
String
post
(
String
requestUrl
,
Map
<
String
,
String
>
headers
)
{
HttpURLConnection
connection
=
null
;
PrintWriter
out
;
try
{
URL
getUrl
=
new
URL
(
requestUrl
);
connection
=
(
HttpURLConnection
)
getUrl
.
openConnection
();
connection
.
setRequestMethod
(
"POST"
);
connection
.
setRequestProperty
(
"Accept-Charset"
,
"utf-8"
);
connection
.
setRequestProperty
(
"Content-Type"
,
"application/
x-www-form-urlencoded
"
);
connection
.
setRequestProperty
(
"Content-Type"
,
"application/
json
"
);
if
(
headers
!=
null
)
{
for
(
String
key
:
headers
.
keySet
())
{
connection
.
setRequestProperty
(
key
,
headers
.
get
(
key
));
}
}
connection
.
setDoOutput
(
true
);
connection
.
setDoInput
(
true
);
out
=
new
PrintWriter
(
connection
.
getOutputStream
());
String
queryString
=
toQueryString
(
parameters
);
out
.
print
(
queryString
);
out
.
flush
();
connection
.
connect
();
return
responseBody
(
connection
);
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/egolm/pds/schedule/service/PdsService.java
View file @
1d2d9100
...
...
@@ -29,11 +29,9 @@ public class PdsService {
@Transactional
public
void
savePdsProduct
(
Object
transactionId
,
Map
<
String
,
Object
>
productMap
)
{
jdbcTemplate
.
save
(
"pds_article"
,
productMap
);
Map
<
String
,
Object
>
parameters
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
authKey
,
authValue
);
parameters
.
put
(
"transaction_id"
,
transactionId
==
null
?
null
:
transactionId
.
toString
());
HttpUtil
.
post
(
urlUpdate
,
parameters
,
headers
);
HttpUtil
.
post
(
urlUpdate
+
"/"
+
transactionId
,
headers
);
}
public
JdbcTemplate
getJdbcTemplate
()
{
...
...
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