From b1a6c3a5400c8734068b95368873d864efb0fc02 Mon Sep 17 00:00:00 2001 From: wangchaoxu Date: Mon, 11 Sep 2023 15:30:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=91=BD=E5=90=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ms/api/spi/move/GetFreightTemplateList.java | 7 +------ .../ms/api/spi/move/GetShopCloudHotProductsService.java | 6 +----- .../java/com/ms/api/task/MovePublishBufferTaskService.java | 2 +- .../com/ms/api/task/SyncShopCategoryQueueTaskService.java | 4 ++-- ms-biz/src/main/java/com/ms/api/util/DdRequestUtil.java | 6 +++--- 5 files changed, 8 insertions(+), 17 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/spi/move/GetFreightTemplateList.java b/ms-biz/src/main/java/com/ms/api/spi/move/GetFreightTemplateList.java index 9794fb3d..1d870ed1 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/move/GetFreightTemplateList.java +++ b/ms-biz/src/main/java/com/ms/api/spi/move/GetFreightTemplateList.java @@ -2,8 +2,6 @@ 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; @@ -12,11 +10,8 @@ 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; @@ -38,7 +33,7 @@ public class GetFreightTemplateList extends SPIBaseService implements ExtensionS // ----业务处理---- FreightTemplateListParam param = new FreightTemplateListParam(); param.setSize(fields.getSize()); - FreightTemplateListData data = DdRequestUtil.FreightTemplateListDataRequest(param); + FreightTemplateListData data = DdRequestUtil.freightTemplateListDataRequest(param); Map result = new HashMap<>(); result.put("data", data.getList()); result.put("total", data.getCount()); diff --git a/ms-biz/src/main/java/com/ms/api/spi/move/GetShopCloudHotProductsService.java b/ms-biz/src/main/java/com/ms/api/spi/move/GetShopCloudHotProductsService.java index 8eaf0733..363091ef 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/move/GetShopCloudHotProductsService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/move/GetShopCloudHotProductsService.java @@ -1,7 +1,5 @@ package com.ms.api.spi.move; -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.api.BaseRequest; @@ -12,10 +10,8 @@ import com.ms.api.common.R; import com.ms.api.common.Ret; import com.ms.api.common.SPIBaseService; 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; @@ -41,7 +37,7 @@ public class GetShopCloudHotProductsService extends SPIBaseService implements Ex param.setClueInfo(fields.getKeyword()); param.setCurrent(fields.getPageNo()); param.setPageSize(fields.getPageSize()); - ProductIsvGetClueListData data = DdRequestUtil.ProductIsvGetClueListRequest(param); + ProductIsvGetClueListData data = DdRequestUtil.productIsvGetClueListRequest(param); Map result = new HashMap<>(); result.put("data", data.getData()); result.put("total", data.getTotal()); diff --git a/ms-biz/src/main/java/com/ms/api/task/MovePublishBufferTaskService.java b/ms-biz/src/main/java/com/ms/api/task/MovePublishBufferTaskService.java index 9b2d6af1..eb13fc41 100644 --- a/ms-biz/src/main/java/com/ms/api/task/MovePublishBufferTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/MovePublishBufferTaskService.java @@ -182,7 +182,7 @@ public class MovePublishBufferTaskService extends TaskBaseService { // 去重 shopIds = shopIds.stream().distinct().collect(Collectors.toList()); - + // 返回 StrObjMap result = new StrObjMap(); result.put("priorityShopsMap", priorityShopsMap); 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 df138edb..3d53b9d8 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 @@ -84,14 +84,14 @@ public class SyncShopCategoryQueueTaskService extends TaskBaseService { private List findChildShopCategory(Long cid) { List dataAll = new ArrayList(); - List dataGet = DdRequestUtil.GetShopCategory(cid); + 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()); + List data1 = DdRequestUtil.getShopCategory(datum.getId()); dataAll.addAll(data1); } } 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 2bc95e9f..345aeba8 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 @@ -200,7 +200,7 @@ 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 ProductIsvGetClueListData ProductIsvGetClueListRequest(ProductIsvGetClueListParam param) { + public static ProductIsvGetClueListData productIsvGetClueListRequest(ProductIsvGetClueListParam param) { String activeProfile = System.getenv("sys-deploy-env"); if (!"Prod".equals(activeProfile)) { AuthThreadLocalUtil.set(AppConst.TEST_SHOP_ID); @@ -217,7 +217,7 @@ 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) { + public static FreightTemplateListData freightTemplateListDataRequest(FreightTemplateListParam param) { String activeProfile = System.getenv("sys-deploy-env"); if (!"Prod".equals(activeProfile)) { AuthThreadLocalUtil.set(AppConst.TEST_SHOP_ID); @@ -235,7 +235,7 @@ public class DdRequestUtil { } ///shop/getShopCategory - public static List GetShopCategory(Long cid){ + public static List getShopCategory(Long cid){ ShopGetShopCategoryRequest request = new ShopGetShopCategoryRequest(); ShopGetShopCategoryParam param = request.getParam(); param.setCid(cid); From 5e538b432b4af39f734026c5cd3d5d7b08d735f4 Mon Sep 17 00:00:00 2001 From: daixiaogang <2510234660@qq.com> Date: Mon, 11 Sep 2023 16:16:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0pom=20setting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- settings.xml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 settings.xml diff --git a/settings.xml b/settings.xml new file mode 100644 index 00000000..c2aff81b --- /dev/null +++ b/settings.xml @@ -0,0 +1,30 @@ + + + + alimaven + aliyun maven + http://maven.aliyun.com/nexus/content/groups/public/ + central + + + + + bytedance-isv + + + bytedance-public-releases + https://artifact.bytedance.com/repository/releases/ + + true + + + false + + + + + + + bytedance-isv + + \ No newline at end of file From 41e9392e7c79c2f09d0afb5bf4ede1e1e3e62b0f Mon Sep 17 00:00:00 2001 From: ljl Date: Mon, 11 Sep 2023 16:21:05 +0800 Subject: [PATCH 3/3] yh --- .../DsMessageConsumerQueueServiceImpl.java | 7 ++-- .../DelayOutstorageMoveBufferTaskService.java | 2 +- .../DelayOutstorageProcessTaskService.java | 2 +- .../task/DsMessageConsumeMsgTaskService.java | 2 +- .../task/DsMessageMoveBufferTaskService.java | 2 +- ms-web/src/main/java/com/ms/web/Test.java | 36 +++++++++++++++---- 6 files changed, 36 insertions(+), 15 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/DsMessageConsumerQueueServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/DsMessageConsumerQueueServiceImpl.java index a3fd7ebd..6326f832 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/DsMessageConsumerQueueServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/DsMessageConsumerQueueServiceImpl.java @@ -122,18 +122,17 @@ public class DsMessageConsumerQueueServiceImpl implements DsMessageConsumerQueue result = ApiResult.fail("提交数据异常"); break; } - + System.out.println("queues:" + queues); Long startQueueId = null; if (!queues.isEmpty()) { startQueueId = queues.get(0).getDsMessageConsumerQueueId(); } if (ObjectUtil.isNotNull(startQueueId)) { int addQueueCount = queues.size(); - int queueIdLoop = 0; for (Long queueId = startQueueId; queueId < (addQueueCount + startQueueId); queueId++) { String queueRedisKey = RedisKeyConst.getQueueRedisKey(TblConst.ds_message_consumer_queue, false); - redisTemplate.opsForList().leftPush(queueRedisKey, queueId.toString()); - queueIdLoop++; + System.out.println("in_queue[" + queueRedisKey + "]: " + queueId); + redisTemplate.opsForList().leftPush(queueRedisKey, String.valueOf(queueId)); } } diff --git a/ms-biz/src/main/java/com/ms/api/task/DelayOutstorageMoveBufferTaskService.java b/ms-biz/src/main/java/com/ms/api/task/DelayOutstorageMoveBufferTaskService.java index 0335aed8..ebfc65f8 100644 --- a/ms-biz/src/main/java/com/ms/api/task/DelayOutstorageMoveBufferTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/DelayOutstorageMoveBufferTaskService.java @@ -33,7 +33,7 @@ public class DelayOutstorageMoveBufferTaskService extends TaskBaseService { protected Executor taskPool; @Async("delayOutstorageMoveBufferTaskPool") - @Scheduled(fixedRate = 10000) +// @Scheduled(fixedRate = 10000) @Override public void runTask() { super.runTask(); diff --git a/ms-biz/src/main/java/com/ms/api/task/DelayOutstorageProcessTaskService.java b/ms-biz/src/main/java/com/ms/api/task/DelayOutstorageProcessTaskService.java index 566d000e..50a7d182 100644 --- a/ms-biz/src/main/java/com/ms/api/task/DelayOutstorageProcessTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/DelayOutstorageProcessTaskService.java @@ -38,7 +38,7 @@ public class DelayOutstorageProcessTaskService extends TaskBaseService { protected Executor taskPool; @Async("delayOutstorageProcessTaskPool") - @Scheduled(fixedRate = 10000) +// @Scheduled(fixedRate = 10000) @Override public void runTask() { super.runTask(); diff --git a/ms-biz/src/main/java/com/ms/api/task/DsMessageConsumeMsgTaskService.java b/ms-biz/src/main/java/com/ms/api/task/DsMessageConsumeMsgTaskService.java index 2cd4bcfa..67573d7d 100644 --- a/ms-biz/src/main/java/com/ms/api/task/DsMessageConsumeMsgTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/DsMessageConsumeMsgTaskService.java @@ -45,7 +45,7 @@ public class DsMessageConsumeMsgTaskService extends TaskBaseService { protected Executor taskPool; @Async("dsMessageConsumeMsgTaskPool") - @Scheduled(fixedRate = 10000) +// @Scheduled(fixedRate = 10000) @Override public void runTask() { super.runTask(); diff --git a/ms-biz/src/main/java/com/ms/api/task/DsMessageMoveBufferTaskService.java b/ms-biz/src/main/java/com/ms/api/task/DsMessageMoveBufferTaskService.java index 0f628447..94bf090c 100644 --- a/ms-biz/src/main/java/com/ms/api/task/DsMessageMoveBufferTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/DsMessageMoveBufferTaskService.java @@ -33,7 +33,7 @@ public class DsMessageMoveBufferTaskService extends TaskBaseService { protected Executor taskPool; @Async("dsMessageMoveBufferTaskPool") - @Scheduled(fixedRate = 10000) +// @Scheduled(fixedRate = 10000) @Override public void runTask() { super.runTask(); diff --git a/ms-web/src/main/java/com/ms/web/Test.java b/ms-web/src/main/java/com/ms/web/Test.java index c94eb4d9..594e2c04 100644 --- a/ms-web/src/main/java/com/ms/web/Test.java +++ b/ms-web/src/main/java/com/ms/web/Test.java @@ -1,21 +1,28 @@ package com.ms.web; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.jinritemai.cloud.base.api.BaseResponse; +import com.ms.api.common.Pager; +import com.ms.api.common.R; +import com.ms.api.common.Ret; +import com.ms.api.consts.AppConst; import com.ms.api.dto.dsapi.response.GetPlatformShopPurchaseSettingResponseDTO; +import com.ms.api.dto.dsorder.DsMessageCallbackRequestDTO; import com.ms.api.dto.dsorder.RemarkTplTagDTO; -import com.ms.api.service.DsApiService; -import com.ms.api.service.OpOrderService; -import com.ms.api.service.PurchaseOrderItemService; -import com.ms.api.service.ShopService; +import com.ms.api.dto.order.SearchDsOrderFilterDTO; +import com.ms.api.dto.order.SearchDsOrderListRequestDTO; +import com.ms.api.service.*; +import com.ms.api.tool.CommonTool; import com.ms.api.tool.PurchaseTool; import com.ms.common.util.DsClient; import com.ms.common.util.HttpClient; import com.ms.dal.entity.PurchaseOrderItem; import com.ms.dal.entity.Shop; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.spec.SecretKeySpec; @@ -32,6 +39,7 @@ import java.util.regex.Pattern; * @Author: laixw * @Date: 2023/8/22 */ +@Slf4j @RestController public class Test { @@ -44,6 +52,9 @@ public class Test { @Autowired private PurchaseOrderItemService purchaseOrderItemService; + @Autowired + private DsMessageService dsMessageService; + @Autowired private DsApiService dsApiService; @@ -168,4 +179,15 @@ public class Test { e.printStackTrace(); } } + + @PostMapping("/dsMessageCallback") + public BaseResponse dsMessageCallback(@RequestBody DsMessageCallbackRequestDTO request) { + try { + log.info("receive callback: " + JSON.toJSONString(request)); + dsMessageService.addDsMessage(request.getShopId(), request.getPlatformPushMsgId(), request.getBizId(), request.getBizType(), request.getData()); + return R.ok(CommonTool.successResult()); + } catch (RuntimeException e) { + return R.ok(Ret.fail(e.getMessage())); + } + } }