From 2e9e14088a9a7ec0eabb99eed54efeb1254fa927 Mon Sep 17 00:00:00 2001
From: weimingfei <fei_gaming@sina.com>
Date: 星期五, 17 十月 2025 14:15:29 +0800
Subject: [PATCH] 钥匙柜
---
keyCabinet-android/app/src/main/java/com/doumee/keyCabinet/ui/main/MainVM.java | 142 ++++++++++++++---------------------------------
1 files changed, 42 insertions(+), 100 deletions(-)
diff --git a/keyCabinet-android/app/src/main/java/com/doumee/keyCabinet/ui/main/MainVM.java b/keyCabinet-android/app/src/main/java/com/doumee/keyCabinet/ui/main/MainVM.java
index ea0656e..103ae1d 100644
--- a/keyCabinet-android/app/src/main/java/com/doumee/keyCabinet/ui/main/MainVM.java
+++ b/keyCabinet-android/app/src/main/java/com/doumee/keyCabinet/ui/main/MainVM.java
@@ -10,18 +10,15 @@
import com.doumee.keyCabinet.MApplication;
import com.doumee.keyCabinet.R;
-import com.doumee.keyCabinet.bean.ConfigBean;
+import com.doumee.keyCabinet.bean.CabinetFaceBean;
import com.doumee.keyCabinet.bean.DevConfigBean;
import com.doumee.keyCabinet.bean.FaceUserBean;
-import com.doumee.keyCabinet.bean.RecyclerBraceletBean;
import com.doumee.keyCabinet.event.DevConfigEvent;
-import com.doumee.keyCabinet.event.ReLoginEvent;
import com.doumee.keyCabinet.http.Apis;
import com.doumee.keyCabinet.http.param.BaseResponse;
import com.doumee.keyCabinet.http.param.DevErrInfoParam;
import com.doumee.keyCabinet.http.param.DevLoginParam;
import com.doumee.keyCabinet.http.param.FaceUserParam;
-import com.doumee.keyCabinet.http.param.RecyclerSHParam;
import com.doumee.keyCabinet.http.param.RequestBaseObject;
import com.doumee.keyCabinet.ui.guide.GuideActivity;
import com.doumee.keyCabinet.utils.BraceletLogUtils;
@@ -36,6 +33,7 @@
import org.greenrobot.eventbus.EventBus;
+import java.util.ArrayList;
import java.util.List;
import okhttp3.Headers;
@@ -64,73 +62,25 @@
}
public void devLogin(){
- if (true) {
- return;
- }
//娓呴櫎鐧诲綍淇℃伅
if(isReq){
return;
}
isReq = true;
- MApplication.setCookie("");
- MApplication.saveConfigBean(new ConfigBean());
- RequestBaseObject<DevLoginParam> request = new RequestBaseObject<>();
- DevLoginParam param = new DevLoginParam();
- param.setDevCode(LMobileInfo.getDeviceUniqueId());
- request.setParam(param);
- getRetrofitService(Apis.class).devLogin(0,
- ParamsUtil.encodeRequestBody(request))
+ MApplication.saveConfigBean(new DevConfigBean());
+ getRetrofitService(Apis.class).getCabinetInfoForDriver(LMobileInfo.getDeviceUniqueId())
.compose(RxUtils.schedulersTransformer())
- .subscribe(new SimpleObserver<Response<BaseResponse<DevConfigBean>>>(rxJavaGcManager) {
+ .subscribe(new SimpleObserver<BaseResponse<DevConfigBean>>(rxJavaGcManager) {
@Override
- public void onNext(@NonNull Response<BaseResponse<DevConfigBean>> base) {
- Headers headers = base.headers();//鎴戜滑閫氳繃Response鐨刪eaders瀵硅薄鑾峰彇鍒板搷搴斿ご淇℃伅銆�
- List<String> values = headers.values("Set-Cookie");//閫氳繃鈥淪et-Cookie鈥濆瓧娈佃幏鍙栧埌鏈嶅姟鍣ㄨ繑鍥炵殑Cookie淇℃伅
- if(values!=null&&values.size()>0){
- MApplication.setCookie(values.get(0));
- }
- BaseResponse<DevConfigBean> response = base.body();
- if(response==null){
- toast(MApplication.mContext.getString(R.string.guide_toast_1));
- }
- if("000000".equals(response.getErrorCode())){
- if(response.getRecord()!=null){
- if("0".equals(response.getRecord().getStatus())){
- startActivity(GuideActivity.class);
- finish();
- return;
- }
- DevConfigBean devConfigBean = response.getRecord();
- ConfigBean configBean = new ConfigBean();
- configBean.setShopId(devConfigBean.getShopId());
- configBean.setCapacity(devConfigBean.getCapacity());
- configBean.setMoney(devConfigBean.getMoney());
- configBean.setCategory(devConfigBean.getCategory());
- configBean.setCurNum(devConfigBean.getCurNum());
- configBean.setName(devConfigBean.getName());
- configBean.setGymId(devConfigBean.getVenueId());
- configBean.setLanguage(devConfigBean.getLanguage());
- String language = devConfigBean.getLanguage();
- if(!TextUtils.isEmpty(language)){
- //杞皬鍐�
- language = language.toLowerCase();
- if("zh".equals(language)){
- MApplication.nLan = 0;
- }else {
- MApplication.nLan = 1;
- }
- }
- SpUtil.saveString("language",language);
- LanguageUtil.changeAppLanguage(MApplication.mContext,language);
- MApplication.saveConfigBean(configBean);
+ public void onNext(@NonNull BaseResponse<DevConfigBean> response) {
+ if(200==response.getCode()){
+ if(response.getData()!=null){
+ MApplication.saveConfigBean(response.getData());
}else {
toast(MApplication.mContext.getString(R.string.guide_toast_1));
}
- }else if("33010101".equals(response.getErrorCode())) {
- toast(MApplication.mContext.getString(R.string.guide_toast_2)+
- MApplication.mContext.getString(R.string.symbol_colon)+param.getDevCode());
}else {
- toast(response.getErrorMsg());
+ toast(response.getMessage());
}
}
@@ -147,33 +97,20 @@
}
public void devHeart(){
- if (true) {
+ if (MApplication.getConfigBean().getId()==null) {
return;
}
- RequestBaseObject<DevLoginParam> request = new RequestBaseObject<>();
- DevLoginParam param = new DevLoginParam();
- param.setDevCode(LMobileInfo.getDeviceUniqueId());
- request.setParam(param);
- getRetrofitService(Apis.class).heart(MApplication.getConfigBean().getLanguage(),MApplication.getCookie(),MApplication.getConfigBean().getShopId(),
- MApplication.getConfigBean().getGymId(),ParamsUtil.encodeRequestBody(request))
+ getRetrofitService(Apis.class).heart(MApplication.getConfigBean().getId())
.compose(RxUtils.schedulersTransformer())
- .subscribe(new SimpleObserver<BaseResponse<DevConfigBean>>(rxJavaGcManager) {
+ .subscribe(new SimpleObserver<BaseResponse>(rxJavaGcManager) {
@Override
- public void onNext(@NonNull BaseResponse<DevConfigBean> response) {
- if(response!=null&&"000000".equals(response.getErrorCode())){
- if(response.getRecord()!=null){
- EventBus.getDefault().post(new DevConfigEvent(response.getRecord()));
- }
- }else if("00016".equals(response.getErrorCode())||"00068".equals(response.getErrorCode())) {
- EventBus.getDefault().post(new ReLoginEvent());
- }else {
+ public void onNext(@NonNull BaseResponse response) {
- }
}
@Override
public void onError(@NonNull Throwable e) {
- System.out.println(e.getMessage());
+
}
@Override
@@ -191,26 +128,35 @@
if (true) {
return;
}
- RequestBaseObject<FaceUserParam> request = new RequestBaseObject<>();
- FaceUserParam param = new FaceUserParam();
- param.setLastTime(SpUtil.getString("LastTime"));
- param.setType("0");
- request.setParam(param);
+ DevLoginParam param = new DevLoginParam();
+ param.setCode(LMobileInfo.getDeviceUniqueId());
//showLoading(true);
- getRetrofitService(Apis.class).allFaceList(MApplication.getConfigBean().getLanguage(),MApplication.getCookie(),MApplication.getConfigBean().getShopId(),
- MApplication.getConfigBean().getGymId(), ParamsUtil.encodeRequestBody(request))
+ getRetrofitService(Apis.class).allFaceList( ParamsUtil.encodeRequestBody(param))
.compose(RxUtils.schedulersTransformer())
- .subscribe(new SimpleObserver<BaseResponse<FaceUserBean>>(rxJavaGcManager) {
+ .subscribe(new SimpleObserver<BaseResponse<CabinetFaceBean>>(rxJavaGcManager) {
@Override
- public void onNext(@NonNull BaseResponse<FaceUserBean> response) {
- if("000000".equals(response.getErrorCode())){
+ public void onNext(@NonNull BaseResponse<CabinetFaceBean> response) {
+ if(200==response.getCode()){
//鏌ヨ鏁版嵁
- if(response.getRecordList()!=null&&response.getRecordList().size()>0){
- faceLD.setValue(response.getRecordList());
+ if(response.getData()!=null){
+ CabinetFaceBean faceBean = response.getData();
+ List<FaceUserBean> datas = new ArrayList<>();
+ if(faceBean!=null&&faceBean.getAutoFaceList()!=null){
+ for(FaceUserBean bean:faceBean.getAutoFaceList()){
+ bean.setGroupId("1");
+ }
+ datas.addAll(faceBean.getAutoFaceList());
+ }
+ if(faceBean!=null&&faceBean.getDriverFaceList()!=null){
+ for(FaceUserBean bean:faceBean.getDriverFaceList()){
+ bean.setGroupId("0");
+ }
+ datas.addAll(faceBean.getDriverFaceList());
+ }
+ faceLD.setValue(datas);
}
- }else if("00016".equals(response.getErrorCode())||"00068".equals(response.getErrorCode())) {
- EventBus.getDefault().post(new ReLoginEvent());
}else {
+
}
}
@@ -235,16 +181,13 @@
param.setDevCode(LMobileInfo.getDeviceUniqueId());
param.setErrInfo(bean.getValue());
request.setParam(param);
- getRetrofitService(Apis.class).upErrInfo(MApplication.getConfigBean().getLanguage(),MApplication.getCookie(),MApplication.getConfigBean().getShopId(),
- MApplication.getConfigBean().getGymId(), ParamsUtil.encodeRequestBody(request))
+ getRetrofitService(Apis.class).upErrInfo(ParamsUtil.encodeRequestBody(request))
.compose(RxUtils.schedulersTransformer())
.subscribe(new SimpleObserver<BaseResponse>(rxJavaGcManager) {
@Override
public void onNext(@NonNull BaseResponse response) {
- if("000000".equals(response.getErrorCode())){
+ if(200==response.getCode()){
SpUtil.remoreString(bean.getKey());
- }else if("00016".equals(response.getErrorCode())||"00068".equals(response.getErrorCode())) {
- EventBus.getDefault().post(new ReLoginEvent());
}else {
}
}
@@ -279,13 +222,12 @@
param.setDevCode(LMobileInfo.getDeviceUniqueId());
param.setErrInfo(text);
request.setParam(param);
- getRetrofitService(Apis.class).upErrInfo(MApplication.getConfigBean().getLanguage(),MApplication.getCookie(),MApplication.getConfigBean().getShopId(),
- MApplication.getConfigBean().getGymId(), ParamsUtil.encodeRequestBody(request))
+ getRetrofitService(Apis.class).upErrInfo(ParamsUtil.encodeRequestBody(request))
.compose(RxUtils.schedulersTransformer())
.subscribe(new SimpleObserver<BaseResponse>(rxJavaGcManager) {
@Override
public void onNext(@NonNull BaseResponse response) {
- if("000000".equals(response.getErrorCode())){
+ if(200==response.getCode()){
}
}
--
Gitblit v1.9.3