|
|
@@ -2,6 +2,7 @@ package com.uas.appworks.activity;
|
|
|
|
|
|
import android.content.Intent;
|
|
|
import android.graphics.Color;
|
|
|
+import android.os.Bundle;
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
import android.text.TextUtils;
|
|
|
@@ -22,6 +23,8 @@ import com.common.data.JSONUtil;
|
|
|
import com.common.data.ListUtils;
|
|
|
import com.common.data.StringUtil;
|
|
|
import com.core.app.MyApplication;
|
|
|
+import com.core.utils.CommonUtil;
|
|
|
+import com.core.utils.ToastUtil;
|
|
|
import com.modular.apputils.activity.BaseNetActivity;
|
|
|
import com.modular.apputils.listener.OnSmartHttpListener;
|
|
|
import com.modular.apputils.network.Parameter;
|
|
|
@@ -29,6 +32,9 @@ import com.modular.apputils.network.Tags;
|
|
|
import com.modular.apputils.widget.compactcalender.CompactCalendarView;
|
|
|
import com.modular.apputils.widget.compactcalender.Lunar;
|
|
|
import com.modular.apputils.widget.compactcalender.domain.Event;
|
|
|
+import com.modular.booking.activity.services.BServiceAddActivity;
|
|
|
+import com.modular.booking.model.BookingModel;
|
|
|
+import com.modular.booking.model.SBListModel;
|
|
|
import com.uas.appworks.R;
|
|
|
import com.uas.appworks.datainquiry.Constants;
|
|
|
import com.uas.appworks.model.Schedule;
|
|
|
@@ -85,7 +91,7 @@ public class ScheduleActivity extends BaseNetActivity {
|
|
|
|
|
|
@Override
|
|
|
protected String getBaseUrl() {
|
|
|
- return "https://mobile.ubtob.com:8443/schedule/";
|
|
|
+ return CommonUtil.getSchedulerBaseUrl();
|
|
|
}
|
|
|
|
|
|
private void initView() {
|
|
|
@@ -156,7 +162,7 @@ public class ScheduleActivity extends BaseNetActivity {
|
|
|
requestHttp(new Parameter.Builder()
|
|
|
.addParams("imid", MyApplication.getInstance().getLoginUserId())
|
|
|
.addParams("day", dateStr)
|
|
|
- .url("schedule/byDaySchedule")
|
|
|
+ .url("schedule/getByDaySchedule")
|
|
|
.record(LOAD_DAY)
|
|
|
, mOnSmartHttpListener);
|
|
|
}
|
|
|
@@ -175,7 +181,7 @@ public class ScheduleActivity extends BaseNetActivity {
|
|
|
break;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- LogUtil.i("gong","e="+e.getMessage());
|
|
|
+ LogUtil.i("gong", "e=" + e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -219,8 +225,9 @@ public class ScheduleActivity extends BaseNetActivity {
|
|
|
chche.setWarnTime(JSONUtil.getInt(object, "warnTime"));
|
|
|
chche.setAddress(JSONUtil.getText(object, "address"));
|
|
|
chche.setStatus(JSONUtil.getText(object, "status"));
|
|
|
+ chche.setDetails(JSONUtil.getText(object, "details"));
|
|
|
schedules.add(chche);
|
|
|
- if (!ListUtils.isEmpty(systemSchedule)){
|
|
|
+ if (!ListUtils.isEmpty(systemSchedule)) {
|
|
|
for (Schedule e : systemSchedule) {
|
|
|
if (e.getId() == chche.getId()) {
|
|
|
systemSchedule.remove(e);
|
|
|
@@ -328,15 +335,78 @@ public class ScheduleActivity extends BaseNetActivity {
|
|
|
private View.OnClickListener mOnClickListener = new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
- if (view.getTag() != null && view.getTag() instanceof Schedule) {
|
|
|
- Schedule mSchedule = (Schedule) view.getTag();
|
|
|
- startActivityForResult(new Intent(ct, SchedulerCreateActivity.class)
|
|
|
- .putExtra(Constants.Intents.ENABLE, false)
|
|
|
- .putExtra(Constants.Intents.MODEL, mSchedule), 0x11);
|
|
|
+ try {
|
|
|
+ if (view.getTag() != null && view.getTag() instanceof Schedule) {
|
|
|
+ Schedule mSchedule = (Schedule) view.getTag();
|
|
|
+ toDetailActivty(mSchedule);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ private void toDetailActivty(Schedule mSchedule) throws Exception {
|
|
|
+ if ("个人预约".equals(mSchedule.getType())) {
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ BookingModel model = getBookingModelByString(mSchedule.getDetails());
|
|
|
+ if (model==null){
|
|
|
+ ToastUtil.showToast(ct,R.string.error_message);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ bundle.putParcelable("model", model);
|
|
|
+ startActivity(new Intent("com.modular.booking.BookingDetailActivity")
|
|
|
+ .putExtras(bundle));
|
|
|
+ } else if ("商务预约".equals(mSchedule.getType())) {
|
|
|
+ BookingModel mBookingModel = getBookingModelByString(mSchedule.getDetails());
|
|
|
+ if (mBookingModel==null){
|
|
|
+ ToastUtil.showToast(ct,R.string.error_message);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ SBListModel model = new SBListModel();
|
|
|
+ model.setId(Integer.valueOf(mBookingModel.getAb_id()));
|
|
|
+ model.setAddress(mBookingModel.getAb_address());
|
|
|
+ model.setType(mBookingModel.getAb_content());//行业关键代码
|
|
|
+ model.setIndustrycode(mBookingModel.getAb_content());
|
|
|
+ model.setEndtime(mBookingModel.getAb_endtime());
|
|
|
+ model.setName(mBookingModel.getAb_bman());
|
|
|
+ startActivity(new Intent(ct, BServiceAddActivity.class)
|
|
|
+ .putExtra("model", model)
|
|
|
+ .putExtra("isEdited", false)
|
|
|
+ .putExtra("dataService", mBookingModel.getData_service()));
|
|
|
+ } else {
|
|
|
+ startActivityForResult(new Intent(ct, SchedulerCreateActivity.class)
|
|
|
+ .putExtra(Constants.Intents.ENABLE, false)
|
|
|
+ .putExtra(Constants.Intents.MODEL, mSchedule), 0x11);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private BookingModel getBookingModelByString(String json) throws Exception {
|
|
|
+ JSONArray array = JSON.parseArray(json);
|
|
|
+ if (!ListUtils.isEmpty(array)){
|
|
|
+ JSONObject object =array.getJSONObject(0);
|
|
|
+ BookingModel model = new BookingModel();
|
|
|
+ model.setAb_id(JSONUtil.getText(object, "ab_id"));
|
|
|
+ model.setAb_bman(JSONUtil.getText(object, "ab_bman"));
|
|
|
+ model.setAb_bmanid(JSONUtil.getText(object, "ab_bmanid"));
|
|
|
+ model.setAb_starttime(JSONUtil.getText(object, "ab_starttime"));
|
|
|
+ model.setAb_endtime(JSONUtil.getText(object, "ab_endtime"));
|
|
|
+ model.setAb_recorddate(JSONUtil.getText(object, "ab_recorddate"));
|
|
|
+ model.setAb_recordid(JSONUtil.getText(object, "ab_recordid"));
|
|
|
+ model.setAb_recordman(JSONUtil.getText(object, "ab_recordman"));
|
|
|
+ model.setAb_content(JSONUtil.getText(object, "ab_content"));
|
|
|
+ model.setAb_confirmstatus(JSONUtil.getText(object, "ab_confirmstatus"));
|
|
|
+ model.setAb_sharestatus(JSONUtil.getText(object, "ab_sharestatus"));
|
|
|
+ model.setAb_address(JSONUtil.getText(object, "ab_address"));
|
|
|
+ model.setAb_longitude(JSONUtil.getText(object, "ab_longitude"));
|
|
|
+ model.setAb_latitude(JSONUtil.getText(object, "ab_latitude"));
|
|
|
+ model.setAb_type(JSONUtil.getText(object, "ab_type"));
|
|
|
+ model.setAb_reason(JSONUtil.getText(object, "ab_reason"));
|
|
|
+ model.setAd_reason(JSONUtil.getText(object, "ab_reason"));
|
|
|
+ return model;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public int getItemCount() {
|
|
|
return ListUtils.getSize(mSchedules) + 1;
|
|
|
@@ -359,7 +429,6 @@ public class ScheduleActivity extends BaseNetActivity {
|
|
|
contentTv = (TextView) itemView.findViewById(R.id.contentTv);
|
|
|
typeTv = (TextView) itemView.findViewById(R.id.typeTv);
|
|
|
tagTv = (TextView) itemView.findViewById(R.id.tagTv);
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|