From 26ffefb70cecdadca22ffc9e16c35fff2e9f2cde Mon Sep 17 00:00:00 2001 From: wangchaoxu Date: Sun, 17 Sep 2023 14:18:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=90=84=E7=A7=8Daccesstoken?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ms/api/biz/MoveService.java | 33 ++++++------ .../com/ms/api/service/CategoryService.java | 2 +- .../api/service/impl/CategoryServiceImpl.java | 6 +-- .../ProcessMovePublishToPicTaskService.java | 4 +- .../ProcessProductPublishTaskService.java | 50 +++++++++---------- .../SyncShopCategoryQueueTaskService.java | 4 +- .../java/com/ms/api/util/DdRequestUtil.java | 14 ++---- 7 files changed, 55 insertions(+), 58 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/biz/MoveService.java b/ms-biz/src/main/java/com/ms/api/biz/MoveService.java index 1cfbb8b2..9a552dc5 100644 --- a/ms-biz/src/main/java/com/ms/api/biz/MoveService.java +++ b/ms-biz/src/main/java/com/ms/api/biz/MoveService.java @@ -132,10 +132,9 @@ public class MoveService { * * @param moveBaseData * @param queueMsg - * @param accessToken * @return */ - public Ret buildProductDetailBase(JSONObject moveBaseData, MoveProductPublishQueueBO queueMsg, AccessToken accessToken) { + public Ret buildProductDetailBase(JSONObject moveBaseData, MoveProductPublishQueueBO queueMsg) { MoveShopSettingBO condition = queueMsg.getCondition(); long shopId = queueMsg.getShopId(); @@ -204,7 +203,7 @@ public class MoveService { } ProductGetProductUpdateRuleParam param = new ProductGetProductUpdateRuleParam(); param.setCategoryId(Long.valueOf(queueMsg.getCid())); - ApiResult productUpdateRuleRet = DdRequestUtil.getBrandListV2FromDdNotEx(param, accessToken); + ApiResult productUpdateRuleRet = DdRequestUtil.getBrandListV2FromDdNotEx(param); if (productUpdateRuleRet.isSuccess()) { FulfillmentRule fulfillmentRule = productUpdateRuleRet.getData().getFulfillmentRule(); if (ObjectUtil.isNotNull(fulfillmentRule)) { @@ -229,7 +228,7 @@ public class MoveService { long freightTemplateId = condition.getFreightTemplateId() > 0 ? condition.getFreightTemplateId() : MoveConst.DEFAULT_FREIGHT_TEMPLATE_ID; productDetailBase.put("freightTemplateId", freightTemplateId); - productDetailBase.put("supply7dayReturn", buildSupply7dayReturn(queueMsg, condition, accessToken)); + productDetailBase.put("supply7dayReturn", buildSupply7dayReturn(queueMsg, condition)); boolean commit = condition.getMoveOnsaleType() != MoveConst.MOVE_ON_SALE_TYPE_DRAFT; productDetailBase.put("commit", commit); if (condition.getMoveOnsaleType() == MoveConst.MOVE_ON_SALE_TYPE_ON_SALE || condition.getMoveOnsaleType() == MoveConst.MOVE_ON_SALE_TYPE_FOR_SALE) { @@ -239,7 +238,7 @@ public class MoveService { productDetailBase.put("status", MoveConst.MOVE_ON_SALE_TYPE_FOR_SALE); } - Object[] supply7dayReturn = buildSupply7dayReturn(queueMsg, condition, accessToken); + Object[] supply7dayReturn = buildSupply7dayReturn(queueMsg, condition); productDetailBase.put("supply7dayReturn", supply7dayReturn[0]); productDetailBase.put("afterSaleService", supply7dayReturn[1]); return CommonTool.successResult("productDetailBase", productDetailBase); @@ -312,7 +311,7 @@ public class MoveService { return price; } - public Object[] buildSupply7dayReturn(MoveProductPublishQueueBO queueMsg, MoveShopSettingBO condition, AccessToken accessToken) { + public Object[] buildSupply7dayReturn(MoveProductPublishQueueBO queueMsg, MoveShopSettingBO condition) { Integer supply7dayReturn = null; if (ObjectUtil.isNotNull(queueMsg.getSupply7dayReturn())) { supply7dayReturn = queueMsg.getSupply7dayReturn(); @@ -320,7 +319,7 @@ public class MoveService { supply7dayReturn = condition.getSupply7dayReturn(); } - Map supply7dayReturnOptions = getSupply7dayReturnOptions(queueMsg.getCid(), accessToken); + Map supply7dayReturnOptions = getSupply7dayReturnOptions(queueMsg.getCid()); if (ObjectUtil.isNull(supply7dayReturn) || !supply7dayReturnOptions.containsKey(supply7dayReturn.toString())) { List defaultValues = Arrays.asList("2", "5", "4", "3", "6", "8", "0", "1"); for (String defaultValue : defaultValues) { @@ -337,11 +336,11 @@ public class MoveService { return new Object[]{supply7dayReturn, afterSaleService}; } - public Map getSupply7dayReturnOptions(String cid, AccessToken accessToken) { + public Map getSupply7dayReturnOptions(String cid) { Map allOptions = MoveConst.getSupply7dayReturnOption(); ProductGetProductUpdateRuleParam param = new ProductGetProductUpdateRuleParam(); param.setCategoryId(Long.valueOf(cid)); - ApiResult productUpdateRuleRet = DdRequestUtil.getBrandListV2FromDdNotEx(param, accessToken); + ApiResult productUpdateRuleRet = DdRequestUtil.getBrandListV2FromDdNotEx(param); if (!productUpdateRuleRet.isSuccess()) { return new HashMap<>(); } @@ -1077,16 +1076,16 @@ public class MoveService { return str.trim(); } - public Ret uploadMoveProductImgToDd(long shopId, List imgUrls, String folderId, String distinct, AccessToken accessToken) { - Ret ret = realUploadMoveProductImgToDd(shopId, imgUrls, folderId, distinct, accessToken); + public Ret uploadMoveProductImgToDd(long shopId, List imgUrls, String folderId, String distinct) { + Ret ret = realUploadMoveProductImgToDd(shopId, imgUrls, folderId, distinct); if (CommonTool.isFailRet(ret) && ret.getReason().contains("该文件夹已经被删除")) { - String mFolderId = getUploadImgFolderId(shopId, accessToken, true); - return realUploadMoveProductImgToDd(shopId, imgUrls, mFolderId, distinct, accessToken); + String mFolderId = getUploadImgFolderId(shopId, true); + return realUploadMoveProductImgToDd(shopId, imgUrls, mFolderId, distinct); } return ret; } - private Ret realUploadMoveProductImgToDd(Long shopId, List imgUrls, String folderId, String distinct, AccessToken accessToken) { + private Ret realUploadMoveProductImgToDd(Long shopId, List imgUrls, String folderId, String distinct) { List materials = new ArrayList<>(); for (String imgUrl : imgUrls) { String uniqid = SecurityTool.MD5(UUID.randomUUID().toString()); @@ -1191,10 +1190,10 @@ public class MoveService { } } - public String getUploadImgFolderId(long shopId, AccessToken accessToken, boolean forceApi) { + public String getUploadImgFolderId(long shopId, boolean forceApi) { int retry = 0; while (true) { - String folderId = realGetUploadImgFolderId(shopId, accessToken, forceApi); + String folderId = realGetUploadImgFolderId(shopId, forceApi); if (StringUtils.isNotBlank(folderId)) { return folderId; } @@ -1212,7 +1211,7 @@ public class MoveService { } } - private String realGetUploadImgFolderId(long shopId, AccessToken accessToken, boolean forceApi) { + private String realGetUploadImgFolderId(long shopId, boolean forceApi) { String folderId = ""; JSONObject filter = new JSONObject(); filter.put("folderId", "0"); diff --git a/ms-biz/src/main/java/com/ms/api/service/CategoryService.java b/ms-biz/src/main/java/com/ms/api/service/CategoryService.java index 0c7f0926..8c8e21d4 100644 --- a/ms-biz/src/main/java/com/ms/api/service/CategoryService.java +++ b/ms-biz/src/main/java/com/ms/api/service/CategoryService.java @@ -29,7 +29,7 @@ public interface CategoryService { boolean deleteShopCategoryQueue(Integer shopId); - List getAllShopCategorysFromDd(Long cid, AccessToken accessToken); + List getAllShopCategorysFromDd(Long cid); List recordShopCategorys(Integer shopId, List shopAllCategoryList); diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/CategoryServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/CategoryServiceImpl.java index a51d15a4..3929111b 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/CategoryServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/CategoryServiceImpl.java @@ -116,16 +116,16 @@ public class CategoryServiceImpl implements CategoryService{ } @Override - public List getAllShopCategorysFromDd(Long cid, AccessToken accessToken) { + public List getAllShopCategorysFromDd(Long cid) { List dataAll = new ArrayList<>(); - List dataGet = DdRequestUtil.getShopCategory(cid, accessToken); + List dataGet = DdRequestUtil.getShopCategory(cid); if (dataGet.isEmpty()) { return dataGet; } dataAll.addAll(dataGet); for (DataItem datum : dataGet) { if (datum.getEnable() && !datum.getIsLeaf()) { - List data1 = DdRequestUtil.getShopCategory(datum.getId(), accessToken); + List data1 = DdRequestUtil.getShopCategory(datum.getId()); dataAll.addAll(data1); } } diff --git a/ms-biz/src/main/java/com/ms/api/task/ProcessMovePublishToPicTaskService.java b/ms-biz/src/main/java/com/ms/api/task/ProcessMovePublishToPicTaskService.java index 45f5c765..0f51c5a2 100644 --- a/ms-biz/src/main/java/com/ms/api/task/ProcessMovePublishToPicTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/ProcessMovePublishToPicTaskService.java @@ -601,11 +601,11 @@ public class ProcessMovePublishToPicTaskService extends TaskBaseService { dataIsChange = true; Long shopId = queueMsg.getShopId(); - String folderId = moveService.getUploadImgFolderId(shopId, accessToken, false); + String folderId = moveService.getUploadImgFolderId(shopId, false); List batchUploadPics = Arrays.stream(mainImgUrls).filter(pic -> !pic.contains(CommonConst.ddImgUrlNeedle)).collect(Collectors.toList()); if (!batchUploadPics.isEmpty()) { - moveService.uploadMoveProductImgToDd(shopId, batchUploadPics, folderId, "false", accessToken); + moveService.uploadMoveProductImgToDd(shopId, batchUploadPics, folderId, "false"); } E.throwMSException(String.join("|", mainImgUrls)); } diff --git a/ms-biz/src/main/java/com/ms/api/task/ProcessProductPublishTaskService.java b/ms-biz/src/main/java/com/ms/api/task/ProcessProductPublishTaskService.java index 20219b8a..5eeeaec4 100644 --- a/ms-biz/src/main/java/com/ms/api/task/ProcessProductPublishTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/ProcessProductPublishTaskService.java @@ -270,6 +270,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { MoveProductPublishQueueBO queueMsg = (MoveProductPublishQueueBO) getTaskRet.getQueueMsg(); long startTime = System.currentTimeMillis(); long shopId = queueMsg.getShopId(); + AuthThreadLocalUtil.set(String.valueOf(shopId)); MoveShopSettingBO condition = queueMsg.getCondition(); // 获取源产品数据 @@ -292,9 +293,8 @@ public class ProcessProductPublishTaskService extends TaskBaseService { // 修改为抖店要求的参数 JSONObject moveBaseData = (JSONObject) processRet.getData().get("moveBaseData"); - AccessToken accessToken = getShopAccessToken(shopId); - AuthThreadLocalUtil.set(String.valueOf(shopId)); - Ret ret = buildCreateProductV2Data(moveBaseData, queueMsg, accessToken, condition); + + Ret ret = buildCreateProductV2Data(moveBaseData, queueMsg, condition); if (CommonTool.isFailRet(ret)) { ret.setQueueMsg(queueMsg); return ret; @@ -304,7 +304,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { StrObjMap brandList = (StrObjMap) ret.getData().get("'brandList'"); // 图片处理 这边会加入到素材的buffer - Ret processImgsRet = processAndUploadMoveProductImgs(shopId, queueMsg, productDetailBase, moveBaseData, condition, accessToken); + Ret processImgsRet = processAndUploadMoveProductImgs(shopId, queueMsg, productDetailBase, moveBaseData, condition); if (CommonTool.isFailRet(processImgsRet)) { processImgsRet.setQueueMsg(queueMsg); return processImgsRet; @@ -334,16 +334,16 @@ public class ProcessProductPublishTaskService extends TaskBaseService { return processTaskRet; } - private Ret processAndUploadMoveProductImgs(long shopId, MoveProductPublishQueueBO queueMsg, JSONObject productDetailBase, JSONObject moveBaseData, MoveShopSettingBO condition, AccessToken accessToken) { - String folderId = moveService.getUploadImgFolderId(shopId, accessToken, false); - Ret getProductDetailBaseRet = uploadMoveProductImg(shopId, productDetailBase, folderId, accessToken); + private Ret processAndUploadMoveProductImgs(long shopId, MoveProductPublishQueueBO queueMsg, JSONObject productDetailBase, JSONObject moveBaseData, MoveShopSettingBO condition) { + String folderId = moveService.getUploadImgFolderId(shopId, false); + Ret getProductDetailBaseRet = uploadMoveProductImg(shopId, productDetailBase, folderId); if (CommonTool.isFailRet(getProductDetailBaseRet)) { return getProductDetailBaseRet; } return CommonTool.successResult("productDetailBase", productDetailBase); } - private Ret uploadMoveProductImg(long shopId, JSONObject productDetailBase, String folderId, AccessToken accessToken) { + private Ret uploadMoveProductImg(long shopId, JSONObject productDetailBase, String folderId) { List imgUrls = moveService.getMovePublishAllImgs(productDetailBase); log.info("getMovePublishAllImgs : " + imgUrls); imgUrls = uploadImgsFilterExist(shopId, imgUrls); @@ -355,19 +355,19 @@ public class ProcessProductPublishTaskService extends TaskBaseService { List> imgChunks = CommonTool.chunkList(imgUrls, 50); for (List imgChunk : imgChunks) { log.info("start uploadMoveProductImgToDd"); - Ret uploadRet = moveService.uploadMoveProductImgToDd(shopId, imgChunk, folderId, "false", accessToken); + Ret uploadRet = moveService.uploadMoveProductImgToDd(shopId, imgChunk, folderId, "false"); log.info("end uploadMoveProductImgToDd"); if (CommonTool.isFailRet(uploadRet)) { if (uploadRet.getReason().contains(MaterialConst.imgSpaceFull) || uploadRet.getReason().contains(MaterialConst.imgSpaceFull1) || uploadRet.getReason().contains("授权已被关闭")) { return uploadRet; } log.info("uploadMoveProductImgToDd ret" + uploadRet + " folderId is :" + folderId); - Map sourceImgUrlToOssImgUrlMap = retryUploadMoveProductImg(shopId, imgChunk, folderId, accessToken); + Map sourceImgUrlToOssImgUrlMap = retryUploadMoveProductImg(shopId, imgChunk, folderId); productDetailBase = MoveUtil.replaceMoveProductImg(productDetailBase, sourceImgUrlToOssImgUrlMap, false); } else { List failUrls = getUploadImgSuccessMapAndFailUrls(uploadRet.getData(), imgChunk); if (!failUrls.isEmpty()) { - Map sourceImgUrlToOssImgUrlMap = retryUploadMoveProductImg(shopId, failUrls, folderId, accessToken); + Map sourceImgUrlToOssImgUrlMap = retryUploadMoveProductImg(shopId, failUrls, folderId); productDetailBase = MoveUtil.replaceMoveProductImg(productDetailBase, sourceImgUrlToOssImgUrlMap, false); } } @@ -395,7 +395,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { return failUrls; } - private Map retryUploadMoveProductImg(long shopId, List imgUrls, String folderId, AccessToken accessToken) { + private Map retryUploadMoveProductImg(long shopId, List imgUrls, String folderId) { String key = "retryUploadMoveProductImg" + LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE); redisTemplate.opsForValue().increment(key, imgUrls.size()); redisTemplate.expire(key, 3600 * 24 * 3, TimeUnit.SECONDS); @@ -418,7 +418,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { sourceImgUrlToOssImgUrlMap.put(imgUrl, currOssImgUrl); } - Ret ret = uploadMaterialImageSyncToDd(shopId, filter, accessToken); + Ret ret = uploadMaterialImageSyncToDd(shopId, filter); if (CommonTool.isSuccessRet(ret)) { continue; } @@ -439,7 +439,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { } String ossUrl = gifCheckRet.getData().get("ossUrl").toString(); sourceImgUrlToOssImgUrlMap.put(imgUrl, filter.put("url", ossUrl)); - ret = uploadMaterialImageSyncToDd(shopId, filter, accessToken); + ret = uploadMaterialImageSyncToDd(shopId, filter); if (CommonTool.isSuccessRet(ret)) { continue; } @@ -447,7 +447,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { Map ossImgUrlMap = MoveUtil.transferMoveSourceImgToOss(shopId, Collections.singletonList(imgUrl), null); String currOssImgUrl = ossImgUrlMap.get(imgUrl); sourceImgUrlToOssImgUrlMap.put(imgUrl, filter.put("url", currOssImgUrl)); - ret = uploadMaterialImageSyncToDd(shopId, filter, accessToken); + ret = uploadMaterialImageSyncToDd(shopId, filter); moveService.delOssMainImgUrls(new String[]{currOssImgUrl}); if (CommonTool.isSuccessRet(ret)) { @@ -497,11 +497,11 @@ public class ProcessProductPublishTaskService extends TaskBaseService { return byteArray; } - public Ret uploadMaterialImageSyncToDd(long shopId, Map filter, AccessToken accessToken) { + public Ret uploadMaterialImageSyncToDd(long shopId, Map filter) { for (int i = 0; i < 3; i++) { - Ret retryRet = realUploadMaterialImageSyncToDd(shopId, filter, accessToken); + Ret retryRet = realUploadMaterialImageSyncToDd(shopId, filter); if (CommonTool.isFailRet(retryRet) && (retryRet.getCode().equals(String.valueOf(MaterialConst.folderIdUnExist)) || retryRet.getReason().contains("该文件夹已经被删除"))) { - String folderId = moveService.getUploadImgFolderId(shopId, accessToken, true); + String folderId = moveService.getUploadImgFolderId(shopId, true); if (folderId != null) { filter.put("folderId", folderId); continue; @@ -512,7 +512,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { return null; } - private Ret realUploadMaterialImageSyncToDd(Long shopId, Map filter, AccessToken accessToken) { + private Ret realUploadMaterialImageSyncToDd(Long shopId, Map filter) { MaterialUploadImageSyncRequest request = new MaterialUploadImageSyncRequest(); MaterialUploadImageSyncParam param = request.getParam(); if (filter.containsKey("url")) { @@ -544,8 +544,8 @@ public class ProcessProductPublishTaskService extends TaskBaseService { return imgUrls; } - private Ret buildCreateProductV2Data(JSONObject mMoveBaseData, MoveProductPublishQueueBO queueMsg, AccessToken accessToken, MoveShopSettingBO condition) { - Ret getPostDataRet = getCompletePostData(mMoveBaseData, queueMsg, accessToken); + private Ret buildCreateProductV2Data(JSONObject mMoveBaseData, MoveProductPublishQueueBO queueMsg, MoveShopSettingBO condition) { + Ret getPostDataRet = getCompletePostData(mMoveBaseData, queueMsg); if (CommonTool.isFailRet(getPostDataRet)) { return getPostDataRet; } @@ -651,7 +651,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { return key.replace("type_", ""); } - private Ret getCompletePostData(JSONObject moveBaseData, MoveProductPublishQueueBO queueMsg, AccessToken accessToken) { + private Ret getCompletePostData(JSONObject moveBaseData, MoveProductPublishQueueBO queueMsg) { String cid = queueMsg.getCid(); MoveShopSettingBO condition = queueMsg.getCondition(); long shopId = queueMsg.getShopId(); @@ -660,7 +660,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { // $itemNum = $this->moveUtil->buildItemNum($moveBaseData, $condition, $isFastMode, $queueMsg); // $moveBaseData['itemNum'] = $itemNum; - Ret buildProductDetailBaseRet = moveService.buildProductDetailBase(moveBaseData, queueMsg, accessToken); + Ret buildProductDetailBaseRet = moveService.buildProductDetailBase(moveBaseData, queueMsg); if (CommonTool.isFailRet(buildProductDetailBaseRet)) { return buildProductDetailBaseRet; } @@ -694,7 +694,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { Ret matchBrandRet = null; brandName = getSourceAttrBrandName(moveBaseData.getJSONObject("sourceAttrs")); for (int i = 0; i <= 3; i++) { - matchBrandRet = searchBrandIdByBrandNameFromDd(cid, brandName, accessToken, true); + matchBrandRet = searchBrandIdByBrandNameFromDd(cid, brandName, true); if (CommonTool.isSuccessRet(matchBrandRet) || !CommonTool.checkIsFrequencyLimitReason(matchBrandRet.getReason())) { break; } @@ -2046,7 +2046,7 @@ public class ProcessProductPublishTaskService extends TaskBaseService { return saleProp; } - private Ret searchBrandIdByBrandNameFromDd(String cid, String brandName, AccessToken accessToken, boolean isReturnNoBrand) { + private Ret searchBrandIdByBrandNameFromDd(String cid, String brandName, boolean isReturnNoBrand) { // 此处算兼容api的bug,品牌名"gefeila/歌菲拉"拿去接口查不到,但是gefeila 或者 /歌菲拉 或者 歌菲拉 都查的到 String queryName = brandName; if (brandName.contains("/")) { diff --git a/ms-biz/src/main/java/com/ms/api/task/SyncShopCategoryQueueTaskService.java b/ms-biz/src/main/java/com/ms/api/task/SyncShopCategoryQueueTaskService.java index 71dcd1a3..974da1e4 100644 --- a/ms-biz/src/main/java/com/ms/api/task/SyncShopCategoryQueueTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/SyncShopCategoryQueueTaskService.java @@ -80,10 +80,12 @@ public class SyncShopCategoryQueueTaskService extends TaskBaseService { Integer shopId = queue.getShopId(); + AuthThreadLocalUtil.set(shopId.toString()); + log.info("getAllShopCategorysFromDd"); AccessToken accessToken = getShopAccessToken(shopId); AuthThreadLocalUtil.set(shopId.toString()); - List shopAllCategoryList = categoryService.getAllShopCategorysFromDd(0L, accessToken); + List shopAllCategoryList = categoryService.getAllShopCategorysFromDd(0L); log.info("recordShopCategorys"); List recordCategoryIds = categoryService.recordShopCategorys(shopId, shopAllCategoryList); log.info("end recordShopCategorys"); diff --git a/ms-biz/src/main/java/com/ms/api/util/DdRequestUtil.java b/ms-biz/src/main/java/com/ms/api/util/DdRequestUtil.java index 1509d97b..82fce6a7 100644 --- a/ms-biz/src/main/java/com/ms/api/util/DdRequestUtil.java +++ b/ms-biz/src/main/java/com/ms/api/util/DdRequestUtil.java @@ -203,7 +203,7 @@ public class DdRequestUtil { } ///shop/getShopCategory - public static List getShopCategory(Long cid, AccessToken accessToken) { + public static List getShopCategory(Long cid) { ShopGetShopCategoryRequest request = new ShopGetShopCategoryRequest(); ShopGetShopCategoryParam param = request.getParam(); param.setCid(cid); @@ -245,16 +245,12 @@ public class DdRequestUtil { } } - public static ProductGetProductUpdateRuleData getProductUpdateRuleFromDd(ProductGetProductUpdateRuleParam param, AccessToken accessToken) { - String activeProfile = System.getenv("sys-deploy-env"); - if (!"Prod".equals(activeProfile)) { - AuthThreadLocalUtil.set(AppConst.TEST_SHOP_ID); - } + public static ProductGetProductUpdateRuleData getProductUpdateRuleFromDd(ProductGetProductUpdateRuleParam param) { ProductGetProductUpdateRuleRequest request = new ProductGetProductUpdateRuleRequest(); request.setParam(param); log.info("=============Dd请求餐素:{}===================", JSONObject.toJSONString(param)); - ProductGetProductUpdateRuleResponse response = ObjectUtil.isNull(accessToken) ? request.execute() : request.execute(accessToken); + ProductGetProductUpdateRuleResponse response = request.execute(); log.info("=============Dd请求返回:{}===================", JSONObject.toJSONString(response)); boolean success = CommonTool.checkDdApiRequestIsSuccess(response); if (success && ObjectUtil.isNotEmpty(response.getData())) { @@ -263,9 +259,9 @@ 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 ApiResult getBrandListV2FromDdNotEx(ProductGetProductUpdateRuleParam param, AccessToken accessToken) { + public static ApiResult getBrandListV2FromDdNotEx(ProductGetProductUpdateRuleParam param) { try { - ProductGetProductUpdateRuleData data = getProductUpdateRuleFromDd(param, accessToken); + ProductGetProductUpdateRuleData data = getProductUpdateRuleFromDd(param); return ApiResult.ok(data); } catch (RuntimeException e) { return ApiResult.fail(e.getMessage());