/** * 会员未支付订单 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; } } }
/** 未支付订单 */ private void getNoLoginOrder() { Selector selector = Selector.from(SubmittedOrderEntity.class); selector.select(" * "); List<SubmittedOrderEntity> list = Ioc.getIoc().getDb("/sdcard/MTM/", Constants.APP_DATABASE).findAll(selector); if (list != null && list.size() > 0) { initToolBar(); OrdrDetail orderDetail = new OrdrDetail(); Long time = DateUtil.getStartAndEndToTimes( DateUtil.formatDateTime(new Date(), "yyyy-MM-dd HH:mm:ss"), list.get(0).getCreateTime()); orderDetail.setFailureTime(DateUtil.timer(time)); String orderGroupId = ""; String orderGroupNo = ""; for (int i = 0; i < list.size(); i++) { if (Handler_String.isBlank(orderGroupId) || i != (list.size() - 1)) { orderGroupNo += list.get(i).getOrderNo() + ","; orderGroupId += list.get(i).getOrderId() + ","; } else { orderGroupId += list.get(i).getOrderId(); orderGroupNo += list.get(i).getOrderNo(); } } Ioc.getIoc().getLogger().d("订单组id:" + orderGroupId); orderDetail.setOrderIdGroup(orderGroupId); group.add(orderDetail); oca.notifyDataSetChanged(); } }
@Override public void onDestroy() { Ioc.getIoc().getLogger().d("销毁fragment"); dismissDialog(); if (null != countDownTimer) { countDownTimer.cancel(); countDownTimer.onFinish(); countDownTimer = null; Ioc.getIoc().getLogger().d("清除计时器"); } super.onDestroy(); }
/** 后台进程 */ @Override protected BitmapDrawable doInBackground(Void... params) { Ioc.getIoc().getLogger().d("doInBackground - starting work"); final String dataString = String.valueOf(mData); Bitmap bitmap = null; BitmapDrawable drawable = null; // 暂停下载的时候这里被锁住了 等待唤醒 // 这里也可能被取消了 synchronized (mPauseWorkLock) { while (mPauseWork && !isCancelled()) { try { mPauseWorkLock.wait(); } catch (InterruptedException e) { } } } // 如果缓存不为空 没有被取消 当前显示的imageview不为空 则去从本地缓存中获取 if (mImageCache != null && !isCancelled() && getAttachedImageView() != null && !mExitTasksEarly) { bitmap = mImageCache.getBitmapFromDiskCache(dataString, getW(), getH(), ImageWorker.this); } // 下载图片 通过自定义下载模块 if (bitmap == null && !isCancelled() && getAttachedImageView() != null && !mExitTasksEarly) { bitmap = processBitmap(mData, imageViewReference.get()); } // 如果图片不为空 if (bitmap != null) { if (Utils.hasHoneycomb()) { // 如果版本大于3.0则把bitmap包裹到BitmapDrawable中 drawable = new BitmapDrawable(mResources, bitmap); } else { // 小于3.0的情况下 自定义一个BitmapDrawable用来自动回收图片 drawable = new RecyclingBitmapDrawable(mResources, bitmap); } if (mImageCache != null) { mImageCache.addBitmapToCache(dataString, drawable); } } Ioc.getIoc().getLogger().d("doInBackground - finished work"); return drawable; }
/** * ********************************************** * * @return void 返回类型 * @throws @Title: init @Description: TODO(初始化数据) 设定文件 * @date 2014-11-19 *********************************************** */ @InjectInit public void init() { db = Ioc.getIoc().getDb("/sdcard/MTM/", Constants.APP_DATABASE); dataList = new ArrayList<HashMap<String, String>>(); initView(); mImageFetcher = new ImageDownloader(getActivity(), 300); mImageFetcher.setLoadingImage(R.drawable.default_load_image); eventBus.register(this, "onEventPostRoomList"); // 设置list列表间距 srla = new ConditionsRoomAdapter( activity, listview_roomlist, dataList, R.layout.reservation_screeningroom_item); listview_roomlist.setAdapter(srla); // 这里是设置里面的文字 可以不设置 默认有 PullToRefreshManager.getInstance().setRelease_label("松开后刷新"); PullToRefreshManager.getInstance() .setUpdateTime(org.apache.http.impl.cookie.DateUtils.formatDate(new Date(), "yyyy-MM-dd")); showDialog(); ajaxRoomList(1); ajaxPOST(); gallery_hotel.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { startActivity(new Intent(getActivity(), HotelViewPagerActivity.class)); } }); search_layout.setVisibility(View.GONE); }
/** * 异步 post异步获取 有参数 自定义下载配置 * * @param url 请求连接 * @param params 请求参数 * @param config 请求配置 * @param object 回调函数 * @return void * @author mars 2013-5-20 下午2:54:08 */ public static void ajaxWebServer( String url, String method, HashMap<String, String> params, final InternetConfig config, final Object object) { if (config == null) { Ioc.getIoc().getLogger().e(object.getClass().getSimpleName() + " 的网络请求配置不能为空\n"); return; } config.setMethod(method); config.setRequest_type(InternetConfig.request_webserver); AjaxCallBack callBack = new AjaxCallBack() { @Override public void callBack(ResponseEntity status) { http_inject(status, object, config); } @Override public boolean stop() { return isDestory(object); } }; new Thread(new AjaxTask(url, params, config, callBack)).start(); }
/** @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(); } }
/** * @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; } }
// 过滤精准未支付订单 private void installData(List<OrdrDetail> list) { if (group != null) group.clear(); else group = new ArrayList<>(); if (null != list) { for (int i = 0; i < list.size(); i++) { OrdrDetail od = list.get(i); // 只获取 精准订单 if ("0".equals(od.getOrderType()) && OrderStateEnum.notPay.getCode().equals(od.getStatus())) { group.add(od); } } } if (group.size() > 0) { initToolBar(); } else { rl_tools.setVisibility(View.GONE); DbUtils db = Ioc.getIoc().getDb("/sdcard/MTM/", Constants.APP_DATABASE); db.deleteAll(SubmittedOrderEntity.class); // 获取当前未支付订单数量 postMsgCount(group.size()); } oca.notifyDataSetChanged(); }
/** * 取消这个imageview所对应的任务 * * @param imageView */ public static void cancelWork(ImageView imageView) { final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView); if (bitmapWorkerTask != null) { bitmapWorkerTask.cancel(true); final Object bitmapData = bitmapWorkerTask.mData; Ioc.getIoc().getLogger().d("cancelWork - cancelled work for " + bitmapData); } }
private String getOrderId() { String orderIdList = ""; Selector selector = Selector.from(SubmittedOrderEntity.class); selector.select(" * "); List<SubmittedOrderEntity> list = Ioc.getIoc().getDb("/sdcard/MTM/", Constants.APP_DATABASE).findAll(selector); if (list != null) { for (int i = 0; i < list.size(); i++) { if (i == (list.size() - 1)) { orderIdList += list.get(i).getOrderId(); } else { orderIdList += list.get(i).getOrderId() + ","; } } } Ioc.getIoc().getLogger().d("OrderId list :" + orderIdList); return orderIdList; }
@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(); } }
@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); } }
/** 取消订单接口 */ private void cancelOrder() { showDialog(); JsonObject jsonParam = new JsonObject(); jsonParam.addProperty("orderNoList", group.get(groupPosition).getOrderNoGroup()); Ioc.getIoc().getLogger().i("取消预订接口参数:" + jsonParam.toString()); InternetConfig config = new InternetConfig(); config.setKey(27); FastHttpHander.ajaxString( Url.HOTELRESERVE_ACCURATE_CLEARRESERVE, jsonParam.toString(), config, this); }
// 获取会员信息 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); }
/** @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(); }
/** * 异步 post异步获取 有参数 自定义下载配置 * * @param url 请求连接 * @param jsonParams 请求参数 jsonString * @param config 请求配置 * @param object 回调函数 * @return void * @author mars 2013-5-20 下午2:54:08 */ public static void ajaxString( String url, String jsonParams, final InternetConfig config, final Object object) { // String selectUrl = Handler_SharedPreferences.getValueByName((Context) object, "url", // "url", Handler_SharedPreferences.STRING); DbUtils db = Ioc.getIoc().getDb("/sdcard/MTM/", Constants.APP_DATABASE); Selector selector = Selector.from(UrlDbModel.class); selector.select(" * "); String furl; try { UrlDbModel urlmodel = db.findById(UrlDbModel.class, "serviceUrl"); if (null == urlmodel || Handler_String.isNull(urlmodel.getUrl())) { furl = url.replace("_ip_", "mws.mymhotel.com/"); } else { String selectUrl = urlmodel.getUrl(); Ioc.getIoc().getLogger().d("ddddddddddddd-" + selectUrl); furl = url.replace("_ip_", selectUrl); } } catch (Exception e) { Ioc.getIoc().getLogger().i("获取数据库文件错误,修正因不能正确获取网络地址出现的异常"); furl = url.replace("_ip_", "mws.mymhotel.com/"); Ioc.getIoc().getLogger().e(e); } config.setRequest_type(InternetConfig.request_post); AjaxCallBack callBack = new AjaxCallBack() { @Override public void callBack(ResponseEntity status) { http_inject(status, object, config); } @Override public boolean stop() { return false; } }; new Thread(new AjaxTask(furl, jsonParams, config, callBack)).start(); }
/** 自动验证成功的方法 */ @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); }
public void OnEventChange() { hotelCode = Handler_SharedPreferences.getValueByName( getActivity(), "hotel", "hotelcode", Handler_SharedPreferences.STRING); Ioc.getIoc().getLogger().e(" OnEventChange hotelCode:" + hotelCode); if ("2".equals(hotelCode)) { // 三亚 home_page.setBackgroundResource(R.drawable.home_page); jzyd.setBackgroundResource(R.drawable.hotel_back); } else { home_page.setBackgroundResource(R.drawable.hotel_page_qd); jzyd.setBackgroundResource(R.drawable.qingdao_bj); } }
/** * *********************************************** @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(); } }
/** * * * <h1>第一步</h1> * * 根据imageView获取到AsyncDrawable<br> * * <h1>第二步</h1> * * 从AsyncDrawable获得BitmapWorkerTask<br> * * <h1>第三步</h1> * * 根据BitmapWorkerTask中的url判断当前下载的url和之前是否一样<br> * 如果一样则返回false无需再下载<br> * * <h1>第四步</h1> * * 如果不一样则说明 当前imageview需要显示的图片和之前图片不一样,取消之前下载进程 返回true */ public static boolean cancelPotentialWork(Object data, ImageView imageView) { final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView); if (bitmapWorkerTask != null) { final Object bitmapData = bitmapWorkerTask.mData; // 判断当前的Url和之前的url是否一样 if (bitmapData == null || !bitmapData.equals(data)) { bitmapWorkerTask.cancel(true); Ioc.getIoc().getLogger().d("cancelPotentialWork - cancelled work for " + data); } else { return false; } } return true; }
/** * ********************************************** * * @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(); }
/** 图片下载完成以后,调用imageview进行绘制 */ @Override protected void onPostExecute(BitmapDrawable value) { // 如果取消 或者 被标志位退出 则返回Null if (isCancelled() || mExitTasksEarly) { value = null; } final ImageView imageView = getAttachedImageView(); if (value != null && imageView != null) { if (value.getBitmap() != null) { finish(value.getBitmap(), imageView, lister); } Ioc.getIoc().getLogger().d("onPostExecute - setting bitmap"); setImageDrawable(imageView, value); } if (value == null) { fail(imageView, lister); } }
@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 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 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(); } }
@InjectHttpErr public void fail(ResponseEntity entity) { dismissDialog(); Ioc.getIoc().getLogger().i("登录失败,请检查网络"); Toast.makeText(this, ErrorMsgEnum.NET_ERROR.getName(), Toast.LENGTH_SHORT).show(); }
/** * ********************************************** * * @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(); }
private static void http_inject(ResponseEntity entity, Object object, InternetConfig config) { ArrayList<InjectInvoker> ok = ContextUtils.getHttpOkInvokers(object.getClass(), config.getKey()); if (ok == null) { ok = ContextUtils.getHttpOkInvokers(object.getClass(), ContextUtils.ID_NONE); } ArrayList<InjectInvoker> err = ContextUtils.getHttpErrInvokers(object.getClass(), config.getKey()); if (err == null) { err = ContextUtils.getHttpErrInvokers(object.getClass(), ContextUtils.ID_NONE); } ArrayList<InjectInvoker> arrayList = ContextUtils.getHttpAllInvokers(object.getClass(), config.getKey()); if (arrayList == null) { arrayList = ContextUtils.getHttpAllInvokers(object.getClass(), ContextUtils.ID_NONE); } if (entity.getStatus() == FastHttp.result_ok) { if (ok == null && arrayList == null) { Ioc.getIoc() .getLogger() .e( object.getClass().getSimpleName() + " 的网络请求" + entity.getUrl() + "\nkey为" + entity.getKey() + "没有增加回调方法注释 请检查\n"); return; } if (ok == null) { if (arrayList != null) { for (InjectInvoker injectInvoker : arrayList) { injectInvoker.invoke(object, entity); } } return; } for (InjectInvoker injectInvoker : ok) { injectInvoker.invoke(object, entity); } } else { if (err == null && arrayList == null) { Ioc.getIoc() .getLogger() .e( object.getClass().getSimpleName() + " 的网络请求" + entity.getUrl() + "\nkey为" + entity.getKey() + "没有增加回调方法注释 请检查\n"); return; } if (err == null) { if (arrayList != null) { for (InjectInvoker injectInvoker : arrayList) { injectInvoker.invoke(object, entity); } } return; } for (InjectInvoker injectInvoker : err) { injectInvoker.invoke(object, entity); } } }
@Override public void onReq(BaseReq req) { Ioc.getIoc().getLogger().i("onReq微信结果返回页面:" + Handler_Json.beanToJson(req)); }