Authored by Amos_sdy

用户升级发短信场景接入

package com.yoho.message.sdk.common.constants;
public class SendScenes {
// 优质晒单送优惠券
public static final String ORDERRE_RECOMMENDED_IN_SHOW = "ORDERRE_RECOMMENDED_IN_SHOW";
// 首单送优惠券
public static final String FIRST_ORDER_GET_COUPON = "FIRST_ORDER_GET_COUPON";
// 退换货审核通过
public static final String EXCHANGE_GOODS_VERIFY_PASS = "EXCHANGE_GOODS_VERIFY_PASS";
// 退款预计到账时间通知
public static final String REFUND_EXPECT_REACH = "REFUND_EXPECT_REACH";
// 订单发货
public static final String ORDER_SEND_OUT = "ORDER_SEND_OUT";
// 用户升级
public static final String MEMBERSHIP_UPGRADE = "MEMBERSHIP_UPGRADE";
}
... ...
package com.yoho.message.sdk.service;
import java.util.Arrays;
import java.util.List;
import com.yoho.message.sdk.common.model.MessageCenterCommonEvent;
/**
*
* <Description> 通用类<br>
*
* @author amos.shan<br>
* @version 1.0<br>
* @taskId <br>
* @CreateDate 2016年12月22日 <br>
*/
public abstract class AbstractSendMessage {
public MessageCenterCommonEvent genMessageCenterCommonEvent(String sendScene, String sendSceneKey, String uid) {
List<String> uids = Arrays.asList(uid);
return new MessageCenterCommonEvent(sendScene, sendSceneKey, uids);
}
}
... ...
package com.yoho.message.sdk.service.order.impl;
import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -10,19 +7,15 @@ import com.yoho.message.sdk.common.constants.SendScenes;
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 com.yoho.message.sdk.service.AbstractSendMessage;
import com.yoho.message.sdk.service.order.ISendOrderMessage;
@Service
public class SendOrderMessageImpl implements ISendOrderMessage{
public class SendOrderMessageImpl extends AbstractSendMessage implements ISendOrderMessage {
@Autowired
private MessageCenterMqHandler messageCenterMqHandler;
private MessageCenterCommonEvent genMessageCenterCommonEvent(String sendScene,String sendSceneKey,String uid){
List<String> uids = Arrays.asList(uid);
return new MessageCenterCommonEvent(sendScene,sendSceneKey,uids);
}
@Override
public SendMessageRspBo orderRecommendedInShowGetCoupon(String uid, String orderCode) {
MessageCenterCommonEvent messageCenterCommonEvent = genMessageCenterCommonEvent(SendScenes.ORDERRE_RECOMMENDED_IN_SHOW,orderCode,uid);
... ...
package com.yoho.message.sdk.service.user;
import com.yoho.message.sdk.common.model.SendMessageRspBo;
/**
*
* <Description> 用户模块消息发送<br>
*
* @author amos.shan<br>
* @version 1.0<br>
* @taskId <br>
* @CreateDate 2016年12月22日 <br>
*/
public interface ISendUserMessage {
/**
*
* Description: 会员升级<br>
*
* @author amos.shan<br>
* @taskId <br>
* @param vipLevel
* @param vipDiscount
* @return <br>
*/
SendMessageRspBo membershipUpgrade(String vipLevel, String vipDiscount, String uid);
}
... ...
package com.yoho.message.sdk.service.user.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yoho.message.sdk.common.constants.SendScenes;
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 com.yoho.message.sdk.service.AbstractSendMessage;
import com.yoho.message.sdk.service.user.ISendUserMessage;
/**
*
* <Description> 用户模块发消息<br>
*
* @author amos.shan<br>
* @version 1.0<br>
* @taskId <br>
* @CreateDate 2016年12月22日 <br>
*/
@Service
public class SendUserMessageImpl extends AbstractSendMessage implements ISendUserMessage {
@Autowired
private MessageCenterMqHandler messageCenterMqHandler;
@Override
public SendMessageRspBo membershipUpgrade(String vipLevel, String vipDiscount, String uid) {
MessageCenterCommonEvent messageCenterCommonEvent = genMessageCenterCommonEvent(SendScenes.MEMBERSHIP_UPGRADE, String.valueOf(System.currentTimeMillis()), uid);
messageCenterCommonEvent.putInParams("vipLevel", vipLevel);
messageCenterCommonEvent.putInParams("vipDiscount", vipDiscount);
messageCenterMqHandler.sendMessageToMq(messageCenterCommonEvent);
return new SendMessageRspBo(200, "SUCCESS");
}
}
... ...