|
|
@@ -9,10 +9,15 @@ import android.widget.Button;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
+import android.widget.Toast;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.android.volley.AuthFailureError;
|
|
|
+import com.android.volley.Request;
|
|
|
+import com.android.volley.Response;
|
|
|
+import com.android.volley.VolleyError;
|
|
|
import com.common.LogUtil;
|
|
|
import com.common.config.BaseConfig;
|
|
|
import com.common.data.DateFormatUtil;
|
|
|
@@ -24,11 +29,14 @@ import com.core.app.MyApplication;
|
|
|
import com.core.base.OABaseActivity;
|
|
|
import com.core.model.SelectBean;
|
|
|
import com.core.net.utils.NetUtils;
|
|
|
+import com.core.net.volley.ObjectResult;
|
|
|
+import com.core.net.volley.StringJsonObjectRequest;
|
|
|
import com.core.utils.CommonUtil;
|
|
|
import com.core.utils.ToastUtil;
|
|
|
import com.core.utils.helper.AvatarHelper;
|
|
|
import com.core.widget.view.Activity.SelectActivity;
|
|
|
import com.core.widget.view.selectcalendar.SelectCalendarActivity;
|
|
|
+import com.core.xmpp.model.AddAttentionResult;
|
|
|
import com.me.network.app.http.HttpClient;
|
|
|
import com.me.network.app.http.Method;
|
|
|
import com.me.network.app.http.rx.ResultListener;
|
|
|
@@ -578,7 +586,7 @@ public class BServiceAddActivity extends OABaseActivity implements View.OnClickL
|
|
|
}
|
|
|
submiting = true;
|
|
|
progressDialog.show();
|
|
|
- Map<String, Object> map = getServiceMap();
|
|
|
+ final Map<String, Object> map = getServiceMap();
|
|
|
if (map == null) {
|
|
|
LogUtil.i("map == null");
|
|
|
submiting = false;
|
|
|
@@ -607,19 +615,25 @@ public class BServiceAddActivity extends OABaseActivity implements View.OnClickL
|
|
|
.build(), new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
@Override
|
|
|
public void onResponse(Object o) {
|
|
|
- LogUtil.d("result", "result:" + o.toString());
|
|
|
- progressDialog.dismiss();
|
|
|
- submiting = true;
|
|
|
- //{"result":"true"}
|
|
|
- if (JSONUtil.validate(o.toString())) {
|
|
|
- String result = JSON.parseObject(o.toString()).getString("result");
|
|
|
- if ("true".equals(result)) {
|
|
|
- Intent intent = new Intent("com.modular.booking.BookingListActivity");
|
|
|
- intent.putExtra("curDate", startTime == null ? "" : startTime);
|
|
|
- startActivity(intent);
|
|
|
- } else {
|
|
|
- ToastMessage(getString(R.string.save_failed));
|
|
|
+ try {
|
|
|
+ LogUtil.d("result", "result:" + o.toString());
|
|
|
+ progressDialog.dismiss();
|
|
|
+ submiting = true;
|
|
|
+ //{"result":"true"}
|
|
|
+ if (JSONUtil.validate(o.toString())) {
|
|
|
+ String result = JSON.parseObject(o.toString()).getString("result");
|
|
|
+ if ("true".equals(result)) {
|
|
|
+ //发送短信
|
|
|
+ invite(map.get("sb_telephone").toString(), "8636ba7f-a1b4-4062-8571-782035101167");
|
|
|
+ Intent intent = new Intent("com.modular.booking.BookingListActivity");
|
|
|
+ intent.putExtra("curDate", startTime == null ? "" : startTime);
|
|
|
+ startActivity(intent);
|
|
|
+ } else {
|
|
|
+ ToastMessage(getString(R.string.save_failed));
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -1049,4 +1063,45 @@ public class BServiceAddActivity extends OABaseActivity implements View.OnClickL
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private void invite(String user, final String modeid) {
|
|
|
+ final String name = CommonUtil.getName();
|
|
|
+ final String phone = user.trim().replaceAll(" ", "");
|
|
|
+ if (!StringUtil.isMobileNumber(phone)) {
|
|
|
+ showToast("选择人员电话号码为空或是格式不正确", R.color.load_submit);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ StringJsonObjectRequest<AddAttentionResult> request = new StringJsonObjectRequest<AddAttentionResult>(
|
|
|
+ Request.Method.POST, "http://message.ubtob.com/sms/send", new Response.ErrorListener() {
|
|
|
+ @Override
|
|
|
+ public void onErrorResponse(VolleyError arg0) {
|
|
|
+ dimssLoading();
|
|
|
+ }
|
|
|
+ }, new StringJsonObjectRequest.Listener<AddAttentionResult>() {
|
|
|
+ @Override
|
|
|
+ public void onResponse(ObjectResult<AddAttentionResult> result) {
|
|
|
+ // showToast("短信发送成功", R.color.load_submit);
|
|
|
+ //ToastUtil.showToast(MyApplication.getInstance(),"短信发送成功");
|
|
|
+ Toast.makeText(MyApplication.getInstance(),"短信发送成功",Toast.LENGTH_SHORT).show();
|
|
|
+
|
|
|
+ }
|
|
|
+ }, AddAttentionResult.class, null) {
|
|
|
+ @Override
|
|
|
+ public byte[] getBody() throws AuthFailureError {
|
|
|
+ String param = "{\"receiver\":\"" + phone + "\",\"params\":[\"" + name + "\"],\"templateId\":\"" + modeid + "\"}";
|
|
|
+ LogUtil.i("param=" + param);
|
|
|
+ return param.getBytes();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, String> getHeaders() {
|
|
|
+ HashMap<String, String> headers = new HashMap<String, String>();
|
|
|
+ headers.put("Accept", "application/json");
|
|
|
+ headers.put("Content-Type", "application/json; charset=UTF-8");
|
|
|
+ return headers;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ MyApplication.getInstance().getFastVolley().addDefaultRequest("Volley", request);
|
|
|
+ }
|
|
|
}
|