| | |
| | | package com.yeshi.fanli.util.factory.msg;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.msg.MsgInviteContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail.MsgTypeInviteTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | public class MsgInviteDetailFactory {
|
| | |
|
| | | /**
|
| | | * 邀请成功
|
| | | * |
| | | * @param threeSale
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail createInviteSuccess(ThreeSale threeSale, Long uid, String beiZhu) {
|
| | | if (threeSale == null || uid == null)
|
| | | return null;
|
| | |
|
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | if (StringUtil.isNullOrEmpty(beiZhu))
|
| | | detail.setBeiZhu("无");
|
| | | else
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setDesc("恭喜你,成功邀请一个粉丝");
|
| | | detail.setInviteUser(threeSale);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.invite);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | |
|
| | | return detail;
|
| | | }
|
| | | /**
|
| | | * 邀请成功
|
| | | * |
| | | * @param threeSale
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail createInviteSuccess2_1(Long uid, ThreeSale threeSale) {
|
| | | if (threeSale == null || uid == null)
|
| | | return null;
|
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setInviteUser(threeSale);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.inviteSucceed);
|
| | | detail.setDesc("粉丝(好友)熟练使用App可获得红包");
|
| | | detail.setBeiZhu("满足获得红包条件后系统将自动下发到“我的-红包”中");
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | | return detail;
|
| | | }
|
| | | |
| | | /**
|
| | | * 扫描邀请二维码成功,但是未登录
|
| | | * |
| | | * @param threeSale
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail createInviteScanSuccess(ThreeSale threeSale, Long uid, String beiZhu) {
|
| | | if (threeSale == null || uid == null)
|
| | | return null;
|
| | |
|
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | if (StringUtil.isNullOrEmpty(beiZhu))
|
| | | detail.setBeiZhu("无");
|
| | | else
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setDesc("恭喜你,有新粉丝加入你的队列,若对方60天内未激活将会与你脱离邀请关系");
|
| | | detail.setInviteUser(threeSale);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.invite);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 邀请失败
|
| | | * |
| | | * @param threeSale
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail createInviteFail(ThreeSale threeSale, Long uid, String beiZhu) {
|
| | | if (threeSale == null || uid == null)
|
| | | return null;
|
| | |
|
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | if (StringUtil.isNullOrEmpty(beiZhu))
|
| | | detail.setBeiZhu("无");
|
| | | else
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setDesc("抱歉,该粉丝因60天内未激活,已脱离了你的队列,可以试着重新邀请");
|
| | | detail.setInviteUser(threeSale);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.invite);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 领取信息激活邀请关系
|
| | | * |
| | | * @param threeSale
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail receiveGift(Long uid, String beiZhu, MsgInviteContentDTO content) {
|
| | | if (content == null || uid == null)
|
| | | return null;
|
| | |
|
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | if (StringUtil.isNullOrEmpty(beiZhu))
|
| | | detail.setBeiZhu("无");
|
| | | else
|
| | | detail.setBeiZhu(beiZhu);
|
| | | |
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setDesc(new Gson().toJson(content));
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.receiveGift);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | | }
|
| | | 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 org.yeshi.utils.TimeUtil; |
| | | import com.yeshi.common.vo.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; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 间接邀请 |
| | | * @param uid |
| | | * @param inviteName |
| | | * @param nickName |
| | | * @param portrait |
| | | * @param time |
| | | * @return |
| | | */ |
| | | public static MsgInviteDetail pullNewRedPack(Long uid, String nickName, String portrait) { |
| | | if (nickName == null || uid == null || portrait == 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("该粉丝完成了你的拉新奖励订单,拉新奖励红包会在该订单确认收货后的次月26日到账", 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.pullNewRedPack); |
| | | detail.setRead(false); |
| | | detail.setUser(new UserInfo(uid)); |
| | | detail.setExtraInfo(new Gson().toJson(listMsg)); |
| | | return detail; |
| | | } |
| | | |
| | | } |