Merge remote-tracking branch 'origin/master'

20230922-ljl-fixBug
daixiaogang 1 year ago
commit c026e5f562

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

@ -11,12 +11,13 @@ public class GetShopCloudHotProductsRequestDTO {
/** /**
* ID * ID
*/ */
private int cid; private Long cid;
/** /**
* *
*/ */
private int pageNo; private Long pageNo;
private Long pageSize;
/** /**
* *

@ -2,52 +2,55 @@ package com.ms.api.spi.move;
import com.doudian.open.api.product_isv_getClueList.ProductIsvGetClueListRequest; import com.doudian.open.api.product_isv_getClueList.ProductIsvGetClueListRequest;
import com.doudian.open.api.product_isv_getClueList.ProductIsvGetClueListResponse; import com.doudian.open.api.product_isv_getClueList.ProductIsvGetClueListResponse;
import com.doudian.open.api.product_isv_getClueList.data.ProductIsvGetClueListData;
import com.doudian.open.api.product_isv_getClueList.param.ProductIsvGetClueListParam; import com.doudian.open.api.product_isv_getClueList.param.ProductIsvGetClueListParam;
import com.jinritemai.cloud.base.api.BaseRequest; import com.jinritemai.cloud.base.api.BaseRequest;
import com.jinritemai.cloud.base.api.BaseResponse; import com.jinritemai.cloud.base.api.BaseResponse;
import com.jinritemai.cloud.base.api.ExtensionService; import com.jinritemai.cloud.base.api.ExtensionService;
import com.jinritemai.cloud.base.api.ExtensionServiceHandler; import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
import com.ms.api.common.R; import com.ms.api.common.R;
import com.ms.api.common.Ret;
import com.ms.api.common.SPIBaseService; import com.ms.api.common.SPIBaseService;
import com.ms.api.dto.move.GetShopCloudHotProductsRequestDTO; import com.ms.api.dto.move.GetShopCloudHotProductsRequestDTO;
import com.ms.api.tool.DsJsonRequestTemplate; import com.ms.api.tool.DsJsonRequestTemplate;
import com.ms.api.util.DdRequestUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.Map;
/** /**
* () * ()
*/ */
@ExtensionService("getShopCloudHotProducts") @ExtensionService("getShopCloudHotProducts")
@Slf4j @Slf4j
public class GetShopCloudHotProductsService extends SPIBaseService implements ExtensionServiceHandler<GetShopCloudHotProductsRequestDTO, Void> { public class GetShopCloudHotProductsService extends SPIBaseService implements ExtensionServiceHandler<GetShopCloudHotProductsRequestDTO, Ret> {
@Autowired @Autowired
private DsJsonRequestTemplate dsJsonRequestTemplate; private DsJsonRequestTemplate dsJsonRequestTemplate;
@Override @Override
public BaseResponse<Void> handle(BaseRequest<GetShopCloudHotProductsRequestDTO> req) { public BaseResponse<Ret> handle(BaseRequest<GetShopCloudHotProductsRequestDTO> req) {
initHandle(req); initHandle(req);
// ----参数校验---- // ----参数校验----
GetShopCloudHotProductsRequestDTO fields = req.getData(); GetShopCloudHotProductsRequestDTO fields = req.getData();
ProductIsvGetClueListRequest request = new ProductIsvGetClueListRequest();
ProductIsvGetClueListParam param = request.getParam();
param.setSourceChannelCode("competitive");
param.setFirstCid(20005L);
param.setSecondCid(20224L);
param.setClueInfo("线索名称");
param.setCurrent(1L);
param.setPageSize(100L);
param.setCompetitiveClueType(0);
ProductIsvGetClueListResponse response = request.execute();
// ----逻辑校验---- // ----逻辑校验----
// ----业务处理---- // ----业务处理----
ProductIsvGetClueListParam param = new ProductIsvGetClueListParam();
// 1688暂时没提供要确认下是否有接口可能要从抖店云api获取 param.setSourceChannelCode(fields.getSourceChannelCode());
param.setFirstCid(fields.getCid());
param.setClueInfo(fields.getKeyword());
param.setCurrent(fields.getPageNo());
param.setPageSize(fields.getPageSize());
ProductIsvGetClueListData data = DdRequestUtil.ProductIsvGetClueListRequest(param);
Map<String, Object> result = new HashMap<>();
result.put("data", data.getData());
result.put("total", data.getTotal());
// ----结果返回---- // ----结果返回----
return R.ok(); return R.ok(Ret.success(result));
} }
} }

@ -33,6 +33,10 @@ import com.doudian.open.api.product_detail.ProductDetailRequest;
import com.doudian.open.api.product_detail.ProductDetailResponse; import com.doudian.open.api.product_detail.ProductDetailResponse;
import com.doudian.open.api.product_detail.data.ProductDetailData; import com.doudian.open.api.product_detail.data.ProductDetailData;
import com.doudian.open.api.product_detail.param.ProductDetailParam; import com.doudian.open.api.product_detail.param.ProductDetailParam;
import com.doudian.open.api.product_isv_getClueList.ProductIsvGetClueListRequest;
import com.doudian.open.api.product_isv_getClueList.ProductIsvGetClueListResponse;
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.core.util.AuthThreadLocalUtil; import com.jinritemai.cloud.base.core.util.AuthThreadLocalUtil;
import com.ms.api.common.ApiResult; import com.ms.api.common.ApiResult;
import com.ms.api.consts.AppConst; import com.ms.api.consts.AppConst;
@ -179,4 +183,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())); throw new RuntimeException(String.format("抖店请求错误:msg:%s,code:%s,subCode:%s,subMsg:%s,", response.getMsg(), response.getCode(), response.getSubCode(), response.getSubMsg()));
} }
public static ProductIsvGetClueListData ProductIsvGetClueListRequest(ProductIsvGetClueListParam param) {
String activeProfile= System.getenv("sys-deploy-env");
if (!"Prod".equals(activeProfile)){
AuthThreadLocalUtil.set(AppConst.TEST_SHOP_ID);
}
ProductIsvGetClueListRequest request = new ProductIsvGetClueListRequest();
request.setParam(param);
log.info("=============Dd请求餐素:{}===================", JSONObject.toJSONString(param));
ProductIsvGetClueListResponse 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