From 22af68a24f3402dadfea6f645ff6bdc9f8555526 Mon Sep 17 00:00:00 2001 From: wangchaoxu Date: Mon, 4 Sep 2023 16:09:39 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=8D=95=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/impl/PurchaseOrderServiceImpl.java | 14 ++++++++------ ms-dal/src/main/resources/mapper/OpOrderMapper.xml | 12 ++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderServiceImpl.java index f6120fd6..ac33f1db 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/PurchaseOrderServiceImpl.java @@ -650,11 +650,13 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService { return new HashMap<>(); } StringBuilder where = new StringBuilder(); - if (ObjectUtil.isNotEmpty(filter.getPurchaseStartTime())) { - where.append(String.format(" and purchase_order_start_time >= '%s'", DateUtil.formatDateTime(filter.getPurchaseStartTime()))); - } - if (ObjectUtil.isNotEmpty(filter.getPurchaseEndTime())) { - where.append(String.format(" and purchase_order_start_time <= '%s'", DateUtil.formatDateTime(filter.getPurchaseEndTime()))); + if (ObjectUtil.isNotEmpty(filter)) { + if (ObjectUtil.isNotEmpty(filter.getPurchaseStartTime())) { + where.append(String.format(" and purchase_order_start_time >= '%s'", DateUtil.formatDateTime(filter.getPurchaseStartTime()))); + } + if (ObjectUtil.isNotEmpty(filter.getPurchaseEndTime())) { + where.append(String.format(" and purchase_order_start_time <= '%s'", DateUtil.formatDateTime(filter.getPurchaseEndTime()))); + } } List purchaseOrders = purchaseOrderMapper.selectPurchaseOrders(shopIds, orderIds, StatusConst.normal, where.toString()); if (ObjectUtil.isEmpty(purchaseOrders)) { @@ -1503,7 +1505,7 @@ public class PurchaseOrderServiceImpl implements PurchaseOrderService { return orderPhaseInfo; } - + private List appendItemsIsUseManualConsignee(List returnOrderItems, Map returnPurchaseOrders, Map skuIdAndPurchaseOrderIdMap) { for (JSONObject item : returnOrderItems) { diff --git a/ms-dal/src/main/resources/mapper/OpOrderMapper.xml b/ms-dal/src/main/resources/mapper/OpOrderMapper.xml index 6554490d..3ba18e12 100644 --- a/ms-dal/src/main/resources/mapper/OpOrderMapper.xml +++ b/ms-dal/src/main/resources/mapper/OpOrderMapper.xml @@ -68,7 +68,7 @@ select from op_order - where op_order_id = #{opOrderId,jdbcType=BIGINT} + where op_order_id = #{opOrderId,jdbcType=BIGINT} select from op_order where order_id in - + #{orderId} From fcd90bee84f1451bc204d4f41a6ad11f3bfec449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cxxxxxxx=E8=AF=A6?= <286460656@qq.com> Date: Mon, 4 Sep 2023 16:16:34 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=95=86=E5=93=81=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...oductInfoByProductId.java => GetProductInfoByProductId.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename ms-biz/src/main/java/com/ms/api/spi/move/{getProductInfoByProductId.java => GetProductInfoByProductId.java} (97%) diff --git a/ms-biz/src/main/java/com/ms/api/spi/move/getProductInfoByProductId.java b/ms-biz/src/main/java/com/ms/api/spi/move/GetProductInfoByProductId.java similarity index 97% rename from ms-biz/src/main/java/com/ms/api/spi/move/getProductInfoByProductId.java rename to ms-biz/src/main/java/com/ms/api/spi/move/GetProductInfoByProductId.java index 3c8a20d8..584d387f 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/move/getProductInfoByProductId.java +++ b/ms-biz/src/main/java/com/ms/api/spi/move/GetProductInfoByProductId.java @@ -30,7 +30,7 @@ import java.util.regex.Pattern; */ @ExtensionService("getProductInfoByProductId") @Slf4j -public class getProductInfoByProductId extends SPIBaseService implements ExtensionServiceHandler { +public class GetProductInfoByProductId extends SPIBaseService implements ExtensionServiceHandler { @Autowired private DsJsonRequestTemplate dsJsonRequestTemplate; From 07694596fcb265c830f713dd0ed7de9017216253 Mon Sep 17 00:00:00 2001 From: wangchaoxu Date: Mon, 4 Sep 2023 16:27:48 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=8D=95=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/RsyncDdOrdersAndPurchaseOrdersService.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/spi/order/RsyncDdOrdersAndPurchaseOrdersService.java b/ms-biz/src/main/java/com/ms/api/spi/order/RsyncDdOrdersAndPurchaseOrdersService.java index ef952191..1eb84db8 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/order/RsyncDdOrdersAndPurchaseOrdersService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/order/RsyncDdOrdersAndPurchaseOrdersService.java @@ -87,7 +87,7 @@ public class RsyncDdOrdersAndPurchaseOrdersService extends SPIBaseService implem } } - Map> retMap = new HashMap(); + Map> purchaseOrderListMap = new HashMap(); if (!StringUtils.isEmpty(orderIdsStr)) { List shopIds = new ArrayList<>(); shopIds.add(shopId.toString()); @@ -113,17 +113,19 @@ public class RsyncDdOrdersAndPurchaseOrdersService extends SPIBaseService implem } } retOrder.setItems(itemList); - if (retMap.containsKey(orderId)) { - retMap.get(orderId).add(retOrder); + if (purchaseOrderListMap.containsKey(orderId)) { + purchaseOrderListMap.get(orderId).add(retOrder); } else { List newList = new ArrayList<>(); newList.add(retOrder); - retMap.put(orderId, newList); + purchaseOrderListMap.put(orderId, newList); } } } } + Map retMap = new HashMap(); + retMap.put("rsyncPurchaseOrderInfo", purchaseOrderListMap); return R.ok(Ret.success(retMap)); } catch (Exception e) { log.error("同步分销采购单失败,原因:" + e.getMessage()); From 022909f01753442ea789f78bdfc041e81a5b40d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cxxxxxxx=E8=AF=A6?= <286460656@qq.com> Date: Mon, 4 Sep 2023 16:31:08 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=B5=8B=E8=AF=95spi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- .../main/java/com/ms/api/TestSpiService.java | 42 +++++++++---------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 04942f34..ccd4120a 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ curl --location --request POST 'localhost:8080/base/cloud/spi' \ --data-raw '{ "appId":"7264840234423027259", "authId":"4463798", -"method":"getProductInfoByProductId", +"method":"testSpi", "data":"{\"productIds\":[682805686164],\"pageSize\":\"20\"}" }' diff --git a/ms-biz/src/main/java/com/ms/api/TestSpiService.java b/ms-biz/src/main/java/com/ms/api/TestSpiService.java index 4c1435af..521d76b0 100644 --- a/ms-biz/src/main/java/com/ms/api/TestSpiService.java +++ b/ms-biz/src/main/java/com/ms/api/TestSpiService.java @@ -1,47 +1,45 @@ package com.ms.api; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; 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.ItemDTO; -import com.ms.api.tool.DsJsonRequestTemplate; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashMap; +import java.util.Map; @ExtensionService("testSpi") @Slf4j -public class TestSpiService extends SPIBaseService implements ExtensionServiceHandler { - @Autowired - private DsJsonRequestTemplate dsJsonRequestTemplate; +public class TestSpiService implements ExtensionServiceHandler { + @Override - public BaseResponse handle(BaseRequest req) { - initHandle(req); - getAuthCode(); - String res = null; - HashMap params = new HashMap<>(); - params.put("platformItemId", 1); - params.put("sourceItemId", 33); - params.put("authCode", authCode); - try { - res = dsJsonRequestTemplate.execute("/micro_move/add_platform_item_to_source_item_relation", params); - log.info(res); - } catch (Exception e) { + public BaseResponse handle(BaseRequest req) { + + String resourceFileName = "/getProductCatTree.txt"; // 注意路径的开头是一个斜杠 + String lines = null; + try (InputStream is = InputStream.class.getResourceAsStream(resourceFileName); + BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { + String line; + while ((line = reader.readLine()) != null) { + System.out.println(line); + lines = lines + line; + } + } catch (IOException e) { e.printStackTrace(); - log.error(e.getMessage()); } - return R.ok(JSON.parseObject(res)); + + Map result = new HashMap<>(); + result.put("line", lines); + + return R.ok(Ret.success(result)); } }