Initial commit
This commit is contained in:
114
sources/com/ubt/jimu/base/db/AbstractDaoHandler.java
Normal file
114
sources/com/ubt/jimu/base/db/AbstractDaoHandler.java
Normal file
@@ -0,0 +1,114 @@
|
||||
package com.ubt.jimu.base.db;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AbstractDaoHandler<T> implements IDaoHandler<T> {
|
||||
protected AbstractDao<T, Long> dao;
|
||||
|
||||
public AbstractDaoHandler(AbstractDao<T, Long> abstractDao) {
|
||||
this.dao = abstractDao;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void delete(T t) {
|
||||
this.dao.b((AbstractDao<T, Long>) t);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void deleteAll() {
|
||||
this.dao.b();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void deleteById(long j) {
|
||||
this.dao.c((AbstractDao<T, Long>) Long.valueOf(j));
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void deleteInTx(List<T> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
this.dao.a((Iterable) list);
|
||||
}
|
||||
|
||||
public QueryBuilder<T> getQueryBuilder() {
|
||||
return this.dao.k();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public long insert(T t) {
|
||||
return this.dao.f(t);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void insertInTx(List<T> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
this.dao.b((Iterable) list);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public long insertOrUpdate(T t) {
|
||||
return this.dao.g(t);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void insertOrUpdateInTx(List<T> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
this.dao.c(list);
|
||||
}
|
||||
|
||||
public List<T> query(QueryBuilder<T> queryBuilder) {
|
||||
List<T> list;
|
||||
try {
|
||||
list = queryBuilder.b();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
list = null;
|
||||
}
|
||||
return list == null ? new ArrayList() : list;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public List<T> selectAll() {
|
||||
return this.dao.j();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public T selectById(Long l) {
|
||||
return this.dao.a(l.longValue());
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public abstract T selectUnique(T t);
|
||||
|
||||
public T unique(QueryBuilder<T> queryBuilder) {
|
||||
try {
|
||||
return queryBuilder.c();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void update(T t) {
|
||||
this.dao.j(t);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.IDaoHandler
|
||||
public void updateInTx(List<T> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
this.dao.d((Iterable) list);
|
||||
}
|
||||
}
|
44
sources/com/ubt/jimu/base/db/DatabaseUtils.java
Normal file
44
sources/com/ubt/jimu/base/db/DatabaseUtils.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.ubt.jimu.base.db;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.gen.DaoMaster;
|
||||
import com.ubt.jimu.gen.DaoSession;
|
||||
import org.greenrobot.greendao.database.Database;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DatabaseUtils {
|
||||
public static final String LOCAL_DB = "local";
|
||||
|
||||
private static DaoSession getDaoSession(Database database) {
|
||||
return new DaoMaster(database).newSession();
|
||||
}
|
||||
|
||||
private static Database getReadableDb(Context context, String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
str = "local";
|
||||
}
|
||||
return new DaoMaster.DevOpenHelper(context, str).getReadableDb();
|
||||
}
|
||||
|
||||
private static Database getWritableDb(Context context, String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
str = "local";
|
||||
}
|
||||
return new DaoMaster.DevOpenHelper(context, str).getWritableDb();
|
||||
}
|
||||
|
||||
public static DaoSession getDaoSession(boolean z) {
|
||||
return JimuApplication.l().e();
|
||||
}
|
||||
|
||||
private static Database getReadableDb() {
|
||||
return getReadableDb(JimuApplication.l(), Cache.getInstance().getUserId());
|
||||
}
|
||||
|
||||
private static Database getWritableDb() {
|
||||
return getWritableDb(JimuApplication.l(), Cache.getInstance().getUserId());
|
||||
}
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
package com.ubt.jimu.base.db;
|
||||
|
||||
import com.ubt.jimu.base.entities.FileDownloadRecord;
|
||||
import com.ubt.jimu.gen.FileDownloadRecordDao;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FileDownloadRecordDbHandler {
|
||||
public static boolean getFileDownloadRecord(int i, int i2) {
|
||||
try {
|
||||
QueryBuilder<FileDownloadRecord> k = DatabaseUtils.getDaoSession(false).j().k();
|
||||
k.a(FileDownloadRecordDao.Properties.TypeId.a(Integer.valueOf(i)), FileDownloadRecordDao.Properties.Type.a(Integer.valueOf(i2)));
|
||||
return k.c() != null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<FileDownloadRecord> getFileDownloadRecordByUrl(String str, int i) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
QueryBuilder<FileDownloadRecord> k = DatabaseUtils.getDaoSession(false).j().k();
|
||||
k.a(FileDownloadRecordDao.Properties.FileUrl.a((Object) str), FileDownloadRecordDao.Properties.Type.a(Integer.valueOf(i)));
|
||||
List<FileDownloadRecord> b = k.b();
|
||||
if (b != null && b.size() > 0) {
|
||||
arrayList.addAll(b);
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static void writeRecord(long j, String str, String str2, int i, long j2) {
|
||||
try {
|
||||
FileDownloadRecordDao j3 = DatabaseUtils.getDaoSession(false).j();
|
||||
QueryBuilder<FileDownloadRecord> k = j3.k();
|
||||
k.a(FileDownloadRecordDao.Properties.FileUrl.a((Object) str), new WhereCondition[0]);
|
||||
FileDownloadRecord c = k.c();
|
||||
if (c != null) {
|
||||
c.setUpdateTime(j2);
|
||||
j3.j(c);
|
||||
} else {
|
||||
FileDownloadRecord fileDownloadRecord = new FileDownloadRecord();
|
||||
fileDownloadRecord.setFileUrl(str);
|
||||
fileDownloadRecord.setId(j);
|
||||
fileDownloadRecord.setSavePath(str2);
|
||||
fileDownloadRecord.setType(i);
|
||||
fileDownloadRecord.setTypeId(j);
|
||||
fileDownloadRecord.setUpdateTime(j2);
|
||||
j3.g(fileDownloadRecord);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
32
sources/com/ubt/jimu/base/db/IDaoHandler.java
Normal file
32
sources/com/ubt/jimu/base/db/IDaoHandler.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.ubt.jimu.base.db;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface IDaoHandler<T> {
|
||||
void delete(T t);
|
||||
|
||||
void deleteAll();
|
||||
|
||||
void deleteById(long j);
|
||||
|
||||
void deleteInTx(List<T> list);
|
||||
|
||||
long insert(T t);
|
||||
|
||||
void insertInTx(List<T> list);
|
||||
|
||||
long insertOrUpdate(T t);
|
||||
|
||||
void insertOrUpdateInTx(List<T> list);
|
||||
|
||||
List<T> selectAll();
|
||||
|
||||
T selectById(Long l);
|
||||
|
||||
T selectUnique(T t);
|
||||
|
||||
void update(T t);
|
||||
|
||||
void updateInTx(List<T> list);
|
||||
}
|
34
sources/com/ubt/jimu/base/db/JimuDaoMaster.java
Normal file
34
sources/com/ubt/jimu/base/db/JimuDaoMaster.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package com.ubt.jimu.base.db;
|
||||
|
||||
import com.ubt.jimu.gen.DaoSession;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.AbstractDaoMaster;
|
||||
import org.greenrobot.greendao.AbstractDaoSession;
|
||||
import org.greenrobot.greendao.database.Database;
|
||||
import org.greenrobot.greendao.identityscope.IdentityScopeType;
|
||||
|
||||
@Deprecated
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuDaoMaster extends AbstractDaoMaster {
|
||||
public static final int SCHEMA_VERSION = 1;
|
||||
|
||||
public JimuDaoMaster(Database database, List<Class<? extends AbstractDao<?, ?>>> list) {
|
||||
super(database, 1);
|
||||
Iterator<Class<? extends AbstractDao<?, ?>>> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
registerDaoClass(it.next());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.AbstractDaoMaster
|
||||
public AbstractDaoSession newSession() {
|
||||
return new DaoSession(this.db, IdentityScopeType.Session, this.daoConfigMap);
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.AbstractDaoMaster
|
||||
public AbstractDaoSession newSession(IdentityScopeType identityScopeType) {
|
||||
return new DaoSession(this.db, identityScopeType, this.daoConfigMap);
|
||||
}
|
||||
}
|
137
sources/com/ubt/jimu/base/db/JimuOpenHelper.java
Normal file
137
sources/com/ubt/jimu/base/db/JimuOpenHelper.java
Normal file
@@ -0,0 +1,137 @@
|
||||
package com.ubt.jimu.base.db;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.util.Log;
|
||||
import com.ubt.jimu.gen.BlocklyProjectDao;
|
||||
import com.ubt.jimu.gen.DaoMaster;
|
||||
import com.ubt.jimu.gen.DiyDBModelDao;
|
||||
import com.ubt.jimu.gen.DiyModelActionDao;
|
||||
import com.ubt.jimu.gen.DiyProgramFileDao;
|
||||
import com.ubt.jimu.gen.FirmwareVersionDao;
|
||||
import com.ubt.jimu.gen.JimuMotionDao;
|
||||
import com.ubt.jimu.gen.JimuSoundDao;
|
||||
import com.ubt.jimu.gen.PackageDao;
|
||||
import com.ubt.jimu.gen.TransportFileDao;
|
||||
import com.ubtrobot.log.ALog;
|
||||
import org.greenrobot.greendao.database.Database;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuOpenHelper extends DaoMaster.OpenHelper {
|
||||
public JimuOpenHelper(Context context, String str) {
|
||||
super(context, str);
|
||||
}
|
||||
|
||||
private void addColumn(SQLiteDatabase sQLiteDatabase, String str, String str2, String str3, boolean z, int i) {
|
||||
sQLiteDatabase.execSQL(createAddColumnSql(str, str2, str3, z, i));
|
||||
}
|
||||
|
||||
private String createAddColumnSql(String str, String str2, String str3, boolean z, int i) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("ALTER TABLE ");
|
||||
sb.append(str);
|
||||
sb.append(" ADD COLUMN ");
|
||||
sb.append(str2);
|
||||
sb.append(" ");
|
||||
sb.append(str3);
|
||||
if (z) {
|
||||
sb.append(";");
|
||||
} else {
|
||||
sb.append(" NOT NULL DEFAULT(");
|
||||
sb.append(i);
|
||||
sb.append(");");
|
||||
}
|
||||
String sb2 = sb.toString();
|
||||
ALog.a("JimuOpenHelper").d(sb2);
|
||||
return sb2;
|
||||
}
|
||||
|
||||
private void upgrade310(SQLiteDatabase sQLiteDatabase) {
|
||||
addColumn(sQLiteDatabase, DiyDBModelDao.TABLENAME, DiyDBModelDao.Properties.LastUploadTime.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, TransportFileDao.TABLENAME, TransportFileDao.Properties.FileType.e, "TEXT", true, 0);
|
||||
addColumn(sQLiteDatabase, TransportFileDao.TABLENAME, TransportFileDao.Properties.Uploaded.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, BlocklyProjectDao.TABLENAME, BlocklyProjectDao.Properties.LastUploadTime.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, BlocklyProjectDao.TABLENAME, BlocklyProjectDao.Properties.ModelId.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, BlocklyProjectDao.TABLENAME, BlocklyProjectDao.Properties.IsFirst.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, BlocklyProjectDao.TABLENAME, BlocklyProjectDao.Properties.IsUploadQiNiu.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, BlocklyProjectDao.TABLENAME, BlocklyProjectDao.Properties.IsUploadService.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, BlocklyProjectDao.TABLENAME, BlocklyProjectDao.Properties.IsModify.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuSoundDao.TABLENAME, JimuSoundDao.Properties.IsUploadQiNiu.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuSoundDao.TABLENAME, JimuSoundDao.Properties.IsSyncUbtService.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuSoundDao.TABLENAME, JimuSoundDao.Properties.LastUploadTime.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuSoundDao.TABLENAME, JimuSoundDao.Properties.IsFirst.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuSoundDao.TABLENAME, JimuSoundDao.Properties.AudioId.e, "TEXT", true, 0);
|
||||
addColumn(sQLiteDatabase, JimuMotionDao.TABLENAME, JimuMotionDao.Properties.LastUploadTime.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuMotionDao.TABLENAME, JimuMotionDao.Properties.IsFirst.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuMotionDao.TABLENAME, JimuMotionDao.Properties.IsUploadService.e, "INTEGER", false, 0);
|
||||
addColumn(sQLiteDatabase, JimuMotionDao.TABLENAME, JimuMotionDao.Properties.ModelId.e, "INTEGER", false, 0);
|
||||
DiyModelActionDao.a(wrap(sQLiteDatabase), true);
|
||||
}
|
||||
|
||||
private void upgrade320(SQLiteDatabase sQLiteDatabase) {
|
||||
addColumn(sQLiteDatabase, "PACKAGE", PackageDao.Properties.VideoThumbnail.e, "STRING", true, 0);
|
||||
addColumn(sQLiteDatabase, "PACKAGE", PackageDao.Properties.VideoUrl.e, "STRING", true, 0);
|
||||
addColumn(sQLiteDatabase, "PACKAGE", PackageDao.Properties.Played.e, "INTEGER", true, 0);
|
||||
}
|
||||
|
||||
private void upgrade7(SQLiteDatabase sQLiteDatabase) {
|
||||
addColumn(sQLiteDatabase, DiyDBModelDao.TABLENAME, DiyDBModelDao.Properties.CompleteState.e, "INTEGER", false, 0);
|
||||
}
|
||||
|
||||
private void upgradeFrom122(SQLiteDatabase sQLiteDatabase) {
|
||||
sQLiteDatabase.execSQL("ALTER TABLE ROBOT ADD COLUMN HAS_MISSION INTEGER;");
|
||||
sQLiteDatabase.execSQL("ALTER TABLE JIMU_COURSE_MISSION ADD COLUMN MODULES_STR TEXT;");
|
||||
}
|
||||
|
||||
private void upgradeFrom223(SQLiteDatabase sQLiteDatabase) {
|
||||
addColumn(sQLiteDatabase, DiyProgramFileDao.TABLENAME, DiyProgramFileDao.Properties.Group.e, "TEXT", true, 0);
|
||||
addColumn(sQLiteDatabase, DiyProgramFileDao.TABLENAME, DiyProgramFileDao.Properties.Language.e, "TEXT", true, 0);
|
||||
}
|
||||
|
||||
private void upgradeTo5(SQLiteDatabase sQLiteDatabase) {
|
||||
addColumn(sQLiteDatabase, "PACKAGE", PackageDao.Properties.EAN.e, "TEXT", true, 0);
|
||||
addColumn(sQLiteDatabase, "PACKAGE", PackageDao.Properties.UPC.e, "TEXT", true, 0);
|
||||
}
|
||||
|
||||
private void upgradeTo8(SQLiteDatabase sQLiteDatabase) {
|
||||
addColumn(sQLiteDatabase, FirmwareVersionDao.TABLENAME, FirmwareVersionDao.Properties.IsForced.e, "INTEGER", false, 0);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.gen.DaoMaster.OpenHelper, org.greenrobot.greendao.database.DatabaseOpenHelper
|
||||
public void onCreate(Database database) {
|
||||
super.onCreate(database);
|
||||
}
|
||||
|
||||
@Override // org.greenrobot.greendao.database.DatabaseOpenHelper, android.database.sqlite.SQLiteOpenHelper
|
||||
public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
|
||||
super.onUpgrade(sQLiteDatabase, i, i2);
|
||||
if (i2 != i) {
|
||||
Log.i("JimuOpenHelper", "onUpgrade version " + i + " to " + i2);
|
||||
if (i <= 1) {
|
||||
upgradeFrom122(sQLiteDatabase);
|
||||
}
|
||||
if (i <= 2) {
|
||||
upgradeFrom223(sQLiteDatabase);
|
||||
}
|
||||
if (i <= 3) {
|
||||
upgrade310(sQLiteDatabase);
|
||||
}
|
||||
if (i <= 4) {
|
||||
upgradeTo5(sQLiteDatabase);
|
||||
}
|
||||
if (i <= 5) {
|
||||
upgrade320(sQLiteDatabase);
|
||||
}
|
||||
if (i <= 6) {
|
||||
upgrade7(sQLiteDatabase);
|
||||
}
|
||||
if (i <= 7) {
|
||||
upgradeTo8(sQLiteDatabase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public JimuOpenHelper(Context context, String str, SQLiteDatabase.CursorFactory cursorFactory) {
|
||||
super(context, str, cursorFactory);
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package com.ubt.jimu.base.db.converter;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.ubt.jimu.diy.model.DiyDetailsModel;
|
||||
import com.ubt.jimu.utils.JsonHelper;
|
||||
import java.util.ArrayList;
|
||||
import org.greenrobot.greendao.converter.PropertyConverter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyBuildStepConvert implements PropertyConverter<ArrayList<DiyDetailsModel.DiyBuildStep>, String> {
|
||||
public String convertToDatabaseValue(ArrayList<DiyDetailsModel.DiyBuildStep> arrayList) {
|
||||
return JsonHelper.a(arrayList);
|
||||
}
|
||||
|
||||
public ArrayList<DiyDetailsModel.DiyBuildStep> convertToEntityProperty(String str) {
|
||||
return (ArrayList) JsonHelper.a(str, new TypeToken<ArrayList<DiyDetailsModel.DiyBuildStep>>() { // from class: com.ubt.jimu.base.db.converter.DiyBuildStepConvert.1
|
||||
}.getType());
|
||||
}
|
||||
}
|
102
sources/com/ubt/jimu/base/db/course/JimuCourseDbHandler.java
Normal file
102
sources/com/ubt/jimu/base/db/course/JimuCourseDbHandler.java
Normal file
@@ -0,0 +1,102 @@
|
||||
package com.ubt.jimu.base.db.course;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.course.repository.JimuCourse;
|
||||
import com.ubt.jimu.gen.JimuCourseDao;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuCourseDbHandler extends AbstractDaoHandler<JimuCourse> {
|
||||
public JimuCourseDbHandler(AbstractDao<JimuCourse, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static JimuCourse getDownloadedCourse(JimuCourse jimuCourse) {
|
||||
QueryBuilder k = new JimuCourseDbHandler(DatabaseUtils.getDaoSession(false).l()).dao.k();
|
||||
k.a(JimuCourseDao.Properties.Id.a(Integer.valueOf(jimuCourse.getId())), new WhereCondition[0]);
|
||||
List<JimuCourse> b = k.b();
|
||||
if (b == null || b.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
for (JimuCourse jimuCourse2 : b) {
|
||||
if (jimuCourse2.getDownload()) {
|
||||
return jimuCourse2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<JimuCourse> getJimuCourseList(String str, long j) {
|
||||
try {
|
||||
QueryBuilder<JimuCourse> k = DatabaseUtils.getDaoSession(false).l().k();
|
||||
k.a(JimuCourseDao.Properties.UserId.a((Object) str), new WhereCondition[0]);
|
||||
k.a(JimuCourseDao.Properties.Id);
|
||||
return k.b();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveOrUpdate(List<JimuCourse> list) {
|
||||
if (list == null) {
|
||||
return;
|
||||
}
|
||||
JimuCourseDao l = DatabaseUtils.getDaoSession(false).l();
|
||||
for (JimuCourse jimuCourse : list) {
|
||||
try {
|
||||
QueryBuilder<JimuCourse> k = l.k();
|
||||
k.a(JimuCourseDao.Properties.UserId.a((Object) jimuCourse.getUserId()), JimuCourseDao.Properties.Id.a(Integer.valueOf(jimuCourse.getId())));
|
||||
JimuCourse c = k.c();
|
||||
if (c == null) {
|
||||
l.f(jimuCourse);
|
||||
} else {
|
||||
c.setDescription(jimuCourse.getDescription());
|
||||
c.setFolderName(jimuCourse.getFolderName());
|
||||
c.setImagePath(jimuCourse.getImagePath());
|
||||
c.setResourceZip(jimuCourse.getResourceZip());
|
||||
c.setImagePathLock(jimuCourse.getImagePathLock());
|
||||
c.setIsAvailable(jimuCourse.getIsAvailable());
|
||||
c.setName(jimuCourse.getName());
|
||||
c.setPassCount(jimuCourse.getPassCount());
|
||||
c.setMissionCount(jimuCourse.getMissionCount());
|
||||
c.setStarMax(jimuCourse.getStarMax());
|
||||
if (jimuCourse.getUpdatedTime() != c.getUpdatedTime()) {
|
||||
c.setDownload(false);
|
||||
}
|
||||
l.j(c);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateAllUserCourseDownloaded(JimuCourse jimuCourse, boolean z) {
|
||||
JimuCourseDao l = DatabaseUtils.getDaoSession(true).l();
|
||||
try {
|
||||
QueryBuilder<JimuCourse> k = l.k();
|
||||
k.a(JimuCourseDao.Properties.Id.a(Integer.valueOf(jimuCourse.getId())), new WhereCondition[0]);
|
||||
List<JimuCourse> b = k.b();
|
||||
if (b == null || b.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
for (JimuCourse jimuCourse2 : b) {
|
||||
jimuCourse2.setDownload(z);
|
||||
jimuCourse2.setUpdatedTime(jimuCourse.getUpdatedTime());
|
||||
l.j(jimuCourse2);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public JimuCourse selectUnique(JimuCourse jimuCourse) {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,110 @@
|
||||
package com.ubt.jimu.base.db.course;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.course.repository.JimuCourseMission;
|
||||
import com.ubt.jimu.gen.DaoSession;
|
||||
import com.ubt.jimu.gen.JimuCourseMissionDao;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuCourseMissionDbHandler extends AbstractDaoHandler<JimuCourseMission> {
|
||||
public JimuCourseMissionDbHandler(AbstractDao<JimuCourseMission, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static JimuCourseMission getJimuCourseMission(JimuCourseMission jimuCourseMission) {
|
||||
try {
|
||||
QueryBuilder<JimuCourseMission> k = DatabaseUtils.getDaoSession(false).m().k();
|
||||
k.a(JimuCourseMissionDao.Properties.UserId.a((Object) jimuCourseMission.getUserId()), JimuCourseMissionDao.Properties.CourseId.a(Long.valueOf(jimuCourseMission.getCourseId())), JimuCourseMissionDao.Properties.TaskId.a(Long.valueOf(jimuCourseMission.getTaskId())), JimuCourseMissionDao.Properties.Id.a(Long.valueOf(jimuCourseMission.getId())));
|
||||
return k.c();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<JimuCourseMission> getJimuCourseMissions(String str, long j, long j2, long j3) {
|
||||
try {
|
||||
QueryBuilder<JimuCourseMission> k = DatabaseUtils.getDaoSession(false).m().k();
|
||||
k.a(JimuCourseMissionDao.Properties.UserId.a((Object) str), JimuCourseMissionDao.Properties.PackageId.a(Long.valueOf(j)), JimuCourseMissionDao.Properties.CourseId.a(Long.valueOf(j2)), JimuCourseMissionDao.Properties.TaskId.a(Long.valueOf(j3)));
|
||||
k.a(JimuCourseMissionDao.Properties.Name);
|
||||
return k.b();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean update(List<JimuCourseMission> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
DaoSession daoSession = DatabaseUtils.getDaoSession(true);
|
||||
for (JimuCourseMission jimuCourseMission : list) {
|
||||
JimuCourseMission jimuCourseMission2 = getJimuCourseMission(jimuCourseMission);
|
||||
if (jimuCourseMission2 != null) {
|
||||
jimuCourseMission.setLocalId(jimuCourseMission2.getLocalId());
|
||||
}
|
||||
}
|
||||
daoSession.m().c((Iterable) list);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean updateMissions(List<JimuCourseMission> list) {
|
||||
JimuCourseMission next;
|
||||
JimuCourseMission jimuCourseMission;
|
||||
if (list == null || list.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
DaoSession daoSession = DatabaseUtils.getDaoSession(true);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Iterator<JimuCourseMission> it = list.iterator();
|
||||
while (it.hasNext() && (jimuCourseMission = getJimuCourseMission((next = it.next()))) != null) {
|
||||
jimuCourseMission.setIsLock(next.getIsLock());
|
||||
jimuCourseMission.setIsSkip(next.getIsSkip());
|
||||
jimuCourseMission.setStar(next.getStar());
|
||||
arrayList.add(jimuCourseMission);
|
||||
}
|
||||
if (arrayList.size() != list.size()) {
|
||||
return false;
|
||||
}
|
||||
daoSession.m().d((Iterable) arrayList);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateNextMission(JimuCourseMission jimuCourseMission) {
|
||||
if (jimuCourseMission == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
JimuCourseMissionDao m = DatabaseUtils.getDaoSession(true).m();
|
||||
JimuCourseMission jimuCourseMission2 = getJimuCourseMission(jimuCourseMission);
|
||||
if (jimuCourseMission2 != null) {
|
||||
jimuCourseMission.setLocalId(jimuCourseMission2.getLocalId());
|
||||
m.b((Object[]) new JimuCourseMission[]{jimuCourseMission});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public JimuCourseMission selectUnique(JimuCourseMission jimuCourseMission) {
|
||||
return null;
|
||||
}
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package com.ubt.jimu.base.db.course;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.course.repository.JimuCourseTask;
|
||||
import com.ubt.jimu.gen.JimuCourseTaskDao;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuCourseTaskDbHaldler extends AbstractDaoHandler<JimuCourseTask> {
|
||||
public JimuCourseTaskDbHaldler(AbstractDao<JimuCourseTask, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static List<JimuCourseTask> getJimuCourseTasks(String str, long j, long j2) {
|
||||
QueryBuilder<JimuCourseTask> k = DatabaseUtils.getDaoSession(false).n().k();
|
||||
k.a(JimuCourseTaskDao.Properties.UserId.a((Object) str), JimuCourseTaskDao.Properties.PackageId.a(Long.valueOf(j)), JimuCourseTaskDao.Properties.CourseId.a(Long.valueOf(j2)));
|
||||
return k.b();
|
||||
}
|
||||
|
||||
public static void saveOrUpdate(List<JimuCourseTask> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
DatabaseUtils.getDaoSession(true).n().c((Iterable) list);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public JimuCourseTask selectUnique(JimuCourseTask jimuCourseTask) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void saveOrUpdate(JimuCourseTask jimuCourseTask) {
|
||||
if (jimuCourseTask == null) {
|
||||
return;
|
||||
}
|
||||
DatabaseUtils.getDaoSession(true).n().a((Object[]) new JimuCourseTask[]{jimuCourseTask});
|
||||
}
|
||||
}
|
8
sources/com/ubt/jimu/base/db/diy/Diy2Type.java
Normal file
8
sources/com/ubt/jimu/base/db/diy/Diy2Type.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum Diy2Type {
|
||||
TEXT,
|
||||
LIST,
|
||||
PICTURE
|
||||
}
|
369
sources/com/ubt/jimu/base/db/diy/DiyDBModel.java
Normal file
369
sources/com/ubt/jimu/base/db/diy/DiyDBModel.java
Normal file
@@ -0,0 +1,369 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.base.entities.RobotLite;
|
||||
import java.io.Serializable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyDBModel implements Serializable, Comparable<DiyDBModel> {
|
||||
private static final int CONTROLLER_COMPLETE = 1;
|
||||
private static final long serialVersionUID = 12840;
|
||||
private String actionPath;
|
||||
private int completeState;
|
||||
private String compressImagePath;
|
||||
private int customModelCategory;
|
||||
private long customModelCreatetime;
|
||||
private String customModelId;
|
||||
private String description;
|
||||
private String filePath;
|
||||
private Long id;
|
||||
private boolean isDelete;
|
||||
private Boolean isModify;
|
||||
private long lastUploadTime;
|
||||
private String modelCreatedId;
|
||||
private Integer modelId;
|
||||
private String modelName;
|
||||
private long modifyTime;
|
||||
private Integer mystep;
|
||||
private String step1Desc;
|
||||
private Integer step1state;
|
||||
private Integer step2state;
|
||||
private Integer step3state;
|
||||
private Integer step4state;
|
||||
private String step5PathDesc;
|
||||
private String step5desc;
|
||||
private Integer step5state;
|
||||
private Integer uploadState;
|
||||
private boolean useable;
|
||||
private String version;
|
||||
|
||||
public DiyDBModel(Long l, String str, String str2, int i, long j, long j2, Boolean bool, Integer num, boolean z, String str3, boolean z2, String str4, String str5, String str6, long j3, String str7, Integer num2, Integer num3, String str8, Integer num4, Integer num5, Integer num6, Integer num7, String str9, String str10, Integer num8, String str11, int i2) {
|
||||
this.isModify = false;
|
||||
this.modelId = 0;
|
||||
this.useable = true;
|
||||
this.isDelete = false;
|
||||
this.uploadState = 0;
|
||||
this.step1state = 0;
|
||||
this.step2state = 0;
|
||||
this.step3state = 0;
|
||||
this.step4state = 0;
|
||||
this.step5state = 0;
|
||||
this.mystep = 0;
|
||||
this.actionPath = "";
|
||||
this.id = l;
|
||||
this.customModelId = str;
|
||||
this.modelName = str2;
|
||||
this.customModelCategory = i;
|
||||
this.customModelCreatetime = j;
|
||||
this.modifyTime = j2;
|
||||
this.isModify = bool;
|
||||
this.modelId = num;
|
||||
this.useable = z;
|
||||
this.version = str3;
|
||||
this.isDelete = z2;
|
||||
this.description = str4;
|
||||
this.modelCreatedId = str5;
|
||||
this.compressImagePath = str6;
|
||||
this.lastUploadTime = j3;
|
||||
this.filePath = str7;
|
||||
this.uploadState = num2;
|
||||
this.step1state = num3;
|
||||
this.step1Desc = str8;
|
||||
this.step2state = num4;
|
||||
this.step3state = num5;
|
||||
this.step4state = num6;
|
||||
this.step5state = num7;
|
||||
this.step5desc = str9;
|
||||
this.step5PathDesc = str10;
|
||||
this.mystep = num8;
|
||||
this.actionPath = str11;
|
||||
this.completeState = i2;
|
||||
}
|
||||
|
||||
public String getActionPath() {
|
||||
return this.actionPath;
|
||||
}
|
||||
|
||||
public int getCompleteState() {
|
||||
return this.completeState;
|
||||
}
|
||||
|
||||
public String getCompressImagePath() {
|
||||
return this.compressImagePath;
|
||||
}
|
||||
|
||||
public int getCustomModelCategory() {
|
||||
return this.customModelCategory;
|
||||
}
|
||||
|
||||
public long getCustomModelCreatetime() {
|
||||
return this.customModelCreatetime;
|
||||
}
|
||||
|
||||
public String getCustomModelId() {
|
||||
return this.customModelId;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
return this.filePath;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public boolean getIsDelete() {
|
||||
return this.isDelete;
|
||||
}
|
||||
|
||||
public Boolean getIsModify() {
|
||||
return this.isModify;
|
||||
}
|
||||
|
||||
public long getLastUploadTime() {
|
||||
return this.lastUploadTime;
|
||||
}
|
||||
|
||||
public String getModelCreatedId() {
|
||||
return this.modelCreatedId;
|
||||
}
|
||||
|
||||
public Integer getModelId() {
|
||||
return this.modelId;
|
||||
}
|
||||
|
||||
public String getModelName() {
|
||||
return this.modelName;
|
||||
}
|
||||
|
||||
public Boolean getModify() {
|
||||
return this.isModify;
|
||||
}
|
||||
|
||||
public long getModifyTime() {
|
||||
return this.modifyTime;
|
||||
}
|
||||
|
||||
public Integer getMyStep() {
|
||||
return this.mystep;
|
||||
}
|
||||
|
||||
public Integer getMystep() {
|
||||
return this.mystep;
|
||||
}
|
||||
|
||||
public RobotLite getRobotLite() {
|
||||
return new RobotLite(this.modelId.intValue(), this.customModelId, this.modelName, this.filePath, true, true);
|
||||
}
|
||||
|
||||
public String getStep1Desc() {
|
||||
return this.step1Desc;
|
||||
}
|
||||
|
||||
public Integer getStep1state() {
|
||||
return this.step1state;
|
||||
}
|
||||
|
||||
public Integer getStep2state() {
|
||||
return this.step2state;
|
||||
}
|
||||
|
||||
public Integer getStep3state() {
|
||||
return this.step3state;
|
||||
}
|
||||
|
||||
public Integer getStep4state() {
|
||||
return this.step4state;
|
||||
}
|
||||
|
||||
public String getStep5PathDesc() {
|
||||
return this.step5PathDesc;
|
||||
}
|
||||
|
||||
public String getStep5desc() {
|
||||
return this.step5desc;
|
||||
}
|
||||
|
||||
public Integer getStep5state() {
|
||||
return this.step5state;
|
||||
}
|
||||
|
||||
public Integer getUploadState() {
|
||||
return this.uploadState;
|
||||
}
|
||||
|
||||
public boolean getUseable() {
|
||||
return this.useable;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public boolean isControllerComplete() {
|
||||
return (this.completeState & 1) > 0;
|
||||
}
|
||||
|
||||
public boolean isDelete() {
|
||||
return this.isDelete;
|
||||
}
|
||||
|
||||
public boolean isUseable() {
|
||||
return this.useable;
|
||||
}
|
||||
|
||||
public void setActionPath(String str) {
|
||||
this.actionPath = str;
|
||||
}
|
||||
|
||||
public void setCompleteState(int i) {
|
||||
this.completeState = i;
|
||||
}
|
||||
|
||||
public void setCompressImagePath(String str) {
|
||||
this.compressImagePath = str;
|
||||
}
|
||||
|
||||
public void setControllerComplete() {
|
||||
this.completeState |= 1;
|
||||
}
|
||||
|
||||
public void setCustomModelCategory(int i) {
|
||||
this.customModelCategory = i;
|
||||
}
|
||||
|
||||
public void setCustomModelCreatetime(long j) {
|
||||
this.customModelCreatetime = j;
|
||||
}
|
||||
|
||||
public void setCustomModelId(String str) {
|
||||
this.customModelId = str;
|
||||
}
|
||||
|
||||
public void setDelete(boolean z) {
|
||||
this.isDelete = z;
|
||||
}
|
||||
|
||||
public void setDescription(String str) {
|
||||
this.description = str;
|
||||
}
|
||||
|
||||
public void setFilePath(String str) {
|
||||
this.filePath = str;
|
||||
}
|
||||
|
||||
public void setId(Long l) {
|
||||
this.id = l;
|
||||
}
|
||||
|
||||
public void setIsDelete(boolean z) {
|
||||
this.isDelete = z;
|
||||
}
|
||||
|
||||
public void setIsModify(Boolean bool) {
|
||||
this.isModify = bool;
|
||||
}
|
||||
|
||||
public void setLastUploadTime(long j) {
|
||||
this.lastUploadTime = j;
|
||||
}
|
||||
|
||||
public void setModelCreatedId(String str) {
|
||||
this.modelCreatedId = str;
|
||||
}
|
||||
|
||||
public void setModelId(Integer num) {
|
||||
this.modelId = num;
|
||||
}
|
||||
|
||||
public void setModelName(String str) {
|
||||
this.modelName = str;
|
||||
}
|
||||
|
||||
public void setModify(Boolean bool) {
|
||||
this.isModify = bool;
|
||||
}
|
||||
|
||||
public void setModifyTime(long j) {
|
||||
this.modifyTime = j;
|
||||
}
|
||||
|
||||
public void setMyStep(Integer num) {
|
||||
this.mystep = num;
|
||||
}
|
||||
|
||||
public void setMystep(Integer num) {
|
||||
this.mystep = num;
|
||||
}
|
||||
|
||||
public void setStep1Desc(String str) {
|
||||
this.step1Desc = str;
|
||||
}
|
||||
|
||||
public void setStep1state(Integer num) {
|
||||
this.step1state = num;
|
||||
}
|
||||
|
||||
public void setStep2state(Integer num) {
|
||||
this.step2state = num;
|
||||
}
|
||||
|
||||
public void setStep3state(Integer num) {
|
||||
this.step3state = num;
|
||||
}
|
||||
|
||||
public void setStep4state(Integer num) {
|
||||
this.step4state = num;
|
||||
}
|
||||
|
||||
public void setStep5PathDesc(String str) {
|
||||
this.step5PathDesc = str;
|
||||
}
|
||||
|
||||
public void setStep5desc(String str) {
|
||||
this.step5desc = str;
|
||||
}
|
||||
|
||||
public void setStep5state(Integer num) {
|
||||
this.step5state = num;
|
||||
}
|
||||
|
||||
public void setUploadState(Integer num) {
|
||||
this.uploadState = num;
|
||||
}
|
||||
|
||||
public void setUseable(boolean z) {
|
||||
this.useable = z;
|
||||
}
|
||||
|
||||
public void setVersion(String str) {
|
||||
this.version = str;
|
||||
}
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
public int compareTo(DiyDBModel diyDBModel) {
|
||||
if (TextUtils.isEmpty(diyDBModel.getCustomModelId()) || TextUtils.isEmpty(this.customModelId)) {
|
||||
return 1;
|
||||
}
|
||||
return Long.parseLong(this.customModelId) > Long.parseLong(diyDBModel.getCustomModelId()) ? -1 : 0;
|
||||
}
|
||||
|
||||
public DiyDBModel() {
|
||||
this.isModify = false;
|
||||
this.modelId = 0;
|
||||
this.useable = true;
|
||||
this.isDelete = false;
|
||||
this.uploadState = 0;
|
||||
this.step1state = 0;
|
||||
this.step2state = 0;
|
||||
this.step3state = 0;
|
||||
this.step4state = 0;
|
||||
this.step5state = 0;
|
||||
this.mystep = 0;
|
||||
this.actionPath = "";
|
||||
}
|
||||
}
|
321
sources/com/ubt/jimu/base/db/diy/DiyDBModelCopy.java
Normal file
321
sources/com/ubt/jimu/base/db/diy/DiyDBModelCopy.java
Normal file
@@ -0,0 +1,321 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyDBModelCopy {
|
||||
private String actionPath;
|
||||
private String compressImagePath;
|
||||
private int customModelCategory;
|
||||
private long customModelCreatetime;
|
||||
private String customModelId;
|
||||
private String description;
|
||||
private String filePath;
|
||||
private Long id;
|
||||
private boolean isDelete;
|
||||
private Boolean isModify;
|
||||
private String modelCreatedId;
|
||||
private Integer modelId;
|
||||
private String modelName;
|
||||
private long modifyTime;
|
||||
private Integer mystep;
|
||||
private String step1Desc;
|
||||
private Integer step1state;
|
||||
private Integer step2state;
|
||||
private Integer step3state;
|
||||
private Integer step4state;
|
||||
private String step5PathDesc;
|
||||
private String step5desc;
|
||||
private Integer step5state;
|
||||
private Integer uploadState;
|
||||
private boolean useable;
|
||||
private String version;
|
||||
|
||||
public DiyDBModelCopy() {
|
||||
this.isModify = false;
|
||||
this.useable = true;
|
||||
this.isDelete = false;
|
||||
this.uploadState = 0;
|
||||
this.step1state = 0;
|
||||
this.step2state = 0;
|
||||
this.step3state = 0;
|
||||
this.step4state = 0;
|
||||
this.step5state = 0;
|
||||
this.mystep = 0;
|
||||
this.actionPath = "";
|
||||
}
|
||||
|
||||
public String getActionPath() {
|
||||
return this.actionPath;
|
||||
}
|
||||
|
||||
public String getCompressImagePath() {
|
||||
return this.compressImagePath;
|
||||
}
|
||||
|
||||
public int getCustomModelCategory() {
|
||||
return this.customModelCategory;
|
||||
}
|
||||
|
||||
public long getCustomModelCreatetime() {
|
||||
return this.customModelCreatetime;
|
||||
}
|
||||
|
||||
public String getCustomModelId() {
|
||||
return this.customModelId;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
return this.filePath;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public boolean getIsDelete() {
|
||||
return this.isDelete;
|
||||
}
|
||||
|
||||
public Boolean getIsModify() {
|
||||
return this.isModify;
|
||||
}
|
||||
|
||||
public String getModelCreatedId() {
|
||||
return this.modelCreatedId;
|
||||
}
|
||||
|
||||
public Integer getModelId() {
|
||||
return this.modelId;
|
||||
}
|
||||
|
||||
public String getModelName() {
|
||||
return this.modelName;
|
||||
}
|
||||
|
||||
public Boolean getModify() {
|
||||
return this.isModify;
|
||||
}
|
||||
|
||||
public long getModifyTime() {
|
||||
return this.modifyTime;
|
||||
}
|
||||
|
||||
public Integer getMyStep() {
|
||||
return this.mystep;
|
||||
}
|
||||
|
||||
public Integer getMystep() {
|
||||
return this.mystep;
|
||||
}
|
||||
|
||||
public String getStep1Desc() {
|
||||
return this.step1Desc;
|
||||
}
|
||||
|
||||
public Integer getStep1state() {
|
||||
return this.step1state;
|
||||
}
|
||||
|
||||
public Integer getStep2state() {
|
||||
return this.step2state;
|
||||
}
|
||||
|
||||
public Integer getStep3state() {
|
||||
return this.step3state;
|
||||
}
|
||||
|
||||
public Integer getStep4state() {
|
||||
return this.step4state;
|
||||
}
|
||||
|
||||
public String getStep5PathDesc() {
|
||||
return this.step5PathDesc;
|
||||
}
|
||||
|
||||
public String getStep5desc() {
|
||||
return this.step5desc;
|
||||
}
|
||||
|
||||
public Integer getStep5state() {
|
||||
return this.step5state;
|
||||
}
|
||||
|
||||
public Integer getUploadState() {
|
||||
return this.uploadState;
|
||||
}
|
||||
|
||||
public boolean getUseable() {
|
||||
return this.useable;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public boolean isDelete() {
|
||||
return this.isDelete;
|
||||
}
|
||||
|
||||
public boolean isUseable() {
|
||||
return this.useable;
|
||||
}
|
||||
|
||||
public void setActionPath(String str) {
|
||||
this.actionPath = str;
|
||||
}
|
||||
|
||||
public void setCompressImagePath(String str) {
|
||||
this.compressImagePath = str;
|
||||
}
|
||||
|
||||
public void setCustomModelCategory(int i) {
|
||||
this.customModelCategory = i;
|
||||
}
|
||||
|
||||
public void setCustomModelCreatetime(long j) {
|
||||
this.customModelCreatetime = j;
|
||||
}
|
||||
|
||||
public void setCustomModelId(String str) {
|
||||
this.customModelId = str;
|
||||
}
|
||||
|
||||
public void setDelete(boolean z) {
|
||||
this.isDelete = z;
|
||||
}
|
||||
|
||||
public void setDescription(String str) {
|
||||
this.description = str;
|
||||
}
|
||||
|
||||
public void setFilePath(String str) {
|
||||
this.filePath = str;
|
||||
}
|
||||
|
||||
public void setId(Long l) {
|
||||
this.id = l;
|
||||
}
|
||||
|
||||
public void setIsDelete(boolean z) {
|
||||
this.isDelete = z;
|
||||
}
|
||||
|
||||
public void setIsModify(Boolean bool) {
|
||||
this.isModify = bool;
|
||||
}
|
||||
|
||||
public void setModelCreatedId(String str) {
|
||||
this.modelCreatedId = str;
|
||||
}
|
||||
|
||||
public void setModelId(Integer num) {
|
||||
this.modelId = num;
|
||||
}
|
||||
|
||||
public void setModelName(String str) {
|
||||
this.modelName = str;
|
||||
}
|
||||
|
||||
public void setModify(Boolean bool) {
|
||||
this.isModify = bool;
|
||||
}
|
||||
|
||||
public void setModifyTime(long j) {
|
||||
this.modifyTime = j;
|
||||
}
|
||||
|
||||
public void setMyStep(Integer num) {
|
||||
this.mystep = num;
|
||||
}
|
||||
|
||||
public void setMystep(Integer num) {
|
||||
this.mystep = num;
|
||||
}
|
||||
|
||||
public void setStep1Desc(String str) {
|
||||
this.step1Desc = str;
|
||||
}
|
||||
|
||||
public void setStep1state(Integer num) {
|
||||
this.step1state = num;
|
||||
}
|
||||
|
||||
public void setStep2state(Integer num) {
|
||||
this.step2state = num;
|
||||
}
|
||||
|
||||
public void setStep3state(Integer num) {
|
||||
this.step3state = num;
|
||||
}
|
||||
|
||||
public void setStep4state(Integer num) {
|
||||
this.step4state = num;
|
||||
}
|
||||
|
||||
public void setStep5PathDesc(String str) {
|
||||
this.step5PathDesc = str;
|
||||
}
|
||||
|
||||
public void setStep5desc(String str) {
|
||||
this.step5desc = str;
|
||||
}
|
||||
|
||||
public void setStep5state(Integer num) {
|
||||
this.step5state = num;
|
||||
}
|
||||
|
||||
public void setUploadState(Integer num) {
|
||||
this.uploadState = num;
|
||||
}
|
||||
|
||||
public void setUseable(boolean z) {
|
||||
this.useable = z;
|
||||
}
|
||||
|
||||
public void setVersion(String str) {
|
||||
this.version = str;
|
||||
}
|
||||
|
||||
public DiyDBModelCopy(Long l, String str, String str2, int i, long j, long j2, Boolean bool, Integer num, boolean z, String str3, boolean z2, String str4, String str5, String str6, String str7, Integer num2, Integer num3, String str8, Integer num4, Integer num5, Integer num6, Integer num7, String str9, String str10, Integer num8, String str11) {
|
||||
this.isModify = false;
|
||||
this.useable = true;
|
||||
this.isDelete = false;
|
||||
this.uploadState = 0;
|
||||
this.step1state = 0;
|
||||
this.step2state = 0;
|
||||
this.step3state = 0;
|
||||
this.step4state = 0;
|
||||
this.step5state = 0;
|
||||
this.mystep = 0;
|
||||
this.actionPath = "";
|
||||
this.id = l;
|
||||
this.customModelId = str;
|
||||
this.modelName = str2;
|
||||
this.customModelCategory = i;
|
||||
this.customModelCreatetime = j;
|
||||
this.modifyTime = j2;
|
||||
this.isModify = bool;
|
||||
this.modelId = num;
|
||||
this.useable = z;
|
||||
this.version = str3;
|
||||
this.isDelete = z2;
|
||||
this.description = str4;
|
||||
this.modelCreatedId = str5;
|
||||
this.compressImagePath = str6;
|
||||
this.filePath = str7;
|
||||
this.uploadState = num2;
|
||||
this.step1state = num3;
|
||||
this.step1Desc = str8;
|
||||
this.step2state = num4;
|
||||
this.step3state = num5;
|
||||
this.step4state = num6;
|
||||
this.step5state = num7;
|
||||
this.step5desc = str9;
|
||||
this.step5PathDesc = str10;
|
||||
this.mystep = num8;
|
||||
this.actionPath = str11;
|
||||
}
|
||||
}
|
22
sources/com/ubt/jimu/base/db/diy/DiyDetailsDbHandler.java
Normal file
22
sources/com/ubt/jimu/base/db/diy/DiyDetailsDbHandler.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.diy.model.DiyDetailsModel;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyDetailsDbHandler extends AbstractDaoHandler<DiyDetailsModel> {
|
||||
public DiyDetailsDbHandler(AbstractDao<DiyDetailsModel, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public boolean checkDownload(DiyDetailsModel diyDetailsModel) {
|
||||
DiyDetailsModel selectById = selectById(diyDetailsModel.getId());
|
||||
return selectById != null && selectById.getDownload();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public DiyDetailsModel selectUnique(DiyDetailsModel diyDetailsModel) {
|
||||
return null;
|
||||
}
|
||||
}
|
89
sources/com/ubt/jimu/base/db/diy/DiyHelper.java
Normal file
89
sources/com/ubt/jimu/base/db/diy/DiyHelper.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import android.content.Context;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.gen.DaoMaster;
|
||||
import com.ubt.jimu.gen.DaoSession;
|
||||
import com.ubt.jimu.gen.DiyDBModelDao;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyHelper {
|
||||
public static final boolean ENCRYPTED = true;
|
||||
private static final DiyHelper ourInstance = new DiyHelper();
|
||||
private DaoSession daoSession;
|
||||
|
||||
private DiyHelper() {
|
||||
}
|
||||
|
||||
public static DiyHelper getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
public void deleteItem(DiyDBModel diyDBModel) {
|
||||
DatabaseUtils.getDaoSession(true).a((DaoSession) diyDBModel);
|
||||
}
|
||||
|
||||
public DaoSession getDaoSession() {
|
||||
return this.daoSession;
|
||||
}
|
||||
|
||||
public List<DiyDBModel> getDiyList() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
try {
|
||||
QueryBuilder<DiyDBModel> k = DatabaseUtils.getDaoSession(true).d().k();
|
||||
k.a(DiyDBModelDao.Properties.ModelCreatedId.a((Object) Cache.getInstance().getUserId()), new WhereCondition[0]);
|
||||
List<DiyDBModel> b = k.b();
|
||||
for (int size = b.size(); size > 0; size--) {
|
||||
arrayList.add(b.get(size - 1));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public void insertData(DiyDBModel diyDBModel) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).b((DaoSession) diyDBModel);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean nameRepeat(String str) {
|
||||
QueryBuilder b = DatabaseUtils.getDaoSession(false).b(DiyDBModel.class);
|
||||
b.a(DiyDBModelDao.Properties.ModelName.a((Object) str), new WhereCondition[0]);
|
||||
return ((DiyDBModel) b.c()) != null;
|
||||
}
|
||||
|
||||
public boolean queryForName(String str) {
|
||||
try {
|
||||
QueryBuilder<DiyDBModel> k = DatabaseUtils.getDaoSession(true).d().k();
|
||||
k.a(DiyDBModelDao.Properties.ModelName.a((Object) str), new WhereCondition[0]);
|
||||
return k.c() != null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public DiyDBModel queryForUUid(String str) {
|
||||
try {
|
||||
QueryBuilder<DiyDBModel> k = DatabaseUtils.getDaoSession(true).d().k();
|
||||
k.a(DiyDBModelDao.Properties.CustomModelId.a((Object) str), new WhereCondition[0]);
|
||||
return k.c();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new DiyDBModel();
|
||||
}
|
||||
}
|
||||
|
||||
public void rigisterDb(Context context) {
|
||||
this.daoSession = new DaoMaster(new DaoMaster.DevOpenHelper(context, "diy-db-encrypted").getEncryptedWritableDb("super-secret")).newSession();
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.blockly.Utils;
|
||||
import com.ubt.jimu.blockly.bean.BlocklyProject;
|
||||
import com.ubt.jimu.diy.DiyRobotDbHandler;
|
||||
import com.ubt.jimu.diy.model.DiyProgramFile;
|
||||
import com.ubt.jimu.gen.DiyProgramFileDao;
|
||||
import com.ubt.jimu.unity.ModelType;
|
||||
import com.ubt.jimu.utils.LocaleUtils;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyProgramFileDbHandler extends AbstractDaoHandler<DiyProgramFile> {
|
||||
public DiyProgramFileDbHandler(AbstractDao<DiyProgramFile, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static List<BlocklyProject> getDiyBlocklyProject(String str) {
|
||||
DiyProgramFileDbHandler diyProgramFileDbHandler = new DiyProgramFileDbHandler(DatabaseUtils.getDaoSession(true).g());
|
||||
ArrayList arrayList = new ArrayList();
|
||||
List<DiyProgramFile> diyProgramFile = diyProgramFileDbHandler.getDiyProgramFile(str);
|
||||
if (diyProgramFile.size() == 0) {
|
||||
return arrayList;
|
||||
}
|
||||
for (DiyProgramFile diyProgramFile2 : diyProgramFile) {
|
||||
File file = new File(DiyRobotDbHandler.getModelPath(str, ModelType.PLAYER_DATA) + str + Utils.BLOCKLY_ADD_PATH + File.separator + diyProgramFile2.getBlocklyProjectXmlName());
|
||||
if (file.exists() && !file.isDirectory()) {
|
||||
BlocklyProject blocklyProject = new BlocklyProject();
|
||||
blocklyProject.setBlocklyType(diyProgramFile2.getType());
|
||||
blocklyProject.setBlocklyVersion(diyProgramFile2.getBlocklyVersion());
|
||||
blocklyProject.setCustomModelId(diyProgramFile2.getCustomModelId());
|
||||
blocklyProject.setXmlId(diyProgramFile2.getBlocklyProjectXmlId());
|
||||
blocklyProject.setXmlName(diyProgramFile2.getName());
|
||||
blocklyProject.setIsDeleted("0");
|
||||
blocklyProject.setModelType(String.valueOf(ModelType.PLAYER_DATA.getType()));
|
||||
arrayList.add(blocklyProject);
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public List<DiyProgramFile> getDiyProgramFile(String str) {
|
||||
QueryBuilder k = this.dao.k();
|
||||
k.a(DiyProgramFileDao.Properties.CustomModelId.a((Object) str), DiyProgramFileDao.Properties.Language.a((Object) LocaleUtils.b()));
|
||||
List<DiyProgramFile> b = k.b();
|
||||
return b == null ? new ArrayList() : b;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public DiyProgramFile selectUnique(DiyProgramFile diyProgramFile) {
|
||||
return null;
|
||||
}
|
||||
}
|
59
sources/com/ubt/jimu/base/db/diy/DiyRobotFileDbDandler.java
Normal file
59
sources/com/ubt/jimu/base/db/diy/DiyRobotFileDbDandler.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.diy.DiyRobotFile;
|
||||
import com.ubt.jimu.gen.DiyRobotFileDao;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyRobotFileDbDandler extends AbstractDaoHandler<DiyRobotFile> {
|
||||
public DiyRobotFileDbDandler(AbstractDao<DiyRobotFile, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static DiyRobotFile query(DiyRobotFile diyRobotFile) {
|
||||
if (diyRobotFile == null) {
|
||||
return null;
|
||||
}
|
||||
QueryBuilder<DiyRobotFile> k = DatabaseUtils.getDaoSession(false).h().k();
|
||||
k.a(DiyRobotFileDao.Properties.CustomModelId.a(TextUtils.isEmpty(diyRobotFile.getCustomModelId()) ? Integer.valueOf(diyRobotFile.getServerModelId()) : diyRobotFile.getCustomModelId()), DiyRobotFileDao.Properties.FileType.a(Integer.valueOf(diyRobotFile.getFileType())), DiyRobotFileDao.Properties.FileName.a((Object) diyRobotFile.getFileName()), DiyRobotFileDao.Properties.ServerModelId.a(Integer.valueOf(diyRobotFile.getServerModelId())));
|
||||
return k.c();
|
||||
}
|
||||
|
||||
public static List<DiyRobotFile> queryDiyRobotFile(String str) {
|
||||
QueryBuilder<DiyRobotFile> k = DatabaseUtils.getDaoSession(false).h().k();
|
||||
k.a(DiyRobotFileDao.Properties.CustomModelId.a((Object) str), new WhereCondition[0]);
|
||||
return k.b();
|
||||
}
|
||||
|
||||
public static void saveOrUpdate(DiyRobotFile diyRobotFile) {
|
||||
if (diyRobotFile == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
DiyRobotFileDao h = DatabaseUtils.getDaoSession(false).h();
|
||||
QueryBuilder<DiyRobotFile> k = h.k();
|
||||
k.a(DiyRobotFileDao.Properties.CustomModelId.a(TextUtils.isEmpty(diyRobotFile.getCustomModelId()) ? Integer.valueOf(diyRobotFile.getServerModelId()) : diyRobotFile.getCustomModelId()), DiyRobotFileDao.Properties.FileType.a(Integer.valueOf(diyRobotFile.getFileType())), DiyRobotFileDao.Properties.FileName.a((Object) diyRobotFile.getFileName()), DiyRobotFileDao.Properties.ServerModelId.a(Integer.valueOf(diyRobotFile.getServerModelId())));
|
||||
DiyRobotFile c = k.c();
|
||||
if (c == null) {
|
||||
h.f(diyRobotFile);
|
||||
} else {
|
||||
diyRobotFile.setId(c.getId());
|
||||
h.g(diyRobotFile);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public DiyRobotFile selectUnique(DiyRobotFile diyRobotFile) {
|
||||
return null;
|
||||
}
|
||||
}
|
37
sources/com/ubt/jimu/base/db/diy/DiyStep2Helper.java
Normal file
37
sources/com/ubt/jimu/base/db/diy/DiyStep2Helper.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.gen.DiyStep2ModelDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyStep2Helper {
|
||||
private static final DiyStep2Helper ourInstance = new DiyStep2Helper();
|
||||
|
||||
private DiyStep2Helper() {
|
||||
}
|
||||
|
||||
public static DiyStep2Helper getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
public void insertData(DiyStep2Model diyStep2Model) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).i().g(diyStep2Model);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public DiyStep2Model queryForUUid(String str) {
|
||||
try {
|
||||
QueryBuilder<DiyStep2Model> k = DatabaseUtils.getDaoSession(true).i().k();
|
||||
k.a(DiyStep2ModelDao.Properties.CustomModelId.a((Object) str), new WhereCondition[0]);
|
||||
return k.c();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new DiyStep2Model();
|
||||
}
|
||||
}
|
||||
}
|
169
sources/com/ubt/jimu/base/db/diy/DiyStep2Model.java
Normal file
169
sources/com/ubt/jimu/base/db/diy/DiyStep2Model.java
Normal file
@@ -0,0 +1,169 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyStep2Model {
|
||||
private String customModelId;
|
||||
private Integer direction;
|
||||
private String directionPath;
|
||||
private String modelName;
|
||||
private String picJson;
|
||||
private Integer step1lock;
|
||||
private Integer step1state;
|
||||
private Integer step2lock;
|
||||
private Integer step2state;
|
||||
private Integer step3lock;
|
||||
private Integer step3state;
|
||||
private Integer step4lock;
|
||||
private Integer step4state;
|
||||
private String stepDesc;
|
||||
|
||||
public DiyStep2Model(String str, String str2, Integer num, Integer num2, String str3, String str4, Integer num3, Integer num4, Integer num5, String str5, Integer num6, Integer num7, Integer num8, Integer num9) {
|
||||
this.step1state = 0;
|
||||
this.step1lock = 0;
|
||||
this.step2state = 0;
|
||||
this.step2lock = 0;
|
||||
this.direction = 1;
|
||||
this.step3state = 0;
|
||||
this.step3lock = 0;
|
||||
this.step4state = 0;
|
||||
this.step4lock = 0;
|
||||
this.customModelId = str;
|
||||
this.modelName = str2;
|
||||
this.step1state = num;
|
||||
this.step1lock = num2;
|
||||
this.stepDesc = str3;
|
||||
this.picJson = str4;
|
||||
this.step2state = num3;
|
||||
this.step2lock = num4;
|
||||
this.direction = num5;
|
||||
this.directionPath = str5;
|
||||
this.step3state = num6;
|
||||
this.step3lock = num7;
|
||||
this.step4state = num8;
|
||||
this.step4lock = num9;
|
||||
}
|
||||
|
||||
public String getCustomModelId() {
|
||||
return this.customModelId;
|
||||
}
|
||||
|
||||
public Integer getDirection() {
|
||||
return this.direction;
|
||||
}
|
||||
|
||||
public String getDirectionPath() {
|
||||
return this.directionPath;
|
||||
}
|
||||
|
||||
public String getModelName() {
|
||||
return this.modelName;
|
||||
}
|
||||
|
||||
public String getPicJson() {
|
||||
return this.picJson;
|
||||
}
|
||||
|
||||
public Integer getStep1lock() {
|
||||
return this.step1lock;
|
||||
}
|
||||
|
||||
public Integer getStep1state() {
|
||||
return this.step1state;
|
||||
}
|
||||
|
||||
public Integer getStep2lock() {
|
||||
return this.step2lock;
|
||||
}
|
||||
|
||||
public Integer getStep2state() {
|
||||
return this.step2state;
|
||||
}
|
||||
|
||||
public Integer getStep3lock() {
|
||||
return this.step3lock;
|
||||
}
|
||||
|
||||
public Integer getStep3state() {
|
||||
return this.step3state;
|
||||
}
|
||||
|
||||
public Integer getStep4lock() {
|
||||
return this.step4lock;
|
||||
}
|
||||
|
||||
public Integer getStep4state() {
|
||||
return this.step4state;
|
||||
}
|
||||
|
||||
public String getStepDesc() {
|
||||
return this.stepDesc;
|
||||
}
|
||||
|
||||
public void setCustomModelId(String str) {
|
||||
this.customModelId = str;
|
||||
}
|
||||
|
||||
public void setDirection(Integer num) {
|
||||
this.direction = num;
|
||||
}
|
||||
|
||||
public void setDirectionPath(String str) {
|
||||
this.directionPath = str;
|
||||
}
|
||||
|
||||
public void setModelName(String str) {
|
||||
this.modelName = str;
|
||||
}
|
||||
|
||||
public void setPicJson(String str) {
|
||||
this.picJson = str;
|
||||
}
|
||||
|
||||
public void setStep1lock(Integer num) {
|
||||
this.step1lock = num;
|
||||
}
|
||||
|
||||
public void setStep1state(Integer num) {
|
||||
this.step1state = num;
|
||||
}
|
||||
|
||||
public void setStep2lock(Integer num) {
|
||||
this.step2lock = num;
|
||||
}
|
||||
|
||||
public void setStep2state(Integer num) {
|
||||
this.step2state = num;
|
||||
}
|
||||
|
||||
public void setStep3lock(Integer num) {
|
||||
this.step3lock = num;
|
||||
}
|
||||
|
||||
public void setStep3state(Integer num) {
|
||||
this.step3state = num;
|
||||
}
|
||||
|
||||
public void setStep4lock(Integer num) {
|
||||
this.step4lock = num;
|
||||
}
|
||||
|
||||
public void setStep4state(Integer num) {
|
||||
this.step4state = num;
|
||||
}
|
||||
|
||||
public void setStepDesc(String str) {
|
||||
this.stepDesc = str;
|
||||
}
|
||||
|
||||
public DiyStep2Model() {
|
||||
this.step1state = 0;
|
||||
this.step1lock = 0;
|
||||
this.step2state = 0;
|
||||
this.step2lock = 0;
|
||||
this.direction = 1;
|
||||
this.step3state = 0;
|
||||
this.step3lock = 0;
|
||||
this.step4state = 0;
|
||||
this.step4lock = 0;
|
||||
}
|
||||
}
|
14
sources/com/ubt/jimu/base/db/diy/DiyStep2TypeConverter.java
Normal file
14
sources/com/ubt/jimu/base/db/diy/DiyStep2TypeConverter.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import org.greenrobot.greendao.converter.PropertyConverter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyStep2TypeConverter implements PropertyConverter<Diy2Type, String> {
|
||||
public String convertToDatabaseValue(Diy2Type diy2Type) {
|
||||
return diy2Type.name();
|
||||
}
|
||||
|
||||
public Diy2Type convertToEntityProperty(String str) {
|
||||
return Diy2Type.valueOf(str);
|
||||
}
|
||||
}
|
8
sources/com/ubt/jimu/base/db/diy/DiyType.java
Normal file
8
sources/com/ubt/jimu/base/db/diy/DiyType.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum DiyType {
|
||||
TEXT,
|
||||
LIST,
|
||||
PICTURE
|
||||
}
|
14
sources/com/ubt/jimu/base/db/diy/DiyTypeConverter.java
Normal file
14
sources/com/ubt/jimu/base/db/diy/DiyTypeConverter.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
import org.greenrobot.greendao.converter.PropertyConverter;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyTypeConverter implements PropertyConverter<DiyType, String> {
|
||||
public String convertToDatabaseValue(DiyType diyType) {
|
||||
return diyType.name();
|
||||
}
|
||||
|
||||
public DiyType convertToEntityProperty(String str) {
|
||||
return DiyType.valueOf(str);
|
||||
}
|
||||
}
|
14
sources/com/ubt/jimu/base/db/diy/SyncDbModel.java
Normal file
14
sources/com/ubt/jimu/base/db/diy/SyncDbModel.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.ubt.jimu.base.db.diy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SyncDbModel extends DiyDBModel {
|
||||
private String modelDescription;
|
||||
|
||||
public String getModelDescription() {
|
||||
return this.modelDescription;
|
||||
}
|
||||
|
||||
public void setModelDescription(String str) {
|
||||
this.modelDescription = str;
|
||||
}
|
||||
}
|
32
sources/com/ubt/jimu/base/db/proxy/BlocklyProjectImpl.java
Normal file
32
sources/com/ubt/jimu/base/db/proxy/BlocklyProjectImpl.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.blockly.bean.BlocklyProject;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class BlocklyProjectImpl implements ISqlProxy<BlocklyProject> {
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteByData(BlocklyProject blocklyProject) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteById() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public BlocklyProject iSelect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public List<BlocklyProject> selectAll() {
|
||||
return DatabaseUtils.getDaoSession(true).a().j();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void insert(BlocklyProject blocklyProject) {
|
||||
DatabaseUtils.getDaoSession(true).a().g(blocklyProject);
|
||||
}
|
||||
}
|
36
sources/com/ubt/jimu/base/db/proxy/ConfigItemImpl.java
Normal file
36
sources/com/ubt/jimu/base/db/proxy/ConfigItemImpl.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.transport.model.ConfigItem;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ConfigItemImpl implements ISqlProxy<ConfigItem> {
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteByData(ConfigItem configItem) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteById() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public ConfigItem iSelect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public List<ConfigItem> selectAll() {
|
||||
return DatabaseUtils.getDaoSession(true).b().j();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void insert(ConfigItem configItem) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).b().f(configItem);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
32
sources/com/ubt/jimu/base/db/proxy/DiyDBModelImpl.java
Normal file
32
sources/com/ubt/jimu/base/db/proxy/DiyDBModelImpl.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.db.diy.DiyDBModel;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiyDBModelImpl implements ISqlProxy<DiyDBModel> {
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteByData(DiyDBModel diyDBModel) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteById() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public DiyDBModel iSelect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public List<DiyDBModel> selectAll() {
|
||||
return DatabaseUtils.getDaoSession(true).d().j();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void insert(DiyDBModel diyDBModel) {
|
||||
DatabaseUtils.getDaoSession(true).d().g(diyDBModel);
|
||||
}
|
||||
}
|
30
sources/com/ubt/jimu/base/db/proxy/GreenDaoImpl.java
Normal file
30
sources/com/ubt/jimu/base/db/proxy/GreenDaoImpl.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import com.ubt.jimu.base.db.proxy.data.TestBean;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GreenDaoImpl implements ISqlProxy<TestBean> {
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteByData(TestBean testBean) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteById() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public TestBean iSelect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void insert(TestBean testBean) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public List<TestBean> selectAll() {
|
||||
return null;
|
||||
}
|
||||
}
|
16
sources/com/ubt/jimu/base/db/proxy/ISqlProxy.java
Normal file
16
sources/com/ubt/jimu/base/db/proxy/ISqlProxy.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ISqlProxy<T> {
|
||||
void deleteByData(T t);
|
||||
|
||||
void deleteById();
|
||||
|
||||
T iSelect();
|
||||
|
||||
void insert(T t);
|
||||
|
||||
List<T> selectAll();
|
||||
}
|
36
sources/com/ubt/jimu/base/db/proxy/JimuMotionImpl.java
Normal file
36
sources/com/ubt/jimu/base/db/proxy/JimuMotionImpl.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.blockly.bean.JimuMotion;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class JimuMotionImpl implements ISqlProxy<JimuMotion> {
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteByData(JimuMotion jimuMotion) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteById() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public JimuMotion iSelect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public List<JimuMotion> selectAll() {
|
||||
return DatabaseUtils.getDaoSession(true).o().j();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void insert(JimuMotion jimuMotion) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).o().g(jimuMotion);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
37
sources/com/ubt/jimu/base/db/proxy/SqliteHelper.java
Normal file
37
sources/com/ubt/jimu/base/db/proxy/SqliteHelper.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SqliteHelper<T> {
|
||||
private static final SqliteHelper ourInstance = new SqliteHelper();
|
||||
private ISqlProxy mSqlProxy;
|
||||
|
||||
private SqliteHelper() {
|
||||
}
|
||||
|
||||
public static SqliteHelper getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
public void delete(T t) {
|
||||
this.mSqlProxy.deleteByData(t);
|
||||
}
|
||||
|
||||
public SqliteHelper init(ISqlProxy iSqlProxy) {
|
||||
this.mSqlProxy = iSqlProxy;
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
public void insert(T t) {
|
||||
this.mSqlProxy.insert(t);
|
||||
}
|
||||
|
||||
public List<T> loadAll() {
|
||||
return this.mSqlProxy.selectAll();
|
||||
}
|
||||
|
||||
public T select() {
|
||||
return (T) this.mSqlProxy.iSelect();
|
||||
}
|
||||
}
|
37
sources/com/ubt/jimu/base/db/proxy/TransportFileImpl.java
Normal file
37
sources/com/ubt/jimu/base/db/proxy/TransportFileImpl.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.ubt.jimu.base.db.proxy;
|
||||
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.transport.model.TransportFile;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TransportFileImpl implements ISqlProxy<TransportFile> {
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteByData(TransportFile transportFile) {
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void deleteById() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public TransportFile iSelect() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public List<TransportFile> selectAll() {
|
||||
return DatabaseUtils.getDaoSession(true).v().j();
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.proxy.ISqlProxy
|
||||
public void insert(TransportFile transportFile) {
|
||||
try {
|
||||
LogUtils.c("l=======" + DatabaseUtils.getDaoSession(true).v().g(transportFile));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
27
sources/com/ubt/jimu/base/db/proxy/data/DataBaseHelper.java
Normal file
27
sources/com/ubt/jimu/base/db/proxy/data/DataBaseHelper.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.ubt.jimu.base.db.proxy.data;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DataBaseHelper extends SQLiteOpenHelper {
|
||||
private static final String DB_NAME = "JIMU_DB";
|
||||
private static final int version = 1007;
|
||||
|
||||
public DataBaseHelper(Context context) {
|
||||
this(context, DB_NAME, null, 1007);
|
||||
}
|
||||
|
||||
@Override // android.database.sqlite.SQLiteOpenHelper
|
||||
public void onCreate(SQLiteDatabase sQLiteDatabase) {
|
||||
}
|
||||
|
||||
@Override // android.database.sqlite.SQLiteOpenHelper
|
||||
public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
|
||||
}
|
||||
|
||||
public DataBaseHelper(Context context, String str, SQLiteDatabase.CursorFactory cursorFactory, int i) {
|
||||
super(context, str, cursorFactory, i);
|
||||
}
|
||||
}
|
5
sources/com/ubt/jimu/base/db/proxy/data/TestBean.java
Normal file
5
sources/com/ubt/jimu/base/db/proxy/data/TestBean.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.ubt.jimu.base.db.proxy.data;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TestBean {
|
||||
}
|
81
sources/com/ubt/jimu/base/db/proxy/data/TestSqlIte.java
Normal file
81
sources/com/ubt/jimu/base/db/proxy/data/TestSqlIte.java
Normal file
@@ -0,0 +1,81 @@
|
||||
package com.ubt.jimu.base.db.proxy.data;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import com.ubt.jimu.base.db.proxy.BlocklyProjectImpl;
|
||||
import com.ubt.jimu.base.db.proxy.ConfigItemImpl;
|
||||
import com.ubt.jimu.base.db.proxy.DiyDBModelImpl;
|
||||
import com.ubt.jimu.base.db.proxy.JimuMotionImpl;
|
||||
import com.ubt.jimu.base.db.proxy.SqliteHelper;
|
||||
import com.ubt.jimu.base.db.proxy.TransportFileImpl;
|
||||
import com.ubt.jimu.blockly.bean.BlocklyProject;
|
||||
import com.ubt.jimu.blockly.bean.JimuMotion;
|
||||
import com.ubt.jimu.transport.model.ConfigItem;
|
||||
import com.ubt.jimu.transport.model.TransportFile;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TestSqlIte {
|
||||
private static final TestSqlIte INSTANCE = new TestSqlIte();
|
||||
|
||||
private TestSqlIte() {
|
||||
}
|
||||
|
||||
public static TestSqlIte getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void execSqlite(Context context) {
|
||||
SQLiteDatabase writableDatabase = new DataBaseHelper(context).getWritableDatabase();
|
||||
new DiyDBModelImpl();
|
||||
try {
|
||||
TestType.isCreate().moveDiyData(writableDatabase.rawQuery("select * from CustomModelBean", null));
|
||||
writableDatabase.execSQL("drop table CustomModelBean");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
BlocklyProjectImpl blocklyProjectImpl = new BlocklyProjectImpl();
|
||||
try {
|
||||
Iterator it = new TestType().moveData(writableDatabase, "select * from BlocklyProject", BlocklyProject.class.getName()).iterator();
|
||||
while (it.hasNext()) {
|
||||
SqliteHelper.getInstance().init(blocklyProjectImpl).insert((BlocklyProject) it.next());
|
||||
}
|
||||
writableDatabase.execSQL("drop table BlocklyProject");
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
ConfigItemImpl configItemImpl = new ConfigItemImpl();
|
||||
try {
|
||||
Iterator it2 = new TestType().moveData(writableDatabase, "select * from ConfigItem", ConfigItem.class.getName()).iterator();
|
||||
while (it2.hasNext()) {
|
||||
SqliteHelper.getInstance().init(configItemImpl).insert((ConfigItem) it2.next());
|
||||
}
|
||||
writableDatabase.execSQL("drop table ConfigItem");
|
||||
} catch (Exception e3) {
|
||||
e3.printStackTrace();
|
||||
}
|
||||
JimuMotionImpl jimuMotionImpl = new JimuMotionImpl();
|
||||
try {
|
||||
Iterator it3 = new TestType().moveData(writableDatabase, "select * from JimuMotion ", JimuMotion.class.getName()).iterator();
|
||||
while (it3.hasNext()) {
|
||||
SqliteHelper.getInstance().init(jimuMotionImpl).insert((JimuMotion) it3.next());
|
||||
}
|
||||
writableDatabase.execSQL("drop table JimuMotion");
|
||||
} catch (Exception e4) {
|
||||
e4.printStackTrace();
|
||||
}
|
||||
TransportFileImpl transportFileImpl = new TransportFileImpl();
|
||||
try {
|
||||
long j = 1;
|
||||
for (TransportFile transportFile : new TestType().moveData(writableDatabase, "select * from syncFile ", TransportFile.class.getName())) {
|
||||
transportFile.setCustomFileId(Long.valueOf(j));
|
||||
SqliteHelper.getInstance().init(transportFileImpl).insert(transportFile);
|
||||
j++;
|
||||
}
|
||||
writableDatabase.execSQL("drop table syncFile");
|
||||
} catch (Exception e5) {
|
||||
e5.printStackTrace();
|
||||
}
|
||||
writableDatabase.close();
|
||||
}
|
||||
}
|
77
sources/com/ubt/jimu/base/db/proxy/data/TestType.java
Normal file
77
sources/com/ubt/jimu/base/db/proxy/data/TestType.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package com.ubt.jimu.base.db.proxy.data;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import com.tencent.open.SocialConstants;
|
||||
import com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter;
|
||||
import com.ubt.jimu.base.db.diy.DiyDBModel;
|
||||
import com.ubt.jimu.base.db.diy.DiyHelper;
|
||||
import com.ubt.jimu.diy.DiyRobotDbHandler;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import com.unity3d.ads.metadata.MediationMetaData;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TestType<T> {
|
||||
private static TestType tt;
|
||||
|
||||
public static TestType isCreate() {
|
||||
if (tt == null) {
|
||||
tt = new TestType();
|
||||
}
|
||||
return tt;
|
||||
}
|
||||
|
||||
public ArrayList<T> moveData(SQLiteDatabase sQLiteDatabase, String str, String str2) throws Exception {
|
||||
AbstractReflectionConverter.ArraysList arraysList = (ArrayList<T>) new ArrayList();
|
||||
Cursor rawQuery = sQLiteDatabase.rawQuery(str, null);
|
||||
while (rawQuery.moveToNext()) {
|
||||
Class<?> cls = Class.forName(str2);
|
||||
Field[] declaredFields = cls.getDeclaredFields();
|
||||
Object newInstance = cls.newInstance();
|
||||
for (int i = 0; i < declaredFields.length; i++) {
|
||||
declaredFields[i].setAccessible(true);
|
||||
if (declaredFields[i].getGenericType().equals(String.class)) {
|
||||
declaredFields[i].set(newInstance, rawQuery.getColumnIndex(declaredFields[i].getName()) != -1 ? rawQuery.getString(rawQuery.getColumnIndex(declaredFields[i].getName())) : null);
|
||||
} else if (declaredFields[i].getGenericType().equals(Integer.class)) {
|
||||
declaredFields[i].set(newInstance, Integer.valueOf(rawQuery.getColumnIndex(declaredFields[i].getName()) != -1 ? rawQuery.getInt(rawQuery.getColumnIndex(declaredFields[i].getName())) : -10));
|
||||
} else if (declaredFields[i].getGenericType().equals(Long.class)) {
|
||||
declaredFields[i].set(newInstance, Long.valueOf(rawQuery.getColumnIndex(declaredFields[i].getName()) != -1 ? rawQuery.getLong(rawQuery.getColumnIndex(declaredFields[i].getName())) : -10L));
|
||||
} else if (declaredFields[i].getGenericType().equals(Boolean.class)) {
|
||||
declaredFields[i].set(newInstance, Boolean.valueOf(rawQuery.getColumnIndex(declaredFields[i].getName()) != -1 && rawQuery.getLong(rawQuery.getColumnIndex(declaredFields[i].getName())) == 1));
|
||||
} else if (declaredFields[i].getGenericType().equals(Double.class)) {
|
||||
declaredFields[i].set(newInstance, Double.valueOf(rawQuery.getColumnIndex(declaredFields[i].getName()) != -1 ? rawQuery.getDouble(rawQuery.getColumnIndex(declaredFields[i].getName())) : 0.0d));
|
||||
}
|
||||
}
|
||||
arraysList.add(newInstance);
|
||||
}
|
||||
return arraysList;
|
||||
}
|
||||
|
||||
public void moveDiyData(Cursor cursor) {
|
||||
while (cursor.moveToNext()) {
|
||||
DiyDBModel diyDBModel = new DiyDBModel();
|
||||
diyDBModel.setCustomModelId(cursor.getString(cursor.getColumnIndex("customModelId")));
|
||||
diyDBModel.setModelName(cursor.getString(cursor.getColumnIndex(UnityActivity.pModelName)));
|
||||
diyDBModel.setCustomModelCategory(cursor.getInt(cursor.getColumnIndex("customModelCategory")));
|
||||
diyDBModel.setModifyTime(cursor.getInt(cursor.getColumnIndex("modifyTime")));
|
||||
boolean z = false;
|
||||
diyDBModel.setModify(Boolean.valueOf(cursor.getInt(cursor.getColumnIndex("isModify")) == 1));
|
||||
diyDBModel.setModelId(Integer.valueOf(cursor.getInt(cursor.getColumnIndex("modelId"))));
|
||||
if (cursor.getInt(cursor.getColumnIndex("useable")) == 1) {
|
||||
z = true;
|
||||
}
|
||||
diyDBModel.setUseable(z);
|
||||
diyDBModel.setVersion(cursor.getString(cursor.getColumnIndex(MediationMetaData.KEY_VERSION)));
|
||||
diyDBModel.setDescription(cursor.getString(cursor.getColumnIndex(SocialConstants.PARAM_COMMENT)));
|
||||
diyDBModel.setModelCreatedId(cursor.getString(cursor.getColumnIndex("modelCreatedId")));
|
||||
diyDBModel.setCompressImagePath(cursor.getString(cursor.getColumnIndex("compressImagePath")));
|
||||
diyDBModel.setFilePath(DiyRobotDbHandler.getCustomModelPath(cursor.getString(cursor.getColumnIndex("modelCreatedId"))) + diyDBModel.getCustomModelId() + File.separator + diyDBModel.getCustomModelId() + ".jpg");
|
||||
diyDBModel.setUploadState(Integer.valueOf(cursor.getInt(cursor.getColumnIndex("uploadState"))));
|
||||
diyDBModel.setStep1state(1);
|
||||
DiyHelper.getInstance().insertData(diyDBModel);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package com.ubt.jimu.base.db.robot;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.FirmwareVersion;
|
||||
import com.ubt.jimu.gen.FirmwareVersionDao;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FirmwareVersionDbHandler extends AbstractDaoHandler<FirmwareVersion> {
|
||||
private static FirmwareVersionDbHandler instance;
|
||||
|
||||
public FirmwareVersionDbHandler(AbstractDao<FirmwareVersion, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static synchronized FirmwareVersionDbHandler getInstance() {
|
||||
FirmwareVersionDbHandler firmwareVersionDbHandler;
|
||||
synchronized (FirmwareVersionDbHandler.class) {
|
||||
if (instance == null) {
|
||||
instance = new FirmwareVersionDbHandler(DatabaseUtils.getDaoSession(true).k());
|
||||
}
|
||||
firmwareVersionDbHandler = instance;
|
||||
}
|
||||
return firmwareVersionDbHandler;
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public FirmwareVersion selectUnique(FirmwareVersion firmwareVersion) {
|
||||
QueryBuilder<FirmwareVersion> queryBuilder = getQueryBuilder();
|
||||
queryBuilder.a(FirmwareVersionDao.Properties.VersionType.a(firmwareVersion.getVersionType()), new WhereCondition[0]);
|
||||
return queryBuilder.c();
|
||||
}
|
||||
}
|
95
sources/com/ubt/jimu/base/db/robot/PackageDbHandler.java
Normal file
95
sources/com/ubt/jimu/base/db/robot/PackageDbHandler.java
Normal file
@@ -0,0 +1,95 @@
|
||||
package com.ubt.jimu.base.db.robot;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.Package;
|
||||
import com.ubt.jimu.gen.PackageDao;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PackageDbHandler {
|
||||
public static List<Package> findByEan(String str) {
|
||||
List<Package> b = DatabaseUtils.getDaoSession(false).q().k().b();
|
||||
if (b == null || b.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Iterator<Package> it = b.iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
Package next = it.next();
|
||||
if (matchWords(str, next.getEAN())) {
|
||||
arrayList.add(next);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static List<Package> findByUpc(String str) {
|
||||
List<Package> b = DatabaseUtils.getDaoSession(false).q().k().b();
|
||||
if (b == null || b.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Iterator<Package> it = b.iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
Package next = it.next();
|
||||
if (matchWords(str, next.getUPC())) {
|
||||
arrayList.add(next);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static List<Package> getPackageList() {
|
||||
QueryBuilder<Package> k = DatabaseUtils.getDaoSession(false).q().k();
|
||||
k.a(PackageDao.Properties.DisplayOrder);
|
||||
return k.b();
|
||||
}
|
||||
|
||||
private static boolean matchWords(String str, String str2) {
|
||||
if (!TextUtils.isEmpty(str2)) {
|
||||
for (String str3 : str2.split(",")) {
|
||||
if (str.equals(str3.trim())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void saveOrUpdate(List<Package> list) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).q().c((Iterable) list);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Package selectById(long j) {
|
||||
try {
|
||||
return DatabaseUtils.getDaoSession(true).q().a(j);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveOrUpdate(Package r1) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).q().j(r1);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package com.ubt.jimu.base.db.robot;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.PartFileInfo;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class PartFileInfoDbHandler extends AbstractDaoHandler<PartFileInfo> {
|
||||
public PartFileInfoDbHandler(AbstractDao<PartFileInfo, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static boolean insertOrUpdate(List<PartFileInfo> list) {
|
||||
try {
|
||||
new PartFileInfoDbHandler(DatabaseUtils.getDaoSession(true).r()).insertOrUpdateInTx(list);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public PartFileInfo selectUnique(PartFileInfo partFileInfo) {
|
||||
return selectById(partFileInfo.getId());
|
||||
}
|
||||
}
|
98
sources/com/ubt/jimu/base/db/robot/RobotDbHandler.java
Normal file
98
sources/com/ubt/jimu/base/db/robot/RobotDbHandler.java
Normal file
@@ -0,0 +1,98 @@
|
||||
package com.ubt.jimu.base.db.robot;
|
||||
|
||||
import com.ubt.jimu.base.db.AbstractDaoHandler;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.Robot;
|
||||
import com.ubt.jimu.gen.RobotDao;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.AbstractDao;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class RobotDbHandler extends AbstractDaoHandler<Robot> {
|
||||
private static RobotDbHandler instance;
|
||||
|
||||
public RobotDbHandler(AbstractDao<Robot, Long> abstractDao) {
|
||||
super(abstractDao);
|
||||
}
|
||||
|
||||
public static synchronized RobotDbHandler getInstance() {
|
||||
RobotDbHandler robotDbHandler;
|
||||
synchronized (RobotDbHandler.class) {
|
||||
if (instance == null) {
|
||||
instance = new RobotDbHandler(DatabaseUtils.getDaoSession(true).s());
|
||||
}
|
||||
robotDbHandler = instance;
|
||||
}
|
||||
return robotDbHandler;
|
||||
}
|
||||
|
||||
public static Robot getRobotById(long j) {
|
||||
QueryBuilder<Robot> k = DatabaseUtils.getDaoSession(true).s().k();
|
||||
k.a(RobotDao.Properties.ModelId.a(Long.valueOf(j)), new WhereCondition[0]);
|
||||
return k.c();
|
||||
}
|
||||
|
||||
public static Robot getRobotByModelName(String str) {
|
||||
QueryBuilder<Robot> k = DatabaseUtils.getDaoSession(true).s().k();
|
||||
k.a(RobotDao.Properties.ModelName.a((Object) str), new WhereCondition[0]);
|
||||
return k.c();
|
||||
}
|
||||
|
||||
public static List<Robot> getRobotList(long j) {
|
||||
try {
|
||||
return DatabaseUtils.getDaoSession(true).q().h(Long.valueOf(j)).getRobotList();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveOrUpdate(List<Robot> list) {
|
||||
try {
|
||||
RobotDao s = DatabaseUtils.getDaoSession(true).s();
|
||||
List<Robot> j = s.j();
|
||||
if (j == null || j.size() == 0) {
|
||||
s.c((Iterable) list);
|
||||
}
|
||||
for (Robot robot : list) {
|
||||
Iterator<Robot> it = j.iterator();
|
||||
while (true) {
|
||||
if (it.hasNext()) {
|
||||
Robot next = it.next();
|
||||
if (robot.getModelId() == next.getModelId()) {
|
||||
robot.setDownload(next.getDownload() && robot.getModelUpdateTime() == next.getModelUpdateTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
s.c((Iterable) list);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void setRobotDownloadState(Robot robot) {
|
||||
RobotDao s = DatabaseUtils.getDaoSession(true).s();
|
||||
QueryBuilder<Robot> k = s.k();
|
||||
k.a(RobotDao.Properties.ModelName.a((Object) robot.getModelName()), new WhereCondition[0]);
|
||||
List<Robot> b = k.b();
|
||||
if (b == null || b.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
Iterator<Robot> it = b.iterator();
|
||||
while (it.hasNext()) {
|
||||
it.next().setDownload(robot.getDownload());
|
||||
}
|
||||
s.d((Iterable) b);
|
||||
}
|
||||
|
||||
@Override // com.ubt.jimu.base.db.AbstractDaoHandler, com.ubt.jimu.base.db.IDaoHandler
|
||||
public Robot selectUnique(Robot robot) {
|
||||
QueryBuilder k = this.dao.k();
|
||||
k.a(RobotDao.Properties.ModelId.a(Long.valueOf(robot.getModelId())), new WhereCondition[0]);
|
||||
return (Robot) k.c();
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package com.ubt.jimu.base.db.robot;
|
||||
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.RobotPackage;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class RobotPackageDbHandler {
|
||||
public static void saveOrUpdate(List<RobotPackage> list) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(false).t().c((Iterable) list);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
81
sources/com/ubt/jimu/base/db/starcourse/CourseDbHandler.java
Normal file
81
sources/com/ubt/jimu/base/db/starcourse/CourseDbHandler.java
Normal file
@@ -0,0 +1,81 @@
|
||||
package com.ubt.jimu.base.db.starcourse;
|
||||
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.Course;
|
||||
import com.ubt.jimu.gen.CourseDao;
|
||||
import com.ubt.jimu.utils.LogUtils;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class CourseDbHandler {
|
||||
public static List<Course> getNewCourseList() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
CourseDao c = DatabaseUtils.getDaoSession(true).c();
|
||||
String g = JimuApplication.l().g();
|
||||
QueryBuilder<Course> k = c.k();
|
||||
k.a(CourseDao.Properties.Lan.a((Object) g), CourseDao.Properties.StoryName.a((Object) Constant.SelectRobot.ASTROBOT_MINI));
|
||||
List<Course> b = k.b();
|
||||
arrayList.addAll(b);
|
||||
LogUtils.c("tList.getNewCourseList" + b.size());
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static List<Course> getOldCourseList() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
CourseDao c = DatabaseUtils.getDaoSession(true).c();
|
||||
String g = JimuApplication.l().g();
|
||||
QueryBuilder<Course> k = c.k();
|
||||
k.a(CourseDao.Properties.Lan.a((Object) g), CourseDao.Properties.StoryName.a((Object) "AstroBot"));
|
||||
arrayList.addAll(k.b());
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public static void saveList(List<Course> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
CourseDao c = DatabaseUtils.getDaoSession(true).c();
|
||||
String g = JimuApplication.l().g();
|
||||
Iterator<Course> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
it.next().setLan(g);
|
||||
}
|
||||
c.c((Iterable) list);
|
||||
}
|
||||
|
||||
public static void setCourseComplete(Course course) {
|
||||
if (course == null) {
|
||||
return;
|
||||
}
|
||||
CourseDao c = DatabaseUtils.getDaoSession(true).c();
|
||||
String g = JimuApplication.l().g();
|
||||
course.setLan(g);
|
||||
course.setStatus(Course.STATUS_COMPLETED);
|
||||
c.j(course);
|
||||
String b = SPUtils.b(Constant.SelectRobot.INTERSTELLAR_ADVENTURE_SELECT_PACKAGE_KEY);
|
||||
List<Course> oldCourseList = (Constant.SelectRobot.INTERSTELLAR_ADVENTURE_OLD_PACKAGE_CN.equals(b) || Constant.SelectRobot.INTERSTELLAR_ADVENTURE_OLD_PACKAGE_NA.equals(b) || Constant.SelectRobot.INTERSTELLAR_ADVENTURE_OLD_PACKAGE_GLOBAL.equals(b)) ? getOldCourseList() : getNewCourseList();
|
||||
Course course2 = null;
|
||||
boolean z = false;
|
||||
for (int i = 0; i < oldCourseList.size(); i++) {
|
||||
Course course3 = oldCourseList.get(i);
|
||||
if (course3.getNameKey().equals(course.getNextCourse())) {
|
||||
course2 = course3;
|
||||
}
|
||||
if (course3.getStatus().equals(Course.STATUS_RUNNING)) {
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
if (z || course2 == null) {
|
||||
return;
|
||||
}
|
||||
course2.setStatus(Course.STATUS_RUNNING);
|
||||
course2.setLan(g);
|
||||
c.b((Object[]) new Course[]{course2});
|
||||
}
|
||||
}
|
41
sources/com/ubt/jimu/base/db/starcourse/StoryDbHandler.java
Normal file
41
sources/com/ubt/jimu/base/db/starcourse/StoryDbHandler.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.ubt.jimu.base.db.starcourse;
|
||||
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.Story;
|
||||
import com.ubt.jimu.gen.StoryDao;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class StoryDbHandler {
|
||||
public static List<Story> getStoryList() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
try {
|
||||
String g = JimuApplication.l().g();
|
||||
QueryBuilder<Story> k = DatabaseUtils.getDaoSession(true).u().k();
|
||||
k.a(StoryDao.Properties.Lan.a((Object) g), new WhereCondition[0]);
|
||||
arrayList.addAll(k.b());
|
||||
return arrayList;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
|
||||
public static void save(List<Story> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
String g = JimuApplication.l().g();
|
||||
StoryDao u = DatabaseUtils.getDaoSession(true).u();
|
||||
Iterator<Story> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
it.next().setLan(g);
|
||||
}
|
||||
u.c((Iterable) list);
|
||||
}
|
||||
}
|
77
sources/com/ubt/jimu/base/db/user/UserDbHandler.java
Normal file
77
sources/com/ubt/jimu/base/db/user/UserDbHandler.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package com.ubt.jimu.base.db.user;
|
||||
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.db.DatabaseUtils;
|
||||
import com.ubt.jimu.base.entities.User;
|
||||
import com.ubt.jimu.gen.UserDao;
|
||||
import com.ubtrobot.ubtlib.analytics.JimuAnalytics;
|
||||
import java.util.List;
|
||||
import org.greenrobot.greendao.query.QueryBuilder;
|
||||
import org.greenrobot.greendao.query.WhereCondition;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class UserDbHandler {
|
||||
public static void clearUser() {
|
||||
JimuAnalytics.b().a("0", "google_play");
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).w().b();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static User getUser() {
|
||||
try {
|
||||
List<User> j = DatabaseUtils.getDaoSession(false).w().j();
|
||||
if (j != null && j.size() != 0) {
|
||||
return j.get(0);
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLogin() {
|
||||
User user = getUser();
|
||||
return user != null && user.getUserId() > 0;
|
||||
}
|
||||
|
||||
public static void save(User user) {
|
||||
if (user != null) {
|
||||
JimuAnalytics.b().a(String.valueOf(user.getUserId()), "google_play");
|
||||
}
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).w().g(user);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateUser(long j) {
|
||||
}
|
||||
|
||||
public static void updateUserInfo(User user) {
|
||||
try {
|
||||
DatabaseUtils.getDaoSession(true).w().j(user);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateUserToken(String str) {
|
||||
try {
|
||||
UserDao w = DatabaseUtils.getDaoSession(false).w();
|
||||
QueryBuilder<User> k = w.k();
|
||||
k.a(UserDao.Properties.UserId.a(Long.valueOf(Cache.getInstance().getLoginUserIntId())), new WhereCondition[0]);
|
||||
User c = k.c();
|
||||
if (c != null) {
|
||||
c.setToken(str);
|
||||
}
|
||||
w.j(c);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user