Пример #1
0
  /** 获取一周回看分类节目列表 */
  @SuppressWarnings({"unchecked", "rawtypes"})
  public void getBTVPrograms() {
    try {
      Assert.notNull(typeId, "分类id不能为空!");
      Map params = new HashMap();
      params.put("typeId", typeId);
      params.put("pageSize", String.valueOf(getPager().getMax()));
      params.put("curPage", String.valueOf(getPager().getPage()));

      String response = HttpUtils.sendPost(BTV_PROGRAMS_URL, params, "utf-8");
      JSONObject jo = JSON.parseObject(response);
      if (null != jo) {
        String ret = jo.getString("ret");
        if (StringUtils.equals("0", ret)) {
          String programList = jo.getString("result");
          List<Map> rows = null;
          if (StringUtils.isNotBlank(programList)) {
            rows = JSON.parseArray(programList, Map.class);
          }
          if (null == rows) {
            rows = new ArrayList<Map>();
          }
          resultMap.put("total", jo.get("totalCount"));
          resultMap.put("rows", rows);
          jsonMap();
        }
      }
    } catch (Exception e) {
      logger.error("调用接口getBTVPrograms失败", e);
      jsonRet("1", e.getMessage());
    }
  }
Пример #2
0
 /** 获取回看节目详情 */
 public void getProgramDetail() {
   try {
     Assert.notNull(programId, "节目id不能为空!");
     String url = PROGRAM_DETAIL_URL + "?programId=" + programId;
     String response = HttpUtils.sendGet(url, "utf-8");
     JSONObject jo = JSON.parseObject(response);
     if (null != jo) {
       String ret = jo.getString("ret");
       if (StringUtils.equals("0", ret)) {
         String result = jo.getString("result");
         this.getTestJSON(result);
       }
     }
   } catch (Exception e) {
     logger.error("调用接口getProgramDetail失败", e);
     jsonRet("1", e.getMessage());
   }
 }
Пример #3
0
 /** 获取节目分类列表 */
 @SuppressWarnings("rawtypes")
 public void getProgramTypeList() {
   try {
     String response = HttpUtils.sendGet(PROGRAM_TYPE_LIST_URL, "utf-8");
     JSONObject jo = JSON.parseObject(response);
     if (null != jo) {
       String ret = jo.getString("ret");
       if (StringUtils.equals("0", ret)) {
         String typeList = jo.getString("result");
         if (StringUtils.isNotBlank(typeList)) {
           List<Map> list = JSON.parseArray(typeList, Map.class);
           resultMap.put("rows", list);
         }
         jsonMap();
       }
     }
   } catch (Exception e) {
     logger.error("调用接口getProgramTypeList失败", e);
     jsonRet("1", e.getMessage());
   }
 }