Skip to content

Commit

Permalink
update request method type
Browse files Browse the repository at this point in the history
  • Loading branch information
xingxing committed Aug 19, 2017
1 parent 4078155 commit ec7d859
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# simplemall
a simple mall which architecture based on micro-service !
# QuickStart
A simple mall which architecture based on micro-service !

base-serv,提供基础服务,包括路由,链路跟踪,配置中心等等

Expand All @@ -11,7 +11,7 @@ a simple mall which architecture based on micro-service !

front-app,编写页面及服务的调用,h5开发

each application module port
Each application module port

sleuth server:9001
admin server :9002
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.simplemall.micro.serv.page.api;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.web.bind.annotation.RequestMapping;
Expand Down Expand Up @@ -40,7 +43,9 @@ public class APIOrderController {
@RequestMapping(value = "create", method = RequestMethod.POST)
public String createOrder(@ApiParam(value = "订单json数据") @RequestParam String orderJsonStr) {
this.loadBalancerClient.choose(ORDER_SERVICE);// 随机访问策略
return restTemplate.getForObject(ORDER_SERVICE_URL + "/order/create?orderJsonStr={orderJsonStr}", String.class,
Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("orderJsonStr", orderJsonStr);
return restTemplate.getForObject(ORDER_SERVICE_URL + "/order/create", String.class,
orderJsonStr);

}
Expand All @@ -58,9 +63,12 @@ public RestAPIResult<OrderDTO> viewOrder(@RequestParam(required = true) String s
@RequestParam(required = true) String accountId) {
RestAPIResult<OrderDTO> restAPIResult = new RestAPIResult<>();
this.loadBalancerClient.choose(ORDER_SERVICE);
Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("serialNo", serialNo);
uriVariables.put("accountId", accountId);
restAPIResult.setRespData(
restTemplate.getForObject(ORDER_SERVICE_URL + "/order/view?serialNo={serialNo}&accountId={accountId}",
OrderDTO.class, serialNo, accountId));
restTemplate.getForObject(ORDER_SERVICE_URL + "/order/view",
OrderDTO.class, uriVariables));
return restAPIResult;
}

Expand Down

0 comments on commit ec7d859

Please sign in to comment.