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.MsgOtherDetail;
|
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
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 MsgOtherDetailFactory {
|
|
|
/**
|
* 免单券相关提醒
|
* @param uid
|
* @param name
|
* @param source
|
* @param num
|
* @param stateDesc
|
* @param startTime
|
* @param endTime
|
* @param days
|
* @return
|
*/
|
public static MsgOtherDetail freeCouponMsg(Long uid, String name, String source, int num, String stateDesc,
|
Date startTime, Date endTime) {
|
Integer days = null;
|
if (endTime != null) {
|
int cha = TimeUtil.getDayDifferenceCount(new Date(), endTime);
|
if (cha < 0)
|
days = 0;
|
else
|
days = cha + 1;
|
}
|
|
List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("类别", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO(name, ClientTextStyleVO.COLOR_CONTENT)));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("来源", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO(source, ClientTextStyleVO.COLOR_CONTENT)));
|
List<ClientTextStyleVO> contentList = new ArrayList<>();
|
contentList.add(new ClientTextStyleVO(num+"" ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
contentList.add(new ClientTextStyleVO("张", ClientTextStyleVO.COLOR_CONTENT));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("数量", ClientTextStyleVO.COLOR_TITLE),contentList));
|
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("状态", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO(stateDesc, ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT)));
|
|
if (days != null) {
|
List<ClientTextStyleVO> contentList2 = new ArrayList<>();
|
contentList2.add(new ClientTextStyleVO(TimeUtil.formatDateDot(startTime) + "-" + TimeUtil.formatDateDot(endTime) + "-于", ClientTextStyleVO.COLOR_CONTENT));
|
contentList2.add(new ClientTextStyleVO(days +"" ,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("\"首页-免单商品\"专题中的全部商品可免单购买", ClientTextStyleVO.COLOR_CONTENT)));
|
}
|
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO("无", ClientTextStyleVO.COLOR_CONTENT)));
|
|
MsgOtherDetail detail = new MsgOtherDetail();
|
detail.setCreateTime(new Date());
|
detail.setRead(false);
|
detail.setUser(new UserInfo(uid));
|
detail.setType(MsgTypeOtherTypeEnum.couponMianDan);
|
detail.setExtraInfo(new Gson().toJson(listMsg));
|
return detail;
|
}
|
|
|
|
/**
|
* 奖励券相关提醒
|
* @param uid
|
* @param name
|
* @param source
|
* @param num
|
* @param stateDesc
|
* @param startTime
|
* @param endTime
|
* @param days
|
* @return
|
*/
|
public static MsgOtherDetail rewardCouponMsg(Long uid, String source, int num, String stateDesc,
|
Date startTime, Date endTime) {
|
Integer days = null;
|
if (endTime != null) {
|
int cha = TimeUtil.getDayDifferenceCount(new Date(), endTime);
|
if (cha < 0)
|
days = 0;
|
else
|
days = cha + 1;
|
}
|
|
List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("来源", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO(source, ClientTextStyleVO.COLOR_CONTENT)));
|
|
List<ClientTextStyleVO> contentList = new ArrayList<>();
|
contentList.add(new ClientTextStyleVO(num+"" ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
contentList.add(new ClientTextStyleVO("张", ClientTextStyleVO.COLOR_CONTENT));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("数量", ClientTextStyleVO.COLOR_TITLE),contentList));
|
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("状态", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO(stateDesc, ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT)));
|
|
if (days != null) {
|
List<ClientTextStyleVO> contentList2 = new ArrayList<>();
|
contentList2.add(new ClientTextStyleVO(TimeUtil.formatDateDot(startTime) + "-" + TimeUtil.formatDateDot(endTime) + "-于", ClientTextStyleVO.COLOR_CONTENT));
|
contentList2.add(new ClientTextStyleVO(days +"" ,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("奖励券可在【\"我的-福利中心\"】赠送他人", ClientTextStyleVO.COLOR_CONTENT)));
|
}
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO("无", ClientTextStyleVO.COLOR_CONTENT)));
|
|
MsgOtherDetail detail = new MsgOtherDetail();
|
detail.setCreateTime(new Date());
|
detail.setRead(false);
|
detail.setUser(new UserInfo(uid));
|
detail.setType(MsgTypeOtherTypeEnum.couponReward);
|
detail.setExtraInfo(new Gson().toJson(listMsg));
|
return detail;
|
}
|
|
|
/**
|
* 系统赠送金币提醒
|
* @param uid
|
* @param num
|
* @param banlce
|
* @return
|
*/
|
public static MsgOtherDetail goldCoinSystemGiveMsg(Long uid, int num, int banlce) {
|
List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("类别", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO("系统赠送", ClientTextStyleVO.COLOR_CONTENT)));
|
List<ClientTextStyleVO> contentList = new ArrayList<>();
|
contentList.add(new ClientTextStyleVO(num+"" ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
contentList.add(new ClientTextStyleVO("枚", ClientTextStyleVO.COLOR_CONTENT));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("获得数量", ClientTextStyleVO.COLOR_TITLE),contentList));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("剩余总数", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO(banlce + "枚", ClientTextStyleVO.COLOR_CONTENT)));
|
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("系统赠送金币无需手动领取,已自动进入到金币账户中", ClientTextStyleVO.COLOR_CONTENT)));
|
|
MsgOtherDetail detail = new MsgOtherDetail();
|
detail.setCreateTime(new Date());
|
detail.setRead(false);
|
detail.setUser(new UserInfo(uid));
|
detail.setType(MsgTypeOtherTypeEnum.goldCoin);
|
detail.setExtraInfo(new Gson().toJson(listMsg));
|
return detail;
|
}
|
|
/**
|
* 金币奖励提醒- 邀请成功
|
* @param uid
|
* @param num
|
* @param banlce
|
* @param directFans
|
* @return
|
*/
|
public static MsgOtherDetail goldCoinRewardInviteSucceedMsg(Long uid, int num, int banlce, boolean directFans) {
|
List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
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("成功邀请" + (directFans?"直接粉丝":"间接粉丝"), ClientTextStyleVO.COLOR_CONTENT)));
|
List<ClientTextStyleVO> contentList = new ArrayList<>();
|
contentList.add(new ClientTextStyleVO(num+"" ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
contentList.add(new ClientTextStyleVO("枚", ClientTextStyleVO.COLOR_CONTENT));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("获得数量", ClientTextStyleVO.COLOR_TITLE),contentList));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("剩余总数", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO(banlce + "枚", ClientTextStyleVO.COLOR_CONTENT)));
|
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("系统赠送金币无需手动领取,已自动进入到金币账户中", ClientTextStyleVO.COLOR_CONTENT)));
|
|
MsgOtherDetail detail = new MsgOtherDetail();
|
detail.setCreateTime(new Date());
|
detail.setRead(false);
|
detail.setUser(new UserInfo(uid));
|
detail.setType(MsgTypeOtherTypeEnum.goldCoin);
|
detail.setExtraInfo(new Gson().toJson(listMsg));
|
return detail;
|
}
|
|
|
/**
|
* 金币奖励提醒 - 订单团队收益不足0.01元不足0.01元
|
* @param uid
|
* @param num
|
* @param banlce
|
* @param directFans
|
* @return
|
*/
|
public static MsgOtherDetail goldCoinOrderSubsidyMsg(Long uid, int num, int banlce, boolean directFans) {
|
List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
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((directFans?"直接粉丝":"间接粉丝") +"下单产生的团队收益不足0.01元", ClientTextStyleVO.COLOR_CONTENT)));
|
List<ClientTextStyleVO> contentList = new ArrayList<>();
|
contentList.add(new ClientTextStyleVO(num+"" ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
contentList.add(new ClientTextStyleVO("枚", ClientTextStyleVO.COLOR_CONTENT));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("获得数量", ClientTextStyleVO.COLOR_TITLE),contentList));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("剩余总数", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO(banlce + "枚", ClientTextStyleVO.COLOR_CONTENT)));
|
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("系统赠送金币无需手动领取,已自动进入到金币账户中", ClientTextStyleVO.COLOR_CONTENT)));
|
|
MsgOtherDetail detail = new MsgOtherDetail();
|
detail.setCreateTime(new Date());
|
detail.setRead(false);
|
detail.setUser(new UserInfo(uid));
|
detail.setType(MsgTypeOtherTypeEnum.goldCoin);
|
detail.setExtraInfo(new Gson().toJson(listMsg));
|
return detail;
|
}
|
|
|
/**
|
* 金币兑换提醒
|
* @param uid
|
* @param num
|
* @param banlce
|
* @param directFans
|
* @return
|
*/
|
public static MsgOtherDetail goldCoinExChangeMsg(Long uid, int num, int banlce, String name, String exNum) {
|
List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("类别", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO("金币兑换", ClientTextStyleVO.COLOR_CONTENT)));
|
List<ClientTextStyleVO> contentList = new ArrayList<>();
|
contentList.add(new ClientTextStyleVO(num+"" ,ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
contentList.add(new ClientTextStyleVO("枚", ClientTextStyleVO.COLOR_CONTENT));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("消耗数量", ClientTextStyleVO.COLOR_TITLE),contentList));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("剩余总数", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO(banlce + "枚", ClientTextStyleVO.COLOR_CONTENT)));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("兑换物品", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO(String.format("礼品:%s 数量:%s",name, exNum), ClientTextStyleVO.COLOR_CONTENT)));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO("无", ClientTextStyleVO.COLOR_CONTENT)));
|
|
MsgOtherDetail detail = new MsgOtherDetail();
|
detail.setCreateTime(new Date());
|
detail.setRead(false);
|
detail.setUser(new UserInfo(uid));
|
detail.setType(MsgTypeOtherTypeEnum.goldCoin);
|
detail.setExtraInfo(new Gson().toJson(listMsg));
|
return detail;
|
}
|
|
|
/**
|
* 云发单相关信息
|
* @param uid
|
* @param category
|
* @param item
|
* @param desc
|
* @return
|
*/
|
public static MsgOtherDetail cloudMsg(Long uid, String category, String item, String desc) {
|
List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("类别", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO(category, ClientTextStyleVO.COLOR_CONTENT)));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("事项", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO(item, ClientTextStyleVO.COLOR_CONTENT)));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("说明", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO(desc, ClientTextStyleVO.COLOR_CONTENT)));
|
listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
new ClientTextStyleVO("无", ClientTextStyleVO.COLOR_CONTENT)));
|
|
MsgOtherDetail detail = new MsgOtherDetail();
|
detail.setCreateTime(new Date());
|
detail.setRead(false);
|
detail.setUser(new UserInfo(uid));
|
detail.setType(MsgTypeOtherTypeEnum.cloudWX);
|
detail.setExtraInfo(new Gson().toJson(listMsg));
|
return detail;
|
}
|
|
}
|