| | |
| | | import java.util.List;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.msg.MsgInviteContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherRewardIntegralDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail.MsgTypeInviteTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
|
| | |
| | | * @return
|
| | | */
|
| | | public static UserMsgVO create(MsgInviteDetail msg) {
|
| | | MsgTypeInviteTypeEnum msgType = msg.getMsgType();
|
| | | if (msgType != null && msgType == MsgTypeInviteTypeEnum.receiveGift) {
|
| | | if (StringUtil.isNullOrEmpty(msg.getDesc()))
|
| | | return null;
|
| | | |
| | | MsgInviteContentDTO dto = new Gson().fromJson(msg.getDesc(), MsgInviteContentDTO.class);
|
| | | if (dto == null)
|
| | | return null;
|
| | | |
| | | List<CommonMsgItemVO> items = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(dto.getState())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getState() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
|
| | | }
|
| | | |
| | | |
| | | if (!StringUtil.isNullOrEmpty(dto.getCode())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getCode() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请码", COLOR_TITLE), contentList));
|
| | | }
|
| | | |
| | | |
| | | if (!StringUtil.isNullOrEmpty(dto.getInviter())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getInviter() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请人", COLOR_TITLE), contentList));
|
| | | }
|
| | | |
| | | |
| | | if (!StringUtil.isNullOrEmpty(dto.getMode())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getMode() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("激活方式", COLOR_TITLE), contentList));
|
| | | }
|
| | | |
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | |
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite.png", dto.getTitle(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | } |
| | | |
| | | if (msg.getInviteUser() == null || msg.getInviteUser().getWorker() == null)
|
| | | return null;
|
| | | |
| | | List<CommonMsgItemVO> items = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | LogHelper.test("邀请消息:" + new Gson().toJson(msg));
|
| | |
| | | if (dto.getLeftDay() != null) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getLeftDay() + "", COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("天", COLOR_CONTENT));
|
| | | |
| | | if (msg.getType() == MsgTypeOtherTypeEnum.couponReward) {
|
| | | contentList.add(new ClientTextStyleVO("天(未使用将会过期)", COLOR_CONTENT));
|
| | | } else if (msg.getType() == MsgTypeOtherTypeEnum.couponMianDan) {
|
| | | contentList.add(new ClientTextStyleVO("天(未使用将会过期)", COLOR_CONTENT));
|
| | | } else {
|
| | | contentList.add(new ClientTextStyleVO("天", COLOR_CONTENT));
|
| | | }
|
| | | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("剩余天数", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | |
| | | contentList.add(new ClientTextStyleVO(dto.getReceiveTime() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("领取时间", COLOR_TITLE), contentList));
|
| | | }
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(dto.getReturnTime())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getReturnTime() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("退回时间", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | |
| | | if (dto == null)
|
| | | return null;
|
| | |
|
| | | icon = "http://img.flqapp.com/resource/msg/icon_msg_other_tlj.png";
|
| | | icon = "http://img.flqapp.com/resource/msg/icon_msg_other_integral.png";
|
| | |
|
| | |
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getState(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
|
| | |
| | | if (!StringUtil.isNullOrEmpty(dto.getTotalGold())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getTotalGold() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("金币总数", COLOR_TITLE), contentList));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("剩余", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getThing())) {
|
| | |
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | | } else if (msg.getType() == MsgTypeOtherTypeEnum.couponActivate) {
|
| | | if (StringUtil.isNullOrEmpty(msg.getContent()))
|
| | | return null;
|
| | |
|
| | | MsgOtherCouponActivateDTO dto = new Gson().fromJson(msg.getContent(), MsgOtherCouponActivateDTO.class);
|
| | | if (dto == null)
|
| | | return null;
|
| | |
|
| | | icon = "http://img.flqapp.com/resource/msg/icon_msg_other_coupon.png";
|
| | | |
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getType(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("类别", COLOR_TITLE), contentList));
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getExplain())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getExplain() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("说明", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getGiveUser())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getGiveUser() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("赠送人", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getReceiveTime())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getReceiveTime() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("获赠时间", COLOR_TITLE), contentList));
|
| | | }
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(dto.getValidityTime())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getValidityTime() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("有效期", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | | |
| | | UserMsgVO userMsgVO = new UserMsgVO();
|
| | | userMsgVO.setIcon(icon);
|
| | | userMsgVO.setTitle(dto.getTitle());
|
| | | userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
|
| | | userMsgVO.setContentItems(items);
|
| | | return userMsgVO;
|
| | | } else if (msg.getType() == MsgTypeOtherTypeEnum.firstOrderReward) {
|
| | | if (StringUtil.isNullOrEmpty(msg.getContent()))
|
| | | return null;
|
| | |
|
| | | MsgOtherRewardIntegralDTO dto = new Gson().fromJson(msg.getContent(), MsgOtherRewardIntegralDTO.class);
|
| | | if (dto == null)
|
| | | return null;
|
| | |
|
| | | icon = "http://img.flqapp.com/resource/msg/icon_msg_other_integral.png";
|
| | | |
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(dto.getSource())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getSource() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("来源", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getNum())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getNum() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("数量", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(dto.getTotal())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getTotal() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("剩余", COLOR_TITLE), contentList));
|
| | | }
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(dto.getExplain())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getExplain() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("说明", COLOR_TITLE), contentList));
|
| | | }
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | | |
| | | UserMsgVO userMsgVO = new UserMsgVO();
|
| | | userMsgVO.setIcon(icon);
|
| | | userMsgVO.setTitle(dto.getTitle());
|
| | | userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
|
| | | userMsgVO.setContentItems(items);
|
| | | return userMsgVO;
|
| | | }
|
| | |
|
| | |
|
| | | return new UserMsgVO(icon, msg.getType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | }
|