Procházet zdrojové kódy

Merge branch 'developer' of https://gitlab.com/Arisono/SkWeiChat-Baidu into gitlab_developer

Arison před 9 roky
rodič
revize
a8a91f74dc

+ 4 - 4
WeiChat/build.gradle

@@ -3,12 +3,12 @@ apply plugin: 'com.getkeepsafe.dexcount'
 
 android {
     signingConfigs {
-     /*   config {
+        config {
             keyPassword '13237658359'
             storeFile file('D:/config/applicationsignname[20150409]')
             storePassword '13237658359'
             keyAlias 'jie-20150409'
-        }*/
+        }
     }
     compileSdkVersion 22
     buildToolsVersion "22.0.1"
@@ -31,9 +31,9 @@ android {
             minifyEnabled false
             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
         }
-        /* debug {
+      debug {
             signingConfig signingConfigs.config
-        }*/
+        }
     }
 }
 

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/BdLocationHelper.java

@@ -45,7 +45,7 @@ public class BdLocationHelper {
         option.setNeedDeviceDirect(false);
         option.setOpenGps(true);//可选,默认false,设置是否使用gps
         mLocationClient.setLocOption(option);
-        requestLocation();
+        requestLocation();//重新定位
 
 
     }

+ 1 - 3
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/account/LoginActivity.java

@@ -2,7 +2,6 @@ package com.xzjmyk.pm.activity.ui.account;
 
 import android.app.ProgressDialog;
 import android.content.DialogInterface;
-import android.content.Intent;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
@@ -18,7 +17,6 @@ import com.xzjmyk.pm.activity.MyApplication;
 import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.bean.LoginRegisterResult;
 import com.xzjmyk.pm.activity.helper.LoginHelper;
-import com.xzjmyk.pm.activity.ui.MainActivity;
 import com.xzjmyk.pm.activity.ui.base.BaseActivity;
 import com.xzjmyk.pm.activity.ui.erp.net.ViewUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.Constants;
@@ -122,7 +120,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
 //            login_manage(phoneNumber, password);//登录管理平台
 //            return;
 //        }
-       
+
         // 加密之后的密码
         final String digestPwd = new String(Md5Util.toMD5(password));
         final String requestTag = "login";

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

@@ -51,23 +51,21 @@ public class AddLogActivity extends BaseActivity {
         findViewById(R.id.release_btn).setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
-                //TODO 发表工作日志
                 sendAble();
             }
         });
     }
-
     private void sendAble() {
         Log.i("gongpengming", "判断是否能发表日志能力");
         StringBuilder builder = new StringBuilder();
         if (sum_tv.getText().toString().length() > 0) {
-            builder.append("工作总结:\n" + sum_tv.getText().toString()+"\n");
+            builder.append("工作总结:\n" + sum_tv.getText().toString() + "\n");
         }
         if (plan_tv.getText().toString().length() > 0) {
-            builder.append("工作计划:\n" + plan_tv.getText().toString()+"\n");
+            builder.append("工作计划:\n" + plan_tv.getText().toString() + "\n");
         }
         if (learned_tv.getText().toString().length() > 0) {
-            builder.append("心得体会:\n" + learned_tv.getText().toString()+"\n");
+            builder.append("心得体会:\n" + learned_tv.getText().toString() + "\n");
         }
         sendWorkLog(builder.toString());
     }

+ 10 - 13
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/oa/LocationMapActivity.java

@@ -2,8 +2,6 @@ package com.xzjmyk.pm.activity.ui.erp.activity.oa;
 
 import android.content.Intent;
 import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuItem;
@@ -17,6 +15,7 @@ import android.widget.TextView;
 import com.baidu.mapapi.map.MapView;
 import com.baidu.mapapi.model.LatLng;
 import com.baidu.mapapi.search.core.PoiInfo;
+import com.baidu.mapapi.search.core.SearchResult;
 import com.baidu.mapapi.search.poi.OnGetPoiSearchResultListener;
 import com.baidu.mapapi.search.poi.PoiDetailResult;
 import com.baidu.mapapi.search.poi.PoiIndoorResult;
@@ -44,17 +43,7 @@ public class LocationMapActivity extends BaseActivity implements OnGetPoiSearchR
     private LocationMapAdapter adapter;
     private int selectItem = 0;
     private PoiInfo myPoInfo;
-    private int what = 0x12;
     private int location;
-    private Handler handler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            if (msg.what == what) {
-                PoiResult poiResult = msg.getData().getParcelable("data");
-                updataByHandle(poiResult);
-            }
-        }
-    };
     private LatLng point;
 
     @Override
@@ -64,7 +53,14 @@ public class LocationMapActivity extends BaseActivity implements OnGetPoiSearchR
         location = getIntent().getIntExtra("data", 500);
         init();
         initView();
-        BaiduMapUtil.getInstence().getNearInfo(location, 0, point, mPoiSearch, handler, what);
+        BaiduMapUtil.getInstence().getNearInfo(location, 0, point, mPoiSearch, new BaiduMapUtil.OnNeerPoiListener() {
+            @Override
+            public void result(SearchResult result) {
+//                PoiResult poiResult = msg.getData().getParcelable("data");
+                if (result instanceof PoiResult)
+                    updataByHandle((PoiResult) result);
+            }
+        });
     }
 
     private void initView() {
@@ -197,6 +193,7 @@ public class LocationMapActivity extends BaseActivity implements OnGetPoiSearchR
     public boolean onOptionsItemSelected(MenuItem item) {
         switch (item.getItemId()) {
             case R.id.save:   //点击保存返回数据
+                //TODO 测试数据,修改
                 Intent intent = new Intent();
                 intent.putExtra(REQUESTNAME, listData.get(selectItem));
                 setResult(REQUCODE, intent);

+ 72 - 52
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/oa/MeetDetailsActivity.java

@@ -8,6 +8,8 @@ import android.util.Log;
 import android.view.View;
 import android.widget.TextView;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.lidroid.xutils.ViewUtils;
 import com.lidroid.xutils.view.annotation.ViewInject;
 import com.xzjmyk.pm.activity.R;
@@ -16,13 +18,10 @@ import com.xzjmyk.pm.activity.bean.oa.MeetingDocBean;
 import com.xzjmyk.pm.activity.ui.base.BaseActivity;
 import com.xzjmyk.pm.activity.ui.erp.net.ViewUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.CommonUtil;
-import com.xzjmyk.pm.activity.ui.erp.view.CustomerListView;
+import com.xzjmyk.pm.activity.util.BaiduMapUtil;
 import com.xzjmyk.pm.activity.util.TimeUtils;
 import com.xzjmyk.pm.activity.util.ToastUtil;
 
-import org.json.JSONException;
-import org.json.JSONObject;
-
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -44,12 +43,11 @@ public class MeetDetailsActivity extends BaseActivity implements View.OnClickLis
     private TextView oa_meeting_start_date;
     @ViewInject(R.id.status_tv)
     private TextView status_tv;
-
-
-    private CustomerListView meet_listview;
-    private final int whatLoad = 0x11;
-    private final int whatEndMeet = 0x12;
-    private final int doMeet = 0x13;
+    @ViewInject(R.id.location_tv)
+    private TextView location_tv;
+    @ViewInject(R.id.num_tv)
+    private TextView num_tv;
+    private final int whatLoad = 0x11, SIGNNIN = 0x12, ENDMEET = 0x13;
     private int ma_id;
     private String ma_code;
     private JSONObject object;
@@ -61,13 +59,8 @@ public class MeetDetailsActivity extends BaseActivity implements View.OnClickLis
             Log.i("gongpengming", message);
             switch (msg.what) {
                 case whatLoad:
-                    try {
-                        JSONObject json = new JSONObject(message);
-                        object = json.getJSONObject("panelData");
-                        updataUI();
-                    } catch (JSONException e) {
-                        e.printStackTrace();
-                    }
+                    object = JSON.parseObject(message).getJSONObject("panelData");
+                    updataUI();
                     break;
                 case ENDMEET:
                     ToastUtil.showToast(ct, "会议结束成功");
@@ -78,6 +71,12 @@ public class MeetDetailsActivity extends BaseActivity implements View.OnClickLis
                     ToastUtil.showToast(ct, "会议签到成功");
                     Log.i("gongpengming", "what==doMeet");
                     break;
+                case 0x14:
+                    JSONObject numlist = JSON.parseObject(message).getJSONObject("participants");
+                    int confirmed = numlist.getJSONArray("confirmed").size();
+                    int unconfirmed = numlist.getJSONArray("unconfirmed").size();
+                    num_tv.setText("当前签到人数:" + confirmed + "/" + (confirmed + unconfirmed));
+                    break;
             }
         }
     };
@@ -93,54 +92,65 @@ public class MeetDetailsActivity extends BaseActivity implements View.OnClickLis
             ma_id = entity.getMa_id();
             ma_code = entity.getMa_code();
         }
-        loadNetData();
+        loadNetData(whatLoad);
+        loadNetData(0x14);
         initView();
     }
 
     private void initView() {
-        meet_listview = (CustomerListView) findViewById(R.id.meet_listview);
+        BaiduMapUtil.getInstence().getPoiInfo(ct, new BaiduMapUtil.OnLocationListener() {
+            @Override
+            public void result(Map<String, Object> map) {
+                progressDialog.dismiss();
+                if (map == null || map.isEmpty()) return;
+                if (map.get("poi") == null) return;
+                location_tv.setText(map.get("poi") + "");
+            }
+        });
         findViewById(R.id.meet_save).setOnClickListener(this);
-        findViewById(R.id.click_find).setOnClickListener(this);
+        findViewById(R.id.num_tag).setOnClickListener(this);
         findViewById(R.id.end_meet_tv).setOnClickListener(this);
         findViewById(R.id.click_btn).setOnClickListener(this);
+        findViewById(R.id.location_tag).setOnClickListener(this);
     }
 
     String baseUrl;
 
     private void updataUI() {
         if (object == null) return;
-        try {
-            name_tv.setText(object.getString("ma_theme"));
-            addr_tv.setText(object.getString("mr_site"));
-            user_tv.setText(object.getString("ma_recorder"));
-            long startLongTime = TimeUtils.f_str_2_long(entity.getMa_starttime());
-            oa_meeting_start.setText(TimeUtils.long2str(startLongTime, "MM月dd"));
-            oa_meeting_start_date.setText(TimeUtils.long2str(startLongTime, "HH:mm"));
-            String str;
-            long endLongTime = TimeUtils.f_str_2_long(entity.getMa_endtime());
-            oa_meeting_end.setText(TimeUtils.long2str(startLongTime, "MM月dd"));
-            oa_meeting_end_date.setText(TimeUtils.long2str(startLongTime, "HH:mm"));
-            if (System.currentTimeMillis() < startLongTime) {
-                str = "会议未开始";
-            } else if (System.currentTimeMillis() < endLongTime) {
-                str = "会议进行中";
-            } else {
-                str = "会议已结束";
-            }
-            status_tv.setText(str);
-        } catch (JSONException e) {
-            e.printStackTrace();
+        name_tv.setText(object.getString("ma_theme"));
+        addr_tv.setText(object.getString("mr_site"));
+        user_tv.setText(object.getString("ma_recorder"));
+        long startLongTime = TimeUtils.f_str_2_long(entity.getMa_starttime());
+        oa_meeting_start.setText(TimeUtils.long2str(startLongTime, "MM月dd"));
+        oa_meeting_start_date.setText(TimeUtils.long2str(startLongTime, "HH:mm"));
+        String str;
+        long endLongTime = TimeUtils.f_str_2_long(entity.getMa_endtime());
+        oa_meeting_end.setText(TimeUtils.long2str(startLongTime, "MM月dd"));
+        oa_meeting_end_date.setText(TimeUtils.long2str(startLongTime, "HH:mm"));
+        if (System.currentTimeMillis() < startLongTime) {
+            str = "会议未开始";
+        } else if (System.currentTimeMillis() < endLongTime) {
+            str = "会议进行中";
+        } else {
+            str = "会议已结束";
         }
+        status_tv.setText(str);
     }
 
-    //获取网络数据
-    private void loadNetData() {
+    //下拉页面数据
+    private void loadNetData(int type) {
         progressDialog.show();
         //获取网络数据
         if (baseUrl == null) {
             baseUrl = CommonUtil.getSharedPreferences(this, "erp_baseurl");
         }
-        String url = baseUrl + "mobile/common/getPanel.action";
+        String url = null;
+        if (type == whatLoad) {
+            url = baseUrl + "mobile/crm/getMeetingDetailParticipants.action";
+        } else {
+            url = baseUrl + "mobile/common/getPanel.action";
+        }
         String em_code = CommonUtil.getSharedPreferences(ct, "erp_username");
         String sessionId = CommonUtil.getSharedPreferences(ct, "sessionId");
         final Map<String, Object> param = new HashMap<>();
@@ -149,19 +159,19 @@ public class MeetDetailsActivity extends BaseActivity implements View.OnClickLis
         param.put("emcode", em_code);
         param.put("formCondition", "ma_id=" + ma_id);
         param.put("gridCondition", "ma_id=" + ma_id);
+        if (type != whatLoad)
+            param.put("ma_code", ma_code);
         param.put("sessionId", sessionId);
         Log.i("gongpengming", url + "?emcode=" + em_code + "sessionId=" + sessionId);
         LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
         headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
-        ViewUtil.httpSendRequest(ct, url, param, handler, headers, whatLoad, null, null, "post");
+        ViewUtil.httpSendRequest(ct, url, param, handler, headers, type, null, null, "post");
     }
 
-    private final int SIGNNIN = 0x1, ENDMEET = 0x2;
-
     /**
      * 提交接口(结束会议、会议签到、为与会成员加 日程)
      *
-     * @param type 接口类型
+     * @param type 接口类型  签到 SIGNNIN、结束会议:ENDMEET
      */
     private void doNetSubmit(int type) {
         progressDialog.show();
@@ -177,7 +187,6 @@ public class MeetDetailsActivity extends BaseActivity implements View.OnClickLis
             case ENDMEET:
                 urlSub = "mobile/crm/updateMeeting.action";//结束会议
                 break;
-
         }
         String url = baseUrl + urlSub;
         String em_code = CommonUtil.getSharedPreferences(ct, "erp_username");
@@ -189,7 +198,6 @@ public class MeetDetailsActivity extends BaseActivity implements View.OnClickLis
             param.put("caller", caller);
         param.put("ma_id", ma_id);
         param.put("sessionId", sessionId);
-        Log.i("gongpengming", url + "?emcode=" + em_code + "sessionId=" + sessionId);
         LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
         headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
         ViewUtil.httpSendRequest(ct, url, param, handler, headers, type, null, null, "post");
@@ -199,7 +207,7 @@ public class MeetDetailsActivity extends BaseActivity implements View.OnClickLis
     @Override
     public void onClick(View view) {
         switch (view.getId()) {
-            case R.id.click_find:
+            case R.id.num_tag:
                 Intent intent = new Intent(MeetDetailsActivity.this, OARegisterActivity.class);
                 intent.putExtra("code", ma_code);
                 intent.putExtra("id", ma_code);
@@ -210,7 +218,7 @@ public class MeetDetailsActivity extends BaseActivity implements View.OnClickLis
                 Intent data = new Intent(ct, SaveMeetActivity.class);
                 bean.setMd_recorder(user_tv.getText().toString());
                 bean.setMd_recorderdate("");
-                bean.setMd_status("录入");
+                bean.setMd_status("录入");
                 bean.setMd_title(name_tv.getText().toString());
                 bean.setMd_mtname("");
                 bean.setMd_meetingname("");
@@ -233,6 +241,18 @@ public class MeetDetailsActivity extends BaseActivity implements View.OnClickLis
             case R.id.click_btn:
                 doNetSubmit(SIGNNIN);
                 break;
+            case R.id.location_tag://点击重新定位
+                progressDialog.show();
+                BaiduMapUtil.getInstence().getPoiInfo(ct, new BaiduMapUtil.OnLocationListener() {
+                    @Override
+                    public void result(Map<String, Object> map) {
+                        progressDialog.dismiss();
+                        if (map == null || map.isEmpty()) return;
+                        if (map.get("poi") == null) return;
+                        location_tv.setText(map.get("poi") + "");
+                    }
+                });
+                break;
         }
     }
 

+ 72 - 46
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/oa/WorkLogsActivity.java

@@ -4,15 +4,17 @@ import android.content.Intent;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
+import android.text.Editable;
 import android.text.TextUtils;
+import android.text.TextWatcher;
 import android.util.Log;
-import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuItem;
-import android.view.View;
 import android.widget.ListView;
 
 import com.alibaba.fastjson.JSON;
+import com.handmark.pulltorefresh.library.PullToRefreshBase;
+import com.handmark.pulltorefresh.library.PullToRefreshListView;
 import com.xzjmyk.pm.activity.MyApplication;
 import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.adapter.WorkLogAdapter;
@@ -20,8 +22,8 @@ import com.xzjmyk.pm.activity.bean.circle.Comment;
 import com.xzjmyk.pm.activity.bean.circle.PublicMessage;
 import com.xzjmyk.pm.activity.ui.base.BaseActivity;
 import com.xzjmyk.pm.activity.ui.erp.net.ViewUtil;
+import com.xzjmyk.pm.activity.view.ClearEditText;
 import com.xzjmyk.pm.activity.view.PMsgBottomView;
-import com.xzjmyk.pm.activity.view.SuperSwipeRefreshLayout;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -36,9 +38,8 @@ import java.util.regex.Pattern;
 public class WorkLogsActivity extends BaseActivity {
     private static final int PAGER_SIZE = 10;
     private WorkLogsActivity ct;
-    private SuperSwipeRefreshLayout root_view;
-    private ListView context_rv;
     private List<PublicMessage> mMessages;//消息对象
+    private List<PublicMessage> messages;//消息对象
     private PMsgBottomView bottom_view;
     private CommentItemChche itemChche;
     private static int requestCode = 0x21;
@@ -54,7 +55,19 @@ public class WorkLogsActivity extends BaseActivity {
             String message = msg.getData().getString("result");
             switch (msg.what) {
                 case LOAD_WHAT:
-                    mMessages = JSON.parseArray(JSON.parseObject(message).getJSONArray("data").toString(), PublicMessage.class);
+                    if (mMessages == null) {
+                        mMessages = new ArrayList<>();
+                    }
+                    if (messages == null) {
+                        messages = new ArrayList<>();
+                    }
+                    if (isRefersh) {
+                        mMessages.clear();
+                        messages.clear();
+                    }
+                    context_rv.setRefreshing(false);
+                    mMessages.addAll(JSON.parseArray(JSON.parseObject(message).getJSONArray("data").toString(), PublicMessage.class));
+                    messages.addAll(JSON.parseArray(JSON.parseObject(message).getJSONArray("data").toString(), PublicMessage.class));
                     upDataUi();
                     break;
                 case ADD_WHAT:
@@ -71,6 +84,8 @@ public class WorkLogsActivity extends BaseActivity {
             }
         }
     };
+    private ClearEditText search_edit;
+    private PullToRefreshListView context_rv;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -102,34 +117,36 @@ public class WorkLogsActivity extends BaseActivity {
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         if (requestCode == this.requestCode) {
             if (resultCode == this.resultCode) {
-                requestSpace();
+                requestSpace(true);
             }
         }
     }
 
     //获取数据后更新界面
     private void upDataUi() {
-        mAdapter.setData(mMessages);
+        mAdapter.setData(messages);
         mAdapter.notifyDataSetChanged();
     }
 
-    private static void getStrings() {
-        String str = "rrwerqq84461376qqasfdasdfrrwerqq84461377qqasfdasdaa654645aafrrwerqq84461378qqasfdaa654646aaasdfrrwerqq84461379qqasfdasdfrrwerqq84461376qqasfdasdf";
-        Pattern p = Pattern.compile("qq(.*?)qq");
-        Matcher m = p.matcher(str);
-        ArrayList<String> strs = new ArrayList<String>();
-        while (m.find()) {
-            strs.add(m.group(1));
-        }
-        for (String s : strs){
-           Log.i("gongepngming",s);
-        }
+    //正则
+    private static boolean getResult(String text, String str) {
+        Pattern p = Pattern.compile(str);
+        Matcher m = p.matcher(text);
+//        ArrayList<String> strs = new ArrayList<String>();
+        return m.find();
+//        while (m.find()) {
+//            strs.add(m.group(1));
+//        }
+//        for (String s : strs) {
+//            Log.i("gongepngming", s);
+//        }
     }
+
     private void initView() {
         bottom_view = (PMsgBottomView) findViewById(R.id.bottom_view);
-        root_view = (SuperSwipeRefreshLayout) findViewById(R.id.root_view);
-        context_rv = (ListView) findViewById(R.id.context_rv);
-        root_view.setHeaderView(getHeaderView());
+        search_edit = (ClearEditText) findViewById(R.id.search_edit);
+        context_rv = (PullToRefreshListView) findViewById(R.id.context_rv);
+        context_rv.setMode(PullToRefreshBase.Mode.BOTH);
         bottom_view.setPMsgBottomListener(new PMsgBottomView.PMsgBottomListener() {
             @Override
             public void sendText(String text) {
@@ -140,25 +157,42 @@ public class WorkLogsActivity extends BaseActivity {
                 bottom_view.hide();
             }
         });
-        //下拉刷新,上拉加载控件
-        root_view.setOnPullRefreshListener(new SuperSwipeRefreshLayout.OnPullRefreshListener() {
+        search_edit.addTextChangedListener(new TextWatcher() {
+            @Override
+            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
+            }
+
             @Override
-            public void onRefresh() {
-                //TODO 开始刷新
-                Log.i("gongpengming", "onRefresh");
+            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
+
             }
 
             @Override
-            public void onPullDistance(int distance) {
-                //TODO 下拉距离
-                Log.i("gongpengming", "onPullDistance=" + distance);
+            public void afterTextChanged(Editable editable) {
+                String strChche = editable.toString();
+                //TODO 正则
+                messages.clear();
 
+                for (PublicMessage e : mMessages) {
+                    boolean b = getResult(e.getNickName() + e.getBody().getText(), strChche);
+                    if (b) {
+                        messages.add(e);
+                    }
+                }
+                mAdapter.setData(messages);
+                mAdapter.notifyDataSetChanged();
+            }
+        });
+        context_rv.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
+            @Override
+            public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
+                requestSpace(true);
             }
 
             @Override
-            public void onPullEnable(boolean enable) {
-                //TODO 下拉过程中,下拉的距离是否足够出发刷新
-                Log.i("gongpengming", "enable=" + enable);
+            public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
+                requestSpace(false);
             }
         });
         if (mMessages == null)
@@ -182,31 +216,23 @@ public class WorkLogsActivity extends BaseActivity {
     }
 
     private void initData() {
-        requestSpace();
+        requestSpace(true);
     }
 
-    /**
-     * 获取头视图
-     *
-     * @return
-     */
-    private View getHeaderView() {
-        View headerView = LayoutInflater.from(ct).inflate(R.layout.space_cover_view, null);
-        //TODO 对于头视图的操作
-        return headerView;
-    }
+    private boolean isRefersh = false;
 
     /**
      * 获取工作日志(朋友圈)数据接口
      */
-    private void requestSpace() {
+    private void requestSpace(boolean isRefersh) {
+        this.isRefersh = isRefersh;
         //参数
         HashMap<String, Object> params = new HashMap<>();
         params.put("access_token", MyApplication.getInstance().mAccessToken);
         params.put("userId", MyApplication.getInstance().mLoginUser.getUserId());
         params.put("flag", PublicMessage.FLAG_APPLY_JOB);
         String messageId = null;
-        if (mMessages.size() > 0) {
+        if (!isRefersh && mMessages.size() > 0) {//不是
             messageId = mMessages.get(mMessages.size() - 1).getMessageId();
         }
         if (!TextUtils.isEmpty(messageId)) {

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

@@ -1,6 +1,7 @@
 package com.xzjmyk.pm.activity.ui.erp.fragment;
 
 import android.content.Intent;
+import android.os.AsyncTask;
 import android.os.Bundle;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -34,7 +35,6 @@ public class OutofficeFragment extends EasyFragment implements View.OnClickListe
     private LatLng point;//位置
     private static int requestCode = 0x11;
     private int sigNum;//签到次数
-
     @ViewInject(R.id.num_tv)
     private TextView num_tv; //签到次数
     @ViewInject(R.id.out_add_name_tv)
@@ -87,12 +87,14 @@ public class OutofficeFragment extends EasyFragment implements View.OnClickListe
 
     private void initview() {
         num_tv.setText("" + sigNum);
+        String name = MyApplication.getInstance().mLoginUser.getNickName();
+        name_img.setText(name.substring(0, 1));
         name_tv.setText(MyApplication.getInstance().mLoginUser.getNickName());
         com_tv.setText(CommonUtil.getSharedPreferences(ct, "erp_commpany"));
         long timeLong = System.currentTimeMillis();
         date_tag.setText(TimeUtils.getWeek(timeLong) + ":");//星期
         out_date_tv.setText(TimeUtils.s_long_2_str(timeLong));//日期
-        out_time_tv.setText(TimeUtils.long2str(timeLong, "HH:mm"));//时间点
+        timeTask.execute();
         BdLocationHelper locationHelper = MyApplication.getInstance().getBdLocationHelper();
         double latitude = locationHelper.getLatitude();
         double longitude = locationHelper.getLongitude();
@@ -105,6 +107,33 @@ public class OutofficeFragment extends EasyFragment implements View.OnClickListe
 
     }
 
+    private AsyncTask<Void, Void, Void> timeTask = new AsyncTask() {
+        @Override
+        protected Object doInBackground(Object[] objects) {
+            try {
+                while (true) {
+                    Thread.sleep(1000);
+                    publishProgress();
+                }
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            return false;
+        }
+
+        @Override
+        protected void onPreExecute() {
+            super.onPreExecute();
+            out_time_tv.setText(TimeUtils.long2str(System.currentTimeMillis(), "HH:mm:ss"));//时间点
+        }
+
+        @Override
+        protected void onProgressUpdate(Object[] values) {
+            super.onProgressUpdate(values);
+            out_time_tv.setText(TimeUtils.long2str(System.currentTimeMillis(), "HH:mm:ss"));//时间点
+        }
+    };
+
     @Override
     public void onClick(View view) {
         switch (view.getId()) {

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

@@ -6,7 +6,6 @@ import android.content.Intent;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
-import android.util.Log;
 import android.view.Gravity;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -246,7 +245,7 @@ public class SigninFragment extends EasyFragment {
     private void sendHandle(long distance) {
         Message message = handler.obtainMessage();
         message.what = thrad;
-        Log.i("gongpengming", "distance=" + distance);
+
         int d = (int) distance / 1000;
         int h = d / 3600;
         int m = (d % 3600) / 60;
@@ -326,6 +325,7 @@ public class SigninFragment extends EasyFragment {
         String url = baseUrl + "mobile/saveCardLog.action";
         final Map<String, Object> param = new HashMap<>();
         SigninBean bean = new SigninBean();
+
         bean.setCl_code(code);
         bean.setCl_address(office_addr.getText().toString());
         bean.setCl_distance(300);
@@ -335,6 +335,7 @@ public class SigninFragment extends EasyFragment {
         bean.setCl_emname(MyApplication.getInstance().mLoginUser.getNickName());
         bean.setCl_phone(MyApplication.getInstance().mLoginUser.getTelephone());
         String formStore = FlexJsonUtil.toJson(bean);
+
         String caller = "CardLog";
         param.put("caller", caller);
         param.put("formStore", formStore);

+ 135 - 76
WeiChat/src/main/java/com/xzjmyk/pm/activity/util/BaiduMapUtil.java

@@ -1,12 +1,12 @@
 package com.xzjmyk.pm.activity.util;
 
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
+import android.content.Context;
 
 import com.baidu.location.BDLocation;
 import com.baidu.location.BDLocationListener;
+import com.baidu.location.LocationClient;
+import com.baidu.location.LocationClientOption;
+import com.baidu.location.Poi;
 import com.baidu.mapapi.map.BitmapDescriptor;
 import com.baidu.mapapi.map.BitmapDescriptorFactory;
 import com.baidu.mapapi.map.MapStatus;
@@ -28,17 +28,17 @@ import com.baidu.mapapi.utils.DistanceUtil;
 import com.xzjmyk.pm.activity.R;
 
 import java.text.DecimalFormat;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 百度地图工具类(重复代码过多,放在工具类中)
  * Created by gongpm on 2016/7/15.
  */
-public class BaiduMapUtil implements OnGetPoiSearchResultListener {
+public class BaiduMapUtil {
     private static BaiduMapUtil instence = null;
-    private Handler handler;
     private PoiNearbySearchOption option;
-    public static int NEAR_WHAT = 0x22;
-    private int what = -1;
 
     private BaiduMapUtil() {
     }
@@ -52,6 +52,12 @@ public class BaiduMapUtil implements OnGetPoiSearchResultListener {
         return instence;
     }
 
+    /**
+     * 设置当前地图显示位置
+     *
+     * @param mapView mapView视图控件
+     * @param point   显示位置
+     */
     public void setMapViewPoint(MapView mapView, LatLng point) {
         setMapViewPoint(mapView, point, false);
     }
@@ -75,7 +81,13 @@ public class BaiduMapUtil implements OnGetPoiSearchResultListener {
         return getDistance(a, b);
     }
 
-    //显示当前位置
+    /**
+     * 将定点显示在指定位置
+     *
+     * @param mapView 地图控件
+     * @param point   显示位置
+     * @param isClear 是否清除前面的点
+     */
     public void setMapViewPoint(MapView mapView, LatLng point, boolean isClear) {
         // 构建Marker图标
         BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.drawable.icon_gcoding);
@@ -90,10 +102,16 @@ public class BaiduMapUtil implements OnGetPoiSearchResultListener {
         mapView.getMap().animateMapStatus(u);//设置为中心显示
     }
 
-    //监听周围信息的获取 radius=0 为默认显示周围1000米
-    public void getNearInfo(int radius, int pagerNum, LatLng location, PoiSearch mPoiSearch, Handler handler, int what) {
-        this.handler = handler;
-        this.what = what;
+    /**
+     * 监听周围信息的获取 radius=0 为默认显示周围1000米
+     *
+     * @param radius          范围
+     * @param pagerNum        页数
+     * @param location        当前(中心)位置
+     * @param mPoiSearch      必须类API
+     * @param neerPoiListener 接口回调
+     */
+    public void getNearInfo(int radius, int pagerNum, LatLng location, PoiSearch mPoiSearch, final OnNeerPoiListener neerPoiListener) {
         if (option == null)
             option = new PoiNearbySearchOption();
         option.keyword("写字楼");
@@ -110,84 +128,125 @@ public class BaiduMapUtil implements OnGetPoiSearchResultListener {
             option.pageNum(1);
         }
         option.pageCapacity(20);
-        mPoiSearch.setOnGetPoiSearchResultListener(this);
-        mPoiSearch.searchNearby(option);
-    }
+        mPoiSearch.setOnGetPoiSearchResultListener(new OnGetPoiSearchResultListener() {
+            @Override
+            public void onGetPoiResult(PoiResult poiResult) {
+                if (neerPoiListener == null) return;
+                neerPoiListener.result(poiResult);
+            }
 
-    public void getLocation() {
+            @Override
+            public void onGetPoiDetailResult(PoiDetailResult poiDetailResult) {
+                if (neerPoiListener == null) return;
+                neerPoiListener.result(poiDetailResult);
+            }
 
+            @Override
+            public void onGetPoiIndoorResult(PoiIndoorResult poiIndoorResult) {
+                if (neerPoiListener == null) return;
+                neerPoiListener.result(poiIndoorResult);
+            }
+        });
+        mPoiSearch.searchNearby(option);
     }
 
-    public void getNearInfo(int radius, int pagerNum, LatLng location, Handler handler) {
-        getNearInfo(radius, pagerNum, location, PoiSearch.newInstance(), handler, NEAR_WHAT);
+    /**
+     * 获取周围位置信息
+     *
+     * @param radius          范围
+     * @param pagerNum        页数
+     * @param location        中心地图
+     * @param neerPoiListener 接口回调
+     */
+    public void getNearInfo(int radius, int pagerNum, LatLng location, OnNeerPoiListener neerPoiListener) {
+        getNearInfo(radius, pagerNum, location, PoiSearch.newInstance(), neerPoiListener);
     }
 
-    private void setDataToHandler(SearchResult result) {
-        if (handler == null) return;
-        Message message = handler.obtainMessage();
-        message.what = this.what;
-        Bundle bundle = new Bundle();
-        bundle.putParcelable("data", result);
-        message.setData(bundle);
-        handler.sendMessage(message);
+    //获取周围位置信息接口
+    public interface OnNeerPoiListener {
+        void result(SearchResult result);
     }
 
-    @Override
-    public void onGetPoiResult(PoiResult poiResult) {
-        if (handler == null) return;
-        Message message = handler.obtainMessage();
-        message.what = this.what;
-        Bundle bundle = new Bundle();
-        bundle.putParcelable("data", poiResult);
-        message.setData(bundle);
-        handler.sendMessage(message);
-    }
+    /**
+     * 结束获取周围位置信息
+     * <p/>
+     * <p/>
+     * <p/>
+     * <p/>
+     * 开始定位功能
+     */
 
-    @Override
-    public void onGetPoiDetailResult(PoiDetailResult poiDetailResult) {
-        setDataToHandler(poiDetailResult);
+    private static LocationClient mLocationClient = null;//使用过多,定义静态避免不必要新建
+    private OnLocationListener locationListener;
+
+    public void getPoiInfo(Context context, OnLocationListener locationListener) {
+        this.locationListener = locationListener;
+        if (mLocationClient == null)
+            mLocationClient = new LocationClient(context); // 声明LocationClient类
+        mLocationClient.registerLocationListener(bdLocationListener); // 注册监听函数
+        initLocation();
+        if (!mLocationClient.isStarted()) {
+            mLocationClient.start();
+        }
     }
 
-    @Override
-    public void onGetPoiIndoorResult(PoiIndoorResult poiIndoorResult) {
-        setDataToHandler(poiIndoorResult);
+    private void initLocation() {
+        LocationClientOption option = new LocationClientOption();
+        option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy
+        );//可选,默认高精度,设置定位模式,高精度,低功耗,仅设备
+        option.setCoorType("bd09ll");//可选,默认gcj02,设置返回的定位结果坐标系
+        int span = 0;
+        option.setScanSpan(span);//可选,默认0,即仅定位一次,设置发起定位请求的间隔需要大于等于1000ms才是有效的
+        option.setIsNeedAddress(true);//可选,设置是否需要地址信息,默认不需要
+        option.setOpenGps(true);//可选,默认false,设置是否使用gps
+        option.setLocationNotify(true);//可选,默认false,设置是否当gps有效时按照1S1次频率输出GPS结果
+        option.setIsNeedLocationDescribe(true);//可选,默认false,设置是否需要位置语义化结果,可以在BDLocation.getLocationDescribe里得到,结果类似于“在北京天安门附近”
+        option.setIsNeedLocationPoiList(true);//可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到
+        option.setIgnoreKillProcess(false);//可选,默认true,定位SDK内部是一个SERVICE,并放到了独立进程,设置是否在stop的时候杀死这个进程,默认不杀死
+        option.SetIgnoreCacheException(false);//可选,默认false,设置是否收集CRASH信息,默认收集
+        option.setEnableSimulateGps(false);//可选,默认false,设置是否需要过滤gps仿真结果,默认需要
+        mLocationClient.setLocOption(option);
     }
 
+    public interface OnLocationListener {
+        void result(Map<String, Object> map);
+    }
 
-    /**
-     * 实现实位回调监听
-     */
-    public class MyLocationListener implements BDLocationListener {
+    //参考获取定位数据
+    private BDLocationListener bdLocationListener = new BDLocationListener() {
+        @Override
         public void onReceiveLocation(BDLocation location) {
-            //Receive Location
-            StringBuffer sb = new StringBuffer(256);
-            sb.append("time : ");
-            sb.append(location.getTime());//获得当前时间
-            sb.append("\nerror code : ");
-            sb.append(location.getLocType());//获得erro code得知定位现状
-            sb.append("\nlatitude : ");
-            sb.append(location.getLatitude());//获得纬度
-            sb.append("\nlontitude : ");
-            sb.append(location.getLongitude());//获得经度
-            sb.append("\nradius : ");
-            sb.append(location.getRadius());
-            if (location.getLocType() == BDLocation.TypeGpsLocation) {//通过GPS定位
-                sb.append("\nspeed : ");
-                sb.append(location.getSpeed());//获得速度
-                sb.append("\nsatellite : ");
-                sb.append(location.getSatelliteNumber());
-                sb.append("\ndirection : ");
-                sb.append("\naddr : ");
-                sb.append(location.getAddrStr());//获得当前地址
-                sb.append(location.getDirection());//获得方位
-            } else if (location.getLocType() == BDLocation.TypeNetWorkLocation) {//通过网络连接定位
-                sb.append("\naddr : ");
-                sb.append(location.getAddrStr());//获得当前地址
-                //运营商信息
-                sb.append("\noperationers : ");
-                sb.append(location.getOperators());//获得经营商?
+            Map<String, Object> map = new Hashtable<>();
+            map.put("time", location.getTime());
+            map.put("code", location.getLocType());
+            map.put("latitude", location.getLatitude());
+            map.put("lontitude", location.getLongitude());
+            map.put("radius", location.getRadius());
+            if (location.getLocType() == BDLocation.TypeGpsLocation) {// GPS定位结果
+                map.put("speed", location.getSpeed());// 单位:公里每小时
+                map.put("satellite", location.getSatelliteNumber());
+                map.put("height", location.getAltitude());// 单位:米
+                map.put("direction", location.getDirection());// 单位度
+                map.put("addr", location.getAddrStr());
+            } else if (location.getLocType() == BDLocation.TypeNetWorkLocation) {// 网络定位结果
+                map.put("addr", location.getAddrStr());
+                map.put("describe", "网络定位成功");
+            } else if (location.getLocType() == BDLocation.TypeOffLineLocation) {// 离线定位结果
+                map.put("describe", "离线定位成功");
+            } else if (location.getLocType() == BDLocation.TypeServerError) {
+                map.put("describe", "服务端网络定位失败,可以反馈IMEI号和大体定位时间到loc-bugs@baidu.com,会有人追查原因");
+            } else if (location.getLocType() == BDLocation.TypeNetWorkException) {
+                map.put("describe", "网络不同导致定位失败,请检查网络是否通畅");
+            } else if (location.getLocType() == BDLocation.TypeCriteriaException) {
+                map.put("describe", "无法获取有效定位依据导致定位失败,一般是由于手机的原因,处于飞行模式下一般会造成这种结果,可以试着重启手机");
+            } else {
+                map.put("describe", "未知原因错误");
             }
-            Log.i("BaiduLocationApiDem", sb.toString());
+            map.put("name", location.getLocationDescribe());// 位置语义化信息
+            List<Poi> list = location.getPoiList();// POI数据
+            map.put("poi", list.get(0).getName());//
+            if (locationListener == null) return;
+            locationListener.result(map);
         }
-    }
+    };
 }

+ 18 - 15
WeiChat/src/main/res/layout/activity_meet_details.xml

@@ -54,7 +54,7 @@
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:layout_marginTop="2dp"
-                    android:text="打卡签到" />
+                    android:text="分配任务" />
             </LinearLayout>
         </LinearLayout>
 
@@ -234,6 +234,7 @@
                 android:orientation="horizontal">
 
                 <TextView
+                    android:id="@+id/location_tv"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:text="广东深圳南山区英唐大厦" />
@@ -243,6 +244,7 @@
                     android:layout_height="1dp" />
 
                 <TextView
+                    android:id="@+id/location_tag"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:text="@string/agare"
@@ -260,7 +262,7 @@
                 android:orientation="horizontal">
 
                 <TextView
-                    android:id="@+id/num"
+                    android:id="@+id/num_tv"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:text="当前签到人数 0/52" />
@@ -270,7 +272,7 @@
                     android:layout_height="1dp" />
 
                 <TextView
-                    android:id="@+id/click_find"
+                    android:id="@+id/num_tag"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     android:text="@string/click_finds"
@@ -283,20 +285,21 @@
                 android:layout_height="wrap_content"
                 android:layout_below="@+id/click_ll"
                 android:layout_marginTop="13dp"
+                android:minHeight="50dp"
                 android:orientation="vertical">
 
-                <TextView
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:background="@color/item_color1"
-                    android:padding="10dp"
-                    android:text="会议议程"
-                    android:textColor="@color/text_hine" />
-
-                <com.xzjmyk.pm.activity.ui.erp.view.CustomerListView
-                    android:id="@+id/meet_listview"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content" />
+                <!--<TextView-->
+                <!--android:layout_width="match_parent"-->
+                <!--android:layout_height="wrap_content"-->
+                <!--android:background="@color/item_color1"-->
+                <!--android:padding="10dp"-->
+                <!--android:text="会议议程"-->
+                <!--android:textColor="@color/text_hine" />-->
+
+                <!--<com.xzjmyk.pm.activity.ui.erp.view.CustomerListView-->
+                <!--android:id="@+id/meet_listview"-->
+                <!--android:layout_width="wrap_content"-->
+                <!--android:layout_height="wrap_content" />-->
             </LinearLayout>
 
             <View

+ 1 - 1
WeiChat/src/main/res/layout/activity_out_signin_ok.xml

@@ -59,7 +59,7 @@
         android:layout_below="@+id/top_tag"
         android:background="@drawable/full_edit_bg"
         android:gravity="top"
-        android:hint="请填写备注(不能超过8个字)"
+        android:hint="请填写备注(不超过100个字)"
         android:inputType="textMultiLine"
         android:minHeight="150dp"
         android:padding="10dp"

+ 47 - 11
WeiChat/src/main/res/layout/activity_work_logs.xml

@@ -1,22 +1,58 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@color/white">
 
-    <com.xzjmyk.pm.activity.view.SuperSwipeRefreshLayout
-        android:id="@+id/root_view"
+    <RelativeLayout
+        android:id="@+id/seach_top"
         android:layout_width="match_parent"
-        android:layout_height="match_parent">
+        android:layout_height="48dp"
+        android:background="@drawable/bg_bar"
+        android:orientation="horizontal"
+        android:paddingBottom="5dp"
+        android:paddingLeft="15dp"
+        android:paddingRight="15dp"
+        android:paddingTop="5dp">
+
+        <com.xzjmyk.pm.activity.view.ClearEditText
+            android:id="@+id/search_edit"
+            android:layout_width="fill_parent"
+            android:layout_height="fill_parent"
+            android:layout_centerVertical="true"
+            android:layout_marginLeft="10dp"
+            android:layout_marginRight="10dp"
+            android:background="@drawable/search_input"
+            android:drawableLeft="@drawable/search"
+            android:drawableRight="@drawable/search_clear"
+            android:hint="@string/search"
+            android:textColor="@color/dark_grey"
+            android:textColorHint="@color/grey"
+            android:textSize="15sp" />
+    </RelativeLayout>
+
+    <com.handmark.pulltorefresh.library.PullToRefreshListView
+        android:id="@+id/context_rv"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_below="@id/seach_top"
+        android:background="@color/item_line"
+        android:dividerHeight="2px"
+        android:scrollbars="none" />
+
+    <!--<com.xzjmyk.pm.activity.view.SuperSwipeRefreshLayout-->
+    <!--android:id="@+id/root_view"-->
+    <!--android:layout_width="match_parent"-->
+    <!--android:layout_height="match_parent"-->
+    <!--android:layout_below="@id/seach_top">-->
 
-        <ListView
-            android:id="@+id/context_rv"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:divider="@color/item_line"
-            android:dividerHeight="2px" />
-    </com.xzjmyk.pm.activity.view.SuperSwipeRefreshLayout>
+    <!--<ListView-->
+    <!--android:id="@+id/context_rv"-->
+    <!--android:layout_width="match_parent"-->
+    <!--android:layout_height="match_parent"-->
+    <!--android:divider="@color/item_line"-->
+    <!--android:dividerHeight="2px" />-->
+    <!--</com.xzjmyk.pm.activity.view.SuperSwipeRefreshLayout>-->
 
     <com.xzjmyk.pm.activity.view.PMsgBottomView
         android:id="@+id/bottom_view"

+ 2 - 2
WeiChat/src/main/res/layout/fragment_outoffice.xml

@@ -11,7 +11,8 @@
         android:background="@drawable/text_button_stye3"
         android:gravity="center"
         android:scaleType="fitXY"
-        android:textSize="25dp" />
+        android:textColor="@color/white"
+        android:textSize="40sp" />
 
     <TextView
         android:id="@+id/name_tv"
@@ -98,7 +99,6 @@
         android:layout_height="wrap_content"
         android:layout_alignParentRight="true"
         android:layout_alignTop="@+id/date_tag"
-        android:text="20:24"
         android:textSize="@dimen/text_hine" />
 
     <TextView