Commit 10459ada authored by hywang's avatar hywang

1.不再保存图片到数据库

parent fddbe583
...@@ -9,8 +9,8 @@ android { ...@@ -9,8 +9,8 @@ android {
applicationId "com.phlx.anchorcollect_p" applicationId "com.phlx.anchorcollect_p"
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"
......
...@@ -51,7 +51,7 @@ public class RetrofitClient { ...@@ -51,7 +51,7 @@ public class RetrofitClient {
public static String baseUrl = public static String baseUrl =
"serve.xlglmnmyzspt.org.cn"//正式 "serve.xlglmnmyzspt.org.cn"//正式
// "39.101.170.186"//阿里云测试 // "39.101.170.186"//阿里云测试
// "192.168.1.80"//董 // "192.168.8.135"//董
// "192.168.43.154"//张敏 // "192.168.43.154"//张敏
; ;
public static String port = public static String port =
......
...@@ -120,7 +120,6 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin ...@@ -120,7 +120,6 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
initTimePicker(); initTimePicker();
} }
@Override @Override
...@@ -141,7 +140,7 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin ...@@ -141,7 +140,7 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
} }
} }
private void initImagePicker(){ private void initImagePicker() {
if (mImagePicker == null) { if (mImagePicker == null) {
mImagePicker = new ImagePicker(getActivity()); mImagePicker = new ImagePicker(getActivity());
mImagePicker.setOnImagePickerListener(new ImagePicker.OnImagePickerListener() { mImagePicker.setOnImagePickerListener(new ImagePicker.OnImagePickerListener() {
......
...@@ -8,6 +8,7 @@ import android.media.SoundPool; ...@@ -8,6 +8,7 @@ import android.media.SoundPool;
import android.os.Environment; import android.os.Environment;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.util.Log;
import android.util.SparseIntArray; import android.util.SparseIntArray;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
...@@ -475,10 +476,11 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve ...@@ -475,10 +476,11 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
cattleResumeEntity.setUpdateTime(dateFormat.format(new Date())); cattleResumeEntity.setUpdateTime(dateFormat.format(new Date()));
} }
//保存图片 //保存图片 改在上传时候读
if (Configs.tempCattleResume.getPhotoPath() != null && !Configs.tempCattleResume.getPhotoPath().equals("")) { // if (Configs.tempCattleResume.getPhotoPath() != null && !Configs.tempCattleResume.getPhotoPath().equals("")) {
cattleResumeEntity.setPhoto(BaseImageUtils.bitmapToString(Configs.tempCattleResume.getPhotoPath(), getApplication())); // cattleResumeEntity.setPhoto(BaseImageUtils.bitmapToString(Configs.tempCattleResume.getPhotoPath(), getApplication()));
} // }
cattleResumeEntity.setPhotoPath(Configs.tempCattleResume.getPhotoPath());
cattleResumeEntity.setDeptId(Long.parseLong(SPUtils.getInstance().getString(Configs.SP_DEPT_ID))); cattleResumeEntity.setDeptId(Long.parseLong(SPUtils.getInstance().getString(Configs.SP_DEPT_ID)));
cattleResumeEntity.setRegistrationNo(rfid.get()); cattleResumeEntity.setRegistrationNo(rfid.get());
cattleResumeEntity.setIndividualNo(tag.get());//修改去配置里修改 cattleResumeEntity.setIndividualNo(tag.get());//修改去配置里修改
......
...@@ -3,6 +3,7 @@ package com.phlx.anchorcollect_p.ui.setting; ...@@ -3,6 +3,7 @@ package com.phlx.anchorcollect_p.ui.setting;
import android.app.Application; import android.app.Application;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment; import android.os.Environment;
import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.databinding.ObservableField; import androidx.databinding.ObservableField;
...@@ -238,6 +239,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -238,6 +239,7 @@ public class SyncVM extends BaseViewModel<Repository> {
BaseImageUtils.saveBaseImage(cre.getPhoto(), imgUrl); BaseImageUtils.saveBaseImage(cre.getPhoto(), imgUrl);
cre.setUploadStatus("1"); cre.setUploadStatus("1");
ids.add(cre.getUnid()); ids.add(cre.getUnid());
cre.setPhoto("");
} }
DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() { DbUtil.getInstance().setDbIDUCallBack(new DbIDUCallBack() {
...@@ -344,6 +346,14 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -344,6 +346,14 @@ public class SyncVM extends BaseViewModel<Repository> {
*/ */
private void uploadBaseArchives(List<CattleResumeEntity> cattleResumeEntities) { private void uploadBaseArchives(List<CattleResumeEntity> cattleResumeEntities) {
//保存图片
for (CattleResumeEntity cre : cattleResumeEntities) {
Log.e("uploadBaseArchives", "cre.getPhotoPath()"+cre.getPhotoPath());
if (cre.getPhotoPath() != null && !cre.getPhotoPath().equals("")) {
cre.setPhoto(BaseImageUtils.bitmapToString(cre.getPhotoPath(), getApplication()));
}
}
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(cattleResumeEntities)); RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(cattleResumeEntities));
// KLog.e("label", postParams.toString()); // KLog.e("label", postParams.toString());
...@@ -359,6 +369,7 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -359,6 +369,7 @@ public class SyncVM extends BaseViewModel<Repository> {
//先都设置成错误数据 //先都设置成错误数据
for (CattleResumeEntity pe : cattleResumeEntities) { for (CattleResumeEntity pe : cattleResumeEntities) {
pe.setUploadStatus("2"); pe.setUploadStatus("2");
pe.setPhoto("");
} }
if (response.getCode() == 0) { if (response.getCode() == 0) {
if (response.getData() != null && response.getData().size() > 0) { if (response.getData() != null && response.getData().size() > 0) {
...@@ -2114,12 +2125,11 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2114,12 +2125,11 @@ 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();
} }
} }
@Override @Override
......
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