Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
A
AnchorCollect
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
Commits
b8c195a0
Commit
b8c195a0
authored
Oct 16, 2023
by
hywang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.不再保存图片base64,增加图片路径
parent
e38e23f3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
245 additions
and
232 deletions
+245
-232
build.gradle
app/build.gradle
+3
-3
DaoMaster.java
...rc/main/java/com/phlx/anchorcollect/db/gen/DaoMaster.java
+2
-2
CattleResumeEntity.java
...ava/com/phlx/anchorcollect/entity/CattleResumeEntity.java
+19
-8
SyncVM.java
...c/main/java/com/phlx/anchorcollect/ui/setting/SyncVM.java
+221
-219
No files found.
app/build.gradle
View file @
b8c195a0
...
...
@@ -9,8 +9,8 @@ android {
applicationId
"com.phlx.anchorcollect"
minSdkVersion
21
targetSdkVersion
29
versionCode
1
1
versionName
"2.0.
5
"
versionCode
1
2
versionName
"2.0.
6
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
...
...
@@ -48,7 +48,7 @@ android {
}
greendao
{
schemaVersion
5
//数据库版本号
schemaVersion
6
//数据库版本号
daoPackage
'com.phlx.anchorcollect.db.gen'
targetGenDir
'src/main/java'
}
...
...
app/src/main/java/com/phlx/anchorcollect/db/gen/DaoMaster.java
View file @
b8c195a0
...
...
@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
// 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
static
final
int
SCHEMA_VERSION
=
5
;
public
static
final
int
SCHEMA_VERSION
=
6
;
/** Creates underlying database table using DAOs. */
public
static
void
createAllTables
(
Database
db
,
boolean
ifNotExists
)
{
...
...
app/src/main/java/com/phlx/anchorcollect/entity/CattleResumeEntity.java
View file @
b8c195a0
...
...
@@ -81,6 +81,9 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
/** 照片路径;(可以多图片“,”分割) */
private
String
photo
;
/** 照片路径, 手持机用*/
private
String
photoPath
;
/** 状态(育种,育成,成年;淘汰,出售) */
private
String
status
;
...
...
@@ -162,6 +165,7 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
junHeavy
=
in
.
readString
();
decAppScore
=
in
.
readString
();
photo
=
in
.
readString
();
photoPath
=
in
.
readString
();
status
=
in
.
readString
();
if
(
in
.
readByte
()
==
0
)
{
isOut
=
null
;
...
...
@@ -194,14 +198,14 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
remark
=
in
.
readString
();
}
@Generated
(
hash
=
1
106807371
)
@Generated
(
hash
=
1
557063295
)
public
CattleResumeEntity
(
Long
unid
,
String
registrationNo
,
String
individualNo
,
String
circleNo
,
String
raiseType
,
String
raiseVarieties
,
String
birthdate
,
Double
birthHeavy
,
String
sex
,
String
birthDifficulty
,
String
isTwins
,
String
childTime
,
String
grade
,
String
fatherReg
,
String
motherReg
,
Double
fromMilkHeavy
,
String
health
,
String
junHeavy
,
String
decAppScore
,
String
photo
,
String
status
,
Long
isOut
,
Integer
age
,
String
colour
,
String
inputTime
,
Long
deptId
,
Long
deptName
,
String
uploadStatus
,
String
uploadTime
,
String
createBy
,
String
createTime
,
String
updateBy
,
String
updateTime
,
String
remark
)
{
String
photo
,
String
photoPath
,
String
status
,
Long
isOut
,
Integer
age
,
String
colour
,
String
inputTime
,
Long
deptId
,
Long
deptName
,
String
uploadStatus
,
String
uploadTime
,
String
create
By
,
String
create
Time
,
String
updateBy
,
String
updateTime
,
String
remark
)
{
this
.
unid
=
unid
;
this
.
registrationNo
=
registrationNo
;
this
.
individualNo
=
individualNo
;
...
...
@@ -222,6 +226,7 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
this
.
junHeavy
=
junHeavy
;
this
.
decAppScore
=
decAppScore
;
this
.
photo
=
photo
;
this
.
photoPath
=
photoPath
;
this
.
status
=
status
;
this
.
isOut
=
isOut
;
this
.
age
=
age
;
...
...
@@ -275,6 +280,7 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
dest
.
writeString
(
junHeavy
);
dest
.
writeString
(
decAppScore
);
dest
.
writeString
(
photo
);
dest
.
writeString
(
photoPath
);
dest
.
writeString
(
status
);
if
(
isOut
==
null
)
{
dest
.
writeByte
((
byte
)
0
);
...
...
@@ -328,10 +334,6 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
}
};
public
static
long
getSerialVersionUID
()
{
return
serialVersionUID
;
}
public
Long
getUnid
()
{
return
unid
;
}
...
...
@@ -492,6 +494,14 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
this
.
photo
=
photo
;
}
public
String
getPhotoPath
()
{
return
photoPath
;
}
public
void
setPhotoPath
(
String
photoPath
)
{
this
.
photoPath
=
photoPath
;
}
public
String
getStatus
()
{
return
status
;
}
...
...
@@ -627,6 +637,7 @@ public class CattleResumeEntity extends BaseObservable implements Parcelable {
", junHeavy='"
+
junHeavy
+
'\''
+
", decAppScore='"
+
decAppScore
+
'\''
+
", photo='"
+
photo
+
'\''
+
", photoPath='"
+
photoPath
+
'\''
+
", status='"
+
status
+
'\''
+
", isOut="
+
isOut
+
", age="
+
age
+
...
...
app/src/main/java/com/phlx/anchorcollect/ui/setting/SyncVM.java
View file @
b8c195a0
...
...
@@ -232,6 +232,8 @@ public class SyncVM extends BaseViewModel<Repository> {
for
(
CattleResumeEntity
cre
:
response
.
getData
())
{
imgUrl
=
savePath
+
"/anchorCiq"
+
cre
.
getUnid
()
+
".jpg"
;
BaseImageUtils
.
saveBaseImage
(
cre
.
getPhoto
(),
imgUrl
);
cre
.
setPhoto
(
""
);
cre
.
setPhotoPath
(
imgUrl
);
cre
.
setUploadStatus
(
"1"
);
ids
.
add
(
cre
.
getUnid
());
}
...
...
@@ -655,53 +657,53 @@ public class SyncVM extends BaseViewModel<Repository> {
// KLog.e("label", postParams.toString());
addSubscribe
(
model
.
uploadBreedingRecordList
(
body
)
.
compose
(
RxUtils
.
bindToLifecycle
(
getLifecycleProvider
()))
.
compose
(
RxUtils
.
schedulersTransformer
())
.
compose
(
RxUtils
.
exceptionTransformer
())
.
doOnSubscribe
(
disposable
->
showDialog
(
"正在同步-配种记录主表-数据..."
))
.
subscribe
((
Consumer
<
ListResponse
<
Long
>>)
response
->
{
.
compose
(
RxUtils
.
bindToLifecycle
(
getLifecycleProvider
()))
.
compose
(
RxUtils
.
schedulersTransformer
())
.
compose
(
RxUtils
.
exceptionTransformer
())
.
doOnSubscribe
(
disposable
->
showDialog
(
"正在同步-配种记录主表-数据..."
))
.
subscribe
((
Consumer
<
ListResponse
<
Long
>>)
response
->
{
if
(
response
.
getCode
()
==
0
)
{
KLog
.
e
(
"uploadBreedingRecord"
,
response
.
toString
());
for
(
BreedingRecordEntity
pe
:
breedingRecordEntities
)
{
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
.
getCode
()
==
0
)
{
KLog
.
e
(
"uploadBreedingRecord"
,
response
.
toString
());
for
(
BreedingRecordEntity
pe
:
breedingRecordEntities
)
{
pe
.
setUploadStatus
(
"2"
);
}
}
}
DbUtil
.
getInstance
().
setDbIDUCallBack
(
new
DbIDUCallBack
()
{
@Override
public
void
onNotification
(
boolean
result
)
{
if
(
result
)
{
queryBreedingRecord
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"上传-配种记录主表-数据成功!"
);
}
else
{
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"修改-配种记录主表-数据失败"
);
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
;
}
}
}
}
}
}).
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
{
DbUtil
.
getInstance
().
setDbIDUCallBack
(
new
DbIDUCallBack
()
{
@Override
public
void
onNotification
(
boolean
result
)
{
if
(
result
)
{
queryBreedingRecord
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"上传-配种记录主表-数据成功!"
);
}
else
{
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"修改-配种记录主表-数据失败"
);
}
}
}).
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();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"服务器:"
+
response
.
getMsg
());
requestBreedingRecord
();
}
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
dismissDialog
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
throwable
.
message
);
})
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"服务器:"
+
response
.
getMsg
());
requestBreedingRecord
();
}
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
dismissDialog
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
throwable
.
message
);
})
);
}
...
...
@@ -852,53 +854,53 @@ public class SyncVM extends BaseViewModel<Repository> {
// KLog.e("label", postParams.toString());
addSubscribe
(
model
.
uploadBreedingRecordDetailList
(
body
)
.
compose
(
RxUtils
.
bindToLifecycle
(
getLifecycleProvider
()))
.
compose
(
RxUtils
.
schedulersTransformer
())
.
compose
(
RxUtils
.
exceptionTransformer
())
.
doOnSubscribe
(
disposable
->
showDialog
(
"正在同步-配种记录子表-数据..."
))
.
subscribe
((
Consumer
<
ListResponse
<
Long
>>)
response
->
{
.
compose
(
RxUtils
.
bindToLifecycle
(
getLifecycleProvider
()))
.
compose
(
RxUtils
.
schedulersTransformer
())
.
compose
(
RxUtils
.
exceptionTransformer
())
.
doOnSubscribe
(
disposable
->
showDialog
(
"正在同步-配种记录子表-数据..."
))
.
subscribe
((
Consumer
<
ListResponse
<
Long
>>)
response
->
{
if
(
response
.
getCode
()
==
0
)
{
KLog
.
e
(
"uploadBreedingRecordDetail"
,
response
.
toString
());
for
(
BreedingRecordDetailEntity
pe
:
breedingRecordDetailEntities
)
{
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
.
getCode
()
==
0
)
{
KLog
.
e
(
"uploadBreedingRecordDetail"
,
response
.
toString
());
for
(
BreedingRecordDetailEntity
pe
:
breedingRecordDetailEntities
)
{
pe
.
setUploadStatus
(
"2"
);
}
}
}
DbUtil
.
getInstance
().
setDbIDUCallBack
(
new
DbIDUCallBack
()
{
@Override
public
void
onNotification
(
boolean
result
)
{
if
(
result
)
{
queryBreedingRecordDetail
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"上传-配种记录子表-数据成功!"
);
}
else
{
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"修改-配种记录子表-数据失败"
);
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
;
}
}
}
}
}
}).
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
{
DbUtil
.
getInstance
().
setDbIDUCallBack
(
new
DbIDUCallBack
()
{
@Override
public
void
onNotification
(
boolean
result
)
{
if
(
result
)
{
queryBreedingRecordDetail
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"上传-配种记录子表-数据成功!"
);
}
else
{
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"修改-配种记录子表-数据失败"
);
}
}
}).
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();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"服务器:"
+
response
.
getMsg
());
requestBreedingRecordDetail
();
}
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
dismissDialog
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
throwable
.
message
);
})
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"服务器:"
+
response
.
getMsg
());
requestBreedingRecordDetail
();
}
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
dismissDialog
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
throwable
.
message
);
})
);
}
...
...
@@ -1248,54 +1250,54 @@ public class SyncVM extends BaseViewModel<Repository> {
// KLog.e("label", postParams.toString());
addSubscribe
(
model
.
uploadMedicalRecordList
(
body
)
.
compose
(
RxUtils
.
bindToLifecycle
(
getLifecycleProvider
()))
.
compose
(
RxUtils
.
schedulersTransformer
())
.
compose
(
RxUtils
.
exceptionTransformer
())
.
doOnSubscribe
(
disposable
->
showDialog
(
"正在同步-诊疗记录-数据..."
))
.
subscribe
((
Consumer
<
ListResponse
<
Long
>>)
response
->
{
.
compose
(
RxUtils
.
bindToLifecycle
(
getLifecycleProvider
()))
.
compose
(
RxUtils
.
schedulersTransformer
())
.
compose
(
RxUtils
.
exceptionTransformer
())
.
doOnSubscribe
(
disposable
->
showDialog
(
"正在同步-诊疗记录-数据..."
))
.
subscribe
((
Consumer
<
ListResponse
<
Long
>>)
response
->
{
if
(
response
.
getCode
()
==
0
)
{
KLog
.
e
(
"uploadMedicalRecord"
,
response
.
toString
());
for
(
MedicalRecordEntity
pe
:
medicalRecordEntities
)
{
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
.
getCode
()
==
0
)
{
KLog
.
e
(
"uploadMedicalRecord"
,
response
.
toString
());
for
(
MedicalRecordEntity
pe
:
medicalRecordEntities
)
{
pe
.
setUploadStatus
(
"2"
);
}
}
}
DbUtil
.
getInstance
().
setDbIDUCallBack
(
new
DbIDUCallBack
()
{
@Override
public
void
onNotification
(
boolean
result
)
{
if
(
result
)
{
queryMedicalRecord
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"上传-诊疗记录-数据成功!"
);
}
else
{
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"修改-诊疗记录-数据失败"
);
dismissDialog
();
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
;
}
}
}
}
}
}).
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
{
DbUtil
.
getInstance
().
setDbIDUCallBack
(
new
DbIDUCallBack
()
{
@Override
public
void
onNotification
(
boolean
result
)
{
if
(
result
)
{
queryMedicalRecord
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"上传-诊疗记录-数据成功!"
);
}
else
{
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"修改-诊疗记录-数据失败"
);
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();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"服务器:"
+
response
.
getMsg
());
requestMedicalRecord
();
}
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
dismissDialog
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
throwable
.
message
);
})
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"服务器:"
+
response
.
getMsg
());
requestMedicalRecord
();
}
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
dismissDialog
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
throwable
.
message
);
})
);
}
...
...
@@ -1449,54 +1451,54 @@ public class SyncVM extends BaseViewModel<Repository> {
// KLog.e("label", postParams.toString());
addSubscribe
(
model
.
uploadImmuneBatchList
(
body
)
.
compose
(
RxUtils
.
bindToLifecycle
(
getLifecycleProvider
()))
.
compose
(
RxUtils
.
schedulersTransformer
())
.
compose
(
RxUtils
.
exceptionTransformer
())
.
doOnSubscribe
(
disposable
->
showDialog
(
"正在同步-免疫记录-主表-数据..."
))
.
subscribe
((
Consumer
<
ListResponse
<
Long
>>)
response
->
{
.
compose
(
RxUtils
.
bindToLifecycle
(
getLifecycleProvider
()))
.
compose
(
RxUtils
.
schedulersTransformer
())
.
compose
(
RxUtils
.
exceptionTransformer
())
.
doOnSubscribe
(
disposable
->
showDialog
(
"正在同步-免疫记录-主表-数据..."
))
.
subscribe
((
Consumer
<
ListResponse
<
Long
>>)
response
->
{
if
(
response
.
getCode
()
==
0
)
{
KLog
.
e
(
"uploadImmuneBatch"
,
response
.
toString
());
for
(
ImmuneBatchEntity
pe
:
immuneBatchEntities
)
{
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
.
getCode
()
==
0
)
{
KLog
.
e
(
"uploadImmuneBatch"
,
response
.
toString
());
for
(
ImmuneBatchEntity
pe
:
immuneBatchEntities
)
{
pe
.
setUploadStatus
(
"2"
);
}
}
}
DbUtil
.
getInstance
().
setDbIDUCallBack
(
new
DbIDUCallBack
()
{
@Override
public
void
onNotification
(
boolean
result
)
{
if
(
result
)
{
queryImmuneBatch
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"上传-免疫记录-主表-数据成功!"
);
}
else
{
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"修改-免疫记录-主表-数据失败"
);
dismissDialog
();
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
;
}
}
}
}
}
}).
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
{
DbUtil
.
getInstance
().
setDbIDUCallBack
(
new
DbIDUCallBack
()
{
@Override
public
void
onNotification
(
boolean
result
)
{
if
(
result
)
{
queryImmuneBatch
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"上传-免疫记录-主表-数据成功!"
);
}
else
{
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"修改-免疫记录-主表-数据失败"
);
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();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"服务器:"
+
response
.
getMsg
());
requestImmuneBatch
();
}
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
dismissDialog
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
throwable
.
message
);
})
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"服务器:"
+
response
.
getMsg
());
requestImmuneBatch
();
}
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
dismissDialog
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
throwable
.
message
);
})
);
}
...
...
@@ -1648,54 +1650,54 @@ public class SyncVM extends BaseViewModel<Repository> {
// KLog.e("label", postParams.toString());
addSubscribe
(
model
.
uploadImmuneBatchDetailList
(
body
)
.
compose
(
RxUtils
.
bindToLifecycle
(
getLifecycleProvider
()))
.
compose
(
RxUtils
.
schedulersTransformer
())
.
compose
(
RxUtils
.
exceptionTransformer
())
.
doOnSubscribe
(
disposable
->
showDialog
(
"正在同步-免疫记录-子表-数据..."
))
.
subscribe
((
Consumer
<
ListResponse
<
Long
>>)
response
->
{
.
compose
(
RxUtils
.
bindToLifecycle
(
getLifecycleProvider
()))
.
compose
(
RxUtils
.
schedulersTransformer
())
.
compose
(
RxUtils
.
exceptionTransformer
())
.
doOnSubscribe
(
disposable
->
showDialog
(
"正在同步-免疫记录-子表-数据..."
))
.
subscribe
((
Consumer
<
ListResponse
<
Long
>>)
response
->
{
if
(
response
.
getCode
()
==
0
)
{
KLog
.
e
(
"uploadImmuneBatchDetail"
,
response
.
toString
());
for
(
ImmuneBatchDetailEntity
pe
:
immuneBatchEntities
)
{
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
.
getCode
()
==
0
)
{
KLog
.
e
(
"uploadImmuneBatchDetail"
,
response
.
toString
());
for
(
ImmuneBatchDetailEntity
pe
:
immuneBatchEntities
)
{
pe
.
setUploadStatus
(
"2"
);
}
}
}
DbUtil
.
getInstance
().
setDbIDUCallBack
(
new
DbIDUCallBack
()
{
@Override
public
void
onNotification
(
boolean
result
)
{
if
(
result
)
{
queryImmuneBatchDetail
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"上传-免疫记录-子表-数据成功!"
);
}
else
{
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"修改-免疫记录-子表-数据失败"
);
dismissDialog
();
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
;
}
}
}
}
}
}).
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
{
DbUtil
.
getInstance
().
setDbIDUCallBack
(
new
DbIDUCallBack
()
{
@Override
public
void
onNotification
(
boolean
result
)
{
if
(
result
)
{
queryImmuneBatchDetail
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"上传-免疫记录-子表-数据成功!"
);
}
else
{
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"修改-免疫记录-子表-数据失败"
);
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();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"服务器:"
+
response
.
getMsg
());
requestImmuneBatchDetail
();
}
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
dismissDialog
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
throwable
.
message
);
})
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
"服务器:"
+
response
.
getMsg
());
requestImmuneBatchDetail
();
}
},
(
Consumer
<
ResponseThrowable
>)
throwable
->
{
dismissDialog
();
me
.
goldze
.
mvvmhabit
.
utils
.
ToastUtils
.
showShort
(
throwable
.
message
);
})
);
}
...
...
@@ -2022,7 +2024,7 @@ public class SyncVM extends BaseViewModel<Repository> {
//如果是未上传就继续查错误数据,如果不是就停止
if
(
UPLOAD_STATUS_HAVE_NOT
.
equals
(
uploadType
))
{
queryBreedingRecordDetailUploadCount
(
isContinue
,
UPLOAD_STATUS_ERROR
);
}
else
{
}
else
{
dismissDialog
();
}
...
...
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