Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xnr-interface
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
heli_wms
xnr-interface
Commits
d9f0281d
Commit
d9f0281d
authored
Jan 06, 2020
by
tank.li@mushiny.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getMethod优化
parent
75bf8743
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
XnrInterfaceApplication.java
...in/java/com/mushiny/heli/xnr/XnrInterfaceApplication.java
+24
-1
ExecutorHandler.java
src/main/java/com/mushiny/heli/xnr/wcs/ExecutorHandler.java
+15
-1
No files found.
src/main/java/com/mushiny/heli/xnr/XnrInterfaceApplication.java
View file @
d9f0281d
package
com
.
mushiny
.
heli
.
xnr
;
package
com
.
mushiny
.
heli
.
xnr
;
import
com.mushiny.heli.xnr.comm.CommonUtils
;
import
com.mushiny.heli.xnr.comm.DateUtils
;
import
com.mushiny.heli.xnr.comm.JsonUtils
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
java.util.
TimeZone
;
import
java.util.
*
;
@SpringBootApplication
@SpringBootApplication
...
@@ -12,6 +15,26 @@ import java.util.TimeZone;
...
@@ -12,6 +15,26 @@ import java.util.TimeZone;
public
class
XnrInterfaceApplication
{
public
class
XnrInterfaceApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
/*Map data = new LinkedHashMap();
data.put("entryId", "entry-board-201912300001");
data.put("workOrder", "workOrder-board-201912300001");
data.put("entryType", "board");
data.put("skuId", "sku-board-0001");
data.put("amount", 100);
data.put("unit", "件");
data.put("lineName", "line0001");
data.put("stored", 100);
data.put("sendTime", DateUtils.date2String(new Date(System.currentTimeMillis())));
data.put("finishTime", DateUtils.date2String(new Date(System.currentTimeMillis())));
System.out.println(JsonUtils.map2Json(data));*/
/*skuId
amount
unit
lineName*/
TimeZone
.
setDefault
(
TimeZone
.
getTimeZone
(
"Asia/Shanghai"
));
TimeZone
.
setDefault
(
TimeZone
.
getTimeZone
(
"Asia/Shanghai"
));
SpringApplication
.
run
(
XnrInterfaceApplication
.
class
,
args
);
SpringApplication
.
run
(
XnrInterfaceApplication
.
class
,
args
);
}
}
...
...
src/main/java/com/mushiny/heli/xnr/wcs/ExecutorHandler.java
View file @
d9f0281d
...
@@ -11,6 +11,7 @@ import org.springframework.web.client.ResponseErrorHandler;
...
@@ -11,6 +11,7 @@ import org.springframework.web.client.ResponseErrorHandler;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Iterator
;
import
java.util.Map
;
import
java.util.Map
;
@Component
@Component
...
@@ -64,8 +65,21 @@ public class ExecutorHandler {
...
@@ -64,8 +65,21 @@ public class ExecutorHandler {
headers
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON
.
toString
());
headers
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON
.
toString
());
headers
.
add
(
"authorization"
,
token
);
headers
.
add
(
"authorization"
,
token
);
restTemplate
.
setErrorHandler
(
new
CustomResponseErrorHandler
());
restTemplate
.
setErrorHandler
(
new
CustomResponseErrorHandler
());
StringBuilder
stringBuilder
=
new
StringBuilder
();
stringBuilder
.
append
(
url
).
append
(
"?a=a"
);
if
(!
params
.
isEmpty
()){
Iterator
iterator
=
params
.
keySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
Object
key
=
iterator
.
next
();
//拼接?taskId={taskId}§ionId={sectionId}
stringBuilder
.
append
(
"&"
).
append
(
key
.
toString
())
.
append
(
"={"
).
append
(
key
.
toString
()).
append
(
"}"
);
}
}
logger
.
debug
(
"get url:"
+
stringBuilder
.
toString
());
ResponseEntity
<
String
>
response
=
restTemplate
.
exchange
(
ResponseEntity
<
String
>
response
=
restTemplate
.
exchange
(
url
+
"?taskId={taskId}§ionId=1"
,
//url+"?taskId={taskId}§ionId=1",
stringBuilder
.
toString
(),
HttpMethod
.
GET
,
HttpMethod
.
GET
,
new
HttpEntity
<
String
>(
headers
),
new
HttpEntity
<
String
>(
headers
),
String
.
class
,
params
);
String
.
class
,
params
);
...
...
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