Пример #1
0
  /** 缓存所有应用包括已经上线和已经下线的产品* */
  @SuppressWarnings("unchecked")
  private void cacheAllApps(
      String baseDir,
      List<Map<String, String>> onLinesingleApp,
      List<Map<String, String>> onLinemutiApp,
      List<Map<String, String>> adverLs) {
    List<Map<String, String>> appList = new ArrayList<Map<String, String>>();
    if (onLinesingleApp != null) appList.addAll(onLinesingleApp);
    if (onLinemutiApp != null) appList.addAll(onLinemutiApp);

    // 取得已经下线的单独应用
    String singlestr = getOffSingleApp();
    // 取得已经下线的组合应用
    String mutistr = getOffMutiApp();

    Map<String, Object> singleMp = JsonUtil.convertJson2Object(singlestr, Map.class);
    List<Map<String, String>> singleLs = (List<Map<String, String>>) singleMp.get("rows");
    Map<String, Object> mutiMp = JsonUtil.convertJson2Object(mutistr, Map.class);
    List<Map<String, String>> mutiLs = (List<Map<String, String>>) mutiMp.get("rows");

    if (singleLs != null) appList.addAll(singleLs);
    if (mutiLs != null) appList.addAll(mutiLs);

    if (appList.size() > 0) SpringContextHelper.instance.getOscache().put(CMS_APPS_CACHE, appList);

    List<String> picUrls = calculatePics(adverLs, appList);
    downLoadPic.downloadPicFromCms(baseDir, picUrls);
  }
Пример #2
0
  @SuppressWarnings("unchecked")
  public String getHomeExpress() {
    String rtnJson = getHomeExpressOriginal();
    List<Map<String, String>> datas = JsonUtil.convertJson2Object(rtnJson, List.class);

    return convert(datas, "getHomeExpress");
  }
Пример #3
0
  @SuppressWarnings("unchecked")
  public String getHomeAdvertising() {
    String rtnJson = getHomeAdvertisingOriginal();
    List<Map<String, String>> datas = JsonUtil.convertJson2Object(rtnJson, List.class);

    calculationPicHref(datas, DownLoadPic.APP_ADVERPIC);

    return convert(datas, "getHomeAdvertising");
  }
Пример #4
0
  @SuppressWarnings("unchecked")
  private String getNodeByID(String nodeId, String converter) {
    String contactJson = getNodeById(nodeId, converter);
    List<Map<String, String>> datas = new ArrayList<Map<String, String>>();
    Map<String, String> data = JsonUtil.convertJson2Object(contactJson, Map.class);
    datas.add(data);

    return convert(datas, converter);
  }
Пример #5
0
  /** 取得应用详细信息 */
  @SuppressWarnings("unchecked")
  public Map<String, Object> getAppDetailMp(String nodeUid) {
    String appDetail = getAppDetail(nodeUid);

    Map<String, Object> appDetailMp = JsonUtil.convertJson2Object(appDetail, Map.class);
    List<Map<String, String>> appDetailLs = (List<Map<String, String>>) appDetailMp.get("rows");

    Map<String, Object> rtnMap = new HashMap<String, Object>();
    if (appDetailLs != null && appDetailLs.size() > 0) {
      Map<String, String> appinfos = appDetailLs.get(0);

      // 应用本身相关信息
      rtnMap.putAll(appinfos);

      // 联系方式
      String contactNodeId = appinfos.get("contact");
      String contactJson = getNodeByID(contactNodeId, "contact");
      Map<String, Object> contactMp = JsonUtil.convertJson2Object(contactJson, Map.class);
      List<Map<String, String>> contactLs = (List<Map<String, String>>) contactMp.get("rows");
      if (contactLs != null && contactLs.size() > 0) {
        rtnMap.put("contact", contactLs.get(0));
      }

      // 推荐组合
      List<Map<String, String>> cpackages = new ArrayList<Map<String, String>>();
      String recmdpckgNodeId = appinfos.get("recmdpckg");
      if (!StringUtil.isEmpty(recmdpckgNodeId)) {
        String[] appIds = recmdpckgNodeId.split(",");
        for (int i = 0; i < appIds.length; i++) {
          String recmdpckgJson = getNodeByID(appIds[i], "recmdpckg");
          Map<String, Object> recmdpckgMp = JsonUtil.convertJson2Object(recmdpckgJson, Map.class);
          List<Map<String, String>> recmdpckgLs =
              (List<Map<String, String>>) recmdpckgMp.get("rows");
          calculationPicHref(recmdpckgLs, "appPic");
          if (recmdpckgLs != null && recmdpckgLs.size() > 0) {
            cpackages.add(recmdpckgLs.get(0));
          }
        }
      }
      rtnMap.put("cpackage", cpackages);
    }

    return rtnMap;
  }
Пример #6
0
 @SuppressWarnings("unchecked")
 public String getMutiApp() {
   String rtnJson = getMutiAppOriginal();
   List<Map<String, String>> datas = JsonUtil.convertJson2Object(rtnJson, List.class);
   calculationPicHref(datas, DownLoadPic.APP_APPPIC);
   calculationPicHref(datas, DownLoadPic.APP_APPMXPIC);
   calculationPicHref(datas, DownLoadPic.APP_APPDESCPIC);
   calculationPicHref(datas, DownLoadPic.APP_PRICETABLE);
   return convert(datas, "getMutiApp");
 }
Пример #7
0
  @SuppressWarnings("unchecked")
  public String getNodeBinaryByUid(String nodeUid) {
    String rtnJson = getNodeBinaryOriginalByUid(nodeUid);

    Map<String, String> data = JsonUtil.convertJson2Object(rtnJson, Map.class);
    List<Map<String, String>> datas = new ArrayList<Map<String, String>>();
    datas.add(data);

    return convert(datas, "getAppDetail");
  }
Пример #8
0
  /**
   * * 根据AppID取得帮助信息
   *
   * @param appId
   * @return
   */
  @SuppressWarnings("unchecked")
  public Map<String, String> getContactByAppId(String appId) {
    Map<String, String> app = getAppInfo("appID", appId);
    String contactNodeId = app.get("contact");

    String contactJson = getNodeByID(contactNodeId, "contact");
    Map<String, Object> contactMp = JsonUtil.convertJson2Object(contactJson, Map.class);
    List<Map<String, String>> contactLs = (List<Map<String, String>>) contactMp.get("rows");
    if (contactLs != null && contactLs.size() > 0) {
      return contactLs.get(0);
    }

    return null;
  }
Пример #9
0
  @SuppressWarnings("unchecked")
  private List<Map<String, String>> getAllApps() {
    Object obj = SpringContextHelper.instance.getOscache().get(HOME_APPS_CACHE);
    if (obj != null) {
      return (List<Map<String, String>>) obj;
    }
    // 取得单独应用
    String singlestr = getSingleApp();
    // 取得组合应用
    String mutistr = getMutiApp();

    Map<String, Object> singleMp = JsonUtil.convertJson2Object(singlestr, Map.class);
    List<Map<String, String>> singleLs = (List<Map<String, String>>) singleMp.get("rows");
    Map<String, Object> mutiMp = JsonUtil.convertJson2Object(mutistr, Map.class);
    List<Map<String, String>> mutiLs = (List<Map<String, String>>) mutiMp.get("rows");

    List<Map<String, String>> appList = new ArrayList<Map<String, String>>();
    if (singleLs != null) appList.addAll(singleLs);
    if (mutiLs != null) appList.addAll(mutiLs);

    if (appList.size() > 0) SpringContextHelper.instance.getOscache().put(HOME_APPS_CACHE, appList);

    return appList;
  }
Пример #10
0
  /** 取得应用详细信息* */
  @SuppressWarnings("unchecked")
  public String getAppDetail(String nodeUid) {
    String rtnJson = getAppDetailOriginal(nodeUid);
    //    	List<Map<String,String>> datas = JsonUtil.convertJson2Object(rtnJson, List.class);
    Map<String, String> data = JsonUtil.convertJson2Object(rtnJson, Map.class);
    List<Map<String, String>> datas = new ArrayList<Map<String, String>>();
    datas.add(data);

    calculationPicHref(datas, DownLoadPic.APP_APPPIC);
    calculationPicHref(datas, DownLoadPic.APP_APPMXPIC);
    calculationPicHref(datas, DownLoadPic.APP_APPDESCPIC);
    calculationPicHref(datas, DownLoadPic.APP_PRICETABLE);
    calculationPicHref(datas, DownLoadPic.APP_APPDOWN);

    return convert(datas, "getAppDetail");
  }
Пример #11
0
  /** 取得首页头部 */
  @SuppressWarnings("unchecked")
  public synchronized String getHomeTops(String baseDir, List<Map<String, String>> userOrders) {
    String rtnJson = "";
    rtnJson = SpringContextHelper.instance.getOscache().get(HOME_TOP_CACHE);

    if (!StringUtil.isEmpty(rtnJson)) {
      return rtnJson;
    }
    // 取得首页广告数据
    String adverstr = getHomeAdvertising();
    // 取得首页二级菜单
    String secmenustr = getHomeSecMenu();
    // 取得已经上线的单独应用
    String singlestr = getSingleApp();
    // 取得已经上线的组合应用
    String mutistr = getMutiApp();
    // 取得快报
    String expressstr = getHomeExpress();

    Map<String, Object> secmenuMp = JsonUtil.convertJson2Object(secmenustr, Map.class);
    List<Map<String, String>> secmenuLs = (List<Map<String, String>>) secmenuMp.get("rows");
    Map<String, Object> singleMp = JsonUtil.convertJson2Object(singlestr, Map.class);
    List<Map<String, String>> singleLs = (List<Map<String, String>>) singleMp.get("rows");
    Map<String, Object> mutiMp = JsonUtil.convertJson2Object(mutistr, Map.class);
    List<Map<String, String>> mutiLs = (List<Map<String, String>>) mutiMp.get("rows");

    // 保存所有应用信息
    List<Map<String, String>> appList = new ArrayList<Map<String, String>>();
    if (singleLs != null) appList.addAll(singleLs);
    if (mutiLs != null) appList.addAll(mutiLs);

    Map<String, Object> adverMp = JsonUtil.convertJson2Object(adverstr, Map.class);
    List<Map<String, String>> adverLs = (List<Map<String, String>>) adverMp.get("rows");

    calculateAdverLs(adverLs, appList);

    cacheAllApps(baseDir, singleLs, mutiLs, adverLs);
    if (appList.size() > 0) SpringContextHelper.instance.getOscache().put(HOME_APPS_CACHE, appList);
    // 保存所有应用信息.结束

    Map<String, Object> expressMp = JsonUtil.convertJson2Object(expressstr, Map.class);
    List<Map<String, String>> expressLs = (List<Map<String, String>>) expressMp.get("rows");

    //		calculateAdverLs(adverLs,appList);
    //		//从cms下载所有图片在本地
    //		List<String> picUrls = calculatePics(adverLs,appList);
    //		downLoadPic.downloadPicFromCms(baseDir, picUrls);
    // List<Map<String,Map<String,String>>> picUrls = calculatePics1(adverLs,appList);
    // downLoadPic.downloadPicFromCms(baseDir, picUrls,this);

    Map<String, List<Map<String, String>>> secmenus = splitSecmenus(secmenuLs);
    Map<String, List<Map<String, Object>>> menus =
        calculatMenus(secmenus, singleLs, mutiLs, userOrders);

    if (expressLs != null && expressLs.size() > 5) {
      expressLs = expressLs.subList(0, 5);
    }
    List<Map<String, String>> teacherSubMenu = getsubMenu(appList, 1);
    List<Map<String, String>> studentSubMenu = getsubMenu(appList, 2);
    List<Map<String, String>> activitSubMenu = getsubMenu(appList, 3);

    Map<String, List<Map<String, String>>> subMenuMp =
        new HashMap<String, List<Map<String, String>>>();
    subMenuMp.put("teacher", teacherSubMenu);
    subMenuMp.put("father", studentSubMenu);
    subMenuMp.put("actived", activitSubMenu);

    Map<String, Object> homeTops = new HashMap<String, Object>();

    homeTops.put("secmenus", menus);
    homeTops.put("subMenu", subMenuMp);
    homeTops.put("adverpics", adverLs);
    homeTops.put("expresses", expressLs);
    homeTops.put("rtnCode", "1");

    rtnJson = JsonUtil.convertObject2Json(homeTops);
    if (null == userOrders || userOrders.size() == 0) {
      if (!StringUtil.isEmpty(rtnJson))
        SpringContextHelper.instance.getOscache().put(HOME_TOP_CACHE, rtnJson);
    }

    return rtnJson;
  }