package com.yeshi.fanli.util.factory.msg;
|
|
import java.util.Date;
|
|
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
|
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
|
import com.yeshi.fanli.entity.bus.user.UserInfo;
|
import com.yeshi.fanli.util.StringUtil;
|
|
public class MsgAccountDetailFactory {
|
public final static int TYPE_WX = 1;// 微信
|
public final static int TYPE_TB = 2;// 淘宝
|
public final static int TYPE_PHONE = 3;// 电话
|
|
/**
|
* 账号绑定成功
|
*
|
* @param uid
|
* @param type
|
* @return
|
*/
|
public static MsgAccountDetail createBindingAccount(Long uid, int type) {
|
String msg = "";
|
if (type == TYPE_PHONE) {
|
msg = "<highlight>恭喜你手机号绑定成功</highlight>";
|
} else if (type == TYPE_TB) {
|
msg = "<highlight>恭喜你淘宝绑定成功</highlight>";
|
} else if (type == TYPE_WX) {
|
msg = "<highlight>恭喜你微信绑定成功</highlight>";
|
}
|
if (StringUtil.isNullOrEmpty(msg))
|
return null;
|
MsgAccountDetail detail = new MsgAccountDetail();
|
detail.setBeiZhu("无");
|
detail.setContent(msg);
|
detail.setTitle("绑定账号");
|
detail.setType(MsgTypeAccountTypeEnum.bingding);
|
detail.setUser(new UserInfo(uid));
|
detail.setCreateTime(new Date());
|
detail.setRead(false);
|
return detail;
|
}
|
|
/**
|
* 账号解绑成功
|
*
|
* @param uid
|
* @param type
|
* @return
|
*/
|
public static MsgAccountDetail createUnBindingAccount(Long uid, int type) {
|
String msg = "";
|
if (type == TYPE_PHONE) {
|
msg = "<highlight>手机号解绑成功</highlight>";
|
} else if (type == TYPE_TB) {
|
msg = "<highlight>淘宝解绑成功</highlight>";
|
} else if (type == TYPE_WX) {
|
msg = "<highlight>微信解绑成功</highlight>";
|
}
|
if (StringUtil.isNullOrEmpty(msg))
|
return null;
|
MsgAccountDetail detail = new MsgAccountDetail();
|
detail.setBeiZhu("无");
|
detail.setContent(msg);
|
detail.setTitle("解绑账号");
|
detail.setType(MsgTypeAccountTypeEnum.cancelBinding);
|
detail.setUser(new UserInfo(uid));
|
detail.setCreateTime(new Date());
|
detail.setRead(false);
|
return detail;
|
}
|
|
/**
|
* 账号更换成功
|
*
|
* @param uid
|
* @param type
|
* @return
|
*/
|
public static MsgAccountDetail createChangeBindingAccount(Long uid, int type) {
|
String msg = "";
|
if (type == TYPE_PHONE) {
|
msg = "<highlight>手机号更换绑定成功</highlight>";
|
} else if (type == TYPE_TB) {
|
msg = "<highlight>淘宝更换绑定成功</highlight>";
|
} else if (type == TYPE_WX) {
|
msg = "<highlight>微信更换绑定成功</highlight>";
|
}
|
if (StringUtil.isNullOrEmpty(msg))
|
return null;
|
MsgAccountDetail detail = new MsgAccountDetail();
|
detail.setBeiZhu("无");
|
detail.setContent(msg);
|
detail.setTitle("更换绑定账号");
|
detail.setType(MsgTypeAccountTypeEnum.bingdingChange);
|
detail.setUser(new UserInfo(uid));
|
detail.setCreateTime(new Date());
|
detail.setRead(false);
|
return detail;
|
}
|
|
/**
|
* 账号打通
|
*
|
* @param mainUid
|
* @param lessUid
|
* @return
|
*/
|
public static MsgAccountDetail createConnectAccount(Long mainUid, Long lessUid) {
|
if (mainUid == null || lessUid == null)
|
return null;
|
String msg = String.format("恭喜你账号合并成功,由“<highlight>%s</highlight>”合并到“<highlight>%s</highlight>”", lessUid + "",
|
mainUid + "");
|
MsgAccountDetail detail = new MsgAccountDetail();
|
detail.setBeiZhu("无");
|
detail.setContent(msg);
|
detail.setTitle("账号合并");
|
detail.setType(MsgTypeAccountTypeEnum.connect);
|
detail.setUser(new UserInfo(mainUid));
|
detail.setCreateTime(new Date());
|
detail.setRead(false);
|
return detail;
|
}
|
|
// 账号等级
|
public static MsgAccountDetail createUserRank(Long uid, String orderType, int orderCount, String rankName) {
|
if (uid == null || rankName == null)
|
return null;
|
|
String msg = String.format(
|
"恭喜你,上月<highlight>%s</highlight>订单达到<highlight>%s</highlight>单,已为你升级为<highlight>%s</highlight>用户,将会获得对应的福利和特权。",
|
orderType, orderCount + "", rankName);
|
MsgAccountDetail detail = new MsgAccountDetail();
|
detail.setBeiZhu("无");
|
detail.setContent(msg);
|
detail.setTitle("账号等级");
|
detail.setType(MsgTypeAccountTypeEnum.level);
|
detail.setUser(new UserInfo(uid));
|
detail.setCreateTime(new Date());
|
detail.setRead(false);
|
return detail;
|
}
|
|
}
|