|
|
@@ -0,0 +1,148 @@
|
|
|
+package com.uas.appme.settings.activity;
|
|
|
+
|
|
|
+import android.content.Context;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.view.View;
|
|
|
+import android.view.ViewGroup;
|
|
|
+import android.widget.BaseAdapter;
|
|
|
+import android.widget.TextView;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.common.LogUtil;
|
|
|
+import com.common.data.JSONUtil;
|
|
|
+import com.common.data.ListUtils;
|
|
|
+import com.core.app.MyApplication;
|
|
|
+import com.core.base.BaseActivity;
|
|
|
+import com.core.widget.MyListView;
|
|
|
+import com.me.network.app.http.HttpClient;
|
|
|
+import com.me.network.app.http.Method;
|
|
|
+import com.me.network.app.http.rx.ResultListener;
|
|
|
+import com.me.network.app.http.rx.ResultSubscriber;
|
|
|
+import com.uas.appme.R;
|
|
|
+import com.uas.appme.settings.Constant.Constant;
|
|
|
+import com.uas.appme.settings.model.ComRestBean;
|
|
|
+import com.uas.appme.settings.model.PersonSetingBean;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by FANGlh on 2017/10/12.
|
|
|
+ * function:
|
|
|
+ */
|
|
|
+
|
|
|
+public class BComSetRestActivity extends BaseActivity implements View.OnClickListener{
|
|
|
+ private MyListView mComList;
|
|
|
+ private List<ComRestBean> mList; //进行保存的员工休息数据列表
|
|
|
+ private PersonSetingBean mServicePersonList; //获取商家服务人员
|
|
|
+ private int mList_size = 0;
|
|
|
+ private ComRestAdapter myAdapter;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onCreate(Bundle savedInstanceState) {
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
+ setContentView(R.layout.service_bcom_setting_activity);
|
|
|
+ initView();
|
|
|
+ initData();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initData() {
|
|
|
+
|
|
|
+ //获取商家服务人员
|
|
|
+ HttpClient httpClient = new HttpClient.Builder(Constant.BASE_BOOKING_SETTING_URL).isDebug(true).build(true);
|
|
|
+ httpClient.Api().send(new HttpClient.Builder()
|
|
|
+ .url("user/appStoreman")
|
|
|
+ .add("companyid", 201)
|
|
|
+ .add("serviceid", MyApplication.getInstance().mLoginUser.getUserId())
|
|
|
+ .add("token",MyApplication.getInstance().mAccessToken)
|
|
|
+ .method(Method.GET)
|
|
|
+ .build(),new ResultSubscriber<>(new ResultListener<Object>() {
|
|
|
+ @Override
|
|
|
+ public void onResponse(Object o) {
|
|
|
+ if (!JSONUtil.validate(o.toString()) || o == null) return;
|
|
|
+ LogUtil.prinlnLongMsg("appStoreman", o.toString()+"");
|
|
|
+ try {
|
|
|
+ mServicePersonList = JSON.parseObject(o.toString(),PersonSetingBean.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void initView() {
|
|
|
+ mList = new ArrayList<>();
|
|
|
+ mServicePersonList = new PersonSetingBean();
|
|
|
+ mComList = (MyListView) findViewById(R.id.com_list);
|
|
|
+ findViewById(R.id.add_new_rl).setOnClickListener(this);
|
|
|
+ myAdapter = new ComRestAdapter(this);
|
|
|
+ myAdapter.setModelList(mList);
|
|
|
+ mComList.setAdapter(myAdapter);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ if (v.getId() == R.id.add_new_rl){
|
|
|
+ mList_size++ ;
|
|
|
+ myAdapter.notifyDataSetChanged();
|
|
|
+ }else if (v.getId() == R.id.save_bt){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private class ComRestAdapter extends BaseAdapter{
|
|
|
+ private Context mContext;
|
|
|
+ private List<ComRestBean> modelList;
|
|
|
+
|
|
|
+ public List<ComRestBean> getModelList() {
|
|
|
+ return modelList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setModelList(List<ComRestBean> modelList) {
|
|
|
+ this.modelList = modelList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ComRestAdapter(Context mContext){
|
|
|
+ this.mContext = mContext;
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public int getCount() { return mList_size;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object getItem(int position) {
|
|
|
+ return mList.get(position);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public long getItemId(int position) {
|
|
|
+ return position;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public View getView(int position, View convertView, ViewGroup parent) {
|
|
|
+ ViewHolder viewHolder = null;
|
|
|
+ if (convertView == null){
|
|
|
+ viewHolder = new ViewHolder();
|
|
|
+ convertView = View.inflate(mContext, R.layout.com_rest_item,null);
|
|
|
+ viewHolder.name_tv = (TextView) convertView.findViewById(R.id.name_tv);
|
|
|
+ viewHolder.date_tv = (TextView) convertView.findViewById(R.id.date_tv);
|
|
|
+ convertView.setTag(viewHolder);
|
|
|
+ }else {
|
|
|
+ viewHolder = (ViewHolder) convertView.getTag();
|
|
|
+ }
|
|
|
+ if (!ListUtils.isEmpty(mList)){
|
|
|
+ viewHolder.name_tv.setText(mList.get(position).getSf_username()+"");
|
|
|
+ viewHolder.date_tv.setText(mList.get(position).getSf_date()+"");
|
|
|
+ }
|
|
|
+ return convertView;
|
|
|
+ }
|
|
|
+
|
|
|
+ class ViewHolder{
|
|
|
+ TextView name_tv;
|
|
|
+ TextView date_tv;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|