Browse Source

Merge branch 'master' into master_925

guilin 1 month ago
parent
commit
1a8b6b9e70

+ 9 - 6
app/src/main/java/com/fxy/common/AsyncFileUpload.java

@@ -319,26 +319,27 @@ public class AsyncFileUpload {
      */
     private void resultUpload(String tmpRealmId,Integer status,String photoPath){
         if (tmpRealmId!=null && !tmpRealmId.isEmpty()){
-            int rePush = 0;
             //遍历删除
             if (awaitUploadList.size()>0){
                 for (int i=0;i<awaitUploadList.size();i++){
                     if (awaitUploadList.get(i).getId().equals(tmpRealmId)){
-                        rePush = awaitUploadList.get(i).getRePush();
                         awaitUploadList.remove(i);
                         break;
                     }
                 }
             }
 
-            int pushStatus = 2;
-            if (status==0){
-                pushStatus = rePush>4 ? 1 : 0;
-            }
+
             //更新值
             mRealm.beginTransaction();
             AsyncUploadRealm myObject = mRealm.where(AsyncUploadRealm.class).equalTo("id",tmpRealmId).findFirst();
             assert myObject != null;
+            int pushStatus = 2;
+            int rePush = myObject.getRePush();
+            if (status==0){
+                pushStatus = rePush>4 ? 1 : 0;
+            }
+
             if (myObject.getPushStatus()!=3){
                 myObject.setPushStatus(pushStatus);
             }
@@ -348,6 +349,8 @@ public class AsyncFileUpload {
             }
             if (status == 1){
                 myObject.setOssUrl(photoPath);
+            }else{
+                myObject.setRePush(myObject.getRePush()+1);
             }
 
 

+ 12 - 6
app/src/main/java/com/fxy/common/AsyncPictureUpload.java

@@ -454,6 +454,7 @@ public class AsyncPictureUpload {
         Integer[] isFinish = {0,1,2};
         RealmResults<AsyncUploadRealm> realmResults ;
         RealmQuery<AsyncUploadRealm> queryRealm =  mRealm.where(AsyncUploadRealm.class)
+                .in("isFinish",isFinish)
                 .equalTo("isDelete",0);
         if (isAllRe){
             Integer[] pushStatus = {0,1};
@@ -461,6 +462,7 @@ public class AsyncPictureUpload {
 //                    .equalTo("notifyKey",fileKey)
 //                    .equalTo("uploadType",uploadType)
                     ;
+            isAllRe = false;
         }else{
             queryRealm.equalTo("pushStatus",0)
 //                    .equalTo("notifyKey",fileKey)
@@ -489,26 +491,28 @@ public class AsyncPictureUpload {
      */
     private void resultUpload(String tmpRealmId,Integer status,String photoPath){
         if (tmpRealmId!=null && !tmpRealmId.isEmpty()){
-            int rePush = 0;
+
             //遍历删除
             if (awaitUploadList.size()>0){
                 for (int i=0;i<awaitUploadList.size();i++){
                     if (awaitUploadList.get(i).getId().equals(tmpRealmId)){
-                        rePush = awaitUploadList.get(i).getRePush();
                         awaitUploadList.remove(i);
                         break;
                     }
                 }
             }
 
-            int pushStatus = 2;
-            if (status==0){
-                pushStatus = rePush>4 ? 1 : 0;
-            }
+
             //更新值
             mRealm.beginTransaction();
             AsyncUploadRealm myObject = mRealm.where(AsyncUploadRealm.class).equalTo("id",tmpRealmId).findFirst();
             assert myObject != null;
+            int rePush = myObject.getRePush();
+            int pushStatus = 2;
+            if (status==0){
+                pushStatus = rePush>4 ? 1 : 0;
+            }
+
             if (myObject.getPushStatus()!=3){
                 myObject.setPushStatus(pushStatus);
             }
@@ -518,6 +522,8 @@ public class AsyncPictureUpload {
             }
             if (status == 1){
                 myObject.setOssUrl(photoPath);
+            }else{
+                myObject.setRePush(myObject.getRePush()+1);
             }
             mRealm.commitTransaction();