|
|
@@ -1,5 +1,6 @@
|
|
|
package com.uas.appworks.activity;
|
|
|
|
|
|
+import android.app.Activity;
|
|
|
import android.content.Intent;
|
|
|
import android.graphics.drawable.AnimationDrawable;
|
|
|
import android.support.v7.widget.AppCompatTextView;
|
|
|
@@ -15,6 +16,7 @@ import android.widget.TextView;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.common.LogUtil;
|
|
|
import com.common.data.CalendarUtil;
|
|
|
import com.common.data.DateFormatUtil;
|
|
|
import com.common.data.JSONUtil;
|
|
|
@@ -23,6 +25,7 @@ import com.core.app.MyApplication;
|
|
|
import com.core.base.activity.BaseMVPActivity;
|
|
|
import com.core.base.presenter.SimplePresenter;
|
|
|
import com.core.base.view.SimpleView;
|
|
|
+import com.core.utils.time.wheel.OASigninPicker;
|
|
|
import com.core.widget.arcmenu.ArcMenu;
|
|
|
import com.me.network.app.base.HttpParams;
|
|
|
import com.me.network.app.http.Method;
|
|
|
@@ -62,6 +65,7 @@ public class TimeHelperActivity extends BaseMVPActivity<SimplePresenter> impleme
|
|
|
private View mEmptyView;
|
|
|
private AppCompatTextView mEmptyTextView;
|
|
|
private TextView mDateTextView;
|
|
|
+ private String mCurrentDate, mFormatDate;
|
|
|
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
|
@@ -133,6 +137,16 @@ public class TimeHelperActivity extends BaseMVPActivity<SimplePresenter> impleme
|
|
|
.putExtra(Constants.Intents.MODEL, schedule), 0x33);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ mDateTextView.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ String[] dates = mFormatDate.split("-");
|
|
|
+ if (dates != null && dates.length >= 3) {
|
|
|
+ showDateDialog(dates[0], dates[1], dates[2]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
private Schedule getSchedule(TimeHelperBean timeHelperBean, boolean isUU) {
|
|
|
@@ -192,15 +206,19 @@ public class TimeHelperActivity extends BaseMVPActivity<SimplePresenter> impleme
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- String currentDate = DateFormatUtil.long2Str(System.currentTimeMillis(), "MM月dd日");
|
|
|
- String currentWeek = CalendarUtil.getWeek(System.currentTimeMillis());
|
|
|
- mDateTextView.setText(currentDate + "(" + currentWeek + ")");
|
|
|
+ mCurrentDate = DateFormatUtil.long2Str(System.currentTimeMillis(), "yyyy年MM月dd日");
|
|
|
+ mFormatDate = DateFormatUtil.long2Str(System.currentTimeMillis(), DateFormatUtil.YMD);
|
|
|
+ String currentWeek = CalendarUtil.getWeek(mFormatDate);
|
|
|
+ mDateTextView.setText(mCurrentDate + "(" + currentWeek + ")");
|
|
|
|
|
|
- getByDaySchedule(DateFormatUtil.long2Str(System.currentTimeMillis(), DateFormatUtil.YMD));
|
|
|
+ getByDaySchedule(mFormatDate);
|
|
|
}
|
|
|
|
|
|
private void getByDaySchedule(String day) {
|
|
|
- mPresenter.httpRequest(mContext, "https://mobile.ubtob.com:8443/",
|
|
|
+ mPresenter.httpRequest(mContext,
|
|
|
+// "https://mobile.ubtob.com:8443/"
|
|
|
+ "http://192.168.253.230:8080/"
|
|
|
+ ,
|
|
|
new HttpParams.Builder()
|
|
|
.url("schedule/schedule/getByDaySchedule")
|
|
|
.method(Method.GET)
|
|
|
@@ -216,6 +234,7 @@ public class TimeHelperActivity extends BaseMVPActivity<SimplePresenter> impleme
|
|
|
switch (what) {
|
|
|
case FLAG_GETBYDAY_SCHEDULE:
|
|
|
if (JSONUtil.validate(result)) {
|
|
|
+ LogUtil.prinlnLongMsg("getbyday", result);
|
|
|
mTimeHelperBeans.clear();
|
|
|
JSONObject resultObject = JSON.parseObject(result);
|
|
|
JSONArray dataArray = resultObject.getJSONArray("data");
|
|
|
@@ -264,6 +283,7 @@ public class TimeHelperActivity extends BaseMVPActivity<SimplePresenter> impleme
|
|
|
timeHelperBean.setWarnRealTime(JSONUtil.getText(dataObject, "warnRealTime"));
|
|
|
timeHelperBean.setAddress(JSONUtil.getText(dataObject, "address"));
|
|
|
timeHelperBean.setStatus(JSONUtil.getInt(dataObject, "status"));
|
|
|
+ timeHelperBean.setDetail(JSONUtil.getText(dataObject, "details"));
|
|
|
int genre = JSONUtil.getInt(dataObject, "genre");
|
|
|
timeHelperBean.setScheduleType(genre);
|
|
|
if (genre == 1) {
|
|
|
@@ -309,6 +329,7 @@ public class TimeHelperActivity extends BaseMVPActivity<SimplePresenter> impleme
|
|
|
timeHelperBean.setWarnRealTime(DateFormatUtil.long2Str(schedule.getWarnRealTime(), DateFormatUtil.YMD_HMS));
|
|
|
timeHelperBean.setAddress(schedule.getAddress());
|
|
|
timeHelperBean.setStatus(0);
|
|
|
+// timeHelperBean.setDetail(sche);
|
|
|
timeHelperBean.setScheduleType(2);
|
|
|
timeHelperBean.setFromWhere(Schedule.TYPE_PHONE);
|
|
|
|
|
|
@@ -383,9 +404,9 @@ public class TimeHelperActivity extends BaseMVPActivity<SimplePresenter> impleme
|
|
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
if (requestCode == 0x01 || requestCode == 0x02 || requestCode == 0x03) {
|
|
|
- getByDaySchedule(DateFormatUtil.long2Str(System.currentTimeMillis(), DateFormatUtil.YMD));
|
|
|
+ getByDaySchedule(mFormatDate);
|
|
|
} else if ((requestCode == 0x33 || requestCode == 0x11) && resultCode == 0x11) {
|
|
|
- getByDaySchedule(DateFormatUtil.long2Str(System.currentTimeMillis(), DateFormatUtil.YMD));
|
|
|
+ getByDaySchedule(mFormatDate);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -406,4 +427,124 @@ public class TimeHelperActivity extends BaseMVPActivity<SimplePresenter> impleme
|
|
|
super.onDestroy();
|
|
|
mAnimationDrawable.stop();
|
|
|
}
|
|
|
+
|
|
|
+/* private void toDetailActivty(TimeHelperBean timeHelperBean) throws Exception {
|
|
|
+ if ("个人预约".equals(timeHelperBean.getType())) {
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ BookingModel model = getBookingModelByString(timeHelperBean.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(timeHelperBean.getType())) {
|
|
|
+ BookingModel mBookingModel = getBookingModelByString(timeHelperBean.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, timeHelperBean), 0x11);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ 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;
|
|
|
+ }*/
|
|
|
+
|
|
|
+ private void showDateDialog(String year, String month, String day) {
|
|
|
+ OASigninPicker picker = new OASigninPicker((Activity) mContext, 2000, 2030);
|
|
|
+ picker.setRange(2030, 12, 31);
|
|
|
+ try {
|
|
|
+ picker.setSelectedItem(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day));
|
|
|
+ } catch (Exception e) {
|
|
|
+ picker.setSelectedItem(CalendarUtil.getYear(), CalendarUtil.getMonth(), CalendarUtil.getDay());
|
|
|
+ }
|
|
|
+ picker.setOnDateTimePickListener(new OASigninPicker.OnDateTimePickListener() {
|
|
|
+ @Override
|
|
|
+ public void setTime(String year, String month, String day) {
|
|
|
+ mCurrentDate = year + "年" + month + "月" + day;
|
|
|
+ mFormatDate = year + "-" + month + "-" + day;
|
|
|
+
|
|
|
+ String currentWeek = CalendarUtil.getWeek(mFormatDate);
|
|
|
+ mDateTextView.setText(mCurrentDate + "(" + currentWeek + ")");
|
|
|
+
|
|
|
+ getByDaySchedule(mFormatDate);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ picker.show();
|
|
|
+ }
|
|
|
}
|