Package com.alimama.mdrill.json

Examples of com.alimama.mdrill.json.JSONArray


          {
            sleep();
            continue;
          }
   
          JSONArray list=jsonObj.getJSONObject("data").getJSONArray("docs");

          if(list.length()==0)
          {
            sleep();
            continue;
          }
         
          for(int i=0;i<list.length();i++)
          {
            try {
              JSONObject item = list.getJSONObject(i);
              String delivey_date= String.valueOf(item.get("putin_date"));
              String url_lwfrom=ColsDefine.getName(String.valueOf(item.get("url")), "lwfrom");
              String adid = String.valueOf(url_lwfrom);
              String pid = String.valueOf(item.get("pid"));
              rtn.put(delivey_date+"@"+adid, pid);
View Full Code Here


          {
            sleep();
            continue;
          }
   
          JSONArray list=jsonObj.getJSONObject("data").getJSONArray("docs");

          if(list.length()==0)
          {
            sleep();
            continue;
          }
         
          for(int i=0;i<list.length();i++)
          {
            try {
              JSONObject item = list.getJSONObject(i);
              String delivey_date= String.valueOf(item.get("putin_date"));
              String adid = String.valueOf(item.get("lwfrom"));
              String pid = String.valueOf(item.get("pid"));
              rtn.put(delivey_date+"@"+adid, pid);
            } catch (Exception e) {
View Full Code Here

      rtna.put("msg","服务器异常,请稍后再试");
      hb.stop();
      return new JSONObject(rtna).toString();
    }

    JSONArray list=jsonObj.getJSONObject("data").getJSONArray("docs");
    int presize=(list.length()/3)+1;
   
    if(list.length()<2)
    {
      rtna.put("code",0);
      rtna.put("msg","请至少选择2天的数据");
      hb.stop();
      return new JSONObject(rtna).toString();
    }
   
    String[] fields=getAllFields(list);
     HashMap<String,String> field2dimvalue=fieldToShowName(fl, dimvalue);

        StringBuilder numberfield = new StringBuilder();

       
    HashMap<String,HashMap<String,Object>> lines=setUpLines(numberfield,fields, isSingleY, field2dimvalue);

        int len=list.length();
        minMaxX minmax=new minMaxX();
    for(int i=10;i<len;i++)
    {
          makePre(lines, false, i, 1, minmax, fields, list, numberfield);
    }
View Full Code Here

          {
            sleep();
            continue;
          }
   
          JSONArray list=jsonObj.getJSONObject("data").getJSONArray("docs");

          if(list.length()==0)
          {
            sleep();
            continue;
          }
         
          for(int i=0;i<list.length();i++)
          {
            try {
              JSONObject item = list.getJSONObject(i);
              String delivey_date= String.valueOf(item.get("delivey_date"));
              String adid = String.valueOf(item.get("adid"));
              String pid = String.valueOf(item.get("pid"));
              rtn.put(delivey_date+"@"+adid, pid);
            } catch (Exception e) {
View Full Code Here

        rtna.put("code",0);
        rtna.put("msg","服务器异常,请稍后再试");
        hb.stop();
        return new JSONObject(rtna).toString();
      }
      JSONArray list=jsonObj.getJSONObject("data").getJSONArray("docs");
      ArrayList<Object> data=new ArrayList< Object>();
      ArrayList<String> showFields = WebServiceParams.showFields(fl);
      String flkey=groupby;
      String flvalue="";
      for (String showfield : showFields) {
          StateField showfielda=WebServiceParams.parseStat(showfield);
          if(showfielda.isstat)
          {
            flvalue=showfield;
          }
         
      }
      JSONArray filterother=new JSONArray(WebServiceParams.query(queryStr));
      JSONArray filterother2=new JSONArray();

      for(int i=0;i<list.length();i++)
      {
        JSONObject item=list.getJSONObject(i);
        JSONObject newitem=new JSONObject();
        newitem.put("label", String.valueOf(item.get(flkey)));
        newitem.put("data", Double.parseDouble(item.getString(flvalue)));
        data.add(newitem);

        JSONObject newitemfilter=new JSONObject();
        newitemfilter.put("key", flkey);
        newitemfilter.put("operate", "2");
        newitemfilter.put("value",  String.valueOf(item.get(flkey)));
        filterother.put(newitemfilter);
        filterother2.put(newitemfilter);
       

      }
     
      if("Y".equals(showOther))
      {
        String rtnother= MdrillService.result(projectName, null, startStr,rowsStr, filterother.toString(), null, flvalue, null, sort, order, null, null);
        JSONObject jsonObjother = new JSONObject(rtnother);
        if(jsonObjother.getString("code").equals("1"))
        {
          JSONArray listother=jsonObjother.getJSONObject("data").getJSONArray("docs");
          for(int i=0;i<listother.length();i++)
          {
            JSONObject item=listother.getJSONObject(i);
            Double d=Double.parseDouble(item.getString(flvalue));
            if(d>0)
            {
            JSONObject newitem=new JSONObject();
            newitem.put("label", "其他");
View Full Code Here

 

  @Override
  public String[] SqlPartions(String queryStr) throws Exception {
    HashSet<String> rtn = new HashSet<String>();
    JSONArray jsonStr = new JSONArray(queryStr.trim());

    for (int j = 0; j < jsonStr.length(); j++) {
      JSONObject obj = jsonStr.getJSONObject(j);
      if (obj.has(this.fieldname)) {
        JSONObject thedate = obj.getJSONObject(this.fieldname);
        Integer operate = Integer.parseInt(thedate.get("operate").toString());
        OperateType optype=WebServiceParams.parseOperateType(operate);
        String[] val = WebServiceParams.parseFqValue(thedate.getString("value"), operate).split(",");
View Full Code Here

  }

  @Override
  public String SqlFilter(String queryStr) throws Exception {
    JSONArray rtn = new JSONArray();
    JSONArray jsonStr = new JSONArray(queryStr.trim());

    for (int j = 0; j < jsonStr.length(); j++) {
      JSONObject obj = jsonStr.getJSONObject(j);
      if (!obj.has(this.fieldname)) {
        rtn.put(obj);
      }
    }
    return rtn.toString();
View Full Code Here

TOP

Related Classes of com.alimama.mdrill.json.JSONArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.