|
|
@@ -4,6 +4,7 @@ import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
+import android.view.WindowManager;
|
|
|
import android.widget.Button;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
@@ -22,6 +23,7 @@ import com.core.app.Constants;
|
|
|
import com.core.app.MyApplication;
|
|
|
import com.core.base.OABaseActivity;
|
|
|
import com.core.model.SelectBean;
|
|
|
+import com.core.net.utils.NetUtils;
|
|
|
import com.core.utils.CommonUtil;
|
|
|
import com.core.utils.ToastUtil;
|
|
|
import com.core.utils.helper.AvatarHelper;
|
|
|
@@ -44,240 +46,242 @@ import de.hdodenhof.circleimageview.CircleImageView;
|
|
|
import static com.common.data.JSONUtil.getJSONArray;
|
|
|
|
|
|
public class BServiceAddActivity extends OABaseActivity implements View.OnClickListener {
|
|
|
- private Button submit_btn;
|
|
|
- private EditText et_book_notes, et_book_phone, et_book_name;//预约人的备注、电话、姓名
|
|
|
- //餐饮
|
|
|
- private TextView tv_food_times, tv_food_rooms, tv_food_peoples;//用餐时间、需要包厢、用餐人数
|
|
|
- // 美容美发
|
|
|
- private TextView tv_hair_times, tv_hair_rooms;//服务时间、服务项目
|
|
|
- // 运动
|
|
|
- private TextView tv_sport_time, tv_sport_rooms, tv_sport_peoples;//运动时间、运动项目、运动人数
|
|
|
- // 医院挂号
|
|
|
- private TextView tv_hospital_rooms, tag_hospital_doctor, tv_hospital_time;//科室、医生、时段
|
|
|
- // 会所
|
|
|
- private TextView tv_club_technician, tv_club_time, tv_club_peoples;//技师、时间、人数
|
|
|
- // KTV
|
|
|
- private TextView tv_ktv_times, tv_ktv_rooms, tv_ktv_peoples;//时间、房间、人数
|
|
|
- //抬头信息
|
|
|
- private CircleImageView iv_header;
|
|
|
- private ImageView max_img;
|
|
|
- private TextView tv_title, tv_sub;
|
|
|
- private SBListModel model;
|
|
|
- private boolean submiting = false;
|
|
|
- private String sb_userid, sb_username;
|
|
|
- private String serviceId;//服务id
|
|
|
- private String serviceName;//服务名称
|
|
|
- private String dataService;//详情数据
|
|
|
- private boolean isHasPerson;//是否指定了人员
|
|
|
-
|
|
|
- @Override
|
|
|
- protected void onCreate(Bundle savedInstanceState) {
|
|
|
- super.onCreate(savedInstanceState);
|
|
|
- setContentView(R.layout.activity_bservice_add);
|
|
|
- initView();
|
|
|
- initData();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private void initView() {
|
|
|
- submit_btn = (Button) findViewById(R.id.submit_btn);
|
|
|
- et_book_notes = (EditText) findViewById(R.id.et_book_notes);
|
|
|
- et_book_phone = (EditText) findViewById(R.id.et_book_phone);
|
|
|
- et_book_name = (EditText) findViewById(R.id.et_book_name);
|
|
|
-
|
|
|
- tv_food_times = (TextView) findViewById(R.id.tv_food_times);
|
|
|
- tv_food_rooms = (TextView) findViewById(R.id.tv_food_rooms);
|
|
|
- tv_food_peoples = (TextView) findViewById(R.id.tv_food_peoples);
|
|
|
-
|
|
|
- tv_hair_rooms = (TextView) findViewById(R.id.tv_hair_rooms);
|
|
|
- tv_hair_times = (TextView) findViewById(R.id.tv_hair_times);
|
|
|
-
|
|
|
- tv_sport_peoples = (TextView) findViewById(R.id.tv_sport_peoples);
|
|
|
- tv_sport_rooms = (TextView) findViewById(R.id.tv_sport_rooms);
|
|
|
- tv_sport_time = (TextView) findViewById(R.id.tv_sport_time);
|
|
|
-
|
|
|
- tv_hospital_rooms = (TextView) findViewById(R.id.tv_hospital_rooms);
|
|
|
- tag_hospital_doctor = (TextView) findViewById(R.id.tag_hospital_doctor);
|
|
|
- tv_hospital_time = (TextView) findViewById(R.id.tv_hospital_time);
|
|
|
-
|
|
|
- tv_club_technician = (TextView) findViewById(R.id.tv_club_technician);
|
|
|
- tv_club_time = (TextView) findViewById(R.id.tv_club_time);
|
|
|
- tv_club_peoples = (TextView) findViewById(R.id.tv_club_peoples);
|
|
|
-
|
|
|
- tv_ktv_times = (TextView) findViewById(R.id.tv_ktv_times);
|
|
|
- tv_ktv_rooms = (TextView) findViewById(R.id.tv_ktv_rooms);
|
|
|
- tv_ktv_peoples = (TextView) findViewById(R.id.tv_ktv_peoples);
|
|
|
-
|
|
|
- iv_header = (CircleImageView) findViewById(R.id.iv_header);
|
|
|
- max_img = (ImageView) findViewById(R.id.max_img);
|
|
|
- tv_title = (TextView) findViewById(R.id.tv_title);
|
|
|
- tv_sub = (TextView) findViewById(R.id.tv_sub);
|
|
|
-
|
|
|
- submit_btn.setOnClickListener(this);
|
|
|
- et_book_name.setText(CommonUtil.getName());
|
|
|
- et_book_phone.setText(CommonUtil.getSharedPreferences(mContext, "user_phone"));
|
|
|
- }
|
|
|
-
|
|
|
- private boolean isEdited = true;
|
|
|
-
|
|
|
- private void initData() {
|
|
|
- Intent intent = getIntent();
|
|
|
- if (intent != null) {
|
|
|
- model = intent.getParcelableExtra("model");
|
|
|
- isEdited = intent.getBooleanExtra("isEdited", true);
|
|
|
- isHasPerson=intent.getBooleanExtra("isHasPerson",false);
|
|
|
- dataService = intent.getStringExtra("dataService");
|
|
|
- sb_userid = intent.getStringExtra("sb_userid");
|
|
|
- sb_username = intent.getStringExtra("sb_username");
|
|
|
- if (model != null) {
|
|
|
- LogUtil.i(model.toString());
|
|
|
- initType(model.getType());
|
|
|
- if (isEdited) {
|
|
|
- submit_btn.setText("提交");
|
|
|
- } else {
|
|
|
- submit_btn.setText("取消");
|
|
|
- }
|
|
|
- tv_title.setText(model.getName());
|
|
|
- tv_sub.setText(model.getAddress());
|
|
|
- getSupportActionBar().setTitle(model.getName());
|
|
|
- AvatarHelper.getInstance().display(model.getUrl(), iv_header, true);
|
|
|
- AvatarHelper.getInstance().display(model.getUrl(), max_img, true);
|
|
|
-
|
|
|
- } else {
|
|
|
- //TODO 由于该界面必须要转进来的对象,如果model缺失,应返回
|
|
|
- }
|
|
|
- } else {
|
|
|
- //TODO 由于该界面必须要转进来的对象,如果model缺失,应返回
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private TextView getTVByType(String type, int requestCode) {
|
|
|
- if (type == null) return null;
|
|
|
-
|
|
|
- switch (type) {
|
|
|
- case "餐饮"://餐饮
|
|
|
- switch (requestCode) {
|
|
|
- case NUMBER_SELECT://人数选择
|
|
|
- return tv_food_peoples;
|
|
|
-
|
|
|
- case TIME_SELECT://时间选择
|
|
|
- return tv_food_times;
|
|
|
- default:
|
|
|
- return tv_food_rooms;
|
|
|
- }
|
|
|
- case "美容美发":// 美容美发
|
|
|
- switch (requestCode) {
|
|
|
- case SERVICE_SELECT:
|
|
|
- return tv_hair_rooms;
|
|
|
- case TIME_SELECT://时间选择
|
|
|
- default:
|
|
|
- return tv_hair_times;
|
|
|
- }
|
|
|
- case "运动健身":
|
|
|
- switch (requestCode) {
|
|
|
- case SERVICE_SELECT:
|
|
|
- return tv_sport_rooms;
|
|
|
- case NUMBER_SELECT://人数选择
|
|
|
- return tv_sport_peoples;
|
|
|
- case TIME_SELECT://时间选择
|
|
|
- default:
|
|
|
- return tv_sport_time;
|
|
|
- }
|
|
|
- case "医疗":
|
|
|
- switch (requestCode) {
|
|
|
- case MAN_SELECT:
|
|
|
- return tag_hospital_doctor;
|
|
|
- case SERVICE_SELECT:
|
|
|
- return tv_hospital_rooms;
|
|
|
- case TIME_SELECT://时间选择
|
|
|
- default:
|
|
|
- return tv_hospital_time;
|
|
|
- }
|
|
|
- case "会所":
|
|
|
- switch (requestCode) {
|
|
|
- case SERVICE_SELECT://人数选择
|
|
|
- return tv_club_technician;
|
|
|
- case NUMBER_SELECT://人数选择
|
|
|
- return tv_club_peoples;
|
|
|
- case TIME_SELECT://时间选择
|
|
|
- default:
|
|
|
- return tv_club_time;
|
|
|
- }
|
|
|
- case "KTV":
|
|
|
- switch (requestCode) {
|
|
|
- case SERVICE_SELECT://服务选择包间选择
|
|
|
- return tv_ktv_rooms;
|
|
|
- case NUMBER_SELECT://人数选择
|
|
|
- return tv_ktv_peoples;
|
|
|
- case TIME_SELECT://时间选择
|
|
|
- default:
|
|
|
- return tv_ktv_times;
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private final int FOOD_ROOMS = 1;
|
|
|
-
|
|
|
- private final int TIME_SELECT = 11//时间选择(包含时间段、时间点)
|
|
|
- , NUMBER_SELECT = 12//人数选择(1~10以上)
|
|
|
- , SERVICE_SELECT = 13//服务项目
|
|
|
- , MAN_SELECT = 14//医生选择
|
|
|
- ;
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- int id = v.getId();
|
|
|
- //选择时间(用餐时间、唱歌时间....)
|
|
|
- if (id == R.id.tv_food_times
|
|
|
- || id == R.id.tv_hair_times
|
|
|
- || id == R.id.tv_sport_time
|
|
|
- || id == R.id.tv_hospital_time
|
|
|
- || id == R.id.tv_club_time
|
|
|
- || id == R.id.tv_ktv_times
|
|
|
- ) {
|
|
|
- //TODO 这个类太长了,修改困难,
|
|
|
- //TODO 现在的需求是
|
|
|
- //TODO 1.当model.getBookType()==0的时候,只能选择开始时间,没有结束时间,当model.getBookType()==1的时候,可选开始时间和结束时间,时间间隔是 30分钟
|
|
|
- //TODO 2.需要传进去商家的id或是ktv包厢的id,在里面请求,判断商家繁忙时刻 5.11、获取商家服务繁忙时间段
|
|
|
- String serviceParam=null;
|
|
|
- if (isHasPerson){
|
|
|
- serviceParam=serviceId;
|
|
|
- }else{
|
|
|
- serviceParam=serviceName;
|
|
|
- }
|
|
|
- startActivityForResult(new Intent(mContext, SelectCalendarActivity.class)
|
|
|
- .putExtra("startDate", DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS))
|
|
|
- .putExtra("endDate", DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS))
|
|
|
- .putExtra("hasMenu", false)
|
|
|
- .putExtra("imId", model.getImid())
|
|
|
- .putExtra("bookType", model.getBookType())//TODO 根据1\0 判断是否有开始时间和结束时间
|
|
|
- .putExtra("companyId", model.getCompanyid())
|
|
|
- .putExtra("businessType", model.getType())
|
|
|
- .putExtra("startTime", model.getStarttime())
|
|
|
- .putExtra("endTime", model.getEndtime())
|
|
|
- .putExtra("serviceId", StringUtil.isEmpty(serviceId) == true ? "" : serviceId)
|
|
|
- .putExtra("type", 3)
|
|
|
- , TIME_SELECT);
|
|
|
- }
|
|
|
- //人数选择(1~10以上)
|
|
|
- else if (id == R.id.tv_food_peoples
|
|
|
- || id == R.id.tv_ktv_peoples
|
|
|
- || id == R.id.tv_club_peoples
|
|
|
- || id == R.id.tv_sport_peoples) {
|
|
|
- ArrayList<SelectBean> formBeaan = new ArrayList<>();
|
|
|
- for (int i = 1; i <= 10; i++) {
|
|
|
- formBeaan.add(new SelectBean(i == 10 ? "10人以上" : i + "人"));
|
|
|
- }
|
|
|
- Intent intent = new Intent(this, SelectActivity.class)
|
|
|
- .putExtra("type", 2)
|
|
|
- .putExtra("title", getString(R.string.service_food_peoples))
|
|
|
- .putParcelableArrayListExtra("data", formBeaan);
|
|
|
- startActivityForResult(intent, NUMBER_SELECT);
|
|
|
- }
|
|
|
- //是否包间(餐饮时候独有)
|
|
|
+ private Button submit_btn;
|
|
|
+ private EditText et_book_notes, et_book_phone, et_book_name;//预约人的备注、电话、姓名
|
|
|
+ //餐饮
|
|
|
+ private TextView tv_food_times, tv_food_rooms, tv_food_peoples;//用餐时间、需要包厢、用餐人数
|
|
|
+ // 美容美发
|
|
|
+ private TextView tv_hair_times, tv_hair_rooms;//服务时间、服务项目
|
|
|
+ // 运动
|
|
|
+ private TextView tv_sport_time, tv_sport_rooms, tv_sport_peoples;//运动时间、运动项目、运动人数
|
|
|
+ // 医院挂号
|
|
|
+ private TextView tv_hospital_rooms, tag_hospital_doctor, tv_hospital_time;//科室、医生、时段
|
|
|
+ // 会所
|
|
|
+ private TextView tv_club_technician, tv_club_time, tv_club_peoples;//技师、时间、人数
|
|
|
+ // KTV
|
|
|
+ private TextView tv_ktv_times, tv_ktv_rooms, tv_ktv_peoples;//时间、房间、人数
|
|
|
+ //抬头信息
|
|
|
+ private CircleImageView iv_header;
|
|
|
+ private ImageView max_img;
|
|
|
+ private TextView tv_title, tv_sub;
|
|
|
+ private SBListModel model;
|
|
|
+ private boolean submiting = false;
|
|
|
+ private String sb_userid, sb_username;
|
|
|
+ private String serviceId;//服务id
|
|
|
+ private String serviceName;//服务名称
|
|
|
+ private String dataService;//详情数据
|
|
|
+ private boolean isHasPerson;//是否指定了人员
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onCreate(Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ setContentView(R.layout.activity_bservice_add);
|
|
|
+ getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
|
|
|
+ | WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
|
|
+ initView();
|
|
|
+ initData();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void initView() {
|
|
|
+ submit_btn = (Button) findViewById(R.id.submit_btn);
|
|
|
+ et_book_notes = (EditText) findViewById(R.id.et_book_notes);
|
|
|
+ et_book_phone = (EditText) findViewById(R.id.et_book_phone);
|
|
|
+ et_book_name = (EditText) findViewById(R.id.et_book_name);
|
|
|
+
|
|
|
+ tv_food_times = (TextView) findViewById(R.id.tv_food_times);
|
|
|
+ tv_food_rooms = (TextView) findViewById(R.id.tv_food_rooms);
|
|
|
+ tv_food_peoples = (TextView) findViewById(R.id.tv_food_peoples);
|
|
|
+
|
|
|
+ tv_hair_rooms = (TextView) findViewById(R.id.tv_hair_rooms);
|
|
|
+ tv_hair_times = (TextView) findViewById(R.id.tv_hair_times);
|
|
|
+
|
|
|
+ tv_sport_peoples = (TextView) findViewById(R.id.tv_sport_peoples);
|
|
|
+ tv_sport_rooms = (TextView) findViewById(R.id.tv_sport_rooms);
|
|
|
+ tv_sport_time = (TextView) findViewById(R.id.tv_sport_time);
|
|
|
+
|
|
|
+ tv_hospital_rooms = (TextView) findViewById(R.id.tv_hospital_rooms);
|
|
|
+ tag_hospital_doctor = (TextView) findViewById(R.id.tag_hospital_doctor);
|
|
|
+ tv_hospital_time = (TextView) findViewById(R.id.tv_hospital_time);
|
|
|
+
|
|
|
+ tv_club_technician = (TextView) findViewById(R.id.tv_club_technician);
|
|
|
+ tv_club_time = (TextView) findViewById(R.id.tv_club_time);
|
|
|
+ tv_club_peoples = (TextView) findViewById(R.id.tv_club_peoples);
|
|
|
+
|
|
|
+ tv_ktv_times = (TextView) findViewById(R.id.tv_ktv_times);
|
|
|
+ tv_ktv_rooms = (TextView) findViewById(R.id.tv_ktv_rooms);
|
|
|
+ tv_ktv_peoples = (TextView) findViewById(R.id.tv_ktv_peoples);
|
|
|
+
|
|
|
+ iv_header = (CircleImageView) findViewById(R.id.iv_header);
|
|
|
+ max_img = (ImageView) findViewById(R.id.max_img);
|
|
|
+ tv_title = (TextView) findViewById(R.id.tv_title);
|
|
|
+ tv_sub = (TextView) findViewById(R.id.tv_sub);
|
|
|
+
|
|
|
+ submit_btn.setOnClickListener(this);
|
|
|
+ et_book_name.setText(CommonUtil.getName());
|
|
|
+ et_book_phone.setText(CommonUtil.getSharedPreferences(mContext, "user_phone"));
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean isEdited = true;
|
|
|
+
|
|
|
+ private void initData() {
|
|
|
+ Intent intent = getIntent();
|
|
|
+ if (intent != null) {
|
|
|
+ model = intent.getParcelableExtra("model");
|
|
|
+ isEdited = intent.getBooleanExtra("isEdited", true);
|
|
|
+ isHasPerson = intent.getBooleanExtra("isHasPerson", false);
|
|
|
+ dataService = intent.getStringExtra("dataService");
|
|
|
+ sb_userid = intent.getStringExtra("sb_userid");
|
|
|
+ sb_username = intent.getStringExtra("sb_username");
|
|
|
+ if (model != null) {
|
|
|
+ LogUtil.i(model.toString());
|
|
|
+ initType(model.getType());
|
|
|
+ if (isEdited) {
|
|
|
+ submit_btn.setText("提交");
|
|
|
+ } else {
|
|
|
+ submit_btn.setText("取消");
|
|
|
+ }
|
|
|
+ tv_title.setText(model.getName());
|
|
|
+ tv_sub.setText(model.getAddress());
|
|
|
+ getSupportActionBar().setTitle(model.getName());
|
|
|
+ AvatarHelper.getInstance().display(model.getUrl(), iv_header, true);
|
|
|
+ AvatarHelper.getInstance().display(model.getUrl(), max_img, true);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ //TODO 由于该界面必须要转进来的对象,如果model缺失,应返回
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //TODO 由于该界面必须要转进来的对象,如果model缺失,应返回
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private TextView getTVByType(String type, int requestCode) {
|
|
|
+ if (type == null) return null;
|
|
|
+
|
|
|
+ switch (type) {
|
|
|
+ case "餐饮"://餐饮
|
|
|
+ switch (requestCode) {
|
|
|
+ case NUMBER_SELECT://人数选择
|
|
|
+ return tv_food_peoples;
|
|
|
+
|
|
|
+ case TIME_SELECT://时间选择
|
|
|
+ return tv_food_times;
|
|
|
+ default:
|
|
|
+ return tv_food_rooms;
|
|
|
+ }
|
|
|
+ case "美容美发":// 美容美发
|
|
|
+ switch (requestCode) {
|
|
|
+ case SERVICE_SELECT:
|
|
|
+ return tv_hair_rooms;
|
|
|
+ case TIME_SELECT://时间选择
|
|
|
+ default:
|
|
|
+ return tv_hair_times;
|
|
|
+ }
|
|
|
+ case "运动健身":
|
|
|
+ switch (requestCode) {
|
|
|
+ case SERVICE_SELECT:
|
|
|
+ return tv_sport_rooms;
|
|
|
+ case NUMBER_SELECT://人数选择
|
|
|
+ return tv_sport_peoples;
|
|
|
+ case TIME_SELECT://时间选择
|
|
|
+ default:
|
|
|
+ return tv_sport_time;
|
|
|
+ }
|
|
|
+ case "医疗":
|
|
|
+ switch (requestCode) {
|
|
|
+ case MAN_SELECT:
|
|
|
+ return tag_hospital_doctor;
|
|
|
+ case SERVICE_SELECT:
|
|
|
+ return tv_hospital_rooms;
|
|
|
+ case TIME_SELECT://时间选择
|
|
|
+ default:
|
|
|
+ return tv_hospital_time;
|
|
|
+ }
|
|
|
+ case "会所":
|
|
|
+ switch (requestCode) {
|
|
|
+ case SERVICE_SELECT://人数选择
|
|
|
+ return tv_club_technician;
|
|
|
+ case NUMBER_SELECT://人数选择
|
|
|
+ return tv_club_peoples;
|
|
|
+ case TIME_SELECT://时间选择
|
|
|
+ default:
|
|
|
+ return tv_club_time;
|
|
|
+ }
|
|
|
+ case "KTV":
|
|
|
+ switch (requestCode) {
|
|
|
+ case SERVICE_SELECT://服务选择包间选择
|
|
|
+ return tv_ktv_rooms;
|
|
|
+ case NUMBER_SELECT://人数选择
|
|
|
+ return tv_ktv_peoples;
|
|
|
+ case TIME_SELECT://时间选择
|
|
|
+ default:
|
|
|
+ return tv_ktv_times;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private final int FOOD_ROOMS = 1;
|
|
|
+
|
|
|
+ private final int TIME_SELECT = 11//时间选择(包含时间段、时间点)
|
|
|
+ , NUMBER_SELECT = 12//人数选择(1~10以上)
|
|
|
+ , SERVICE_SELECT = 13//服务项目
|
|
|
+ , MAN_SELECT = 14//医生选择
|
|
|
+ ;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ int id = v.getId();
|
|
|
+ //选择时间(用餐时间、唱歌时间....)
|
|
|
+ if (id == R.id.tv_food_times
|
|
|
+ || id == R.id.tv_hair_times
|
|
|
+ || id == R.id.tv_sport_time
|
|
|
+ || id == R.id.tv_hospital_time
|
|
|
+ || id == R.id.tv_club_time
|
|
|
+ || id == R.id.tv_ktv_times
|
|
|
+ ) {
|
|
|
+ //TODO 这个类太长了,修改困难,
|
|
|
+ //TODO 现在的需求是
|
|
|
+ //TODO 1.当model.getBookType()==0的时候,只能选择开始时间,没有结束时间,当model.getBookType()==1的时候,可选开始时间和结束时间,时间间隔是 30分钟
|
|
|
+ //TODO 2.需要传进去商家的id或是ktv包厢的id,在里面请求,判断商家繁忙时刻 5.11、获取商家服务繁忙时间段
|
|
|
+ String serviceParam = null;
|
|
|
+ if (isHasPerson) {
|
|
|
+ serviceParam = serviceId;
|
|
|
+ } else {
|
|
|
+ serviceParam = serviceName;
|
|
|
+ }
|
|
|
+ startActivityForResult(new Intent(mContext, SelectCalendarActivity.class)
|
|
|
+ .putExtra("startDate", DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS))
|
|
|
+ .putExtra("endDate", DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS))
|
|
|
+ .putExtra("hasMenu", false)
|
|
|
+ .putExtra("imId", model.getImid())
|
|
|
+ .putExtra("bookType", model.getBookType())//TODO 根据1\0 判断是否有开始时间和结束时间
|
|
|
+ .putExtra("companyId", model.getCompanyid())
|
|
|
+ .putExtra("businessType", model.getType())
|
|
|
+ .putExtra("startTime", model.getStarttime())
|
|
|
+ .putExtra("endTime", model.getEndtime())
|
|
|
+ .putExtra("serviceId", StringUtil.isEmpty(serviceId) == true ? "" : serviceId)
|
|
|
+ .putExtra("type", 3)
|
|
|
+ , TIME_SELECT);
|
|
|
+ }
|
|
|
+ //人数选择(1~10以上)
|
|
|
+ else if (id == R.id.tv_food_peoples
|
|
|
+ || id == R.id.tv_ktv_peoples
|
|
|
+ || id == R.id.tv_club_peoples
|
|
|
+ || id == R.id.tv_sport_peoples) {
|
|
|
+ ArrayList<SelectBean> formBeaan = new ArrayList<>();
|
|
|
+ for (int i = 1; i <= 10; i++) {
|
|
|
+ formBeaan.add(new SelectBean(i == 10 ? "10人以上" : i + "人"));
|
|
|
+ }
|
|
|
+ Intent intent = new Intent(this, SelectActivity.class)
|
|
|
+ .putExtra("type", 2)
|
|
|
+ .putExtra("title", getString(R.string.service_food_peoples))
|
|
|
+ .putParcelableArrayListExtra("data", formBeaan);
|
|
|
+ startActivityForResult(intent, NUMBER_SELECT);
|
|
|
+ }
|
|
|
+ //是否包间(餐饮时候独有)
|
|
|
// else if (id == R.id.tv_food_rooms) {
|
|
|
// ArrayList<SelectBean> formBeaan = new ArrayList<>();
|
|
|
// formBeaan.add(new SelectBean("是"));
|
|
|
@@ -289,619 +293,650 @@ public class BServiceAddActivity extends OABaseActivity implements View.OnClickL
|
|
|
// startActivityForResult(intent, FOOD_ROOMS);
|
|
|
// }
|
|
|
|
|
|
- //服务项目
|
|
|
- else if (id == R.id.tv_hair_rooms
|
|
|
- || id == R.id.tv_sport_rooms
|
|
|
- || id == R.id.tv_hospital_rooms
|
|
|
- || id == R.id.tv_club_technician
|
|
|
- || id == R.id.tv_ktv_rooms
|
|
|
- || id == R.id.tv_food_rooms) {
|
|
|
- loadStoreService();
|
|
|
- }
|
|
|
-
|
|
|
- //医疗
|
|
|
- else if (id == R.id.tag_hospital_doctor) {//医生
|
|
|
- Object tag = tv_hospital_rooms.getTag(R.id.tag_id);
|
|
|
- if (tag != null) {
|
|
|
- LogUtil.i("tag=" + tag.toString());
|
|
|
- if (tag instanceof String) {
|
|
|
- loadServiceMan(tag.toString());
|
|
|
- }
|
|
|
- } else {
|
|
|
- ToastUtil.showToast(ct, "请先选择科室");
|
|
|
- }
|
|
|
- } else if (id == R.id.submit_btn) {
|
|
|
- if (((Button) v).getText().equals("提交")) {
|
|
|
- save();
|
|
|
- } else if (((Button) v).getText().equals("取消")) {
|
|
|
- cancle(String.valueOf(model.getId()));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- private static final String TAG = "BServiceAddActivity";
|
|
|
- public void cancle(String id) {
|
|
|
- LogUtil.d(TAG,"id:"+id);
|
|
|
- HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL).build();
|
|
|
- httpClient.Api().send(new HttpClient.Builder()
|
|
|
- .url("user/appCancelService")
|
|
|
- .add("id", id)
|
|
|
- .add("token", MyApplication.getInstance().mAccessToken)
|
|
|
- .method(Method.POST)
|
|
|
- .build(), new ResultSubscriber<Object>(new ResultListener<Object>() {
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onResponse(Object o) {
|
|
|
- try {
|
|
|
- if (JSONUtil.validate(o.toString())) {
|
|
|
- if ("true".equals(JSON.parseObject(o.toString()).getString("result"))){
|
|
|
- ToastMessage("取消成功!");
|
|
|
- Intent intent = new Intent("com.modular.booking.BookingListActivity");
|
|
|
- intent.putExtra("curDate", model.getEndtime() == null ? "" : model.getEndtime());
|
|
|
- startActivity(intent);
|
|
|
- }
|
|
|
- } else {
|
|
|
- ToastMessage("操作失败!");
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- ToastMessage("操作失败!");
|
|
|
- }
|
|
|
- }
|
|
|
- }));
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
- super.onActivityResult(requestCode, resultCode, data);
|
|
|
- if (data == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- TextView tv = getTVByType(model.getType(), requestCode);
|
|
|
- String tvMessage = null;
|
|
|
- switch (requestCode) {
|
|
|
- case FOOD_ROOMS://是否包间
|
|
|
- String name = "";
|
|
|
- SelectBean bean = data.getParcelableExtra("data");
|
|
|
- if (bean != null && bean.getName() != null) {
|
|
|
- name = bean.getName();
|
|
|
- }
|
|
|
- if (tv == null) {
|
|
|
- tv = tv_food_rooms;
|
|
|
- }
|
|
|
- tv.setText(name);
|
|
|
- break;
|
|
|
- case TIME_SELECT://时间段设置
|
|
|
- if ("0".equals(model.getBookType())) {//只能开始时间
|
|
|
- String startTime = data.getStringExtra("startDate");
|
|
|
- String displayDate = startTime;
|
|
|
+ //服务项目
|
|
|
+ else if (id == R.id.tv_hair_rooms
|
|
|
+ || id == R.id.tv_sport_rooms
|
|
|
+ || id == R.id.tv_hospital_rooms
|
|
|
+ || id == R.id.tv_club_technician
|
|
|
+ || id == R.id.tv_ktv_rooms
|
|
|
+ || id == R.id.tv_food_rooms) {
|
|
|
+ loadStoreService(v.getContentDescription());
|
|
|
+ }
|
|
|
+
|
|
|
+ //医疗
|
|
|
+ else if (id == R.id.tag_hospital_doctor) {//医生
|
|
|
+ Object tag = tv_hospital_rooms.getTag(R.id.tag_id);
|
|
|
+ if (tag != null) {
|
|
|
+ LogUtil.i("tag=" + tag.toString());
|
|
|
+ if (tag instanceof String) {
|
|
|
+ loadServiceMan(tag.toString(), getString(R.string.service_hospital_rooms));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ToastUtil.showToast(ct, "请先选择科室");
|
|
|
+ }
|
|
|
+ } else if (id == R.id.submit_btn) {
|
|
|
+ if (((Button) v).getText().equals("提交")) {
|
|
|
+ save();
|
|
|
+ } else if (((Button) v).getText().equals("取消")) {
|
|
|
+ cancle(String.valueOf(model.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private static final String TAG = "BServiceAddActivity";
|
|
|
+
|
|
|
+ public void cancle(String id) {
|
|
|
+ LogUtil.d(TAG, "id:" + id);
|
|
|
+ HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL).build();
|
|
|
+ httpClient.Api().send(new HttpClient.Builder()
|
|
|
+ .url("user/appCancelService")
|
|
|
+ .add("id", id)
|
|
|
+ .add("token", MyApplication.getInstance().mAccessToken)
|
|
|
+ .method(Method.POST)
|
|
|
+ .build(), new ResultSubscriber<Object>(new ResultListener<Object>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onResponse(Object o) {
|
|
|
+ try {
|
|
|
+ if (JSONUtil.validate(o.toString())) {
|
|
|
+ if ("true".equals(JSON.parseObject(o.toString()).getString("result"))) {
|
|
|
+ ToastMessage("取消成功!");
|
|
|
+ Intent intent = new Intent("com.modular.booking.BookingListActivity");
|
|
|
+ intent.putExtra("curDate", model.getEndtime() == null ? "" : model.getEndtime());
|
|
|
+ startActivity(intent);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ToastMessage("操作失败!");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ ToastMessage("操作失败!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
+ super.onActivityResult(requestCode, resultCode, data);
|
|
|
+ if (data == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ TextView tv = getTVByType(model.getType(), requestCode);
|
|
|
+ String tvMessage = null;
|
|
|
+ switch (requestCode) {
|
|
|
+ case FOOD_ROOMS://是否包间
|
|
|
+ String name = "";
|
|
|
+ SelectBean bean = data.getParcelableExtra("data");
|
|
|
+ if (bean != null && bean.getName() != null) {
|
|
|
+ name = bean.getName();
|
|
|
+ }
|
|
|
+ if (tv == null) {
|
|
|
+ tv = tv_food_rooms;
|
|
|
+ }
|
|
|
+ tv.setText(name);
|
|
|
+ break;
|
|
|
+ case TIME_SELECT://时间段设置
|
|
|
+ if ("0".equals(model.getBookType())) {//只能开始时间
|
|
|
+ String startTime = data.getStringExtra("startDate");
|
|
|
+ String displayDate = startTime;
|
|
|
// tv.setTag(R.id.tag_id2, endTime);
|
|
|
// tv.setTag(R.id.tag_id, startTime);
|
|
|
- tv.setText(displayDate);
|
|
|
- } else {
|
|
|
- String startTime = data.getStringExtra("startDate");
|
|
|
- String endTime = data.getStringExtra("endDate");
|
|
|
- String displayDate = startTime + "-" + endTime.substring(11, 16);
|
|
|
- tv.setTag(R.id.tag_id2, endTime);
|
|
|
- tv.setTag(R.id.tag_id, startTime);
|
|
|
- tv.setText(displayDate);
|
|
|
- }
|
|
|
- break;
|
|
|
- case NUMBER_SELECT://人数选择
|
|
|
- String number = "";
|
|
|
- SelectBean numberBean = data.getParcelableExtra("data");
|
|
|
- if (numberBean != null && numberBean.getName() != null) {
|
|
|
- number = numberBean.getName();
|
|
|
- }
|
|
|
- tv.setText(number.substring(0, number.length() - 1));
|
|
|
- break;
|
|
|
- case SERVICE_SELECT:
|
|
|
- case MAN_SELECT:
|
|
|
- SelectBean service = data.getParcelableExtra("data");
|
|
|
- if (service != null && service.getName() != null) {
|
|
|
- LogUtil.i("service=" + JSON.toJSONString(service));
|
|
|
- tvMessage = service.getName();
|
|
|
- serviceId = service.getFields();
|
|
|
- serviceName = service.getName();
|
|
|
- if (tv != null) {
|
|
|
- tv.setTag(R.id.tag_id, serviceId);
|
|
|
- tv.setTag(R.id.tag_id2, serviceName);
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- if (tvMessage != null && tv != null) {
|
|
|
- if (tv == tv_hospital_rooms) {
|
|
|
- tag_hospital_doctor.setText("");
|
|
|
- }
|
|
|
- tv.setText(tvMessage);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //load 服务项目
|
|
|
- public void loadStoreService() {
|
|
|
- progressDialog.show();
|
|
|
- HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL)
|
|
|
- .isDebug(BaseConfig.isDebug()).build();
|
|
|
- httpClient.Api().send(new HttpClient.Builder()
|
|
|
- .url("/user/appStoreService")
|
|
|
- .add("companyid", model.getCompanyid())
|
|
|
- .add("token", MyApplication.getInstance().mAccessToken)
|
|
|
- .method(Method.GET)
|
|
|
- .build(), new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
- @Override
|
|
|
- public void onResponse(Object o) {
|
|
|
- LogUtil.i(o.toString());
|
|
|
- if (JSONUtil.validateJSONObject(o.toString())) {
|
|
|
- JSONArray array = getJSONArray(o.toString(), "result");
|
|
|
- SelectBean bean = null;
|
|
|
- ArrayList<SelectBean> selectBeens = new ArrayList<SelectBean>();
|
|
|
- //TODO 测试数据
|
|
|
- if (ListUtils.isEmpty(array)) {
|
|
|
- array = JSONUtil.getJSONArray(TestString.STORE_SERVICE, "result");
|
|
|
- }
|
|
|
- if (!ListUtils.isEmpty(array)) {
|
|
|
- for (int i = 0; i < array.size(); i++) {
|
|
|
- JSONObject object = array.getJSONObject(i);
|
|
|
- bean = new SelectBean();
|
|
|
- int id = JSONUtil.getInt(object, "st_id");
|
|
|
- String name = JSONUtil.getText(object, "st_name");
|
|
|
- bean.setId(id);
|
|
|
- bean.setFields(String.valueOf(id));
|
|
|
- bean.setName(name);
|
|
|
- bean.setObject(object.toJSONString());
|
|
|
- selectBeens.add(bean);
|
|
|
- }
|
|
|
- }
|
|
|
- if (!ListUtils.isEmpty(selectBeens)) {
|
|
|
- Intent intent = new Intent(ct, SelectActivity.class)
|
|
|
- .putExtra("type", 2)
|
|
|
- .putExtra("title", getString(R.string.service_food_rooms))
|
|
|
- .putParcelableArrayListExtra("data", selectBeens);
|
|
|
- startActivityForResult(intent, SERVICE_SELECT);
|
|
|
- }
|
|
|
- }
|
|
|
- progressDialog.dismiss();
|
|
|
- }
|
|
|
- }));
|
|
|
- }
|
|
|
-
|
|
|
- //load 选择服务人员
|
|
|
- public void loadServiceMan(String serviceId) {
|
|
|
- progressDialog.show();
|
|
|
- LogUtil.d("HttpLogs", "serviceId:" + serviceId);
|
|
|
- LogUtil.d("HttpLogs", "companyid:" + model.getCompanyid());
|
|
|
- HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL).isDebug(BaseConfig.isDebug()).build();
|
|
|
- httpClient.Api().send(new HttpClient.Builder()
|
|
|
- .url("user/appStoreman")
|
|
|
- .add("companyid", model.getCompanyid())
|
|
|
- .add("serviceid", serviceId)
|
|
|
- .add("token", MyApplication.getInstance().mAccessToken)
|
|
|
- .method(Method.GET)
|
|
|
- .build(), new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
- @Override
|
|
|
- public void onResponse(Object o) {
|
|
|
- LogUtil.i(o.toString());
|
|
|
- if (JSONUtil.validateJSONObject(o.toString())) {
|
|
|
- JSONArray array = getJSONArray(o.toString(), "result");
|
|
|
- SelectBean bean = null;
|
|
|
- ArrayList<SelectBean> selectBeens = new ArrayList<SelectBean>();
|
|
|
- //TODO 测试数据
|
|
|
- if (ListUtils.isEmpty(array)) {
|
|
|
- array = JSONUtil.getJSONArray(TestString.STORE_SERVICE, "result");
|
|
|
- }
|
|
|
- if (!ListUtils.isEmpty(array)) {
|
|
|
- for (int i = 0; i < array.size(); i++) {
|
|
|
- JSONObject object = array.getJSONObject(i);
|
|
|
- bean = new SelectBean();
|
|
|
- int id = JSONUtil.getInt(object, "sm_userid");
|
|
|
- String name = JSONUtil.getText(object, "sm_username");
|
|
|
- bean.setId(id);
|
|
|
- bean.setFields(String.valueOf(id));
|
|
|
- bean.setName(name);
|
|
|
- selectBeens.add(bean);
|
|
|
- }
|
|
|
- }
|
|
|
- if (!ListUtils.isEmpty(selectBeens)) {
|
|
|
- Intent intent = new Intent(ct, SelectActivity.class)
|
|
|
- .putExtra("type", 2)
|
|
|
- .putExtra("title", getString(R.string.service_food_rooms))
|
|
|
- .putParcelableArrayListExtra("data", selectBeens);
|
|
|
- startActivityForResult(intent, MAN_SELECT);
|
|
|
- }
|
|
|
- }
|
|
|
- progressDialog.dismiss();
|
|
|
- }
|
|
|
- }));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private synchronized void save() {
|
|
|
- if (submiting) {
|
|
|
- return;
|
|
|
- }
|
|
|
- submiting = true;
|
|
|
- progressDialog.show();
|
|
|
- Map<String, Object> map = getServiceMap();
|
|
|
- if (map == null) {
|
|
|
- LogUtil.i("map == null");
|
|
|
- submiting = false;
|
|
|
- progressDialog.dismiss();
|
|
|
- return;
|
|
|
- } else {
|
|
|
- LogUtil.i("map=" + JSONUtil.map2JSON(map));
|
|
|
+ tv.setText(displayDate);
|
|
|
+ } else {
|
|
|
+ String startTime = data.getStringExtra("startDate");
|
|
|
+ String endTime = data.getStringExtra("endDate");
|
|
|
+ String displayDate = startTime + "-" + endTime.substring(11, 16);
|
|
|
+ tv.setTag(R.id.tag_id2, endTime);
|
|
|
+ tv.setTag(R.id.tag_id, startTime);
|
|
|
+ tv.setText(displayDate);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case NUMBER_SELECT://人数选择
|
|
|
+ String number = "";
|
|
|
+ SelectBean numberBean = data.getParcelableExtra("data");
|
|
|
+ if (numberBean != null && numberBean.getName() != null) {
|
|
|
+ number = numberBean.getName();
|
|
|
+ }
|
|
|
+ tv.setText(number.substring(0, number.length() - 1));
|
|
|
+ break;
|
|
|
+ case SERVICE_SELECT:
|
|
|
+ case MAN_SELECT:
|
|
|
+ SelectBean service = data.getParcelableExtra("data");
|
|
|
+ if (service != null && service.getName() != null) {
|
|
|
+ LogUtil.i("service=" + JSON.toJSONString(service));
|
|
|
+ tvMessage = service.getName();
|
|
|
+ serviceId = service.getFields();
|
|
|
+ serviceName = service.getName();
|
|
|
+ if (tv != null) {
|
|
|
+ tv.setTag(R.id.tag_id, serviceId);
|
|
|
+ tv.setTag(R.id.tag_id2, serviceName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (tvMessage != null && tv != null) {
|
|
|
+ if (tv == tv_hospital_rooms) {
|
|
|
+ tag_hospital_doctor.setText("");
|
|
|
+ }
|
|
|
+ tv.setText(tvMessage);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //load 服务项目
|
|
|
+ public void loadStoreService(final CharSequence title) {
|
|
|
+ progressDialog.show();
|
|
|
+ HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL)
|
|
|
+ .isDebug(BaseConfig.isDebug()).build();
|
|
|
+ httpClient.Api().send(new HttpClient.Builder()
|
|
|
+ .url("/user/appStoreService")
|
|
|
+ .add("companyid", model.getCompanyid())
|
|
|
+ .add("token", MyApplication.getInstance().mAccessToken)
|
|
|
+ .method(Method.GET)
|
|
|
+ .build(), new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
+ @Override
|
|
|
+ public void onResponse(Object o) {
|
|
|
+ LogUtil.i(o.toString());
|
|
|
+ if (JSONUtil.validateJSONObject(o.toString())) {
|
|
|
+ JSONArray array = getJSONArray(o.toString(), "result");
|
|
|
+ SelectBean bean = null;
|
|
|
+ ArrayList<SelectBean> selectBeens = new ArrayList<SelectBean>();
|
|
|
+ if (ListUtils.isEmpty(array)) {
|
|
|
+ array = JSONUtil.getJSONArray(TestString.STORE_SERVICE, "result");
|
|
|
+ }
|
|
|
+ if (!ListUtils.isEmpty(array)) {
|
|
|
+ for (int i = 0; i < array.size(); i++) {
|
|
|
+ JSONObject object = array.getJSONObject(i);
|
|
|
+ bean = new SelectBean();
|
|
|
+ int id = JSONUtil.getInt(object, "st_id");
|
|
|
+ String name = JSONUtil.getText(object, "st_name");
|
|
|
+ if (StringUtil.isEmpty(name)) continue;
|
|
|
+ bean.setId(id);
|
|
|
+ bean.setFields(String.valueOf(id));
|
|
|
+ bean.setName(name);
|
|
|
+ bean.setObject(object.toJSONString());
|
|
|
+ selectBeens.add(bean);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!ListUtils.isEmpty(selectBeens)) {
|
|
|
+ Intent intent = new Intent(ct, SelectActivity.class)
|
|
|
+ .putExtra("type", 2)
|
|
|
+ .putExtra("title", title)
|
|
|
+ .putParcelableArrayListExtra("data", selectBeens);
|
|
|
+ startActivityForResult(intent, SERVICE_SELECT);
|
|
|
+ } else {
|
|
|
+ showToast("该商家当前无可选服务", R.color.load_error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ progressDialog.dismiss();
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
+ //load 选择服务人员
|
|
|
+ public void loadServiceMan(String serviceId, final String title) {
|
|
|
+ progressDialog.show();
|
|
|
+ LogUtil.d("HttpLogs", "serviceId:" + serviceId);
|
|
|
+ LogUtil.d("HttpLogs", "companyid:" + model.getCompanyid());
|
|
|
+ HttpClient httpClient = new HttpClient.Builder(Constants.IM_BASE_URL).isDebug(BaseConfig.isDebug()).build();
|
|
|
+ httpClient.Api().send(new HttpClient.Builder()
|
|
|
+ .url("user/appStoreman")
|
|
|
+ .add("companyid", model.getCompanyid())
|
|
|
+ .add("serviceid", serviceId)
|
|
|
+ .add("token", MyApplication.getInstance().mAccessToken)
|
|
|
+ .method(Method.GET)
|
|
|
+ .build(), new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
+ @Override
|
|
|
+ public void onResponse(Object o) {
|
|
|
+ LogUtil.i(o.toString());
|
|
|
+ if (JSONUtil.validateJSONObject(o.toString())) {
|
|
|
+ JSONArray array = getJSONArray(o.toString(), "result");
|
|
|
+ SelectBean bean = null;
|
|
|
+ ArrayList<SelectBean> selectBeens = new ArrayList<SelectBean>();
|
|
|
+ //TODO 测试数据
|
|
|
+ if (ListUtils.isEmpty(array)) {
|
|
|
+ array = JSONUtil.getJSONArray(TestString.STORE_SERVICE, "result");
|
|
|
+ }
|
|
|
+ if (!ListUtils.isEmpty(array)) {
|
|
|
+ for (int i = 0; i < array.size(); i++) {
|
|
|
+ JSONObject object = array.getJSONObject(i);
|
|
|
+ bean = new SelectBean();
|
|
|
+ int id = JSONUtil.getInt(object, "sm_userid");
|
|
|
+ String name = JSONUtil.getText(object, "sm_username");
|
|
|
+ if (StringUtil.isEmpty(name)) continue;
|
|
|
+ bean.setId(id);
|
|
|
+ bean.setFields(String.valueOf(id));
|
|
|
+ bean.setName(name);
|
|
|
+ selectBeens.add(bean);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!ListUtils.isEmpty(selectBeens)) {
|
|
|
+ Intent intent = new Intent(ct, SelectActivity.class)
|
|
|
+ .putExtra("type", 2)
|
|
|
+ .putExtra("title", title)
|
|
|
+ .putParcelableArrayListExtra("data", selectBeens);
|
|
|
+ startActivityForResult(intent, MAN_SELECT);
|
|
|
+ } else {
|
|
|
+ showToast("该商家当前无可选" + title, R.color.load_error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ progressDialog.dismiss();
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private synchronized void save() {
|
|
|
+ if (!NetUtils.isNetWorkConnected(ct)) {
|
|
|
+ showToast(R.string.networks_out, R.color.load_error);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (submiting) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ submiting = true;
|
|
|
+ progressDialog.show();
|
|
|
+ Map<String, Object> map = getServiceMap();
|
|
|
+ if (map == null) {
|
|
|
+ LogUtil.i("map == null");
|
|
|
+ submiting = false;
|
|
|
+ progressDialog.dismiss();
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ LogUtil.i("map=" + JSONUtil.map2JSON(map));
|
|
|
// if (1 == 1) {
|
|
|
// submiting = false;
|
|
|
// progressDialog.dismiss();
|
|
|
// return;
|
|
|
// }
|
|
|
- }
|
|
|
- final String startTime = map.get("sb_endtime").toString();
|
|
|
- new HttpClient
|
|
|
- .Builder(Constants.IM_BASE_URL)
|
|
|
- .isDebug(BaseConfig.isDebug())
|
|
|
- .build()
|
|
|
- .Api()
|
|
|
- .send(new HttpClient.Builder()
|
|
|
- .url("/user/appSaveService")
|
|
|
- .add("map", JSONUtil.map2JSON(map))
|
|
|
- .add("token", MyApplication.getInstance().mAccessToken)
|
|
|
- .method(Method.POST)
|
|
|
- .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));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }));
|
|
|
- }
|
|
|
-
|
|
|
- private Map<String, Object> getServiceMap() {
|
|
|
- Map<String, Object> map = getMapFormType();
|
|
|
- if (map == null) {
|
|
|
- LogUtil.i("getServiceMap==nulll");
|
|
|
- return map;
|
|
|
- }
|
|
|
- map.put("sb_recordid", MyApplication.getInstance().getLoginUserId());//当前用户ID
|
|
|
- if (TextUtils.isEmpty(et_book_name.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- map.put("sb_recordor", StringUtil.getTextRexHttp(et_book_name));//姓名
|
|
|
- }
|
|
|
- if (TextUtils.isEmpty(et_book_phone.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- map.put("sb_telephone", StringUtil.getTextRexHttp(et_book_phone));//姓名
|
|
|
- }
|
|
|
- if (TextUtils.isEmpty(et_book_notes.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- map.put("sb_remark", StringUtil.getTextRexHttp(et_book_notes));//姓名
|
|
|
- }
|
|
|
-
|
|
|
- map.put("sb_industry", model.getIndustrycode());
|
|
|
- map.put("sb_companyid", StringUtil.toHttpString(model.getCompanyid()));//商家ID
|
|
|
- map.put("sb_companyname", StringUtil.toHttpString(model.getName()));//商家名称
|
|
|
- map.put("sb_address", StringUtil.toHttpString(model.getAddress()));//地址
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- private Map<String, Object> getMapFormType() {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- switch (model.getType()) {
|
|
|
- case "餐饮"://餐饮st_id
|
|
|
- if (TextUtils.isEmpty(tv_food_peoples.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- map.put("sb_person", StringUtil.getTextRexHttp(tv_food_peoples));//姓名
|
|
|
- }
|
|
|
- if (TextUtils.isEmpty(tv_food_times.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- //sb_enddate的格式是yyyy-MM-dd HH:mm:ss
|
|
|
- setTime(map, tv_food_times);
|
|
|
- }
|
|
|
- if (!TextUtils.isEmpty(tv_food_rooms.getText())){
|
|
|
- map.put("sb_spname",tv_food_rooms.getText());
|
|
|
- }
|
|
|
- break;
|
|
|
- case "美容美发":
|
|
|
- if (TextUtils.isEmpty(tv_hair_rooms.getText()) || tv_hair_rooms.getTag(R.id.tag_id) == null) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- map.put("sb_stname", StringUtil.getTextRexHttp(tv_hair_rooms));//服务项目名称
|
|
|
- map.put("sb_stid", tv_hair_rooms.getTag(R.id.tag_id));//服务项目ID
|
|
|
- }
|
|
|
- if (TextUtils.isEmpty(tv_hair_times.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- setTime(map, tv_hair_times);
|
|
|
- }
|
|
|
- if (!StringUtil.isEmpty(sb_userid)) {
|
|
|
- map.put("sb_userid", sb_userid);//技师ID
|
|
|
- }
|
|
|
- if (!StringUtil.isEmpty(sb_username)) {
|
|
|
- map.put("sb_username", sb_username);//技师名字
|
|
|
- }
|
|
|
- map.put("sb_person", 1);//人数
|
|
|
- break;
|
|
|
- case "运动健身":
|
|
|
- if (TextUtils.isEmpty(tv_sport_time.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- //sb_enddate的格式是yyyy-MM-dd HH:mm:ss
|
|
|
- setTime(map, tv_sport_time);
|
|
|
- }
|
|
|
- if (TextUtils.isEmpty(tv_sport_peoples.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- map.put("sb_person", StringUtil.getFirstInt(tv_sport_peoples.getText().toString(), 1));//人数
|
|
|
- }
|
|
|
- if (TextUtils.isEmpty(tv_sport_rooms.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- map.put("sb_spname", StringUtil.getTextRexHttp(tv_sport_peoples));//场地名称
|
|
|
- }
|
|
|
- break;
|
|
|
- case "医疗":
|
|
|
- if (TextUtils.isEmpty(tv_hospital_time.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- setTime(map, tv_hospital_time);
|
|
|
- }
|
|
|
- //|| tv_hospital_rooms.getTag(R.id.tag_id) == null
|
|
|
- if (TextUtils.isEmpty(tv_hospital_rooms.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- map.put("sb_stname", StringUtil.getTextRexHttp(tv_hospital_rooms));//服务项目名称
|
|
|
- map.put("sb_stid", tv_hospital_rooms.getTag(R.id.tag_id));//服务项目ID
|
|
|
- }
|
|
|
- //|| tag_hospital_doctor.getTag(R.id.tag_id) == null
|
|
|
- if (TextUtils.isEmpty(tag_hospital_doctor.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- map.put("sb_username", StringUtil.getTextRexHttp(tag_hospital_doctor));//服务项目名称
|
|
|
- map.put("sb_userid", tag_hospital_doctor.getTag(R.id.tag_id));//服务项目ID
|
|
|
- }
|
|
|
- break;
|
|
|
- case "会所":
|
|
|
- if (TextUtils.isEmpty(tv_club_time.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- setTime(map, tv_club_time);
|
|
|
- }
|
|
|
- if (TextUtils.isEmpty(tv_club_peoples.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- map.put("sb_person", StringUtil.getFirstInt(tv_club_peoples.getText().toString(), 1));//人数
|
|
|
- }
|
|
|
-
|
|
|
- if (TextUtils.isEmpty(tv_club_technician.getText()) || tv_club_technician.getTag(R.id.tag_id) == null) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- map.put("sb_stname", StringUtil.getTextRexHttp(tv_club_technician));//服务项目名称
|
|
|
- map.put("sb_stid", tv_club_technician.getTag(R.id.tag_id));//服务项目ID
|
|
|
- }
|
|
|
- if (!StringUtil.isEmpty(sb_userid)) {
|
|
|
- map.put("sb_userid", sb_userid);//技师ID
|
|
|
- }
|
|
|
- if (!StringUtil.isEmpty(sb_username)) {
|
|
|
- map.put("sb_username", sb_username);//技师名字
|
|
|
- }
|
|
|
- break;
|
|
|
- case "KTV":
|
|
|
- if (TextUtils.isEmpty(tv_ktv_times.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- setTime(map, tv_ktv_times);
|
|
|
- }
|
|
|
- if (TextUtils.isEmpty(tv_ktv_peoples.getText())) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- map.put("sb_person", StringUtil.getFirstInt(tv_ktv_peoples.getText().toString(), 1));//人数
|
|
|
- }
|
|
|
- if (TextUtils.isEmpty(tv_ktv_rooms.getText()) || tv_ktv_rooms.getTag(R.id.tag_id) == null) {
|
|
|
- return null;
|
|
|
- } else {
|
|
|
- map.put("sb_spname", StringUtil.getTextRexHttp(tv_ktv_rooms));//服务项目名称
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private void setTime(Map<String, Object> map, TextView tv) {
|
|
|
- //这个需要与选择时段相对应,有model确定选择的是时间点还是时段
|
|
|
- if (tv == null || TextUtils.isEmpty(tv.getText())) {
|
|
|
- return;
|
|
|
- }
|
|
|
- String message = tv.getText().toString();
|
|
|
- if ("1".equals(model.getBookType())) {//时段
|
|
|
- Object start = tv.getTag(R.id.tag_id);
|
|
|
- Object end = tv.getTag(R.id.tag_id2);
|
|
|
- if (start != null && start instanceof String) {
|
|
|
- map.put("sb_starttime", start.toString() + ":00");
|
|
|
- }
|
|
|
- if (end != null && end instanceof String) {
|
|
|
- map.put("sb_endtime", end.toString() + ":00");
|
|
|
- }
|
|
|
- } else {//时间点
|
|
|
- map.put("sb_endtime", message + ":00");
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private void initType(String type) {
|
|
|
- if (type == null) return;
|
|
|
- JSONObject data = null;
|
|
|
- if (!isEdited) {
|
|
|
- if (dataService != null) {
|
|
|
- data = JSON.parseObject(dataService);
|
|
|
- }
|
|
|
- et_book_phone.setText(data.getString("sb_telephone"));
|
|
|
- et_book_name.setText(data.getString("sb_recordor"));
|
|
|
- et_book_notes.setText(data.getString("sb_remark"));
|
|
|
- et_book_phone.setEnabled(false);
|
|
|
- et_book_name.setEnabled(false);
|
|
|
- et_book_notes.setEnabled(false);
|
|
|
- }
|
|
|
- switch (type) {
|
|
|
- case "餐饮"://餐饮
|
|
|
- findViewById(R.id.ll_food).setVisibility(View.VISIBLE);
|
|
|
- if (isEdited) {
|
|
|
- tv_food_times.setOnClickListener(this);
|
|
|
- tv_food_rooms.setOnClickListener(this);
|
|
|
- tv_food_peoples.setOnClickListener(this);
|
|
|
- } else {
|
|
|
- tv_food_times.setText(data.getString("sb_endtime"));
|
|
|
- tv_food_rooms.setText(data.getString("sb_stname"));
|
|
|
- tv_food_peoples.setText(data.getString("sb_person"));
|
|
|
- }
|
|
|
- break;
|
|
|
- case "美容美发":// 美容美发
|
|
|
- findViewById(R.id.ll_hair).setVisibility(View.VISIBLE);
|
|
|
- if (isEdited) {
|
|
|
- tv_hair_rooms.setOnClickListener(this);
|
|
|
- tv_hair_times.setOnClickListener(this);
|
|
|
- } else {
|
|
|
- tv_hair_times.setText(data.getString("sb_endtime"));
|
|
|
- tv_hair_rooms.setText(data.getString("sb_stname"));
|
|
|
- }
|
|
|
- break;
|
|
|
- case "运动健身":
|
|
|
- findViewById(R.id.ll_sport).setVisibility(View.VISIBLE);
|
|
|
- if (isEdited) {
|
|
|
- tv_sport_peoples.setOnClickListener(this);
|
|
|
- tv_sport_rooms.setOnClickListener(this);
|
|
|
- tv_sport_time.setOnClickListener(this);
|
|
|
- } else {
|
|
|
- tv_sport_time.setText(data.getString("sb_endtime"));
|
|
|
- tv_sport_rooms.setText(data.getString("sb_stname"));
|
|
|
- tv_sport_peoples.setText(data.getString("sb_person"));
|
|
|
- }
|
|
|
- break;
|
|
|
- case "医疗":
|
|
|
- findViewById(R.id.ll_hospital).setVisibility(View.VISIBLE);
|
|
|
- if (isEdited) {
|
|
|
- tv_hospital_rooms.setOnClickListener(this);
|
|
|
- tag_hospital_doctor.setOnClickListener(this);
|
|
|
- tv_hospital_time.setOnClickListener(this);
|
|
|
- } else {
|
|
|
- tv_hospital_time.setText(data.getString("sb_endtime"));
|
|
|
- tv_hospital_rooms.setText(data.getString("sb_stname"));
|
|
|
- tag_hospital_doctor.setText(data.getString("sb_username"));
|
|
|
- }
|
|
|
- break;
|
|
|
- case "会所":
|
|
|
- findViewById(R.id.ll_club).setVisibility(View.VISIBLE);
|
|
|
- if (isEdited) {
|
|
|
- tv_club_technician.setOnClickListener(this);
|
|
|
- tv_club_time.setOnClickListener(this);
|
|
|
- tv_club_peoples.setOnClickListener(this);
|
|
|
- } else {
|
|
|
- tv_club_time.setText(data.getString("sb_endtime"));
|
|
|
- tv_club_technician.setText(data.getString("sb_stname"));
|
|
|
- tv_club_peoples.setText(data.getString("sb_person"));
|
|
|
- }
|
|
|
- break;
|
|
|
- case "KTV":
|
|
|
- findViewById(R.id.ll_ktv).setVisibility(View.VISIBLE);
|
|
|
- if (isEdited) {
|
|
|
- tv_ktv_times.setOnClickListener(this);
|
|
|
- tv_ktv_rooms.setOnClickListener(this);
|
|
|
- tv_ktv_peoples.setOnClickListener(this);
|
|
|
- } else {
|
|
|
- tv_ktv_times.setText(data.getString("sb_endtime"));
|
|
|
- tv_ktv_rooms.setText(data.getString("sb_spname"));
|
|
|
- tv_ktv_peoples.setText(data.getString("sb_person"));
|
|
|
- }
|
|
|
- break;
|
|
|
- case "10001"://医院
|
|
|
- findViewById(R.id.ll_hospital).setVisibility(View.VISIBLE);
|
|
|
- if (isEdited) {
|
|
|
- tv_hospital_rooms.setOnClickListener(this);
|
|
|
- tag_hospital_doctor.setOnClickListener(this);
|
|
|
- tv_hospital_time.setOnClickListener(this);
|
|
|
- } else {
|
|
|
- tv_hospital_time.setText(data.getString("sb_endtime"));
|
|
|
- tv_hospital_rooms.setText(data.getString("sb_stname"));
|
|
|
- tag_hospital_doctor.setText(data.getString("sb_username"));
|
|
|
- }
|
|
|
- break;
|
|
|
- case "10002"://运动健身
|
|
|
- findViewById(R.id.ll_sport).setVisibility(View.VISIBLE);
|
|
|
- if (isEdited) {
|
|
|
- tv_sport_peoples.setOnClickListener(this);
|
|
|
- tv_sport_rooms.setOnClickListener(this);
|
|
|
- tv_sport_time.setOnClickListener(this);
|
|
|
- } else {
|
|
|
- tv_sport_time.setText(data.getString("sb_endtime"));
|
|
|
- tv_sport_rooms.setText(data.getString("sb_stname"));
|
|
|
- tv_sport_peoples.setText(data.getString("sb_person"));
|
|
|
- }
|
|
|
- break;
|
|
|
- case "10003"://餐饮
|
|
|
- findViewById(R.id.ll_food).setVisibility(View.VISIBLE);
|
|
|
- if (isEdited) {
|
|
|
- tv_food_times.setOnClickListener(this);
|
|
|
- tv_food_rooms.setOnClickListener(this);
|
|
|
- tv_food_peoples.setOnClickListener(this);
|
|
|
- } else {
|
|
|
- tv_food_times.setText(data.getString("sb_endtime"));
|
|
|
- tv_food_rooms.setText(data.getString("sb_spname"));
|
|
|
- tv_food_peoples.setText(data.getString("sb_person"));
|
|
|
- }
|
|
|
- break;
|
|
|
- case "10004"://美容美发
|
|
|
- findViewById(R.id.ll_hair).setVisibility(View.VISIBLE);
|
|
|
- if (isEdited) {
|
|
|
- tv_hair_rooms.setOnClickListener(this);
|
|
|
- tv_hair_times.setOnClickListener(this);
|
|
|
- } else {
|
|
|
- tv_hair_times.setText(data.getString("sb_endtime"));
|
|
|
- tv_hair_rooms.setText(data.getString("sb_stname"));
|
|
|
- }
|
|
|
- break;
|
|
|
- case "10005"://会所
|
|
|
- findViewById(R.id.ll_club).setVisibility(View.VISIBLE);
|
|
|
- if (isEdited) {
|
|
|
- tv_club_technician.setOnClickListener(this);
|
|
|
- tv_club_time.setOnClickListener(this);
|
|
|
- tv_club_peoples.setOnClickListener(this);
|
|
|
- } else {
|
|
|
- tv_club_time.setText(data.getString("sb_endtime"));
|
|
|
- tv_club_technician.setText(data.getString("sb_stname"));
|
|
|
- tv_club_peoples.setText(data.getString("sb_person"));
|
|
|
- }
|
|
|
- break;
|
|
|
- case "10006"://ktv
|
|
|
- findViewById(R.id.ll_ktv).setVisibility(View.VISIBLE);
|
|
|
- if (isEdited) {
|
|
|
- tv_ktv_times.setOnClickListener(this);
|
|
|
- tv_ktv_rooms.setOnClickListener(this);
|
|
|
- tv_ktv_peoples.setOnClickListener(this);
|
|
|
- } else {
|
|
|
- tv_ktv_times.setText(data.getString("sb_endtime"));
|
|
|
- tv_ktv_rooms.setText(data.getString("sb_spname"));
|
|
|
- tv_ktv_peoples.setText(data.getString("sb_person"));
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+ final String startTime = map.get("sb_endtime").toString();
|
|
|
+ new HttpClient
|
|
|
+ .Builder(Constants.IM_BASE_URL)
|
|
|
+ .isDebug(BaseConfig.isDebug())
|
|
|
+ .build()
|
|
|
+ .Api()
|
|
|
+ .send(new HttpClient.Builder()
|
|
|
+ .url("/user/appSaveService")
|
|
|
+ .add("map", JSONUtil.map2JSON(map))
|
|
|
+ .add("token", MyApplication.getInstance().mAccessToken)
|
|
|
+ .method(Method.POST)
|
|
|
+ .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));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Object> getServiceMap() {
|
|
|
+ Map<String, Object> map = getMapFormType();
|
|
|
+ if (map == null) {
|
|
|
+ LogUtil.i("getServiceMap==nulll");
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+ map.put("sb_recordid", MyApplication.getInstance().getLoginUserId());//当前用户ID
|
|
|
+ if (TextUtils.isEmpty(et_book_name.getText())) {
|
|
|
+ showToast("姓名为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ map.put("sb_recordor", StringUtil.getTextRexHttp(et_book_name));//姓名
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(et_book_phone.getText())) {
|
|
|
+ showToast("电话为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ map.put("sb_telephone", StringUtil.getTextRexHttp(et_book_phone));//姓名
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(et_book_notes.getText())) {
|
|
|
+ showToast("备注为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ map.put("sb_remark", StringUtil.getTextRexHttp(et_book_notes));//姓名
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("sb_industry", model.getIndustrycode());
|
|
|
+ map.put("sb_companyid", StringUtil.toHttpString(model.getCompanyid()));//商家ID
|
|
|
+ map.put("sb_companyname", StringUtil.toHttpString(model.getName()));//商家名称
|
|
|
+ map.put("sb_address", StringUtil.toHttpString(model.getAddress()));//地址
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Object> getMapFormType() {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ switch (model.getType()) {
|
|
|
+ case "餐饮"://餐饮st_id
|
|
|
+ if (TextUtils.isEmpty(tv_food_peoples.getText())) {
|
|
|
+ showToast("用餐人数为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ map.put("sb_person", StringUtil.getTextRexHttp(tv_food_peoples));//姓名
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(tv_food_times.getText())) {
|
|
|
+ showToast("用餐时间为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ //sb_enddate的格式是yyyy-MM-dd HH:mm:ss
|
|
|
+ setTime(map, tv_food_times);
|
|
|
+ }
|
|
|
+ if (!TextUtils.isEmpty(tv_food_rooms.getText())) {
|
|
|
+ map.put("sb_spname", tv_food_rooms.getText());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "美容美发":
|
|
|
+ if (TextUtils.isEmpty(tv_hair_rooms.getText()) || tv_hair_rooms.getTag(R.id.tag_id) == null) {
|
|
|
+ showToast("服务项目为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ map.put("sb_stname", StringUtil.getTextRexHttp(tv_hair_rooms));//服务项目名称
|
|
|
+ map.put("sb_stid", tv_hair_rooms.getTag(R.id.tag_id));//服务项目ID
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(tv_hair_times.getText())) {
|
|
|
+ showToast("服务时间为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ setTime(map, tv_hair_times);
|
|
|
+ }
|
|
|
+ if (!StringUtil.isEmpty(sb_userid)) {
|
|
|
+ map.put("sb_userid", sb_userid);//技师ID
|
|
|
+ }
|
|
|
+ if (!StringUtil.isEmpty(sb_username)) {
|
|
|
+ map.put("sb_username", sb_username);//技师名字
|
|
|
+ }
|
|
|
+ map.put("sb_person", 1);//人数
|
|
|
+ break;
|
|
|
+ case "运动健身":
|
|
|
+ if (TextUtils.isEmpty(tv_sport_time.getText())) {
|
|
|
+ showToast("运动时间为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ //sb_enddate的格式是yyyy-MM-dd HH:mm:ss
|
|
|
+ setTime(map, tv_sport_time);
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(tv_sport_peoples.getText())) {
|
|
|
+ showToast("运动人数为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ map.put("sb_person", StringUtil.getFirstInt(tv_sport_peoples.getText().toString(), 1));//人数
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(tv_sport_rooms.getText())) {
|
|
|
+ showToast("运动项目为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ map.put("sb_spname", StringUtil.getTextRexHttp(tv_sport_peoples));//场地名称
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "医疗":
|
|
|
+ if (TextUtils.isEmpty(tv_hospital_time.getText())) {
|
|
|
+ showToast("时段为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ setTime(map, tv_hospital_time);
|
|
|
+ }
|
|
|
+ //|| tv_hospital_rooms.getTag(R.id.tag_id) == null
|
|
|
+ if (TextUtils.isEmpty(tv_hospital_rooms.getText())) {
|
|
|
+ showToast("科室为必填项", R.color.load_error);
|
|
|
+
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ map.put("sb_stname", StringUtil.getTextRexHttp(tv_hospital_rooms));//服务项目名称
|
|
|
+ map.put("sb_stid", tv_hospital_rooms.getTag(R.id.tag_id));//服务项目ID
|
|
|
+ }
|
|
|
+ //|| tag_hospital_doctor.getTag(R.id.tag_id) == null
|
|
|
+ if (TextUtils.isEmpty(tag_hospital_doctor.getText())) {
|
|
|
+ showToast("医生为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ map.put("sb_username", StringUtil.getTextRexHttp(tag_hospital_doctor));//服务项目名称
|
|
|
+ map.put("sb_userid", tag_hospital_doctor.getTag(R.id.tag_id));//服务项目ID
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "会所":
|
|
|
+ if (TextUtils.isEmpty(tv_club_time.getText())) {
|
|
|
+ showToast("服务时段为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ setTime(map, tv_club_time);
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(tv_club_peoples.getText())) {
|
|
|
+ showToast("人数为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ map.put("sb_person", StringUtil.getFirstInt(tv_club_peoples.getText().toString(), 1));//人数
|
|
|
+ }
|
|
|
+
|
|
|
+ if (TextUtils.isEmpty(tv_club_technician.getText()) || tv_club_technician.getTag(R.id.tag_id) == null) {
|
|
|
+ showToast("服务项目为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ map.put("sb_stname", StringUtil.getTextRexHttp(tv_club_technician));//服务项目名称
|
|
|
+ map.put("sb_stid", tv_club_technician.getTag(R.id.tag_id));//服务项目ID
|
|
|
+ }
|
|
|
+ if (!StringUtil.isEmpty(sb_userid)) {
|
|
|
+ map.put("sb_userid", sb_userid);//技师ID
|
|
|
+ }
|
|
|
+ if (!StringUtil.isEmpty(sb_username)) {
|
|
|
+ map.put("sb_username", sb_username);//技师名字
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "KTV":
|
|
|
+ if (TextUtils.isEmpty(tv_ktv_times.getText())) {
|
|
|
+ showToast("时段为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ setTime(map, tv_ktv_times);
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(tv_ktv_peoples.getText())) {
|
|
|
+ showToast("人数为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ map.put("sb_person", StringUtil.getFirstInt(tv_ktv_peoples.getText().toString(), 1));//人数
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(tv_ktv_rooms.getText()) || tv_ktv_rooms.getTag(R.id.tag_id) == null) {
|
|
|
+ showToast("包房为必填项", R.color.load_error);
|
|
|
+ return null;
|
|
|
+ } else {
|
|
|
+ map.put("sb_spname", StringUtil.getTextRexHttp(tv_ktv_rooms));//服务项目名称
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void setTime(Map<String, Object> map, TextView tv) {
|
|
|
+ //这个需要与选择时段相对应,有model确定选择的是时间点还是时段
|
|
|
+ if (tv == null || TextUtils.isEmpty(tv.getText())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String message = tv.getText().toString();
|
|
|
+ if ("1".equals(model.getBookType())) {//时段
|
|
|
+ Object start = tv.getTag(R.id.tag_id);
|
|
|
+ Object end = tv.getTag(R.id.tag_id2);
|
|
|
+ if (start != null && start instanceof String) {
|
|
|
+ map.put("sb_starttime", start.toString() + ":00");
|
|
|
+ }
|
|
|
+ if (end != null && end instanceof String) {
|
|
|
+ map.put("sb_endtime", end.toString() + ":00");
|
|
|
+ }
|
|
|
+ } else {//时间点
|
|
|
+ map.put("sb_endtime", message + ":00");
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void initType(String type) {
|
|
|
+ if (type == null) return;
|
|
|
+ JSONObject data = null;
|
|
|
+ if (!isEdited) {
|
|
|
+ if (dataService != null) {
|
|
|
+ data = JSON.parseObject(dataService);
|
|
|
+ }
|
|
|
+ et_book_phone.setText(data.getString("sb_telephone"));
|
|
|
+ et_book_name.setText(data.getString("sb_recordor"));
|
|
|
+ et_book_notes.setText(data.getString("sb_remark"));
|
|
|
+ et_book_phone.setEnabled(false);
|
|
|
+ et_book_name.setEnabled(false);
|
|
|
+ et_book_notes.setEnabled(false);
|
|
|
+ }
|
|
|
+ switch (type) {
|
|
|
+ case "餐饮"://餐饮
|
|
|
+ findViewById(R.id.ll_food).setVisibility(View.VISIBLE);
|
|
|
+ if (isEdited) {
|
|
|
+ tv_food_times.setOnClickListener(this);
|
|
|
+ tv_food_rooms.setOnClickListener(this);
|
|
|
+ tv_food_peoples.setOnClickListener(this);
|
|
|
+ } else {
|
|
|
+ tv_food_times.setText(data.getString("sb_endtime"));
|
|
|
+ tv_food_rooms.setText(data.getString("sb_stname"));
|
|
|
+ tv_food_peoples.setText(data.getString("sb_person"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "美容美发":// 美容美发
|
|
|
+ findViewById(R.id.ll_hair).setVisibility(View.VISIBLE);
|
|
|
+ if (isEdited) {
|
|
|
+ tv_hair_rooms.setOnClickListener(this);
|
|
|
+ tv_hair_times.setOnClickListener(this);
|
|
|
+ } else {
|
|
|
+ tv_hair_times.setText(data.getString("sb_endtime"));
|
|
|
+ tv_hair_rooms.setText(data.getString("sb_stname"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "运动健身":
|
|
|
+ findViewById(R.id.ll_sport).setVisibility(View.VISIBLE);
|
|
|
+ if (isEdited) {
|
|
|
+ tv_sport_peoples.setOnClickListener(this);
|
|
|
+ tv_sport_rooms.setOnClickListener(this);
|
|
|
+ tv_sport_time.setOnClickListener(this);
|
|
|
+ } else {
|
|
|
+ tv_sport_time.setText(data.getString("sb_endtime"));
|
|
|
+ tv_sport_rooms.setText(data.getString("sb_stname"));
|
|
|
+ tv_sport_peoples.setText(data.getString("sb_person"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "医疗":
|
|
|
+ findViewById(R.id.ll_hospital).setVisibility(View.VISIBLE);
|
|
|
+ if (isEdited) {
|
|
|
+ tv_hospital_rooms.setOnClickListener(this);
|
|
|
+ tag_hospital_doctor.setOnClickListener(this);
|
|
|
+ tv_hospital_time.setOnClickListener(this);
|
|
|
+ } else {
|
|
|
+ tv_hospital_time.setText(data.getString("sb_endtime"));
|
|
|
+ tv_hospital_rooms.setText(data.getString("sb_stname"));
|
|
|
+ tag_hospital_doctor.setText(data.getString("sb_username"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "会所":
|
|
|
+ findViewById(R.id.ll_club).setVisibility(View.VISIBLE);
|
|
|
+ if (isEdited) {
|
|
|
+ tv_club_technician.setOnClickListener(this);
|
|
|
+ tv_club_time.setOnClickListener(this);
|
|
|
+ tv_club_peoples.setOnClickListener(this);
|
|
|
+ } else {
|
|
|
+ tv_club_time.setText(data.getString("sb_endtime"));
|
|
|
+ tv_club_technician.setText(data.getString("sb_stname"));
|
|
|
+ tv_club_peoples.setText(data.getString("sb_person"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "KTV":
|
|
|
+ findViewById(R.id.ll_ktv).setVisibility(View.VISIBLE);
|
|
|
+ if (isEdited) {
|
|
|
+ tv_ktv_times.setOnClickListener(this);
|
|
|
+ tv_ktv_rooms.setOnClickListener(this);
|
|
|
+ tv_ktv_peoples.setOnClickListener(this);
|
|
|
+ } else {
|
|
|
+ tv_ktv_times.setText(data.getString("sb_endtime"));
|
|
|
+ tv_ktv_rooms.setText(data.getString("sb_spname"));
|
|
|
+ tv_ktv_peoples.setText(data.getString("sb_person"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "10001"://医院
|
|
|
+ findViewById(R.id.ll_hospital).setVisibility(View.VISIBLE);
|
|
|
+ if (isEdited) {
|
|
|
+ tv_hospital_rooms.setOnClickListener(this);
|
|
|
+ tag_hospital_doctor.setOnClickListener(this);
|
|
|
+ tv_hospital_time.setOnClickListener(this);
|
|
|
+ } else {
|
|
|
+ tv_hospital_time.setText(data.getString("sb_endtime"));
|
|
|
+ tv_hospital_rooms.setText(data.getString("sb_stname"));
|
|
|
+ tag_hospital_doctor.setText(data.getString("sb_username"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "10002"://运动健身
|
|
|
+ findViewById(R.id.ll_sport).setVisibility(View.VISIBLE);
|
|
|
+ if (isEdited) {
|
|
|
+ tv_sport_peoples.setOnClickListener(this);
|
|
|
+ tv_sport_rooms.setOnClickListener(this);
|
|
|
+ tv_sport_time.setOnClickListener(this);
|
|
|
+ } else {
|
|
|
+ tv_sport_time.setText(data.getString("sb_endtime"));
|
|
|
+ tv_sport_rooms.setText(data.getString("sb_stname"));
|
|
|
+ tv_sport_peoples.setText(data.getString("sb_person"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "10003"://餐饮
|
|
|
+ findViewById(R.id.ll_food).setVisibility(View.VISIBLE);
|
|
|
+ if (isEdited) {
|
|
|
+ tv_food_times.setOnClickListener(this);
|
|
|
+ tv_food_rooms.setOnClickListener(this);
|
|
|
+ tv_food_peoples.setOnClickListener(this);
|
|
|
+ } else {
|
|
|
+ tv_food_times.setText(data.getString("sb_endtime"));
|
|
|
+ tv_food_rooms.setText(data.getString("sb_spname"));
|
|
|
+ tv_food_peoples.setText(data.getString("sb_person"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "10004"://美容美发
|
|
|
+ findViewById(R.id.ll_hair).setVisibility(View.VISIBLE);
|
|
|
+ if (isEdited) {
|
|
|
+ tv_hair_rooms.setOnClickListener(this);
|
|
|
+ tv_hair_times.setOnClickListener(this);
|
|
|
+ } else {
|
|
|
+ tv_hair_times.setText(data.getString("sb_endtime"));
|
|
|
+ tv_hair_rooms.setText(data.getString("sb_stname"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "10005"://会所
|
|
|
+ findViewById(R.id.ll_club).setVisibility(View.VISIBLE);
|
|
|
+ if (isEdited) {
|
|
|
+ tv_club_technician.setOnClickListener(this);
|
|
|
+ tv_club_time.setOnClickListener(this);
|
|
|
+ tv_club_peoples.setOnClickListener(this);
|
|
|
+ } else {
|
|
|
+ tv_club_time.setText(data.getString("sb_endtime"));
|
|
|
+ tv_club_technician.setText(data.getString("sb_stname"));
|
|
|
+ tv_club_peoples.setText(data.getString("sb_person"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "10006"://ktv
|
|
|
+ findViewById(R.id.ll_ktv).setVisibility(View.VISIBLE);
|
|
|
+ if (isEdited) {
|
|
|
+ tv_ktv_times.setOnClickListener(this);
|
|
|
+ tv_ktv_rooms.setOnClickListener(this);
|
|
|
+ tv_ktv_peoples.setOnClickListener(this);
|
|
|
+ } else {
|
|
|
+ tv_ktv_times.setText(data.getString("sb_endtime"));
|
|
|
+ tv_ktv_rooms.setText(data.getString("sb_spname"));
|
|
|
+ tv_ktv_peoples.setText(data.getString("sb_person"));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|