use of com.rogge.order.model.Order in project spring-cloud by Rogge666.
the class OrderController method list.
@GetMapping("/list")
public ApiResponse list(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size) {
PageHelper.startPage(page, size);
List<Order> list = orderService.findAll();
PageInfo pageInfo = new PageInfo(list);
return ApiResponse.creatSuccess(pageInfo);
}
use of com.rogge.order.model.Order in project spring-cloud by Rogge666.
the class OrderController method getOrderByUserIdV2.
/**
* 测试feign
*
* @param userId
* @return
*/
@GetMapping("/getOrderByUserIdV2")
@HystrixCommand(fallbackMethod = "getOrderByUserNameError")
public ApiResponse getOrderByUserIdV2(@RequestParam("userId") Long userId) {
User lUser = mUserFeign.detail(userId);
String userName = lUser.getUsername();
List<Order> lOrders = orderService.getOrderByUserName(userName);
return ApiResponse.creatSuccess(lOrders);
}
use of com.rogge.order.model.Order in project spring-cloud by Rogge666.
the class OrderController method getOrderByUserIdV3.
/**
* 测试session透传 需要先调用user模块的登录
*
* @return
*/
@GetMapping("/getOrderByUserIdV3")
public ApiResponse getOrderByUserIdV3() {
User lUser = mSessionUserInfo.getCurrentSessionUser(User.class);
String userName = lUser.getUsername();
List<Order> lOrders = orderService.getOrderByUserName(userName);
return ApiResponse.creatSuccess(lOrders);
}
use of com.rogge.order.model.Order in project spring-cloud by Rogge666.
the class OrderController method getOrderByUserId.
/**
* 测试mRestTemplate
*
* @param userId
* @return
*/
@GetMapping("/getOrderByUserId")
@HystrixCommand(fallbackMethod = "getOrderByUserNameError")
public ApiResponse getOrderByUserId(@RequestParam("userId") Long userId) {
// TODO: 2017/11/7 0007 by Rogge RestTemplate没有做session透传 所以会在拦截器失败,如需调用去掉登录拦截器即可
System.out.println("==========" + name);
Map<String, Object> map = new HashMap<>();
map.put("userId", userId);
User lUser = mRestTemplate.getForObject("http://user-module/detail?id={userId}", User.class, map);
String userName = lUser.getUsername();
List<Order> lOrders = orderService.getOrderByUserName(userName);
return ApiResponse.creatSuccess(lOrders);
}
Aggregations