获取模板列表

20230922-ljl-fixBug
cxxxxxxx详 1 year ago
parent 2f3cf72b2b
commit 180163360b

@ -5,7 +5,7 @@ curl --location --request POST 'localhost:8080/base/cloud/spi' \
--data-raw '{
"appId":"7264840234423027259",
"authId":"4463798",
"method":"testSpi",
"method":"getFreightTemplateList",
"data":"{\"sourceChannelCode\":\"query_none_less\",\"pageSize\":20,\"pageNo\":1}"
}'

@ -0,0 +1,22 @@
package com.ms.api.dto.move;
import lombok.Data;
/*
*
*/
@Data
public class GetFreightTemplateListRequestDTO {
/**
* 1
*/
private String name;
/**
*
*/
private String pageNo;
/**
*
*/
private String pageSize;
}

@ -11,6 +11,7 @@ import com.ms.api.common.Ret;
import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.ItemDTO;
import com.ms.api.tool.DsJsonRequestTemplate;
import com.ms.api.tool.SecurityTool;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -32,7 +33,7 @@ public class TestSpiService extends SPIBaseService implements ExtensionServiceHa
getAuthCode();
String res = null;
HashMap<String, Object> params = new HashMap<>();
params.put("platformItemId", "1");
params.put("platformItemId", SecurityTool.encodeByAES("1"));
params.put("sourceItemId", "33");
params.put("authCode", authCode);
try {

@ -0,0 +1,51 @@
package com.ms.api.spi.move;
import com.doudian.open.api.freightTemplate_list.data.FreightTemplateListData;
import com.doudian.open.api.freightTemplate_list.param.FreightTemplateListParam;
import com.doudian.open.api.product_isv_getClueList.data.ProductIsvGetClueListData;
import com.doudian.open.api.product_isv_getClueList.param.ProductIsvGetClueListParam;
import com.jinritemai.cloud.base.api.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionService;
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
import com.ms.api.common.R;
import com.ms.api.common.Ret;
import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.move.GetFreightTemplateListRequestDTO;
import com.ms.api.dto.move.GetShopCloudHotProductsRequestDTO;
import com.ms.api.tool.DsJsonRequestTemplate;
import com.ms.api.util.DdRequestUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.Map;
/**
*
*/
@ExtensionService("getFreightTemplateList")
@Slf4j
public class GetFreightTemplateList extends SPIBaseService implements ExtensionServiceHandler<GetFreightTemplateListRequestDTO, Ret> {
@Override
public BaseResponse<Ret> handle(BaseRequest<GetFreightTemplateListRequestDTO> req) {
initHandle(req);
// ----参数校验----
GetFreightTemplateListRequestDTO fields = req.getData();
// ----逻辑校验----
// ----业务处理----
FreightTemplateListParam param = new FreightTemplateListParam();
param.setName(fields.getName());
param.setPage(fields.getPageNo());
param.setSize(fields.getPageSize());
FreightTemplateListData data = DdRequestUtil.FreightTemplateListDataRequest(param);
Map<String, Object> result = new HashMap<>();
result.put("data", data.getList());
result.put("total", data.getCount());
// ----结果返回----
return R.ok(Ret.success(result));
}
}

@ -26,10 +26,6 @@ import java.util.Map;
@ExtensionService("getShopCloudHotProducts")
@Slf4j
public class GetShopCloudHotProductsService extends SPIBaseService implements ExtensionServiceHandler<GetShopCloudHotProductsRequestDTO, Ret> {
@Autowired
private DsJsonRequestTemplate dsJsonRequestTemplate;
@Override
public BaseResponse<Ret> handle(BaseRequest<GetShopCloudHotProductsRequestDTO> req) {
initHandle(req);

@ -1,5 +1,6 @@
package com.ms.api.spi.move;
import com.doudian.open.api.freightTemplate_list.FreightTemplateListRequest;
import com.jinritemai.cloud.base.api.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionService;

@ -8,6 +8,10 @@ import com.doudian.open.api.afterSale_Detail.AfterSaleDetailRequest;
import com.doudian.open.api.afterSale_Detail.AfterSaleDetailResponse;
import com.doudian.open.api.afterSale_Detail.data.AfterSaleDetailData;
import com.doudian.open.api.afterSale_Detail.param.AfterSaleDetailParam;
import com.doudian.open.api.freightTemplate_list.FreightTemplateListRequest;
import com.doudian.open.api.freightTemplate_list.FreightTemplateListResponse;
import com.doudian.open.api.freightTemplate_list.data.FreightTemplateListData;
import com.doudian.open.api.freightTemplate_list.param.FreightTemplateListParam;
import com.doudian.open.api.order_BatchSearchIndex.OrderBatchSearchIndexRequest;
import com.doudian.open.api.order_BatchSearchIndex.OrderBatchSearchIndexResponse;
import com.doudian.open.api.order_BatchSearchIndex.data.OrderBatchSearchIndexData;
@ -200,4 +204,21 @@ public class DdRequestUtil {
}
throw new RuntimeException(String.format("抖店请求错误:msg:%s,code:%s,subCode:%s,subMsg:%s,", response.getMsg(), response.getCode(), response.getSubCode(), response.getSubMsg()));
}
public static FreightTemplateListData FreightTemplateListDataRequest(FreightTemplateListParam param) {
String activeProfile= System.getenv("sys-deploy-env");
if (!"Prod".equals(activeProfile)){
AuthThreadLocalUtil.set(AppConst.TEST_SHOP_ID);
}
FreightTemplateListRequest request = new FreightTemplateListRequest();
request.setParam(param);
log.info("=============Dd请求餐素:{}===================", JSONObject.toJSONString(param));
FreightTemplateListResponse response = request.execute();
log.info("=============Dd请求返回:{}===================", JSONObject.toJSONString(response));
boolean success = CommonTool.checkDdApiRequestIsSuccess(response);
if (success && ObjectUtil.isNotEmpty(response.getData())) {
return response.getData();
}
throw new RuntimeException(String.format("抖店请求错误:msg:%s,code:%s,subCode:%s,subMsg:%s,", response.getMsg(), response.getCode(), response.getSubCode(), response.getSubMsg()));
}
}

Loading…
Cancel
Save