/** @Function resultOk @Description 消费明细列表响应结果 @Input r:响应结果封装实体类 @Return 无返回值 */
  @InjectHttpOk(1)
  public void resultOk(ResponseEntity r) {
    Ioc.getIoc().getLogger().i("消费明细列表返回结果【" + r + "】");
    try {

      // 返回结果格式化处理后OK进行数据处理
      if (ResultParse.isResultOK(r, this)) {
        count = getTotalCount(r.getContentAsString());

        if (count == 0) {
          mapList.clear();
          adapter.notifyDataSetChanged(); // 列表变化
          cancelDialog();
          return;
        }

        this.getMapList(r.getContentAsString());
        adapter.notifyDataSetChanged(); // 列表变化
      }

      pageUtil.isEndRefreshPage(); // 结束刷新
      cancelDialog();

    } catch (Exception e) {
      cancelDialog();
    }
  }
예제 #2
0
 /**
  * 会员未支付订单 2014-8-14下午2:49:19
  *
  * @author wangmingyu
  */
 @InjectHttpOk({10, 11, 27})
 public void resultOk(ResponseEntity r) {
   dismissDialog();
   if (ResultParse.isResultOK(r, activity)) {
     switch (r.getKey()) {
       case 10:
         List<OrdrDetail> list = new ArrayList<OrdrDetail>();
         list = Handler_Json.jsonToBean(OrdrDetail.class, "list", r.getContentAsString());
         installData(list);
         break;
       case 11: // 查询订单组列表
         positionJson = r.getContentAsString();
         child = Handler_Json.jsonToBean(OrderDetailEntity.class, "list", r.getContentAsString());
         if (child != null) {
           order_center_list.expandGroup(groupPosition);
           if (Handler_String.isBlank(((OrderDetailEntity) oca.getChild(0, 0)).getCardNo())) {
             footerView.findViewById(R.id.rl_type_card).setVisibility(View.GONE);
             footerView.findViewById(R.id.rl_type_money).setVisibility(View.VISIBLE);
           } else {
             footerView.findViewById(R.id.rl_type_card).setVisibility(View.VISIBLE);
             footerView.findViewById(R.id.rl_type_money).setVisibility(View.GONE);
             TextView cardNo = (TextView) footerView.findViewById(R.id.tv_card_No);
             TextView cardPoint = (TextView) footerView.findViewById(R.id.tv_card_point);
             Selector selector = Selector.from(ReservationDto.class);
             selector.select(" * ");
             selector.where("cardNo", "=", ((OrderDetailEntity) oca.getChild(0, 0)).getCardNo());
             ReservationDto rd =
                 Ioc.getIoc().getDb("/sdcard/MTM/", Constants.APP_DATABASE).findFirst(selector);
             String card_no_6 = rd.getCardNo().substring(rd.getCardNo().length() - 6);
             cardNo.setText(getString(R.string._card_wh, card_no_6));
             cardPoint.setText(getString(R.string.usable_card_idx, rd.getCardRemainingIdx()));
           }
           order_center_list.addFooterView(footerView);
           oca.notifyDataSetChanged();
         }
         break;
       case 27: // 取消订单
         try {
           List<HashMap<String, String>> cancelList =
               Handler_Json.jsonToList("orderCancelList", r.getContentAsString());
           for (int i = 0; i < cancelList.size(); i++) {
             Ioc.getIoc()
                 .getDb("/sdcard/MTM/", Constants.APP_DATABASE)
                 .delete(
                     SubmittedOrderEntity.class,
                     WhereBuilder.b("orderNo", "=", cancelList.get(i).get("orderNo")));
           }
           // group.remove(groupPosition);
           // 获取当前未支付订单数量
           eventBus.post(new MSGCountEntity());
           group.clear();
           oca.notifyDataSetChanged();
           rl_tools.setVisibility(View.GONE);
         } catch (Exception e) {
           e.printStackTrace();
         }
         break;
     }
   }
 }
예제 #3
0
 @InjectHttpErr(value = {1, 3})
 public void resultErr(ResponseEntity r) {
   dismissDialog();
   Ioc.getIoc().getLogger().i("接口请求异常:" + r.getContentAsString());
   if (r.getKey() == 1) {
     pageUtil.isEndDownPage();
     Toast.makeText(activity, ErrorMsgEnum.NET_ERROR.getName(), Toast.LENGTH_SHORT).show();
   }
 }
예제 #4
0
 @InjectHttpErr({9, 10, 11, 27})
 public void resultErr(ResponseEntity r) {
   if (r.getKey() == 9) {
     getNoLoginOrder();
   }
   dismissDialog();
   Toast.makeText(activity, ErrorMessageEnum.SYSTEM_EXCEPTION.getName(), Toast.LENGTH_SHORT)
       .show();
 }
예제 #5
0
 @InjectHttpOk(1)
 public void resultOk(ResponseEntity r) {
   dismissDialog();
   if (ResultParse.isResultOK(r, activity)) {
     ArrayList<HashMap<String, String>> list =
         Handler_Json.jsonToList("list", r.getContentAsString());
     String page = (String) Handler_Json.getValue("pageNo", r.getContentAsString());
     String time = (String) Handler_Json.getValue("sysDateTime", r.getContentAsString());
     MangrovePayApp.msgTime = time;
     MangrovePayApp.app.setData("msgTime", time);
     Ioc.getIoc().getLogger().i("-------------------------");
     Ioc.getIoc().getLogger().i("-------------系统时间:" + MangrovePayApp.msgTime);
     if (!Handler_String.isBlank(page)) {
       pageNo = Integer.valueOf(page) + 1;
     }
     initData(list, page);
   }
 }
예제 #6
0
  /**
   * **********************************************
   *
   * @param r 设定文件
   * @return void 返回类型
   * @throws @Title: result @Description: (推荐房间返回)
   * @date 2014-11-19 ***********************************************
   */
  @InjectHttpOk(1)
  public void result(ResponseEntity r) {
    dismissDialog();
    switch (r.getStatus()) {
      case FastHttp.result_ok:
        ArrayList<HashMap<String, String>> list = null;
        try {
          // if (ResultParse.reservationIsResultOK(r, activity)) {
          String json = Handler_Json.getValue("list", r.getContentAsString()).toString();
          String s = Handler_Json.getValue("pageNo", r.getContentAsString()).toString();
          pageNo = Integer.valueOf(s) + 1;
          if (!"".equals(json)) { // 判断查询数据是否为空 ,
            list = Handler_Json.JsonToCollection(json);
            getList(list);
          } else { // 为空数据 初始化当前页数1 ,展示无数据图片
            // pageNo = 1;
            // dataList.clear();
            Toast.makeText(activity, "无数据", Toast.LENGTH_SHORT).show();
          }
          Ioc.getIoc().getLogger().i(" 完成 刷新");
          // }
        } catch (Exception e) {
          e.printStackTrace();
        }

        break;
      case FastHttp.result_net_err:
        Toast.makeText(activity, "请求错误", Toast.LENGTH_SHORT).show();
        break;
    }
    // 完成 加载更多
    PullToRefreshManager.getInstance().onFooterRefreshComplete();
    // 完成 刷新
    PullToRefreshManager.getInstance().onHeaderRefreshComplete();

    // 关闭顶部的下拉
    PullToRefreshManager.getInstance().headerUnable();
    // 打开顶部的下拉
    PullToRefreshManager.getInstance().headerEnable();
    // 关闭底部的加载
    PullToRefreshManager.getInstance().footerUnable();
    // 打开顶部的加载
    PullToRefreshManager.getInstance().footerEnable();
  }
예제 #7
0
 @InjectHttp
 private void imgListResult(ResponseEntity r) {
   Ioc.getIoc().getLogger().i("图片房间接口返回数据:【" + r + "】");
   switch (r.getStatus()) {
     case FastHttp.result_ok:
       if (ResultParse.isResultOK(r, this)) {
         ArrayList<HashMap<String, String>> list =
             (ArrayList<HashMap<String, String>>)
                 Handler_Json.JsonToCollection(r.getContentAsString());
         spa = new SamplePagerAdapter(this, list, R.layout.activity_img_page_item);
         mViewPager.setAdapter(spa);
       }
       break;
     case FastHttp.result_net_err:
       break;
     default:
       break;
   }
 }
예제 #8
0
 @InjectHttpOk(9)
 private void checkTicketResult(ResponseEntity r) {
   dismissDialog();
   Map<String, String> map = r.getHeaders();
   if ("OK".equals(map.get(HeaderConst.MYMHOTEL_STATUS))) {
     // Toast.makeText(context, msgArray[1], Toast.LENGTH_SHORT).show();
     ajaxOrder();
   } else {
     getNoLoginOrder();
   }
 }
  /** @Function resultErr @Description 请求结果失败处理 @Input r:请求结果封装实体类 @Return 无返回值 */
  @InjectHttpErr(value = {1})
  public void resultErr(ResponseEntity r) {
    switch (r.getKey()) {
        // 消费明细
      case 1:
        Ioc.getIoc().getLogger().i("消费明细接口获取失败,请检查网络或者接口");
        Toast.makeText(this, "消费明细接口获取失败,请检查网络或者接口", Toast.LENGTH_SHORT).show();
        break;
    }

    cancelDialog();
  }
예제 #10
0
  /**
   * **********************************************
   *
   * @param r 设定文件
   * @return void 返回类型
   * @throws @Title: fastResult @Description: (酒店楼宇接口 返回)
   * @date 2014-11-19 ***********************************************
   */
  @InjectHttpOk(value = {111})
  protected void fastResult(ResponseEntity r) {
    System.out.println(r.getStatus());
    switch (r.getStatus()) {
      case FastHttp.result_ok:
        if (ResultParse.reservationIsResultOK(r, activity)) {
          imgList = Handler_Json.JsonToCollection(r.getContentAsString());
          // InitFocusIndicatorContainer();
          // initGallery();
          ipaAdapter = new ImagePagerAdapter(activity, imgList, indicator_container);

          gallery_hotel.setAdapter(ipaAdapter);
          ipaAdapter.notifyDataSetChanged();
          gallery_hotel.setFocusable(true);
        }
        break;
      case FastHttp.result_net_err:
        Toast.makeText(activity, "网络异常 ,请检查您确保开启无线网络", Toast.LENGTH_SHORT).show();
        break;
    }
  }
예제 #11
0
  /**
   * *********************************************** @Title: success @Description: TODO(登录返回)
   *
   * @param entity 设定文件
   * @return void 返回类型
   * @throws
   * @date 2015-1-8 ***********************************************
   */
  @InjectHttpOk
  public void success(ResponseEntity entity) {
    Ioc.getIoc().getLogger().i("登录接口状态返回结果【" + entity.toString() + "】");

    // 获取头部信息
    Map<String, String> map = entity.getHeaders();

    // 登录成功 返回OK
    if (ResultParse.isResultOK(entity, this)) {
      // 获取返回内容 ticket
      String jsonString = entity.getContentAsString();

      Ioc.getIoc().getLogger().i("ticket数据【" + jsonString + "】");

      // 存放ticket
      MapVo.map = Handler_Json.JsonToCollection(jsonString); // 设置ticket
      // TODO
      MangrovePayApp.ticket = (String) MapVo.get("ticket");
      // 存储用户名密码到本地
      MangrovePayApp.app.setData("account", loginMap.get("account"));
      MangrovePayApp.app.setData("password", loginMap.get("password"));
      Ioc.getIoc().getLogger().i("登录成功");

      Intent intent = new Intent();
      intent.setClass(this, MainActivity.class);
      startActivity(intent);
      // startActivity(new Intent().setClass(this, CaptureActivity.class));
      this.finish();
    }
    // 登录失败
    else {
      Ioc.getIoc().getLogger().i("登录失败");
      Toast.makeText(this, "登录失败,请检查用户名密码是否正确", Toast.LENGTH_SHORT).show();
      dismissDialog();
    }
  }
예제 #12
0
 /**
  * **********************************************
  *
  * @param r 返回信息
  * @return void 返回类型
  * @throws @Title: resultErr @Description: (http请求错误返回方法)
  * @date 2014-11-19 ***********************************************
  */
 @InjectHttpErr(value = {1, 111})
 private void resultErr(ResponseEntity r) {
   Ioc.getIoc().getLogger().e(r.getContentAsString());
   dismissDialog();
   Toast.makeText(activity, "请求错误", Toast.LENGTH_SHORT).show();
 }
예제 #13
0
  // 获取个人信息成功返回结果
  @InjectHttpOk({1, 13})
  public void resultOk(ResponseEntity r) {

    dismissDialog();
    // 获取个人信息成功 返回OK
    if (ResultParse.isResultOK(r, this)) {
      switch (r.getKey()) {
        case 1: // 获取个人信息
          personEntity = Handler_Json.JsonToBean(PersonalEntity.class, r.getContentAsString());
          personEntity.setId("2222");
          if (getPersonInfo() > 0) db.saveOrUpdate(personEntity);
          else db.save(personEntity);

          // 判断是否绑定手机,如果绑定手机,登陆的时候显示手机号,否则显示邮箱
          if (personEntity.getCallPhone() != null && !personEntity.getCallPhone().equals("")) {
            account_item_name.setText(personEntity.getCallPhone());
          } else {
            account_item_name.setText(personEntity.getEmail());
          }
          break;
        case 13: // 版本更新
          try {
            final Map<String, String> map = Handler_Json.JsonToCollection(r.getContentAsString());
            ////                       {
            //                        "name": "红树林管家",
            //                                "version": "10",
            //                                "changelog": "新版本更新\n1、增加新产品商城\n2、业态展示\n3、商品订单中心",
            //                                "updated_at": 1470668072,
            //                                "versionShort": "V 3.1.0",
            //                                "build": "10",
            //                                "installUrl":
            // "http://download.fir.im/v2/app/install/54c7076b64fa0433050049a8?download_token=1fbef156fe3a27ff2524cae445d06849",
            //                                "install_url":
            // "http://download.fir.im/v2/app/install/54c7076b64fa0433050049a8?download_token=1fbef156fe3a27ff2524cae445d06849",
            //                                "direct_install_url":
            // "http://download.fir.im/v2/app/install/54c7076b64fa0433050049a8?download_token=1fbef156fe3a27ff2524cae445d06849",
            //                                "update_url": "http://fir.im/mangrovetree",
            //                                "binary": {
            //                            "fsize": 60386833
            //                        }
            //                    }
            int version = Integer.valueOf(map.get("version"));
            Ioc.getIoc().getLogger().e(" 当前versionCode:" + Handler_System.getVersionCode(this));
            if (version > Handler_System.getVersionCode(this)) {
              onAlertVersion(map.get("changelog"), map.get("install_url"));
            }
          } catch (Exception e) {
          }
          break;
      }

      // 是否开通帐户余额,开通了获取余额值
      //            if(personEntity.getOpenBalance() == 1){
      //                internetConfig.setKey(3);
      //                //已开通余额帐户,取帐户余额
      //                FastHttpHander.ajaxString(Url.METHOD_MEMBERBALANCEINFO,new
      // JsonObject().toString(),internetConfig,this);
      //            }else{
      //                //设置帐户余额
      //                account_item_money.setText("未开通账户余额");
      //            }

    }
  }