Package net.baguajie.domains

Examples of net.baguajie.domains.FollowShip


    }
    User target = userRepository.findOne(targetId);
    if(target==null){
      throw new RuntimeException("Invalid user id : " + targetId);
    }
    FollowShip fs = followShipRepository.getByTargetAndFollowed(targetId, signInUser.getId());
    boolean followed = false;
    if(fs!=null && fs.getStatus() == ApplicationConstants.FOLLOWSHIP_DISABLED){
      followed = true;
      fs.setStatus(ApplicationConstants.FOLLOWSHIP_NORMAL);
      fs.setUpdatedAt(new Date());
      userRepository.inc(signInUser.getId(), "followCount", 1);
      userRepository.inc(target.getId(), "fansCount", 1);
    }else if(fs==null){
      followed = true;
      fs = new FollowShip();
      fs.setCreatedAt(new Date());
      fs.setUpdatedAt(fs.getCreatedAt());
      fs.setTarget(target);
      fs.setFollowed(signInUser);
      fs.setStatus(ApplicationConstants.FOLLOWSHIP_NORMAL);
      userRepository.inc(signInUser.getId(), "followCount", 1);
      userRepository.inc(target.getId(), "fansCount", 1);
    }
    if(followed){
      followShipRepository.save(fs);
View Full Code Here


    }
    User target = userRepository.findOne(targetId);
    if(target==null){
      throw new RuntimeException("Invalid user id : " + targetId);
    }
    FollowShip fs = followShipRepository.getByTargetAndFollowed(targetId, signInUser.getId());
    if(fs!=null && fs.getStatus() == ApplicationConstants.FOLLOWSHIP_NORMAL){
      fs.setStatus(ApplicationConstants.FOLLOWSHIP_DISABLED);
      fs.setUpdatedAt(new Date());
      userRepository.inc(signInUser.getId(), "followCount", -1);
      userRepository.inc(target.getId(), "fansCount", -1);
      followShipRepository.save(fs);
    }
    return new AjaxResult(AjaxResultCode.SUCCESS);
View Full Code Here

TOP

Related Classes of net.baguajie.domains.FollowShip

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.