|
|
@@ -8,6 +8,7 @@ import com.xzjmyk.pm.activity.db.DatabaseManager;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.model.MessageModel;
|
|
|
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.StringUtils;
|
|
|
import com.xzjmyk.pm.activity.util.PreferenceUtils;
|
|
|
@@ -137,7 +138,7 @@ public class MessageDao {
|
|
|
* @param isReaded
|
|
|
* @return
|
|
|
*/
|
|
|
- public boolean upStatus(int id, boolean isReaded) {
|
|
|
+ public boolean upStatus(int id, String type, boolean isReaded) {
|
|
|
SQLiteDatabase db = null;
|
|
|
long i = 0;
|
|
|
try {
|
|
|
@@ -145,6 +146,7 @@ public class MessageDao {
|
|
|
String emcode = CommonUtil.getEmcode();
|
|
|
if (StringUtils.isEmpty(master) || StringUtils.isEmpty(emcode)) return false;
|
|
|
db = DatabaseManager.getInstance().openDatabase();
|
|
|
+ db.beginTransaction();
|
|
|
ContentValues values = new ContentValues();
|
|
|
values.put("isReaded", isReaded ? 1 : 0);
|
|
|
String readTime = TimeUtils.f_long_2_str(System.currentTimeMillis());
|
|
|
@@ -155,6 +157,24 @@ public class MessageDao {
|
|
|
}
|
|
|
String[] whereArgs = {master, emcode, String.valueOf(id)};
|
|
|
i = db.update(TABLE_NAME, values, where, whereArgs);
|
|
|
+ //更新完成后,查看最后一条状态
|
|
|
+ if (!StringUtils.isEmpty(type)) {
|
|
|
+ String select = "master=? and emcode=? and type=? and hierarchy=? and isReaded= 0";
|
|
|
+ String[] selectArgs = {master, emcode, type, String.valueOf(0)};
|
|
|
+ String[] columns = {"subTitle"};
|
|
|
+ Cursor c = db.query(TABLE_NAME, columns, select, selectArgs, null, null, "time desc");
|
|
|
+ String subTitle = "";
|
|
|
+ if (c.moveToFirst())
|
|
|
+ subTitle = c.getString(c.getColumnIndex("subTitle"));
|
|
|
+ c.close();
|
|
|
+ LogUtil.d("subTitle=" + subTitle);
|
|
|
+ values.put("subTitle", subTitle);
|
|
|
+ where = "master=? and emcode=? and type=? and hierarchy=?";
|
|
|
+ String[] whereArgs2 = {master, emcode, type, String.valueOf(0)};
|
|
|
+ db.update(TABLE_NAME, values, where, whereArgs2);
|
|
|
+ }
|
|
|
+ db.setTransactionSuccessful();
|
|
|
+ db.endTransaction();
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
} finally {
|
|
|
@@ -229,6 +249,10 @@ public class MessageDao {
|
|
|
String where = "master=? and emcode=? and type=?";
|
|
|
String[] whereArgs = {master, emcode, type};
|
|
|
i = db.update(TABLE_NAME, values, where, whereArgs);
|
|
|
+ values.put("subTitle", "");
|
|
|
+ where = "master=? and emcode=? and type=? and hierarchy=?";
|
|
|
+ String[] whereArgs2 = {master, emcode, type, String.valueOf(0)};
|
|
|
+ db.update(TABLE_NAME, values, where, whereArgs2);
|
|
|
} catch (Exception e) {
|
|
|
} finally {
|
|
|
if (db != null)
|