| | |
| | | package com.yeshi.fanli.util.factory.msg;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail.MsgTypeInviteTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVOFactory;
|
| | |
|
| | | public class MsgInviteDetailFactory {
|
| | |
|
| | | /**
|
| | | * 直接粉丝邀请提醒
|
| | | * @param uid
|
| | | * @param nickName
|
| | | * @param portrait
|
| | | * @param time
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail directInviteSuccess(Long uid, String nickName, String portrait, Date time) {
|
| | | if (nickName == null || uid == null || portrait == null || time == null)
|
| | | return null;
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("",ClientTextStyleVO.COLOR_CONTENT, portrait));
|
| | | contentList.add(new ClientTextStyleVO("&" + nickName, ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("粉丝信息", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("粉丝类别", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("直接粉丝", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("加入时间", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(TimeUtil.formatDate(time), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("无", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.inviteSucceed);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | | |
| | | /**
|
| | | * 间接邀请
|
| | | * @param uid
|
| | | * @param inviteName
|
| | | * @param nickName
|
| | | * @param portrait
|
| | | * @param time
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail indirectInviteSuccess(Long uid, String inviteName, String nickName, String portrait, Date time) {
|
| | | if (nickName == null || uid == null || portrait == null || time == null)
|
| | | return null;
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("",ClientTextStyleVO.COLOR_CONTENT, portrait));
|
| | | contentList.add(new ClientTextStyleVO("&" + nickName, ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("粉丝信息", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("粉丝类别", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("间接粉丝", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | List<ClientTextStyleVO> contentList2 = new ArrayList<>();
|
| | | contentList2.add(new ClientTextStyleVO("由直接粉丝", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO(inviteName,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO("邀请", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("邀请人", ClientTextStyleVO.COLOR_TITLE),contentList2));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("加入时间", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(TimeUtil.formatDate(time), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("无", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.inviteSucceed);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 粉丝升级
|
| | | * @param uid
|
| | | * @param rankName
|
| | | * @param nickName
|
| | | * @param item
|
| | | * @param time
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail fansUpgrade(Long uid, String rankName, String nickName, String item, Date time) {
|
| | | if (nickName == null || uid == null || item == null || time == null)
|
| | | return null;
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("恭喜你!你的直接粉丝:", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(nickName ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("已升级为", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(rankName, ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("升级说明", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("升级时间", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(TimeUtil.formatDate(time), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("升级方式", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(String.format("满足%s条件后完成的升级", item), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("如有疑问请联系人工客服", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.fansUpgrade);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | | |
| | | }
|