use of com.yuxuan.admin.expression.entity.UserDqInfomation in project expression by happy-yuxuan.
the class UMyOrdersActivity method dealResult.
private void dealResult() {
L.i("da_phone = " + tv_phone.getText().toString());
L.i("addr = " + tv_addr.getText().toString());
List<BmobQuery<UserDqInfomation>> queries = new ArrayList<BmobQuery<UserDqInfomation>>();
BmobQuery<UserDqInfomation> q1 = new BmobQuery<UserDqInfomation>();
q1.addWhereEqualTo("dq_phone", tv_phone.getText().toString());
BmobQuery<UserDqInfomation> q2 = new BmobQuery<UserDqInfomation>();
q2.addWhereEqualTo("addr", tv_addr.getText().toString());
BmobQuery<UserDqInfomation> q3 = new BmobQuery<UserDqInfomation>();
BmobUser user = MyUser.getCurrentUser();
String username = user.getUsername();
q3.addWhereEqualTo("username", username);
queries.add(q1);
queries.add(q2);
queries.add(q3);
// 找到objId
BmobQuery<UserDqInfomation> query = new BmobQuery<UserDqInfomation>();
query.and(queries);
// 执行查询方法 获得 objId
query.findObjects(new FindListener<UserDqInfomation>() {
@Override
public void done(List<UserDqInfomation> object, BmobException e) {
if (e == null) {
UserDqInfomation udi = new UserDqInfomation();
udi.setSuccess(true);
// 执行更新方法
udi.update(object.get(0).getObjectId(), new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
L.i(" success 更新成功");
displayList.dismiss();
queryData();
Toast.makeText(UMyOrdersActivity.this, "代取成功,我们将一直为您服务", Toast.LENGTH_SHORT).show();
} else {
L.i("bmob 更新失败:" + e.getMessage() + "," + e.getErrorCode());
Toast.makeText(UMyOrdersActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
} else {
L.i("query dq_phone at UMyOrderActivity 失败:" + e.getMessage() + "," + e.getErrorCode());
Toast.makeText(UMyOrdersActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
use of com.yuxuan.admin.expression.entity.UserDqInfomation 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.UserDqInfomation in project expression by happy-yuxuan.
the class KDDQInfomationActivity method addInfo.
// 将数据保存到数据库(Bmob) ?????
private void addInfo() {
String phoneNumber = et_phoneNumber.getText().toString().trim();
String name = et_name.getText().toString().trim();
String addr = et_addr.getText().toString().trim();
String status = et_status.getText().toString().trim();
String other = et_other.getText().toString().trim();
// 获取代取用户的手机号,即送件人
String dq_phone = getIntent().getStringExtra("dq_phone");
BmobUser user = MyUser.getCurrentUser();
String username = user.getUsername();
UserDqInfomation DqInfo = new UserDqInfomation();
DqInfo.setUsername(username);
DqInfo.setPhone(phoneNumber);
DqInfo.setName(name);
DqInfo.setAddr(addr);
DqInfo.setStatus(status);
DqInfo.setOther(other);
DqInfo.setSuccess(false);
if (!TextUtils.isEmpty(dq_phone)) {
DqInfo.setDq_phone(dq_phone);
}
DqInfo.save(new SaveListener<String>() {
@Override
public void done(String objectId, BmobException e) {
if (e == null) {
// Toast.makeText(KDDQInfomationActivity.this, "创建数据成功:" + objectId, Toast.LENGTH_SHORT).show();
L.i("添加ok");
dialog.dismiss();
new AlertDialog.Builder(KDDQInfomationActivity.this).setTitle("注意").setMessage("代取信息填写成功\n请到 '我的订单' 中查看详细信息\n我们稍后联系您,请保持信息畅通").setPositiveButton("我的订单?", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
startActivity(new Intent(KDDQInfomationActivity.this, UMyOrdersActivity.class));
finish();
}
}).setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).show();
} else {
L.i("代取信息添加失败:" + e.getMessage());
Toast.makeText(KDDQInfomationActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
use of com.yuxuan.admin.expression.entity.UserDqInfomation 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