use of com.yuxuan.admin.expression.entity.MyOrdersData in project expression by happy-yuxuan.
the class UMyPaiJianActivity method initData.
// 从bmob获取数据
private void initData() {
dialog.show();
// 查询所有下单代取的用户
BmobQuery<UserDqInfomation> query = new BmobQuery<UserDqInfomation>();
query.addWhereEqualTo("success", false);
query.findObjects(new FindListener<UserDqInfomation>() {
@Override
public void done(List<UserDqInfomation> object, BmobException e) {
if (e == null) {
L.i("queryAllData = " + object.size());
for (final UserDqInfomation u : object) {
String dq_phone = u.getDq_phone();
// 查询当前用户需要派送的用户
BmobQuery<MyUser> q = new BmobQuery<MyUser>();
q.addWhereEqualTo("mobilePhoneNumber", dq_phone);
q.findObjects(new FindListener<MyUser>() {
@Override
public void done(List<MyUser> object, BmobException e) {
dialog.dismiss();
if (e == null) {
MyOrdersData buffer;
String sendUsername = object.get(0).getUsername();
String username = BmobUser.getCurrentUser().getUsername();
L.i(username + "--" + sendUsername);
if (sendUsername.equals(username)) {
String rusername = u.getUsername();
String addr = u.getAddr();
String phone = u.getPhone();
String status = u.getStatus();
String other = u.getOther();
buffer = new MyOrdersData();
buffer.setUsername(rusername);
buffer.setAddr(addr);
buffer.setPhoneNumber(phone);
buffer.setOther(other);
buffer.setStatus(status);
data.add(buffer);
hander.sendEmptyMessage(StaticClass.LOAD_DATA_OK);
}
} else {
L.i("querDqUsername fail:" + e.getMessage());
hander.sendEmptyMessage(StaticClass.LOAD_DATA_FAIL);
Toast.makeText(UMyPaiJianActivity.this, "加载数据失败", Toast.LENGTH_SHORT).show();
}
}
});
}
} else {
L.i("queryteamFlag fail:" + e.getMessage());
hander.sendEmptyMessage(StaticClass.LOAD_DATA_FAIL);
Toast.makeText(UMyPaiJianActivity.this, "加载数据失败", Toast.LENGTH_SHORT).show();
}
}
});
}
use of com.yuxuan.admin.expression.entity.MyOrdersData in project expression by happy-yuxuan.
the class UMyOrdersActivity method queryData.
// 查数据
private void queryData() {
dialog.show();
List<BmobQuery<UserDqInfomation>> queries = new ArrayList<BmobQuery<UserDqInfomation>>();
BmobQuery<UserDqInfomation> q1 = new BmobQuery<UserDqInfomation>();
q1.addWhereEqualTo("success", false);
BmobUser user = MyUser.getCurrentUser();
String username = user.getUsername();
BmobQuery<UserDqInfomation> q2 = new BmobQuery<UserDqInfomation>();
q2.addWhereEqualTo("username", username);
queries.add(q1);
queries.add(q2);
BmobQuery<UserDqInfomation> query = new BmobQuery<UserDqInfomation>();
query.and(queries);
query.findObjects(new FindListener<UserDqInfomation>() {
@Override
public void done(List<UserDqInfomation> object, BmobException e) {
if (e == null) {
if (object.size() == 0) {
handler.sendEmptyMessage(CACHE_DATA_FAIL);
return;
}
data.clear();
L.i("queryData = " + object.size());
MyOrdersData buffer;
for (UserDqInfomation u : object) {
buffer = new MyOrdersData();
buffer.setAddr(u.getAddr());
buffer.setPhoneNumber(u.getDq_phone());
queryUsername(u.getDq_phone(), buffer);
}
} else {
L.i("queryData失败:" + e.getMessage());
handler.sendEmptyMessage(CACHE_DATA_FAIL);
Toast.makeText(UMyOrdersActivity.this, "加载失败", Toast.LENGTH_SHORT).show();
}
}
});
}
Aggregations