Przeglądaj źródła

修改消息首页UI

Bitliker 8 lat temu
rodzic
commit
00dfaa5cca

+ 109 - 15
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/MessageFragment.java

@@ -5,30 +5,43 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.Intent;
 import android.os.Bundle;
 import android.os.Bundle;
 import android.provider.Settings;
 import android.provider.Settings;
+import android.support.constraint.ConstraintLayout;
+import android.support.v7.widget.AppCompatTextView;
 import android.text.Editable;
 import android.text.Editable;
+import android.text.TextUtils;
+import android.view.ContextMenu;
 import android.view.Gravity;
 import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
 import android.view.View;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewGroup;
 import android.widget.AdapterView;
 import android.widget.AdapterView;
 import android.widget.BaseAdapter;
 import android.widget.BaseAdapter;
+import android.widget.ImageButton;
 import android.widget.ImageView;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.LinearLayout;
 import android.widget.PopupWindow;
 import android.widget.PopupWindow;
 import android.widget.ScrollView;
 import android.widget.ScrollView;
 import android.widget.TextView;
 import android.widget.TextView;
 
 
+import com.alibaba.fastjson.JSON;
 import com.common.LogUtil;
 import com.common.LogUtil;
 import com.common.data.DateFormatUtil;
 import com.common.data.DateFormatUtil;
 import com.common.data.ListUtils;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
 import com.common.data.StringUtil;
+import com.common.data.TextUtil;
 import com.common.preferences.PreferenceUtils;
 import com.common.preferences.PreferenceUtils;
 import com.common.system.DisplayUtil;
 import com.common.system.DisplayUtil;
 import com.core.api.wxapi.ApiPlatform;
 import com.core.api.wxapi.ApiPlatform;
 import com.core.api.wxapi.ApiUtils;
 import com.core.api.wxapi.ApiUtils;
 import com.core.app.Constants;
 import com.core.app.Constants;
+import com.core.base.BaseActivity;
 import com.core.base.EasyFragment;
 import com.core.base.EasyFragment;
 import com.core.model.Friend;
 import com.core.model.Friend;
+import com.core.model.WorkModel;
+import com.core.utils.ToastUtil;
 import com.core.utils.sortlist.BaseSortModel;
 import com.core.utils.sortlist.BaseSortModel;
 import com.core.widget.DrawableCenterTextView;
 import com.core.widget.DrawableCenterTextView;
 import com.core.widget.MyListView;
 import com.core.widget.MyListView;
@@ -47,6 +60,7 @@ import com.modular.appmessages.adapter.MessageAdapter;
 import com.modular.appmessages.model.MessageHeader;
 import com.modular.appmessages.model.MessageHeader;
 import com.modular.appmessages.presenter.MessagePresenter;
 import com.modular.appmessages.presenter.MessagePresenter;
 import com.modular.appmessages.presenter.imp.IMessageView;
 import com.modular.appmessages.presenter.imp.IMessageView;
+import com.modular.appmessages.widget.SignRefreshLayout;
 import com.uas.appme.pedometer.view.UURanking;
 import com.uas.appme.pedometer.view.UURanking;
 import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.ui.platform.task.TaskActivity;
 import com.xzjmyk.pm.activity.ui.platform.task.TaskActivity;
@@ -67,14 +81,19 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
 
 
     @ViewInject(R.id.message_net_set)
     @ViewInject(R.id.message_net_set)
     private DrawableCenterTextView message_net_set;
     private DrawableCenterTextView message_net_set;
-    @ViewInject(R.id.pullScrollView)
-    private PullToRefreshScrollView pullScrollView;
+    @ViewInject(R.id.mSignRefreshLayout)
+    private SignRefreshLayout mSignRefreshLayout;
     @ViewInject(R.id.headerLV)
     @ViewInject(R.id.headerLV)
     private MyListView headerLV;
     private MyListView headerLV;
     @ViewInject(R.id.contentLV)
     @ViewInject(R.id.contentLV)
     private MyListView contentLV;
     private MyListView contentLV;
 
 
-    private Activity mContext;
+    private View signView;
+    private ImageButton itemSignImage;
+    private AppCompatTextView itemWorkTv;
+    private AppCompatTextView itemOffkTv;
+
+    private BaseActivity mContext;
     private MessagePresenter presenter;
     private MessagePresenter presenter;
     private MessageAdapter mAdapter;
     private MessageAdapter mAdapter;
     private PopupWindow setWindow;
     private PopupWindow setWindow;
@@ -89,8 +108,8 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
     @Override
     @Override
     public void onAttach(Context context) {
     public void onAttach(Context context) {
         super.onAttach(context);
         super.onAttach(context);
-        if (context instanceof Activity) {
-            mContext = (Activity) context;
+        if (context instanceof BaseActivity) {
+            mContext = (BaseActivity) context;
         }
         }
         if (context instanceof MessagePresenter.UnReaderListener) {
         if (context instanceof MessagePresenter.UnReaderListener) {
             unReaderListener = (MessagePresenter.UnReaderListener) context;
             unReaderListener = (MessagePresenter.UnReaderListener) context;
@@ -104,6 +123,20 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
     }
     }
 
 
 
 
+    @Override
+    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+        inflater.inflate(R.menu.add_new, menu);
+        super.onCreateOptionsMenu(menu, inflater);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == R.id.add) {
+            setSignViewData();
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
     @Override
     @Override
     protected int inflateLayoutId() {
     protected int inflateLayoutId() {
         return R.layout.fragment_new_message;
         return R.layout.fragment_new_message;
@@ -111,12 +144,12 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
 
 
     @Override
     @Override
     protected void onCreateView(Bundle savedInstanceState, boolean createView) {
     protected void onCreateView(Bundle savedInstanceState, boolean createView) {
-        LogUtil.d("onCreateView:" + DateFormatUtil.long2Str(DateFormatUtil.YMD_HMS));
         if (createView) {
         if (createView) {
             ViewUtils.inject(getmRootView());
             ViewUtils.inject(getmRootView());
             platform = ApiUtils.getApiModel() instanceof ApiPlatform;
             platform = ApiUtils.getApiModel() instanceof ApiPlatform;
             initView();
             initView();
             initEvent();
             initEvent();
+            setHasOptionsMenu(true);
         }
         }
     }
     }
 
 
@@ -124,6 +157,9 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
     public void onResume() {
     public void onResume() {
         super.onResume();
         super.onResume();
         presenter.loadData();
         presenter.loadData();
+        if (!mSignRefreshLayout.isEnablePullDown()) {
+            mSignRefreshLayout.setSignShow();
+        }
     }
     }
 
 
 
 
@@ -135,13 +171,13 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
                 presenter.search(s.toString());
                 presenter.search(s.toString());
             }
             }
         });
         });
-        pullScrollView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ScrollView>() {
+        mSignRefreshLayout.setOnRefreshListener(new SignRefreshLayout.onRefreshListener() {
             @Override
             @Override
-            public void onRefresh(PullToRefreshBase<ScrollView> refreshView) {
-//                initHeaderView();
+            public void onRefresh() {
                 presenter.loadData();
                 presenter.loadData();
             }
             }
         });
         });
+
         contentLV.setOnItemClickListener(new AdapterView.OnItemClickListener() {
         contentLV.setOnItemClickListener(new AdapterView.OnItemClickListener() {
             @Override
             @Override
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
@@ -169,12 +205,56 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
 
 
 
 
     private void initView() {
     private void initView() {
-        pullScrollView.setMode(PullToRefreshBase.Mode.PULL_FROM_START);
         mAdapter = new MessageAdapter(null, mContext);
         mAdapter = new MessageAdapter(null, mContext);
         contentLV.setAdapter(mAdapter);
         contentLV.setAdapter(mAdapter);
         presenter = new MessagePresenter(mContext, this, unReaderListener);
         presenter = new MessagePresenter(mContext, this, unReaderListener);
+        signView = mSignRefreshLayout.getSignView();
+
+
+        if (signView != null) {
+            itemSignImage = signView.findViewById(R.id.itemSignImage);
+            itemWorkTv = signView.findViewById(R.id.itemWorkTv);
+            itemOffkTv = signView.findViewById(R.id.itemOffkTv);
+            itemSignImage.setOnClickListener(this);
+        }
     }
     }
 
 
+    public void showProgress() {
+        if (mContext != null && mContext.progressDialog != null) {
+            mContext.progressDialog.show();
+        }
+    }
+
+    private void setSignViewData() {
+        if (mContext != null && mContext.progressDialog != null) {
+            mContext.progressDialog.dismiss();
+        }
+        WorkModel work = presenter.getCurrentWork();
+        if (work != null) {
+            if (itemWorkTv != null) {
+                if (TextUtils.isEmpty(work.getWorkSignin())) {
+                    itemWorkTv.setTextColor(getResources().getColor(R.color.message_not_sign_time));
+                    itemWorkTv.setText("未打卡(" + work.getWorkTime() + ")");
+                } else {
+                    itemWorkTv.setText(work.getWorkSignin() + ":00");
+                    itemWorkTv.setTextColor(getResources().getColor(R.color.white));
+                }
+            }
+            if (itemOffkTv != null) {
+                if (TextUtils.isEmpty(work.getOffSignin())) {
+                    itemOffkTv.setTextColor(getResources().getColor(R.color.message_not_sign_time));
+                    itemOffkTv.setText("未打卡(" + work.getOffTime() + ")");
+                } else {
+                    itemOffkTv.setText(work.getOffSignin() + ":00");
+                    itemOffkTv.setTextColor(getResources().getColor(R.color.white));
+                }
+            }
+            mSignRefreshLayout.setTag(work);
+            mSignRefreshLayout.setSignShow();
+        } else {
+            ToastUtil.showToast(ct, "未找到班次!!");
+        }
+    }
 
 
     private void showPopupWindow() {
     private void showPopupWindow() {
         if (setWindow == null) initPopupWindow();
         if (setWindow == null) initPopupWindow();
@@ -250,11 +330,20 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
                 break;
                 break;
 
 
             case R.id.uustep_rl:
             case R.id.uustep_rl:
-//                startActivity(new Intent(mContext, UUSportActivity.class));
                 startActivity(new Intent(mContext, UURanking.class));
                 startActivity(new Intent(mContext, UURanking.class));
-//				uustepRedtv.setVisibility(View.GONE);
                 PreferenceUtils.putBoolean(Constants.UU_STEP_RED, true);
                 PreferenceUtils.putBoolean(Constants.UU_STEP_RED, true);
                 break;
                 break;
+
+            case R.id.itemSignImage:
+                WorkModel work = null;
+                if (mSignRefreshLayout != null && mSignRefreshLayout.getTag() != null) {
+                    Object tag = mSignRefreshLayout.getTag();
+                    if (tag instanceof WorkModel) {
+                        work = (WorkModel) tag;
+                    }
+                }
+                presenter.signWork(work);
+                break;
         }
         }
 
 
     }
     }
@@ -263,8 +352,8 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
     @Override
     @Override
     public void showModel(List<BaseSortModel<Friend>> models) {
     public void showModel(List<BaseSortModel<Friend>> models) {
         sortModels(models);
         sortModels(models);
-        if (pullScrollView.isRefreshing()) {
-            pullScrollView.onRefreshComplete();
+        if (mSignRefreshLayout.isRefreshing()) {
+            mSignRefreshLayout.stopRefresh();
         }
         }
         if (mAdapter == null) {
         if (mAdapter == null) {
             mAdapter = new MessageAdapter(models, mContext);
             mAdapter = new MessageAdapter(models, mContext);
@@ -321,7 +410,7 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
             }
             }
 
 
         }
         }
-        pullScrollView.onRefreshComplete();
+        mSignRefreshLayout.stopRefresh();
     }
     }
 
 
     private boolean updateHideOrDisplay(int num, boolean isUpdated, int type) {
     private boolean updateHideOrDisplay(int num, boolean isUpdated, int type) {
@@ -395,6 +484,11 @@ public class MessageFragment extends EasyFragment implements IMessageView, View.
         }
         }
     }
     }
 
 
+    @Override
+    public void updateSign() {
+        setSignViewData();
+    }
+
 
 
     private class HeadAdapter extends BaseAdapter {
     private class HeadAdapter extends BaseAdapter {
         List<MessageHeader> models;
         List<MessageHeader> models;

+ 66 - 53
WeiChat/src/main/res/layout/fragment_new_message.xml

@@ -1,73 +1,86 @@
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:slide="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_height="match_parent"
     android:background="#ebe9e9"
     android:background="#ebe9e9"
-    xmlns:slide="http://schemas.android.com/apk/res-auto"
     android:orientation="vertical">
     android:orientation="vertical">
 
 
     <com.core.widget.VoiceSearchView
     <com.core.widget.VoiceSearchView
         android:id="@+id/voiceSearchView"
         android:id="@+id/voiceSearchView"
         android:layout_width="match_parent"
         android:layout_width="match_parent"
-        android:layout_height="48dp"/>
+        android:layout_height="48dp"
+        android:visibility="gone" />
+
+    <!--<com.handmark.pulltorefresh.library.PullToRefreshScrollView-->
+    <!--android:id="@+id/pullScrollView"-->
+    <!--slide:slideAnimationTime="200"-->
+    <!--slide:slideLeftAction="scroll"-->
+    <!--slide:slideMode="right"-->
+    <!--slide:slideRightAction="scroll"-->
+    <!--android:layout_width="match_parent"-->
+    <!--android:layout_height="match_parent"-->
+    <!--android:background="@color/transparent"-->
+    <!--android:divider="@color/item_line"-->
+    <!--android:dividerHeight="@dimen/line"-->
+    <!--slide:ptrAnimationStyle="flip"-->
+    <!--slide:ptrDrawableEnd="@drawable/default_ptr_rotate"-->
+    <!--slide:ptrDrawableStart="@drawable/default_ptr_flip"-->
+    <!--slide:ptrHeaderTextColor="@color/black"-->
+    <!--slide:ptrOverScroll="false"-->
+    <!--slide:ptrScrollingWhileRefreshingEnabled="true"-->
+    <!--slide:ptrShowIndicator="false">-->
 
 
-    <com.handmark.pulltorefresh.library.PullToRefreshScrollView
-        android:id="@+id/pullScrollView"
-        slide:slideAnimationTime="200"
-        slide:slideLeftAction="scroll"
-        slide:slideMode="right"
-        slide:slideRightAction="scroll"
+    <com.modular.appmessages.widget.SignRefreshLayout
+        android:id="@+id/mSignRefreshLayout"
         android:layout_width="match_parent"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:background="@color/transparent"
-        android:divider="@color/item_line"
-        android:dividerHeight="@dimen/line"
-        slide:ptrAnimationStyle="flip"
-        slide:ptrDrawableEnd="@drawable/default_ptr_rotate"
-        slide:ptrDrawableStart="@drawable/default_ptr_flip"
-        slide:ptrHeaderTextColor="@color/black"
-        slide:ptrOverScroll="false"
-        slide:ptrScrollingWhileRefreshingEnabled="true"
-        slide:ptrShowIndicator="false">
+        android:layout_height="match_parent">
 
 
-        <LinearLayout
+        <ScrollView
             android:layout_width="match_parent"
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:orientation="vertical">
+            android:layout_height="match_parent">
 
 
-
-            <com.core.widget.DrawableCenterTextView
-                android:id="@+id/message_net_set"
+            <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_width="match_parent"
-                android:layout_height="35dp"
-                android:background="#fcd8d8"
-                android:drawableLeft="@drawable/ic_net_noticce"
-                android:drawablePadding="10dp"
-                android:gravity="center_vertical"
-                android:text="当前网络不可用,请检查您的网络设置"
-                android:textColor="@color/black"
-                android:visibility="gone"/>
+                android:layout_height="match_parent"
+                android:orientation="vertical">
 
 
-            <com.core.widget.MyListView
-                android:id="@+id/headerLV"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:divider="@color/item_line"
-                android:dividerHeight="@dimen/line"/>
 
 
-            <View
-                android:layout_width="match_parent"
-                android:layout_height="@dimen/line"
-                android:background="@color/item_line"/>
+                <com.core.widget.DrawableCenterTextView
+                    android:id="@+id/message_net_set"
+                    android:layout_width="match_parent"
+                    android:layout_height="35dp"
+                    android:background="#fcd8d8"
+                    android:drawableLeft="@drawable/ic_net_noticce"
+                    android:drawablePadding="10dp"
+                    android:gravity="center_vertical"
+                    android:text="当前网络不可用,请检查您的网络设置"
+                    android:textColor="@color/black"
+                    android:visibility="gone" />
 
 
-            <com.core.widget.MyListView
-                android:id="@+id/contentLV"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:divider="@color/item_line"
-                android:dividerHeight="@dimen/line"/>
+                <com.core.widget.MyListView
+                    android:id="@+id/headerLV"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:divider="@color/item_line"
+                    android:dividerHeight="5dp" />
+
+                <View
+                    android:layout_width="match_parent"
+                    android:layout_height="5dp"
+                    android:background="@color/item_line" />
+
+                <com.core.widget.MyListView
+                    android:id="@+id/contentLV"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:divider="@color/item_line"
+                    android:dividerHeight="5dp" />
+
+
+            </LinearLayout>
 
 
+        </ScrollView>
+    </com.modular.appmessages.widget.SignRefreshLayout>
 
 
-        </LinearLayout>
-    </com.handmark.pulltorefresh.library.PullToRefreshScrollView>
+    <!--</com.handmark.pulltorefresh.library.PullToRefreshScrollView>-->
 </LinearLayout>
 </LinearLayout>

+ 2 - 0
WeiChat/src/main/res/values/colors.xml

@@ -328,4 +328,6 @@
     <color name="selected_day_text">#fff2f2f2</color>
     <color name="selected_day_text">#fff2f2f2</color>
     <color name="new_waitting_approvel">#F4A460</color>
     <color name="new_waitting_approvel">#F4A460</color>
 
 
+    <color name="message_not_sign_time">#8AB8D9</color>
+
 </resources>
 </resources>

+ 3 - 3
WeiChat/version.properties

@@ -1,5 +1,5 @@
-#Fri Apr 27 16:51:25 CST 2018
-debugName=164
+#Thu May 03 11:39:26 CST 2018
+debugName=184
 versionName=614
 versionName=614
-debugCode=164
+debugCode=184
 versionCode=153
 versionCode=153

+ 5 - 0
app_core/common/src/main/java/com/common/data/DateFormatUtil.java

@@ -1,5 +1,7 @@
 package com.common.data;
 package com.common.data;
 
 
+import android.text.TextUtils;
+
 import java.text.ParseException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Calendar;
@@ -43,6 +45,9 @@ public class DateFormatUtil {
     }
     }
 
 
     public static long str2Long(String time, String format) {
     public static long str2Long(String time, String format) {
+        if (TextUtils.isEmpty(time)){
+            return 0;
+        }
         SimpleDateFormat s = new SimpleDateFormat(format);
         SimpleDateFormat s = new SimpleDateFormat(format);
         try {
         try {
             return s.parse(time).getTime();
             return s.parse(time).getTime();

+ 3 - 1
app_core/common/src/main/java/com/core/utils/BaiduMapUtil.java

@@ -151,7 +151,9 @@ public class BaiduMapUtil {
                 String chche = BaiduMapUtil.getInstence().getDistance(bean.getLongitude(),
                 String chche = BaiduMapUtil.getInstence().getDistance(bean.getLongitude(),
                         bean.getLatitude(), helper.getLatitude(), helper.getLongitude());
                         bean.getLatitude(), helper.getLatitude(), helper.getLongitude());
                 dis = Float.valueOf(chche);
                 dis = Float.valueOf(chche);
-                if (dis < bean.getValidrange()) return dis;
+                if (dis < bean.getValidrange()){
+                    return dis;
+                }
             }
             }
             return 0;
             return 0;
         } catch (NumberFormatException e) {
         } catch (NumberFormatException e) {

+ 7 - 7
app_core/common/src/main/res/layout/item_message.xml

@@ -14,7 +14,7 @@
         android:layout_height="65dp"
         android:layout_height="65dp"
         android:layout_centerVertical="true">
         android:layout_centerVertical="true">
 
 
-        <ImageView
+        <de.hdodenhof.circleimageview.CircleImageView
             android:id="@+id/avatar_img"
             android:id="@+id/avatar_img"
             android:layout_width="@dimen/item_img_height"
             android:layout_width="@dimen/item_img_height"
             android:layout_height="@dimen/item_img_width"
             android:layout_height="@dimen/item_img_width"
@@ -52,8 +52,8 @@
             android:ellipsize="end"
             android:ellipsize="end"
             android:lines="1"
             android:lines="1"
             android:text="我的审批"
             android:text="我的审批"
-            android:textColor="@color/text_main"
-            android:textSize="16sp" />
+            android:textColor="#333333"
+            android:textSize="15sp" />
 
 
         <TextView
         <TextView
             android:id="@+id/time_tv"
             android:id="@+id/time_tv"
@@ -61,8 +61,8 @@
             android:layout_height="wrap_content"
             android:layout_height="wrap_content"
             android:layout_alignParentRight="true"
             android:layout_alignParentRight="true"
             android:ellipsize="end"
             android:ellipsize="end"
-            android:textColor="@color/text_hine"
-            android:textSize="14sp" />
+            android:textColor="#999999"
+            android:textSize="10sp" />
 
 
         <TextView
         <TextView
             android:id="@+id/content_tv"
             android:id="@+id/content_tv"
@@ -72,8 +72,8 @@
             android:layout_marginTop="8dp"
             android:layout_marginTop="8dp"
             android:ellipsize="end"
             android:ellipsize="end"
             android:lines="1"
             android:lines="1"
-            android:textColor="@color/text_hine"
-            android:textSize="14sp" />
+            android:textColor="#999999"
+            android:textSize="12sp" />
     </RelativeLayout>
     </RelativeLayout>
 
 
 </RelativeLayout>
 </RelativeLayout>

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

@@ -13,6 +13,7 @@ import android.text.TextUtils;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
+import com.common.LogUtil;
 import com.common.data.DateFormatUtil;
 import com.common.data.DateFormatUtil;
 import com.common.data.JSONUtil;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.data.ListUtils;
@@ -28,16 +29,21 @@ import com.core.app.MyApplication;
 import com.core.broadcast.MsgBroadcast;
 import com.core.broadcast.MsgBroadcast;
 import com.core.dao.MessageDao;
 import com.core.dao.MessageDao;
 import com.core.dao.UUHelperDao;
 import com.core.dao.UUHelperDao;
+import com.core.dao.UserDao;
+import com.core.dao.work.WorkModelDao;
 import com.core.model.Friend;
 import com.core.model.Friend;
 import com.core.model.MessageModel;
 import com.core.model.MessageModel;
 import com.core.model.OAConfig;
 import com.core.model.OAConfig;
 import com.core.model.UUHelperModel;
 import com.core.model.UUHelperModel;
+import com.core.model.User;
+import com.core.model.WorkModel;
 import com.core.model.XmppMessage;
 import com.core.model.XmppMessage;
 import com.core.net.http.http.OAHttpHelper;
 import com.core.net.http.http.OAHttpHelper;
 import com.core.net.http.http.OnHttpResultListener;
 import com.core.net.http.http.OnHttpResultListener;
 import com.core.net.http.http.Request;
 import com.core.net.http.http.Request;
 import com.core.utils.CommonUtil;
 import com.core.utils.CommonUtil;
 import com.core.utils.TimeUtils;
 import com.core.utils.TimeUtils;
+import com.core.utils.ToastUtil;
 import com.core.utils.sortlist.BaseSortModel;
 import com.core.utils.sortlist.BaseSortModel;
 import com.core.utils.sortlist.PingYinUtil;
 import com.core.utils.sortlist.PingYinUtil;
 import com.core.xmpp.dao.ChatMessageDao;
 import com.core.xmpp.dao.ChatMessageDao;
@@ -55,6 +61,7 @@ import com.modular.appmessages.model.MessageHeader;
 import com.modular.appmessages.model.SubMessage;
 import com.modular.appmessages.model.SubMessage;
 import com.modular.appmessages.presenter.imp.IMessageView;
 import com.modular.appmessages.presenter.imp.IMessageView;
 import com.modular.appmessages.util.ApprovalUtil;
 import com.modular.appmessages.util.ApprovalUtil;
+import com.modular.apputils.utils.SignUtils;
 import com.modular.apputils.utils.SwitchUtil;
 import com.modular.apputils.utils.SwitchUtil;
 import com.modular.booking.activity.services.BServiceListActivity;
 import com.modular.booking.activity.services.BServiceListActivity;
 import com.modular.booking.model.SBMenuModel;
 import com.modular.booking.model.SBMenuModel;
@@ -72,7 +79,7 @@ import java.util.Map;
 /**
 /**
  * Created by Bitliker on 2017/3/1.
  * Created by Bitliker on 2017/3/1.
  */
  */
-@Deprecated
+
 public class MessagePresenter implements OnHttpResultListener {
 public class MessagePresenter implements OnHttpResultListener {
     private final int LOAD_EMNEWS = 0x11;
     private final int LOAD_EMNEWS = 0x11;
     private final int LOAD_SUBS = 0x12;
     private final int LOAD_SUBS = 0x12;
@@ -477,11 +484,12 @@ public class MessagePresenter implements OnHttpResultListener {
                 time = "";
                 time = "";
             }
             }
         }
         }
-        String taskTime = TimeUtils.getFriendlyTimeDesc(ct, (int) (TimeUtils.f_str_2_long(time) / 1000));
+        String taskTime = TimeUtils.getFriendlyTimeDesc(ct, (int) (DateFormatUtil.str2Long(time, DateFormatUtil.YMD_HMS) / 1000));
         iMessageView.updateHeaderView(5, taskNum, subTitle, taskTime);
         iMessageView.updateHeaderView(5, taskNum, subTitle, taskTime);
         updateForUnReader();
         updateForUnReader();
     }
     }
 
 
+
     /**
     /**
      * 处理审批了相关数据
      * 处理审批了相关数据
      *
      *
@@ -611,8 +619,8 @@ public class MessagePresenter implements OnHttpResultListener {
                     detailModel.setTime(DateFormatUtil.long2Str(JSONUtil.getTime(detail, "createTime"), "yyyy-MM-dd HH:mm"));
                     detailModel.setTime(DateFormatUtil.long2Str(JSONUtil.getTime(detail, "createTime"), "yyyy-MM-dd HH:mm"));
                     detailModel.setType(type);
                     detailModel.setType(type);
                     detailModel.setHierarchy(1);
                     detailModel.setHierarchy(1);
-                    detailModel.setCaller(JSONUtil.getText(detail,"caller"));
-                    detailModel.setKeyValue(JSONUtil.getInt(detail,"keyValue"));
+                    detailModel.setCaller(JSONUtil.getText(detail, "caller"));
+                    detailModel.setKeyValue(JSONUtil.getInt(detail, "keyValue"));
                     detailModels.add(detailModel);
                     detailModels.add(detailModel);
                 }
                 }
             }
             }
@@ -900,6 +908,22 @@ public class MessagePresenter implements OnHttpResultListener {
         iMessageView.showModel(chcheShow);
         iMessageView.showModel(chcheShow);
     }
     }
 
 
+    public WorkModel getCurrentWork() {
+        List<WorkModel> workModels = WorkModelDao.getInstance().queryAuto();
+        WorkModel workModel = null;
+        String newsTime = DateFormatUtil.long2Str(DateFormatUtil.HM);
+        if (!ListUtils.isEmpty(workModels)) {
+            for (WorkModel e : workModels) {
+                if (newsTime.compareTo(e.getWorkStart()) >= 0 && newsTime.compareTo(e.getOffend()) <= 0) {
+                    workModel = e;
+                    break;
+                }
+            }
+        }
+        return workModel;
+    }
+
+
     private boolean canShowbyFilter(BaseSortModel<Friend> mode) {
     private boolean canShowbyFilter(BaseSortModel<Friend> mode) {
         if (TextUtils.isEmpty(filter) || mode.getSimpleSpell().startsWith(filter) || mode.getWholeSpell().startsWith(filter)
         if (TextUtils.isEmpty(filter) || mode.getSimpleSpell().startsWith(filter) || mode.getWholeSpell().startsWith(filter)
                 || mode.getBean().getShowName().startsWith(filter)) return true;
                 || mode.getBean().getShowName().startsWith(filter)) return true;
@@ -1033,6 +1057,26 @@ public class MessagePresenter implements OnHttpResultListener {
 
 
     private UnReaderListener unReaderListener;
     private UnReaderListener unReaderListener;
 
 
+    private SignUtils mSignUtils;
+
+    public void signWork(WorkModel work) {
+        if (mSignUtils == null) {
+            mSignUtils = new SignUtils(new SignUtils.SignListener() {
+                @Override
+                public void sign(boolean signOk, String message) {
+                    ToastUtil.showToast(ct, message);
+                    LogUtil.i("gong", "message=" + message);
+                    iMessageView.updateSign();
+                }
+            });
+        }
+        if (work == null) {
+            work = getCurrentWork();
+        }
+        iMessageView.showProgress();
+        mSignUtils.sign(isB2b, work);
+    }
+
     public interface UnReaderListener {
     public interface UnReaderListener {
         void setUnReader(int number);
         void setUnReader(int number);
 
 

+ 4 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/imp/IMessageView.java

@@ -21,4 +21,8 @@ public interface IMessageView  {
     void changeNet(boolean workConnected);
     void changeNet(boolean workConnected);
 
 
     void updateHeader(List<MessageHeader> models);
     void updateHeader(List<MessageHeader> models);
+
+    void updateSign();
+
+    void showProgress();
 }
 }

+ 16 - 7
app_modular/appmessages/src/main/java/com/modular/appmessages/widget/SignRefreshLayout.java

@@ -33,7 +33,6 @@ import com.modular.apputils.widget.EmptyRecyclerView;
 
 
 public class SignRefreshLayout extends ViewGroup {
 public class SignRefreshLayout extends ViewGroup {
     private boolean mEnablePullDown;// 是否允许下拉刷新
     private boolean mEnablePullDown;// 是否允许下拉刷新
-    private boolean mShowSign;// 是否正在显示打卡界面
     private onRefreshListener mListener;// 事件监听接口
     private onRefreshListener mListener;// 事件监听接口
 
 
     private LayoutInflater mInflater;// 布局填充器对象
     private LayoutInflater mInflater;// 布局填充器对象
@@ -159,7 +158,9 @@ public class SignRefreshLayout extends ViewGroup {
                     View child = getChildAt(0);
                     View child = getChildAt(0);
                     if (child instanceof RecyclerView) {
                     if (child instanceof RecyclerView) {
                         intercept = rvPullDownIntercept(child);
                         intercept = rvPullDownIntercept(child);
-                    } else if (child instanceof EmptyRecyclerView) {
+                    } else if (child instanceof ScrollView) {
+                        intercept = svPullDownIntercept(child);
+                    }  else if (child instanceof EmptyRecyclerView) {
                         RecyclerView recycler = ((EmptyRecyclerView) child);
                         RecyclerView recycler = ((EmptyRecyclerView) child);
                         intercept = rvPullDownIntercept(recycler);
                         intercept = rvPullDownIntercept(recycler);
                     }
                     }
@@ -180,7 +181,13 @@ public class SignRefreshLayout extends ViewGroup {
         Log.i("gong", "intercept=" + intercept);
         Log.i("gong", "intercept=" + intercept);
         return intercept;
         return intercept;
     }
     }
-
+    private boolean svPullDownIntercept(View child) {
+        boolean intercept = false;
+        if (child.getScrollY() <= 0) {
+            intercept = true;
+        }
+        return intercept;
+    }
 
 
     private boolean rvPullDownIntercept(View child) {
     private boolean rvPullDownIntercept(View child) {
         boolean intercept = false;
         boolean intercept = false;
@@ -216,7 +223,7 @@ public class SignRefreshLayout extends ViewGroup {
                                 }
                                 }
                             }
                             }
                         }
                         }
-                    } else if (mShowSign && Math.abs(getScrollY()) <= mEffectiveScroll) {
+                    } else if (!isEnablePullDown() && Math.abs(getScrollY()) <= mEffectiveScroll) {
                         scrollBy(0, dy / 2);
                         scrollBy(0, dy / 2);
                         if (Math.abs(getScrollY()) > mEffectiveScroll / 2) {
                         if (Math.abs(getScrollY()) > mEffectiveScroll / 2) {
                             updateStatus(SIGN_REFRESH);
                             updateStatus(SIGN_REFRESH);
@@ -239,7 +246,7 @@ public class SignRefreshLayout extends ViewGroup {
                                 }
                                 }
                             }
                             }
                         }
                         }
-                    } else if (mShowSign) {
+                    } else if (!isEnablePullDown()) {
                         scrollBy(0, dy / 2);
                         scrollBy(0, dy / 2);
                         if (Math.abs(getScrollY()) > mEffectiveScroll / 2) {
                         if (Math.abs(getScrollY()) > mEffectiveScroll / 2) {
                             updateStatus(SIGN_REFRESH);
                             updateStatus(SIGN_REFRESH);
@@ -399,11 +406,13 @@ public class SignRefreshLayout extends ViewGroup {
         mLayoutScroller.startScroll(0, getScrollY(), 0, -(getScrollY() - (-mEffectiveScroll)), SCROLL_SPEED);
         mLayoutScroller.startScroll(0, getScrollY(), 0, -(getScrollY() - (-mEffectiveScroll)), SCROLL_SPEED);
         setEnablePullDown(false);
         setEnablePullDown(false);
         updateStatus(SIGN_REFRESH);
         updateStatus(SIGN_REFRESH);
-        mShowSign = true;
     }
     }
 
 
+    public View getSignView() {
+        return signView;
+    }
 
 
-    private boolean isEnablePullDown() {
+    public  boolean isEnablePullDown() {
         return simplyView != null && simplyView.getVisibility() == VISIBLE;
         return simplyView != null && simplyView.getVisibility() == VISIBLE;
     }
     }
 
 

+ 7 - 5
app_modular/appmessages/src/main/res/layout/item_message_header.xml

@@ -15,7 +15,7 @@
         android:layout_height="65dp"
         android:layout_height="65dp"
         android:layout_centerVertical="true">
         android:layout_centerVertical="true">
 
 
-        <ImageView
+        <de.hdodenhof.circleimageview.CircleImageView
             android:id="@+id/headerImg"
             android:id="@+id/headerImg"
             android:layout_width="@dimen/item_img_height"
             android:layout_width="@dimen/item_img_height"
             android:layout_height="@dimen/item_img_width"
             android:layout_height="@dimen/item_img_width"
@@ -63,6 +63,8 @@
             android:layout_height="wrap_content"
             android:layout_height="wrap_content"
             android:layout_alignParentRight="true"
             android:layout_alignParentRight="true"
             android:layout_marginRight="8dp"
             android:layout_marginRight="8dp"
+            android:textColor="#999999"
+            android:textSize="10sp"
             android:visibility="gone"
             android:visibility="gone"
             />
             />
 
 
@@ -74,8 +76,8 @@
             android:ellipsize="end"
             android:ellipsize="end"
             android:lines="1"
             android:lines="1"
             android:text="会所"
             android:text="会所"
-            android:textColor="@color/text_main"
-            android:textSize="16sp"/>
+            android:textColor="#333333"
+            android:textSize="15sp"/>
 
 
 
 
         <TextView
         <TextView
@@ -88,8 +90,8 @@
             android:ellipsize="end"
             android:ellipsize="end"
             android:lines="1"
             android:lines="1"
             android:text="预约有优惠"
             android:text="预约有优惠"
-            android:textColor="@color/text_hine"
-            android:textSize="14sp"/>
+            android:textColor="#999999"
+            android:textSize="12sp"/>
     </RelativeLayout>
     </RelativeLayout>
 
 
 </RelativeLayout>
 </RelativeLayout>

+ 2 - 2
app_modular/appmessages/src/main/res/layout/refresh_sign_header.xml

@@ -6,11 +6,11 @@
     android:id="@+id/signView"
     android:id="@+id/signView"
     android:background="@drawable/bg_message_sign">
     android:background="@drawable/bg_message_sign">
 
 
-    <android.support.v7.widget.AppCompatImageView
+    <ImageButton
         android:id="@+id/itemSignImage"
         android:id="@+id/itemSignImage"
         android:layout_width="66dp"
         android:layout_width="66dp"
         android:layout_height="66dp"
         android:layout_height="66dp"
-        android:src="@drawable/ic_sign"
+        android:background="@drawable/ic_sign"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintRight_toRightOf="parent"

+ 265 - 1
app_modular/apputils/src/main/java/com/modular/apputils/utils/SignUtils.java

@@ -1,8 +1,272 @@
 package com.modular.apputils.utils;
 package com.modular.apputils.utils;
 
 
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.content.LocalBroadcastManager;
+import android.text.TextUtils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.common.LogUtil;
+import com.common.data.DateFormatUtil;
+import com.common.data.JSONUtil;
+import com.common.data.ListUtils;
+import com.common.data.StringUtil;
+import com.common.preferences.PreferenceUtils;
+import com.core.api.wxapi.ApiConfig;
+import com.core.api.wxapi.ApiUtils;
+import com.core.app.AppConfig;
+import com.core.app.MyApplication;
+import com.core.broadcast.MsgBroadcast;
+import com.core.dao.MessageDao;
+import com.core.dao.UserDao;
+import com.core.dao.WorkLocationDao;
+import com.core.dao.work.WorkModelDao;
+import com.core.model.User;
+import com.core.model.WorkModel;
+import com.core.net.http.http.OAHttpHelper;
+import com.core.net.http.http.OnHttpResultListener;
+import com.core.net.http.http.Request;
+import com.core.net.location.BdLocationHelper;
+import com.core.utils.BaiduMapUtil;
+import com.core.utils.CommonInterface;
+import com.modular.apputils.R;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static com.core.utils.CommonUtil.getSharedPreferences;
+
+
 /**
 /**
+ * 只负责判断|签到
  * Created by Bitlike on 2018/5/3.
  * Created by Bitlike on 2018/5/3.
  */
  */
 
 
-public class SignUtils {
+public class SignUtils implements OnHttpResultListener {
+    private final int LOAD_WORKLOG = 12;
+    private final int SIGNING = 11;
+    private SignListener mSignListener;
+
+    public SignUtils(SignListener mSignListener) {
+        this.mSignListener = mSignListener;
+    }
+
+    public interface SignListener {
+        void sign(boolean signOk, String message);
+    }
+
+
+    public void sign(final boolean isB2b, WorkModel model) {
+        final float dis = isSubmitAble();
+        if (dis > 0) {
+            final Bundle bundle = new Bundle();
+            bundle.putParcelable("data", model);
+            if (isB2b) {
+                signinWork(isB2b, bundle, "", dis);
+            } else {
+                CommonInterface.getInstance().getCodeByNet("CardLog", new CommonInterface.OnResultListener() {
+                    @Override
+                    public void result(boolean isOk, int result, String message) {
+                        signinWork(isB2b, bundle, message, dis);
+                    }
+                });
+            }
+        } else {
+            if (this.mSignListener != null) {
+                this.mSignListener.sign(false, StringUtil.getMessage(R.string.too_long));
+            }
+        }
+
+    }
+
+    //签到
+    private void signinWork(boolean isB2b, Bundle bunder, String code, float dis) {
+        Context ct = MyApplication.getInstance();
+        Map<String, Object> param = new HashMap<>();
+        Map<String, Object> form = new HashMap<>();
+        if (!isB2b)
+            form.put("cl_code", code);
+        String phone = MyApplication.getInstance().mLoginUser.getTelephone();
+        if (StringUtil.isEmpty(phone)) {
+            String userId = MyApplication.getInstance().mLoginUser.getUserId();
+            if (!StringUtil.isEmpty(userId)) {
+                User user = UserDao.getInstance().getUserByUserId(userId);
+                phone = user.getTelephone();
+            } else
+                phone = getSharedPreferences(MyApplication.getInstance(), "user_phone");
+        }
+        form.put("cl_phone", phone);
+        form.put("cl_emcode", getSharedPreferences(ct, "erp_username"));
+        String emname = getSharedPreferences(ct, "erp_emname");
+        if (StringUtil.isEmpty(emname)) {
+            emname = MyApplication.getInstance().mLoginUser.getNickName().trim();
+        }
+        form.put("cl_emname", emname);
+        form.put("cl_distance", dis);
+
+        boolean isp = isPlay(form);
+        if (!isp) {
+            return;//不符合打卡
+        }
+        if (isB2b) {
+            form.put("enuu", getSharedPreferences(MyApplication.getInstance().getApplicationContext(), "companyEnUu"));
+            form.put("emcode", getSharedPreferences(MyApplication.getInstance().getApplicationContext(), "b2b_uu"));
+        } else
+            param.put("caller", "CardLog");
+
+        String formStore = JSONUtil.map2JSON(form);
+        param.put("formStore", formStore);
+        param.put("emcode", getSharedPreferences(ct, "erp_username"));
+        String url = isB2b ? ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().punch_worksignin_url :
+                "mobile/saveCardLog.action";
+        if (bunder != null) {
+            bunder.putBoolean("isB2b", isB2b);
+        }
+        Request request = new Request.Bulider()
+                .setBundle(bunder)
+                .setMode(Request.Mode.POST)
+                .setParam(param)
+                .setUrl(url)
+                .setWhat(SIGNING)
+                .bulid();
+        OAHttpHelper.getInstance().requestHttp(request, this);
+
+    }
+
+    /*判断是否符合打卡*/
+    private boolean isPlay(Map<String, Object> form) {
+        try {
+            //判断是否符合打卡
+            BdLocationHelper helper = MyApplication.getInstance().getBdLocationHelper();
+            String address = helper.getAddress();
+            if (StringUtil.isEmpty(address)) {
+                address = PreferenceUtils.getString("bdaddress");
+            }
+            form.put("cl_address", address);
+            form.put("cl_location", helper.getName());
+            return true;
+
+        } catch (NullPointerException e) {
+            return false;
+        } catch (Exception e) {
+            return false;
+        }
+    }
+
+    private float isSubmitAble() {
+        //先判断网络
+        if (!MyApplication.getInstance().isNetworkActive()) {
+            if (this.mSignListener != null) {
+                this.mSignListener.sign(false, StringUtil.getMessage(R.string.networks_out));
+            }
+            return -1;
+        }
+        //判断位置
+        float dis = BaiduMapUtil.getInstence().getDistance();
+        return dis;
+    }
+
+    //获取打卡记录
+    private void loadLog(Bundle bunder) {
+        boolean isB2b = false;
+        if (bunder != null) {
+            isB2b = bunder.getBoolean("isB2b");
+        }
+        String date = DateFormatUtil.long2Str(DateFormatUtil.YMD);
+        //获取网络数据
+        Map<String, Object> param = new HashMap<>();
+        String code = getSharedPreferences(MyApplication.getInstance(), "erp_username");
+        param.put("currentMaster", getSharedPreferences(MyApplication.getInstance(), "erp_master"));
+        if (isB2b) {
+            param.put("pageNumber", 1);
+            param.put("date", DateFormatUtil.long2Str(System.currentTimeMillis(), "yyyyMMdd"));
+        } else {
+            param.put("page", 1);
+            param.put("condition", "cl_emcode='" + code + "' and to_char(cl_time,'yyyy-MM-dd')='" + date + "'");
+        }
+        param.put("pageSize", 100);
+        param.put("caller", "CardLog");
+        param.put("emcode", code);
+        param.put("master", getSharedPreferences(MyApplication.getInstance(), "erp_master"));
+
+        String url = isB2b ? ApiConfig.getInstance(ApiUtils.getApiModel()).getmApiBase().punch_record_url :
+                "mobile/oa/workdata.action";
+        Request request = new Request.Bulider()
+                .setBundle(bunder)
+                .setMode(Request.Mode.GET)
+                .setParam(param)
+                .setUrl(url)
+                .setWhat(LOAD_WORKLOG)
+                .bulid();
+        OAHttpHelper.getInstance().requestHttp(request, this);
+    }
+
+    @Override
+    public void result(int what, boolean isJSON, String message, Bundle bundle) {
+        try {
+            switch (what) {
+                case SIGNING:
+                    loadLog(bundle);
+                    break;
+                case LOAD_WORKLOG:
+                    if (isJSON && JSON.parseObject(message).containsKey("listdata")) {
+                        saveSignin2DB(bundle, JSON.parseObject(message).getJSONArray("listdata"));
+                    }
+                    break;
+            }
+        } catch (Exception e) {
+            if (this.mSignListener != null && e != null) {
+                this.mSignListener.sign(false, "e=" + e.getMessage());
+            }
+        }
+    }
+
+    @Override
+    public void error(int what, String message, Bundle bundle) {
+        if (this.mSignListener != null && message != null) {
+            this.mSignListener.sign(false, message);
+        }
+    }
+
+    //保存到数据库
+    private void saveSignin2DB(Bundle bundle, JSONArray array) throws Exception {
+        WorkModel model = null;
+        if (bundle != null && bundle.getParcelable("data") != null) {
+            model = bundle.getParcelable("data");
+        }
+        if (model == null) {
+            LogUtil.i("model == null");
+            List<WorkModel> models = WorkModelDao.getInstance().query(false);
+            if (ListUtils.isEmpty(models)) return;
+            String time = DateFormatUtil.long2Str(System.currentTimeMillis(), "HH:mm");
+            for (WorkModel m : models) {
+                //当前时间位于该班次之间
+                if (m.getWorkStart().compareTo(time) < 0 && m.getOffend().compareTo(time) > 0) {
+                    model = m;
+                    break;
+                }
+            }
+        }
+        //取最后一个
+        JSONObject object = array.getJSONObject(array.size() - 1);
+        String time = object.getString("cl_time");//获取最后一次打卡信息,班次打卡信息
+        time = DateFormatUtil.long2Str(DateFormatUtil.str2Long(time, DateFormatUtil.YMD_HMS), DateFormatUtil.HM);//获取到的
+        if (StringUtil.isEmpty(time) || model == null) return;
+        if (StringUtil.isEmpty(model.getWorkSignin()) && model.getWorkStart().compareTo(time) <= 0
+                && model.getWorkTime().compareTo(time) >= 0) {
+            model.setWorkSignin(time);
+            WorkModelDao.getInstance().update(model);
+        } else if (StringUtil.isEmpty(model.getOffSignin()) && model.getOffTime().compareTo(time) <= 0
+                && model.getOffend().compareTo(time) >= 0) {
+            model.setOffSignin(time);
+            WorkModelDao.getInstance().update(model);
+        }
+        if (this.mSignListener != null) {
+            this.mSignListener.sign(true, "打卡成功");
+        }
+    }
 }
 }

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

@@ -99,11 +99,6 @@ public class AutoErpSigninUitl implements OnHttpResultListener {
             CommonUtil.saveAutoLogtoLocal(getString(R.string.auto_sign_failed), getString(R.string.common_notlinknet));
             CommonUtil.saveAutoLogtoLocal(getString(R.string.auto_sign_failed), getString(R.string.common_notlinknet));
             return;
             return;
         }
         }
-        String macAddress = SystemUtil.getMac(MyApplication.getInstance());
-        if (StringUtil.isEmpty(macAddress)) {
-            CommonUtil.saveAutoLogtoLocal(getString(R.string.auto_sign_failed), "未获取到mac地址");
-            return;
-        }
         final Bundle bundle = new Bundle();
         final Bundle bundle = new Bundle();
         bundle.putParcelable("data", model);
         bundle.putParcelable("data", model);
         if (isB2b) {
         if (isB2b) {