1
This commit is contained in:
@@ -8,6 +8,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -61,7 +62,8 @@ public class WXUtil {
|
||||
*/
|
||||
public static String WX_BASE_URL;
|
||||
private Environment env;
|
||||
|
||||
@Autowired
|
||||
private RocketMQTemplate rocketMQTemplate;
|
||||
@Autowired
|
||||
public WXUtil(Environment env) {
|
||||
this.env = env;
|
||||
@@ -137,6 +139,8 @@ public class WXUtil {
|
||||
//System.out.println(JSON.toJSONString(jsonObject));
|
||||
//wxReqDate.setData(jsonObject);
|
||||
if (Util.isNotEmpty(wxid)) {
|
||||
// 把消息发送到RocketMQ,使用'wx-message'作为topic,jsonObject作为消息内容。
|
||||
rocketMQTemplate.convertAndSend("wx-message", jsonObject);
|
||||
String responseStr = HttpRequest.post(WX_BASE_URL)
|
||||
.body(JSON.toJSONString(jsonObject)).execute().body();
|
||||
if (ObjectUtil.isNotEmpty(responseStr)) {
|
||||
|
||||
Reference in New Issue
Block a user