package com.zhujizheng.IHome.everymoment.vo; import com.github.binarywang.java.emoji.EmojiConverter; import com.sun.org.apache.xpath.internal.operations.Bool; import com.vdurmont.emoji.EmojiParser; import com.zhujizheng.IHome.generator.dao.PYEveryMoment; import com.zhujizheng.IHome.generator.dao.PYEveryMomentComment; import com.zhujizheng.IHome.generator.dao.PYUserInfo; import com.zhujizheng.IHome.generator.mapper.PYUserInfoMapper; import lombok.Data; /** * Created with IntelliJ IDEA *

* Author: yons * Date: 2019/03/29 * Time: 01:23 * Description: * Copyright © 2019年 com.zhujizheng. All rights reserved. */ @Data public class PYEveryMomentCommentVO { private Integer commentId; private Integer emId; private Integer fromUserId; private String fromUserName; private Integer toUserId; private String toUserName; private String comment; private Long commentTime; private Boolean needDecode; public static PYEveryMomentCommentVO createCommentVO(PYEveryMomentComment comment, PYUserInfoMapper userInfoMapper) { System.out.println("comment" + comment + ", userInfoMapper = " + userInfoMapper); if (comment == null || userInfoMapper == null) { return null; } PYEveryMomentCommentVO commentVO = new PYEveryMomentCommentVO(); commentVO.setEmId(comment.getEmId()); commentVO.setCommentId(comment.getId()); String commentUnicode = EmojiConverter.getInstance().toUnicode(comment.getComment()); commentVO.setComment(commentUnicode); commentVO.setFromUserId(comment.getFromUserId()); commentVO.setToUserId(comment.getToUserId()); commentVO.setCommentTime(comment.getCommentTime()); commentVO.setNeedDecode(comment.getNeedDecode()); PYUserInfo fromUserInfo = userInfoMapper.selectUserInfoByUserId(comment.getFromUserId()); System.out.println("fromUserInfo = " + fromUserInfo); if (fromUserInfo == null) { return null; } String fromUserName = EmojiConverter.getInstance().toUnicode(fromUserInfo.getUserName()); commentVO.setFromUserName(fromUserName); if (comment.getToUserId() != -1) { PYUserInfo toUserInfo = userInfoMapper.selectUserInfoByUserId(comment.getToUserId()); System.out.println("toUserInfo = " + toUserInfo); if (toUserInfo == null) { return null; } String toUserName = EmojiConverter.getInstance().toUnicode(toUserInfo.getUserName()); commentVO.setToUserName(toUserName); } System.out.println("commentVO = " + commentVO); return commentVO; } }