@RequestMapping(value = "/tweet", method = RequestMethod.GET)
 public Tweet get(@RequestParam("uid") long uid, @RequestParam("tid") long tid) {
   Tweet tweet = tweetRepo.findOne(tid);
   tweet.setStar(
       userTweetRepo.findByUidAndTidAndUserTweetType(
               uid, tweet.getId(), UserTweet.UserTweetType.STAR)
           != null);
   TweetTweet tweetTweet =
       tweetTweetRepo.findByTidAndTweetTweetType(tweet.getId(), TweetTweet.TweetTweetType.REPEAT);
   if (tweetTweet != null) {
     Tweet originTweet = tweetRepo.findOne(tweetTweet.getTid2());
     originTweet.setStar(
         userTweetRepo.findByUidAndTidAndUserTweetType(
                 uid, originTweet.getId(), UserTweet.UserTweetType.STAR)
             != null);
     tweet.setOriginTweet(originTweet);
   }
   return tweet;
 }
  @RequestMapping(value = "/tweet/list", method = RequestMethod.GET)
  public List<Tweet> gets(
      @RequestParam("getsType") GetsType getsType,
      @RequestParam("uid") long uid,
      @RequestParam("keyword") String keyword,
      @RequestParam("pageIndex") int pageIndex,
      @RequestParam("pageSize") int pageSize) {
    PageRequest pageRequest = new PageRequest(pageIndex, pageSize, Sort.Direction.DESC, "date");
    Page<Tweet> tweets = null;
    if (getsType != GetsType.VIDEO) {
      List<Long> uids = new ArrayList<>();

      if (uid > 0 && (getsType == GetsType.HOME || getsType == GetsType.USER)) {
        uids.add(uid);
      }
      if (getsType != GetsType.USER) {
        List<User> users = new ArrayList<>();
        if (uid > 0) {
          users.addAll(
              userRepo.findAll(
                  userUserRepo.findUid2sByUidAndUserUserType(uid, UserUser.UserUserType.FOCUS)));
        } else {
          users.add(userRepo.findByName(Constants.SPECIAL_BREAK));
          users.add(userRepo.findByName(Constants.NEWS_YINGCHAO));
          users.add(userRepo.findByName(Constants.NEWS_XIJIA));
          users.add(userRepo.findByName(Constants.NEWS_DEJIA));
          users.add(userRepo.findByName(Constants.NEWS_YIJIA));
          users.add(userRepo.findByName(Constants.NEWS_FAJIA));
          users.add(userRepo.findByName(Constants.NEWS_ZHONGCHAO));
          users.add(userRepo.findByName(Constants.NEWS_OUGUAN));
          users.add(userRepo.findByName(Constants.NEWS_HUABIAN));
          users.add(userRepo.findByName(Constants.NEWS_VIDEO));
        }
        for (User user : users) {
          if (getsType == GetsType.HOME
              && (user.getUserType() == User.UserType.NORMAL
                  || user.getUserType() == User.UserType.SPECIAL)) {
            uids.add(user.getId());
          } else if (getsType == GetsType.TEAM && user.getUserType() == User.UserType.TEAM) {
            uids.add(user.getId());
          } else if (getsType == GetsType.NEWS && user.getUserType() == User.UserType.NEWS) {
            uids.add(user.getId());
          }
        }
      }

      if (getsType != GetsType.SEARCH) {
        if (uids.size() > 0) {
          List<Long> tids =
              userTweetRepo.findTidsByUidsAndUserTweetType(uids, UserTweet.UserTweetType.ADD);
          tweets = tweetRepo.findByIdIn(tids, pageRequest);
        }
      } else if (!StringUtils.isEmpty(keyword)) {
        keyword = "%" + keyword + "%";
        tweets =
            tweetRepo
                .findByNameLikeIgnoreCaseOrTitleLikeIgnoreCaseOrSourceLikeIgnoreCaseOrSummaryLikeIgnoreCase(
                    keyword, keyword, keyword, keyword, pageRequest);
      }
    } else {
      tweets = tweetRepo.findByTweetContentType(Tweet.TweetContentType.VIDEO, pageRequest);
    }

    if (tweets != null) {
      for (Tweet tweet : tweets) {
        tweet.setStar(
            userTweetRepo.findByUidAndTidAndUserTweetType(
                    uid, tweet.getId(), UserTweet.UserTweetType.STAR)
                != null);
        TweetTweet tweetTweet =
            tweetTweetRepo.findByTidAndTweetTweetType(
                tweet.getId(), TweetTweet.TweetTweetType.REPEAT);
        if (tweetTweet != null) {
          Tweet originTweet = tweetRepo.findOne(tweetTweet.getTid2());
          originTweet.setStar(
              userTweetRepo.findByUidAndTidAndUserTweetType(
                      uid, originTweet.getId(), UserTweet.UserTweetType.STAR)
                  != null);
          tweet.setOriginTweet(originTweet);
        }
      }
      return tweets.getContent();
    } else {
      return new ArrayList<>();
    }
  }