Browse Source

添加保存个人商家休息时间

Bitliker 8 years ago
parent
commit
36e576b93d

+ 89 - 32
app_core/common/src/main/res/layout/bsetting_activity.xml

@@ -1,17 +1,20 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical">
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:orientation="vertical">
+
     <RelativeLayout
         android:id="@+id/image_setting_rl"
         style="@style/IMTbleLine"
         android:background="@drawable/selector_me_menu_item_bg">
+
         <View
-            android:layout_alignParentBottom="true"
             android:layout_width="match_parent"
             android:layout_height="@dimen/line"
-            android:background="@color/item_line" />
+            android:layout_alignParentBottom="true"
+            android:background="@color/item_line"/>
+
         <TextView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -19,22 +22,24 @@
             android:gravity="center"
             android:text="形象照片"
             android:textColor="@color/black"
-            android:textSize="14sp" />
+            android:textSize="14sp"/>
+
         <ImageView
             android:layout_width="@dimen/next_width"
             android:layout_height="@dimen/next_height"
             android:layout_alignParentRight="true"
             android:layout_centerVertical="true"
             android:background="@drawable/oa_next"
-            android:contentDescription="@string/app_name" />
+            android:contentDescription="@string/app_name"/>
+
         <TextView
             android:id="@+id/image_setting_new"
             android:layout_width="10dp"
             android:layout_height="10dp"
+            android:layout_alignParentRight="true"
             android:layout_alignTop="@+id/tv_oa"
             android:layout_centerVertical="true"
             android:layout_marginRight="10dp"
-            android:layout_alignParentRight="true"
             android:background="@drawable/hongdian"
             android:textColor="@android:color/white"
             android:textSize="10.0dip"
@@ -45,11 +50,13 @@
         android:id="@+id/keshi_setting_rl"
         style="@style/IMTbleLine"
         android:background="@drawable/selector_me_menu_item_bg">
+
         <View
-            android:layout_alignParentBottom="true"
             android:layout_width="match_parent"
             android:layout_height="@dimen/line"
-            android:background="@color/item_line" />
+            android:layout_alignParentBottom="true"
+            android:background="@color/item_line"/>
+
         <TextView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -57,25 +64,29 @@
             android:gravity="center"
             android:text="科室设置"
             android:textColor="@color/black"
-            android:textSize="14sp" />
+            android:textSize="14sp"/>
+
         <ImageView
             android:layout_width="@dimen/next_width"
             android:layout_height="@dimen/next_height"
             android:layout_alignParentRight="true"
             android:layout_centerVertical="true"
             android:background="@drawable/oa_next"
-            android:contentDescription="@string/app_name" />
+            android:contentDescription="@string/app_name"/>
 
     </RelativeLayout>
+
     <RelativeLayout
         android:id="@+id/people_setting_rl"
         style="@style/IMTbleLine"
         android:background="@drawable/selector_me_menu_item_bg">
+
         <View
-            android:layout_alignParentBottom="true"
             android:layout_width="match_parent"
             android:layout_height="@dimen/line"
-            android:background="@color/item_line" />
+            android:layout_alignParentBottom="true"
+            android:background="@color/item_line"/>
+
         <TextView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -83,23 +94,28 @@
             android:gravity="center"
             android:text="人员设置"
             android:textColor="@color/black"
-            android:textSize="14sp" />
+            android:textSize="14sp"/>
+
         <ImageView
             android:layout_width="@dimen/next_width"
             android:layout_height="@dimen/next_height"
             android:layout_alignParentRight="true"
             android:layout_centerVertical="true"
             android:background="@drawable/oa_next"
-            android:contentDescription="@string/app_name" />
+            android:contentDescription="@string/app_name"/>
     </RelativeLayout>
+
     <RelativeLayout
+        android:id="@+id/appPersonRest"
         style="@style/IMTbleLine"
         android:background="@drawable/selector_me_menu_item_bg">
+
         <View
-            android:layout_alignParentBottom="true"
             android:layout_width="match_parent"
             android:layout_height="@dimen/line"
-            android:background="@color/item_line" />
+            android:layout_alignParentBottom="true"
+            android:background="@color/item_line"/>
+
         <TextView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -107,25 +123,59 @@
             android:gravity="center"
             android:text="员工休息日设置"
             android:textColor="@color/black"
-            android:textSize="14sp" />
+            android:textSize="14sp"/>
+
         <ImageView
             android:layout_width="@dimen/next_width"
             android:layout_height="@dimen/next_height"
             android:layout_alignParentRight="true"
             android:layout_centerVertical="true"
             android:background="@drawable/oa_next"
-            android:contentDescription="@string/app_name" />
+            android:contentDescription="@string/app_name"/>
 
     </RelativeLayout>
+
     <RelativeLayout
-        android:id="@+id/batchplace_rl"
+        android:id="@+id/appStoreRest"
         style="@style/IMTbleLine"
         android:background="@drawable/selector_me_menu_item_bg">
+
         <View
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/line"
             android:layout_alignParentBottom="true"
+            android:background="@color/item_line"/>
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerVertical="true"
+            android:gravity="center"
+            android:text="商家休息日设置"
+            android:textColor="@color/black"
+            android:textSize="14sp"/>
+
+        <ImageView
+            android:layout_width="@dimen/next_width"
+            android:layout_height="@dimen/next_height"
+            android:layout_alignParentRight="true"
+            android:layout_centerVertical="true"
+            android:background="@drawable/oa_next"
+            android:contentDescription="@string/app_name"/>
+
+    </RelativeLayout>
+
+    <RelativeLayout
+        android:id="@+id/batchplace_rl"
+        style="@style/IMTbleLine"
+        android:background="@drawable/selector_me_menu_item_bg">
+
+        <View
             android:layout_width="match_parent"
             android:layout_height="@dimen/line"
-            android:background="@color/item_line" />
+            android:layout_alignParentBottom="true"
+            android:background="@color/item_line"/>
+
         <TextView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -133,14 +183,15 @@
             android:gravity="center"
             android:text="服务/场地/房间批量设置"
             android:textColor="@color/black"
-            android:textSize="14sp" />
+            android:textSize="14sp"/>
+
         <ImageView
             android:layout_width="@dimen/next_width"
             android:layout_height="@dimen/next_height"
             android:layout_alignParentRight="true"
             android:layout_centerVertical="true"
             android:background="@drawable/oa_next"
-            android:contentDescription="@string/app_name" />
+            android:contentDescription="@string/app_name"/>
 
     </RelativeLayout>
 
@@ -148,11 +199,13 @@
         android:id="@+id/employeerest_rl"
         style="@style/IMTbleLine"
         android:background="@drawable/selector_me_menu_item_bg">
+
         <View
-            android:layout_alignParentBottom="true"
             android:layout_width="match_parent"
             android:layout_height="@dimen/line"
-            android:background="@color/item_line" />
+            android:layout_alignParentBottom="true"
+            android:background="@color/item_line"/>
+
         <TextView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -160,14 +213,15 @@
             android:gravity="center"
             android:text="批量设置员工休息日"
             android:textColor="@color/black"
-            android:textSize="14sp" />
+            android:textSize="14sp"/>
+
         <ImageView
             android:layout_width="@dimen/next_width"
             android:layout_height="@dimen/next_height"
             android:layout_alignParentRight="true"
             android:layout_centerVertical="true"
             android:background="@drawable/oa_next"
-            android:contentDescription="@string/app_name" />
+            android:contentDescription="@string/app_name"/>
 
     </RelativeLayout>
 
@@ -175,11 +229,13 @@
         android:id="@+id/companyrest_rl"
         style="@style/IMTbleLine"
         android:background="@drawable/selector_me_menu_item_bg">
+
         <View
-            android:layout_alignParentBottom="true"
             android:layout_width="match_parent"
             android:layout_height="@dimen/line"
-            android:background="@color/item_line" />
+            android:layout_alignParentBottom="true"
+            android:background="@color/item_line"/>
+
         <TextView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -187,14 +243,15 @@
             android:gravity="center"
             android:text="批量设置企业休息日"
             android:textColor="@color/black"
-            android:textSize="14sp" />
+            android:textSize="14sp"/>
+
         <ImageView
             android:layout_width="@dimen/next_width"
             android:layout_height="@dimen/next_height"
             android:layout_alignParentRight="true"
             android:layout_centerVertical="true"
             android:background="@drawable/oa_next"
-            android:contentDescription="@string/app_name" />
+            android:contentDescription="@string/app_name"/>
 
     </RelativeLayout>
 

+ 1 - 0
app_modular/appme/build.gradle

@@ -25,4 +25,5 @@ dependencies {
     compile project(':appworks')
     compile project(':applogin')
     compile project(':appcontact')
+    compile 'com.android.support.constraint:constraint-layout:1.0.2'
 }

+ 39 - 28
app_modular/appme/src/main/AndroidManifest.xml

@@ -1,60 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.uas.appme" >
+          package="com.uas.appme">
+
+    <uses-permission android:name="android.permission.CALL_PHONE"/>
 
-    <uses-permission android:name="android.permission.CALL_PHONE" />
     <application
         android:allowBackup="true"
         android:label="@string/app_name"
         android:supportsRtl="true">
-
-        <activity android:name="com.uas.appme.pedometer.view.NewStepActivity"
-            android:label="@string/set_sport"></activity>
-
         <activity
-            android:name="com.uas.appme.pedometer.view.NewStepListActivity"
+            android:name=".pedometer.view.NewStepActivity"
+            android:label="@string/set_sport"/>
+        <activity
+            android:name=".pedometer.view.NewStepListActivity"
             android:label="@string/sports_recode_more"/>
-        <activity android:name="com.uas.appme.pedometer.view.StepSplashActivity"></activity>
-
-        <activity android:name="com.uas.appme.settings.activity.AboutActivity"/>
-        <activity android:name="com.uas.appme.settings.activity.BaseInfoActivity"/>
-        <activity android:name="com.uas.appme.settings.activity.BookingSetActivity"/>
+        <activity android:name=".pedometer.view.StepSplashActivity"/>
+        <activity android:name=".settings.activity.AboutActivity"/>
+        <activity android:name=".settings.activity.BaseInfoActivity"/>
+        <activity android:name=".settings.activity.BookingSetActivity"/>
         <activity
-            android:name="com.uas.appme.settings.activity.FeedbackActivity"
+            android:name=".settings.activity.FeedbackActivity"
             android:windowSoftInputMode="stateHidden|stateAlwaysHidden">
             <intent-filter>
-                <action android:name="com.modular.main.FeedbackActivity" />
-                <category android:name="android.intent.category.DEFAULT" />
+                <action android:name="com.modular.main.FeedbackActivity"/>
+
+                <category android:name="android.intent.category.DEFAULT"/>
             </intent-filter>
         </activity>
-
-        <activity android:name="com.uas.appme.settings.activity.SelectLanguageActivity"/>
+        <activity android:name=".settings.activity.SelectLanguageActivity"/>
         <activity
-            android:name="com.uas.appme.settings.activity.SettingActivity"
+            android:name=".settings.activity.SettingActivity"
             android:configChanges="keyboardHidden|orientation"
             android:screenOrientation="portrait"/>
         <activity
-            android:name="com.uas.appme.other.activity.SelectAreaActivity"
-            android:screenOrientation="portrait" />
-        <activity android:name=".pedometer.view.UURanking"
+            android:name=".other.activity.SelectAreaActivity"
+            android:screenOrientation="portrait"/>
+        <activity
+            android:name=".pedometer.view.UURanking"
             android:label="排行榜">
             <intent-filter>
                 <action android:name="com.modular.appme.UURanking"/>
+
                 <category android:name="android.intent.category.DEFAULT"/>
             </intent-filter>
         </activity>
         <activity android:name=".pedometer.view.PersonalPageActivity"/>
-        <activity android:name=".pedometer.view.ShareStepsActivity"
+        <activity
+            android:name=".pedometer.view.ShareStepsActivity"
             android:label="分享"/>
-        <activity android:name=".settings.activity.BSettingActivity"
+        <activity
+            android:name=".settings.activity.BSettingActivity"
             android:label="商家设置"/>
-        <activity android:name=".settings.activity.ImageSettingActivity"
+        <activity
+            android:name=".settings.activity.ImageSettingActivity"
             android:label="形象照片"/>
-        <activity android:name=".settings.activity.PersonSettingActivity"
+        <activity
+            android:name=".settings.activity.PersonSettingActivity"
             android:label="新增人员"
             android:windowSoftInputMode="adjustPan"/>
-        <activity android:name=".settings.activity.PersonSettingListActivity"
+        <activity
+            android:name=".settings.activity.PersonSettingListActivity"
             android:label="@string/more"/>
-        <activity android:name=".settings.activity.BComSetRestActivity"
+        <activity
+            android:name=".settings.activity.BComSetRestActivity"
             android:label="批量设置员工休息日"/>
+        <activity android:name=".settings.activity.BRestActivity">
+        </activity>
     </application>
-</manifest>
+
+</manifest>

+ 0 - 2
app_modular/appme/src/main/java/com/uas/appme/pedometer/service/StepService.java

@@ -369,7 +369,6 @@ public class StepService extends Service implements SensorEventListener {
      */
     @TargetApi(Build.VERSION_CODES.HONEYCOMB)
     private void saveStepData() {
-        LogUtil.i("saveStepData");
         //查询数据库中的数据
         StepEntity entity = stepDataDao.getCurDataByDate(CURRENT_DATE);
         //为空则说明还没有该天的数据,有则说明已经开始当天的计步了
@@ -382,7 +381,6 @@ public class StepService extends Service implements SensorEventListener {
             stepDataDao.addNewData(entity);
         } else {
             //有则更新当前的数据
-            LogUtil.i("", String.valueOf(CURRENT_STEP));
             entity.setSteps(String.valueOf(CURRENT_STEP));
 
             stepDataDao.updateCurData(entity);

+ 272 - 2
app_modular/appme/src/main/java/com/uas/appme/settings/activity/BRestActivity.java

@@ -1,15 +1,285 @@
 package com.uas.appme.settings.activity;
 
-import android.support.v7.app.AppCompatActivity;
+import android.content.Intent;
 import android.os.Bundle;
+import android.support.v7.widget.DefaultItemAnimator;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.common.LogUtil;
+import com.common.config.BaseConfig;
+import com.common.data.JSONUtil;
+import com.common.data.ListUtils;
+import com.common.data.StringUtil;
+import com.core.app.Constants;
+import com.core.app.MyApplication;
+import com.core.base.BaseActivity;
+import com.core.model.SelectBean;
+import com.core.utils.CommonUtil;
+import com.core.utils.ToastUtil;
+import com.core.widget.view.Activity.SelectActivity;
+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.adapter.BRestAdapter;
+import com.uas.appme.settings.model.BRest;
+import com.uas.appworks.OA.erp.utils.MostLinearLayoutManager;
 
-public class BRestActivity extends AppCompatActivity {
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static com.common.data.JSONUtil.getJSONArray;
+
+/**
+ * 员工和商家消息日设置界面
+ * by Bitliker
+ */
+public class BRestActivity extends BaseActivity implements BRestAdapter.OnItemClickListener, View.OnClickListener {
+	private final int MAN_SELECT = 11;
+
+	private RecyclerView contentRV;
+	private int type;
+	private int position;
+	private BRestAdapter mAdapter;
 
 	@Override
 	protected void onCreate(Bundle savedInstanceState) {
 		super.onCreate(savedInstanceState);
 		setContentView(R.layout.activity_brest);
+		initView();
+	}
+
+	@Override
+	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+		super.onActivityResult(requestCode, resultCode, data);
+		if (data != null && MAN_SELECT == requestCode) {
+			SelectBean bean = data.getParcelableExtra("data");
+			if (bean != null) {
+				String json = bean.getJson();
+				if (JSONUtil.validateJSONObject(json)) {
+					JSONObject object = JSON.parseObject(json);
+					if (object != null) {
+						BRest model = new BRest(type);
+						model.setCompanyid(JSONUtil.getText(object, "sm_companyid"));
+						model.setCompanyname(JSONUtil.getText(object, "sm_companyname"));
+						model.setUserId(JSONUtil.getText(object, "sm_userid"));
+						model.setUsername(JSONUtil.getText(object, "sm_username"));
+						model.set_id(JSONUtil.getText(object, "sm_id"));
+						if (mAdapter != null) {
+							mAdapter.updateData(position, model);
+						}
+					}
+				}
+			}
+		}
+	}
+
+	private void initView() {
+		contentRV = (RecyclerView) findViewById(R.id.contentRV);
+		findViewById(R.id.saveBtn).setOnClickListener(this);
+		Intent intent = getIntent();
+		if (intent != null) {
+			type = intent.getIntExtra("type", 0);
+		}
+		testData();
+	}
+
+
+	private void testData() {
+		List<BRest> models = new ArrayList<>();
+		models.add(new BRest(type));
+		mAdapter = new BRestAdapter(this, models);
+		contentRV.setItemAnimator(new DefaultItemAnimator());
+		contentRV.setLayoutManager(new MostLinearLayoutManager(ct));
+		contentRV.setAdapter(mAdapter);
+		if (type == 1) {
+			mAdapter.setOnItemClickListener(this);
+		}
+	}
+
+	private boolean isSubmit;
+
+	@Override
+	public void itemClick(int position) {
+		if (isSubmit) return;
+		isSubmit = true;
+		this.position = position;
+		loadServiceMan();
+	}
+
+	@Override
+	public void onClick(View v) {
+		if (v.getId() == R.id.saveBtn) {
+			submitSave();
+		}
 	}
+
+	//load 选择服务人员
+	public void loadServiceMan() {
+		progressDialog.show();
+		String b_enuu = CommonUtil.getSharedPreferences(ct, "erp_uu");
+		LogUtil.i("b_enuu=" + b_enuu);
+		new HttpClient.Builder(Constants.IM_BASE_URL)
+				.isDebug(BaseConfig.isDebug())
+				.build()
+				.Api()
+				.send(new HttpClient.Builder()
+						.url("/user/appStoreman")
+						.add("companyid","601" )//TODO 先写死"601"
+						.add("serviceid", "0")
+						.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)) {
+								for (int i = 0; i < array.size(); i++) {
+									JSONObject object = array.getJSONObject(i);
+									bean = new SelectBean();
+									int id = JSONUtil.getInt(object, "sm_id");
+									String name = JSONUtil.getText(object, "sm_username");
+									bean.setId(id);
+									bean.setFields(String.valueOf(id));
+									bean.setName(name);
+									bean.setJson(object.toJSONString());
+									selectBeens.add(bean);
+								}
+							}else{
+								ToastUtil.showToast(ct,"当前公司还没有设置员工");
+							}
+							if (!ListUtils.isEmpty(selectBeens)) {
+								Intent intent = new Intent(ct, SelectActivity.class)
+										.putExtra("type", 2)
+										.putExtra("title", "选择人员")
+										.putParcelableArrayListExtra("data", selectBeens);
+								startActivityForResult(intent, MAN_SELECT);
+							}
+						}
+						isSubmit = false;
+						progressDialog.dismiss();
+					}
+				}));
+	}
+
+
+	public void submitSave() {
+		if (isSubmit) return;
+		isSubmit = true;
+		Map<String, Object> map = getSaveMap();
+		if (map == null) {
+			isSubmit = false;
+			return;
+		}
+		LogUtil.i(JSONUtil.map2JSON(map));
+		new HttpClient.Builder(Constants.IM_BASE_URL)
+				.isDebug(BaseConfig.isDebug())
+				.build()
+				.Api()
+				.send(new HttpClient.Builder()
+						.url(type == 1 ? "/user/appPersonRest" : "/user/appStoreRest")
+						.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) {
+						if (JSONUtil.validateJSONObject(o.toString())) {
+							if (JSONUtil.getBoolean(o.toString(), "result")) {
+								//TODO 保存成功
+							}
+						}
+						isSubmit = false;
+					}
+				}));
+
+
+	}
+
+	private Map<String, Object> getSaveMap() {
+		if (mAdapter == null || ListUtils.isEmpty(mAdapter.getModels())) {
+			//TODO show must imput
+			return null;
+		}
+		BRest model = mAdapter.getModels().get(0);
+		if (model == null) {
+			//TODO show must imput
+			return null;
+		}
+		LogUtil.i(JSON.toJSONString(model));
+		Map<String, Object> map = new HashMap<>();
+		String date = null;
+		String sc_companyname = null;
+		String sc_companyid = null;
+
+		if (StringUtil.isEmpty(model.getDate())) {
+			ToastUtil.showToast(ct,"请选择日期");
+			return null;
+		} else {
+			date = model.getDate();
+		}
+		if (StringUtil.isEmpty(model.getCompanyname())) {
+			ToastUtil.showToast(ct,"公司名称无效");
+			return null;
+		} else {
+			sc_companyname = model.getCompanyname();
+			sc_companyid = model.getCompanyid();
+
+		}
+		if (type == 1) {
+			map.put("sf_companyname", sc_companyname);
+			map.put("sf_companyid", sc_companyid);
+			map.put("sf_date", date);
+			if (StringUtil.isEmpty(model.getUsername())) {
+				ToastUtil.showToast(ct,"请选择人员");
+				return null;
+			} else {
+				map.put("sf_username", model.getUsername());
+				map.put("sf_userid", model.getUserId());
+			}
+//			if (!StringUtil.isEmpty(model.get_id())) {
+//				map.put("sf_id", model.get_id());
+//			}
+		} else {
+			map.put("sc_companyname", sc_companyname);
+			map.put("sc_companyid", sc_companyid);
+			map.put("sc_date", date);
+//			if (!StringUtil.isEmpty(model.get_id())) {
+//				map.put("sc_id", model.get_id());
+//			}
+		}
+		return map;
+	}
+
+	//TODO test数据
+	public final String SERVICE_MAN = "{\n" +
+			"    \"result\": [\n" +
+			"        {\n" +
+			"            \"sm_companyid\": \"201\",\n" +
+			"            \"sm_companyname\": \"北大医院\",\n" +
+			"            \"sm_id\": \"10002\",\n" +
+			"            \"sm_level\": \"医师\",\n" +
+			"            \"sm_stid\": \"10002\",\n" +
+			"            \"sm_stname\": \"眼科\",\n" +
+			"            \"sm_telephone\": \"13910000002\",\n" +
+			"            \"sm_userid\": \"2\",\n" +
+			"            \"sm_username\": \"张四\"\n" +
+			"        }\n" +
+			"    ]\n" +
+			"}";
+
+
 }

+ 36 - 29
app_modular/appme/src/main/java/com/uas/appme/settings/activity/BSettingActivity.java

@@ -14,33 +14,40 @@ import com.uas.appme.R;
 
 public class BSettingActivity extends BaseActivity implements View.OnClickListener {
 
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.bsetting_activity);
-        initView();
-    }
-
-    @Override
-    public void onClick(View v) {
-        if (v.getId() == R.id.image_setting_rl){
-            startActivity(new Intent(this,ImageSettingActivity.class));
-        }else if (v.getId() == R.id.keshi_setting_rl){
-            
-        }else if (v.getId() == R.id.people_setting_rl){
-            startActivity(new Intent(this,PersonSettingListActivity.class));
-        }else if (v.getId() == R.id.employeerest_rl){
-            startActivity(new Intent(ct,BComSetRestActivity.class));
-        }else if (v.getId() == R.id.companyrest_rl){
-
-        }
-    }
-
-    private void initView() {
-        findViewById(R.id.image_setting_rl).setOnClickListener(this);
-        findViewById(R.id.keshi_setting_rl).setOnClickListener(this);
-        findViewById(R.id.people_setting_rl).setOnClickListener(this);
-        findViewById(R.id.employeerest_rl).setOnClickListener(this);
-        findViewById(R.id.companyrest_rl).setOnClickListener(this);
-    }
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.bsetting_activity);
+		initView();
+	}
+
+	@Override
+	public void onClick(View v) {
+		if (v.getId() == R.id.image_setting_rl) {
+			startActivity(new Intent(this, ImageSettingActivity.class));
+		} else if (v.getId() == R.id.keshi_setting_rl) {
+
+		} else if (v.getId() == R.id.people_setting_rl) {
+			startActivity(new Intent(this, PersonSettingListActivity.class));
+		} else if (v.getId() == R.id.employeerest_rl) {
+			startActivity(new Intent(ct, BComSetRestActivity.class));
+		} else if (v.getId() == R.id.companyrest_rl) {
+
+		} else if (v.getId() == R.id.appPersonRest) {
+			startActivity(new Intent(ct, BRestActivity.class)
+					.putExtra("type", 1));
+		} else if (v.getId() == R.id.appStoreRest) {
+			startActivity(new Intent(ct, BRestActivity.class));
+		}
+	}
+
+	private void initView() {
+		findViewById(R.id.image_setting_rl).setOnClickListener(this);
+		findViewById(R.id.keshi_setting_rl).setOnClickListener(this);
+		findViewById(R.id.people_setting_rl).setOnClickListener(this);
+		findViewById(R.id.employeerest_rl).setOnClickListener(this);
+		findViewById(R.id.companyrest_rl).setOnClickListener(this);
+		findViewById(R.id.appPersonRest).setOnClickListener(this);
+		findViewById(R.id.appStoreRest).setOnClickListener(this);
+	}
 }

+ 68 - 70
app_modular/appme/src/main/java/com/uas/appme/settings/activity/SettingActivity.java

@@ -100,8 +100,7 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
 	private String newStep_service_name = "com.uas.appme.pedometer.service.StepService";
 
 	private PopupWindow setWindow = null;//
-    private PopupWindow setWindow = null;//
-    private RelativeLayout businessmen_setting_rl;
+	private RelativeLayout businessmen_setting_rl;
 
 	@Override
 	protected void onCreate(Bundle savedInstanceState) {
@@ -112,32 +111,32 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
 	}
 
 
-    private void initView() {
-        uas_website_tv = (TextView) findViewById(R.id.uas_website_tv);
-        tv_menu_setting = (TextView) findViewById(R.id.tv_menu_setting);
-        cb_task_reply = (SwitchView) findViewById(R.id.cb_task_reply);
-        uu_step_rl = (RelativeLayout) findViewById(R.id.uu_step_rl);
-        sign_in_rl = (RelativeLayout) findViewById(R.id.sign_in_rl);
-        sign_out_rl = (RelativeLayout) findViewById(R.id.sign_out_rl);
-        tv_signauto_new = (TextView) findViewById(R.id.tv_signauto_new);
-        tv_sign_new = (TextView) findViewById(R.id.tv_sign_new);
-        tv_language_new = (TextView) findViewById(R.id.tv_language_new);
-        tv_booking_new = (TextView) findViewById(R.id.tv_booking_new);
-        tv_help_new = (TextView) findViewById(R.id.tv_help_new);
-        language_us_rl = (RelativeLayout) findViewById(R.id.language_us_rl);
-        uu_step_im = (ImageView) findViewById(R.id.uu_step_im);
-        uu_step_reply = (SwitchView) findViewById(R.id.uu_step_reply);
-        rl_app_update = (RelativeLayout) findViewById(R.id.rl_app_update);
-        version_value = (TextView) findViewById(R.id.version_value);
-        close_push_rl = (RelativeLayout) findViewById(R.id.close_push_rl);
-        speech_recognition_rl = (RelativeLayout) findViewById(R.id.speech_recognition_rl);
-        new_step_rl = (RelativeLayout) findViewById(R.id.new_step_rl);
-        booking_set_rl = (RelativeLayout) findViewById(R.id.booking_set_rl);
-        businessmen_setting_rl = (RelativeLayout) findViewById(R.id.businessmen_setting_rl);
-        businessmen_setting_rl.setOnClickListener(this);
-
-        if (CommonUtil.isReleaseVersion())
-            businessmen_setting_rl.setVisibility(View.GONE);
+	private void initView() {
+		uas_website_tv = (TextView) findViewById(R.id.uas_website_tv);
+		tv_menu_setting = (TextView) findViewById(R.id.tv_menu_setting);
+		cb_task_reply = (SwitchView) findViewById(R.id.cb_task_reply);
+		uu_step_rl = (RelativeLayout) findViewById(R.id.uu_step_rl);
+		sign_in_rl = (RelativeLayout) findViewById(R.id.sign_in_rl);
+		sign_out_rl = (RelativeLayout) findViewById(R.id.sign_out_rl);
+		tv_signauto_new = (TextView) findViewById(R.id.tv_signauto_new);
+		tv_sign_new = (TextView) findViewById(R.id.tv_sign_new);
+		tv_language_new = (TextView) findViewById(R.id.tv_language_new);
+		tv_booking_new = (TextView) findViewById(R.id.tv_booking_new);
+		tv_help_new = (TextView) findViewById(R.id.tv_help_new);
+		language_us_rl = (RelativeLayout) findViewById(R.id.language_us_rl);
+		uu_step_im = (ImageView) findViewById(R.id.uu_step_im);
+		uu_step_reply = (SwitchView) findViewById(R.id.uu_step_reply);
+		rl_app_update = (RelativeLayout) findViewById(R.id.rl_app_update);
+		version_value = (TextView) findViewById(R.id.version_value);
+		close_push_rl = (RelativeLayout) findViewById(R.id.close_push_rl);
+		speech_recognition_rl = (RelativeLayout) findViewById(R.id.speech_recognition_rl);
+		new_step_rl = (RelativeLayout) findViewById(R.id.new_step_rl);
+		booking_set_rl = (RelativeLayout) findViewById(R.id.booking_set_rl);
+		businessmen_setting_rl = (RelativeLayout) findViewById(R.id.businessmen_setting_rl);
+		businessmen_setting_rl.setOnClickListener(this);
+
+		if (CommonUtil.isReleaseVersion())
+			businessmen_setting_rl.setVisibility(View.GONE);
 
 		new_step_rl.setOnClickListener(this);
 //        new_step_rl.setVisibility(View.GONE);
@@ -349,46 +348,46 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
 					BDAutoUpdateSDK.cpUpdateCheck(SettingActivity.this,
 							new CPCheckUpdateCallback() {
 
-                               @Override
-                               public void onCheckUpdateCallback(
-                                       AppUpdateInfo info,
-                                       AppUpdateInfoForInstall infoForInstall) {
-                                   if (infoForInstall != null
-                                           && !TextUtils
-                                           .isEmpty(infoForInstall
-                                                   .getInstallPath())) {
-                                   } else if (info != null) {
-                                   } else {
-                                       ViewUtil.ShowMessageTitle(
-                                               SettingActivity.this,
-                                               getString(R.string.set_isnewVersion));
-                                   }
-                                   dialog.dismiss();
-                               }
-                           });
-               }
-           });
-       }else if (v.getId() == R.id.super_setting_tv){
-           startActivityForResult(new Intent(mContext, SignSeniorSettingActivity.class), 0x12);
-           closePopupWindow();
-       }else if (v.getId() == R.id.work_setting_tv){
-           intent = new Intent(mContext, FlightsActivity.class);
-           startActivityForResult(intent, 0x12);
-           closePopupWindow();
-       }else if (v.getId() == R.id.office_addr_setting_tv){
-           startActivityForResult(new Intent(mContext, OfficeAddressSettingsActivity.class), 0x12);
-           closePopupWindow();
-       }else if (v.getId() == R.id.my_rule_setting_tv){
-           intent = new Intent(mContext, MyRuleSetActivity.class);
-//                presenter.showMyRele(intent, adapter.getModels());
-           startActivity(intent);
-           closePopupWindow();
-       }else if (v.getId() == R.id.cancel_tv){
-           closePopupWindow();
-       }else if (v.getId() == R.id.businessmen_setting_rl){
-           startActivity(new Intent(this,BSettingActivity.class));
-       }
-    }
+								@Override
+								public void onCheckUpdateCallback(
+										AppUpdateInfo info,
+										AppUpdateInfoForInstall infoForInstall) {
+									if (infoForInstall != null
+											&& !TextUtils
+											.isEmpty(infoForInstall
+													.getInstallPath())) {
+									} else if (info != null) {
+									} else {
+										ViewUtil.ShowMessageTitle(
+												SettingActivity.this,
+												getString(R.string.set_isnewVersion));
+									}
+									dialog.dismiss();
+								}
+							});
+				}
+			});
+		} else if (v.getId() == R.id.super_setting_tv) {
+			startActivityForResult(new Intent(mContext, SignSeniorSettingActivity.class), 0x12);
+			closePopupWindow();
+		} else if (v.getId() == R.id.work_setting_tv) {
+			intent = new Intent(mContext, FlightsActivity.class);
+			startActivityForResult(intent, 0x12);
+			closePopupWindow();
+		} else if (v.getId() == R.id.office_addr_setting_tv) {
+			startActivityForResult(new Intent(mContext, OfficeAddressSettingsActivity.class), 0x12);
+			closePopupWindow();
+		} else if (v.getId() == R.id.my_rule_setting_tv) {
+			intent = new Intent(mContext, MyRuleSetActivity.class);
+			showMyRele(intent);
+			startActivity(intent);
+			closePopupWindow();
+		} else if (v.getId() == R.id.cancel_tv) {
+			closePopupWindow();
+		} else if (v.getId() == R.id.businessmen_setting_rl) {
+			startActivity(new Intent(this, BSettingActivity.class));
+		}
+	}
 
 	public void showMyRele(Intent intent) {
 		List<WorkModel> models = WorkModelDao.getInstance().query(true);
@@ -396,7 +395,7 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
 			intent.putParcelableArrayListExtra("data", (ArrayList<WorkModel>) models);
 		intent.putExtra("isFree", ListUtils.isEmpty(models));
 		intent.putExtra("day", OAConfig.days);
-		intent.putExtra("name",  OAConfig.name);
+		intent.putExtra("name", OAConfig.name);
 	}
 
 	private void share() {
@@ -421,7 +420,6 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
 				.setMessage(getString(R.string.cache_msg))
 				.setNegativeButton(getString(R.string.common_cancel), null)
 				.setPositiveButton(getString(R.string.common_sure), new DialogInterface.OnClickListener() {
-
 					@Override
 					public void onClick(DialogInterface dialog, int which) {
 						clearCache();

+ 163 - 0
app_modular/appme/src/main/java/com/uas/appme/settings/adapter/BRestAdapter.java

@@ -0,0 +1,163 @@
+package com.uas.appme.settings.adapter;
+
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.common.data.CalendarUtil;
+import com.common.data.ListUtils;
+import com.core.base.BaseActivity;
+import com.core.utils.time.wheel.DatePicker;
+import com.uas.appme.R;
+import com.uas.appme.settings.model.BRest;
+
+import java.util.List;
+
+/**
+ * Created by Bitliker on 2017/10/13.
+ */
+
+public class BRestAdapter extends RecyclerView.Adapter<BRestAdapter.ViewHolder> {
+	private BaseActivity ct;
+	private List<BRest> models;
+
+	public BRestAdapter(BaseActivity ct, List<BRest> models) {
+		this.ct = ct;
+		this.models = models;
+	}
+
+	public void updateData(int position, BRest model) {
+		if (position >= 0 && position < getItemCount()) {
+			this.models.get(position).update(model);
+			notifyItemChanged(position);
+		}
+	}
+
+	public List<BRest> getModels() {
+		return models;
+	}
+
+	@Override
+	public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+		return new ViewHolder(parent);
+	}
+
+
+	@Override
+	public int getItemCount() {
+		return ListUtils.getSize(models);
+	}
+
+	class ViewHolder extends RecyclerView.ViewHolder {
+		TextView delete_tv, name_tv, date_tv, additem_tv;
+		RelativeLayout name_rl, date_rl;
+
+		public ViewHolder(ViewGroup parent) {
+			this(LayoutInflater.from(ct).inflate(R.layout.item_b_rest, parent, false));
+		}
+
+		public ViewHolder(View itemView) {
+			super(itemView);
+			delete_tv = (TextView) itemView.findViewById(R.id.delete_tv);
+			name_tv = (TextView) itemView.findViewById(R.id.company_tv);
+			date_tv = (TextView) itemView.findViewById(R.id.date_tv);
+			additem_tv = (TextView) itemView.findViewById(R.id.additem_tv);
+			name_rl = (RelativeLayout) itemView.findViewById(R.id.company_rl);
+			date_rl = (RelativeLayout) itemView.findViewById(R.id.date_rl);
+		}
+	}
+
+
+	@Override
+	public void onBindViewHolder(ViewHolder holder, final int position) {
+		final BRest model = models.get(position);
+
+		if (position == 0) {
+			holder.delete_tv.setVisibility(View.GONE);
+			holder.delete_tv.setOnClickListener(null);
+		} else {
+			holder.delete_tv.setVisibility(View.VISIBLE);
+			holder.delete_tv.setOnClickListener(new View.OnClickListener() {
+				@Override
+				public void onClick(View v) {
+					models.remove(model);
+					notifyItemRemoved(position);
+					notifyDataSetChanged();
+				}
+			});
+		}
+
+		//只能设置一个
+		if (position == getItemCount() - 1 && (1 != 1)) {
+			holder.additem_tv.setVisibility(View.VISIBLE);
+			holder.additem_tv.setOnClickListener(new View.OnClickListener() {
+				@Override
+				public void onClick(View v) {
+					BRest newModel = new BRest(models.get(position).getType());
+					models.add(newModel);
+					notifyItemInserted(position);
+					notifyDataSetChanged();
+				}
+			});
+		} else {
+			holder.additem_tv.setVisibility(View.GONE);
+			holder.additem_tv.setOnClickListener(null);
+		}
+		if (model.getType() == 1) {
+			holder.name_rl.setVisibility(View.VISIBLE);
+			holder.name_tv.setOnClickListener(new View.OnClickListener() {
+				@Override
+				public void onClick(View v) {
+					if (onItemClickListener != null) {
+						onItemClickListener.itemClick(position);
+					}
+				}
+			});
+		} else {
+			holder.name_rl.setVisibility(View.GONE);
+			holder.name_tv.setOnClickListener(null);
+		}
+		holder.date_tv.setOnClickListener(new View.OnClickListener() {
+			@Override
+			public void onClick(View v) {
+				showTimeSelect(position);
+			}
+		});
+		holder.name_tv.setText(model.getUsername());
+		holder.date_tv.setText(model.getDate());
+	}
+
+
+	private void showTimeSelect(final int position) {
+		DatePicker picker = new DatePicker(ct, DatePicker.YEAR_MONTH_DAY);
+		picker.setRange(2015, 2019, true);
+		picker.setSelectedItem(CalendarUtil.getYear(), CalendarUtil.getMonth(), CalendarUtil.getDay());
+		picker.setOnDatePickListener(new DatePicker.OnYearMonthDayPickListener() {
+			@Override
+			public void onDatePicked(String year, String month, String day) {
+				String time = year + "-" + month + "-" + day;
+				if (getItemCount() > position) {
+					models.get(position).setDate(time);
+					notifyItemChanged(position);
+					notifyItemRangeChanged(position, getItemCount());
+				}
+			}
+		});
+		picker.show();
+	}
+
+	public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
+		this.onItemClickListener = onItemClickListener;
+	}
+
+	private OnItemClickListener onItemClickListener;
+
+	public interface OnItemClickListener {
+		void itemClick(int position);
+	}
+
+
+}

+ 85 - 0
app_modular/appme/src/main/java/com/uas/appme/settings/model/BRest.java

@@ -0,0 +1,85 @@
+package com.uas.appme.settings.model;
+
+import com.common.data.StringUtil;
+
+/**
+ * Created by Bitliker on 2017/10/13.
+ */
+
+public class BRest {
+
+	private String _id;
+	private String userId;
+	private String username;
+	private String companyid;
+	private String companyname;
+	private String date;
+	private int type;//0为默认商家、1为人员
+
+	public BRest(int type) {
+		this.type = type;
+	}
+
+	public int getType() {
+		return type;
+	}
+
+	public String get_id() {
+		return _id;
+	}
+
+	public void set_id(String _id) {
+		this._id = _id;
+	}
+
+	public String getUserId() {
+		return userId;
+	}
+
+	public void setUserId(String userId) {
+		this.userId = userId;
+	}
+
+	public String getUsername() {
+		return username == null ? "" : username;
+	}
+
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+	public String getCompanyid() {
+		return companyid;
+	}
+
+	public void setCompanyid(String companyid) {
+		this.companyid = companyid;
+	}
+
+	public String getCompanyname() {
+		return companyname;
+	}
+
+	public void setCompanyname(String companyname) {
+		this.companyname = companyname;
+	}
+
+	public String getDate() {
+		return date == null ? "" : date;
+	}
+
+	public void setDate(String date) {
+		this.date = date;
+	}
+
+	public void update(BRest model) {
+		this.set_id(model.get_id());
+		this.setCompanyid(model.getCompanyid());
+		this.setUsername(model.getUsername());
+		this.setUserId(model.getUserId());
+		this.setCompanyname(model.getCompanyname());
+		if (!StringUtil.isEmpty(model.getDate())) {
+			this.setDate(model.getDate());
+		}
+	}
+}

+ 30 - 3
app_modular/appme/src/main/res/layout/activity_brest.xml

@@ -1,10 +1,37 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
+<ScrollView
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:background="@color/base_bg"
     tools:context="com.uas.appme.settings.activity.BRestActivity">
 
-</LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+
+        <android.support.v7.widget.RecyclerView
+            android:id="@+id/contentRV"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"/>
+
+        <Button
+            android:id="@+id/saveBtn"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:layout_marginBottom="30dp"
+            android:layout_marginLeft="20dp"
+            android:layout_marginRight="20dp"
+            android:layout_marginTop="50dp"
+            android:background="@drawable/bg_bule_btn"
+            android:padding="10dp"
+            android:text="@string/common_save_button"
+            android:textColor="@color/white"
+            android:textSize="@dimen/text_main"/>
+
+    </LinearLayout>
+
+</ScrollView>

+ 79 - 0
app_modular/appme/src/main/res/layout/item_b_rest.xml

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content">
+
+    <TextView
+        android:id="@+id/delete_tv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentRight="true"
+        android:padding="6dp"
+        android:text="@string/common_delete"
+        android:textColor="@color/button_focus"/>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+        android:layout_below="@+id/delete_tv"
+        android:background="@color/item_line"/>
+
+    <RelativeLayout
+        android:id="@+id/company_rl"
+        style="@style/item_menu"
+        android:layout_below="@id/delete_tv">
+
+        <TextView
+            android:id="@+id/company_tag"
+            style="@style/item_menu_tag"
+            android:gravity="center_vertical"
+            android:text="@string/name"/>
+
+        <TextView
+            android:id="@+id/company_tv"
+            style="@style/item_menu_input"
+            android:layout_toRightOf="@id/company_tag"
+            android:drawablePadding="6dp"
+            android:hint="@string/select_must"/>
+
+    </RelativeLayout>
+
+
+    <RelativeLayout
+        android:id="@+id/date_rl"
+        style="@style/item_menu"
+        android:layout_below="@id/company_rl">
+
+
+        <TextView
+            android:id="@+id/date_tag"
+            style="@style/item_menu_tag"
+            android:gravity="center_vertical"
+            android:text="@string/rest_date"
+            android:textColor="@color/hintColor"/>
+
+        <TextView
+            android:id="@+id/date_tv"
+            style="@style/item_menu_input"
+            android:layout_toRightOf="@id/date_tag"
+            android:hint="@string/select_must"
+            android:inputType="phone"
+            android:textColor="@color/hintColor"/>
+    </RelativeLayout>
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+        android:layout_below="@id/date_rl"
+        android:background="@color/item_line"/>
+
+    <TextView
+        android:id="@+id/additem_tv"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/week_bar_height"
+        android:layout_below="@id/date_rl"
+        android:background="@color/me_menu_item_normal"
+        android:gravity="center"
+        android:text="@string/add_contacts"
+        android:textColor="@color/button_focus"/>
+</RelativeLayout>

+ 7 - 0
app_modular/appme/src/main/res/values/strings.xml

@@ -1869,4 +1869,11 @@
     <string name="common_service_query">常用业务查询</string>
     <string name="more_queries">更多查询</string>
     <string name="select_query_service">选择查询业务</string>
+
+
+
+    <string name="rest_date">休息时间</string>
+
+
+
 </resources>