Authored by unknown

增加用户注册,升降级场景

... ... @@ -98,4 +98,13 @@ public class SendScenes {
//换货商品未寄回
public static final String CHANGE_NOT_SEND_BACK = "CHANGE_NOT_SEND_BACK";
//用户升级/降级
public static final String USER_VIP_CHANGE = "USER_VIP_CHANGE";
//用户注册成功通知
public static final String USER_REGISTER_NOTICE = "USER_REGISTER_NOTICE";
//退款成功 补加小程序通知 因为同为优先级一,暂新增场景处理
public static final String REFUND_SUCCESS_MINI = "REFUND_SUCCESS_MINI";
}
... ...
/**
*
*/
package com.yoho.message.sdk.common.constants;
/**
* 描述:黑名单用户类型
*
*
*/
public enum UserVipLevelEnum {
NORMAL(0, "普通会员","7天退换货、极速发货"),
LEVEL_1(1, "银卡会员","7天退换货、极速发货、专享折扣、生日礼包、购物返币、升级礼包"),
LEVEL_2(3, "金卡会员","7天退换货、极速发货、专享折扣、生日礼包、购物返币、升级礼包、免邮服务"),
LEVEL_3(4, "白金卡会员","7天退换货、极速发货、专享折扣、生日礼包、购物返币、升级礼包、免邮服务、优享客服");
private int value;
private String name;
private String desc;
UserVipLevelEnum(int value, String name,String desc) {
this.value = value;
this.name = name;
this.desc = desc;
}
public static String getNameByValue(int value) {
for (UserVipLevelEnum e : values()) {
if (value == e.getValue()) {
return e.getName();
}
}
return null;
}
public static String getDescByValue(int value) {
for (UserVipLevelEnum e : values()) {
if (value == e.getValue()) {
return e.getDesc();
}
}
return null;
}
public int getValue() {
return value;
}
public String getName() {
return name;
}
public String getDesc() {
return desc;
}
}
... ...
... ... @@ -47,4 +47,22 @@ public interface ISendUserMessage {
// */
// SendMessageRspBo assistExpireProcess(String uid, String assistId);
/**
* 会员 升级/降级提醒
* @param uid
* @param oldVipLevel 原等级type
* @param currentVipLevel 更新后等级type
* @param expireTime 更新后等级到期时间戳
* @return
*/
SendMessageRspBo userVipChange(String uid,int oldVipLevel,int currentVipLevel,int expireTime);
/**
* 用户注册成功提醒
* @param uid
* @param nickName 昵称
* @param registerTime 注册时间戳
* @return
*/
SendMessageRspBo userRegisterNotice(String uid,String nickName,int registerTime);
}
... ...
package com.yoho.message.sdk.service.user.impl;
import com.yoho.message.sdk.common.constants.UserVipLevelEnum;
import com.yoho.message.sdk.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -53,5 +54,26 @@ public class SendUserMessageImpl extends AbstractSendMessage implements ISendUse
return new SendMessageRspBo(200, "SUCCESS");
}
@Override
public SendMessageRspBo userVipChange(String uid,int oldVipLevel,int currentVipLevel,int expireTime){
MessageCenterCommonEvent messageCenterCommonEvent = genMessageCenterCommonEvent(SendScenes.USER_VIP_CHANGE, String.valueOf(System.currentTimeMillis()), uid);
messageCenterCommonEvent.putInParams("oldVipLevel",UserVipLevelEnum.getNameByValue(oldVipLevel));
messageCenterCommonEvent.putInParams("currentVipLevel", UserVipLevelEnum.getNameByValue(currentVipLevel));
messageCenterCommonEvent.putInParams("expireDate", DateUtils.long2DateStr(expireTime * 1000l, "yyyy-MM-dd"));
messageCenterCommonEvent.putInParams("vipRights", UserVipLevelEnum.getDescByValue(currentVipLevel));
messageCenterMqHandler.sendMessageToMq(messageCenterCommonEvent);
return new SendMessageRspBo(200,"SUCCESS");
}
@Override
public SendMessageRspBo userRegisterNotice(String uid,String nickName,int registerTime){
MessageCenterCommonEvent messageCenterCommonEvent = genMessageCenterCommonEvent(SendScenes.USER_REGISTER_NOTICE, String.valueOf(System.currentTimeMillis()), uid);
messageCenterCommonEvent.putInParams("nickName", nickName);
messageCenterCommonEvent.putInParams("registerDate", DateUtils.long2DateStr(registerTime * 1000l, "yyyy-MM-dd"));
messageCenterMqHandler.sendMessageToMq(messageCenterCommonEvent);
return new SendMessageRspBo(200,"SUCCESS");
}
}
... ...
package com.yoho.message.sdk.test;
import com.yoho.message.sdk.service.promotion.ISendPromotionMessage;
import com.yoho.message.sdk.service.user.ISendUserMessage;
import org.junit.Test;
import org.junit.runner.RunWith;
... ... @@ -30,5 +29,13 @@ public class TestUserMessage {
}
@Test
public void userVipChange(){
sendPromotionMessage.userVipChange("500031566",0,1,1546272000);
}
@Test
public void userRegisterNotice(){
sendPromotionMessage.userRegisterNotice("500031566", "小溪", 1534842955);
}
}
... ...