This commit is contained in:
van
2026-04-09 00:09:09 +08:00
parent c9876df3de
commit e94f17973c
50 changed files with 1637 additions and 72 deletions

View File

@@ -0,0 +1,41 @@
package com.ruoyi.jarvis.mq;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.jarvis.dto.GoofishNotifyMessage;
import com.ruoyi.jarvis.service.goofish.GoofishNotifyAsyncFacade;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 闲管家订单推送异步消费(需配置 rocketmq.name-server
*/
@Component
@ConditionalOnProperty(name = "rocketmq.name-server")
@RocketMQMessageListener(
nameServer = "${rocketmq.name-server}",
topic = "${jarvis.goofish-order.mq-topic:jarvis-goofish-erp-order}",
consumerGroup = "${jarvis.goofish-order.consumer-group:jarvis-goofish-order-consumer}"
)
public class GoofishOrderNotifyConsumer implements RocketMQListener<String> {
@Resource
private GoofishNotifyAsyncFacade goofishNotifyAsyncFacade;
@Override
public void onMessage(String message) {
GoofishNotifyMessage m = JSON.parseObject(message, GoofishNotifyMessage.class);
if (m == null || m.getAppid() == null) {
return;
}
JSONObject body = m.getBody() == null ? new JSONObject() : JSON.parseObject(m.getBody());
if (body == null) {
body = new JSONObject();
}
goofishNotifyAsyncFacade.afterNotify(m.getAppid(), body);
}
}