|
@@ -1,9 +1,9 @@
|
|
|
package com.free.mq;
|
|
|
|
|
|
-import com.fasterxml.jackson.annotation.JsonInclude;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
|
|
import java.util.Map;
|
|
|
import java.util.HashMap;
|
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
@@ -31,9 +31,10 @@ public class MqService {
|
|
|
* @throws JsonProcessingException JSON处理异常
|
|
|
*/
|
|
|
public void sendMsg(String ex, String queue, Map msg) throws JsonProcessingException {
|
|
|
+ System.out.println(msg);
|
|
|
String strMsg = null;
|
|
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
- mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
|
|
+ mapper.setSerializationInclusion(Include.NON_NULL);
|
|
|
strMsg = mapper.writeValueAsString(msg);
|
|
|
rabbitTemplate.convertAndSend(ex, queue, strMsg);
|
|
|
}
|
|
@@ -84,8 +85,9 @@ public class MqService {
|
|
|
String routerKey = MqListeners.queueName + "." + apply.getUser_id();
|
|
|
Map map = new HashMap<>();
|
|
|
Map data = Utils.objectToMap(apply);
|
|
|
- map.put("data", map);
|
|
|
+ map.put("data", data);
|
|
|
map.put("type", "notice");
|
|
|
+ System.out.println(data);
|
|
|
try {
|
|
|
this.sendMsg(ex, routerKey, map);
|
|
|
} catch (JsonProcessingException e) {
|