|
@@ -0,0 +1,58 @@
|
|
|
+package com.ydd.third.controller;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.ydd.third.common.vo.ResObject;
|
|
|
+import com.ydd.third.common.vo.waimai.ConfirmOrderVo;
|
|
|
+import com.ydd.third.common.vo.waimai.SyncRiderPositionStatusVo;
|
|
|
+import com.ydd.third.common.vo.waimai.eleme.api.entity.order.OrderList;
|
|
|
+import com.ydd.third.waimai.Client;
|
|
|
+import com.ydd.third.waimai.eleme.ElemeAuthClient;
|
|
|
+import com.ydd.third.waimai.eleme.ElemeCallback;
|
|
|
+import com.ydd.third.waimai.eleme.ElemeClient;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+@Api(value = "饿了么接口", tags = {"饿了么接口"})
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
|
+public class ElemeController {
|
|
|
+ private final Client waimaiClient;
|
|
|
+ private final ElemeClient elemeClient;
|
|
|
+ private final ElemeAuthClient elemeAuthClient;
|
|
|
+ private final ElemeCallback elemeCallback;
|
|
|
+
|
|
|
+ @PostMapping(value="/eleme/selfDeliveryLocationSync")
|
|
|
+ public ResObject selfDeliveryLocationSync(@RequestBody SyncRiderPositionStatusVo syncRiderPositionVo){
|
|
|
+ return waimaiClient.syncRiderPositionStatus(syncRiderPositionVo);
|
|
|
+ }
|
|
|
+ @GetMapping(value="/eleme/getOAuthUrl")
|
|
|
+ public String getOAuthUrl(@RequestParam("shopCode") String shopCode){
|
|
|
+ return elemeAuthClient.getOAuthUrl(shopCode);
|
|
|
+ }
|
|
|
+ @GetMapping(value="/eleme/getAllOrders")
|
|
|
+ public ResObject<OrderList> getAllOrders(@RequestParam("shopCode") String token, @RequestParam("shopId") Long shopId, @RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam("date") String date){
|
|
|
+ return elemeClient.getAllOrders(token, shopId, pageNo, pageSize, date);
|
|
|
+ }
|
|
|
+ @PostMapping(value="/eleme/confirmOrder")
|
|
|
+ public ResObject confirmOrder(@RequestBody ConfirmOrderVo confirmOrderVo){
|
|
|
+ return elemeClient.confirmOrder(confirmOrderVo);
|
|
|
+ }
|
|
|
+ @GetMapping(value="/eleme/doOAuthToken")
|
|
|
+ public ResObject doOAuthToken(@RequestParam("code") String code, @RequestParam("state") String state){
|
|
|
+
|
|
|
+ return elemeAuthClient.doOAuthToken(code, state);
|
|
|
+ }
|
|
|
+ @PostMapping(value="/eleme/doOrder")
|
|
|
+ public ResObject doOrder(@RequestBody(required = false) JSONObject jsonParams){
|
|
|
+ return elemeCallback.doOrder(jsonParams);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value="/queryItem")
|
|
|
+ public ResObject queryItem(@RequestParam("authToken")String authToken, @RequestParam("thirdShopId") Long thirdShopId){
|
|
|
+ return elemeClient.queryItem(authToken, thirdShopId);
|
|
|
+ }
|
|
|
+}
|