1
This commit is contained in:
@@ -10,6 +10,9 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
import static cn.van.business.util.WXUtil.WX_BASE_URL;
|
import static cn.van.business.util.WXUtil.WX_BASE_URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,8 +32,12 @@ public class MessageConsumerService implements RocketMQListener<JSONObject> {
|
|||||||
// 处理消息
|
// 处理消息
|
||||||
try {
|
try {
|
||||||
logger.info("消费到消息:{}", jsonObject);
|
logger.info("消费到消息:{}", jsonObject);
|
||||||
|
String body = jsonObject.getString("body");
|
||||||
|
byte[] decodedBody = Base64.getDecoder().decode(body);
|
||||||
|
String decodedBodyStr = new String(decodedBody, StandardCharsets.UTF_8);
|
||||||
|
JSONObject decodedBodyJson = JSONObject.parseObject(decodedBodyStr);
|
||||||
String responseStr = HttpRequest.post(WX_BASE_URL)
|
String responseStr = HttpRequest.post(WX_BASE_URL)
|
||||||
.body(JSONUtil.toJsonStr(jsonObject))
|
.body(JSONUtil.toJsonStr(decodedBodyJson))
|
||||||
.execute()
|
.execute()
|
||||||
.body();
|
.body();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user