public void getDatas() { AjaxParams params = new AjaxParams(); params.put( "userid", SharedPreferencesUtils.getString(MyTificationBankActivity.this, "userid", null)); params.put("imei", AppConfig.getIMEI(MyTificationBankActivity.this)); params.put("androidid", AppConfig.getAndroidId(MyTificationBankActivity.this)); params.put( "mobileno", SharedPreferencesUtils.getString(MyTificationBankActivity.this, "mobileno", null)); FinalHttp fh = new FinalHttp(); fh.get( InternetURL.USER_BANK_RENZHENG_READ, params, new AjaxCallBack<String>() { @Override public void onFailure(Throwable t, int errorNo, String strMsg) { super.onFailure(t, errorNo, strMsg); ToastUtil.show(MyTificationBankActivity.this, "读取银行卡信息失败"); Log.i("mytag", "strMsg==" + strMsg); } @Override public void onSuccess(String t) { super.onSuccess(t); ToastUtil.show(MyTificationBankActivity.this, "读取银行卡信息成功,占无数据"); } }); }
/** * 获取服务指定小区列表的相关厂家客服人员列表 * * @param subdisIds 小区编号,多个的话逗号分隔 * @param callBack */ public void getSellSupportsByPowner( String subdisIds, NetProcessor.QueryRsProcessor<Human> callBack) { AjaxParams params = new AjaxParams(); params.put("subdisIds", subdisIds); // 兼容老的服务器端,后面可以去掉 String[] segs = StringUtils.splitByWholeSeparator(subdisIds, ","); params.put("subdisId", segs[0]); super.query(params, callBack, "/priv/subdist/sellSupports"); }
public List<EntityWrapper<Human>> listAllEmpHumanIdOfPmcId(Long userId, String roleType) { AjaxParams params = new AjaxParams(); params.put("userId", userId.toString()); params.put("roleType", roleType); String result = (String) NetFactory.getHttp() .postSync(NetFactory.getServerUrl() + "/pmcAdmin/listAllEmpHumanIdOfPmcId", params); List<EntityWrapper<Human>> humans = JsonParser.parseArray(result, Human.class); return humans; }
/** * 获取楼管员管辖的业主human列表 * * @param userId 楼管员用户号 * @param subdisId 小区号,过滤作用,可以为null * @param updatedDate 更新日期 * @param callBack */ public void getPownerOfApartManager( Long userId, String subdisId, NetProcessor.QueryRsProcessor<Human> callBack, String... updatedDate) { AjaxParams params = new AjaxParams(); params.put("userId", userId.toString()); if (subdisId != null) params.put("subdisId", subdisId); if (updatedDate != null && updatedDate.length > 0) params.put("startCursor", updatedDate[0]); // callBack.setPageInfo(new PageInfo(0, 100)); // params.put("pageInfo", new PageInfo(0, 100).toString()); super.query(params, callBack, "/priv/subdist/powners"); }
/** 取消订单 */ public void CancelOrder(int orderId) { /** *** 1 /order/cancel取消订单 2/order/delete删除订单 ***** */ showDialog(); final FinalHttp fh = new FinalHttp(); fh.addHeader("Cookie", ParserUtil.getCookieValue(PreferencesUtil.getAuthToken())); AjaxParams ajaxParams = new AjaxParams(); // 订单类型 ajaxParams.put("orderId", orderId + ""); fh.post( ResourceConfigManager.RELEASE_DOMAIN_HOST + "/order/cancel", ajaxParams, new AjaxCallBack<String>() { @Override public void onSuccess(String content) { closeDialog(); Log.e("取消订单******", "content:" + content); if (content != null) { try { JSONObject jsonObject = new JSONObject(content); if (jsonObject.optString("msg").equals("success")) { handler.sendEmptyMessage(STSTE); if (LineTeachOrderActivity.lineTeachOrderActivity != null) { LineTeachOrderActivity.lineTeachOrderActivity.handler.sendEmptyMessage(STSTE); } WidgetUtil.ToastMessage(BallParkOrderDetailsActivity.this, "取消订单成功!"); BookSuccessActivity.orderStatus = orderStatus_2; // 订单取消成功后状态变为2(已取消) BookSuccessActivity.isCancel = true; // 订单取消成功后状态变为2(已取消) order_status_tv.setText("已取消"); isCancelSuccess = true; } else { WidgetUtil.ToastMessage(BallParkOrderDetailsActivity.this, "取消订单失败!"); } } catch (JSONException e) { e.printStackTrace(); } } } @Override public void onFailure(Throwable t, int errorNo, String strMsg) { closeDialog(); Log.e("取消订单*******", "errorNo:" + errorNo + "strMsg:" + strMsg); } }); }
public List<EntityWrapper<Human>> getSellSupportsByPowner(String subdisIds, String roleType) { AjaxParams params = new AjaxParams(); params.put("subdisIds", subdisIds); params.put("roleType", roleType); if (TextUtils.isEmpty(subdisIds)) { String[] segs = StringUtils.splitByWholeSeparator(subdisIds, ","); params.put("subdisId", segs[0]); } String result = (String) NetFactory.getHttp() .postSync(NetFactory.getServerUrl() + "/priv/subdist/sellSupports", params); List<EntityWrapper<Human>> humans = JsonParser.parseArray(result, Human.class); return humans; }
public void download() { AjaxParams ajaxParams = new AjaxParams(); ajaxParams.put("num", "10"); ajaxParams.put("time", ""); ajaxParams.put("than", ""); ajaxParams.put("orderBy", ""); connectionModel.getDatabyNet( "http://1.onedollar.sinaapp.com/phone/coupon-class-list.action", ajaxParams, new JsonParser() { @Override public void parser(String t) { jsonUtils.parseJsonToEntity(t, handler); } }); }
private void phoneSpw(String phoneVerify, String phone) { String url = Constans.Phone_PwRetrieve; PhoneBean bean = new PhoneBean(); bean.setPhone(phone); bean.setCode(phoneVerify); String jsonstr = JsonHelper.toJsonString(bean); String encodesstr = ""; try { encodesstr = AesUtils.Encrypt(jsonstr, CommonConstants.AES_KEY); // System.out.println(encodesstr); Logger.d("encodesstr", encodesstr); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } AjaxParams params = new AjaxParams(); params.put("cont", encodesstr); params.put("sid", sid); showDialogFragment(false); HttpRespose http = new HttpRespose(url, params); http.request( new HttpCallback() { @Override public void onCallback(Object obj) { if (isFinishing()) return; removeDialogFragment(); if (obj == null || TextUtils.isEmpty((String) obj)) { Toast.makeText(getActivity(), "操作失败", Toast.LENGTH_SHORT).show(); return; } CommonBack back = (CommonBack) ReqJsonUtil.changeToObject((String) obj, CommonBack.class); if (back.getCode() == 00000) { // Toast.makeText(getActivity(), back.getMessage(), Toast.LENGTH_SHORT).show(); Intent intent = new Intent(); intent.putExtra(ShellResetPasswordActivity.EXTRA_SID, sid); ShellUtil.execute(getActivity(), ShellResetPasswordActivity.class, intent); } else { Toast.makeText(getActivity(), back.getMessage(), Toast.LENGTH_SHORT).show(); } } }); }
private void getPhoneCord(String imgCode, String phone) { phoneCordBean bean = new phoneCordBean(); bean.setPhone(phone); bean.setCode(imgCode); bean.setType("0"); String jsonEnc = null; String json = JsonHelper.toJsonString(bean); try { jsonEnc = AesUtils.Encrypt(json, CommonConstants.AES_KEY); } catch (Exception e) { e.printStackTrace(); } AjaxParams params = new AjaxParams(); params.put("cont", jsonEnc); params.put("sid", sid); String url = Constans.get_PhoneCode; showDialogFragment(false); HttpRespose http = new HttpRespose(url, params); http.request( new HttpCallback() { @Override public void onCallback(Object obj) { if (isFinishing()) return; removeDialogFragment(); if (obj == null || TextUtils.isEmpty((String) obj)) { Toast.makeText(getActivity(), "获取手机验证码失败", Toast.LENGTH_SHORT).show(); return; } CommonBack back = (CommonBack) ReqJsonUtil.changeToObject((String) obj, CommonBack.class); if (back.getCode() == 00000) { Toast.makeText(getActivity(), "验证码已发送", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getActivity(), back.getMessage(), Toast.LENGTH_SHORT).show(); } } }); }
/** ** 提交支付方式 *** */ private void PostOrderId(OrderBean orderBean, int payType) { final FinalHttp fh = new FinalHttp(); fh.addHeader("Cookie", ParserUtil.getCookieValue(PreferencesUtil.getAuthToken())); AjaxParams ajaxParams = new AjaxParams(); ajaxParams.put("orderId", orderBean.orderId + ""); ajaxParams.put("payType", payType + ""); fh.post( ResourceConfigManager.RELEASE_DOMAIN_HOST + "/order/updatePayType", ajaxParams, new AjaxCallBack<String>() { @Override public void onSuccess(String json) { Log.e("提交支付方式", "json:" + json); } @Override public void onFailure(Throwable t, int errorNo, String strMsg) { Log.e("提交失败", "json:" + errorNo); } }); }
public List<EntityWrapper<Human>> getPownerOfApartManager( Long userId, String subdisId, String roleType, String... updatedDate) { AjaxParams params = new AjaxParams(); params.put("userId", userId.toString()); if (subdisId != null) params.put("subdisId", subdisId); if (updatedDate != null && updatedDate.length > 0) params.put("startCursor", updatedDate[0]); params.put("page", "1"); params.put("rows", "100000000"); params.put("roleType", roleType); String result = (String) NetFactory.getHttp() .postSync(NetFactory.getServerUrl() + "/priv/subdist/powners", params); List<EntityWrapper<Human>> humans = JsonParser.parseArray(result, Human.class); return humans; }
protected void getData( final Handler handler, final String url, final AjaxParams params, final Type type) { LogUtil.i("cm_netPost", "url==" + url); LogUtil.i("cm_netPost", "params==" + params.toString()); FinalHttpFactory.getFinalHttp() .post( url, params, new AjaxCallBack<Object>() { @Override public void onSuccess(Object t) { Gson gson = new Gson(); String content = t.toString(); if (content != null) { content = content.trim(); } LogUtil.i("cm_netPost", "content==" + content); BaseBean<?> bean = null; if (content != null && !Tools.judgeString(content, "")) { try { bean = gson.fromJson(content, type); } catch (Exception e) { LogUtil.i("cm_netinfo", "Exception1"); e.printStackTrace(); Type defaulType = new TypeToken<BaseBean<?>>() {}.getType(); try { bean = gson.fromJson(content, defaulType); } catch (Exception e1) { LogUtil.i("cm_netinfo", "Exception2"); } } } setHandler(handler, bean, url); } // 异常处理 @Override public void onFailure(Throwable t, int errorNo, String strMsg) { super.onFailure(t, errorNo, strMsg); // ToastUtil.TshowToast("netpost异常" ); setErrorHandler(handler); } }); }
/** 查询所有满分的联系人 */ public void getCompanyList(Long userId, NetProcessor.QueryRsProcessor<Human> callBack) { AjaxParams params = new AjaxParams(); params.put("userId", userId.toString()); super.query(params, callBack, "/companyHuman/listAllHumanIdOfCompanyId"); }
/** * 获取本物业公司内,与当前楼管员的同事信息 * * @param userId * @param callBack */ public void listAllEmpHumanIdOfPmcId(Long userId, NetProcessor.QueryRsProcessor<Human> callBack) { AjaxParams params = new AjaxParams(); params.put("userId", userId.toString()); super.query(params, callBack, "/pmcAdmin/listAllEmpHumanIdOfPmcId"); }
private void checkUpdate(int ver) { AjaxParams params = new AjaxParams(); params.put("action", "version"); params.put("version", ver + ""); getFinalHttp() .post( Constants.ApiUrl.BACKFEED, params, new AjaxCallBack<String>() { @Override public void onStart() { super.onStart(); } @Override public void onSuccess(String t) { try { super.onSuccess(t); String data = ErrorCode.getData(getBaseContext(), t); System.out.println("data:" + data); if (!"1".equals(data)) { String version = JSONObject.parseObject(data).getString("version"); String discription = JSONObject.parseObject(data).getString("discription"); final String down_url = JSONObject.parseObject(data).getString("url"); getPromptDialog().setMessage("检查到有新版本!"); getPromptDialog().setMessage(discription); getPromptDialog().addCannel(); getPromptDialog().setCannelText("不更新"); getPromptDialog() .addCannel( new View.OnClickListener() { @Override public void onClick(View v) { getPromptDialog().cancel(); waitTime = 1000; init(); } }); getPromptDialog().setConfirmText("更新"); getPromptDialog() .addConfirm( new View.OnClickListener() { @Override public void onClick(View v) { getPromptDialog().cancel(); Intent updateIntent = new Intent(MainActivity.this, UpdateService.class); updateIntent.putExtra("url", down_url); updateIntent.putExtra( "app_name", getResources().getString(R.string.app_name)); startService(updateIntent); waitTime = 1000; init(); } }); getPromptDialog().show(); } else { // showToast("获取服务器版本数据失败"); waitTime = 1000; init(); } } catch (Exception e) { waitTime = 1000; init(); } } @Override public void onFailure(Throwable t, String strMsg) { super.onFailure(t, strMsg); getWaitDialog().cancel(); waitTime = 1000; init(); // showToast("服务器响应失败!"); } }); }