From c23154e7f5e2d2c572c8ba6a51a905f6e80c0764 Mon Sep 17 00:00:00 2001 From: zhaoqiaobo Date: Wed, 29 May 2024 10:14:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(all):=20=E5=A2=9E=E5=8A=A0=E6=88=91?= =?UTF-8?q?=E4=B9=90=E9=85=8D=E9=80=81=E8=8A=82=E7=82=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../olo/mq/NodeDataPushListener.java | 13 ++++++++++++- .../factorydata/olo/pros/OldProperties.java | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/pros/OldProperties.java 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 7495af8ed..7ac2392fd 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 @@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.EnumUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONArray; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; @@ -12,6 +13,7 @@ import com.logpm.factorydata.feign.IFactoryDataClient; import com.logpm.factorydata.olo.enums.FactoryNodeEnums; import com.logpm.factorydata.olo.enums.NodeMappingEnums; import com.logpm.factorydata.olo.enums.NodeNeedEnums; +import com.logpm.factorydata.olo.pros.OldProperties; import com.logpm.factorydata.vo.PushData; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -40,6 +42,7 @@ import java.util.stream.Collectors; public class NodeDataPushListener { private final IFactoryDataClient factoryDataClient; + private final OldProperties oldProperties; @RabbitListener(bindings = @QueueBinding( value = @Queue(name = FactoryDataConstants.Mq.Queues.OLO_NODE_DATA_PUSH, durable = "true"), @@ -87,7 +90,15 @@ public class NodeDataPushListener { } js.set("snList", snArray); log.info("推送节点数据:{}", js.toString()); -// HttpUtil.post("", js.toString()); + if (StrUtil.isNotEmpty(oldProperties.getPushNodeUrl())) { + try { + String post = HttpUtil.post(oldProperties.getPushNodeUrl(), js.toString()); + log.info("推送结果:{}", post); + } 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/pros/OldProperties.java b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/pros/OldProperties.java new file mode 100644 index 000000000..9d414cf8b --- /dev/null +++ b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/pros/OldProperties.java @@ -0,0 +1,19 @@ +package com.logpm.factorydata.olo.pros; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * 老系统配置 + * @author zhaoqiaobo + * @Date 2024/5/29 + **/ +@Data +@ConfigurationProperties(prefix = "old") +public class OldProperties { + /** + * 推送节点数据到来系统的 url + */ + private String pushNodeUrl; + +}