Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
A
AnchorCollect_p
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hywang
AnchorCollect_p
Commits
10459ada
Commit
10459ada
authored
Oct 16, 2023
by
hywang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.不再保存图片到数据库
parent
fddbe583
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
277 additions
and
266 deletions
+277
-266
build.gradle
app/build.gradle
+2
-2
RetrofitClient.java
...ain/java/com/phlx/anchorcollect_p/net/RetrofitClient.java
+1
-1
BasicsCollectFragment.java
...lx/anchorcollect_p/ui/fragment/BasicsCollectFragment.java
+9
-10
BasicsCollectVM.java
.../phlx/anchorcollect_p/ui/fragment/vm/BasicsCollectVM.java
+6
-4
SyncVM.java
...main/java/com/phlx/anchorcollect_p/ui/setting/SyncVM.java
+259
-249
No files found.
app/build.gradle
View file @
10459ada
...
@@ -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
1
1
versionCode
1
2
versionName
"2.0.
5
"
versionName
"2.0.
6
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
...
...
app/src/main/java/com/phlx/anchorcollect_p/net/RetrofitClient.java
View file @
10459ada
...
@@ -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
=
...
...
app/src/main/java/com/phlx/anchorcollect_p/ui/fragment/BasicsCollectFragment.java
View file @
10459ada
...
@@ -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
()
{
...
@@ -225,13 +224,13 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
...
@@ -225,13 +224,13 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
.
setCancelTextInfo
(
textInfo
)
.
setCancelTextInfo
(
textInfo
)
.
setMaxWidth
(
600
)
.
setMaxWidth
(
600
)
.
setInputHintText
(
"请输入可视化耳标号"
).
setOkButton
(
new
OnInputDialogButtonClickListener
<
InputDialog
>()
{
.
setInputHintText
(
"请输入可视化耳标号"
).
setOkButton
(
new
OnInputDialogButtonClickListener
<
InputDialog
>()
{
@Override
@Override
public
boolean
onClick
(
InputDialog
baseDialog
,
View
v
,
String
inputStr
)
{
public
boolean
onClick
(
InputDialog
baseDialog
,
View
v
,
String
inputStr
)
{
viewModel
.
tag
.
set
(
inputStr
);
viewModel
.
tag
.
set
(
inputStr
);
viewModel
.
initDataForTag
(
inputStr
);
viewModel
.
initDataForTag
(
inputStr
);
return
false
;
return
false
;
}
}
});
});
}
}
});
});
...
@@ -408,7 +407,7 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
...
@@ -408,7 +407,7 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
RxPermissions
rxPermissions
=
new
RxPermissions
(
getActivity
());
RxPermissions
rxPermissions
=
new
RxPermissions
(
getActivity
());
rxPermissions
.
request
(
Manifest
.
permission
.
CAMERA
,
Manifest
.
permission
rxPermissions
.
request
(
Manifest
.
permission
.
CAMERA
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
.
READ_EXTERNAL_STORAGE
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
.
subscribe
(
new
Consumer
<
Boolean
>()
{
.
subscribe
(
new
Consumer
<
Boolean
>()
{
@Override
@Override
public
void
accept
(
Boolean
aBoolean
)
throws
Exception
{
public
void
accept
(
Boolean
aBoolean
)
throws
Exception
{
...
...
app/src/main/java/com/phlx/anchorcollect_p/ui/fragment/vm/BasicsCollectVM.java
View file @
10459ada
...
@@ -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
());
//修改去配置里修改
...
...
app/src/main/java/com/phlx/anchorcollect_p/ui/setting/SyncVM.java
View file @
10459ada
...
@@ -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
)
{
...
@@ -748,53 +759,53 @@ public class SyncVM extends BaseViewModel<Repository> {
...
@@ -748,53 +759,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
);
})
})
);
);
}
}
...
@@ -945,53 +956,53 @@ public class SyncVM extends BaseViewModel<Repository> {
...
@@ -945,53 +956,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
);
})
})
);
);
}
}
...
@@ -1341,54 +1352,54 @@ public class SyncVM extends BaseViewModel<Repository> {
...
@@ -1341,54 +1352,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
);
})
})
);
);
}
}
...
@@ -1542,54 +1553,54 @@ public class SyncVM extends BaseViewModel<Repository> {
...
@@ -1542,54 +1553,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
);
})
})
);
);
}
}
...
@@ -1741,54 +1752,54 @@ public class SyncVM extends BaseViewModel<Repository> {
...
@@ -1741,54 +1752,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
);
})
})
);
);
}
}
...
@@ -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
...
@@ -2158,39 +2168,39 @@ public class SyncVM extends BaseViewModel<Repository> {
...
@@ -2158,39 +2168,39 @@ public class SyncVM extends BaseViewModel<Repository> {
RequestBody
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json"
),
new
Gson
().
toJson
(
errorEntity
));
RequestBody
body
=
RequestBody
.
create
(
MediaType
.
parse
(
"application/json"
),
new
Gson
().
toJson
(
errorEntity
));
addSubscribe
(
model
.
uploadErrorData
(
body
)
addSubscribe
(
model
.
uploadErrorData
(
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
<
CollectResponse
>)
response
->
{
.
subscribe
((
Consumer
<
CollectResponse
>)
response
->
{
if
(
response
.
getCode
()
==
0
)
{
if
(
response
.
getCode
()
==
0
)
{
DbUtil
.
getInstance
().
setDbIDUCallBack
(
new
DbIDUCallBack
()
{
DbUtil
.
getInstance
().
setDbIDUCallBack
(
new
DbIDUCallBack
()
{
@Override
@Override
public
void
onNotification
(
boolean
result
)
{
public
void
onNotification
(
boolean
result
)
{
if
(
result
)
{
if
(
result
)
{
uploadBaseArchivesError
();
uploadBaseArchivesError
();
}
else
{
}
else
{
uploadPerformanceError
();
uploadPerformanceError
();
}
}
}
}
}).
deleteAsyncBatch
(
CattleResumeEntity
.
class
,
result
);
}).
deleteAsyncBatch
(
CattleResumeEntity
.
class
,
result
);
}
else
if
(
response
.
getCode
()
==
401
)
{
}
else
if
(
response
.
getCode
()
==
401
)
{
dismissDialog
();
dismissDialog
();
Bundle
bundle
=
new
Bundle
();
Bundle
bundle
=
new
Bundle
();
bundle
.
putInt
(
"loginType"
,
1
);
bundle
.
putInt
(
"loginType"
,
1
);
startActivity
(
LoginActivity
.
class
,
bundle
);
startActivity
(
LoginActivity
.
class
,
bundle
);
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"登录过期,请重新登录"
);
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"登录过期,请重新登录"
);
}
else
{
}
else
{
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"服务器:"
+
response
.
getMsg
());
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"服务器:"
+
response
.
getMsg
());
uploadPerformanceError
();
uploadPerformanceError
();
}
}
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
dismissDialog
();
dismissDialog
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
throwable
.
message
);
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
throwable
.
message
);
})
})
);
);
}
else
{
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment