48 lines
1.9 KiB
Java
48 lines
1.9 KiB
Java
package com.ubt.jimu.transport3.upgrade;
|
||
|
||
import android.text.TextUtils;
|
||
import com.ubt.jimu.base.db.diy.DiyDBModel;
|
||
import com.ubt.jimu.blockly.Utils;
|
||
import com.ubt.jimu.diy.DiyRobotDbHandler;
|
||
import com.ubt.jimu.transport3.dao.DiyDBModelDBHandler;
|
||
import com.ubt.jimu.utils.SystemUtils;
|
||
import com.ubtrobot.log.ALog;
|
||
import java.io.File;
|
||
import java.util.List;
|
||
|
||
/* loaded from: classes2.dex */
|
||
public class DiyDBModelUpgrade {
|
||
private final String TAG = "upgrade";
|
||
private DiyDBModelDBHandler modelDBHandler = DiyDBModelDBHandler.getInstance();
|
||
|
||
public void upgrade() {
|
||
List<DiyDBModel> selectAll = this.modelDBHandler.selectAll();
|
||
if (selectAll == null || selectAll.size() == 0) {
|
||
ALog.a("upgrade").d("DIY 模型升级:0");
|
||
return;
|
||
}
|
||
long a = SystemUtils.a();
|
||
for (DiyDBModel diyDBModel : selectAll) {
|
||
try {
|
||
diyDBModel.setModelId(0);
|
||
diyDBModel.setCustomModelCreatetime(SystemUtils.a(Utils.formatFileCreateTime(diyDBModel.getCustomModelId())));
|
||
diyDBModel.setLastUploadTime(a);
|
||
diyDBModel.setIsModify(true);
|
||
if (!TextUtils.isEmpty(diyDBModel.getDescription())) {
|
||
diyDBModel.setStep1state(1);
|
||
}
|
||
if (!TextUtils.isEmpty(diyDBModel.getModelCreatedId())) {
|
||
File file = new File(DiyRobotDbHandler.getCustomModelPath(diyDBModel.getModelCreatedId()) + File.separator + diyDBModel.getCustomModelId() + File.separator + "actions");
|
||
if (file.exists() && file.listFiles().length > 0) {
|
||
diyDBModel.setStep3state(1);
|
||
}
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
}
|
||
}
|
||
this.modelDBHandler.updateInTx(selectAll);
|
||
ALog.a("upgrade").d("DIY 模型升级:" + selectAll.size());
|
||
}
|
||
}
|