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; + +}