/** 未支付订单 */ 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(); } }
/** * 会员未支付订单 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 List<OrderCenterEntity> getNotSubOrder(String startDate, String endDate) { Selector selector = Selector.from(OrderCenterEntity.class); selector.select(" * "); selector.where("startDate", "=", startDate); selector.and("endDate", "=", endDate); List<OrderCenterEntity> list = db.findAll(selector); return list; }
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; }
/** * 异步 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(); }
/** * 获取个人信息 * * @return */ private int getPersonInfo() { Selector selector = Selector.from(PersonalEntity.class); selector.select(" * "); List<PersonalEntity> list = db.findAll(selector); return list != null && list.size() > 0 ? list.size() : 0; }
/** * 获取联系人信息 * * @param orderId * @return */ private List<GuestInfo> getNotSubOrderGuest(String orderId) { DbUtils db = Ioc.getIoc().getDb("/sdcard/MTM/", Constants.APP_DATABASE); Selector selector = Selector.from(GuestInfo.class); selector.select(" * where orderId='" + orderId + "'"); return db.findAll(selector); }