|
@@ -1,8 +1,13 @@
|
|
|
package org.dromara.util;
|
|
package org.dromara.util;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.dromara.common.core.utils.SpringUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
|
+import org.dromara.system.service.ISysConfigService;
|
|
|
import org.springframework.context.annotation.Import;
|
|
import org.springframework.context.annotation.Import;
|
|
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
import java.io.UnsupportedEncodingException;
|
|
@@ -31,8 +36,16 @@ public class MessageUtils {
|
|
|
Map<String, String> data = new HashMap<>();
|
|
Map<String, String> data = new HashMap<>();
|
|
|
data.put("devtype", "tts");
|
|
data.put("devtype", "tts");
|
|
|
data.put("devcode", devicecode);
|
|
data.put("devcode", devicecode);
|
|
|
|
|
+ int vol = 1;
|
|
|
|
|
+ try {
|
|
|
|
|
+ String vols = SpringUtils.getBean(ISysConfigService.class).selectConfigByKey("sys.tts.vol");
|
|
|
|
|
+ JSONObject volso =JSONUtil.parseObj(vols);
|
|
|
|
|
+ int hour = DateUtil.date().hour(true);
|
|
|
|
|
+ vol = volso.getInt(hour<10?"0"+hour:hour+"");
|
|
|
|
|
+ }catch (Exception e){}
|
|
|
|
|
+
|
|
|
final CamelDataUtil camelDataUtil = SpringUtil.getBean("camelDataUtil");
|
|
final CamelDataUtil camelDataUtil = SpringUtil.getBean("camelDataUtil");
|
|
|
- camelDataUtil.SendData("direct:sendMessage", StringUtils.format("{\"val\":\"{}\",\"vol\":3,\"id\":\"{}\"}", message,devicecode), "mqheader", data);
|
|
|
|
|
|
|
+ camelDataUtil.SendData("direct:sendMessage", StringUtils.format("{\"val\":\"{}\",\"vol\":"+vol+",\"id\":\"{}\"}", message,devicecode), "mqheader", data);
|
|
|
}else{
|
|
}else{
|
|
|
log.error("------------------");
|
|
log.error("------------------");
|
|
|
log.error("devicecode:"+devicecode.toString()+" message:"+message.toString());
|
|
log.error("devicecode:"+devicecode.toString()+" message:"+message.toString());
|