|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package com.logpm.factorydata.util; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import com.logpm.factorydata.feign.IFactoryDataClient; |
|
|
|
|
import com.logpm.factorydata.vo.NodePushMsg; |
|
|
|
@ -31,14 +33,13 @@ public class FactoryDataMessageSender {
|
|
|
|
|
public void sendNodeDataByBrand(NodePushMsg data) { |
|
|
|
|
try{ |
|
|
|
|
String routingKeyByName = FactoryDataUtil.findRoutingKeyByName(data.getBrand()); |
|
|
|
|
if(routingKeyByName == null){ |
|
|
|
|
if(StrUtil.isEmpty(routingKeyByName)){ |
|
|
|
|
return ; |
|
|
|
|
} |
|
|
|
|
SendMsg build = SendMsg.builder().exchange(FactoryDataConstants.Mq.Exchanges.NODE_DATA_PUSH).routingKey(routingKeyByName).message(JSONUtil.toJsonStr(data, HutoolConfigUtil.jsonConfigByDataTimeFormat())).build(); |
|
|
|
|
factoryDataClient.sendMessage(build); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.error("sendNodeDataByBrand >>>>" ,e); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|