Commit b8c195a0 authored by hywang's avatar hywang

1.不再保存图片base64,增加图片路径

parent e38e23f3
...@@ -9,8 +9,8 @@ android { ...@@ -9,8 +9,8 @@ android {
applicationId "com.phlx.anchorcollect" applicationId "com.phlx.anchorcollect"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode 11 versionCode 12
versionName "2.0.5" versionName "2.0.6"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
...@@ -48,7 +48,7 @@ android { ...@@ -48,7 +48,7 @@ android {
} }
greendao { greendao {
schemaVersion 5 //数据库版本号 schemaVersion 6 //数据库版本号
daoPackage 'com.phlx.anchorcollect.db.gen' daoPackage 'com.phlx.anchorcollect.db.gen'
targetGenDir 'src/main/java' targetGenDir 'src/main/java'
} }
......
...@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType; ...@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** /**
* Master of DAO (schema version 5): knows all DAOs. * Master of DAO (schema version 6): knows all DAOs.
*/ */
public class DaoMaster extends AbstractDaoMaster { public class DaoMaster extends AbstractDaoMaster {
public static final int SCHEMA_VERSION = 5; public static final int SCHEMA_VERSION = 6;
/** Creates underlying database table using DAOs. */ /** Creates underlying database table using DAOs. */
public static void createAllTables(Database db, boolean ifNotExists) { public static void createAllTables(Database db, boolean ifNotExists) {
......
...@@ -81,6 +81,9 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -81,6 +81,9 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
/** 照片路径;(可以多图片“,”分割) */ /** 照片路径;(可以多图片“,”分割) */
private String photo; private String photo;
/** 照片路径, 手持机用*/
private String photoPath;
/** 状态(育种,育成,成年;淘汰,出售) */ /** 状态(育种,育成,成年;淘汰,出售) */
private String status; private String status;
...@@ -162,6 +165,7 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -162,6 +165,7 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
junHeavy = in.readString(); junHeavy = in.readString();
decAppScore = in.readString(); decAppScore = in.readString();
photo = in.readString(); photo = in.readString();
photoPath = in.readString();
status = in.readString(); status = in.readString();
if (in.readByte() == 0) { if (in.readByte() == 0) {
isOut = null; isOut = null;
...@@ -194,14 +198,14 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -194,14 +198,14 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
remark = in.readString(); remark = in.readString();
} }
@Generated(hash = 1106807371) @Generated(hash = 1557063295)
public CattleResumeEntity(Long unid, String registrationNo, String individualNo, String circleNo, public CattleResumeEntity(Long unid, String registrationNo, String individualNo, String circleNo,
String raiseType, String raiseVarieties, String birthdate, Double birthHeavy, String sex, String raiseType, String raiseVarieties, String birthdate, Double birthHeavy, String sex,
String birthDifficulty, String isTwins, String childTime, String grade, String fatherReg, String birthDifficulty, String isTwins, String childTime, String grade, String fatherReg,
String motherReg, Double fromMilkHeavy, String health, String junHeavy, String decAppScore, String motherReg, Double fromMilkHeavy, String health, String junHeavy, String decAppScore,
String photo, String status, Long isOut, Integer age, String colour, String inputTime, String photo, String photoPath, String status, Long isOut, Integer age, String colour,
Long deptId, Long deptName, String uploadStatus, String uploadTime, String createBy, String inputTime, Long deptId, Long deptName, String uploadStatus, String uploadTime,
String createTime, String updateBy, String updateTime, String remark) { String createBy, String createTime, String updateBy, String updateTime, String remark) {
this.unid = unid; this.unid = unid;
this.registrationNo = registrationNo; this.registrationNo = registrationNo;
this.individualNo = individualNo; this.individualNo = individualNo;
...@@ -222,6 +226,7 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -222,6 +226,7 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
this.junHeavy = junHeavy; this.junHeavy = junHeavy;
this.decAppScore = decAppScore; this.decAppScore = decAppScore;
this.photo = photo; this.photo = photo;
this.photoPath = photoPath;
this.status = status; this.status = status;
this.isOut = isOut; this.isOut = isOut;
this.age = age; this.age = age;
...@@ -275,6 +280,7 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -275,6 +280,7 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
dest.writeString(junHeavy); dest.writeString(junHeavy);
dest.writeString(decAppScore); dest.writeString(decAppScore);
dest.writeString(photo); dest.writeString(photo);
dest.writeString(photoPath);
dest.writeString(status); dest.writeString(status);
if (isOut == null) { if (isOut == null) {
dest.writeByte((byte) 0); dest.writeByte((byte) 0);
...@@ -328,10 +334,6 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -328,10 +334,6 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
} }
}; };
public static long getSerialVersionUID() {
return serialVersionUID;
}
public Long getUnid() { public Long getUnid() {
return unid; return unid;
} }
...@@ -492,6 +494,14 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -492,6 +494,14 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
this.photo = photo; this.photo = photo;
} }
public String getPhotoPath() {
return photoPath;
}
public void setPhotoPath(String photoPath) {
this.photoPath = photoPath;
}
public String getStatus() { public String getStatus() {
return status; return status;
} }
...@@ -627,6 +637,7 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable { ...@@ -627,6 +637,7 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
", junHeavy='" + junHeavy + '\'' + ", junHeavy='" + junHeavy + '\'' +
", decAppScore='" + decAppScore + '\'' + ", decAppScore='" + decAppScore + '\'' +
", photo='" + photo + '\'' + ", photo='" + photo + '\'' +
", photoPath='" + photoPath + '\'' +
", status='" + status + '\'' + ", status='" + status + '\'' +
", isOut=" + isOut + ", isOut=" + isOut +
", age=" + age + ", age=" + age +
......
...@@ -232,6 +232,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -232,6 +232,8 @@ public class SyncVM extends BaseViewModel<Repository> {
for (CattleResumeEntity cre : response.getData()) { for (CattleResumeEntity cre : response.getData()) {
imgUrl = savePath + "/anchorCiq" + cre.getUnid() + ".jpg"; imgUrl = savePath + "/anchorCiq" + cre.getUnid() + ".jpg";
BaseImageUtils.saveBaseImage(cre.getPhoto(), imgUrl); BaseImageUtils.saveBaseImage(cre.getPhoto(), imgUrl);
cre.setPhoto("");
cre.setPhotoPath(imgUrl);
cre.setUploadStatus("1"); cre.setUploadStatus("1");
ids.add(cre.getUnid()); ids.add(cre.getUnid());
} }
...@@ -655,53 +657,53 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -655,53 +657,53 @@ public class SyncVM extends BaseViewModel<Repository> {
// KLog.e("label", postParams.toString()); // KLog.e("label", postParams.toString());
addSubscribe(model.uploadBreedingRecordList(body) addSubscribe(model.uploadBreedingRecordList(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
.compose(RxUtils.schedulersTransformer()) .compose(RxUtils.schedulersTransformer())
.compose(RxUtils.exceptionTransformer()) .compose(RxUtils.exceptionTransformer())
.doOnSubscribe(disposable -> showDialog("正在同步-配种记录主表-数据...")) .doOnSubscribe(disposable -> showDialog("正在同步-配种记录主表-数据..."))
.subscribe((Consumer<ListResponse<Long>>) response -> { .subscribe((Consumer<ListResponse<Long>>) response -> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
KLog.e("uploadBreedingRecord", response.toString()); KLog.e("uploadBreedingRecord", response.toString());
for (BreedingRecordEntity pe : breedingRecordEntities) { for (BreedingRecordEntity pe : breedingRecordEntities) {
pe.setUploadStatus("2"); pe.setUploadStatus("2");
}
if (response.getData() != null && response.getData().size() > 0) {
for (BreedingRecordEntity pe : breedingRecordEntities) {
for (Long ids : response.getData()) {
if (pe.getUnid().equals(ids)) {
pe.setUploadStatus("1");
break;
}
} }
} if (response.getData() != null && response.getData().size() > 0) {
} for (BreedingRecordEntity pe : breedingRecordEntities) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { for (Long ids : response.getData()) {
@Override if (pe.getUnid().equals(ids)) {
public void onNotification(boolean result) { pe.setUploadStatus("1");
if (result) { break;
queryBreedingRecord(); }
me.goldze.mvvmhabit.utils.ToastUtils.showShort("上传-配种记录主表-数据成功!"); }
} else { }
me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改-配种记录主表-数据失败");
} }
} DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() {
}).updateAsyncBatch(BreedingRecordEntity.class, breedingRecordEntities); @Override
} else if (response.getCode() == 401) { public void onNotification(boolean result) {
dismissDialog(); if (result) {
Bundle bundle = new Bundle(); queryBreedingRecord();
bundle.putInt("loginType", 1); me.goldze.mvvmhabit.utils.ToastUtils.showShort("上传-配种记录主表-数据成功!");
startActivity(LoginActivity.class, bundle); } else {
me.goldze.mvvmhabit.utils.ToastUtils.showShort("登录过期,请重新登录"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改-配种记录主表-数据失败");
} else { }
}
}).updateAsyncBatch(BreedingRecordEntity.class, breedingRecordEntities);
} else if (response.getCode() == 401) {
dismissDialog();
Bundle bundle = new Bundle();
bundle.putInt("loginType", 1);
startActivity(LoginActivity.class, bundle);
me.goldze.mvvmhabit.utils.ToastUtils.showShort("登录过期,请重新登录");
} else {
// dismissDialog(); // dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort("服务器:" + response.getMsg()); me.goldze.mvvmhabit.utils.ToastUtils.showShort("服务器:" + response.getMsg());
requestBreedingRecord(); requestBreedingRecord();
} }
}, (Consumer<ResponseThrowable>) throwable -> { }, (Consumer<ResponseThrowable>) throwable -> {
dismissDialog(); dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort(throwable.message); me.goldze.mvvmhabit.utils.ToastUtils.showShort(throwable.message);
}) })
); );
} }
...@@ -852,53 +854,53 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -852,53 +854,53 @@ public class SyncVM extends BaseViewModel<Repository> {
// KLog.e("label", postParams.toString()); // KLog.e("label", postParams.toString());
addSubscribe(model.uploadBreedingRecordDetailList(body) addSubscribe(model.uploadBreedingRecordDetailList(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
.compose(RxUtils.schedulersTransformer()) .compose(RxUtils.schedulersTransformer())
.compose(RxUtils.exceptionTransformer()) .compose(RxUtils.exceptionTransformer())
.doOnSubscribe(disposable -> showDialog("正在同步-配种记录子表-数据...")) .doOnSubscribe(disposable -> showDialog("正在同步-配种记录子表-数据..."))
.subscribe((Consumer<ListResponse<Long>>) response -> { .subscribe((Consumer<ListResponse<Long>>) response -> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
KLog.e("uploadBreedingRecordDetail", response.toString()); KLog.e("uploadBreedingRecordDetail", response.toString());
for (BreedingRecordDetailEntity pe : breedingRecordDetailEntities) { for (BreedingRecordDetailEntity pe : breedingRecordDetailEntities) {
pe.setUploadStatus("2"); pe.setUploadStatus("2");
}
if (response.getData() != null && response.getData().size() > 0) {
for (BreedingRecordDetailEntity pe : breedingRecordDetailEntities) {
for (Long ids : response.getData()) {
if (pe.getUnid().equals(ids)) {
pe.setUploadStatus("1");
break;
}
} }
} if (response.getData() != null && response.getData().size() > 0) {
} for (BreedingRecordDetailEntity pe : breedingRecordDetailEntities) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { for (Long ids : response.getData()) {
@Override if (pe.getUnid().equals(ids)) {
public void onNotification(boolean result) { pe.setUploadStatus("1");
if (result) { break;
queryBreedingRecordDetail(); }
me.goldze.mvvmhabit.utils.ToastUtils.showShort("上传-配种记录子表-数据成功!"); }
} else { }
me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改-配种记录子表-数据失败");
} }
} DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() {
}).updateAsyncBatch(BreedingRecordDetailEntity.class, breedingRecordDetailEntities); @Override
} else if (response.getCode() == 401) { public void onNotification(boolean result) {
dismissDialog(); if (result) {
Bundle bundle = new Bundle(); queryBreedingRecordDetail();
bundle.putInt("loginType", 1); me.goldze.mvvmhabit.utils.ToastUtils.showShort("上传-配种记录子表-数据成功!");
startActivity(LoginActivity.class, bundle); } else {
me.goldze.mvvmhabit.utils.ToastUtils.showShort("登录过期,请重新登录"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改-配种记录子表-数据失败");
} else { }
}
}).updateAsyncBatch(BreedingRecordDetailEntity.class, breedingRecordDetailEntities);
} else if (response.getCode() == 401) {
dismissDialog();
Bundle bundle = new Bundle();
bundle.putInt("loginType", 1);
startActivity(LoginActivity.class, bundle);
me.goldze.mvvmhabit.utils.ToastUtils.showShort("登录过期,请重新登录");
} else {
// dismissDialog(); // dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort("服务器:" + response.getMsg()); me.goldze.mvvmhabit.utils.ToastUtils.showShort("服务器:" + response.getMsg());
requestBreedingRecordDetail(); requestBreedingRecordDetail();
} }
}, (Consumer<ResponseThrowable>) throwable -> { }, (Consumer<ResponseThrowable>) throwable -> {
dismissDialog(); dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort(throwable.message); me.goldze.mvvmhabit.utils.ToastUtils.showShort(throwable.message);
}) })
); );
} }
...@@ -1248,54 +1250,54 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1248,54 +1250,54 @@ public class SyncVM extends BaseViewModel<Repository> {
// KLog.e("label", postParams.toString()); // KLog.e("label", postParams.toString());
addSubscribe(model.uploadMedicalRecordList(body) addSubscribe(model.uploadMedicalRecordList(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
.compose(RxUtils.schedulersTransformer()) .compose(RxUtils.schedulersTransformer())
.compose(RxUtils.exceptionTransformer()) .compose(RxUtils.exceptionTransformer())
.doOnSubscribe(disposable -> showDialog("正在同步-诊疗记录-数据...")) .doOnSubscribe(disposable -> showDialog("正在同步-诊疗记录-数据..."))
.subscribe((Consumer<ListResponse<Long>>) response -> { .subscribe((Consumer<ListResponse<Long>>) response -> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
KLog.e("uploadMedicalRecord", response.toString()); KLog.e("uploadMedicalRecord", response.toString());
for (MedicalRecordEntity pe : medicalRecordEntities) { for (MedicalRecordEntity pe : medicalRecordEntities) {
pe.setUploadStatus("2"); pe.setUploadStatus("2");
}
if (response.getData() != null && response.getData().size() > 0) {
for (MedicalRecordEntity pe : medicalRecordEntities) {
for (Long ids : response.getData()) {
if (pe.getUnid().equals(ids)) {
pe.setUploadStatus("1");
break;
}
} }
} if (response.getData() != null && response.getData().size() > 0) {
} for (MedicalRecordEntity pe : medicalRecordEntities) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { for (Long ids : response.getData()) {
@Override if (pe.getUnid().equals(ids)) {
public void onNotification(boolean result) { pe.setUploadStatus("1");
if (result) { break;
queryMedicalRecord(); }
me.goldze.mvvmhabit.utils.ToastUtils.showShort("上传-诊疗记录-数据成功!"); }
} else { }
me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改-诊疗记录-数据失败");
dismissDialog();
} }
} DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() {
}).updateAsyncBatch(MedicalRecordEntity.class, medicalRecordEntities); @Override
} else if (response.getCode() == 401) { public void onNotification(boolean result) {
dismissDialog(); if (result) {
Bundle bundle = new Bundle(); queryMedicalRecord();
bundle.putInt("loginType", 1); me.goldze.mvvmhabit.utils.ToastUtils.showShort("上传-诊疗记录-数据成功!");
startActivity(LoginActivity.class, bundle); } else {
me.goldze.mvvmhabit.utils.ToastUtils.showShort("登录过期,请重新登录"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改-诊疗记录-数据失败");
} else { dismissDialog();
}
}
}).updateAsyncBatch(MedicalRecordEntity.class, medicalRecordEntities);
} else if (response.getCode() == 401) {
dismissDialog();
Bundle bundle = new Bundle();
bundle.putInt("loginType", 1);
startActivity(LoginActivity.class, bundle);
me.goldze.mvvmhabit.utils.ToastUtils.showShort("登录过期,请重新登录");
} else {
// dismissDialog(); // dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort("服务器:" + response.getMsg()); me.goldze.mvvmhabit.utils.ToastUtils.showShort("服务器:" + response.getMsg());
requestMedicalRecord(); requestMedicalRecord();
} }
}, (Consumer<ResponseThrowable>) throwable -> { }, (Consumer<ResponseThrowable>) throwable -> {
dismissDialog(); dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort(throwable.message); me.goldze.mvvmhabit.utils.ToastUtils.showShort(throwable.message);
}) })
); );
} }
...@@ -1449,54 +1451,54 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1449,54 +1451,54 @@ public class SyncVM extends BaseViewModel<Repository> {
// KLog.e("label", postParams.toString()); // KLog.e("label", postParams.toString());
addSubscribe(model.uploadImmuneBatchList(body) addSubscribe(model.uploadImmuneBatchList(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
.compose(RxUtils.schedulersTransformer()) .compose(RxUtils.schedulersTransformer())
.compose(RxUtils.exceptionTransformer()) .compose(RxUtils.exceptionTransformer())
.doOnSubscribe(disposable -> showDialog("正在同步-免疫记录-主表-数据...")) .doOnSubscribe(disposable -> showDialog("正在同步-免疫记录-主表-数据..."))
.subscribe((Consumer<ListResponse<Long>>) response -> { .subscribe((Consumer<ListResponse<Long>>) response -> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
KLog.e("uploadImmuneBatch", response.toString()); KLog.e("uploadImmuneBatch", response.toString());
for (ImmuneBatchEntity pe : immuneBatchEntities) { for (ImmuneBatchEntity pe : immuneBatchEntities) {
pe.setUploadStatus("2"); pe.setUploadStatus("2");
}
if (response.getData() != null && response.getData().size() > 0) {
for (ImmuneBatchEntity pe : immuneBatchEntities) {
for (Long ids : response.getData()) {
if (pe.getUnid().equals(ids)) {
pe.setUploadStatus("1");
break;
}
} }
} if (response.getData() != null && response.getData().size() > 0) {
} for (ImmuneBatchEntity pe : immuneBatchEntities) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { for (Long ids : response.getData()) {
@Override if (pe.getUnid().equals(ids)) {
public void onNotification(boolean result) { pe.setUploadStatus("1");
if (result) { break;
queryImmuneBatch(); }
me.goldze.mvvmhabit.utils.ToastUtils.showShort("上传-免疫记录-主表-数据成功!"); }
} else { }
me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改-免疫记录-主表-数据失败");
dismissDialog();
} }
} DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() {
}).updateAsyncBatch(ImmuneBatchEntity.class, immuneBatchEntities); @Override
} else if (response.getCode() == 401) { public void onNotification(boolean result) {
dismissDialog(); if (result) {
Bundle bundle = new Bundle(); queryImmuneBatch();
bundle.putInt("loginType", 1); me.goldze.mvvmhabit.utils.ToastUtils.showShort("上传-免疫记录-主表-数据成功!");
startActivity(LoginActivity.class, bundle); } else {
me.goldze.mvvmhabit.utils.ToastUtils.showShort("登录过期,请重新登录"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改-免疫记录-主表-数据失败");
} else { dismissDialog();
}
}
}).updateAsyncBatch(ImmuneBatchEntity.class, immuneBatchEntities);
} else if (response.getCode() == 401) {
dismissDialog();
Bundle bundle = new Bundle();
bundle.putInt("loginType", 1);
startActivity(LoginActivity.class, bundle);
me.goldze.mvvmhabit.utils.ToastUtils.showShort("登录过期,请重新登录");
} else {
// dismissDialog(); // dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort("服务器:" + response.getMsg()); me.goldze.mvvmhabit.utils.ToastUtils.showShort("服务器:" + response.getMsg());
requestImmuneBatch(); requestImmuneBatch();
} }
}, (Consumer<ResponseThrowable>) throwable -> { }, (Consumer<ResponseThrowable>) throwable -> {
dismissDialog(); dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort(throwable.message); me.goldze.mvvmhabit.utils.ToastUtils.showShort(throwable.message);
}) })
); );
} }
...@@ -1648,54 +1650,54 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1648,54 +1650,54 @@ public class SyncVM extends BaseViewModel<Repository> {
// KLog.e("label", postParams.toString()); // KLog.e("label", postParams.toString());
addSubscribe(model.uploadImmuneBatchDetailList(body) addSubscribe(model.uploadImmuneBatchDetailList(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
.compose(RxUtils.schedulersTransformer()) .compose(RxUtils.schedulersTransformer())
.compose(RxUtils.exceptionTransformer()) .compose(RxUtils.exceptionTransformer())
.doOnSubscribe(disposable -> showDialog("正在同步-免疫记录-子表-数据...")) .doOnSubscribe(disposable -> showDialog("正在同步-免疫记录-子表-数据..."))
.subscribe((Consumer<ListResponse<Long>>) response -> { .subscribe((Consumer<ListResponse<Long>>) response -> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
KLog.e("uploadImmuneBatchDetail", response.toString()); KLog.e("uploadImmuneBatchDetail", response.toString());
for (ImmuneBatchDetailEntity pe : immuneBatchEntities) { for (ImmuneBatchDetailEntity pe : immuneBatchEntities) {
pe.setUploadStatus("2"); pe.setUploadStatus("2");
}
if (response.getData() != null && response.getData().size() > 0) {
for (ImmuneBatchDetailEntity pe : immuneBatchEntities) {
for (Long ids : response.getData()) {
if (pe.getUnid().equals(ids)) {
pe.setUploadStatus("1");
break;
}
} }
} if (response.getData() != null && response.getData().size() > 0) {
} for (ImmuneBatchDetailEntity pe : immuneBatchEntities) {
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { for (Long ids : response.getData()) {
@Override if (pe.getUnid().equals(ids)) {
public void onNotification(boolean result) { pe.setUploadStatus("1");
if (result) { break;
queryImmuneBatchDetail(); }
me.goldze.mvvmhabit.utils.ToastUtils.showShort("上传-免疫记录-子表-数据成功!"); }
} else { }
me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改-免疫记录-子表-数据失败");
dismissDialog();
} }
} DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() {
}).updateAsyncBatch(ImmuneBatchDetailEntity.class, immuneBatchEntities); @Override
} else if (response.getCode() == 401) { public void onNotification(boolean result) {
dismissDialog(); if (result) {
Bundle bundle = new Bundle(); queryImmuneBatchDetail();
bundle.putInt("loginType", 1); me.goldze.mvvmhabit.utils.ToastUtils.showShort("上传-免疫记录-子表-数据成功!");
startActivity(LoginActivity.class, bundle); } else {
me.goldze.mvvmhabit.utils.ToastUtils.showShort("登录过期,请重新登录"); me.goldze.mvvmhabit.utils.ToastUtils.showShort("修改-免疫记录-子表-数据失败");
} else { dismissDialog();
}
}
}).updateAsyncBatch(ImmuneBatchDetailEntity.class, immuneBatchEntities);
} else if (response.getCode() == 401) {
dismissDialog();
Bundle bundle = new Bundle();
bundle.putInt("loginType", 1);
startActivity(LoginActivity.class, bundle);
me.goldze.mvvmhabit.utils.ToastUtils.showShort("登录过期,请重新登录");
} else {
// dismissDialog(); // dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort("服务器:" + response.getMsg()); me.goldze.mvvmhabit.utils.ToastUtils.showShort("服务器:" + response.getMsg());
requestImmuneBatchDetail(); requestImmuneBatchDetail();
} }
}, (Consumer<ResponseThrowable>) throwable -> { }, (Consumer<ResponseThrowable>) throwable -> {
dismissDialog(); dismissDialog();
me.goldze.mvvmhabit.utils.ToastUtils.showShort(throwable.message); me.goldze.mvvmhabit.utils.ToastUtils.showShort(throwable.message);
}) })
); );
} }
...@@ -2022,7 +2024,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2022,7 +2024,7 @@ public class SyncVM extends BaseViewModel<Repository> {
//如果是未上传就继续查错误数据,如果不是就停止 //如果是未上传就继续查错误数据,如果不是就停止
if (UPLOAD_STATUS_HAVE_NOT.equals(uploadType)) { if (UPLOAD_STATUS_HAVE_NOT.equals(uploadType)) {
queryBreedingRecordDetailUploadCount(isContinue, UPLOAD_STATUS_ERROR); queryBreedingRecordDetailUploadCount(isContinue, UPLOAD_STATUS_ERROR);
}else{ } else {
dismissDialog(); dismissDialog();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment