| | |
| | | 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.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;
|
| | | 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));
|
| | | 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(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));
|
| | | 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));
|
| | | |
| | | 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 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;
|
| | | }
|
| | | }
|