| | |
| | | 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;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | public class MsgAccountDetailFactory {
|
| | | public final static int TYPE_WX = 1;// 微信
|
| | | public final static int TYPE_TB = 2;// 淘宝
|
| | | public final static int TYPE_PHONE = 3;// 电话
|
| | |
|
| | | /**
|
| | | * 账号绑定成功
|
| | |
| | | * @return
|
| | | */
|
| | | public static MsgAccountDetail createBindingAccount(Long uid, int type) {
|
| | |
|
| | | return null;
|
| | | 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;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @return
|
| | | */
|
| | | public static MsgAccountDetail createUnBindingAccount(Long uid, int type) {
|
| | |
|
| | | return null;
|
| | | 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;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @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;
|
| | | }
|
| | |
|
| | | return null;
|
| | | /**
|
| | | * 账号打通
|
| | | * |
| | | * @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;
|
| | | }
|
| | |
|
| | | // 淘宝授权失败
|
| | | public static MsgAccountDetail createTaoBaoAuthFail(Long uid, String taoBaoNickName, String reason) {
|
| | | if (uid == null || reason == null)
|
| | | return null;
|
| | |
|
| | | JSONArray msg = new JSONArray();
|
| | | JSONObject item = new JSONObject();
|
| | | item.put("name", "账号");
|
| | | item.put("content", String.format("淘宝昵称[%s]", taoBaoNickName));
|
| | | msg.add(item);
|
| | |
|
| | | item = new JSONObject();
|
| | | item.put("name", "原因");
|
| | | item.put("content", reason);
|
| | | msg.add(item);
|
| | |
|
| | | MsgAccountDetail detail = new MsgAccountDetail();
|
| | | detail.setBeiZhu("无");
|
| | | detail.setContent(msg.toString());
|
| | | detail.setTitle("淘宝账号授权失败");
|
| | | detail.setType(MsgTypeAccountTypeEnum.taoBaoAuthFail);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | return detail;
|
| | | }
|
| | |
|
| | | }
|