Пример #1
0
 @Override
 public String work() {
   Long fromGroup = this.getFromUserGroup();
   for (String url : urlList) {
     Content content = contentService.parseUrl(url);
     if (content == null) {
       logger.error("illegal url:" + url);
       continue;
     }
     List<Long> existRobotIds = robotContentService.findRelatedRobotId(content.getId(), null);
     Iterator<User> robots =
         userGroupFacadeService.queryLimitedRandomGrouppedUser(
             fromGroup, random.get(), existRobotIds);
     while (robots.hasNext()) {
       User robot = robots.next();
       Boolean needForwardFlag = needForward.get();
       robotContentService.save(robot.getId(), content.getId(), RobotContent.TYPE_REPLY);
       if (needForwardFlag == true) {
         robotContentService.save(robot.getId(), content.getId(), RobotContent.TYPE_FORWARD);
       }
       ReplyDto dto =
           new ReplyDto(robot.getId(), content.getId(), replyWords.get(), needForwardFlag);
       replyWeibo.send(dto);
     }
   }
   return null;
 }
 @Override
 protected void afterRemove(User user) {
   super.afterRemove(user);
   doWeiboAppeal.send(user.getId());
 }