UFOSendServiceImpl.java
3.15 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package com.yoho.message.sdk.service.ufo;
import com.yoho.message.sdk.common.constants.UFOScenes;
import com.yoho.message.sdk.common.handler.MessageCenterMqHandler;
import com.yoho.message.sdk.common.model.MessageCenterCommonEvent;
import com.yoho.message.sdk.common.model.SendMessageRspBo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
/**
* Created by min.ling on 2019/1/29.
*/
@Service
public class UFOSendServiceImpl implements IUFOSendService{
@Autowired
private MessageCenterMqHandler messageCenterMqHandler;
@Override
public SendMessageRspBo sendAdjustPrice(String uid,int productCount) {
MessageCenterCommonEvent messageCenterCommonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_PRICE_ADJUST,uid,0,uid);
messageCenterCommonEvent.putInParams("productCount", productCount);
messageCenterMqHandler.sendMessageToMq(messageCenterCommonEvent);
return new SendMessageRspBo(200, "SUCCESS");
}
public MessageCenterCommonEvent genMessageCenterCommonEvent(String sendScene, String sendSceneKey,int miniappType,String uid) {
List<String> uids = Collections.singletonList(uid);
return new MessageCenterCommonEvent(sendScene, sendSceneKey,miniappType, uids);
}
/**
* 更低出售价提醒 商家已入驻
* @param uid
* @param productName 商品名称
* @param size 尺寸
* @param goodsNumber 货号
* @param salePrice 提醒的更低售价
* @param productSkn 商品skn
* @return
*/
public SendMessageRspBo sendLessPriceEnter(String uid,String productName,String size,String goodsNumber,String salePrice,String productSkn){
MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_LESS_PRICE_ENTER,uid,0,uid);
commonEvent.putInParams("productName",productName);
commonEvent.putInParams("size",size);
commonEvent.putInParams("goodsNumber",goodsNumber);
commonEvent.putInParams("productSkn",productSkn);
commonEvent.putInParams("salePrice",salePrice);
messageCenterMqHandler.sendMessageToMq(commonEvent);
return new SendMessageRspBo(200, "SUCCESS");
}
/**
* 更低出售价提醒 商家未入驻
* @param uid
* @param productName 商品名称
* @param size 尺寸
* @param goodsNumber 货号
* @param salePrice 提醒的更低售价
* @param orderCode 订单编号
* @return
*/
public SendMessageRspBo sendLessPrice(String uid,String productName,String size,String goodsNumber,String salePrice,String orderCode){
MessageCenterCommonEvent commonEvent = genMessageCenterCommonEvent(UFOScenes.UFO_LESS_PRICE,uid,0,uid);
commonEvent.putInParams("productName",productName);
commonEvent.putInParams("size",size);
commonEvent.putInParams("goodsNumber",goodsNumber);
commonEvent.putInParams("orderCode",orderCode);
commonEvent.putInParams("salePrice",salePrice);
messageCenterMqHandler.sendMessageToMq(commonEvent);
return new SendMessageRspBo(200, "SUCCESS");
}
}