Esempio n. 1
0
  // 결과 저장합니다.
  public boolean resultCodeSave(String data) {

    JSONObject json = new JSONObject();
    String p_data = data.substring(10, data.length());
    try {
      json = (JSONObject) JSONValue.parseWithException(p_data);
    } catch (ParseException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    String query = "Select * From e_AppInstall Where idx='" + json.get("idx") + "' ";
    String query_result = "";
    Ms_Connect mscon = new Ms_Connect();
    HashMap<String, String> map = mscon.selectQueryOne(query);

    if (map.size() <= 0) {
      query_result =
          "Insert into e_AppInstall (idx, mem_id, platform, devicetoken, deviceuid, devicename, devicemodel, deviceversion, hp_num, reg_time, cus_code) values("
              + "'"
              + json.get("idx")
              + "', '"
              + json.get("mem_id")
              + "', '"
              + json.get("platform")
              + "', '"
              + json.get("devicetoken")
              + "', '"
              + json.get("deviceuid")
              + "', '"
              + json.get("devicename")
              + "', '"
              + json.get("devicemodel")
              + "', '"
              + json.get("deviceversion")
              + "', '"
              + json.get("hp_num")
              + "', '"
              + json.get("reg_time")
              + "', '')";
      int result = mscon.connect_update(query_result);
      if (result == 0) {
        return true;
      } else {
        return false;
      }
    } else {
      if (map.get("idx").equals(json.get("idx"))) {
        query_result =
            "Update e_AppInstall Set mem_id='"
                + json.get("mem_id")
                + "', platform='"
                + json.get("platform")
                + "', devicetoken='"
                + json.get("devicetoken")
                + "', deviceuid='"
                + json.get("deviceuid")
                + "', devicename='"
                + json.get("devicename")
                + "', devicemodel='"
                + json.get("devicemodel")
                + "', deviceversion='"
                + json.get("deviceversion")
                + "', hp_num='"
                + json.get("hp_num")
                + "', reg_time='"
                + json.get("reg_time")
                + "' "
                + "Where idx='"
                + json.get("idx")
                + "' ";
        int result = mscon.connect_update(query_result);
        if (result == 0) {
          return true;
        } else {
          return false;
        }
      } else {
        return false;
      }
    }
  }