예제 #1
0
  /**
   * 查看专辑及级下节目的信息
   *
   * @param pagesize
   * @param page
   * @param id
   * @param acttype
   * @return
   */
  public Map<String, Object> getSeqInfo(int pagesize, int page, String id, String acttype) {
    List<Map<String, Object>> listaudio = new ArrayList<Map<String, Object>>();
    Map<String, Object> map = new HashMap<String, Object>();
    Map<String, Object> seqData = new HashMap<String, Object>(); // 存放专辑信息
    SeqMediaAsset sma = mediaService.getSmaInfoById(id);
    List<Map<String, Object>> catalist =
        mediaService.getResDictRefByResId("'" + sma.getId() + "'", "wt_SeqMediaAsset");
    List<Map<String, Object>> chlist =
        mediaService.getCHAByAssetId("'" + sma.getId() + "'", "wt_SeqMediaAsset");
    List<SeqMaRefPo> listseqmaref = mediaService.getSeqMaRefBySid(sma.getId());
    Map<String, Object> smap = sma.toHashMap();
    smap.put("count", listseqmaref.size());
    smap.put("smaPublishTime", chlist.get(0).get("pubTime"));
    seqData = ContentUtils.convert2Sma(smap, null, catalist, chlist, null);

    // 查询专辑和单体的联系
    List<String> listaudioid = new ArrayList<String>();

    for (SeqMaRefPo seqMaRefPo : listseqmaref) {
      listaudioid.add(seqMaRefPo.getMId());
    }

    // 查询单体信息
    for (String audid : listaudioid) {
      listaudio.add(getAudioInfo(audid, "wt_MediaAsset"));
    }

    if (listaudio.size() == 0) {
      map.put("audio", null);
    } else {
      map.put("audio", listaudio);
    }
    map.put("sequ", seqData);
    return map;
  }
예제 #2
0
  /**
   * 查询列表
   *
   * @param flowFlag
   * @param page
   * @param pagesize
   * @param catalogsid
   * @param source
   * @param beginpubtime
   * @param endpubtime
   * @param beginctime
   * @param endctime
   * @return
   */
  public Map<String, Object> getContent(
      int flowFlag,
      int page,
      int pagesize,
      String channelId,
      String publisherId,
      Timestamp beginpubtime,
      Timestamp endpubtime,
      Timestamp beginctime,
      Timestamp endctime) {
    Map<String, Object> mapall = new HashMap<String, Object>();
    Connection conn = null;
    PreparedStatement ps = null;
    ResultSet rs = null;
    List<Map<String, Object>> list2seq = new ArrayList<Map<String, Object>>();
    int numall = 0;
    String sql = "";

    Map<String, Object> m = new HashMap<String, Object>();
    m.put("channelId", channelId);
    m.put("publisherId", publisherId);
    m.put("beginPubtime", beginpubtime);
    m.put("endPubtime", endpubtime);
    m.put("begincTime", beginctime);
    m.put("endcTime", endctime);
    m.put("flowFlag", flowFlag);
    numall = mediaService.getCountInCha(m);

    m.clear();
    m.put("channelId", channelId);
    m.put("publisherId", publisherId);
    m.put("beginPubtime", beginpubtime);
    m.put("endPubtime", endpubtime);
    m.put("begincTime", beginctime);
    m.put("endcTime", endctime);
    m.put("flowFlag", flowFlag);
    m.put("beginNum", page * pagesize);
    m.put("size", pagesize);
    List<ChannelAssetPo> listchapo = mediaService.getContentsByFlowFlag(m);
    for (ChannelAssetPo channelAssetPo : listchapo) {
      Map<String, Object> oneData = new HashMap<String, Object>();
      oneData.put("Id", channelAssetPo.getId()); // 栏目ID修改排序功能时使用
      oneData.put("MediaType", channelAssetPo.getAssetType());
      oneData.put("ContentId", channelAssetPo.getAssetId()); // 内容ID获得详细信息时使用
      oneData.put("ContentImg", channelAssetPo.getPubImg());
      oneData.put("ContentCTime", channelAssetPo.getCTime());
      oneData.put("ContentPubTime", channelAssetPo.getPubTime());
      oneData.put("ContentSort", channelAssetPo.getSort());
      oneData.put("ContentFlowFlag", channelAssetPo.getFlowFlag());
      list2seq.add(oneData);
    }

    // 查询显示的节目名称,发布组织和描述信息
    for (Map<String, Object> map : list2seq) {
      if (map.get("MediaType").equals("wt_SeqMediaAsset")) {
        SeqMediaAsset sma = mediaService.getSmaInfoById(map.get("ContentId") + "");
        map.put("ContentName", sma.getSmaTitle());
        map.put("ContentSource", sma.getPublisher());
        map.put("ContentDesc", sma.getDescn());
      } else {
        if (map.get("MediaType").equals("wt_MediaAsset")) {
          MediaAsset ma = mediaService.getMaInfoById(map.get("ContentId") + "");
          map.put("ContentName", ma.getMaTitle());
          map.put("ContentSource", ma.getMaPublisher());
          map.put("ContentDesc", ma.getDescn());
        } else {
          if (map.get("MediaType").equals("wt_Broadcast")) {
            // 待更改
            sql = "select bcTitle,bcPublisher,descn from wt_Broadcast where id = ? limit 1";
            try {
              conn = DataSource.getConnection();
              ps = conn.prepareStatement(sql);
              ps.setString(1, (String) map.get("ContentId"));
              rs = ps.executeQuery();
              while (rs != null && rs.next()) {
                map.put("ContentName", rs.getString("bcTitle"));
                map.put("ContentSource", rs.getString("bcPublisher"));
                map.put("ContentDesc", rs.getString("descn"));
              }
            } catch (SQLException e) {
              e.printStackTrace();
            } finally {
              closeConnection(conn, ps, rs);
            }
          }
        }
      }
    }
    mapall.put("List", list2seq);
    mapall.put("Count", numall);
    return mapall;
  }