|
@@ -0,0 +1,69 @@ |
|
|
|
|
|
package com.ruoyi.web.controller.aliexpress; |
|
|
|
|
|
|
|
|
|
|
|
import com.global.iop.api.IopClient; |
|
|
|
|
|
import com.global.iop.api.IopClientImpl; |
|
|
|
|
|
import com.global.iop.api.IopRequest; |
|
|
|
|
|
import com.global.iop.api.IopResponse; |
|
|
|
|
|
import com.global.iop.domain.Protocol; |
|
|
|
|
|
import com.global.iop.util.ApiException; |
|
|
|
|
|
import com.ruoyi.common.annotation.Log; |
|
|
|
|
|
import com.ruoyi.common.enums.BusinessType; |
|
|
|
|
|
import com.ruoyi.web.controller.aliexpress.dto.category.CategoryGetPropValueFeatureDTO; |
|
|
|
|
|
import com.ruoyi.web.controller.aliexpress.dto.globalcategory.GlobalCategoryTreeListDTO; |
|
|
|
|
|
import com.ruoyi.web.core.config.AliexpressAuthClientConfig; |
|
|
|
|
|
import com.ruoyi.web.enumerate.AliexpressCategoryEnu; |
|
|
|
|
|
import com.ruoyi.web.enumerate.AliexpressGlobalCategoryEnu; |
|
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @author ldj |
|
|
|
|
|
* @date 2024/3/1 14:36 |
|
|
|
|
|
* @Description: ... |
|
|
|
|
|
* @Version 1.0 |
|
|
|
|
|
*/ |
|
|
|
|
|
@RestController |
|
|
|
|
|
@Api("对接速卖通 类目") |
|
|
|
|
|
@RequestMapping("/aliexpress/global/category") |
|
|
|
|
|
public class AliexpressGlobalCategoryController { |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private AliexpressAuthClientConfig AliexpressAuthClientConfig; |
|
|
|
|
|
|
|
|
|
|
|
//统一类目树查询 |
|
|
|
|
|
//描述:获取商家有发布权限的统一类目树 |
|
|
|
|
|
/* |
|
|
|
|
|
IopClient client = new IopClient(url, appkey, appSecret); |
|
|
|
|
|
IopRequest request = new IopRequest(); |
|
|
|
|
|
request.setApiName("global.category.tree.list"); |
|
|
|
|
|
request.setHttpMethod("GET"); |
|
|
|
|
|
request.addApiParameter("locale", "en_US"); |
|
|
|
|
|
request.addApiParameter("category_id", "10001"); |
|
|
|
|
|
IopResponse response = client.execute(request, accessToken, Protocol.TOP); |
|
|
|
|
|
System.out.println(response.getBody()); |
|
|
|
|
|
Thread.sleep(10); |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 统一类目树查询 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Log(title = "统一类目树查询", businessType = BusinessType.SELECT) |
|
|
|
|
|
@ApiOperation("统一类目树查询") |
|
|
|
|
|
@PostMapping("/globalCategoryTreeList") |
|
|
|
|
|
public String globalCategoryTreeList(@RequestBody GlobalCategoryTreeListDTO reqDto) throws ApiException { |
|
|
|
|
|
IopClient client = new IopClientImpl(AliexpressAuthClientConfig.getUrl(), AliexpressAuthClientConfig.getAppKey(), AliexpressAuthClientConfig.getAppSecret()); |
|
|
|
|
|
IopRequest request = new IopRequest(); |
|
|
|
|
|
request.setApiName(AliexpressGlobalCategoryEnu.GLOBAL_CATEGORY_TREE_LIST.getApiName()); |
|
|
|
|
|
request.setHttpMethod("GET"); |
|
|
|
|
|
request.addApiParameter("locale", reqDto.getLocale()); |
|
|
|
|
|
request.addApiParameter("category_id", reqDto.getCategory_id()); |
|
|
|
|
|
IopResponse response = client.execute(request, reqDto.getAccessToken(), Protocol.TOP); |
|
|
|
|
|
return response.getGopResponseBody(); |
|
|
|
|
|
} |
|
|
|
|
|
} |