jyy
2021-01-09 30f2f276ca35cae2bde763c58719f05c572f415b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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);
        }
 
 
    }
}