/** * 会员未支付订单 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; } } }
/** @Function init @Description 初始化方法 初始化控件 @Input 无 @Return 无返回值 */ @InjectInit public void init() { textview_title.setVisibility(View.VISIBLE); getSupportActionBar().setTitle(""); title_center_layout.setVisibility(View.VISIBLE); foodTopDown.setVisibility(View.VISIBLE); eventBus.register(this, "onEventRefreshPayDetailData"); cardType = 99; // 默认筛选条件是间夜消费 // 初始化消费筛选列表 setPayDetailFilterDataList(); internetConfig = new InternetConfig(); internetConfig.setKey(1); intent = getIntent(); // 消费信息查询条件 filtermap = (Map<String, String>) Handler_Json.JsonToHashMap(intent.getStringExtra("payDetailFilter")); filtermap.put("pageNo", pageNo + ""); filtermap.put("pageCount", UrlParams.PAGESIZE + ""); pageUtil = new PageUtil(); adapter = new HotelCardPayDetailAdapter( hotelcard_pay_detail_list, mapList, R.layout.mem_hotelcard_pay_detail); hotelcard_pay_detail_list.setAdapter(adapter); showDialog(); // 打开模式层 // 调用消费明细信息接口 FastHttpHander.ajaxString( Url.METHOD_CARDCONSUMEARRAY, intent.getStringExtra("payDetailFilter"), internetConfig, this); }
/** * @Function pageRefresh @Description 分页 * * @input type:1:向下翻页 2,向上翻页 * @return 无返回值 */ @InjectPullRefresh public void pageRefresh(int type) { // 消费列表接口分页 Ioc.getIoc().getLogger().i("红树林卡消费接口:[" + Url.METHOD_CARDCONSUMEARRAY + "]"); internetConfig.setKey(1); switch (type) { case InjectView.PULL: // 向下翻页 pageNo++; if (pageNo > count) { pageUtil.isEndDownPage(); // 结束翻页 return; } // 设置输入参数 filtermap.put("pageNo", pageNo + ""); filtermap.put("pageCount", UrlParams.PAGESIZE + ""); showDialog(); // 调用后接口 FastHttpHander.ajaxString( Url.METHOD_CARDCONSUMEARRAY, Handler_Json.beanToJson(filtermap), internetConfig, this); break; case InjectView.DOWN: pageUtil.isEndDownPage(); break; } }
/** * @Function onEventRefreshPayDetailData @Description 根据请求条件 调用消费明细接口 @Input * entity:请求参数实体类数据 @Return 无返回值 */ public void onEventRefreshPayDetailData(MenuRefreshEventEntity entity) { // 排序方式 if (!Handler_String.isBlank(entity.getMenuKindCode()) && !Handler_String.isBlank(entity.getMenuKindName())) { cardType = Integer.parseInt(entity.getMenuKindCode()); textview_title.setText(entity.getMenuKindName()); mapList.clear(); pageNo = 1; // 设置输入参数 if (entity.getMenuKindCode().equals("0")) { filtermap.put("cardType", ""); } else { filtermap.put("cardType", entity.getMenuKindCode()); } filtermap.put("pageNo", pageNo + ""); filtermap.put("pageCount", UrlParams.PAGESIZE + ""); showDialog(); // 打开模式层 // 调用消费明细信息接口 FastHttpHander.ajaxString( Url.METHOD_CARDCONSUMEARRAY, Handler_Json.beanToJson(filtermap), internetConfig, this); } foodTopDown.setImageResource(R.drawable.arrow_down_white); }
@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); } }
/** * ********************************************** * * @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(); }
// 获取会员信息 private void getMemInfo() { internetConfig = new InternetConfig(); Ioc.getIoc().getLogger().i("调用后台获取个人信息接口:[" + Url.METHOD_MEMBERINFO + "]"); internetConfig.setKey(1); Map<String, String> map = new HashMap<>(); map.put("proceedsPhone", ""); internetConfig.setHead(FastHttp.inHeaders()); // 调用后台个人信息接口 FastHttpHander.ajaxString( Url.METHOD_MEMBERINFO, Handler_Json.beanToJson(map), internetConfig, this); }
@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; } }
/** * ********************************************** * * @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; } }
/** * @Function getMapList @Description 格式化消费订单列表,封装到适配器中 @Input jsonString:消费明细json格式 @Return 无返回值 */ public ArrayList<HashMap<String, String>> getMapList(String jsonString) { ArrayList<HashMap<String, String>> list = (ArrayList<HashMap<String, String>>) Handler_Json.jsonToListOrMap("list", jsonString); for (HashMap<String, String> map : list) { // 格式化时间 Handler_Time costDate = Handler_Time.getInstance(map.get("costDate").toString()); HashMap<String, String> hashMap = new HashMap<String, String>(); hashMap.put( "hotel_card_recordType", map.get("unitName").toString() + "-" + map.get("recordType").toString()); hashMap.put( "hotel_card_costime", DateUtil.formatStringDateTime(map.get("costDate").toString(), "yyyy.MM.dd HH:mm")); hashMap.put("hotel_card_unitcost", map.get("unitCost").toString()); mapList.add(hashMap); } return mapList; }
/** 自动验证成功的方法 */ @Override public void onValidationSucceeded() { showDialog("登录中..."); Ioc.getIoc().getLogger().i("登录前端验证成功"); // Toast.makeText(this, "前端验证通过", Toast.LENGTH_SHORT).show(); loginMap = new HashMap<String, String>(); loginMap.put("account", login_name.getText().toString().trim()); loginMap.put("password", login_pwd.getText().toString().trim()); // 验证手机是否联网 if (!Handler_Network.isNetworkAvailable(this)) { Toast.makeText(this, ErrorMsgEnum.NET_ERROR.getName(), Toast.LENGTH_SHORT).show(); return; } config = new InternetConfig(); config.setKey(R.raw.client); config.setHead(CommonUtils.inHeaders()); Ioc.getIoc().getLogger().i("调用后台登录接口:[" + Url.METHOD_LOGIN + "]"); // 调用后台登录接口 FastHttpHander.ajaxString(Url.METHOD_LOGIN, Handler_Json.beanToJson(loginMap), config, this); }
/** * *********************************************** @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(); } }
@Override public void onResp(BaseResp resp) { Ioc.getIoc().getLogger().i("onResp微信结果返回页面:" + Handler_Json.beanToJson(resp)); Ioc.getIoc().getLogger().i("微信结果返回页面:errStr" + resp.errStr); Ioc.getIoc().getLogger().i("微信结果返回页面:getType" + resp.getType()); Ioc.getIoc().getLogger().i("微信结果返回页面:openId" + resp.openId); Ioc.getIoc().getLogger().i("微信结果返回页面: transaction" + resp.transaction); Ioc.getIoc().getLogger().i("微信结果返回页面:errCode" + resp.errCode); if (resp.getType() >= ConstantsAPI.COMMAND_PAY_BY_WX) { if (resp.errCode == 0 || "0".equals(resp.errCode + "")) { // Intent i=getIntent(); String orderId = getOrderId(); Intent intent = new Intent(this, OrderPaySuccessfulActivity.class); intent.putExtra("orderId", orderId); intent.putExtra("payType", "微信支付"); startActivity(intent); } else { Toast.makeText(this, "支付未完成...", Toast.LENGTH_LONG).show(); } finish(); } }
/** * ********************************************** * * @param page 设定文件 * @return void 返回类型 * @throws @Title: ajaxRoomList @Description: TODO(获取房间列表) * @date 2014-11-19 *********************************************** */ private void ajaxRoomList(int page) { RoomResourceParamDto rrpd = new RoomResourceParamDto(); rrpd.setStartDate(rd.getStartDate()); rrpd.setEndDate(rd.getEndDate()); rrpd.setHotelCode(rd.getHotelCode()); rrpd.setCardNo(rd.getCardNo()); rrpd.setPageNo(page + ""); rrpd.setPageCount("5"); ArrayList<HashMap<String, String>> conditions = (ArrayList<HashMap<String, String>>) MapVo.get("conditions"); if (conditions != null) { rrpd.setBuildingCode(conditions.get(3).get("text_type_code") + ""); rrpd.setFloorCode(conditions.get(4).get("text_type_code") + ""); rrpd.setInfarIntro(conditions.get(2).get("text_type_code") + ""); rrpd.setRoomTypeCode(conditions.get(0).get("text_type_code") + ""); rrpd.setViewCode(conditions.get(1).get("text_type_code") + ""); rrpd.setRoomIdxRange(conditions.get(5).get("text_type_code") + ""); } InternetConfig config = new InternetConfig(); config.setKey(1); String json = Handler_Json.beanToJson(rrpd); Ioc.getIoc().getLogger().i(json); FastHttpHander.ajaxString(Url.HOTELRESERVE_ASSET_RECOMMENDROOMARRAY, json, config, this); }
@Override public void onReq(BaseReq req) { Ioc.getIoc().getLogger().i("onReq微信结果返回页面:" + Handler_Json.beanToJson(req)); }
/** * 红树林卡消费列表信息总条数 * * @param jsonString 红树林卡消费明细json数据 */ public int getTotalCount(String jsonString) { return Integer.parseInt(Handler_Json.getValue("count", jsonString).toString()); }
// 获取个人信息成功返回结果 @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("未开通账户余额"); // } } }