Browse Source

Merge branch 'dev' into pre-production

master
zhaoqiaobo 8 months ago
parent
commit
c9e7345298
  1. 13
      blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/mq/NodeDataPushListener.java
  2. 19
      blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/pros/OldProperties.java

13
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.EnumUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONArray; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; 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.FactoryNodeEnums;
import com.logpm.factorydata.olo.enums.NodeMappingEnums; import com.logpm.factorydata.olo.enums.NodeMappingEnums;
import com.logpm.factorydata.olo.enums.NodeNeedEnums; import com.logpm.factorydata.olo.enums.NodeNeedEnums;
import com.logpm.factorydata.olo.pros.OldProperties;
import com.logpm.factorydata.vo.PushData; import com.logpm.factorydata.vo.PushData;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -40,6 +42,7 @@ import java.util.stream.Collectors;
public class NodeDataPushListener { public class NodeDataPushListener {
private final IFactoryDataClient factoryDataClient; private final IFactoryDataClient factoryDataClient;
private final OldProperties oldProperties;
@RabbitListener(bindings = @QueueBinding( @RabbitListener(bindings = @QueueBinding(
value = @Queue(name = FactoryDataConstants.Mq.Queues.OLO_NODE_DATA_PUSH, durable = "true"), value = @Queue(name = FactoryDataConstants.Mq.Queues.OLO_NODE_DATA_PUSH, durable = "true"),
@ -87,7 +90,15 @@ public class NodeDataPushListener {
} }
js.set("snList", snArray); js.set("snList", snArray);
log.info("推送节点数据:{}", js.toString()); 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);
}
}
} }
} }
} }

19
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;
}
Loading…
Cancel
Save