|
@@ -5,19 +5,20 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.springframework.context.annotation.Import;
|
|
import org.springframework.context.annotation.Import;
|
|
|
|
|
|
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
@Import(cn.hutool.extra.spring.SpringUtil.class)
|
|
@Import(cn.hutool.extra.spring.SpringUtil.class)
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
public class MessageUtils {
|
|
public class MessageUtils {
|
|
|
- public static void sendLed(String devicecode,String message){
|
|
|
|
|
|
|
+ public static void sendLed(String devicecode,String message) throws UnsupportedEncodingException {
|
|
|
if(StringUtils.isNotEmpty(devicecode)&&StringUtils.isNotEmpty(message)) {
|
|
if(StringUtils.isNotEmpty(devicecode)&&StringUtils.isNotEmpty(message)) {
|
|
|
Map<String, String> data = new HashMap<>();
|
|
Map<String, String> data = new HashMap<>();
|
|
|
data.put("devtype", "led");
|
|
data.put("devtype", "led");
|
|
|
data.put("devcode", devicecode);
|
|
data.put("devcode", devicecode);
|
|
|
final CamelDataUtil camelDataUtil = SpringUtil.getBean("camelDataUtil");
|
|
final CamelDataUtil camelDataUtil = SpringUtil.getBean("camelDataUtil");
|
|
|
- camelDataUtil.SendData("direct:sendMessage", StringUtils.format("{\"val\":\"{}\"}", message), "mqheader", data);
|
|
|
|
|
|
|
+ camelDataUtil.SendData("direct:sendMessage", StringUtils.format("{\"val\":\"{}\"}", message).getBytes("GBK"), "mqheader", data);
|
|
|
}else {
|
|
}else {
|
|
|
log.error("------------------");
|
|
log.error("------------------");
|
|
|
log.error("devicecode:"+devicecode.toString()+" message:"+message.toString());
|
|
log.error("devicecode:"+devicecode.toString()+" message:"+message.toString());
|