Exemplo n.º 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);
  }
Exemplo n.º 2
0
  @SuppressWarnings("unchecked")
  public String getHomeExpress() {
    String rtnJson = getHomeExpressOriginal();
    List<Map<String, String>> datas = JsonUtil.convertJson2Object(rtnJson, List.class);

    return convert(datas, "getHomeExpress");
  }
Exemplo n.º 3
0
  /** 取得首页Body信息 */
  public String getAllHotNewApp(
      String myTrack,
      List<Map<String, String>> appfavorite,
      List<Map<String, String>> userOrders,
      long userId) {
    Map<String, Object> rtn = new HashMap<String, Object>();
    //		rtn.putAll(getAllHotNewApp());
    Map<String, Object> allHotNewApp = getAllHotNewApp();
    rtn.putAll(allHotNewApp);
    if (userId > 0) {
      List<Map<String, String>> appList = getAllApps();
      rtn.put("myTrack", getMyTrack(myTrack.split(","), appList));
    }
    if (userId > 0) {
      calculationPicHref(appfavorite, "appPic");

      rtn.put("appfavorite", appfavorite);
    }
    if (userId > 0) {
      List<Map<String, String>> appList = getAllApps();

      List<Map<String, String>> orderApps = getUserOrders(appList, userOrders);
      if (orderApps != null && orderApps.size() > 7) {
        orderApps = orderApps.subList(0, 7);
      }
      rtn.put("userOrderApps", orderApps);
    }

    rtn.put("rtnCode", "1");

    String rtnJson = JsonUtil.convertObject2Json(rtn);

    return rtnJson;
  }
Exemplo n.º 4
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");
  }
Exemplo n.º 5
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);
  }
Exemplo n.º 6
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;
  }
Exemplo n.º 7
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");
 }
Exemplo n.º 8
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");
  }
Exemplo n.º 9
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;
  }
Exemplo n.º 10
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;
  }
Exemplo n.º 11
0
  /** 取得所有应用 */
  public String getAllApp() {
    List<Map<String, String>> appList = getAllApps();
    List<Map<String, String>> hotkeywords = getHotKeywords(appList);
    if (hotkeywords.size() > 5) {
      hotkeywords = hotkeywords.subList(0, 5);
    }

    Map<String, Object> rtnmap = new HashMap<String, Object>();
    rtnmap.put("rtnCode", "1");
    rtnmap.put("hotkeywords", hotkeywords);
    rtnmap.put("rows", appList);

    String rtnJson = JsonUtil.convertObject2Json(rtnmap);

    return rtnJson;
  }
Exemplo n.º 12
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");
  }
Exemplo n.º 13
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;
  }