package com.matrix.system.shopXcx.mqTask;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.matrix.system.hive.dao.OnlinebookingDao;
|
import com.matrix.system.hive.dao.SysShopInfoDao;
|
import com.matrix.system.shopXcx.dao.ShopProductDao;
|
import com.matrix.system.shopXcx.dao.ShopWxtemplateMsgDao;
|
import com.matrix.system.shopXcx.mqTask.templateMsg.AppointmentSuccess;
|
import com.matrix.system.shopXcx.shopEnum.TemplateMsgType;
|
import com.rabbitmq.client.DeliverCallback;
|
import com.rabbitmq.client.Delivery;
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import java.io.IOException;
|
|
/**
|
* 发送预约成功提醒消息
|
*/
|
public class TemplateMsgTask implements DeliverCallback {
|
|
@Autowired
|
OnlinebookingDao onlinebookingDao;
|
@Autowired
|
SysShopInfoDao shopInfoDao;
|
@Autowired
|
ShopProductDao productDao;
|
|
@Autowired
|
ShopWxtemplateMsgDao wxtemplateMsgDao;
|
|
@Autowired
|
AppointmentSuccess appointmentSuccess;
|
|
|
@Override
|
public void handle(String consumerTag, Delivery message) throws IOException {
|
|
String msg = new String(message.getBody(), "UTF-8");
|
JSONObject object = JSONObject.parseObject(msg);
|
Integer templateMsgType = (Integer) object.get("templateMsgType");
|
String content = object.get("content") + "";
|
|
if (TemplateMsgType.APPOINTMENT_SUCCESS.getCode().equals(templateMsgType)) {
|
appointmentSuccess.sendTemplateMsg(content);
|
}
|
|
|
}
|
}
|