Commit e76b6a53a84ab2f2efc4c05d9730d949c8ce20ad

Authored by 韩亚云
2 parents 2a748ca8 4af31590

Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/ModulePedometer

moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollTraceListDetailFragmentView.java
@@ -391,6 +391,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener @@ -391,6 +391,7 @@ public class CollTraceListDetailFragmentView implements MvpView, OnFenceListener
391 addFence(eventShoeLinesBean.getDarenId(), eventShoeLinesBean.getEventName(), importPoints); 391 addFence(eventShoeLinesBean.getDarenId(), eventShoeLinesBean.getEventName(), importPoints);
392 } else { 392 } else {
393 QMUITipDialogUtil.dismessDialog(); 393 QMUITipDialogUtil.dismessDialog();
  394 + QMUITipDialogUtil.failedDialog(getContext(), deleteFenceResponse.getMessage(), 1);
394 } 395 }
395 } 396 }
396 397
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoMaster.java
@@ -21,18 +21,18 @@ public class DaoMaster extends AbstractDaoMaster { @@ -21,18 +21,18 @@ public class DaoMaster extends AbstractDaoMaster {
21 21
22 /** Creates underlying database table using DAOs. */ 22 /** Creates underlying database table using DAOs. */
23 public static void createAllTables(Database db, boolean ifNotExists) { 23 public static void createAllTables(Database db, boolean ifNotExists) {
  24 + CollFailedEntityDao.createTable(db, ifNotExists);
24 CollUserStepEntityDao.createTable(db, ifNotExists); 25 CollUserStepEntityDao.createTable(db, ifNotExists);
25 FailedEntityDao.createTable(db, ifNotExists); 26 FailedEntityDao.createTable(db, ifNotExists);
26 UserStepEntityDao.createTable(db, ifNotExists); 27 UserStepEntityDao.createTable(db, ifNotExists);
27 - CollFailedEntityDao.createTable(db, ifNotExists);  
28 } 28 }
29 29
30 /** Drops underlying database table using DAOs. */ 30 /** Drops underlying database table using DAOs. */
31 public static void dropAllTables(Database db, boolean ifExists) { 31 public static void dropAllTables(Database db, boolean ifExists) {
  32 + CollFailedEntityDao.dropTable(db, ifExists);
32 CollUserStepEntityDao.dropTable(db, ifExists); 33 CollUserStepEntityDao.dropTable(db, ifExists);
33 FailedEntityDao.dropTable(db, ifExists); 34 FailedEntityDao.dropTable(db, ifExists);
34 UserStepEntityDao.dropTable(db, ifExists); 35 UserStepEntityDao.dropTable(db, ifExists);
35 - CollFailedEntityDao.dropTable(db, ifExists);  
36 } 36 }
37 37
38 /** 38 /**
@@ -51,10 +51,10 @@ public class DaoMaster extends AbstractDaoMaster { @@ -51,10 +51,10 @@ public class DaoMaster extends AbstractDaoMaster {
51 51
52 public DaoMaster(Database db) { 52 public DaoMaster(Database db) {
53 super(db, SCHEMA_VERSION); 53 super(db, SCHEMA_VERSION);
  54 + registerDaoClass(CollFailedEntityDao.class);
54 registerDaoClass(CollUserStepEntityDao.class); 55 registerDaoClass(CollUserStepEntityDao.class);
55 registerDaoClass(FailedEntityDao.class); 56 registerDaoClass(FailedEntityDao.class);
56 registerDaoClass(UserStepEntityDao.class); 57 registerDaoClass(UserStepEntityDao.class);
57 - registerDaoClass(CollFailedEntityDao.class);  
58 } 58 }
59 59
60 public DaoSession newSession() { 60 public DaoSession newSession() {
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/DaoSession.java
@@ -8,15 +8,15 @@ import org.greenrobot.greendao.database.Database; @@ -8,15 +8,15 @@ import org.greenrobot.greendao.database.Database;
8 import org.greenrobot.greendao.identityscope.IdentityScopeType; 8 import org.greenrobot.greendao.identityscope.IdentityScopeType;
9 import org.greenrobot.greendao.internal.DaoConfig; 9 import org.greenrobot.greendao.internal.DaoConfig;
10 10
  11 +import com.cnlive.moudle.pedometer.sql.entity.CollFailedEntity;
11 import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; 12 import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity;
12 import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; 13 import com.cnlive.moudle.pedometer.sql.entity.FailedEntity;
13 import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; 14 import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity;
14 -import com.cnlive.moudle.pedometer.sql.entity.CollFailedEntity;  
15 15
  16 +import com.cnlive.moudle.pedometer.sql.dao.CollFailedEntityDao;
16 import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao; 17 import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao;
17 import com.cnlive.moudle.pedometer.sql.dao.FailedEntityDao; 18 import com.cnlive.moudle.pedometer.sql.dao.FailedEntityDao;
18 import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; 19 import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao;
19 -import com.cnlive.moudle.pedometer.sql.dao.CollFailedEntityDao;  
20 20
21 // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. 21 // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
22 22
@@ -27,20 +27,23 @@ import com.cnlive.moudle.pedometer.sql.dao.CollFailedEntityDao; @@ -27,20 +27,23 @@ import com.cnlive.moudle.pedometer.sql.dao.CollFailedEntityDao;
27 */ 27 */
28 public class DaoSession extends AbstractDaoSession { 28 public class DaoSession extends AbstractDaoSession {
29 29
  30 + private final DaoConfig collFailedEntityDaoConfig;
30 private final DaoConfig collUserStepEntityDaoConfig; 31 private final DaoConfig collUserStepEntityDaoConfig;
31 private final DaoConfig failedEntityDaoConfig; 32 private final DaoConfig failedEntityDaoConfig;
32 private final DaoConfig userStepEntityDaoConfig; 33 private final DaoConfig userStepEntityDaoConfig;
33 - private final DaoConfig collFailedEntityDaoConfig;  
34 34
  35 + private final CollFailedEntityDao collFailedEntityDao;
35 private final CollUserStepEntityDao collUserStepEntityDao; 36 private final CollUserStepEntityDao collUserStepEntityDao;
36 private final FailedEntityDao failedEntityDao; 37 private final FailedEntityDao failedEntityDao;
37 private final UserStepEntityDao userStepEntityDao; 38 private final UserStepEntityDao userStepEntityDao;
38 - private final CollFailedEntityDao collFailedEntityDao;  
39 39
40 public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig> 40 public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
41 daoConfigMap) { 41 daoConfigMap) {
42 super(db); 42 super(db);
43 43
  44 + collFailedEntityDaoConfig = daoConfigMap.get(CollFailedEntityDao.class).clone();
  45 + collFailedEntityDaoConfig.initIdentityScope(type);
  46 +
44 collUserStepEntityDaoConfig = daoConfigMap.get(CollUserStepEntityDao.class).clone(); 47 collUserStepEntityDaoConfig = daoConfigMap.get(CollUserStepEntityDao.class).clone();
45 collUserStepEntityDaoConfig.initIdentityScope(type); 48 collUserStepEntityDaoConfig.initIdentityScope(type);
46 49
@@ -50,25 +53,26 @@ public class DaoSession extends AbstractDaoSession { @@ -50,25 +53,26 @@ public class DaoSession extends AbstractDaoSession {
50 userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone(); 53 userStepEntityDaoConfig = daoConfigMap.get(UserStepEntityDao.class).clone();
51 userStepEntityDaoConfig.initIdentityScope(type); 54 userStepEntityDaoConfig.initIdentityScope(type);
52 55
53 - collFailedEntityDaoConfig = daoConfigMap.get(CollFailedEntityDao.class).clone();  
54 - collFailedEntityDaoConfig.initIdentityScope(type);  
55 - 56 + collFailedEntityDao = new CollFailedEntityDao(collFailedEntityDaoConfig, this);
56 collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this); 57 collUserStepEntityDao = new CollUserStepEntityDao(collUserStepEntityDaoConfig, this);
57 failedEntityDao = new FailedEntityDao(failedEntityDaoConfig, this); 58 failedEntityDao = new FailedEntityDao(failedEntityDaoConfig, this);
58 userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this); 59 userStepEntityDao = new UserStepEntityDao(userStepEntityDaoConfig, this);
59 - collFailedEntityDao = new CollFailedEntityDao(collFailedEntityDaoConfig, this);  
60 60
  61 + registerDao(CollFailedEntity.class, collFailedEntityDao);
61 registerDao(CollUserStepEntity.class, collUserStepEntityDao); 62 registerDao(CollUserStepEntity.class, collUserStepEntityDao);
62 registerDao(FailedEntity.class, failedEntityDao); 63 registerDao(FailedEntity.class, failedEntityDao);
63 registerDao(UserStepEntity.class, userStepEntityDao); 64 registerDao(UserStepEntity.class, userStepEntityDao);
64 - registerDao(CollFailedEntity.class, collFailedEntityDao);  
65 } 65 }
66 66
67 public void clear() { 67 public void clear() {
  68 + collFailedEntityDaoConfig.clearIdentityScope();
68 collUserStepEntityDaoConfig.clearIdentityScope(); 69 collUserStepEntityDaoConfig.clearIdentityScope();
69 failedEntityDaoConfig.clearIdentityScope(); 70 failedEntityDaoConfig.clearIdentityScope();
70 userStepEntityDaoConfig.clearIdentityScope(); 71 userStepEntityDaoConfig.clearIdentityScope();
71 - collFailedEntityDaoConfig.clearIdentityScope(); 72 + }
  73 +
  74 + public CollFailedEntityDao getCollFailedEntityDao() {
  75 + return collFailedEntityDao;
72 } 76 }
73 77
74 public CollUserStepEntityDao getCollUserStepEntityDao() { 78 public CollUserStepEntityDao getCollUserStepEntityDao() {
@@ -83,8 +87,4 @@ public class DaoSession extends AbstractDaoSession { @@ -83,8 +87,4 @@ public class DaoSession extends AbstractDaoSession {
83 return userStepEntityDao; 87 return userStepEntityDao;
84 } 88 }
85 89
86 - public CollFailedEntityDao getCollFailedEntityDao() {  
87 - return collFailedEntityDao;  
88 - }  
89 -  
90 } 90 }
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/db/DbCore.java
@@ -7,6 +7,7 @@ import android.text.TextUtils; @@ -7,6 +7,7 @@ import android.text.TextUtils;
7 import com.cnlive.moudle.pedometer.sql.dao.DaoMaster; 7 import com.cnlive.moudle.pedometer.sql.dao.DaoMaster;
8 import com.cnlive.moudle.pedometer.sql.dao.DaoSession; 8 import com.cnlive.moudle.pedometer.sql.dao.DaoSession;
9 9
  10 +import org.greenrobot.greendao.identityscope.IdentityScopeType;
10 import org.greenrobot.greendao.query.QueryBuilder; 11 import org.greenrobot.greendao.query.QueryBuilder;
11 12
12 /** 13 /**
@@ -61,7 +62,8 @@ public class DbCore { @@ -61,7 +62,8 @@ public class DbCore {
61 if (daoMaster == null) { 62 if (daoMaster == null) {
62 daoMaster = getDaoMaster(); 63 daoMaster = getDaoMaster();
63 } 64 }
64 - daoSession = daoMaster.newSession(); 65 + //不使用缓存
  66 + daoSession = daoMaster.newSession(IdentityScopeType.None);
65 } 67 }
66 return daoSession; 68 return daoSession;
67 } 69 }
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/db/MyOpenHelper.java
@@ -45,7 +45,10 @@ package com.cnlive.moudle.pedometer.sql.db; @@ -45,7 +45,10 @@ package com.cnlive.moudle.pedometer.sql.db;
45 45
46 import android.content.Context; 46 import android.content.Context;
47 47
  48 +import com.cnlive.moudle.pedometer.sql.dao.CollFailedEntityDao;
  49 +import com.cnlive.moudle.pedometer.sql.dao.CollUserStepEntityDao;
48 import com.cnlive.moudle.pedometer.sql.dao.DaoMaster; 50 import com.cnlive.moudle.pedometer.sql.dao.DaoMaster;
  51 +import com.cnlive.moudle.pedometer.sql.dao.FailedEntityDao;
49 import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao; 52 import com.cnlive.moudle.pedometer.sql.dao.UserStepEntityDao;
50 import com.cnlive.moudle.pedometer.sql.updateDB.UpgradeHelper; 53 import com.cnlive.moudle.pedometer.sql.updateDB.UpgradeHelper;
51 54
@@ -75,7 +78,7 @@ public class MyOpenHelper extends DaoMaster.OpenHelper { @@ -75,7 +78,7 @@ public class MyOpenHelper extends DaoMaster.OpenHelper {
75 try { 78 try {
76 //进行数据库升级 79 //进行数据库升级
77 new UpgradeHelper().migrate(db, 80 new UpgradeHelper().migrate(db,
78 - UserStepEntityDao.class 81 + UserStepEntityDao.class, FailedEntityDao.class, CollUserStepEntityDao.class, CollFailedEntityDao.class
79 ); 82 );
80 } catch (ClassCastException e) { 83 } catch (ClassCastException e) {
81 } 84 }