Selaa lähdekoodia

封装了网络请求,添加tags

Bitliker 8 vuotta sitten
vanhempi
commit
b9c74414ff
37 muutettua tiedostoa jossa 2634 lisäystä ja 2338 poistoa
  1. 1 0
      WeiChat/build.gradle
  2. 568 567
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/MainActivity.java
  3. 5 5
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/oa/NavigationActivity.java
  4. 3 2
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/fragment/OutofficeFragment.java
  5. 354 350
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/MessageFragment.java
  6. 0 2
      app_core/common/build.gradle
  7. 104 105
      app_core/common/src/main/java/com/common/LogUtil.java
  8. 277 273
      app_core/common/src/main/java/com/common/data/JSONUtil.java
  9. 4 0
      app_core/common/src/main/java/com/common/system/SystemUtil.java
  10. 348 344
      app_core/common/src/main/java/com/core/app/Constants.java
  11. 210 211
      app_core/common/src/main/java/com/core/net/location/BdLocationHelper.java
  12. 0 57
      app_core/common/src/main/java/com/core/net/smart/Success.java
  13. 1 1
      app_core/network/build.gradle
  14. 1 1
      app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/MessagePresenter.java
  15. 1 2
      app_modular/apptasks/build.gradle
  16. 15 9
      app_modular/apptasks/src/main/AndroidManifest.xml
  17. 31 3
      app_modular/apptasks/src/main/java/com/modular/apptasks/AutoTasks.java
  18. 81 0
      app_modular/apptasks/src/main/java/com/modular/apptasks/service/AutoTaskHttp.java
  19. 32 0
      app_modular/apptasks/src/main/java/com/modular/apptasks/service/AutoTaskReceiver.java
  20. 62 0
      app_modular/apptasks/src/main/java/com/modular/apptasks/util/AlarmUtil.java
  21. 0 1
      app_modular/apptasks/src/main/res/values/strings.xml
  22. 1 0
      app_modular/apputils/.gitignore
  23. 27 0
      app_modular/apputils/build.gradle
  24. 25 0
      app_modular/apputils/proguard-rules.pro
  25. 13 0
      app_modular/apputils/src/main/AndroidManifest.xml
  26. 4 3
      app_modular/apputils/src/main/java/com/modular/apputils/listener/OnSmartHttpListener.java
  27. 1 2
      app_modular/apputils/src/main/java/com/modular/apputils/network/Failure.java
  28. 1 7
      app_modular/apputils/src/main/java/com/modular/apputils/network/Parameter.java
  29. 1 1
      app_modular/apputils/src/main/java/com/modular/apputils/network/Result.java
  30. 2 2
      app_modular/apputils/src/main/java/com/modular/apputils/network/SmartHttpClient.java
  31. 61 0
      app_modular/apputils/src/main/java/com/modular/apputils/network/Success.java
  32. 1 1
      app_modular/apputils/src/main/java/com/modular/apputils/network/Tags.java
  33. 3 0
      app_modular/apputils/src/main/res/values/strings.xml
  34. 4 4
      app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/MissionActivity.java
  35. 389 383
      app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/WorkActivity.java
  36. 0 1
      app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/utils/AutoErpSigninUitl.java
  37. 3 1
      settings.gradle

+ 1 - 0
WeiChat/build.gradle

@@ -115,6 +115,7 @@ dependencies {
     compile project(':network')
     compile project(':imageload')
     compile project(':applogin')
+    compile project(':apptasks')
 
     compile project(':appcontact')
     compile project(':appme')

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 568 - 567
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/MainActivity.java


+ 5 - 5
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/oa/NavigationActivity.java

@@ -20,13 +20,13 @@ import com.baidu.mapapi.search.route.OnGetRoutePlanResultListener;
 import com.baidu.mapapi.search.route.PlanNode;
 import com.baidu.mapapi.search.route.RoutePlanSearch;
 import com.common.LogUtil;
+import com.common.data.ListUtils;
+import com.core.app.Constants;
+import com.core.app.MyApplication;
+import com.core.base.BaseActivity;
 import com.lidroid.xutils.ViewUtils;
 import com.lidroid.xutils.view.annotation.ViewInject;
-import com.core.net.location.BdLocationHelper;
-import com.core.app.MyApplication;
 import com.xzjmyk.pm.activity.R;
-import com.core.base.BaseActivity;
-import com.common.data.ListUtils;
 import com.xzjmyk.pm.activity.util.baidu.BaiduMapUtil;
 import com.xzjmyk.pm.activity.util.baidu.DrivingRouteOverlay;
 import com.xzjmyk.pm.activity.util.baidu.OnGetRoutePlanResult;
@@ -85,7 +85,7 @@ public class NavigationActivity extends BaseActivity {
 
     private void initReceiver() {
         IntentFilter filter = new IntentFilter();
-        filter.addAction(BdLocationHelper.UPLOCATION_ACTION);
+        filter.addAction(Constants.ACTION_LOCATION_CHANGE);
         LocalBroadcastManager.getInstance(ct).registerReceiver(upLocationReceiver, filter);
     }
 

+ 3 - 2
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/fragment/OutofficeFragment.java

@@ -28,11 +28,13 @@ import com.common.data.DateFormatUtil;
 import com.common.data.JSONUtil;
 import com.common.data.StringUtil;
 import com.core.app.AppConfig;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.net.http.ViewUtil;
 import com.core.net.location.BdLocationHelper;
 import com.core.utils.TimeUtils;
 import com.core.utils.helper.AvatarHelper;
+import com.core.widget.view.Activity.SearchLocationActivity;
 import com.core.widget.view.model.SearchPoiParam;
 import com.lidroid.xutils.ViewUtils;
 import com.lidroid.xutils.view.annotation.ViewInject;
@@ -42,7 +44,6 @@ import com.xzjmyk.pm.activity.ui.erp.activity.oa.OutLogListActivity;
 import com.xzjmyk.pm.activity.ui.erp.activity.oa.OutSigninOKActivity;
 import com.xzjmyk.pm.activity.ui.erp.activity.oa.OutofficeActivity;
 import com.xzjmyk.pm.activity.ui.erp.activity.oa.OutofficeSetActivity;
-import com.core.widget.view.Activity.SearchLocationActivity;
 import com.xzjmyk.pm.activity.util.baidu.BaiduMapUtil;
 import com.xzjmyk.pm.activity.util.oa.CommonUtil;
 
@@ -241,7 +242,7 @@ public class OutofficeFragment extends EasyFragment implements View.OnClickListe
         setHasOptionsMenu(true);
         ViewUtils.inject(getmRootView());
         IntentFilter filter = new IntentFilter();
-        filter.addAction(BdLocationHelper.UPLOCATION_ACTION);
+        filter.addAction(Constants.ACTION_LOCATION_CHANGE);
         LocalBroadcastManager.getInstance(ct).registerReceiver(receiver, filter);
         adminStatus = ct.getIntent() == null ? false : ct.getIntent().getBooleanExtra(AppConfig.IS_ADMIN, false);
         initview();

+ 354 - 350
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/MessageFragment.java

@@ -58,273 +58,277 @@ import java.util.List;
  */
 public class MessageFragment extends EasyFragment implements IMessageView, View.OnClickListener {
 
-    @ViewInject(R.id.voiceSearchView)
-    private VoiceSearchView voiceSearchView;
-
-    @ViewInject(R.id.message_net_set)
-    private DrawableCenterTextView message_net_set;
-    @ViewInject(R.id.pull_refresh_list)
-    private PullToRefreshListView listView;
-
-    private Activity mContext;
-    private MessagePresenter presenter;
-    private MessageAdapter mAdapter = null;
-    private PopupWindow setWindow;
-    private int clickPosition = 0;
-    private Boolean platform;
-    //    private RelativeLayout news_notice_rl;
-    private RelativeLayout subscribe_rl;
-    public static final int REQUESTCODE = 0xa1;
-    private Comparator<BaseSortModel<Friend>> comparator;
-    private TextView dingyue_num;
-    private TextView tv_dingyue_desc;
-
-    //头文件处理
-    private TextView schedule_num_tv;//审批流
-    private TextView waitting_work_num_tv;//待办工作
-    private TextView subscribe_num_tv;//我的订阅
-    private TextView booking_num_tv;//小秘书预约
-
-    private TextView schedule_content_tv;//审批流
-    private TextView waitting_work_content_tv;//待办工作
-    private TextView subscribe_content_tv;//我的订阅
-    private TextView book_content_tv;
-
-    private TextView schedule_time_tv;//审批流
-    private TextView waitting_work_time_tv;//待办工作
-    private TextView subscribe_time_tv;//我的订阅
-    private TextView book_time_tv;
-    private TextView tv_book_num;
-    private MessagePresenter.UnReaderListener unReaderListener;
-    private RelativeLayout uustep_rl;
-
-
-    @Override
-    public void onAttach(Context context) {
-        super.onAttach(context);
-        if (context instanceof Activity) {
-            mContext = (Activity) context;
-        }
-        if (context instanceof MessagePresenter.UnReaderListener) {
-            unReaderListener = (MessagePresenter.UnReaderListener) context;
-        }
-    }
-
-    @Override
-    public void onDestroy() {
-        super.onDestroy();
-        presenter.onDestroyView(mContext);
-    }
-
-
-    @Override
-    protected int inflateLayoutId() {
-        return R.layout.fragment_new_message;
-    }
-
-    @Override
-    protected void onCreateView(Bundle savedInstanceState, boolean createView) {
-        LogUtil.d("onCreateView:" + DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
-        if (createView) {
-            ViewUtils.inject(getmRootView());
-            platform = ApiUtils.getApiModel() instanceof ApiPlatform;
-            initView();
-            initEvent();
-        }
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-        presenter.loadData();
-        if (PreferenceUtils.getInt(MyApplication.getInstance(), Constant.UU_STEP) == 1
-              && !CommonUtil.isReleaseVersion()  )
-            uustep_rl.setVisibility(View.VISIBLE);
-        else
-            uustep_rl.setVisibility(View.GONE);
-    }
-
-    private void initEvent() {
-
-
-        message_net_set.setOnClickListener(this);
-        voiceSearchView.addTextChangedListener(new EditChangeListener() {
-            @Override
-            public void afterTextChanged(Editable s) {
-                presenter.search(s.toString());
-            }
-        });
-        //下拉刷新
-        listView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
-            @Override
-            public void onRefresh(PullToRefreshBase<ListView> refreshView) {
-                presenter.loadData();
-            }
-        });
-        listView.getRefreshableView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
-            @Override
-            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                if (mAdapter == null || ListUtils.isEmpty(mAdapter.getmFriendList()) || mAdapter.getCount() <= id)
-                    return;
-                presenter.turn2NextAct(mContext, (int) id);
-            }
-        });
-
-        listView.getRefreshableView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
-            @Override
-            public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
-                if (mAdapter == null || ListUtils.isEmpty(mAdapter.getmFriendList()) || mAdapter.getCount() <= id)
-                    return true;
-                clickPosition = (int) id;
-                if (clickPosition < 0) clickPosition = 0;
-                showPopupWindow();
-                return true;
-            }
-        });
-    }
-
-
-    private void initView() {
-        listView.getRefreshableView().addHeaderView(initHeaderView());
-        listView.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
-        mAdapter = new MessageAdapter(null, mContext);
-        listView.getRefreshableView().setAdapter(mAdapter);
-        presenter = new MessagePresenter(mContext, this, unReaderListener);
-    }
-
-    private View initHeaderView() {
-        View view = LayoutInflater.from(mContext).inflate(R.layout.new_message_header, null);
-        subscribe_rl = (RelativeLayout) view.findViewById(R.id.subscribe_rl);
-        schedule_num_tv = (TextView) view.findViewById(R.id.schedule_num_tv);//审批流
-        waitting_work_num_tv = (TextView) view.findViewById(R.id.waitting_work_num_tv);//待办工作
-        subscribe_num_tv = (TextView) view.findViewById(R.id.subscribe_num_tv);//我的订阅
-        booking_num_tv = (TextView) view.findViewById(R.id.booking_num_tv);//小秘书
-        tv_book_num = (TextView) view.findViewById(R.id.tv_book_num);//小秘书
-        schedule_content_tv = (TextView) view.findViewById(R.id.schedule_content_tv);//审批流
-        waitting_work_content_tv = (TextView) view.findViewById(R.id.waitting_work_content_tv);//待办工作
-        subscribe_content_tv = (TextView) view.findViewById(R.id.subscribe_content_tv);//我的订阅
-        book_content_tv = (TextView) view.findViewById(R.id.book_content_tv);//预约内容
-        schedule_time_tv = (TextView) view.findViewById(R.id.schedule_time_tv);//审批流
-        waitting_work_time_tv = (TextView) view.findViewById(R.id.waitting_work_time_tv);//待办工作
-        subscribe_time_tv = (TextView) view.findViewById(R.id.subscribe_time_tv);//我的订阅
-        book_time_tv = (TextView) view.findViewById(R.id.book_time_tv);
-        dingyue_num = (TextView) view.findViewById(R.id.tv_dingYue_num);//订阅红点
-        tv_dingyue_desc = (TextView) view.findViewById(R.id.tv_dingyue_desc);//订阅红点
-
-        uustep_rl = (RelativeLayout) view.findViewById(R.id.uustep_rl);
-        if (CommonUtil.getSharedPreferencesBoolean(MyApplication.getInstance(), Constants.new_dingyue)) {
-            dingyue_num.setVisibility(View.GONE);
-            tv_dingyue_desc.setVisibility(View.GONE);
-        }
-        if (CommonUtil.getSharedPreferencesBoolean(MyApplication.getInstance(), Constants.SET_BOOKING)) {
-            tv_book_num.setVisibility(View.GONE);
-        }
-        view.findViewById(R.id.schedule_rl).setOnClickListener(this);//审批流
-        view.findViewById(R.id.waitting_work_rl).setOnClickListener(this);//待办工作
-        view.findViewById(R.id.subscribe_rl).setOnClickListener(this);//我的订阅
-        view.findViewById(R.id.booking_rl).setOnClickListener(this);//我的订阅
-        view.findViewById(R.id.uustep_rl).setOnClickListener(this);//UU运动
-        if (platform) {
-            subscribe_rl.setVisibility(View.GONE);
-        } else {
-            subscribe_rl.setVisibility(View.VISIBLE);
-        }
-        String user = CommonUtil.getUserRole();
-        if (user.equals("1")) {
-            view.findViewById(R.id.schedule_rl).setVisibility(View.GONE);//审批流
-            view.findViewById(R.id.waitting_work_rl).setVisibility(View.GONE);//待办工作
-            view.findViewById(R.id.subscribe_rl).setVisibility(View.GONE);//我的订阅
-        }
-
-        if (PreferenceUtils.getInt(MyApplication.getInstance(), Constant.UU_STEP) == 1
-                && !CommonUtil.isReleaseVersion()  )
-            uustep_rl.setVisibility(View.VISIBLE);
-        else
-            uustep_rl.setVisibility(View.GONE);
-        return view;
-    }
-
-
-    private void showPopupWindow() {
-        if (setWindow == null) initPopupWindow();
-        setWindow.showAtLocation(mContext.getWindow().getDecorView().
-                findViewById(android.R.id.content), Gravity.CENTER, 0, 0);
-        DisplayUtil.backgroundAlpha(mContext, 0.4f);
-    }
-
-    private void initPopupWindow() {
-        View viewContext = LayoutInflater.from(ct).inflate(R.layout.msgs_long_click, null);
-        viewContext.findViewById(R.id.msg_delete_tv).setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                presenter.deleteListByType(clickPosition);
-                closePopupWindow();
-            }
-        });
-        viewContext.findViewById(R.id.msg_markread_tv).setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                presenter.readerAllByType(clickPosition);
-                closePopupWindow();
-            }
-        });
-        setWindow = new PopupWindow(viewContext,
-                LinearLayout.LayoutParams.MATCH_PARENT,
-                LinearLayout.LayoutParams.WRAP_CONTENT, true);
-        setWindow.setAnimationStyle(R.style.MenuAnimationFade);
-        setWindow.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.bg_popuwin));
-        setWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
-            @Override
-            public void onDismiss() {
-                closePopupWindow();
-            }
-        });
-    }
-
-    private void closePopupWindow() {
-        if (setWindow != null)
-            setWindow.dismiss();
-        DisplayUtil.backgroundAlpha(mContext, 1f);
-    }
-
-
-    //点击时间回调
-    @Override
-    public void onClick(View v) {
-        switch (v.getId()) {
-            case R.id.booking_rl:
-                startActivity(new Intent("com.modular.booking.BookingListActivity"));
-                tv_book_num.setVisibility(View.GONE);
-                CommonUtil.setSharedPreferences(MyApplication.getInstance(), Constants.SET_BOOKING, true);
-                break;
-            case R.id.message_net_set://点击无网络情况
-                startActivity(new Intent(Settings.ACTION_SETTINGS));
-                break;
-            case R.id.schedule_rl://审批流
-                if (ApiUtils.getApiModel() instanceof ApiPlatform) {
-                    startActivity(new Intent(mContext, ProcessB2BActivity.class));
-                } else {
-                    startActivity(new Intent(mContext, ProcessMsgActivity.class));
-                }
-                break;
-            case R.id.waitting_work_rl://待办工作
-                if (ApiUtils.getApiModel() instanceof ApiPlatform) {
-                    startActivity(new Intent(mContext, TaskB2BActivity.class));
-                } else {
-                    startActivity(new Intent(mContext, TaskActivity.class));
-                }
-                break;
-            case R.id.subscribe_rl://我的订阅
-                presenter.setSubReadTime(DateFormatUtil.long2Str(DateFormatUtil.YMD));
-                startActivity(new Intent(mContext, Subscription2Activity.class));
-                CommonUtil.setSharedPreferences(MyApplication.getInstance(), Constants.new_dingyue, true);
-                dingyue_num.setVisibility(View.GONE);
-                tv_dingyue_desc.setVisibility(View.GONE);
-                break;
-            case R.id.msg_delete_tv://删除
-                break;
-            case R.id.msg_markread_tv://标为已读
-                break;
+	@ViewInject(R.id.voiceSearchView)
+	private VoiceSearchView voiceSearchView;
+
+	@ViewInject(R.id.message_net_set)
+	private DrawableCenterTextView message_net_set;
+	@ViewInject(R.id.pull_refresh_list)
+	private PullToRefreshListView listView;
+
+	private Activity mContext;
+	private MessagePresenter presenter;
+	private MessageAdapter mAdapter = null;
+	private PopupWindow setWindow;
+	private int clickPosition = 0;
+	private Boolean platform;
+	//    private RelativeLayout news_notice_rl;
+	private RelativeLayout subscribe_rl;
+	public static final int REQUESTCODE = 0xa1;
+	private Comparator<BaseSortModel<Friend>> comparator;
+	private TextView dingyue_num;
+	private TextView tv_dingyue_desc;
+
+	//头文件处理
+	private TextView schedule_num_tv;//审批流
+	private TextView waitting_work_num_tv;//待办工作
+	private TextView subscribe_num_tv;//我的订阅
+	private TextView booking_num_tv;//小秘书预约
+
+	private TextView schedule_content_tv;//审批流
+	private TextView waitting_work_content_tv;//待办工作
+	private TextView subscribe_content_tv;//我的订阅
+	private TextView book_content_tv;
+
+	private TextView schedule_time_tv;//审批流
+	private TextView waitting_work_time_tv;//待办工作
+	private TextView subscribe_time_tv;//我的订阅
+	private TextView book_time_tv;
+	private TextView tv_book_num;
+	private MessagePresenter.UnReaderListener unReaderListener;
+	private RelativeLayout uustep_rl;
+
+
+	@Override
+	public void onAttach(Context context) {
+		super.onAttach(context);
+		if (context instanceof Activity) {
+			mContext = (Activity) context;
+		}
+		if (context instanceof MessagePresenter.UnReaderListener) {
+			unReaderListener = (MessagePresenter.UnReaderListener) context;
+		}
+	}
+
+	@Override
+	public void onDestroy() {
+		super.onDestroy();
+		presenter.onDestroyView(mContext);
+	}
+
+
+	@Override
+	protected int inflateLayoutId() {
+		return R.layout.fragment_new_message;
+	}
+
+	@Override
+	protected void onCreateView(Bundle savedInstanceState, boolean createView) {
+		LogUtil.d("onCreateView:" + DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
+		if (createView) {
+			ViewUtils.inject(getmRootView());
+			platform = ApiUtils.getApiModel() instanceof ApiPlatform;
+			initView();
+			initEvent();
+		}
+	}
+
+	@Override
+	public void onResume() {
+		super.onResume();
+		presenter.loadData();
+		if (PreferenceUtils.getInt(MyApplication.getInstance(), Constant.UU_STEP) == 1
+				&& !CommonUtil.isReleaseVersion())
+			uustep_rl.setVisibility(View.VISIBLE);
+		else
+			uustep_rl.setVisibility(View.GONE);
+	}
+
+	private void initEvent() {
+
+
+		message_net_set.setOnClickListener(this);
+		voiceSearchView.addTextChangedListener(new EditChangeListener() {
+			@Override
+			public void afterTextChanged(Editable s) {
+				presenter.search(s.toString());
+			}
+		});
+		//下拉刷新
+		listView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
+			@Override
+			public void onRefresh(PullToRefreshBase<ListView> refreshView) {
+				presenter.loadData();
+			}
+		});
+		listView.getRefreshableView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
+			@Override
+			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+				if (mAdapter == null || ListUtils.isEmpty(mAdapter.getmFriendList()) || mAdapter.getCount() <= id || id < 0)
+					return;
+				try {
+					presenter.turn2NextAct(mContext, (int) id);
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
+			}
+		});
+
+		listView.getRefreshableView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
+			@Override
+			public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
+				if (mAdapter == null || ListUtils.isEmpty(mAdapter.getmFriendList()) || mAdapter.getCount() <= id)
+					return true;
+				clickPosition = (int) id;
+				if (clickPosition < 0) clickPosition = 0;
+				showPopupWindow();
+				return true;
+			}
+		});
+	}
+
+
+	private void initView() {
+		listView.getRefreshableView().addHeaderView(initHeaderView());
+		listView.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
+		mAdapter = new MessageAdapter(null, mContext);
+		listView.getRefreshableView().setAdapter(mAdapter);
+		presenter = new MessagePresenter(mContext, this, unReaderListener);
+	}
+
+	private View initHeaderView() {
+		View view = LayoutInflater.from(mContext).inflate(R.layout.new_message_header, null);
+		subscribe_rl = (RelativeLayout) view.findViewById(R.id.subscribe_rl);
+		schedule_num_tv = (TextView) view.findViewById(R.id.schedule_num_tv);//审批流
+		waitting_work_num_tv = (TextView) view.findViewById(R.id.waitting_work_num_tv);//待办工作
+		subscribe_num_tv = (TextView) view.findViewById(R.id.subscribe_num_tv);//我的订阅
+		booking_num_tv = (TextView) view.findViewById(R.id.booking_num_tv);//小秘书
+		tv_book_num = (TextView) view.findViewById(R.id.tv_book_num);//小秘书
+		schedule_content_tv = (TextView) view.findViewById(R.id.schedule_content_tv);//审批流
+		waitting_work_content_tv = (TextView) view.findViewById(R.id.waitting_work_content_tv);//待办工作
+		subscribe_content_tv = (TextView) view.findViewById(R.id.subscribe_content_tv);//我的订阅
+		book_content_tv = (TextView) view.findViewById(R.id.book_content_tv);//预约内容
+		schedule_time_tv = (TextView) view.findViewById(R.id.schedule_time_tv);//审批流
+		waitting_work_time_tv = (TextView) view.findViewById(R.id.waitting_work_time_tv);//待办工作
+		subscribe_time_tv = (TextView) view.findViewById(R.id.subscribe_time_tv);//我的订阅
+		book_time_tv = (TextView) view.findViewById(R.id.book_time_tv);
+		dingyue_num = (TextView) view.findViewById(R.id.tv_dingYue_num);//订阅红点
+		tv_dingyue_desc = (TextView) view.findViewById(R.id.tv_dingyue_desc);//订阅红点
+
+		uustep_rl = (RelativeLayout) view.findViewById(R.id.uustep_rl);
+		if (CommonUtil.getSharedPreferencesBoolean(MyApplication.getInstance(), Constants.new_dingyue)) {
+			dingyue_num.setVisibility(View.GONE);
+			tv_dingyue_desc.setVisibility(View.GONE);
+		}
+		if (CommonUtil.getSharedPreferencesBoolean(MyApplication.getInstance(), Constants.SET_BOOKING)) {
+			tv_book_num.setVisibility(View.GONE);
+		}
+		view.findViewById(R.id.schedule_rl).setOnClickListener(this);//审批流
+		view.findViewById(R.id.waitting_work_rl).setOnClickListener(this);//待办工作
+		view.findViewById(R.id.subscribe_rl).setOnClickListener(this);//我的订阅
+		view.findViewById(R.id.booking_rl).setOnClickListener(this);//我的订阅
+		view.findViewById(R.id.uustep_rl).setOnClickListener(this);//UU运动
+		if (platform) {
+			subscribe_rl.setVisibility(View.GONE);
+		} else {
+			subscribe_rl.setVisibility(View.VISIBLE);
+		}
+		String user = CommonUtil.getUserRole();
+		if (user.equals("1")) {
+			view.findViewById(R.id.schedule_rl).setVisibility(View.GONE);//审批流
+			view.findViewById(R.id.waitting_work_rl).setVisibility(View.GONE);//待办工作
+			view.findViewById(R.id.subscribe_rl).setVisibility(View.GONE);//我的订阅
+		}
+
+		if (PreferenceUtils.getInt(MyApplication.getInstance(), Constant.UU_STEP) == 1
+				&& !CommonUtil.isReleaseVersion())
+			uustep_rl.setVisibility(View.VISIBLE);
+		else
+			uustep_rl.setVisibility(View.GONE);
+		return view;
+	}
+
+
+	private void showPopupWindow() {
+		if (setWindow == null) initPopupWindow();
+		setWindow.showAtLocation(mContext.getWindow().getDecorView().
+				findViewById(android.R.id.content), Gravity.CENTER, 0, 0);
+		DisplayUtil.backgroundAlpha(mContext, 0.4f);
+	}
+
+	private void initPopupWindow() {
+		View viewContext = LayoutInflater.from(ct).inflate(R.layout.msgs_long_click, null);
+		viewContext.findViewById(R.id.msg_delete_tv).setOnClickListener(new View.OnClickListener() {
+			@Override
+			public void onClick(View v) {
+				presenter.deleteListByType(clickPosition);
+				closePopupWindow();
+			}
+		});
+		viewContext.findViewById(R.id.msg_markread_tv).setOnClickListener(new View.OnClickListener() {
+			@Override
+			public void onClick(View v) {
+				presenter.readerAllByType(clickPosition);
+				closePopupWindow();
+			}
+		});
+		setWindow = new PopupWindow(viewContext,
+				LinearLayout.LayoutParams.MATCH_PARENT,
+				LinearLayout.LayoutParams.WRAP_CONTENT, true);
+		setWindow.setAnimationStyle(R.style.MenuAnimationFade);
+		setWindow.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.bg_popuwin));
+		setWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
+			@Override
+			public void onDismiss() {
+				closePopupWindow();
+			}
+		});
+	}
+
+	private void closePopupWindow() {
+		if (setWindow != null)
+			setWindow.dismiss();
+		DisplayUtil.backgroundAlpha(mContext, 1f);
+	}
+
+
+	//点击时间回调
+	@Override
+	public void onClick(View v) {
+		switch (v.getId()) {
+			case R.id.booking_rl:
+				startActivity(new Intent("com.modular.booking.BookingListActivity"));
+				tv_book_num.setVisibility(View.GONE);
+				CommonUtil.setSharedPreferences(MyApplication.getInstance(), Constants.SET_BOOKING, true);
+				break;
+			case R.id.message_net_set://点击无网络情况
+				startActivity(new Intent(Settings.ACTION_SETTINGS));
+				break;
+			case R.id.schedule_rl://审批流
+				if (ApiUtils.getApiModel() instanceof ApiPlatform) {
+					startActivity(new Intent(mContext, ProcessB2BActivity.class));
+				} else {
+					startActivity(new Intent(mContext, ProcessMsgActivity.class));
+				}
+				break;
+			case R.id.waitting_work_rl://待办工作
+				if (ApiUtils.getApiModel() instanceof ApiPlatform) {
+					startActivity(new Intent(mContext, TaskB2BActivity.class));
+				} else {
+					startActivity(new Intent(mContext, TaskActivity.class));
+				}
+				break;
+			case R.id.subscribe_rl://我的订阅
+				presenter.setSubReadTime(DateFormatUtil.long2Str(DateFormatUtil.YMD));
+				startActivity(new Intent(mContext, Subscription2Activity.class));
+				CommonUtil.setSharedPreferences(MyApplication.getInstance(), Constants.new_dingyue, true);
+				dingyue_num.setVisibility(View.GONE);
+				tv_dingyue_desc.setVisibility(View.GONE);
+				break;
+			case R.id.msg_delete_tv://删除
+				break;
+			case R.id.msg_markread_tv://标为已读
+				break;
 //            case R.id.notice_rl: //新闻通知
 //                Intent intent = new Intent(mContext, NoticeMenuActivity.class);
 ////                intent.putExtra(NoticeMenuActivity.GONGGAO, GONGGAO_count);
@@ -332,88 +336,88 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
 ////                intent.putExtra(NoticeMenuActivity.NES, NES_count);
 //                startActivityForResult(intent, REQUESTCODE);
 //                break;
-            case R.id.uustep_rl:
-                startActivity(new Intent(mContext, UUSportActivity.class));
-                break;
-        }
-
-    }
-
-
-    @Override
-    public void showModel(List<BaseSortModel<Friend>> models) {
-        sortModels(models);
-        if (listView.isRefreshing())
-            listView.onRefreshComplete();
-        if (mAdapter == null) {
-            mAdapter = new MessageAdapter(models, mContext);
-            listView.getRefreshableView().setAdapter(mAdapter);
-        } else {
-            mAdapter.setmFriendList(models);
-            mAdapter.notifyDataSetChanged();
-        }
-    }
-
-    private void sortModels(List<BaseSortModel<Friend>> models) {
-        if (ListUtils.isEmpty(models)) return;
-        if (comparator == null)
-            comparator = new Comparator<BaseSortModel<Friend>>() {
-                @Override
-                public int compare(BaseSortModel<Friend> lhs, BaseSortModel<Friend> rhs) {
-                    return rhs.getBean().getTimeSend() - lhs.getBean().getTimeSend();
-                }
-            };
-        Collections.sort(models, comparator);
-    }
-
-
-    @Override
-    public void clearSearch() {
-        voiceSearchView.setText("");
-    }
-
-
-    @Override
-    public void updateHeaderView(int postion, int num, String subTitle, String time) {
-        switch (postion) {
-            case 0:
-                updateHeaderView(schedule_num_tv, schedule_content_tv, schedule_time_tv, num, subTitle, time);
-                break;
-            case 1:
-                updateHeaderView(waitting_work_num_tv, waitting_work_content_tv, waitting_work_time_tv, num, subTitle, time);
-                break;
-            case 2:
-                updateHeaderView(subscribe_num_tv, subscribe_content_tv, subscribe_time_tv, num, subTitle, time);
-                break;
-            case 4:
-                LogUtil.d("Test", "updateHeaderView:" + num);
-                updateHeaderView(booking_num_tv, book_content_tv, book_time_tv, num, subTitle, time);
-                break;
-        }
-        listView.onRefreshComplete();
-    }
-
-    @Override
-    public void changeNet(boolean workConnected) {
-        if (message_net_set != null) {
-            if (!workConnected) {
-                message_net_set.setVisibility(View.VISIBLE);
-            } else {
-                message_net_set.setVisibility(View.GONE);
-            }
-        }
-    }
-
-
-    private void updateHeaderView(TextView num_tv, TextView content_tv, TextView time_tv, int num, String subTitle, String time) {
-        if (num_tv != null) {
-            num_tv.setVisibility(num == 0 ? View.GONE : View.VISIBLE);
-            num_tv.setText("" + num);
-        }
-        if (content_tv != null)
-            content_tv.setText(StringUtil.isEmpty(subTitle) ? "" : subTitle);
-        if (time_tv != null)
-            time_tv.setText(num == 0 ? "" : (StringUtil.isEmpty(time)) ? getString(R.string.friendly_time_just_now) : time);
-    }
+			case R.id.uustep_rl:
+				startActivity(new Intent(mContext, UUSportActivity.class));
+				break;
+		}
+
+	}
+
+
+	@Override
+	public void showModel(List<BaseSortModel<Friend>> models) {
+		sortModels(models);
+		if (listView.isRefreshing())
+			listView.onRefreshComplete();
+		if (mAdapter == null) {
+			mAdapter = new MessageAdapter(models, mContext);
+			listView.getRefreshableView().setAdapter(mAdapter);
+		} else {
+			mAdapter.setmFriendList(models);
+			mAdapter.notifyDataSetChanged();
+		}
+	}
+
+	private void sortModels(List<BaseSortModel<Friend>> models) {
+		if (ListUtils.isEmpty(models)) return;
+		if (comparator == null)
+			comparator = new Comparator<BaseSortModel<Friend>>() {
+				@Override
+				public int compare(BaseSortModel<Friend> lhs, BaseSortModel<Friend> rhs) {
+					return rhs.getBean().getTimeSend() - lhs.getBean().getTimeSend();
+				}
+			};
+		Collections.sort(models, comparator);
+	}
+
+
+	@Override
+	public void clearSearch() {
+		voiceSearchView.setText("");
+	}
+
+
+	@Override
+	public void updateHeaderView(int postion, int num, String subTitle, String time) {
+		switch (postion) {
+			case 0:
+				updateHeaderView(schedule_num_tv, schedule_content_tv, schedule_time_tv, num, subTitle, time);
+				break;
+			case 1:
+				updateHeaderView(waitting_work_num_tv, waitting_work_content_tv, waitting_work_time_tv, num, subTitle, time);
+				break;
+			case 2:
+				updateHeaderView(subscribe_num_tv, subscribe_content_tv, subscribe_time_tv, num, subTitle, time);
+				break;
+			case 4:
+				LogUtil.d("Test", "updateHeaderView:" + num);
+				updateHeaderView(booking_num_tv, book_content_tv, book_time_tv, num, subTitle, time);
+				break;
+		}
+		listView.onRefreshComplete();
+	}
+
+	@Override
+	public void changeNet(boolean workConnected) {
+		if (message_net_set != null) {
+			if (!workConnected) {
+				message_net_set.setVisibility(View.VISIBLE);
+			} else {
+				message_net_set.setVisibility(View.GONE);
+			}
+		}
+	}
+
+
+	private void updateHeaderView(TextView num_tv, TextView content_tv, TextView time_tv, int num, String subTitle, String time) {
+		if (num_tv != null) {
+			num_tv.setVisibility(num == 0 ? View.GONE : View.VISIBLE);
+			num_tv.setText("" + num);
+		}
+		if (content_tv != null)
+			content_tv.setText(StringUtil.isEmpty(subTitle) ? "" : subTitle);
+		if (time_tv != null)
+			time_tv.setText(num == 0 ? "" : (StringUtil.isEmpty(time)) ? getString(R.string.friendly_time_just_now) : time);
+	}
 
 }

+ 0 - 2
app_core/common/build.gradle

@@ -40,8 +40,6 @@ dependencies {
     compile deps.stickyGridHeaders
     compile 'com.squareup.okhttp3:okhttp:3.9.0'
 
-    compile project(':network')
-
     compile project(':pullToRefershLibraryMy')
     compile project(':MPAndroidChart')
     compile project(':libedittextformlibrary')

+ 104 - 105
app_core/common/src/main/java/com/common/LogUtil.java

@@ -11,109 +11,108 @@ import java.util.Date;
 
 public class LogUtil {
 
-    public static void d(String TAG, String method, String msg) {
-        Log.d(TAG, "[" + method + "]" + msg);
-    }
-
-    public static void d(String TAG, String msg) {
-        if (BaseConfig.showLogAble()) {
-            Log.d(TAG, "[" + getFileLineMethod() + "]" + msg);
-        }
-    }
-
-    public static void d(String msg) {
-        if (BaseConfig.showLogAble() && !TextUtils.isEmpty(msg)) {
-            Log.d(_FILE_(), "[" + getLineMethod() + "]" + msg);
-        }
-    }
-
-    public static void e(String msg) {
-        if (BaseConfig.showLogAble()) {
-            Log.e(_FILE_(), getLineMethod() + msg);
-        }
-    }
-
-    public static void e(String TAG, String msg) {
-        if (BaseConfig.showLogAble()) {
-            Log.e(TAG, getLineMethod() + msg);
-        }
-    }
-
-    public static void i(String msg) {
-        if (BaseConfig.showLogAble()) {
-            if (!StringUtil.isEmpty(msg))
-                Log.i("gongpengming", msg);
-        }
-    }
-
-    public static void i(String tag, String msg) {
-        if (BaseConfig.showLogAble()) {
-            if (!StringUtil.isEmpty(msg)) {
-                if (TextUtils.isEmpty(tag)) {
-                    Log.i("gongpengming", msg);
-                } else {
-                    prinlnLongMsg(tag, msg);
-                }
-            }
-        }
-    }
-
-    public static String getFileLineMethod() {
-        StackTraceElement traceElement = ((new Exception()).getStackTrace())[2];
-        StringBuffer toStringBuffer = new StringBuffer("[")
-                .append(traceElement.getFileName()).append(" | ")
-                .append(traceElement.getLineNumber()).append(" | ")
-                .append(traceElement.getMethodName()).append("]");
-        return toStringBuffer.toString();
-    }
-
-    public static String getLineMethod() {
-        StackTraceElement traceElement = ((new Exception()).getStackTrace())[2];
-        StringBuffer toStringBuffer = new StringBuffer("[")
-                .append(traceElement.getLineNumber()).append(" | ")
-                .append(traceElement.getMethodName()).append("]");
-        return toStringBuffer.toString();
-    }
-
-    public static String _FILE_() {
-        StackTraceElement traceElement = ((new Exception()).getStackTrace())[2];
-        return traceElement.getFileName();
-    }
-
-    public static String _FUNC_() {
-        StackTraceElement traceElement = ((new Exception()).getStackTrace())[1];
-        return traceElement.getMethodName();
-    }
-
-    public static int _LINE_() {
-        StackTraceElement traceElement = ((new Exception()).getStackTrace())[1];
-        return traceElement.getLineNumber();
-    }
-
-    public static String _TIME_() {
-        Date now = new Date();
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
-        return sdf.format(now);
-    }
-
-    public static void prinlnLongMsg(String TAG, String responseInfo) {
-        if (responseInfo != null) {
-            if (responseInfo.length() >= 3000) {
-                Log.v(TAG, "sb.length = " + responseInfo.length());
-                int chunkCount = responseInfo.length() / 3000;     // integer division
-                for (int i = 0; i <= chunkCount; i++) {
-                    int max = 3000 * (i + 1);
-                    if (max >= responseInfo.length()) {
-                        Log.v(TAG, "【chunk " + i + " of " + chunkCount + "】:" + responseInfo.substring(3000 * i));
-                    } else {
-                        Log.v(TAG, "【chunk " + i + " of " + chunkCount + "】:" + responseInfo.substring(3000 * i, max));
-                    }
-                }
-            } else {
-                Log.v(TAG, "sb.length = " + responseInfo.length());
-                Log.v(TAG, responseInfo.toString());
-            }
-        }
-
-    }
+	public static void d(String TAG, String method, String msg) {
+		Log.d(TAG, "[" + method + "]" + msg);
+	}
+
+	public static void d(String TAG, String msg) {
+		if (BaseConfig.showLogAble()) {
+			Log.d(TAG, "[" + getFileLineMethod() + "]" + msg);
+		}
+	}
+
+	public static void d(String msg) {
+		if (BaseConfig.showLogAble() && !TextUtils.isEmpty(msg)) {
+			Log.d(_FILE_(), "[" + getLineMethod() + "]" + msg);
+		}
+	}
+
+	public static void e(String msg) {
+		if (BaseConfig.showLogAble()) {
+			Log.e(_FILE_(), getLineMethod() + msg);
+		}
+	}
+
+	public static void e(String TAG, String msg) {
+		if (BaseConfig.showLogAble()) {
+			Log.e(TAG, getLineMethod() + msg);
+		}
+	}
+
+	public static void i(String msg) {
+		if (BaseConfig.showLogAble() && msg != null && msg.length() > 0) {
+			Log.i("gongpengming", msg);
+		}
+	}
+
+	public static void i(String tag, String msg) {
+		if (BaseConfig.showLogAble()) {
+			if (!StringUtil.isEmpty(msg)) {
+				if (TextUtils.isEmpty(tag)) {
+					Log.i("gongpengming", msg);
+				} else {
+					prinlnLongMsg(tag, msg);
+				}
+			}
+		}
+	}
+
+	public static String getFileLineMethod() {
+		StackTraceElement traceElement = ((new Exception()).getStackTrace())[2];
+		StringBuffer toStringBuffer = new StringBuffer("[")
+				.append(traceElement.getFileName()).append(" | ")
+				.append(traceElement.getLineNumber()).append(" | ")
+				.append(traceElement.getMethodName()).append("]");
+		return toStringBuffer.toString();
+	}
+
+	public static String getLineMethod() {
+		StackTraceElement traceElement = ((new Exception()).getStackTrace())[2];
+		StringBuffer toStringBuffer = new StringBuffer("[")
+				.append(traceElement.getLineNumber()).append(" | ")
+				.append(traceElement.getMethodName()).append("]");
+		return toStringBuffer.toString();
+	}
+
+	public static String _FILE_() {
+		StackTraceElement traceElement = ((new Exception()).getStackTrace())[2];
+		return traceElement.getFileName();
+	}
+
+	public static String _FUNC_() {
+		StackTraceElement traceElement = ((new Exception()).getStackTrace())[1];
+		return traceElement.getMethodName();
+	}
+
+	public static int _LINE_() {
+		StackTraceElement traceElement = ((new Exception()).getStackTrace())[1];
+		return traceElement.getLineNumber();
+	}
+
+	public static String _TIME_() {
+		Date now = new Date();
+		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+		return sdf.format(now);
+	}
+
+	public static void prinlnLongMsg(String TAG, String responseInfo) {
+		if (responseInfo != null) {
+			if (responseInfo.length() >= 3000) {
+				Log.v(TAG, "sb.length = " + responseInfo.length());
+				int chunkCount = responseInfo.length() / 3000;     // integer division
+				for (int i = 0; i <= chunkCount; i++) {
+					int max = 3000 * (i + 1);
+					if (max >= responseInfo.length()) {
+						Log.v(TAG, "【chunk " + i + " of " + chunkCount + "】:" + responseInfo.substring(3000 * i));
+					} else {
+						Log.v(TAG, "【chunk " + i + " of " + chunkCount + "】:" + responseInfo.substring(3000 * i, max));
+					}
+				}
+			} else {
+				Log.v(TAG, "sb.length = " + responseInfo.length());
+				Log.v(TAG, responseInfo.toString());
+			}
+		}
+
+	}
 }

+ 277 - 273
app_core/common/src/main/java/com/common/data/JSONUtil.java

@@ -15,278 +15,282 @@ import java.util.Map;
 
 public class JSONUtil {
 
-    public static <T> String map2JSON(Map<String, T> map) {
-        if (map == null) return "";
-        StringBuilder builder = new StringBuilder("{\n");
-        for (Map.Entry<String, T> e : map.entrySet()) {
-            builder.append("\"" + e.getKey() + "\":");
-            if (e.getValue() instanceof String || e.getValue() instanceof CharSequence) {
-                builder.append("\"" + e.getValue() + "\",\n");
-            } else {
-                builder.append(e.getValue() + ",\n");
-            }
-        }
-        builder.deleteCharAt(builder.length() - 1);
-        builder.deleteCharAt(builder.length() - 1);
-        builder.append("\n}");
-        return builder.toString();
-    }
-
-    public static <T> String map2JSON(List<Map<String, T>> maps) {
-        if (maps == null || maps.size() <= 0) return "";
-        StringBuilder builder = new StringBuilder("[\n");
-        for (Map<String, T> m : maps) {
-            builder.append("{\n");
-            for (Map.Entry<String, T> e : m.entrySet()) {
-                builder.append("\"" + e.getKey() + "\":");
-                if (e.getValue() instanceof String || e.getValue() instanceof CharSequence) {
-                    builder.append("\"" + StringUtil.toHttpString((String) e.getValue()) + "\",\n");
-                } else {
-                    builder.append(e.getValue() + ",\n");
-                }
-            }
-            StringUtil.removieLast(builder);
-            StringUtil.removieLast(builder);
-            builder.append("\n},\n");
-        }
-        StringUtil.removieLast(builder);
-        StringUtil.removieLast(builder);
-        builder.append("\n]");
-        return builder.toString();
-    }
-
-    public static String param2Url(String url, Map<String, Object> param) {
-        if (StringUtil.isEmpty(url))
-            return "";
-        StringBuilder urlBuilder = new StringBuilder(url);
-        if (param == null || param.isEmpty()) {
-            return urlBuilder.toString();
-        }
-        if (!url.contains("?"))
-            urlBuilder.append("?");
-        else urlBuilder.append("&");
-        for (Map.Entry<String, Object> e : param.entrySet()) {
-            if (e.getValue() == null || StringUtil.isEmpty(e.getKey()))
-                continue;
-            String value = null;
-            try {
-                value = URLEncoder.encode(e.getValue().toString(), "UTF-8");
-            } catch (UnsupportedEncodingException e1) {
-                value = e.getValue().toString();
-            }
-            urlBuilder.append(String.format("%s=%s", e.getKey(), value));
-            urlBuilder.append("&");
-        }
-        if (urlBuilder.length() > 1)
-            urlBuilder.deleteCharAt(urlBuilder.length() - 1);
-        return urlBuilder.toString();
-    }
-
-    public static JSONObject getJSONObject(String message, String... keys) {
-        try {
-            return getJSONObject(JSON.parseObject(message), keys);
-        } catch (Exception e) {
-            return new JSONObject();
-        }
-    }
-
-    public static JSONArray getJSONArray(String message, String... keys) {
-        try {
-            return getJSONArray(JSON.parseObject(message), keys);
-        } catch (Exception e) {
-            return new JSONArray();
-        }
-    }
-
-    public static boolean getBoolean(String message, String... keys) {
-        try {
-            return getBoolean(JSON.parseObject(message), keys);
-        } catch (Exception e) {
-            return false;
-        }
-    }
-
-    public static String getText(String message, String... keys) {
-        try {
-            return getText(JSON.parseObject(message), keys);
-        } catch (Exception e) {
-            return "";
-        }
-    }
-
-    public static int getInt(String message, String... keys) {
-        try {
-            return getInt(JSON.parseObject(message), keys);
-        } catch (Exception e) {
-            return 0;
-        }
-    }
-
-    public static long getLong(String message, String... keys) {
-        try {
-            return getLong(JSON.parseObject(message), keys);
-        } catch (Exception e) {
-            return 0;
-        }
-    }
-
-    public static double getDouble(String message, String... keys) {
-        try {
-            return getDouble(JSON.parseObject(message), keys);
-        } catch (Exception e) {
-            return 0;
-        }
-    }
-
-    public static float getFloat(String message, String... keys) {
-        try {
-            return getFloat(JSON.parseObject(message), keys);
-        } catch (Exception e) {
-            return 0;
-        }
-    }
-
-    public static JSONObject getJSONObject(JSONObject object, String... keys) {
-        try {
-            String obj = getDataForJson(object, keys);
-            return !validateJSONObject(obj) ? new JSONObject() : JSON.parseObject(obj);
-        } catch (Exception e) {
-            return new JSONObject();
-        }
-    }
-
-    public static JSONArray getJSONArray(JSONObject object, String... keys) {
-        try {
-            String arry = getDataForJson(object, keys);
-            return !validateJSONArray(arry) ? new JSONArray() : JSON.parseArray(arry);
-        } catch (Exception e) {
-            return new JSONArray();
-        }
-    }
-
-    public static boolean getBoolean(JSONObject object, String... keys) {
-        try {
-            String bool = getDataForJson(object, keys);
-            return Boolean.valueOf(bool);
-        } catch (Exception e) {
-            return false;
-        }
-
-    }
-
-    public static String getText(JSONObject object, String... keys) {
-        try {
-            String t = getDataForJson(object, keys);
-            if (StringUtil.isEmpty(t) || StringUtil.hasOneEqual(t, "(null)", "null")) {
-                return "";
-            } else
-                return t;
-        } catch (Exception e) {
-            return "";
-        }
-    }
-
-    public static int getInt(JSONObject object, String... keys) {
-        try {
-            String i = getDataForJson(object, keys);
-            return Integer.valueOf(i);
-        } catch (Exception e) {
-            return 0;
-        }
-    }
-
-    public static long getLong(JSONObject object, String... keys) {
-        try {
-            String i = getDataForJson(object, keys);
-            return Long.valueOf(i);
-        } catch (Exception e) {
-            return 0;
-        }
-    }
-
-    public static double getDouble(JSONObject object, String... keys) {
-        try {
-            String d = getDataForJson(object, keys);
-            return Double.valueOf(d);
-        } catch (Exception e) {
-            return 0;
-
-        }
-    }
-
-    public static float getFloat(JSONObject object, String... keys) {
-        try {
-            String f = getDataForJson(object, keys);
-            return Float.valueOf(f);
-        } catch (Exception e) {
-            return 0;
-        }
-    }
-
-    private static String getDataForJson(JSONObject object, String... keys) {
-        if (object == null || keys == null || keys.length <= 0) return null;
-        Object o = null;
-        for (String key : keys) {
-            o = object.get(key);
-            if (o != null)
-                return o.toString();
-        }
-        return null;
-    }
-
-
-
-    /*获取接口时间格式,由于独立版和erp版本返回的时间格式不一样 long 和 String */
-    public static long getTime(JSONObject jsonObject, String... keys) {
-        if (jsonObject == null || keys == null || keys.length <= 0) return 0;
-        for (String k : keys) {
-            try {
-                if (jsonObject.containsKey(k)) {
-                    Object o = jsonObject.get(k);
-                    if (o instanceof String) {
-                        return DateFormatUtil.str2Long((String) o,DateFormatUtil.YMD_HMS);
-                    } else if (o instanceof Long) {
-                        return (long) o;
-                    }
-                }
-            } catch (Exception e) {
-
-            }
-        }
-        return 0;
-    }
-
-    /*验证一个字符串是否是合法的JSON串*/
-    public static boolean validate(String message) {
-        if (StringUtil.isEmpty(message)) return false;
-        try {
-            JSON.parse(message);
-            return true;
-        } catch (Exception e) {
-            return false;
-        }
-    }
-
-    /*验证一个字符串是否是合法的JSON串*/
-    public static boolean validateJSONObject(String message) {
-        if (StringUtil.isEmpty(message)) return false;
-        try {
-            JSON.parseObject(message);
-            return true;
-        } catch (Exception e) {
-            return false;
-        }
-    }
-
-    /*验证一个字符串是否是合法的JSON串*/
-    public static boolean validateJSONArray(String message) {
-        if (StringUtil.isEmpty(message)) return false;
-        try {
-            JSON.parseArray(message);
-            return true;
-        } catch (Exception e) {
-            return false;
-        }
-    }
+	public static <T> String map2JSON(Map<String, T> map) {
+		if (map == null) return "";
+		StringBuilder builder = new StringBuilder("{\n");
+		for (Map.Entry<String, T> e : map.entrySet()) {
+			builder.append("\"" + e.getKey() + "\":");
+			if (e.getValue() instanceof String || e.getValue() instanceof CharSequence) {
+				builder.append("\"" + e.getValue() + "\",\n");
+			} else {
+				builder.append(e.getValue() + ",\n");
+			}
+		}
+		builder.deleteCharAt(builder.length() - 1);
+		builder.deleteCharAt(builder.length() - 1);
+		builder.append("\n}");
+		return builder.toString();
+	}
+
+	public static <T> String map2JSON(List<Map<String, T>> maps) {
+		if (maps == null || maps.size() <= 0) return "";
+		StringBuilder builder = new StringBuilder("[\n");
+		for (Map<String, T> m : maps) {
+			builder.append("{\n");
+			for (Map.Entry<String, T> e : m.entrySet()) {
+				builder.append("\"" + e.getKey() + "\":");
+				if (e.getValue() instanceof String || e.getValue() instanceof CharSequence) {
+					builder.append("\"" + StringUtil.toHttpString((String) e.getValue()) + "\",\n");
+				} else {
+					builder.append(e.getValue() + ",\n");
+				}
+			}
+			StringUtil.removieLast(builder);
+			StringUtil.removieLast(builder);
+			builder.append("\n},\n");
+		}
+		StringUtil.removieLast(builder);
+		StringUtil.removieLast(builder);
+		builder.append("\n]");
+		return builder.toString();
+	}
+
+	public static String param2Url(String url, Map<String, Object> param) {
+		if (StringUtil.isEmpty(url))
+			return "";
+		StringBuilder urlBuilder = new StringBuilder(url);
+		if (param == null || param.isEmpty()) {
+			return urlBuilder.toString();
+		}
+		if (!url.contains("?"))
+			urlBuilder.append("?");
+		else urlBuilder.append("&");
+		for (Map.Entry<String, Object> e : param.entrySet()) {
+			if (e.getValue() == null || StringUtil.isEmpty(e.getKey()))
+				continue;
+			String value = null;
+			try {
+				value = URLEncoder.encode(e.getValue().toString(), "UTF-8");
+			} catch (UnsupportedEncodingException e1) {
+				value = e.getValue().toString();
+			}
+			urlBuilder.append(String.format("%s=%s", e.getKey(), value));
+			urlBuilder.append("&");
+		}
+		if (urlBuilder.length() > 1)
+			urlBuilder.deleteCharAt(urlBuilder.length() - 1);
+		return urlBuilder.toString();
+	}
+
+	public static JSONObject getJSONObject(String message, String... keys) {
+		try {
+			return getJSONObject(JSON.parseObject(message), keys);
+		} catch (Exception e) {
+			return new JSONObject();
+		}
+	}
+
+	public static JSONArray getJSONArray(String message, String... keys) {
+		try {
+			return getJSONArray(JSON.parseObject(message), keys);
+		} catch (Exception e) {
+			return new JSONArray();
+		}
+	}
+
+	public static boolean getBoolean(String message, String... keys) {
+		try {
+			return getBoolean(JSON.parseObject(message), keys);
+		} catch (Exception e) {
+			return false;
+		}
+	}
+
+	public static String getText(String message, String... keys) {
+		try {
+			return getText(JSON.parseObject(message), keys);
+		} catch (Exception e) {
+			return "";
+		}
+	}
+
+	public static int getInt(String message, String... keys) {
+		try {
+			return getInt(JSON.parseObject(message), keys);
+		} catch (Exception e) {
+			return 0;
+		}
+	}
+
+	public static long getLong(String message, String... keys) {
+		try {
+			return getLong(JSON.parseObject(message), keys);
+		} catch (Exception e) {
+			return 0;
+		}
+	}
+
+	public static double getDouble(String message, String... keys) {
+		try {
+			return getDouble(JSON.parseObject(message), keys);
+		} catch (Exception e) {
+			return 0;
+		}
+	}
+
+	public static float getFloat(String message, String... keys) {
+		try {
+			return getFloat(JSON.parseObject(message), keys);
+		} catch (Exception e) {
+			return 0;
+		}
+	}
+
+	public static JSONObject getJSONObject(JSONObject object, String... keys) {
+		try {
+			String obj = getDataForJson(object, keys);
+			return !validateJSONObject(obj) ? new JSONObject() : JSON.parseObject(obj);
+		} catch (Exception e) {
+			return new JSONObject();
+		}
+	}
+
+	public static JSONArray getJSONArray(JSONObject object, String... keys) {
+		try {
+			if (object == null || keys == null || keys.length <= 0) return new JSONArray();
+			for (String key : keys) {
+				if (object.containsKey(key)&&object.get(key) instanceof JSONArray){
+					return object.getJSONArray(key);
+				}
+			}
+		} catch (Exception e) {
+			return new JSONArray();
+		}
+		return new JSONArray();
+	}
+
+	public static boolean getBoolean(JSONObject object, String... keys) {
+		try {
+			String bool = getDataForJson(object, keys);
+			return Boolean.valueOf(bool);
+		} catch (Exception e) {
+			return false;
+		}
+
+	}
+
+	public static String getText(JSONObject object, String... keys) {
+		try {
+			String t = getDataForJson(object, keys);
+			if (StringUtil.isEmpty(t) || StringUtil.hasOneEqual(t, "(null)", "null")) {
+				return "";
+			} else
+				return t;
+		} catch (Exception e) {
+			return "";
+		}
+	}
+
+	public static int getInt(JSONObject object, String... keys) {
+		try {
+			String i = getDataForJson(object, keys);
+			return Integer.valueOf(i);
+		} catch (Exception e) {
+			return 0;
+		}
+	}
+
+	public static long getLong(JSONObject object, String... keys) {
+		try {
+			String i = getDataForJson(object, keys);
+			return Long.valueOf(i);
+		} catch (Exception e) {
+			return 0;
+		}
+	}
+
+	public static double getDouble(JSONObject object, String... keys) {
+		try {
+			String d = getDataForJson(object, keys);
+			return Double.valueOf(d);
+		} catch (Exception e) {
+			return 0;
+
+		}
+	}
+
+	public static float getFloat(JSONObject object, String... keys) {
+		try {
+			String f = getDataForJson(object, keys);
+			return Float.valueOf(f);
+		} catch (Exception e) {
+			return 0;
+		}
+	}
+
+	private static String getDataForJson(JSONObject object, String... keys) {
+		if (object == null || keys == null || keys.length <= 0) return null;
+		Object o = null;
+		for (String key : keys) {
+			o = object.get(key);
+			if (o != null)
+				return o.toString();
+		}
+		return null;
+	}
+
+
+	/*获取接口时间格式,由于独立版和erp版本返回的时间格式不一样 long 和 String */
+	public static long getTime(JSONObject jsonObject, String... keys) {
+		if (jsonObject == null || keys == null || keys.length <= 0) return 0;
+		for (String k : keys) {
+			try {
+				if (jsonObject.containsKey(k)) {
+					Object o = jsonObject.get(k);
+					if (o instanceof String) {
+						return DateFormatUtil.str2Long((String) o, DateFormatUtil.YMD_HMS);
+					} else if (o instanceof Long) {
+						return (long) o;
+					}
+				}
+			} catch (Exception e) {
+
+			}
+		}
+		return 0;
+	}
+
+	/*验证一个字符串是否是合法的JSON串*/
+	public static boolean validate(String message) {
+		if (StringUtil.isEmpty(message)) return false;
+		try {
+			JSON.parse(message);
+			return true;
+		} catch (Exception e) {
+			return false;
+		}
+	}
+
+	/*验证一个字符串是否是合法的JSON串*/
+	public static boolean validateJSONObject(String message) {
+		if (StringUtil.isEmpty(message)) return false;
+		try {
+			JSON.parseObject(message);
+			return true;
+		} catch (Exception e) {
+			return false;
+		}
+	}
+
+	/*验证一个字符串是否是合法的JSON串*/
+	public static boolean validateJSONArray(String message) {
+		if (StringUtil.isEmpty(message)) return false;
+		try {
+			JSON.parseArray(message);
+			return true;
+		} catch (Exception e) {
+			return false;
+		}
+	}
 
 }

+ 4 - 0
app_core/common/src/main/java/com/common/system/SystemUtil.java

@@ -184,6 +184,10 @@ public class SystemUtil {
     public static String getOsVersion() {
         return android.os.Build.VERSION.RELEASE;
     }
+    /* 获取操作系统版本号 */
+    public static int getSdkVersion() {
+        return android.os.Build.VERSION.SDK_INT;
+    }
 
     /* 获取手机型号 */
     public static String getModel() {

+ 348 - 344
app_core/common/src/main/java/com/core/app/Constants.java

@@ -7,333 +7,333 @@ import com.core.db.DatabaseTables;
  */
 public class Constants {
 
-    public static String IS_NOTIFICATION = "is_notification";//是是否进行通知
-    public static final String BASE_URL_LOGIN = "http://manage.ubtob.com/public/account";
-    public static final String IM_BASE_URL = "http://113.105.74.140:8092/";
-
-    //通讯录表
-    public static final String TABLE_CONTANCTS = "CREATE TABLE  tbl_contacts " +
-            "(id integer primary key autoincrement,"
-            + "tf_name varchar(50),"
-            + "tf_whichSys varchar(50),"
-            + "tf_company varchar(50),"
-            + "tf_phone varchar(50),"
-            + "tf_email varchar(50),"
-            + "tf_type integer,"
-            + "tf_ownerId varchar(50),"
-            + "tf_imId varchar(50) default '0')";
-
-    //组织架构 员工信息
-    public static final String SQL_EMPLOYEES_CREATETABLE = "CREATE TABLE EMPLOYEES "
-            + "(id integer primary key autoincrement,"
-            + "em_id integer,"
-            + "em_code varchar(50) NOT NULL UNIQUE,"
-            + "em_name varchar(50),"
-            + "em_position varchar(50),"
-            + "em_jobs varchar(50),"
-            + "em_defaultorname varchar(50),"
-            + "em_depart varchar(50),"
-            + "em_tel varchar(50),"
-            + "em_imid varchar(50) default '0',"
-            + "em_mobile varchar(50),"
-            + "em_email varchar(50),"
-            + "em_uu varchar(50),"
-            + "em_imageid integer,"
-            + "company varchar(100),"
-            + "whichsys varchar(50),"
-            + "em_defaultorid integer,"
-            + "em_flag varchar(50))";
-    //组织架构表
-    public static final String SQL_HRORGS_CREATETABLE = "CREATE TABLE HRORGS "
-            + "(id integer primary key autoincrement,"
-            + "or_id integer,"
-            + "or_code varchar(50) NOT NULL UNIQUE,"
-            + "or_name varchar(50),"
-            + "or_subof varchar(50),"
-            + "or_isleaf varchar(50),"
-            + "company varchar(100),"
-            + "whichsys varchar(50),"
-            + "or_flag varchar(50),"
-            + "or_headmanname varchar(50),"
-            + "or_headmancode varchar(50),"
-            + "or_remark integer" +
-            ")";
-    //组织架构 更新时间表
-    public static final String SQL_empdate_CREATETABLE = "CREATE TABLE empdate "
-            + "(id integer primary key autoincrement,"
-            + "ed_lastdate varchar(50),"
-            + "ed_kind varchar(50),"
-            + "ed_company varchar(50),"
-            + "ed_whichsys varchar(50)"
-            + ")";
-    //b2b消息通知表
-    public static final String SQL_B2B_MSG = "CREATE TABLE B2BMSG "
-            + "(id integer primary key autoincrement,"
-            + "b2b_content varchar(50),"
-            + "b2b_time varchar(50),"
-            + "b2b_hasRead integer,"
-            + "b2b_master varchar(50)"
-            + ")";
-
-    //OA内勤签到表
-    public static final String WORKTIBLE = "CREATE TABLE workdata("
-            + "id integer UNIQUE,"//id  唯一不可重复
-            + "emCode  varchar(10),"//员工编号
-            + "master  varchar(20),"//账套
-            + "date  varchar(20),"//日期  yyyy-MM-dd
-
-            + "workStart  varchar(6),"//上班开始时间  hh:mm
-            + "workTime  varchar(6),"//上班时间  hh:mm
-            + "workend  varchar(6),"//上班结束时间  hh:mm
-            + "workSignin  varchar(6),"//上班签到  hh:mm
-            + "workAllegedly  varchar(6),"//上班申诉时间  hh:mm
-            + "workAlarm INTEGER,"//上班提醒 0|1
-
-            + "offStart  varchar(6),"//下班开始时间  hh:mm
-            + "offTime  varchar(6),"//下班时间  hh:mm
-            + "offend  varchar(6),"//下班结束时间  hh:mm
-            + "offSignin  varchar(6),"//下班签到  hh:mm
-            + "offAllegedly  varchar(6),"//下班申诉时间  hh:mm
-            + "offAlarm INTEGER,"//下班提醒 0|1
-
-            + "isNextDay INTEGER,"//是否是跨天 0|1
-            + "leaveAlarm INTEGER"//离开提示次数  0|1
-            + ")";
-
-
-    //OA内勤签到表
-    public static final String SIGNING = "CREATE TABLE signing("
-            + "emCode  varchar(10),"//员工编号
-            + "master  varchar(20),"//账套
-
-            + "workTime  varchar(6),"//上班时间  hh:mm
-            + "offTime  varchar(6),"//下班时间   hh:mm
-
-            + "workSignin  varchar(6),"//上班签到时间 hh:mm
-            + "offSignin  varchar(6),"//下班签到时间  hh:mm
-
-            + "startTime  varchar(6),"//上班开始签到时间  hh:mm
-            + "endTime  varchar(6),"//下班开始签到时间    hh:mm
-
-            + "leave INTEGER,"//下班开始签到时间    hh:mm
-
-            + "workAlarm INTEGER,"//上班提醒
-            + "offAlarm INTEGER"//下班提醒
-
-            + ")";
-
-    /**
-     * oa签到时间表
-     */
-    @Deprecated
-    public static final String OA_SIGNIN_TIME = "CREATE TABLE Signin("
-            + "emCode  varchar(10),"//员工编号
-            + "master  varchar(20),"//账套
-
-            + "workTime  varchar(6),"//上班时间  hh:mm
-            + "offTime  varchar(6),"//下班时间   hh:mm
-
-            + "workSignin  varchar(6),"//上班签到时间  hh:mm
-            + "offSignin  varchar(6),"//下班签到时间  hh:mm
-
-            + "startTime  varchar(6),"//上班开始签到时间  hh:mm
-            + "endTime  varchar(6),"//下班开始签到时间     hh:mm
-
-            + "workAlarm ,"//上班提醒
-            + "offAlarm"//下班提醒 boolean
-
-            + ")";
-
-
-    public static final String SUB_MESSAGE = "CREATE TABLE submessage(" +
-            "isRead ," +//员工账套
-            "master  varchar(20)," +//员工账套
-            "emcode  varchar(20)," +//员工编号
-            "id integer," +//Id   连接时候使用
-            "numId integer," +//Id   连接时候使用
-            "instanceId integer," +//Id   连接时候使用
-            "title  varchar(40)," +//主标题
-            "subTitle varchar(40)," +//副标题
-            "status integer," +//状态
-            "date varchar(20)," +//yyyy-mm-dd
-            "createTime" +//创建时间  与date关联
-            ")";
-
-    //所有订阅号表
-    public static final String TABLE_ALL_SUBSCRIPTION = "CREATE TABLE AllSubs "
-            + "(id integer primary key autoincrement,"
-            + "subs_id integer,"
-            + "subs_title varchar(50),"
-            + "subs_kind varchar(50),"
-            + "subs_status integer,"
-            + "subs_type varchar(50),"
-            + "subs_master varchar(50),"
-            + "subs_username varchar(50),"
-            + "subs_removed integer,"
-            + "subs_img BLOB"
-            + ")";
-
-
-    //监控日志表
-    public static final String AUTO_LOG = "CREATE TABLE SignAutoLog ("
-            + "_id INTEGER PRIMARY KEY AUTOINCREMENT, "
-            + "aa_type TEXT, "
-            + "aa_location TEXT, "
-            + "aa_remark TEXT, "
-            + "aa_date TEXT, "
-            + "aa_telephone TEXT, "
-            + "sendstatus TEXT"
-            + ")";
-    //用于创建记步数统计表
-    public static final String CREATE_BANNER = "create table step ("
-            + "_id INTEGER PRIMARY KEY AUTOINCREMENT, "
-            + "curDate TEXT, "
-            + "totalSteps TEXT)";
-
-   /* //运行轨迹,实时定位点记录表
-    public static final String TRACK_POINT = "CREATE TABLE trackPoint ("
-            +"_id INTEGER PRIMARY KEY AUTOINCREMENT,"
-            +"latitude double(13,10)," //纬度
-            +"longitude double(13,10)," //经度
-            +"timestamp varchar(50)," //实时定位时的时间戳
-            +"type varchar(10)," //类型 run、walk
-            +"startTime varchar(50),"  //开始定位后全部默认为开始时间:yyyy-MM-dd HH:mm
-            +"endTime varchar(50)"  //未点击结束前都为空 点击格式:yyyy-MM-dd HH:mm
-            +")";*/
-    //已订阅号表
-    public static final String TABLE_MY_SUBSCRIPTION = "CREATE TABLE MySubs "
-            + "(id integer primary key autoincrement,"
-            + "subs_id integer,"
-            + "subs_title varchar(50),"
-            + "subs_kind varchar(50),"
-            + "subs_type varchar(50),"
-            + "subs_applied integer,"
-            + "subs_master varchar(50),"
-            + "subs_username varchar(50),"
-            + "subs_img BLOB"
-            + ")";
-
-    //消息红点数据表
-    public static final String EM_ERPNEWS = "CREATE TABLE em_erpnews ("
-            + "id integer ,"
-            + "master  varchar(20)," //员工账套
-            + "emcode  varchar(20)," //员工编号
-            + "count integer ,"
-            + "title varchar(20),"//位置
-            + "subTitle varchar(20),"//详细信息
-            + "time varchar(20),"//时间
-            + "type varchar(20),"//类型
-            + "hierarchy integer,"//类型
-            + "readTime integer,"//阅读时间
-            + "isReaded integer"//阅读状态,1阅读
-            + ")";
-    //考勤地址表
-    public static final String WORK_LOCATION = "CREATE TABLE work_location ("
-            + "id integer primary key autoincrement,"
-
-            + "master  varchar(20)," //员工账套
-            + "emcode  varchar(20)," //员工编号
-
-            + "latitude double,"//纬度
-            + "longitude double,"//经度
-            + "shortName varchar(20),"//位置
-            + "workaddr varchar(20),"//地址
-            + "validrange integer,"//打卡距离
-            + "innerdistance integer"//办公范围
-            + ")";
-
-    //外勤计划表
-    public static final String TABLE_MISSION = "CREATE TABLE mission ("
-            + "id integer UNIQUE,"//id  唯一不可重复
-            + "status integer,"//状态  1.结束   2.进行中
-            + "master  varchar(20)," //员工账套
-            + "emcode  varchar(20)," //员工编号
-            + "company varchar(50),"//公司
-            + "companyAddr varchar(50),"//公司地址
-            + "signinNum integer,"//签到次数
-            + "latitude Double,"//纬度
-            + "longitude Double,"//经度
-            + "date varchar(50),"//日期 yyyy-MM-dd
-            + "visittime varchar(50),"//预计到达时间 yyyy-MM-dd HH:mm:ss
-            + "realvisitTime varchar(50),"//实际到达时间yyyy-MM-dd HH:mm:ss
-            + "realLeaveTime varchar(50),"//实际离开时间yyyy-MM-dd HH:mm:ss
-            //update by 2016/12/19
-            + "distance Double,"//距离  米
-            + "type integer,"//距离  米
-            + "remark varchar(50),"//距离  米
-            + "location varchar(50),"//录入位置
-            + "recorddate varchar(50)"//录入时间yyyy-MM-dd HH:mm:ss
-            + ")";
-
-    //数据查询历史记录表
-    public static final String TABLE_HISTORICAL_RECORD = "create table "
-            + DatabaseTables.HistoricalRecordTable.NAME + "("
-            + "_id integer primary key autoincrement, "
-            + DatabaseTables.HistoricalRecordTable.Cols.SCHEME_ID + ", "
-            + DatabaseTables.HistoricalRecordTable.Cols.SCHEME_NAME + ", "
-            + DatabaseTables.HistoricalRecordTable.Cols.SEARCH_FIELD + ")";
-
-    //UU助手
-    public static final String TABLE_UUHELPER_RECORD = "create table "
-            + DatabaseTables.UUHelperTable.NAME + "("
-            + DatabaseTables.UUHelperTable.Cols.ID + " integer primary key autoincrement"
-            + "," + DatabaseTables.UUHelperTable.Cols.USER_ID
-            + "," + DatabaseTables.UUHelperTable.Cols.TIME_SEND
-            + "," + DatabaseTables.UUHelperTable.Cols.DATE
-            + "," + DatabaseTables.UUHelperTable.Cols.IMAGE_URL
-            + "," + DatabaseTables.UUHelperTable.Cols.ICON_URL
-            + "," + DatabaseTables.UUHelperTable.Cols.LINK_URL
-            + "," + DatabaseTables.UUHelperTable.Cols.CONTENT
-            + "," + DatabaseTables.UUHelperTable.Cols.READED
-            + "," + DatabaseTables.UUHelperTable.Cols.TITLE
-            + "," + DatabaseTables.UUHelperTable.Cols.TYPE
-            + ")";
-
-
-    /**
-     * @desc:常量
-     * @author:Administrator on 2016/5/13 10:21
-     */
-    public final static int TYPE_CHAT_MANAGE = 2;
-    public final static int TYPE_CHAT_All = 1;
-
-    /**
-     * @desc:http 请求状态码
-     * @author:Arison on 2016/7/18
-     */
-    public static final int HTTP_SUCCESS_INIT = 1;
-    public final static int APP_SOCKETIMEOUTEXCEPTION = 99;//网络请求超时,错误,404响应
-
-    public final static int LOAD_SUCCESS = 1;
-    public final static int SocketTimeoutException = 0;//ERP登录成功
-    public final static int APP_NOTNETWORK = 111;//网络未连接
-    public final static int SUCCESS_LOGIN = 3;//获取用户开通的平台信息
-    public final static int SUCCESS_B2B = 4;//B2B登录成功
-    public final static int SUCCESS_ERP = 5;//ERP登录成功
-    public final static int SUCCESS_INITDATA = 7;
-    public final static int FIRST_MSG_REQUEST = 17022801;
-
-    //新功能红点
-    public final static String new_dingyue = "dingyue";
-    public final static String new_signin = "signin";
-    public final static String new_signout = "signout";
-    public final static String new_oa = "oa_menu";
-    public final static String new_business = "business";
-    public final static String NEW_SETING = "seting_2";
-    public final static String NEW_UURUN = "NEW_UURUN";
-    public final static String NEW_ME_TAG = "ME_TAG";
-    public final static String SET_SIGN_AUTO = "set_sign_auto";
-    public final static String SET_SIGN_IN = "set_sign_in";
-    public final static String SET_SIGN_LANGUAGE = "set_sign_language";
-    public final static String SET_BOOKING_TIME = "set_booking_time";
-    public final static String SET_BOOKING = "set_booking";
-    public final static String SET_CALL = "set_call";
-
-    public final static String NEW_FUNCTION_NOTICE = "NEWFUNCTIONNOTICE";
-    public final static String NEW_EXPENSE_REIMBURSEMENT_NOTICE = "NEWEXPENSEREIMBURSEMENTNOTICE";
-    public final static String MORE_FUNCTION = "MORE_FUNCTION";
-
-    public final static String SET_UU_NEW = "set_uu_new";
+	public static String IS_NOTIFICATION = "is_notification";//是是否进行通知
+	public static final String BASE_URL_LOGIN = "http://manage.ubtob.com/public/account";
+	public static final String IM_BASE_URL = "http://113.105.74.140:8092/";
+
+	//通讯录表
+	public static final String TABLE_CONTANCTS = "CREATE TABLE  tbl_contacts " +
+			"(id integer primary key autoincrement,"
+			+ "tf_name varchar(50),"
+			+ "tf_whichSys varchar(50),"
+			+ "tf_company varchar(50),"
+			+ "tf_phone varchar(50),"
+			+ "tf_email varchar(50),"
+			+ "tf_type integer,"
+			+ "tf_ownerId varchar(50),"
+			+ "tf_imId varchar(50) default '0')";
+
+	//组织架构 员工信息
+	public static final String SQL_EMPLOYEES_CREATETABLE = "CREATE TABLE EMPLOYEES "
+			+ "(id integer primary key autoincrement,"
+			+ "em_id integer,"
+			+ "em_code varchar(50) NOT NULL UNIQUE,"
+			+ "em_name varchar(50),"
+			+ "em_position varchar(50),"
+			+ "em_jobs varchar(50),"
+			+ "em_defaultorname varchar(50),"
+			+ "em_depart varchar(50),"
+			+ "em_tel varchar(50),"
+			+ "em_imid varchar(50) default '0',"
+			+ "em_mobile varchar(50),"
+			+ "em_email varchar(50),"
+			+ "em_uu varchar(50),"
+			+ "em_imageid integer,"
+			+ "company varchar(100),"
+			+ "whichsys varchar(50),"
+			+ "em_defaultorid integer,"
+			+ "em_flag varchar(50))";
+	//组织架构表
+	public static final String SQL_HRORGS_CREATETABLE = "CREATE TABLE HRORGS "
+			+ "(id integer primary key autoincrement,"
+			+ "or_id integer,"
+			+ "or_code varchar(50) NOT NULL UNIQUE,"
+			+ "or_name varchar(50),"
+			+ "or_subof varchar(50),"
+			+ "or_isleaf varchar(50),"
+			+ "company varchar(100),"
+			+ "whichsys varchar(50),"
+			+ "or_flag varchar(50),"
+			+ "or_headmanname varchar(50),"
+			+ "or_headmancode varchar(50),"
+			+ "or_remark integer" +
+			")";
+	//组织架构 更新时间表
+	public static final String SQL_empdate_CREATETABLE = "CREATE TABLE empdate "
+			+ "(id integer primary key autoincrement,"
+			+ "ed_lastdate varchar(50),"
+			+ "ed_kind varchar(50),"
+			+ "ed_company varchar(50),"
+			+ "ed_whichsys varchar(50)"
+			+ ")";
+	//b2b消息通知表
+	public static final String SQL_B2B_MSG = "CREATE TABLE B2BMSG "
+			+ "(id integer primary key autoincrement,"
+			+ "b2b_content varchar(50),"
+			+ "b2b_time varchar(50),"
+			+ "b2b_hasRead integer,"
+			+ "b2b_master varchar(50)"
+			+ ")";
+
+	//OA内勤签到表
+	public static final String WORKTIBLE = "CREATE TABLE workdata("
+			+ "id integer UNIQUE,"//id  唯一不可重复
+			+ "emCode  varchar(10),"//员工编号
+			+ "master  varchar(20),"//账套
+			+ "date  varchar(20),"//日期  yyyy-MM-dd
+
+			+ "workStart  varchar(6),"//上班开始时间  hh:mm
+			+ "workTime  varchar(6),"//上班时间  hh:mm
+			+ "workend  varchar(6),"//上班结束时间  hh:mm
+			+ "workSignin  varchar(6),"//上班签到  hh:mm
+			+ "workAllegedly  varchar(6),"//上班申诉时间  hh:mm
+			+ "workAlarm INTEGER,"//上班提醒 0|1
+
+			+ "offStart  varchar(6),"//下班开始时间  hh:mm
+			+ "offTime  varchar(6),"//下班时间  hh:mm
+			+ "offend  varchar(6),"//下班结束时间  hh:mm
+			+ "offSignin  varchar(6),"//下班签到  hh:mm
+			+ "offAllegedly  varchar(6),"//下班申诉时间  hh:mm
+			+ "offAlarm INTEGER,"//下班提醒 0|1
+
+			+ "isNextDay INTEGER,"//是否是跨天 0|1
+			+ "leaveAlarm INTEGER"//离开提示次数  0|1
+			+ ")";
+
+
+	//OA内勤签到表
+	public static final String SIGNING = "CREATE TABLE signing("
+			+ "emCode  varchar(10),"//员工编号
+			+ "master  varchar(20),"//账套
+
+			+ "workTime  varchar(6),"//上班时间  hh:mm
+			+ "offTime  varchar(6),"//下班时间   hh:mm
+
+			+ "workSignin  varchar(6),"//上班签到时间 hh:mm
+			+ "offSignin  varchar(6),"//下班签到时间  hh:mm
+
+			+ "startTime  varchar(6),"//上班开始签到时间  hh:mm
+			+ "endTime  varchar(6),"//下班开始签到时间    hh:mm
+
+			+ "leave INTEGER,"//下班开始签到时间    hh:mm
+
+			+ "workAlarm INTEGER,"//上班提醒
+			+ "offAlarm INTEGER"//下班提醒
+
+			+ ")";
+
+	/**
+	 * oa签到时间表
+	 */
+	@Deprecated
+	public static final String OA_SIGNIN_TIME = "CREATE TABLE Signin("
+			+ "emCode  varchar(10),"//员工编号
+			+ "master  varchar(20),"//账套
+
+			+ "workTime  varchar(6),"//上班时间  hh:mm
+			+ "offTime  varchar(6),"//下班时间   hh:mm
+
+			+ "workSignin  varchar(6),"//上班签到时间  hh:mm
+			+ "offSignin  varchar(6),"//下班签到时间  hh:mm
+
+			+ "startTime  varchar(6),"//上班开始签到时间  hh:mm
+			+ "endTime  varchar(6),"//下班开始签到时间     hh:mm
+
+			+ "workAlarm ,"//上班提醒
+			+ "offAlarm"//下班提醒 boolean
+
+			+ ")";
+
+
+	public static final String SUB_MESSAGE = "CREATE TABLE submessage(" +
+			"isRead ," +//员工账套
+			"master  varchar(20)," +//员工账套
+			"emcode  varchar(20)," +//员工编号
+			"id integer," +//Id   连接时候使用
+			"numId integer," +//Id   连接时候使用
+			"instanceId integer," +//Id   连接时候使用
+			"title  varchar(40)," +//主标题
+			"subTitle varchar(40)," +//副标题
+			"status integer," +//状态
+			"date varchar(20)," +//yyyy-mm-dd
+			"createTime" +//创建时间  与date关联
+			")";
+
+	//所有订阅号表
+	public static final String TABLE_ALL_SUBSCRIPTION = "CREATE TABLE AllSubs "
+			+ "(id integer primary key autoincrement,"
+			+ "subs_id integer,"
+			+ "subs_title varchar(50),"
+			+ "subs_kind varchar(50),"
+			+ "subs_status integer,"
+			+ "subs_type varchar(50),"
+			+ "subs_master varchar(50),"
+			+ "subs_username varchar(50),"
+			+ "subs_removed integer,"
+			+ "subs_img BLOB"
+			+ ")";
+
+
+	//监控日志表
+	public static final String AUTO_LOG = "CREATE TABLE SignAutoLog ("
+			+ "_id INTEGER PRIMARY KEY AUTOINCREMENT, "
+			+ "aa_type TEXT, "
+			+ "aa_location TEXT, "
+			+ "aa_remark TEXT, "
+			+ "aa_date TEXT, "
+			+ "aa_telephone TEXT, "
+			+ "sendstatus TEXT"
+			+ ")";
+	//用于创建记步数统计表
+	public static final String CREATE_BANNER = "create table step ("
+			+ "_id INTEGER PRIMARY KEY AUTOINCREMENT, "
+			+ "curDate TEXT, "
+			+ "totalSteps TEXT)";
+
+	/* //运行轨迹,实时定位点记录表
+	 public static final String TRACK_POINT = "CREATE TABLE trackPoint ("
+			 +"_id INTEGER PRIMARY KEY AUTOINCREMENT,"
+			 +"latitude double(13,10)," //纬度
+			 +"longitude double(13,10)," //经度
+			 +"timestamp varchar(50)," //实时定位时的时间戳
+			 +"type varchar(10)," //类型 run、walk
+			 +"startTime varchar(50),"  //开始定位后全部默认为开始时间:yyyy-MM-dd HH:mm
+			 +"endTime varchar(50)"  //未点击结束前都为空 点击格式:yyyy-MM-dd HH:mm
+			 +")";*/
+	//已订阅号表
+	public static final String TABLE_MY_SUBSCRIPTION = "CREATE TABLE MySubs "
+			+ "(id integer primary key autoincrement,"
+			+ "subs_id integer,"
+			+ "subs_title varchar(50),"
+			+ "subs_kind varchar(50),"
+			+ "subs_type varchar(50),"
+			+ "subs_applied integer,"
+			+ "subs_master varchar(50),"
+			+ "subs_username varchar(50),"
+			+ "subs_img BLOB"
+			+ ")";
+
+	//消息红点数据表
+	public static final String EM_ERPNEWS = "CREATE TABLE em_erpnews ("
+			+ "id integer ,"
+			+ "master  varchar(20)," //员工账套
+			+ "emcode  varchar(20)," //员工编号
+			+ "count integer ,"
+			+ "title varchar(20),"//位置
+			+ "subTitle varchar(20),"//详细信息
+			+ "time varchar(20),"//时间
+			+ "type varchar(20),"//类型
+			+ "hierarchy integer,"//类型
+			+ "readTime integer,"//阅读时间
+			+ "isReaded integer"//阅读状态,1阅读
+			+ ")";
+	//考勤地址表
+	public static final String WORK_LOCATION = "CREATE TABLE work_location ("
+			+ "id integer primary key autoincrement,"
+
+			+ "master  varchar(20)," //员工账套
+			+ "emcode  varchar(20)," //员工编号
+
+			+ "latitude double,"//纬度
+			+ "longitude double,"//经度
+			+ "shortName varchar(20),"//位置
+			+ "workaddr varchar(20),"//地址
+			+ "validrange integer,"//打卡距离
+			+ "innerdistance integer"//办公范围
+			+ ")";
+
+	//外勤计划表
+	public static final String TABLE_MISSION = "CREATE TABLE mission ("
+			+ "id integer UNIQUE,"//id  唯一不可重复
+			+ "status integer,"//状态  1.结束   2.进行中
+			+ "master  varchar(20)," //员工账套
+			+ "emcode  varchar(20)," //员工编号
+			+ "company varchar(50),"//公司
+			+ "companyAddr varchar(50),"//公司地址
+			+ "signinNum integer,"//签到次数
+			+ "latitude Double,"//纬度
+			+ "longitude Double,"//经度
+			+ "date varchar(50),"//日期 yyyy-MM-dd
+			+ "visittime varchar(50),"//预计到达时间 yyyy-MM-dd HH:mm:ss
+			+ "realvisitTime varchar(50),"//实际到达时间yyyy-MM-dd HH:mm:ss
+			+ "realLeaveTime varchar(50),"//实际离开时间yyyy-MM-dd HH:mm:ss
+			//update by 2016/12/19
+			+ "distance Double,"//距离  米
+			+ "type integer,"//距离  米
+			+ "remark varchar(50),"//距离  米
+			+ "location varchar(50),"//录入位置
+			+ "recorddate varchar(50)"//录入时间yyyy-MM-dd HH:mm:ss
+			+ ")";
+
+	//数据查询历史记录表
+	public static final String TABLE_HISTORICAL_RECORD = "create table "
+			+ DatabaseTables.HistoricalRecordTable.NAME + "("
+			+ "_id integer primary key autoincrement, "
+			+ DatabaseTables.HistoricalRecordTable.Cols.SCHEME_ID + ", "
+			+ DatabaseTables.HistoricalRecordTable.Cols.SCHEME_NAME + ", "
+			+ DatabaseTables.HistoricalRecordTable.Cols.SEARCH_FIELD + ")";
+
+	//UU助手
+	public static final String TABLE_UUHELPER_RECORD = "create table "
+			+ DatabaseTables.UUHelperTable.NAME + "("
+			+ DatabaseTables.UUHelperTable.Cols.ID + " integer primary key autoincrement"
+			+ "," + DatabaseTables.UUHelperTable.Cols.USER_ID
+			+ "," + DatabaseTables.UUHelperTable.Cols.TIME_SEND
+			+ "," + DatabaseTables.UUHelperTable.Cols.DATE
+			+ "," + DatabaseTables.UUHelperTable.Cols.IMAGE_URL
+			+ "," + DatabaseTables.UUHelperTable.Cols.ICON_URL
+			+ "," + DatabaseTables.UUHelperTable.Cols.LINK_URL
+			+ "," + DatabaseTables.UUHelperTable.Cols.CONTENT
+			+ "," + DatabaseTables.UUHelperTable.Cols.READED
+			+ "," + DatabaseTables.UUHelperTable.Cols.TITLE
+			+ "," + DatabaseTables.UUHelperTable.Cols.TYPE
+			+ ")";
+
+
+	/**
+	 * @desc:常量
+	 * @author:Administrator on 2016/5/13 10:21
+	 */
+	public final static int TYPE_CHAT_MANAGE = 2;
+	public final static int TYPE_CHAT_All = 1;
+
+	/**
+	 * @desc:http 请求状态码
+	 * @author:Arison on 2016/7/18
+	 */
+	public static final int HTTP_SUCCESS_INIT = 1;
+	public final static int APP_SOCKETIMEOUTEXCEPTION = 99;//网络请求超时,错误,404响应
+
+	public final static int LOAD_SUCCESS = 1;
+	public final static int SocketTimeoutException = 0;//ERP登录成功
+	public final static int APP_NOTNETWORK = 111;//网络未连接
+	public final static int SUCCESS_LOGIN = 3;//获取用户开通的平台信息
+	public final static int SUCCESS_B2B = 4;//B2B登录成功
+	public final static int SUCCESS_ERP = 5;//ERP登录成功
+	public final static int SUCCESS_INITDATA = 7;
+	public final static int FIRST_MSG_REQUEST = 17022801;
+
+	//新功能红点
+	public final static String new_dingyue = "dingyue";
+	public final static String new_signin = "signin";
+	public final static String new_signout = "signout";
+	public final static String new_oa = "oa_menu";
+	public final static String new_business = "business";
+	public final static String NEW_SETING = "seting_2";
+	public final static String NEW_UURUN = "NEW_UURUN";
+	public final static String NEW_ME_TAG = "ME_TAG";
+	public final static String SET_SIGN_AUTO = "set_sign_auto";
+	public final static String SET_SIGN_IN = "set_sign_in";
+	public final static String SET_SIGN_LANGUAGE = "set_sign_language";
+	public final static String SET_BOOKING_TIME = "set_booking_time";
+	public final static String SET_BOOKING = "set_booking";
+	public final static String SET_CALL = "set_call";
+
+	public final static String NEW_FUNCTION_NOTICE = "NEWFUNCTIONNOTICE";
+	public final static String NEW_EXPENSE_REIMBURSEMENT_NOTICE = "NEWEXPENSEREIMBURSEMENTNOTICE";
+	public final static String MORE_FUNCTION = "MORE_FUNCTION";
+
+	public final static String SET_UU_NEW = "set_uu_new";
 
 //    public static void cleanRed(Context ct) throws PackageManager.NameNotFoundException {
 //        int versionCode = PreferenceUtils.getInt("versionCode", 0);
@@ -347,28 +347,32 @@ public class Constants {
 //        }
 //    }
 
-    public static String INSTANT_MESSAGE = "instant_message";//转发消息的标记
-    public static String INSTANT_MESSAGE_FILE = "instant_message_file";//转发文件稍有不同
-    public static String INSTANT_SEND = "instant_send";//转发
-    public static String CHAT_MESSAGE_DELETE_ACTION = "chat_message_delete";
-    public static String CHAT_MESSAGE_DELETE_FRIENDID = "chat_message_delete_friendid";//删除消息要带过去的朋友id
-    public static String CHAT_REMOVE_MESSAGE_FALG = "CHAT_REMOVE_MESSAGE_FALG";
-    public static String CHAT_REMOVE_MESSAGE_POSITION = "CHAT_REMOVE_MESSAGE_POSITION";
-    public static String ONRECORDSTART = "onrecordstart";
-    public static String GROUP_JOIN_NOTICE = "group_join_notice";//加入新群的通知
+	public static String INSTANT_MESSAGE = "instant_message";//转发消息的标记
+	public static String INSTANT_MESSAGE_FILE = "instant_message_file";//转发文件稍有不同
+	public static String INSTANT_SEND = "instant_send";//转发
+	public static String CHAT_MESSAGE_DELETE_ACTION = "chat_message_delete";
+	public static String CHAT_MESSAGE_DELETE_FRIENDID = "chat_message_delete_friendid";//删除消息要带过去的朋友id
+	public static String CHAT_REMOVE_MESSAGE_FALG = "CHAT_REMOVE_MESSAGE_FALG";
+	public static String CHAT_REMOVE_MESSAGE_POSITION = "CHAT_REMOVE_MESSAGE_POSITION";
+	public static String ONRECORDSTART = "onrecordstart";
+	public static String GROUP_JOIN_NOTICE = "group_join_notice";//加入新群的通知
 
 
-    public static String GROUP_JOIN_NOTICE_ACTION = "group_join_notice_action";//加入新群的通知
-    public static String GROUP_JOIN_NOTICE_FRIEND_ID = "group_join_notice_friend_id";//加入新群发送朋友的id
+	public static String GROUP_JOIN_NOTICE_ACTION = "group_join_notice_action";//加入新群的通知
+	public static String GROUP_JOIN_NOTICE_FRIEND_ID = "group_join_notice_friend_id";//加入新群发送朋友的id
 
-    public static String OFFLINE_TIME = "offline_time";//离线时间
-    public static String LAST_OFFLINE_TIME = "last_offline_time";
+	public static String OFFLINE_TIME = "offline_time";//离线时间
+	public static String LAST_OFFLINE_TIME = "last_offline_time";
 
 
-    public static String AUDIO_PHONENUMBER = "audio_phonenumber";//语音
-    public static String IS_AUDIO_OR_VIDEO = "is_audio_or_video";//是语音还是视频
+	public static String AUDIO_PHONENUMBER = "audio_phonenumber";//语音
+	public static String IS_AUDIO_OR_VIDEO = "is_audio_or_video";//是语音还是视频
 
 
-    public final static int REQUEST_MANAGE_ALL_SUBSCRIPTON = 101;
-    public final static int RESULT_MANAGE_ALL_SUBSCRIPTION = 102;
+	public final static int REQUEST_MANAGE_ALL_SUBSCRIPTON = 101;
+	public final static int RESULT_MANAGE_ALL_SUBSCRIPTION = 102;
+
+
+	public static final String ACTION_LOCATION_CHANGE = "action_location_Change";//位置改变发送广播
+	public static final String ACTION_WORK_SIGNIN = "action_work_signin";//当时间合理的时候回调计算内勤打卡
 }

+ 210 - 211
app_core/common/src/main/java/com/core/net/location/BdLocationHelper.java

@@ -4,228 +4,227 @@ import android.content.Context;
 import android.content.Intent;
 import android.support.v4.content.LocalBroadcastManager;
 
+import com.alibaba.fastjson.JSON;
 import com.baidu.location.BDLocation;
 import com.baidu.location.BDLocationListener;
 import com.baidu.location.LocationClient;
 import com.baidu.location.LocationClientOption;
 import com.baidu.mapapi.model.LatLng;
 import com.common.LogUtil;
+import com.common.config.BaseConfig;
 import com.common.data.StringUtil;
 import com.common.preferences.PreferenceUtils;
-import com.core.app.MyApplication;
+import com.core.app.Constants;
 
 public class BdLocationHelper {
-    public static final String UPLOCATION_ACTION = "UPLOCATION_ACTION";//更新位置时候广播数据
-
-    private boolean locationOk;//是否定位成功
-    private LatLng latLng;
-    private String location;//位置信息
-    private String address;//详细地址
-    private String province;// 省份
-    private String cityName;// 城市
-    private String district;// 街道
-    private String errorMessage;//定位错误信息
-
-    private final Intent broadcast = new Intent(UPLOCATION_ACTION);//更新后广播
-    private LocationClient mLocationClient = null;
-    private int mFaildCount = 0;//失败次数
-
-    public BdLocationHelper(Context ct) {
-        initLocation(ct);
-    }
-
-    private void initLocation(Context ct) {
-        mLocationClient = new LocationClient(ct); // 声明LocationClient类
-        mLocationClient.registerLocationListener(mLocationListener); // 注册监听函数
-        mLocationClient.setLocOption(getOptionByGPS());
+	public final int SCAN_SPAN = 0;//0表示只执行一次( 单位:ms)
+
+	private boolean locationOk;//是否定位成功
+	private LatLng latLng;
+	private String location;//位置信息
+	private String address;//详细地址
+	private String province;// 省份
+	private String cityName;// 城市
+	private String district;// 街道
+	private String errorMessage;//定位错误信息
+
+	private final Intent broadcast = new Intent(Constants.ACTION_LOCATION_CHANGE);//更新后广播
+	private LocationClient mLocationClient = null;
+	private int mFaildCount = 0;//失败次数
+
+	public BdLocationHelper(Context ct) {
+		initLocation(ct);
+	}
+
+	private void initLocation(Context ct) {
+		mLocationClient = new LocationClient(ct); // 声明LocationClient类
+		mLocationClient.registerLocationListener(mLocationListener); // 注册监听函数
+		mLocationClient.setLocOption(getOptionNotGPS());
 //        requestLocation();
-    }
-
-    /**
-     * 获取配置
-     *
-     * @return
-     */
-    private LocationClientOption getOptionByGPS() {
-        LocationClientOption option = new LocationClientOption();
-        option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);//可选,默认高精度,设置定位模式,高精度,低功耗,仅设备
-        option.setCoorType("bd09ll");//可选,默认gcj02,设置返回的定位结果坐标系
-        option.setScanSpan(20 * 1000);//可选,默认0,即仅定位一次,设置发起定位请求的间隔需要大于等于1000ms才是有效的
-        option.setIsNeedAddress(true);//可选,设置是否需要地址信息,默认不需要
-        option.setOpenGps(true);//可选,默认false,设置是否使用gps
-        option.setLocationNotify(false);//可选,默认false,设置是否当GPS有效时按照1S/1次频率输出GPS结果
-        option.setIsNeedLocationDescribe(true);//可选,默认false,设置是否需要位置语义化结果,可以在BDLocation.getLocationDescribe里得到,结果类似于“在北京天安门附近”
-        option.setIsNeedLocationPoiList(false);//可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到
-        option.setIgnoreKillProcess(false);//可选,默认true,定位SDK内部是一个SERVICE,并放到了独立进程,设置是否在stop的时候杀死这个进程,默认不杀死
-        option.SetIgnoreCacheException(false);//可选,默认false,设置是否收集CRASH信息,默认收集
-        option.setEnableSimulateGps(true);//可选,默认false,设置是否需要过滤GPS仿真结果,默认需要
-        option.setNeedDeviceDirect(false);
-        return option;
-    }
-
-    /**
-     * 获取配置
-     *
-     * @return
-     */
-    private LocationClientOption getOptionNotGPS() {
-        LocationClientOption option = getOptionByGPS();
-        option.setOpenGps(false);
-        return option;
-    }
-
-
-    /**
-     * 关闭定位
-     **/
-    public void release() {
-        if (mLocationClient.isStarted()) {
-            mLocationClient.stop();
-        }
-    }
-
-
-    /**
-     * 重新定位
-     **/
-    public void requestLocation() {
-        if (mLocationClient == null) return;
-        if (!mLocationClient.isStarted()) {
-            mFaildCount = 0;
-            mLocationClient.start();
-        } else {
-            mLocationClient.requestLocation();
-        }
-    }
-
-
-    private BDLocationListener mLocationListener = new BDLocationListener() {
-        @Override
-        public void onReceiveLocation(BDLocation location) {
-            try {
-                setLocation(location);
-            } catch (Exception e) {
-                if (e != null)
-                    log("onReceiveLocation Exception" + e.getMessage());
-                clearLocation();
-            }
-        }
-    };
-
-
-    private void setLocation(BDLocation location) throws Exception {
-        if (location.getLocType() == BDLocation.TypeGpsLocation// GPS定位结果
-                || location.getLocType() == BDLocation.TypeNetWorkLocation//网络定位
-                || location.getLocType() == BDLocation.TypeOffLineLocation//离线定位(未验证离线定位的有效性)
-                ) {
-            //定位成功
-            locationOk = true;
-            latLng = new LatLng(location.getLatitude(), location.getLongitude());
-            this.location = location.getLocationDescribe();
-            province = location.getProvince();
-            cityName = location.getCity();
-            district = location.getDistrict();
-            address = location.getAddrStr();
-            if (!StringUtil.isEmpty(this.location))
-                PreferenceUtils.putString("bdlocation", this.location);
-            if (!StringUtil.isEmpty(address))
-                PreferenceUtils.putString("bdaddress", address);
-            errorMessage = "";
-        } else {
-            //统一为定位失败
-            locationOk = false;
-            log("定位失败");
-            if (location.getLocType() == BDLocation.TypeServerError) {
-                //服务端网络定位失败,可以反馈IMEI号和大体定位时间到loc-bugs@baidu.com,会有人追查原因
-                errorMessage = "服务端网络定位失败";
-                log("服务端网络定位失败");
-            } else if (location.getLocType() == BDLocation.TypeNetWorkException) {
-                //网络不同导致定位失败,请检查网络是否通畅
-                errorMessage = "网络不同导致定位失败,请检查网络是否通畅";
-                log("网络不同导致定位失败,请检查网络是否通畅");
-            } else if (location.getLocType() == BDLocation.TypeCriteriaException) {
-                //无法获取有效定位依据导致定位失败,一般是由于手机的原因,处于飞行模式下一般会造成这种结果,可以试着重启手机
-                errorMessage = "无法获取有效定位依据导致定位失败";
-                log("无法获取有效定位依据导致定位失败");
-            } else {
-                errorMessage = "未知错误";
-                log("未知错误");
-            }
-            if (mFaildCount < 3) {
-                mFaildCount++;
-                requestLocation();
-                return;
-            }
-        }
-        //发送广播
-        broadcast.putExtra(UPLOCATION_ACTION, locationOk);
-        LocalBroadcastManager.getInstance(MyApplication.getInstance()).sendBroadcast(broadcast);
-    }
-
-    private void log(String message) {
-        LogUtil.i(message);
-    }
-
-
-    public String getName() {
-        return StringUtil.isEmpty(location) ? "" : location;
-    }
-
-
-    // 获取经纬度
-    public double getLongitude() {
-        return latLng == null ? 1 : latLng.longitude;
-    }
-
-    // 获取经纬度
-    public double getLatitude() {
-        return latLng == null ? 1 : latLng.latitude;
-    }
-
-    // 获取地址详情
-    public String getAddress() {
-        return StringUtil.isEmpty(address) ? PreferenceUtils.getString("bdaddress") : address;
-    }
-
-
-    public String getProvinceName() {
-        return province;
-    }
-
-    public LatLng getLocation() {
-        return latLng;
-    }
-
-    public String getCityName() {
-        return cityName;
-    }
-
-    public String getDistrictName() {
-        return district;
-    }
-
-    public boolean locationOk() {
-        return locationOk;
-    }
-
-    public String getErrorMessage() {
-        return errorMessage;
-    }
-
-    public boolean isLocationUpdate() {
-        return true;
-    }
-
-    private void clearLocation() {
-        locationOk = false;
-        latLng = null;
-        location = null;
-        address = null;
-        province = null;
-        cityName = null;
-        district = null;
-        errorMessage = null;
-    }
+	}
+
+	/**
+	 * 获取配置
+	 *
+	 * @return
+	 */
+	private LocationClientOption getOptionByGPS() {
+		LocationClientOption option = new LocationClientOption();
+		option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);//可选,默认高精度,设置定位模式,高精度,低功耗,仅设备
+		option.setCoorType("bd09ll");//可选,默认gcj02,设置返回的定位结果坐标系
+		option.setScanSpan(SCAN_SPAN);//可选,默认0,即仅定位一次,设置发起定位请求的间隔需要大于等于1000ms才是有效的
+		option.setIsNeedAddress(true);//可选,设置是否需要地址信息,默认不需要
+		option.setOpenGps(true);//可选,默认false,设置是否使用gps
+		option.setLocationNotify(false);//可选,默认false,设置是否当GPS有效时按照1S/1次频率输出GPS结果
+		option.setIsNeedLocationDescribe(true);//可选,默认false,设置是否需要位置语义化结果,可以在BDLocation.getLocationDescribe里得到,结果类似于“在北京天安门附近”
+		option.setIsNeedLocationPoiList(false);//可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到
+		option.setIgnoreKillProcess(false);//可选,默认true,定位SDK内部是一个SERVICE,并放到了独立进程,设置是否在stop的时候杀死这个进程,默认不杀死
+		option.SetIgnoreCacheException(false);//可选,默认false,设置是否收集CRASH信息,默认收集
+		option.setEnableSimulateGps(true);//可选,默认false,设置是否需要过滤GPS仿真结果,默认需要
+		option.setNeedDeviceDirect(false);
+		return option;
+	}
+
+	/**
+	 * 获取配置
+	 *
+	 * @return
+	 */
+	private LocationClientOption getOptionNotGPS() {
+		LocationClientOption option = getOptionByGPS();
+		option.setOpenGps(false);
+		return option;
+	}
+
+
+	/**
+	 * 关闭定位
+	 **/
+	public void release() {
+		if (mLocationClient.isStarted()) {
+			mLocationClient.stop();
+		}
+	}
+
+
+	/**
+	 * 重新定位
+	 **/
+	public void requestLocation() {
+		if (mLocationClient == null) return;
+		if (!mLocationClient.isStarted()) {
+			mFaildCount = 0;
+			mLocationClient.start();
+		} else {
+			mLocationClient.requestLocation();
+		}
+	}
+
+
+	private BDLocationListener mLocationListener = new BDLocationListener() {
+		@Override
+		public void onReceiveLocation(BDLocation location) {
+			try {
+				setLocation(location);
+			} catch (Exception e) {
+				if (e != null)
+					LogUtil.i("onReceiveLocation Exception" + e.getMessage());
+				clearLocation();
+			}
+		}
+	};
+
+
+	private void setLocation(BDLocation location) throws Exception {
+		if (location.getLocType() == BDLocation.TypeGpsLocation// GPS定位结果
+				|| location.getLocType() == BDLocation.TypeNetWorkLocation//网络定位
+				|| location.getLocType() == BDLocation.TypeOffLineLocation//离线定位(未验证离线定位的有效性)
+				) {
+			//定位成功
+			locationOk = true;
+			latLng = new LatLng(location.getLatitude(), location.getLongitude());
+			this.location = location.getLocationDescribe();
+			province = location.getProvince();
+			cityName = location.getCity();
+			district = location.getDistrict();
+			address = location.getAddrStr();
+			if (!StringUtil.isEmpty(this.location))
+				PreferenceUtils.putString("bdlocation", this.location);
+			if (!StringUtil.isEmpty(address))
+				PreferenceUtils.putString("bdaddress", address);
+			errorMessage = "";
+			LogUtil.i(JSON.toJSONString(this));
+			//发送广播
+			broadcast.putExtra(Constants.ACTION_LOCATION_CHANGE, locationOk);
+			LocalBroadcastManager.getInstance(BaseConfig.getContext()).sendBroadcast(broadcast);
+		} else {
+			//统一为定位失败
+			locationOk = false;
+			LogUtil.i("定位失败");
+			if (location.getLocType() == BDLocation.TypeServerError) {
+				//服务端网络定位失败,可以反馈IMEI号和大体定位时间到loc-bugs@baidu.com,会有人追查原因
+				errorMessage = "服务端网络定位失败";
+				LogUtil.i("服务端网络定位失败");
+			} else if (location.getLocType() == BDLocation.TypeNetWorkException) {
+				//网络不同导致定位失败,请检查网络是否通畅
+				errorMessage = "网络不同导致定位失败,请检查网络是否通畅";
+				LogUtil.i("网络不同导致定位失败,请检查网络是否通畅");
+			} else if (location.getLocType() == BDLocation.TypeCriteriaException) {
+				//无法获取有效定位依据导致定位失败,一般是由于手机的原因,处于飞行模式下一般会造成这种结果,可以试着重启手机
+				errorMessage = "无法获取有效定位依据导致定位失败";
+				LogUtil.i("无法获取有效定位依据导致定位失败");
+			} else {
+				errorMessage = "未知错误";
+				LogUtil.i("未知错误");
+			}
+			if (mFaildCount < 3) {
+				mFaildCount++;
+				requestLocation();
+				return;
+			}
+		}
+	}
+
+
+	public String getName() {
+		return StringUtil.isEmpty(location) ? "" : location;
+	}
+
+
+	// 获取经纬度
+	public double getLongitude() {
+		return latLng == null ? 1 : latLng.longitude;
+	}
+
+	// 获取经纬度
+	public double getLatitude() {
+		return latLng == null ? 1 : latLng.latitude;
+	}
+
+	// 获取地址详情
+	public String getAddress() {
+		return StringUtil.isEmpty(address) ? PreferenceUtils.getString("bdaddress") : address;
+	}
+
+
+	public String getProvinceName() {
+		return province;
+	}
+
+	public LatLng getLocation() {
+		return latLng;
+	}
+
+	public String getCityName() {
+		return cityName;
+	}
+
+	public String getDistrictName() {
+		return district;
+	}
+
+	public boolean locationOk() {
+		return locationOk;
+	}
+
+	public String getErrorMessage() {
+		return errorMessage;
+	}
+
+	public boolean isLocationUpdate() {
+		return true;
+	}
+
+	private void clearLocation() {
+		locationOk = false;
+		latLng = null;
+		location = null;
+		address = null;
+		province = null;
+		cityName = null;
+		district = null;
+		errorMessage = null;
+	}
 
 }
 

+ 0 - 57
app_core/common/src/main/java/com/core/net/smart/Success.java

@@ -1,57 +0,0 @@
-package com.core.net.smart;
-
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-
-/**
- * Created by Bitliker on 2017/6/14.
- */
-
-public class Success extends Result {
-
-
-    public Success(Result result) {
-        super(result);
-    }
-
-
-    public JSONObject getJsonObject() {
-        if (isJSON())
-            return JSON.parseObject(message);
-        else return new JSONObject();
-    }
-
-    public JSONObject getJsonObject(String... keys) {
-        if (isJSON()) {
-            JSONObject object = JSON.parseObject(message);
-            if (object != null && keys != null && keys.length > 0) {
-                for (String key : keys) {
-                    if (object.containsKey(key) && object.get(key) instanceof JSONObject) {
-                        return object.getJSONObject(key);
-                    }
-                }
-            }
-        }
-        return new JSONObject();
-    }
-
-    public JSONArray getJSONArray() {
-        if (isJSON())
-            return JSON.parseArray(message);
-        else return new JSONArray();
-    }
-
-    public JSONArray getJSONArray(String key) {
-        if (isJSON()) {
-            try {
-                return JSON.parseObject(message).getJSONArray(key);
-            } catch (Exception e) {
-                return new JSONArray();
-            }
-        } return new JSONArray();
-    }
-
-
-}

+ 1 - 1
app_core/network/build.gradle

@@ -32,5 +32,5 @@ dependencies {
     compile deps.converterGson
     compile deps.adapterRxjava
     compile deps.fastjson
-
+    compile project(':common')
 }

+ 1 - 1
app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/MessagePresenter.java

@@ -858,7 +858,7 @@ public class MessagePresenter implements OnHttpResultListener {
      * @param mContext
      * @param position
      */
-    public void turn2NextAct(Activity mContext, int position) {
+    public void turn2NextAct(Activity mContext, int position) throws Exception {
         Friend friend = mFriendList.get(position).getBean();
         if (friend == null) {
             return;

+ 1 - 2
app_modular/apptasks/build.gradle

@@ -22,6 +22,5 @@ dependencies {
     compile fileTree(include: ['*.jar'], dir: 'libs')
     testCompile deps.junit
     compile deps.appcompatV7
-    compile project(':common')
-    compile project(':network')
+    compile project(':apputils')
 }

+ 15 - 9
app_modular/apptasks/src/main/AndroidManifest.xml

@@ -1,13 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          package="com.modular.apptasks">
 
-          package="com.modular.apptasks"
->
-
-    <application android:allowBackup="true"
-                 android:label="@string/app_name"
-                 android:supportsRtl="true"
-    >
-
+    <application
+        android:allowBackup="true"
+        android:label="@string/app_name"
+        android:supportsRtl="true">
+        <receiver
+            android:name=".service.AutoTaskReceiver"
+            android:enabled="true"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="action_location_Change"/>
+            </intent-filter>
+        </receiver>
     </application>
 
-</manifest>
+</manifest>

+ 31 - 3
app_modular/apptasks/src/main/java/com/modular/apptasks/AutoTasks.java

@@ -1,12 +1,18 @@
 package com.modular.apptasks;
 
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+
+import com.core.utils.CommonInterface;
+import com.modular.apptasks.service.AutoTaskHttp;
+
 /**
  * Created by Bitliker on 2017/9/29.
  */
 
 public class AutoTasks {
 	private static AutoTasks instance;
-
+	private AutoTaskHttp taskHttp;
 	public static AutoTasks getInstance() {
 		AutoTasks inst = instance;
 		if (inst == null) {
@@ -25,9 +31,31 @@ public class AutoTasks {
 
 	}
 
+	//初始化时候
+	public void initTask() {
+		initMission();
+	}
 
+	/**
+	 * 初始化外勤
+	 * 1.先获取网络的外勤,获取到网络的外勤数据以后在保存到数据库
+	 */
+	private void initMission() {
+		CommonInterface.getInstance().getOutSetInfo(new CommonInterface.OnResultListener() {
+			@Override
+			public void result(@NonNull boolean success, @NonNull int what, @Nullable String message) {
+				if (success){
+					getTaskHttp().loadMissionPlan();
+				}
+			}
+		});
+	}
 
 
-
-
+	public AutoTaskHttp getTaskHttp() {
+		if (taskHttp==null){
+			taskHttp=new AutoTaskHttp();
+		}
+		return taskHttp;
+	}
 }

+ 81 - 0
app_modular/apptasks/src/main/java/com/modular/apptasks/service/AutoTaskHttp.java

@@ -0,0 +1,81 @@
+package com.modular.apptasks.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.common.LogUtil;
+import com.core.model.MissionModel;
+import com.core.utils.CommonUtil;
+import com.modular.apputils.listener.OnSmartHttpListener;
+import com.modular.apputils.network.Failure;
+import com.modular.apputils.network.Parameter;
+import com.modular.apputils.network.SmartHttpClient;
+import com.modular.apputils.network.Success;
+
+import java.util.List;
+
+import rx.Observable;
+import rx.Subscriber;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.functions.Action1;
+import rx.schedulers.Schedulers;
+
+/**
+ * Created by Bitliker on 2017/9/29.
+ */
+
+public class AutoTaskHttp implements OnSmartHttpListener {
+	private final int LOAD_PLAN = 21;//获取外勤计划
+	private final int SIGNIN_MISSION = 22;//外勤签到
+	private final int HAVE_OUT_PLAN = 23;//还有未拜访外勤计划
+
+
+	//获取外勤计划列表
+	public void loadMissionPlan() {
+		Parameter paramenter = new Parameter.Builder()
+				.setAction("mobile/mobileoutplan.action")
+				.add("emcode", CommonUtil.getEmcode())
+				.record(LOAD_PLAN)
+				.build();
+		SmartHttpClient.api().get(paramenter, this);
+	}
+
+	@Override
+	public void onSuccess(Success success) {
+		switch (success.getRecord()) {
+			case LOAD_PLAN:
+				handlerData(success.getJSONArray("data", "success"));
+				break;
+			case SIGNIN_MISSION:
+				break;
+			case HAVE_OUT_PLAN:
+				break;
+		}
+
+	}
+
+	@Override
+	public void onFailure(Failure failure) {
+		LogUtil.i(failure.getMessage());
+	}
+
+
+	private void handlerData(final JSONArray array) {
+		Observable.create(new Observable.OnSubscribe<List<MissionModel>>() {
+			@Override
+			public void call(Subscriber<? super List<MissionModel>> subscriber) {
+
+
+			}
+		}).observeOn(Schedulers.newThread())
+				.subscribeOn(AndroidSchedulers.mainThread())
+				.subscribe(new Action1<List<MissionModel>>() {
+					@Override
+					public void call(List<MissionModel> missionModel) {
+
+					}
+				});
+
+
+	}
+
+}
+

+ 32 - 0
app_modular/apptasks/src/main/java/com/modular/apptasks/service/AutoTaskReceiver.java

@@ -0,0 +1,32 @@
+package com.modular.apptasks.service;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import com.common.LogUtil;
+import com.core.app.Constants;
+import com.core.app.MyApplication;
+
+public class AutoTaskReceiver extends BroadcastReceiver {
+
+	@Override
+	public void onReceive(Context context, Intent intent) {
+		if (intent != null) {
+			String action = intent.getAction();
+			if (action != null && action.length() > 0) {
+				switch (action) {
+					case Constants.ACTION_LOCATION_CHANGE:
+						LogUtil.i("定位成功广播回调");
+						break;
+					case Constants.ACTION_WORK_SIGNIN:
+						MyApplication.getInstance().getBdLocationHelper().requestLocation();
+						LogUtil.i("当时间合理时候回调到计算打卡允许");
+
+						break;
+
+				}
+			}
+		}
+	}
+}

+ 62 - 0
app_modular/apptasks/src/main/java/com/modular/apptasks/util/AlarmUtil.java

@@ -0,0 +1,62 @@
+package com.modular.apptasks.util;
+
+import android.app.AlarmManager;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Build;
+
+import com.common.LogUtil;
+import com.common.config.BaseConfig;
+import com.common.data.DateFormatUtil;
+import com.modular.apptasks.service.AutoTaskReceiver;
+
+/**
+ * AlarmManager.ELAPSED_REALTIME 表示闹钟在手机睡眠状态下不可用,该状态下闹钟使用相对时间(相对于系统启动开始),状态值为3;
+ * AlarmManager.ELAPSED_REALTIME_WAKEUP 表示闹钟在睡眠状态下会唤醒系统并执行提示功能,该状态下闹钟也使用相对时间,状态值为2;
+ * AlarmManager.RTC 表示闹钟在睡眠状态下不可用,该状态下闹钟使用绝对时间,即当前系统时间,状态值为1;
+ * AlarmManager.RTC_WAKEUP 表示闹钟在睡眠状态下会唤醒系统并执行提示功能,该状态下闹钟使用绝对时间,状态值为0;
+ * AlarmManager.POWER_OFF_WAKEUP 表示闹钟在手机关机状态下也能正常进行提示功能,所以是5个状态中用的最多的状态之一,该状态下闹钟也是用绝对时间,状态值为4;不过本状态好像受SDK版本影响,某些版本并不支持;
+ * Created by Bitliker on 2017/8/7.
+ */
+
+public class AlarmUtil {
+
+
+	/**
+	 * 使用闹钟模式开启定时任务,定时回调
+	 *
+	 * @param id                  用于标识,取消
+	 * @param action              开启任务后回调的action
+	 * @param nextAlarmTimeMillis 下一次回调任务的时间
+	 */
+	public static void startAlarm(int id, String action, long nextAlarmTimeMillis) {
+		if (nextAlarmTimeMillis < System.currentTimeMillis() || action == null || action.length() <= 0) {
+			return;
+		}
+		LogUtil.i("nextAlarmTimeMillis=" + DateFormatUtil.long2Str(nextAlarmTimeMillis, DateFormatUtil.YMD_HMS));
+		LogUtil.i("action=" + action);
+		AlarmManager manager = (AlarmManager) BaseConfig.getContext().getSystemService(Context.ALARM_SERVICE);
+		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+			manager.setExact(AlarmManager.RTC_WAKEUP
+					, nextAlarmTimeMillis
+					, getPendingIntent(id, action));
+		} else {
+			manager.set(AlarmManager.RTC_WAKEUP
+					, nextAlarmTimeMillis
+					, getPendingIntent(id, action));
+		}
+	}
+
+	public static void cancelAlarm(int id, String action) {
+		LogUtil.i("cancelAlarm");
+		AlarmManager manager = (AlarmManager) BaseConfig.getContext().getSystemService(Context.ALARM_SERVICE);
+		manager.cancel(getPendingIntent(id, action));
+	}
+
+	private static PendingIntent getPendingIntent(int id, String action) {
+		Intent intent = new Intent(BaseConfig.getContext(), AutoTaskReceiver.class);
+		intent.setAction(action);
+		return PendingIntent.getBroadcast(BaseConfig.getContext(), id, intent, PendingIntent.FLAG_UPDATE_CURRENT);
+	}
+}

+ 0 - 1
app_modular/apptasks/src/main/res/values/strings.xml

@@ -1,3 +1,2 @@
 <resources>
-    <string name="app_name">AppTasks</string>
 </resources>

+ 1 - 0
app_modular/apputils/.gitignore

@@ -0,0 +1 @@
+/build

+ 27 - 0
app_modular/apputils/build.gradle

@@ -0,0 +1,27 @@
+apply plugin: 'com.android.library'
+
+
+android {
+    compileSdkVersion rootProject.ext.android.compileSdkVersion
+    buildToolsVersion rootProject.ext.android.buildToolsVersion
+    defaultConfig {
+        minSdkVersion rootProject.ext.android.minSdkVersion
+        targetSdkVersion rootProject.ext.android.targetSdkVersion
+        versionCode rootProject.ext.android.versionCode
+        versionName rootProject.ext.android.versionName
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+}
+
+dependencies {
+    compile fileTree(include: ['*.jar'], dir: 'libs')
+    testCompile deps.junit
+    compile deps.appcompatV7
+    compile project(':common')
+    compile project(':network')
+}

+ 25 - 0
app_modular/apputils/proguard-rules.pro

@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\Bitliker\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile

+ 13 - 0
app_modular/apputils/src/main/AndroidManifest.xml

@@ -0,0 +1,13 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+
+          package="com.modular.apputils"
+>
+
+    <application android:allowBackup="true"
+                 android:label="@string/app_name"
+                 android:supportsRtl="true"
+    >
+
+    </application>
+
+</manifest>

+ 4 - 3
app_core/common/src/main/java/com/core/net/listener/OnSmartHttpListener.java → app_modular/apputils/src/main/java/com/modular/apputils/listener/OnSmartHttpListener.java

@@ -1,7 +1,8 @@
-package com.core.net.listener;
+package com.modular.apputils.listener;
 
-import com.core.net.smart.Failure;
-import com.core.net.smart.Success;
+
+import com.modular.apputils.network.Failure;
+import com.modular.apputils.network.Success;
 
 /**
  * Created by Bitliker on 2017/9/29.

+ 1 - 2
app_core/common/src/main/java/com/core/net/smart/Failure.java → app_modular/apputils/src/main/java/com/modular/apputils/network/Failure.java

@@ -1,5 +1,4 @@
-package com.core.net.smart;
-
+package com.modular.apputils.network;
 
 import com.common.data.JSONUtil;
 import com.common.data.StringUtil;

+ 1 - 7
app_core/common/src/main/java/com/core/net/smart/Parameter.java → app_modular/apputils/src/main/java/com/modular/apputils/network/Parameter.java

@@ -1,12 +1,6 @@
-package com.core.net.smart;
-
-import android.support.annotation.IntDef;
+package com.modular.apputils.network;
 
 import com.me.network.app.http.HttpClient;
-import com.me.network.app.http.Method;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
 
 /**
  * Created by Bitliker on 2017/9/29.

+ 1 - 1
app_core/common/src/main/java/com/core/net/smart/Result.java → app_modular/apputils/src/main/java/com/modular/apputils/network/Result.java

@@ -1,4 +1,4 @@
-package com.core.net.smart;
+package com.modular.apputils.network;
 
 import android.text.TextUtils;
 

+ 2 - 2
app_core/common/src/main/java/com/core/net/smart/SmartHttpClient.java → app_modular/apputils/src/main/java/com/modular/apputils/network/SmartHttpClient.java

@@ -1,15 +1,15 @@
-package com.core.net.smart;
+package com.modular.apputils.network;
 
 import android.support.annotation.IntDef;
 
 import com.common.LogUtil;
 import com.common.config.BaseConfig;
-import com.core.net.listener.OnSmartHttpListener;
 import com.core.utils.CommonUtil;
 import com.me.network.app.http.HttpClient;
 import com.me.network.app.http.Method;
 import com.me.network.app.http.rx.Result2Listener;
 import com.me.network.app.http.rx.ResultSubscriber;
+import com.modular.apputils.listener.OnSmartHttpListener;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;

+ 61 - 0
app_modular/apputils/src/main/java/com/modular/apputils/network/Success.java

@@ -0,0 +1,61 @@
+package com.modular.apputils.network;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.common.data.JSONUtil;
+
+/**
+ * Created by Bitliker on 2017/6/14.
+ */
+
+public class Success extends Result {
+
+
+	public Success(Result result) {
+		super(result);
+	}
+
+
+	public JSONObject getJsonObject() {
+		if (isJSON())
+			return JSON.parseObject(message);
+		else return new JSONObject();
+	}
+
+	public JSONObject getJsonObject(String... keys) {
+		if (isJSON()) {
+			JSONObject object = JSON.parseObject(message);
+			if (object != null && keys != null && keys.length > 0) {
+				for (String key : keys) {
+					if (object.containsKey(key) && object.get(key) instanceof JSONObject) {
+						return object.getJSONObject(key);
+					}
+				}
+			}
+		}
+		return new JSONObject();
+	}
+
+	public JSONArray getJSONArray() {
+		if (isJSON())
+			return JSON.parseArray(message);
+		else return new JSONArray();
+	}
+
+	public JSONArray getJSONArray(String... keys) {
+		try {
+			if (isJsonObject()) {
+				return JSONUtil.getJSONArray(message, keys);
+			} else if (isJsonArray()) {
+				//TODO  当返回的是数组的时候
+			}
+		} catch (Exception e) {
+			return new JSONArray();
+		}
+		return new JSONArray();
+
+	}
+
+
+}

+ 1 - 1
app_core/common/src/main/java/com/core/net/smart/Tags.java → app_modular/apputils/src/main/java/com/modular/apputils/network/Tags.java

@@ -1,4 +1,4 @@
-package com.core.net.smart;
+package com.modular.apputils.network;
 
 import android.util.SparseArray;
 

+ 3 - 0
app_modular/apputils/src/main/res/values/strings.xml

@@ -0,0 +1,3 @@
+<resources>
+    <string name="app_name">AppUtils</string>
+</resources>

+ 4 - 4
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/MissionActivity.java

@@ -25,10 +25,10 @@ import com.common.preferences.PreferenceUtils;
 import com.core.api.wxapi.ApiPlatform;
 import com.core.api.wxapi.ApiUtils;
 import com.core.app.AppConfig;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.OABaseActivity;
 import com.core.model.MissionModel;
-import com.core.net.location.BdLocationHelper;
 import com.core.utils.BaiduMapUtil;
 import com.core.utils.OnGetDrivingRouteResult;
 import com.core.utils.TimeUtils;
@@ -36,12 +36,12 @@ import com.core.utils.helper.PopupWindowHelper;
 import com.core.utils.time.wheel.DateTimePicker;
 import com.core.widget.view.model.SelectAimModel;
 import com.lidroid.xutils.ViewUtils;
-import com.uas.appworks.R;
 import com.uas.appworks.OA.erp.adapter.MissionAdapter;
-import com.uas.appworks.OA.erp.presenter.IMissionPresenter;
 import com.uas.appworks.OA.erp.model.IMission;
+import com.uas.appworks.OA.erp.presenter.IMissionPresenter;
 import com.uas.appworks.OA.erp.presenter.MissionPresenter;
 import com.uas.appworks.OA.erp.utils.MostLinearLayoutManager;
+import com.uas.appworks.R;
 
 import java.util.List;
 
@@ -83,7 +83,7 @@ public class MissionActivity extends OABaseActivity implements View.OnClickListe
         setContentView(R.layout.activity_mission);
         ViewUtils.inject(this);
         IntentFilter filter = new IntentFilter();
-        filter.addAction(BdLocationHelper.UPLOCATION_ACTION);
+        filter.addAction(Constants.ACTION_LOCATION_CHANGE);
         LocalBroadcastManager.getInstance(ct).registerReceiver(receiver, filter);
         initView();
         initEvent();

+ 389 - 383
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/activity/WorkActivity.java

@@ -29,18 +29,18 @@ import com.common.data.StringUtil;
 import com.common.system.DisplayUtil;
 import com.common.system.SystemUtil;
 import com.core.app.AppConfig;
+import com.core.app.Constants;
 import com.core.app.MyApplication;
 import com.core.base.OABaseActivity;
 import com.core.model.WorkModel;
-import com.core.net.location.BdLocationHelper;
+import com.core.utils.time.wheel.OASigninPicker;
 import com.core.widget.crouton.Crouton;
 import com.lidroid.xutils.ViewUtils;
-import com.uas.appworks.R;
 import com.uas.appworks.OA.erp.adapter.WorkAdapter;
 import com.uas.appworks.OA.erp.presenter.WorkPresenter;
-import com.core.utils.time.wheel.OASigninPicker;
 import com.uas.appworks.OA.erp.utils.WifiReceiverUtil;
 import com.uas.appworks.OA.erp.view.IWorkView;
+import com.uas.appworks.R;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -53,386 +53,392 @@ import java.util.List;
  */
 public class WorkActivity extends OABaseActivity implements View.OnClickListener, IWorkView {
 
-    public static final int ALLEGEDLY = 0x16;
-    private final int PHONE_CHANGE = 0x15;
-    private final int ADDRESS_CHANGE = 0x14;
-    private RecyclerView listview;//列表
-    private TextView office_addr;//当前位置
-    private TextView unoffice_mm;//距离
-    private TextView date_tv;//当前日期
-    private View line;//当前日期
-    private RelativeLayout empty_rl;//当前日期
-    private TextView empty_tv;//当前日期
-
-    private PopupWindow setWindow = null;//
-    private WorkAdapter adapter;
-    private boolean isToday = true;
-    private WorkPresenter presenter;
-    private String macAddress;
-    private String macError;//变更mac地址
-    private long selectTime;
-    private boolean isAdmin = false;
-    private boolean isChangePoi = false;
-    private BroadcastReceiver receiver = new BroadcastReceiver() {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            if (presenter != null && !isChangePoi) presenter.upDateLocation();
-        }
-    };
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        getMenuInflater().inflate(R.menu.menu_outoffice, menu);
-        return super.onCreateOptionsMenu(menu);
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        if (item.getItemId() == R.id.title) {
-            showPopupWindow();
-        }
-        return super.onOptionsItemSelected(item);
-    }
-
-    @Override
-    protected void onDestroy() {
-        LocalBroadcastManager.getInstance(ct).unregisterReceiver(receiver);
-        super.onDestroy();
-    }
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_work);
-        IntentFilter filter = new IntentFilter();
-        filter.addAction(BdLocationHelper.UPLOCATION_ACTION);
-        LocalBroadcastManager.getInstance(ct).registerReceiver(receiver, filter);
-        ViewUtils.inject(this);
-        initView();
-        initLcation();
-    }
-
-    boolean isRuning = false;
-
-    private void initLcation() {
-        isRuning = true;
-    }
-
-    private void initView() {
-        getSupportActionBar().setTitle(R.string.activity_signing);
-        isAdmin = getIntent() == null ? false : getIntent().getBooleanExtra(AppConfig.IS_ADMIN, false);
-        listview = (RecyclerView) findViewById(R.id.listview);
-        empty_tv = (TextView) findViewById(R.id.empty_tv);
-        office_addr = (TextView) findViewById(R.id.office_addr);
-        unoffice_mm = (TextView) findViewById(R.id.unoffice_mm);
-        line = findViewById(R.id.line);
-        empty_rl = (RelativeLayout) findViewById(R.id.empty_rl);
-        date_tv = (TextView) findViewById(R.id.date_tv);
-
-        selectTime = System.currentTimeMillis();
-        getMac();
-        presenter = new WorkPresenter(this, macAddress);
-        adapter = new WorkAdapter(ct);
-        listview.setLayoutManager(new LinearLayoutManager(ct));
-        listview.setAdapter(adapter);
-        presenter.start(true);
-        date_tv.setText(DateFormatUtil.long2Str(System.currentTimeMillis(), "yyyy年MM月dd日") + " " +
-                CalendarUtil.getWeek(System.currentTimeMillis()));
-        findViewById(R.id.signin_btn).setOnClickListener(this);
-        findViewById(R.id.unoffice_).setOnClickListener(this);
-        date_tv.setOnClickListener(this);
-
-
-    }
-
-    @Override
-    public void showDistance(double distance) {
-        if (distance == -1)
-            unoffice_mm.setText("");
-        else if (distance != 0)
-            unoffice_mm.setText("约" + distance + "米");
-        else unoffice_mm.setText("约0米");
-    }
-
-    @Override
-    public void showLocation(String location) {
-        if (!StringUtil.isEmpty(location))
-            office_addr.setText(location);
+	public static final int ALLEGEDLY = 0x16;
+	private final int PHONE_CHANGE = 0x15;
+	private final int ADDRESS_CHANGE = 0x14;
+	private RecyclerView listview;//列表
+	private TextView office_addr;//当前位置
+	private TextView unoffice_mm;//距离
+	private TextView date_tv;//当前日期
+	private View line;//当前日期
+	private RelativeLayout empty_rl;//当前日期
+	private TextView empty_tv;//当前日期
+
+	private PopupWindow setWindow = null;//
+	private WorkAdapter adapter;
+	private boolean isToday = true;
+	private WorkPresenter presenter;
+	private String macAddress;
+	private String macError;//变更mac地址
+	private long selectTime;
+	private boolean isAdmin = false;
+	private boolean isChangePoi = false;
+	private BroadcastReceiver receiver = new BroadcastReceiver() {
+		@Override
+		public void onReceive(Context context, Intent intent) {
+			if (presenter != null && !isChangePoi) presenter.upDateLocation();
+		}
+	};
+
+	@Override
+	public boolean onCreateOptionsMenu(Menu menu) {
+		getMenuInflater().inflate(R.menu.menu_outoffice, menu);
+		return super.onCreateOptionsMenu(menu);
+	}
+
+	@Override
+	public boolean onOptionsItemSelected(MenuItem item) {
+		if (item.getItemId() == R.id.title) {
+			showPopupWindow();
+		}
+		return super.onOptionsItemSelected(item);
+	}
+
+	@Override
+	protected void onDestroy() {
+		LocalBroadcastManager.getInstance(ct).unregisterReceiver(receiver);
+		super.onDestroy();
+	}
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_work);
+		IntentFilter filter = new IntentFilter();
+		filter.addAction(Constants.ACTION_LOCATION_CHANGE);
+		LocalBroadcastManager.getInstance(ct).registerReceiver(receiver, filter);
+		ViewUtils.inject(this);
+		initView();
+		initLcation();
+	}
+
+	@Override
+	protected void onResume() {
+		MyApplication.getInstance().getBdLocationHelper().requestLocation();
+		super.onResume();
+	}
+
+	boolean isRuning = false;
+
+	private void initLcation() {
+		isRuning = true;
+	}
+
+	private void initView() {
+		getSupportActionBar().setTitle(R.string.activity_signing);
+		isAdmin = getIntent() == null ? false : getIntent().getBooleanExtra(AppConfig.IS_ADMIN, false);
+		listview = (RecyclerView) findViewById(R.id.listview);
+		empty_tv = (TextView) findViewById(R.id.empty_tv);
+		office_addr = (TextView) findViewById(R.id.office_addr);
+		unoffice_mm = (TextView) findViewById(R.id.unoffice_mm);
+		line = findViewById(R.id.line);
+		empty_rl = (RelativeLayout) findViewById(R.id.empty_rl);
+		date_tv = (TextView) findViewById(R.id.date_tv);
+
+		selectTime = System.currentTimeMillis();
+		getMac();
+		presenter = new WorkPresenter(this, macAddress);
+		adapter = new WorkAdapter(ct);
+		listview.setLayoutManager(new LinearLayoutManager(ct));
+		listview.setAdapter(adapter);
+		presenter.start(true);
+		date_tv.setText(DateFormatUtil.long2Str(System.currentTimeMillis(), "yyyy年MM月dd日") + " " +
+				CalendarUtil.getWeek(System.currentTimeMillis()));
+		findViewById(R.id.signin_btn).setOnClickListener(this);
+		findViewById(R.id.unoffice_).setOnClickListener(this);
+		date_tv.setOnClickListener(this);
+
+
+	}
+
+	@Override
+	public void showDistance(double distance) {
+		if (distance == -1)
+			unoffice_mm.setText("");
+		else if (distance != 0)
+			unoffice_mm.setText("约" + distance + "米");
+		else unoffice_mm.setText("约0米");
+	}
+
+	@Override
+	public void showLocation(String location) {
+		if (!StringUtil.isEmpty(location))
+			office_addr.setText(location);
 //        else
 //            Crouton.showToast(ct, "定位失败,请检查定位权限", R.color.load_warning);
-    }
-
-
-    @Override
-    public void showModel(boolean isFree, List<WorkModel> models) {
-        if (isFree) {
-            line.setVisibility(View.GONE);
-            if (ListUtils.isEmpty(models)) {
-                showEmptyView(true, true);
-            } else {
-                showEmptyView(false, true);
-                adapter.setModels(isToday, isFree, selectTime, models);
-            }
-        } else {
-            if (ListUtils.isEmpty(models)) {
-                showEmptyView(true, false);
-                line.setVisibility(View.GONE);
-            } else {
-                showEmptyView(false, false);
-                line.setVisibility(View.VISIBLE);
-            }
-            adapter.setModels(isToday, isFree, selectTime, models);
-        }
-
-    }
-
-
-    @Override
-    public void showFristMac() {
-        MaterialDialog dialog = new MaterialDialog.Builder(ct).title(R.string.common_dialog_title).content(R.string.show_frist_mac)
-                .positiveText(R.string.common_sure).negativeText(R.string.common_cancel).autoDismiss(false).callback(new MaterialDialog.ButtonCallback() {
-                    @Override
-                    public void onPositive(MaterialDialog dialog) {
-                        presenter.submitByFrist((ArrayList<WorkModel>) adapter.getModels(), macAddress);
-                        dialog.dismiss();
-                    }
-
-                    @Override
-                    public void onNegative(MaterialDialog dialog) {
-                        super.onNegative(dialog);
-                        dialog.dismiss();
-                    }
-                }).build();
-        dialog.show();
-    }
-
-    @Override
-    public void showErrorMac() {
-        MaterialDialog dialog = new MaterialDialog.Builder(ct).title(R.string.common_dialog_title).content(getString(R.string.other_phone_error))
-                .positiveText(R.string.common_sure).negativeText(R.string.common_cancel).autoDismiss(false).callback(new MaterialDialog.ButtonCallback() {
-                    @Override
-                    public void onPositive(MaterialDialog dialog) {
-                        dialog.dismiss();
-                        Intent intent = new Intent(ct, ChangeMobileActivity.class);
-                        intent.putExtra("macAddress", macAddress);
-                        startActivityForResult(intent, PHONE_CHANGE);
-                    }
-
-                    @Override
-                    public void onNegative(MaterialDialog dialog) {
-                        super.onNegative(dialog);
-                        dialog.dismiss();
-                    }
-                }).build();
-        dialog.show();
-    }
-
-    private MaterialDialog notLocationDialog = null;
-
-    @Override
-    public void showNotLocation() {
-        if (notLocationDialog == null)
-            notLocationDialog = new MaterialDialog.Builder(ct).title(R.string.prompt_title).
-                    content(R.string.allow_location)
-                    .positiveText(R.string.common_sure).
-                            autoDismiss(false).callback(new MaterialDialog.ButtonCallback() {
-                        @Override
-                        public void onPositive(MaterialDialog dialog) {
-                            super.onPositive(dialog);
-                            dialog.dismiss();
-                        }
-                    }).build();
-        if (!notLocationDialog.isShowing())
-            notLocationDialog.show();
-    }
-
-    @Override
-    public void setPois(List<PoiInfo> pois, LatLng latLng) {
-    }
-
-    @Override
-    public void setErrorMac(String message) {
-        macError = message;
-    }
-
-
-    @Override
-    public void onClick(View view) {
-        Intent intent = null;
-
-        if (view.getId() == R.id.signin_btn) {
-            if (isSubmitAble()) {
-                isShowTocstAble = true;
-                presenter.submit((ArrayList<WorkModel>) adapter.getModels(), macAddress);
-            }
-        } else if (view.getId() == R.id.date_tv) {
-            isShowTocstAble = true;
-            showDateDialog();
-        } else if (view.getId() == R.id.unoffice_) {
-            isShowTocstAble = true;
-            presenter.gotoLocationActivity(WorkActivity.this);
-        } else if (view.getId() == R.id.super_setting_tv) {
-            startActivityForResult(new Intent(ct, SignSeniorSettingActivity.class), 0x12);
-            closePopupWindow();
-        } else if (view.getId() == R.id.work_setting_tv) {
-            intent = new Intent(ct, FlightsActivity.class);
-            startActivityForResult(intent, 0x12);
-            closePopupWindow();
-        } else if (view.getId() == R.id.office_addr_setting_tv) {
-            startActivityForResult(new Intent(ct, OfficeAddressSettingsActivity.class), 0x12);
-            closePopupWindow();
-        } else if (view.getId() == R.id.my_rule_setting_tv) {
-            intent = new Intent(ct, MyRuleSetActivity.class);
-            presenter.showMyRele(intent, adapter.getModels());
-            startActivity(intent);
-            closePopupWindow();
-        } else if (view.getId() == R.id.cancel_tv) {
-            closePopupWindow();
-        }
-    }
-
-
-    private void initPopupWindow() {
-        View viewContext = LayoutInflater.from(ct).inflate(R.layout.pop_work_activity, null);
-        if (!isAdmin) {
-            viewContext.findViewById(R.id.super_setting_tv).setVisibility(View.GONE);
-            viewContext.findViewById(R.id.work_setting_tv).setVisibility(View.GONE);
-            viewContext.findViewById(R.id.office_addr_setting_tv).setVisibility(View.GONE);
-        } else {
-            viewContext.findViewById(R.id.super_setting_tv).setOnClickListener(this);
-            viewContext.findViewById(R.id.work_setting_tv).setOnClickListener(this);
-            viewContext.findViewById(R.id.office_addr_setting_tv).setOnClickListener(this);
-        }
-        viewContext.findViewById(R.id.my_rule_setting_tv).setOnClickListener(this);
-        viewContext.findViewById(R.id.cancel_tv).setOnClickListener(this);
-        setWindow = new PopupWindow(viewContext,
-                LinearLayout.LayoutParams.MATCH_PARENT,
-                LinearLayout.LayoutParams.WRAP_CONTENT, true);
-        setWindow.setAnimationStyle(R.style.MenuAnimationFade);
-        setWindow.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.bg_popuwin));
-        setWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
-            @Override
-            public void onDismiss() {
-                closePopupWindow();
-            }
-        });
-    }
-
-    private void showPopupWindow() {
-        if (setWindow == null) initPopupWindow();
-        setWindow.showAtLocation(getWindow().getDecorView().
-                findViewById(android.R.id.content), Gravity.BOTTOM, 0, 0);
-        DisplayUtil.backgroundAlpha(this, 0.4f);
-    }
-
-    private void closePopupWindow() {
-        if (setWindow != null)
-            setWindow.dismiss();
-        DisplayUtil.backgroundAlpha(this, 1f);
-    }
-
-    //显示时间选择器
-    private void showDateDialog() {
-        OASigninPicker picker = new OASigninPicker(this);
-        picker.setRange(CalendarUtil.getYear(), CalendarUtil.getMonth(), CalendarUtil.getDay());
-        picker.setSelectedItem(CalendarUtil.getYear(), CalendarUtil.getMonth(), CalendarUtil.getDay());
-        picker.setOnDateTimePickListener(new OASigninPicker.OnDateTimePickListener() {
-            @Override
-            public void setTime(String year, String month, String day) {
-                String time = year + "-" + month + "-" + day;
-                selectTime = DateFormatUtil.str2Long(time, DateFormatUtil.YMD);
-                isToday = time.equals(DateFormatUtil.long2Str(DateFormatUtil.YMD)) ? true : false;
-                date_tv.setText(year + "年" + month + "月" + day + "日 " + CalendarUtil.getWeek(selectTime));
-                presenter.loadWorkData(selectTime, true);
-            }
-        });
-        picker.show();
-    }
-
-    public void getMac() {
-        macAddress = SystemUtil.getMac(ct);
-        if (StringUtil.isEmpty(macAddress)) {
-            //当没有获取到MACAddress的时候,判断wifi状态,如果wifi为未启动
-            //mac地址不合法时候   提示开启wifi
-            WifiReceiverUtil wifiReceiver = new WifiReceiverUtil();
-            wifiReceiver.regReceiver(ct, new WifiReceiverUtil.OnWifiStatusChangeLinstener() {
-                @Override
-                public void callBack(boolean isOpen) {
-                    if (isOpen) {
-                        macAddress = SystemUtil.getMac(ct);
-                    }
-                }
-            });
-        }
-    }
-
-
-    private void showEmptyView(boolean isShow, boolean isFree) {
-        if (isFree) {
-            empty_tv.setText(getResources().getString(R.string.free_work));
-        } else {
-            empty_tv.setText(getResources().getString(R.string.not_find_work));
-        }
-        if (isShow) {
-            empty_rl.setVisibility(View.VISIBLE);
-            listview.setVisibility(View.GONE);
-        } else {
-            empty_rl.setVisibility(View.GONE);
-            listview.setVisibility(View.VISIBLE);
-        }
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        if (0x12 == requestCode) {
-            isShowTocstAble = false;
-            presenter.loadWorkData(selectTime, isShowTocstAble);
-        }
-        if (data == null) return;
-        if (requestCode == ADDRESS_CHANGE && resultCode == ADDRESS_CHANGE) {//地址微调
-            PoiInfo poi = data.getParcelableExtra("resultKey");
-            if (poi == null || presenter == null) return;
-            isChangePoi = true;
-            presenter.changPoi(poi);
-        } else if (requestCode == PHONE_CHANGE && resultCode == 0x20) {
-            boolean isChange = data.getBooleanExtra("isChange", false);
-            if (isChange)
-                macError = getResources().getString(R.string.mac_changing);
-        } else if (ALLEGEDLY == requestCode && 0x20 == resultCode) {
-            boolean isChange = data.getBooleanExtra("isChange", false);
-            if (isChange)
-                presenter.loadWorkData(selectTime, isShowTocstAble);
-        }
-    }
-
-    private boolean isSubmitAble() {
-        if (!MyApplication.getInstance().isNetworkActive()) {
-            Crouton.showToast(this, R.string.networks_out, R.color.load_warning);
-            return false;
-        } else if (!isToday) {
-            Crouton.showToast(this, R.string.not_today, R.color.load_warning);
-            return false;
-        } else if (!StringUtil.isEmpty(macError)) {
-            Crouton.showToast(this, macError, R.color.load_warning);
-            return false;
-        } else if (TextUtils.isEmpty(unoffice_mm.getText())) {
-            Crouton.showToast(this, R.string.not_addr_message, R.color.load_warning);
-            return false;
-        }
-        return true;
-    }
-
-    private boolean isShowTocstAble = true;
-
-    @Override
-    public void showToast(String message, int colorId) {
-        if (isShowTocstAble)
-            super.showToast(message, colorId);
-    }
-
-    @Override
-    public void showToast(int reId, int colorId) {
-        if (isShowTocstAble)
-            super.showToast(reId, colorId);
-    }
+	}
+
+
+	@Override
+	public void showModel(boolean isFree, List<WorkModel> models) {
+		if (isFree) {
+			line.setVisibility(View.GONE);
+			if (ListUtils.isEmpty(models)) {
+				showEmptyView(true, true);
+			} else {
+				showEmptyView(false, true);
+				adapter.setModels(isToday, isFree, selectTime, models);
+			}
+		} else {
+			if (ListUtils.isEmpty(models)) {
+				showEmptyView(true, false);
+				line.setVisibility(View.GONE);
+			} else {
+				showEmptyView(false, false);
+				line.setVisibility(View.VISIBLE);
+			}
+			adapter.setModels(isToday, isFree, selectTime, models);
+		}
+
+	}
+
+
+	@Override
+	public void showFristMac() {
+		MaterialDialog dialog = new MaterialDialog.Builder(ct).title(R.string.common_dialog_title).content(R.string.show_frist_mac)
+				.positiveText(R.string.common_sure).negativeText(R.string.common_cancel).autoDismiss(false).callback(new MaterialDialog.ButtonCallback() {
+					@Override
+					public void onPositive(MaterialDialog dialog) {
+						presenter.submitByFrist((ArrayList<WorkModel>) adapter.getModels(), macAddress);
+						dialog.dismiss();
+					}
+
+					@Override
+					public void onNegative(MaterialDialog dialog) {
+						super.onNegative(dialog);
+						dialog.dismiss();
+					}
+				}).build();
+		dialog.show();
+	}
+
+	@Override
+	public void showErrorMac() {
+		MaterialDialog dialog = new MaterialDialog.Builder(ct).title(R.string.common_dialog_title).content(getString(R.string.other_phone_error))
+				.positiveText(R.string.common_sure).negativeText(R.string.common_cancel).autoDismiss(false).callback(new MaterialDialog.ButtonCallback() {
+					@Override
+					public void onPositive(MaterialDialog dialog) {
+						dialog.dismiss();
+						Intent intent = new Intent(ct, ChangeMobileActivity.class);
+						intent.putExtra("macAddress", macAddress);
+						startActivityForResult(intent, PHONE_CHANGE);
+					}
+
+					@Override
+					public void onNegative(MaterialDialog dialog) {
+						super.onNegative(dialog);
+						dialog.dismiss();
+					}
+				}).build();
+		dialog.show();
+	}
+
+	private MaterialDialog notLocationDialog = null;
+
+	@Override
+	public void showNotLocation() {
+		if (notLocationDialog == null)
+			notLocationDialog = new MaterialDialog.Builder(ct).title(R.string.prompt_title).
+					content(R.string.allow_location)
+					.positiveText(R.string.common_sure).
+							autoDismiss(false).callback(new MaterialDialog.ButtonCallback() {
+						@Override
+						public void onPositive(MaterialDialog dialog) {
+							super.onPositive(dialog);
+							dialog.dismiss();
+						}
+					}).build();
+		if (!notLocationDialog.isShowing())
+			notLocationDialog.show();
+	}
+
+	@Override
+	public void setPois(List<PoiInfo> pois, LatLng latLng) {
+	}
+
+	@Override
+	public void setErrorMac(String message) {
+		macError = message;
+	}
+
+
+	@Override
+	public void onClick(View view) {
+		Intent intent = null;
+
+		if (view.getId() == R.id.signin_btn) {
+			if (isSubmitAble()) {
+				isShowTocstAble = true;
+				presenter.submit((ArrayList<WorkModel>) adapter.getModels(), macAddress);
+			}
+		} else if (view.getId() == R.id.date_tv) {
+			isShowTocstAble = true;
+			showDateDialog();
+		} else if (view.getId() == R.id.unoffice_) {
+			isShowTocstAble = true;
+			presenter.gotoLocationActivity(WorkActivity.this);
+		} else if (view.getId() == R.id.super_setting_tv) {
+			startActivityForResult(new Intent(ct, SignSeniorSettingActivity.class), 0x12);
+			closePopupWindow();
+		} else if (view.getId() == R.id.work_setting_tv) {
+			intent = new Intent(ct, FlightsActivity.class);
+			startActivityForResult(intent, 0x12);
+			closePopupWindow();
+		} else if (view.getId() == R.id.office_addr_setting_tv) {
+			startActivityForResult(new Intent(ct, OfficeAddressSettingsActivity.class), 0x12);
+			closePopupWindow();
+		} else if (view.getId() == R.id.my_rule_setting_tv) {
+			intent = new Intent(ct, MyRuleSetActivity.class);
+			presenter.showMyRele(intent, adapter.getModels());
+			startActivity(intent);
+			closePopupWindow();
+		} else if (view.getId() == R.id.cancel_tv) {
+			closePopupWindow();
+		}
+	}
+
+
+	private void initPopupWindow() {
+		View viewContext = LayoutInflater.from(ct).inflate(R.layout.pop_work_activity, null);
+		if (!isAdmin) {
+			viewContext.findViewById(R.id.super_setting_tv).setVisibility(View.GONE);
+			viewContext.findViewById(R.id.work_setting_tv).setVisibility(View.GONE);
+			viewContext.findViewById(R.id.office_addr_setting_tv).setVisibility(View.GONE);
+		} else {
+			viewContext.findViewById(R.id.super_setting_tv).setOnClickListener(this);
+			viewContext.findViewById(R.id.work_setting_tv).setOnClickListener(this);
+			viewContext.findViewById(R.id.office_addr_setting_tv).setOnClickListener(this);
+		}
+		viewContext.findViewById(R.id.my_rule_setting_tv).setOnClickListener(this);
+		viewContext.findViewById(R.id.cancel_tv).setOnClickListener(this);
+		setWindow = new PopupWindow(viewContext,
+				LinearLayout.LayoutParams.MATCH_PARENT,
+				LinearLayout.LayoutParams.WRAP_CONTENT, true);
+		setWindow.setAnimationStyle(R.style.MenuAnimationFade);
+		setWindow.setBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.bg_popuwin));
+		setWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
+			@Override
+			public void onDismiss() {
+				closePopupWindow();
+			}
+		});
+	}
+
+	private void showPopupWindow() {
+		if (setWindow == null) initPopupWindow();
+		setWindow.showAtLocation(getWindow().getDecorView().
+				findViewById(android.R.id.content), Gravity.BOTTOM, 0, 0);
+		DisplayUtil.backgroundAlpha(this, 0.4f);
+	}
+
+	private void closePopupWindow() {
+		if (setWindow != null)
+			setWindow.dismiss();
+		DisplayUtil.backgroundAlpha(this, 1f);
+	}
+
+	//显示时间选择器
+	private void showDateDialog() {
+		OASigninPicker picker = new OASigninPicker(this);
+		picker.setRange(CalendarUtil.getYear(), CalendarUtil.getMonth(), CalendarUtil.getDay());
+		picker.setSelectedItem(CalendarUtil.getYear(), CalendarUtil.getMonth(), CalendarUtil.getDay());
+		picker.setOnDateTimePickListener(new OASigninPicker.OnDateTimePickListener() {
+			@Override
+			public void setTime(String year, String month, String day) {
+				String time = year + "-" + month + "-" + day;
+				selectTime = DateFormatUtil.str2Long(time, DateFormatUtil.YMD);
+				isToday = time.equals(DateFormatUtil.long2Str(DateFormatUtil.YMD)) ? true : false;
+				date_tv.setText(year + "年" + month + "月" + day + "日 " + CalendarUtil.getWeek(selectTime));
+				presenter.loadWorkData(selectTime, true);
+			}
+		});
+		picker.show();
+	}
+
+	public void getMac() {
+		macAddress = SystemUtil.getMac(ct);
+		if (StringUtil.isEmpty(macAddress)) {
+			//当没有获取到MACAddress的时候,判断wifi状态,如果wifi为未启动
+			//mac地址不合法时候   提示开启wifi
+			WifiReceiverUtil wifiReceiver = new WifiReceiverUtil();
+			wifiReceiver.regReceiver(ct, new WifiReceiverUtil.OnWifiStatusChangeLinstener() {
+				@Override
+				public void callBack(boolean isOpen) {
+					if (isOpen) {
+						macAddress = SystemUtil.getMac(ct);
+					}
+				}
+			});
+		}
+	}
+
+
+	private void showEmptyView(boolean isShow, boolean isFree) {
+		if (isFree) {
+			empty_tv.setText(getResources().getString(R.string.free_work));
+		} else {
+			empty_tv.setText(getResources().getString(R.string.not_find_work));
+		}
+		if (isShow) {
+			empty_rl.setVisibility(View.VISIBLE);
+			listview.setVisibility(View.GONE);
+		} else {
+			empty_rl.setVisibility(View.GONE);
+			listview.setVisibility(View.VISIBLE);
+		}
+	}
+
+	@Override
+	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+		if (0x12 == requestCode) {
+			isShowTocstAble = false;
+			presenter.loadWorkData(selectTime, isShowTocstAble);
+		}
+		if (data == null) return;
+		if (requestCode == ADDRESS_CHANGE && resultCode == ADDRESS_CHANGE) {//地址微调
+			PoiInfo poi = data.getParcelableExtra("resultKey");
+			if (poi == null || presenter == null) return;
+			isChangePoi = true;
+			presenter.changPoi(poi);
+		} else if (requestCode == PHONE_CHANGE && resultCode == 0x20) {
+			boolean isChange = data.getBooleanExtra("isChange", false);
+			if (isChange)
+				macError = getResources().getString(R.string.mac_changing);
+		} else if (ALLEGEDLY == requestCode && 0x20 == resultCode) {
+			boolean isChange = data.getBooleanExtra("isChange", false);
+			if (isChange)
+				presenter.loadWorkData(selectTime, isShowTocstAble);
+		}
+	}
+
+	private boolean isSubmitAble() {
+		if (!MyApplication.getInstance().isNetworkActive()) {
+			Crouton.showToast(this, R.string.networks_out, R.color.load_warning);
+			return false;
+		} else if (!isToday) {
+			Crouton.showToast(this, R.string.not_today, R.color.load_warning);
+			return false;
+		} else if (!StringUtil.isEmpty(macError)) {
+			Crouton.showToast(this, macError, R.color.load_warning);
+			return false;
+		} else if (TextUtils.isEmpty(unoffice_mm.getText())) {
+			Crouton.showToast(this, R.string.not_addr_message, R.color.load_warning);
+			return false;
+		}
+		return true;
+	}
+
+	private boolean isShowTocstAble = true;
+
+	@Override
+	public void showToast(String message, int colorId) {
+		if (isShowTocstAble)
+			super.showToast(message, colorId);
+	}
+
+	@Override
+	public void showToast(int reId, int colorId) {
+		if (isShowTocstAble)
+			super.showToast(reId, colorId);
+	}
 }

+ 0 - 1
app_modular/appworks/src/main/java/com/uas/appworks/OA/erp/utils/AutoErpSigninUitl.java

@@ -486,7 +486,6 @@ public class AutoErpSigninUitl implements OnHttpResultListener {
                     }
                     handlerData(array);
                     break;
-
                 case LOAD_WORK_SET:
                     if (isJSON) {
                         handlerWorkSet(JSON.parseObject(message));

+ 3 - 1
settings.gradle

@@ -15,7 +15,8 @@ include ':appbooking'
 include ':appme'
 include ':appworks'
 include ':appmoments'
-include  ':apptasks'
+include ':apptasks'
+include ':apputils'
 
 //第三库模块
 include ':lib-zxing'
@@ -46,6 +47,7 @@ project(':appmessages').projectDir = new File('app_modular/appmessages')
 project(':appbooking').projectDir = new File('app_modular/appbooking')
 project(':appmoments').projectDir = new File('app_modular/appmoments')
 project(':apptasks').projectDir = new File('app_modular/apptasks')
+project(':apputils').projectDir = new File('app_modular/apputils')
 
 //第三库模块
 project(':lib-zxing').projectDir = new File('app_third/lib-zxing')

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä