From 1ad41dd5d70da152ae4477dcecaf7d491b18cad5 Mon Sep 17 00:00:00 2001 From: zhaoqiaobo Date: Thu, 30 May 2024 14:47:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(all):=20=E4=BF=AE=E6=94=B9=E6=88=91?= =?UTF-8?q?=E4=B9=90=E8=8A=82=E7=82=B9=E6=95=B0=E6=8D=AE=E5=9B=9E=E6=8E=A8?= =?UTF-8?q?=E8=80=81=E7=B3=BB=E7=BB=9F=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../olo/mq/NodeDataPushListener.java | 18 +++++++++++------- .../service/impl/DeliveryNoteServiceImpl.java | 7 ++++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mq/NodeDataPushListener.java b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mq/NodeDataPushListener.java index 8a14ceb58..b2360d2ff 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mq/NodeDataPushListener.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mq/NodeDataPushListener.java @@ -65,6 +65,7 @@ public class NodeDataPushListener { if (CollUtil.isNotEmpty(content)) { Map> sendMap = content.stream() .collect(Collectors.groupingBy(data -> data.getOrderCode() + data.getWaybillNumber())); + JSONArray jsons = new JSONArray(sendMap.size()); for (Map.Entry> entry : sendMap.entrySet()) { List pushDatas = entry.getValue(); PushData pushData = pushDatas.get(0); @@ -89,15 +90,18 @@ public class NodeDataPushListener { snArray.add(jsonObject); } js.set("snList", snArray); - log.info("推送节点数据:{}", js.toString()); - if (StrUtil.isNotEmpty(oldProperties.getPushNodeUrl())) { - try { - String post = HttpUtil.post(oldProperties.getPushNodeUrl(), js.toString()); + jsons.add(js); + } + if (StrUtil.isNotEmpty(oldProperties.getPushNodeUrl())) { + try { + if (CollUtil.isNotEmpty(jsons)) { + log.info("推送节点数据:{}", JSONUtil.toJsonStr(jsons)); + String post = HttpUtil.post(oldProperties.getPushNodeUrl(), JSONUtil.toJsonStr(jsons)); log.info("推送结果:{}", post); - } catch (Exception e) { - e.printStackTrace(); - log.error("推送节点数据错误:{}", e); } + } catch (Exception e) { + e.printStackTrace(); + log.error("推送节点数据错误:{}", e); } } } diff --git a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/impl/DeliveryNoteServiceImpl.java b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/impl/DeliveryNoteServiceImpl.java index eb1f98f72..f8087418c 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/impl/DeliveryNoteServiceImpl.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/service/impl/DeliveryNoteServiceImpl.java @@ -23,7 +23,6 @@ import com.logpm.factorydata.olo.pros.OldProperties; import com.logpm.factorydata.olo.service.DeliveryNoteService; import com.logpm.factorydata.olo.service.FactoryOrderLogService; import com.logpm.factorydata.olo.vo.DeliveryNoteVO; -import com.logpm.factorydata.vo.PushData; import com.logpm.factorydata.vo.SendMsg; import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; import com.logpm.trunkline.entity.TrunklineAdvanceEntity; @@ -39,7 +38,6 @@ import org.springblade.common.constant.factorydata.FactoryDataConstants; import org.springblade.common.utils.FileLogsUtil; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.oss.model.BladeFile; -import org.springblade.core.redis.cache.BladeRedis; import org.springblade.core.tool.api.R; import org.springblade.resource.feign.IOssClient; import org.springframework.amqp.rabbit.core.RabbitTemplate; @@ -237,6 +235,9 @@ public class DeliveryNoteServiceImpl extends BaseServiceImpl pushDatas = StrUtil.split(sns, ","); js.set("siteLevel", 3); @@ -255,7 +256,7 @@ public class DeliveryNoteServiceImpl extends BaseServiceImpl