Exemplo n.º 1
0
  /**
   * 得到评分结果(Grid显示)
   *
   * @return
   */
  public String getResult4Grid() {
    List<?> list;
    GridDataEncoder encoder;
    if ("1".equals(aspect)) {
      list = service.findResult4Author(channelIds, startTime, endTime);
      encoder =
          new GridDataEncoder(list, CMSConstants.GRID_TEMPLATE_SCORE_COUNT, new ScoreGridParser());
    } else if ("3".equals(aspect)) {
      // 没有文章的栏目不展示
      list = service.getResult4Channel(startTime, endTime);
      encoder = new GridDataEncoder(list, CMSConstants.GRID_TEMPLATE_SCORE_CHANNEL);
    } else {
      if ("site".equals(mode)) {
        list = service.findScoreInfoBySelectedChannels(channelIds, startTime, endTime, author);
        encoder =
            new GridDataEncoder(
                new Object[] {list, "0.0"},
                CMSConstants.GRID_TEMPLATE_CHANNEL_ARTICLE_SCORE,
                new ArticleScoreGridParser());
      } else {
        Object[] objs = service.findScoreInfoByArticle(articleId);
        list = (List<?>) ((Object[]) objs)[0];
        encoder =
            new GridDataEncoder(
                objs, CMSConstants.GRID_TEMPLATE_ARTICLE_SCORE, new ArticleScoreGridParser());
      }
    }

    // 目前一律一页展示,不分页
    String info = getPageInfo(page, 10000, list.size());
    return print(new String[] {"ScoreCountList", "PageList"}, new Object[] {encoder, info});
  }
Exemplo n.º 2
0
  /**
   * 得到文章打分结果(图表显示)
   *
   * @return
   */
  public String getScoreResult() {
    List<?> list = null;
    if ("site".equals(mode)) { // 选定栏目
      list = service.findScoreInfoBySelectedChannels(channelIds, startTime, endTime, author);
    } else if ("article".equals(mode)) { // 单篇文章
      list = (List<?>) service.findScoreInfoByArticle(articleId)[0];
    }

    if ("1".equals(type)) {
      drawPie(list);
    } else if ("0".equals(type)) {
      drawBar(list);
    }
    return XML;
  }