ソースを参照

通讯录功能改版!先备份正常的5.8.2版本。

SpringBoots 8 年 前
コミット
b0bce0c761

+ 0 - 1
WeiChat/build.gradle

@@ -86,7 +86,6 @@ dependencies {
     compile files('libs/asmack.jar')
     compile files('libs/BaiduLBS_Android.jar')
     compile files('libs/cyberplayer-sdk.jar')
-    //    compile files('libs/fastjson-1.1.41.jar')
     compile files('libs/httpmime-4.2.jar')
     compile files('libs/nineoldandroids.jar')
     compile files('libs/org.xbill.dns_2.1.6.jar')

+ 2 - 2
WeiChat/src/main/AndroidManifest.xml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="com.xzjmyk.pm.activity"
-          android:versionCode="101"
-          android:versionName="5.8.1">
+          android:versionCode="102"
+          android:versionName="5.8.2">
 
     <uses-sdk
         android:minSdkVersion="11"

+ 0 - 4
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/contact/ContactFragment.java

@@ -503,10 +503,6 @@ public class ContactFragment extends EasyFragment implements View.OnClickListene
                 ct.startActivity(intent);
                 break;
             case R.id.peculiar_tv://常用联系人
-//                intent = new Intent(ct, MyFriendActivity.class);
-//                intent.putExtra("isPeculiar", true);
-//                ct.startActivity(intent);
-
                 intent = new Intent(ct, SelectPContactsActivity.class);
                 SelectCollisionTurnBean bean = new SelectCollisionTurnBean()
                         .setTitle(getString(R.string.app_local_contacts))

+ 2 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/contact/MyFriendActivity.java

@@ -39,6 +39,7 @@ import com.xzjmyk.pm.activity.ui.erp.db.DBManager;
 import com.xzjmyk.pm.activity.ui.erp.entity.EmployeesEntity;
 import com.xzjmyk.pm.activity.ui.erp.util.CommonUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.ListUtils;
+import com.xzjmyk.pm.activity.ui.erp.util.LogUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.OACheckUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.oa.http.OAHttpHelper;
 import com.xzjmyk.pm.activity.ui.erp.util.oa.http.OnHttpResultListener;
@@ -118,6 +119,7 @@ public class MyFriendActivity extends BaseActivity {
         }, new StringJsonArrayRequest.Listener<AttentionUser>() {
             @Override
             public void onResponse(ArrayResult<AttentionUser> result) {
+                LogUtil.d("Test","result:"+result);
                 boolean success = Result.defaultParser(MyFriendActivity.this, result, false);
                 if (success) {
                     FriendDao.getInstance().addAttentionUsers(mHandler, MyApplication.getInstance().mLoginUser.getUserId(), result.getData(),

+ 2 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/secretary/BookingAddActivity.java

@@ -151,10 +151,11 @@ public class BookingAddActivity extends OABaseActivity implements HttpImp, View.
                 }else {
                     intent = new Intent(this, SelectPContactsActivity.class);
                     SelectCollisionTurnBean bean = new SelectCollisionTurnBean()
-                            .setTitle(getString(R.string.app_local_contacts))
+                            .setTitle(getString(R.string.booking_object_name))
                             .setSingleAble(true)
                             .setSelectCode(null);
                     intent.putExtra(OAConfig.MODEL_DATA, bean);
+                    intent.putExtra("isMenuShuffle",true);
                     intent.putExtra("type", 1);
                     startActivityForResult(intent, 0x01);
                 }

+ 47 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/secretary/SelectPContactsActivity.java

@@ -1,10 +1,13 @@
 package com.xzjmyk.pm.activity.ui.erp.activity.secretary;
 
 import android.Manifest;
+import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.text.Editable;
+import android.view.Menu;
+import android.view.MenuItem;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.CheckBox;
@@ -66,6 +69,7 @@ public class SelectPContactsActivity extends OABaseActivity implements ISelectAc
     private EmptyLayout emptyLayout;
     private SelectCollisionTurnBean selectBean;
     private int type;
+    private boolean isMenuShuffle=false;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -76,6 +80,48 @@ public class SelectPContactsActivity extends OABaseActivity implements ISelectAc
         initView();
     }
 
+    @Override
+    public boolean onPrepareOptionsMenu(Menu menu) {
+        if(isMenuShuffle)
+        {
+            menu.findItem(R.id.search).setVisible(true);
+            menu.findItem(R.id.search).setIcon(getResources().getDrawable(R.drawable.icon_new_friend));
+        }else
+        {
+            menu.findItem(R.id.search).setVisible(false);
+           
+        }
+        return super.onPrepareOptionsMenu(menu);
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        getMenuInflater().inflate(R.menu.menu_nearby, menu);
+        return super.onCreateOptionsMenu(menu);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == R.id.search) {
+            Intent intent = new Intent(ct, SelectPContactsActivity.class);
+            SelectCollisionTurnBean bean = new SelectCollisionTurnBean()
+                    .setTitle(getString(R.string.app_local_contacts))
+                    .setSingleAble(true)
+                    .setSelectCode(null);
+            intent.putExtra(OAConfig.MODEL_DATA, bean);
+            intent.putExtra("isMenuShuffle",false);
+            intent.putExtra("type",0);
+            startActivityForResult(intent, 0x01);
+        }
+
+        if (item.getItemId() == android.R.id.home) {
+           onBackPressed();
+        }
+        return super.onOptionsItemSelected(item);
+
+    }
+    
+
     @Override
     protected void onResume() {
         super.onResume();
@@ -122,6 +168,7 @@ public class SelectPContactsActivity extends OABaseActivity implements ISelectAc
         presenter = new SelectPContactsPresenter(this);
         if (getIntent() != null) {
             selectBean = getIntent().getParcelableExtra(OAConfig.MODEL_DATA);
+            isMenuShuffle=getIntent().getBooleanExtra("isMenuShuffle",false);
             type= getType();
             if (selectBean == null) {
                 LogUtil.i("selectBean == null");

+ 50 - 3
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/secretary/SelectPContactsPresenter.java

@@ -1,6 +1,10 @@
 package com.xzjmyk.pm.activity.ui.erp.activity.secretary;
 
+import android.app.Activity;
+import android.content.ComponentName;
 import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.IBinder;
 import android.text.Editable;
 import android.text.TextUtils;
 import android.util.Log;
@@ -16,8 +20,12 @@ import com.xzjmyk.pm.activity.MyApplication;
 import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.bean.AddAttentionResult;
 import com.xzjmyk.pm.activity.bean.Friend;
+import com.xzjmyk.pm.activity.bean.User;
+import com.xzjmyk.pm.activity.bean.message.NewFriendMessage;
+import com.xzjmyk.pm.activity.bean.message.XmppMessage;
 import com.xzjmyk.pm.activity.bean.oa.SelectEmUser;
 import com.xzjmyk.pm.activity.db.dao.FriendDao;
+import com.xzjmyk.pm.activity.db.dao.NewFriendDao;
 import com.xzjmyk.pm.activity.sortlist.BaseComparator;
 import com.xzjmyk.pm.activity.sortlist.BaseSortModel;
 import com.xzjmyk.pm.activity.sortlist.PingYinUtil;
@@ -34,9 +42,11 @@ import com.xzjmyk.pm.activity.ui.erp.util.OACheckUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.StringUtils;
 import com.xzjmyk.pm.activity.ui.erp.util.oa.http.OAHttpHelper;
 import com.xzjmyk.pm.activity.ui.tool.ThreadPool;
+import com.xzjmyk.pm.activity.util.ToastUtil;
 import com.xzjmyk.pm.activity.volley.ObjectResult;
 import com.xzjmyk.pm.activity.volley.Result;
 import com.xzjmyk.pm.activity.volley.StringJsonObjectRequest;
+import com.xzjmyk.pm.activity.xmpp.CoreService;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -56,10 +66,26 @@ public class SelectPContactsPresenter {
     private List<BaseSortModel<SelectEmUser>> allList=new ArrayList<>();
     private BaseComparator<SelectEmUser> mBaseComparator;
     private SelectCollisionTurnBean selectBean;
+    private CoreService mXmppService;
+    private boolean mBind;
+    private  Activity activity;
+
+    private ServiceConnection mServiceConnection = new ServiceConnection() {
+        @Override
+        public void onServiceDisconnected(ComponentName name) {
+            mXmppService = null;
+        }
+
+        @Override
+        public void onServiceConnected(ComponentName name, IBinder service) {
+            mXmppService = ((CoreService.CoreServiceBinder) service).getService();
+        }
+    };
 
     public SelectPContactsPresenter(ISelectActiveView iSelectActiveView) {
         if (iSelectActiveView == null) throw new NullPointerException("iSelectActiveView is Null");
         this.iSelectActiveView = iSelectActiveView;
+        this.activity=((Activity) iSelectActiveView);
     }
 
 
@@ -68,6 +94,9 @@ public class SelectPContactsPresenter {
             new NullPointerException("Intent cannot be Null");
         }
         this.selectBean = selectBean;
+
+        mBind = activity.bindService(CoreService.getIntent(), mServiceConnection, activity.BIND_AUTO_CREATE);
+       
         allList = new ArrayList<>();
         mBaseComparator = new BaseComparator<>();
         switch (type) {
@@ -75,12 +104,17 @@ public class SelectPContactsPresenter {
                 initdata();
                 break;
             case 1:
-                //UU好友
                 loadDataForFriend();
                 break;
         }
 
     }
+    
+    private void destory(){
+        if (mBind) {
+            activity.unbindService(mServiceConnection);
+        }
+    }
 
     private synchronized void loadDataForFriend() {
         iSelectActiveView.showLoading();
@@ -431,6 +465,7 @@ public class SelectPContactsPresenter {
             @Override
             public void onErrorResponse(VolleyError arg0) {
                 iSelectActiveView.dimssLoading();
+                ToastUtil.showErrorNet(activity);
             }
         }, new StringJsonObjectRequest.Listener<AddAttentionResult>() {
             @Override
@@ -438,13 +473,25 @@ public class SelectPContactsPresenter {
                 iSelectActiveView.dimssLoading();
                 boolean success = Result.defaultParser(MyApplication.getInstance(), result, true);
                 String message = result.toString();
-                LogUtil.i("success=" + success);
-                LogUtil.i("message=" + message);
+                LogUtil.d("Test","success=" + success);
+                LogUtil.d("Test","message=" + message);
                 if (success) {
                     iSelectActiveView.showToast(R.string.add_attention_succ, R.color.load_submit);
                     if (ListUtils.getSize(allList) > position && allList.get(position).getBean().getImId() == user.getImId()) {
                         //进行确认是同一个人,防止线程出现的适配器和管理器数据不同步问题
                         allList.get(position).getBean().setTag("1");
+                        // 添加为关注
+                        User mUser=new User();
+                        mUser.setUserId(String.valueOf(user.getImId()));//已经开通了UU IM的人
+                        mUser.setNickName(user.getEmName());//手机通讯录的名字
+                        // 发送推送的消息
+                        NewFriendMessage mess = NewFriendMessage.createWillSendMessage(
+                                MyApplication.getInstance().mLoginUser, XmppMessage.TYPE_FRIEND, null, mUser);
+                        mXmppService.sendNewFriendMessage(mUser.getUserId(), mess);
+
+                        // 添加为好友
+                        NewFriendDao.getInstance().ascensionNewFriend(mess, Friend.STATUS_FRIEND);
+                 
                         showModel(allList);
                     }
                 }

+ 56 - 44
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/db/DBManager.java

@@ -35,16 +35,19 @@ public class DBManager {
 
     private SQLiteDatabase db;
     private static volatile DBManager instance;
-    public static  DBManager getInstance(){
-        if (instance==null){
-            synchronized (DBManager.class){
-                if (instance==null){
-                    instance=new DBManager();
+
+    public static DBManager getInstance() {
+        if (instance == null) {
+            synchronized (DBManager.class) {
+                if (instance == null) {
+                    instance = new DBManager();
                 }
             }
         }
-        return  instance;
-    };
+        return instance;
+    }
+
+    ;
 
     public DBManager() {
         db = DatabaseManager.getInstance().openDatabase();
@@ -59,7 +62,7 @@ public class DBManager {
         String sql = "replace into B2BMSG"
                 + "(b2b_content,b2b_time,b2b_hasRead,b2b_master)"
                 + " values (?, ?, ?, ?);";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         SQLiteStatement sta = db.compileStatement(sql);
         sta.bindString(1, entity.getContent());
         sta.bindString(2, entity.getTime());
@@ -74,7 +77,7 @@ public class DBManager {
         String groupBy = null;
         String having = null;
         String orderBy = " b2b_hasRead,b2b_time DESC";
-        if (!db.isOpen()) return entity;
+        if (checkDbObject()) return entity;
         Cursor cursor = db.query(table, null, selection, selectionArgs, groupBy, having, orderBy);
         while (cursor.moveToNext()) {
             B2BMsg model = new B2BMsg();
@@ -95,7 +98,7 @@ public class DBManager {
         String sql = "update B2BMSG"
                 + " set b2b_hasRead=?"
                 + " where id=? and b2b_master=? ;";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         SQLiteStatement sta = db.compileStatement(sql);
         sta.bindLong(1, data.getHasRead());
         sta.bindLong(2, data.getId());
@@ -107,7 +110,7 @@ public class DBManager {
         String table = "B2BMSG";
         String[] whereArgs = {String.valueOf(data.getId()), data.getMaster()};
         String whereClause = "id=? and b2b_master=? ";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         db.delete(table, whereClause, whereArgs);
     }
 
@@ -119,7 +122,7 @@ public class DBManager {
         String sql = "replace into hrorgs"
                 + "(or_code,whichsys,or_subof,company,or_isleaf,or_name,or_id,or_flag,or_headmanname,or_headmancode,or_remark)"
                 + " values (?, ?, ?, ?, ?, ?, ?,?,?,?,?);";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         SQLiteStatement sta = db.compileStatement(sql);
         db.beginTransaction();
         for (int i = 0; i < hrorgsList.size(); i++) {
@@ -149,7 +152,7 @@ public class DBManager {
         String sql = "update hrorgs"
                 + " set or_remark=?"
                 + " where or_id=? and whichsys=?;";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         SQLiteStatement sta = db.compileStatement(sql);
         sta.bindLong(1, or_remark);
         sta.bindLong(2, or_id);//更新关键字段
@@ -165,7 +168,7 @@ public class DBManager {
         String sql = "update hrorgs"
                 + " set or_code=?,whichsys=?,or_subof=?,company=?,or_isleaf=?,or_name=?,or_id=?,or_flag=?"
                 + " where or_code=?;";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         SQLiteStatement sta = db.compileStatement(sql);
         db.beginTransaction();
         for (int i = 0; i < hrorgsList.size(); i++) {
@@ -189,31 +192,31 @@ public class DBManager {
     /**
      * @author Administrator
      * @功能:增加员工信息---批量
-     *
      */
     public void saveEmployees(List<EmployeesEntity> employeesEntities) {
         String sql = "replace into employees(EM_ID,EM_CODE,EM_NAME,EM_POSITION,EM_DEFAULTORNAME,EM_DEPART,EM_MOBILE,EM_UU,COMPANY,WHICHSYS,Em_defaultorid,Em_flag,Em_imid,EM_EMAIL) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?);";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         SQLiteStatement sta = db.compileStatement(sql);
         db.beginTransaction();
-        String whichsys=CommonUtil.getMaster();
-        if (StringUtils.isEmpty(whichsys))whichsys=MyApplication.getInstance().getString(R.string.common_noinput);
+        String whichsys = CommonUtil.getMaster();
+        if (StringUtils.isEmpty(whichsys))
+            whichsys = MyApplication.getInstance().getString(R.string.common_noinput);
         for (int i = 0; i < employeesEntities.size(); i++) {
             EmployeesEntity entity = employeesEntities.get(i);
             sta.bindString(1, String.valueOf(entity.getEM_ID()));
             sta.bindString(2, entity.getEM_CODE() == null ? "null" : entity.getEM_CODE());
             sta.bindString(3, entity.getEM_NAME());
             sta.bindString(4, entity.getEM_POSITION());
-            sta.bindString(5, entity.getEM_DEFAULTORNAME() == null ? MyApplication.getInstance().getString(R.string.common_noinput): entity.getEM_DEFAULTORNAME());
+            sta.bindString(5, entity.getEM_DEFAULTORNAME() == null ? MyApplication.getInstance().getString(R.string.common_noinput) : entity.getEM_DEFAULTORNAME());
             sta.bindString(6, entity.getEM_DEPART());
             sta.bindString(7, entity.getEM_MOBILE() == null ? MyApplication.getInstance().getString(R.string.common_noinput) : entity.getEM_MOBILE());
             sta.bindString(8, String.valueOf(entity.getEM_UU()));
             sta.bindString(9, entity.getCOMPANY());
-            sta.bindString(10, StringUtils.isEmpty(entity.getWHICHSYS())?whichsys:entity.getWHICHSYS());
+            sta.bindString(10, StringUtils.isEmpty(entity.getWHICHSYS()) ? whichsys : entity.getWHICHSYS());
             sta.bindLong(11, entity.getEm_defaultorid());
             sta.bindString(12, entity.getFLAG());
             sta.bindString(13, String.valueOf(entity.getEm_IMID()));
-            sta.bindString(14, StringUtils.isEmpty(entity.getEM_EMAIL()) ?MyApplication.getInstance().getString(R.string.common_noinput) : entity.getEM_EMAIL());
+            sta.bindString(14, StringUtils.isEmpty(entity.getEM_EMAIL()) ? MyApplication.getInstance().getString(R.string.common_noinput) : entity.getEM_EMAIL());
             sta.executeInsert();
         }
         db.setTransactionSuccessful();
@@ -228,7 +231,7 @@ public class DBManager {
         String sql = "update employees"
                 + " set EM_ID=?,EM_CODE=?,EM_NAME=?,EM_POSITION=?,EM_DEFAULTORNAME=?,EM_DEPART=?,EM_MOBILE=?,EM_UU=?,COMPANY=?,WHICHSYS=?,Em_defaultorid=?,Em_flag=?"
                 + " where EM_CODE=?;";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         SQLiteStatement sta = db.compileStatement(sql);
         db.beginTransaction();
         for (int i = 0; i < employeesEntities.size(); i++) {
@@ -239,7 +242,7 @@ public class DBManager {
             sta.bindString(4, entity.getEM_POSITION());
             sta.bindString(5, entity.getEM_DEFAULTORNAME() == null ? MyApplication.getInstance().getString(R.string.common_noinput) : entity.getEM_DEFAULTORNAME());
             sta.bindString(6, entity.getEM_DEPART());
-            sta.bindString(7, entity.getEM_MOBILE() == null ?MyApplication.getInstance().getString(R.string.common_noinput) : entity.getEM_MOBILE());
+            sta.bindString(7, entity.getEM_MOBILE() == null ? MyApplication.getInstance().getString(R.string.common_noinput) : entity.getEM_MOBILE());
             sta.bindString(8, String.valueOf(entity.getEM_UU()));
             sta.bindString(9, entity.getCOMPANY());
             sta.bindString(10, entity.getWHICHSYS());
@@ -253,6 +256,15 @@ public class DBManager {
         // db.close();
     }
 
+    private boolean checkDbObject() {
+        if (db==null)db=DatabaseManager.getInstance().openDatabase();
+        if (!db.isOpen()) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
     /**
      * @author Administrator
      * @功能:记录缓存的时间
@@ -261,7 +273,7 @@ public class DBManager {
         String sql = "insert into empdate"
                 + "(ed_lastdate,ed_kind,ed_company,ed_whichsys)"
                 + " values (?, ?, ?, ?);";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         SQLiteStatement sta = db.compileStatement(sql);
 
         sta.bindString(1, data.get("ed_lastdate").toString());
@@ -280,7 +292,7 @@ public class DBManager {
         String sql = "update empdate"
                 + " set ed_lastdate=?"
                 + " where ed_kind=? and ed_company=? and ed_whichsys=?;";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         SQLiteStatement sta = db.compileStatement(sql);
         sta.bindString(1, data.get("ed_lastdate").toString());
         sta.bindString(2, data.get("ed_kind").toString());
@@ -300,7 +312,7 @@ public class DBManager {
         String groupBy = null;
         String having = null;
         String orderBy = null;
-        if (!db.isOpen()) return null;
+        if (checkDbObject()) return null;
         Cursor cursor = db.query(table, columns, where, selectionArgs, groupBy, having, orderBy);
         while (cursor.moveToNext()) {
             datestr = cursor.getString(cursor.getColumnIndex("ed_lastdate"));
@@ -317,7 +329,7 @@ public class DBManager {
         String table = "employees";
         String whereClause = "em_flag=?";
         String[] whereArgs = {"DELETE"};
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         db.delete(table, whereClause, whereArgs);
 
         table = "hrorgs";
@@ -339,7 +351,7 @@ public class DBManager {
         String groupBy = null;
         String having = null;
         String orderBy = null;
-        if (!db.isOpen()) return hrorgsEntities;
+        if (checkDbObject()) return hrorgsEntities;
         Cursor cursor = db.query(table, columns, selection, selectionArgs, groupBy, having, orderBy);
         while (cursor.moveToNext()) {
             Hrorgs.HrorgItem hrorgItem = new Hrorgs().new HrorgItem();
@@ -391,7 +403,7 @@ public class DBManager {
 //        String having = null;
 //        String orderBy = null;
         //db.query(table, columns, selection, selectionArgs, groupBy, having, orderBy);
-        if (!db.isOpen()) return 0;
+        if (checkDbObject()) return 0;
         Cursor cursor =
                 db.rawQuery("select count(*) from employees where em_defaultorid=? and WHICHSYS=?", selectionArgs);
         if (cursor.moveToFirst()) {
@@ -407,7 +419,7 @@ public class DBManager {
         String table = "hrorgs";
         String[] whereArgs = {master};
         String whereClause = "whichsys=?";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         db.delete(table, whereClause, whereArgs);
         table = "employees";
         db.delete(table, whereClause, whereArgs);
@@ -427,7 +439,7 @@ public class DBManager {
             String groupBy = null;
             String having = null;
             String orderBy = null;
-            if (!db.isOpen()) return hrorgsEntities;
+            if (checkDbObject()) return hrorgsEntities;
             Cursor cursor = db.query(table, columns, selection, selectionArgs, groupBy, having, orderBy);
             while (cursor.moveToNext()) {
                 hrorgsEntities = new HrorgsEntity();
@@ -463,7 +475,7 @@ public class DBManager {
         String groupBy = null;
         String having = null;
         String orderBy = null;
-        if (!db.isOpen()) return hrorgsEntities;
+        if (checkDbObject()) return hrorgsEntities;
         Cursor cursor = db.query(table, columns, selection, selectionArgs, groupBy, having, orderBy);
         while (cursor.moveToNext()) {
             HrorgsEntity hrorgsEntity = new HrorgsEntity();
@@ -496,7 +508,7 @@ public class DBManager {
         String orderBy = null;
         Cursor cursor = null;
         try {
-            if (!db.isOpen())
+            if (checkDbObject())
                 db = DatabaseManager.getInstance().openDatabase();
             cursor = db.query(table, null, selection, selectionArgs, groupBy, having, orderBy);
             while (cursor.moveToNext()) {
@@ -539,7 +551,7 @@ public class DBManager {
         int count = 0;
         try {
             String master = CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_master");
-            if (!db.isOpen())
+            if (checkDbObject())
                 db = DatabaseManager.getInstance().openDatabase();
             String sql = "SELECT * FROM EMPLOYEES WHERE WHICHSYS=\'" + master + "\' AND EM_DEFAULTORID IN(" + defaulid + ") ";
             Cursor cursor = db.rawQuery(sql, null);
@@ -564,7 +576,7 @@ public class DBManager {
             Log.i("todo", "e=" + e);
         }
         EmployeesEntity model = null;
-        if (!db.isOpen()) return model;
+        if (checkDbObject()) return model;
         Cursor cursor = db.query(table, null, selection, selectionArgs, groupBy, having, orderBy);
 
         Log.i("todo", "e数据为空");
@@ -607,7 +619,7 @@ public class DBManager {
     }*/
     public void saveListToAllSubs(List<SubscriptionNumber> subscriptionNumbers) {
         String saveSql = "replace into AllSubs(subs_id,subs_title,subs_kind,subs_status,subs_type,subs_master,subs_username,subs_removed,subs_img) values (?,?,?,?,?,?,?,?,?)";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         SQLiteStatement sqLiteStatement = db.compileStatement(saveSql);
         for (int i = 0; i < subscriptionNumbers.size(); i++) {
             SubscriptionNumber subscriptionNumber = subscriptionNumbers.get(i);
@@ -631,7 +643,7 @@ public class DBManager {
         String groupBy = null;
         String having = null;
         String orderBy = null;
-        if (!db.isOpen()) return subscriptionNumbers;
+        if (checkDbObject()) return subscriptionNumbers;
         Cursor cursor = db.query(table, null, selection, selectionArgs, groupBy, having, orderBy);
         while (cursor.moveToNext()) {
             SubscriptionNumber subscriptionNumber = new SubscriptionNumber();
@@ -656,7 +668,7 @@ public class DBManager {
         String sql = "update AllSubs"
                 + " set subs_status=?, subs_removed=? "
                 + " where subs_id=? and subs_master=? and subs_username=? ;";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         SQLiteStatement sta = db.compileStatement(sql);
         sta.bindLong(1, subscriptionNumber.getStatus());
         sta.bindLong(2, subscriptionNumber.getRemoved());
@@ -670,7 +682,7 @@ public class DBManager {
         String sql = "update AllSubs"
                 + " set subs_status=?, subs_removed=? "
                 + " where subs_id=? and subs_master=? and subs_username=? ;";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         SQLiteStatement sta = db.compileStatement(sql);
 
         for (int i = 0; i < subscriptionNumbers.size(); i++) {
@@ -706,7 +718,7 @@ public class DBManager {
         String table = "AllSubs";
         String[] whereArgs = {master, username};
         String whereClause = "subs_master=? and subs_username=? ";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         db.delete(table, whereClause, whereArgs);
     }
 
@@ -729,7 +741,7 @@ public class DBManager {
 
     public void saveListToMySubs(List<PersonalSubscriptionBean> personalSubscriptionBeans) {
         String saveSql = "replace into MySubs(subs_id,subs_title,subs_kind,subs_type,subs_applied,subs_master,subs_username,subs_img) values (?,?,?,?,?,?,?,?)";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         SQLiteStatement sqLiteStatement = db.compileStatement(saveSql);
         for (int i = 0; i < personalSubscriptionBeans.size(); i++) {
             PersonalSubscriptionBean personalSubscriptionBean = personalSubscriptionBeans.get(i);
@@ -751,7 +763,7 @@ public class DBManager {
         String groupBy = null;
         String having = null;
         String orderBy = null;
-        if (!db.isOpen()) return personalSubscriptionBeans;
+        if (checkDbObject()) return personalSubscriptionBeans;
         Cursor cursor = db.query(table, null, selection, selectionArgs, groupBy, having, orderBy);
         while (cursor.moveToNext()) {
             PersonalSubscriptionBean personalSubscriptionBean = new PersonalSubscriptionBean();
@@ -787,7 +799,7 @@ public class DBManager {
         String table = "MySubs";
         String[] whereArgs = {String.valueOf(personalSubscriptionBean.getNUM_ID()), personalSubscriptionBean.getMASTER(), personalSubscriptionBean.getUSERNAME()};
         String whereClause = "subs_id=? and subs_master=? and subs_username=? ";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         db.delete(table, whereClause, whereArgs);
     }
 
@@ -805,7 +817,7 @@ public class DBManager {
         String table = "MySubs";
         String[] whereArgs = {master, username};
         String whereClause = "subs_master=? and subs_username=? ";
-        if (!db.isOpen()) return;
+        if (checkDbObject()) return;
         db.delete(table, whereClause, whereArgs);
     }
 

+ 2 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/util/Constants.java

@@ -317,7 +317,8 @@ public class Constants {
     public final static String SET_SIGN_IN="set_sign_in";
     public final static String SET_SIGN_LANGUAGE="set_sign_language";
     public final static String SET_BOOKING_TIME="set_booking_time";
-    
+    public final static String SET_BOOKING = "set_booking";
+    public final static String SET_CALL="set_call";
 
     public final static String NEW_FUNCTION_NOTICE = "NEWFUNCTIONNOTICE";
     public final static String NEW_EXPENSE_REIMBURSEMENT_NOTICE = "NEWEXPENSEREIMBURSEMENTNOTICE";

+ 9 - 3
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/me/SettingActivity.java

@@ -101,6 +101,10 @@ public class SettingActivity extends ActionBackActivity implements View.OnClickL
     @ViewInject(R.id.tv_booking_new)
     private TextView tv_booking_new;
 
+    @ViewInject(R.id.tv_help_new)
+    private TextView tv_help_new;
+  
+
     @ViewInject(R.id.language_us_rl)
     private RelativeLayout language_us_rl;
 
@@ -247,7 +251,7 @@ public class SettingActivity extends ActionBackActivity implements View.OnClickL
         tv_sign_new.setVisibility(CommonUtil.getSharedPreferencesBoolean(this, Constants.SET_SIGN_IN, false) ? View.GONE : View.VISIBLE);
         tv_language_new.setVisibility(CommonUtil.getSharedPreferencesBoolean(this, Constants.SET_SIGN_LANGUAGE, false) ? View.GONE : View.VISIBLE);
         tv_booking_new.setVisibility(CommonUtil.getSharedPreferencesBoolean(this, Constants.SET_BOOKING_TIME, false) ? View.GONE : View.VISIBLE);
-
+        tv_help_new.setVisibility(CommonUtil.getSharedPreferencesBoolean(this, Constants.SET_CALL, false) ? View.GONE : View.VISIBLE);
 
         speech_recognition_rl.setOnClickListener(this);
         sign_in_rl.setOnClickListener(this);
@@ -353,8 +357,9 @@ public class SettingActivity extends ActionBackActivity implements View.OnClickL
             case R.id.clear_cache_rl:
                 showclearDialog();
                 break;
-            case R.id.use_help_rl: {  // 用户反馈
-                //注意权限
+            case R.id.use_help_rl: {
+                CommonUtil.setSharedPreferences(this, Constants.SET_CALL, true);
+                tv_help_new.setVisibility(View.GONE);
                 intent = new Intent(mContext, FeedbackActivity.class);
                 intent.putExtra("type", 1);
                 intent.putExtra(WebViewActivity.EXTRA_URL, mConfig.help_url);
@@ -364,6 +369,7 @@ public class SettingActivity extends ActionBackActivity implements View.OnClickL
             break;
             case R.id.about_us_rl:// 关于我们
                 startActivity(new Intent(mContext, AboutActivity.class));
+                //startActivity(new Intent(mContext, RegisterActivity.class));
                 break;
             case R.id.share_rl:
                 share();

+ 9 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/MessageFragment.java

@@ -92,6 +92,7 @@ public class MessageFragment extends EasyFragment implements IMessageView,   Vie
     private TextView waitting_work_time_tv;//待办工作
     private TextView subscribe_time_tv;//我的订阅
     private TextView book_time_tv;
+    private TextView tv_book_num;
 
 
     @Override
@@ -190,6 +191,8 @@ public class MessageFragment extends EasyFragment implements IMessageView,   Vie
         waitting_work_num_tv = (TextView) view.findViewById(R.id.waitting_work_num_tv);//待办工作
         subscribe_num_tv = (TextView) view.findViewById(R.id.subscribe_num_tv);//我的订阅
         booking_num_tv = (TextView) view.findViewById(R.id.booking_num_tv);//小秘书
+
+        tv_book_num = (TextView) view.findViewById(R.id.tv_book_num);//小秘书
         
         schedule_content_tv = (TextView) view.findViewById(R.id.schedule_content_tv);//审批流
         waitting_work_content_tv = (TextView) view.findViewById(R.id.waitting_work_content_tv);//待办工作
@@ -208,6 +211,10 @@ public class MessageFragment extends EasyFragment implements IMessageView,   Vie
             dingyue_num.setVisibility(View.GONE);
             tv_dingyue_desc.setVisibility(View.GONE);
         }
+
+        if (CommonUtil.getSharedPreferencesBoolean(MyApplication.getInstance(), Constants.SET_BOOKING)) {
+            tv_book_num.setVisibility(View.GONE);
+        }
         view.findViewById(R.id.schedule_rl).setOnClickListener(this);//审批流
         view.findViewById(R.id.waitting_work_rl).setOnClickListener(this);//待办工作
         view.findViewById(R.id.subscribe_rl).setOnClickListener(this);//我的订阅
@@ -275,6 +282,8 @@ public class MessageFragment extends EasyFragment implements IMessageView,   Vie
         switch (v.getId()) {
             case R.id.booking_rl:
                 startActivity(new Intent(mContext,BookingListActivity.class));
+                tv_book_num.setVisibility(View.GONE);
+                CommonUtil.setSharedPreferences(MyApplication.getInstance(), Constants.SET_BOOKING, true);
                 break;
             case R.id.message_net_set://点击无网络情况
                 startActivity(new Intent(Settings.ACTION_SETTINGS));

BIN
WeiChat/src/main/res/drawable-xxhdpi/icon_new_friend.png


+ 11 - 1
WeiChat/src/main/res/layout/activity_setting.xml

@@ -346,7 +346,17 @@
                     android:text="@string/Rated_suggest"
                     android:textColor="@color/black"
                     android:textSize="14sp" />
-
+                <TextView
+                    android:id="@+id/tv_help_new"
+                    android:layout_width="10dp"
+                    android:layout_height="10dp"
+                    android:layout_alignTop="@+id/tv_oa"
+                    android:layout_centerVertical="true"
+                    android:layout_marginRight="10dp"
+                    android:layout_alignParentRight="true"
+                    android:background="@drawable/hongdian"
+                    android:textColor="@android:color/white"
+                    android:textSize="10.0dip" />
                 <ImageView
                     android:layout_width="@dimen/next_width"
                     android:layout_height="@dimen/next_height"

+ 1 - 3
WeiChat/src/main/res/layout/fragment_new_message.xml

@@ -28,9 +28,7 @@
         android:id="@+id/pull_refresh_list"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:background="#ebe9e9"
-        android:hardwareAccelerated="false"
-        android:layerType="software"
+        android:background="@color/transparent"
         app:ptrAnimationStyle="flip"
         app:ptrDrawableEnd="@drawable/default_ptr_rotate"
         app:ptrDrawableStart="@drawable/default_ptr_flip"

+ 7 - 7
WeiChat/src/main/res/layout/new_message_header.xml

@@ -91,7 +91,7 @@
         android:layout_height="@dimen/line"
         android:layout_marginLeft="10dp"
         android:layout_marginRight="10dp"
-        android:background="@color/item_line" />
+        android:background="@color/transparent" />
 
     <RelativeLayout
         android:id="@+id/waitting_work_rl"
@@ -180,7 +180,7 @@
         android:layout_height="@dimen/line"
         android:layout_marginLeft="10dp"
         android:layout_marginRight="10dp"
-        android:background="@color/item_line" />
+        android:background="@color/transparent" />
 
     <RelativeLayout
         android:id="@+id/subscribe_rl"
@@ -287,7 +287,7 @@
         android:layout_height="@dimen/line"
         android:layout_marginLeft="10dp"
         android:layout_marginRight="10dp"
-        android:background="@color/item_line" />
+        android:background="@color/transparent" />
 
     <RelativeLayout
         android:id="@+id/booking_rl"
@@ -324,7 +324,7 @@
                 android:gravity="center"
                 android:textColor="@android:color/white"
                 android:textSize="10.0dp"
-                android:visibility="gone" />
+                 />
         </FrameLayout>
 
         <RelativeLayout
@@ -352,8 +352,8 @@
                 android:layout_below="@+id/book_time_tv"
                 android:layout_toLeftOf="@+id/tv_book_num"
                 android:layout_toStartOf="@+id/tv_book_num"
-                android:visibility="gone"
-                android:text="@string/msg_subscribe_data" />
+               
+                android:text="" />
 
             <TextView
                 android:id="@+id/tv_book_num"
@@ -364,7 +364,7 @@
                 android:background="@drawable/hongdian"
                 android:gravity="center"
                 android:text=""
-                android:visibility="gone"
+          
                 android:textColor="@android:color/white"
                 android:textSize="10.0dp" />
 

+ 1 - 1
WeiChat/src/main/res/raw/versionconfiguration.properties

@@ -1,4 +1,4 @@
 
 #发布版本状态改为true,测试版本状态为false
 #release_version = true
-release_version = false
+release_version = true

+ 1 - 1
WeiChat/src/main/res/values/dimens.xml

@@ -22,7 +22,7 @@
     <dimen name="oa_statistics_date_minheight">30dp</dimen>
     <!-- end oa 考勤统计页面-->
     <dimen name="next_width">10.0dip</dimen>
-    <dimen name="line">2px</dimen>
+    <dimen name="line">1px</dimen>
     <dimen name="line_big">7.0dip</dimen>
     <dimen name="line_min">2.0dip</dimen>
     <dimen name="next_height">15.0dip</dimen>

+ 1 - 1
WeiChat/src/main/res/values/strings.xml

@@ -1830,7 +1830,7 @@
     <string name="booking_content">内容</string>
     <string name="booking_change">变更</string>
     <string name="booking_object">对象</string>
-
+    <string name="booking_object_name">预约对象</string>
     <string name="booking_me">我的预约</string>
     <string name="booking_shared">共享预约</string>
     <string name="booking_time_set">预约时间段设置</string>