|  |  |  | 
|---|
|  |  |  | import com.doumee.keyCabinet.bean.CabinetFaceBean; | 
|---|
|  |  |  | import com.doumee.keyCabinet.bean.FaceUserBean; | 
|---|
|  |  |  | import com.doumee.keyCabinet.bean.KeyCabinetBean; | 
|---|
|  |  |  | import com.doumee.keyCabinet.event.HttpEvent; | 
|---|
|  |  |  | import com.doumee.keyCabinet.http.Apis; | 
|---|
|  |  |  | import com.doumee.keyCabinet.http.param.AlcoholTestAlarmParam; | 
|---|
|  |  |  | import com.doumee.keyCabinet.http.param.BaseResponse; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.doumee.lib_coremodel.base.BaseModel; | 
|---|
|  |  |  | import com.doumee.lib_coremodel.base.DataViewModel; | 
|---|
|  |  |  | import com.doumee.lib_coremodel.http.rxJava.SimpleObserver; | 
|---|
|  |  |  | import com.doumee.lib_coremodel.http.utils.GsonTools; | 
|---|
|  |  |  | import com.doumee.lib_coremodel.http.utils.RxUtils; | 
|---|
|  |  |  | import com.doumee.lib_coremodel.util.StringUtil; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.greenrobot.eventbus.EventBus; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public class FaceVM extends DataViewModel { | 
|---|
|  |  |  | 
|---|
|  |  |  | * @param type //0:管理员,1:司机 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public void getMemberIdByCode(String code,String type){ | 
|---|
|  |  |  | showLoading(true); | 
|---|
|  |  |  | //showLoading(true); | 
|---|
|  |  |  | getRetrofitService(Apis.class).getMemberIdByCode(code) | 
|---|
|  |  |  | .compose(RxUtils.schedulersTransformer()) | 
|---|
|  |  |  | .subscribe(new SimpleObserver<BaseResponse<Integer>>(rxJavaGcManager) { | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void onNext(@NonNull BaseResponse<Integer> response) { | 
|---|
|  |  |  | EventBus.getDefault().post(new HttpEvent(StringUtil.DateToStrSS(new Date())+ | 
|---|
|  |  |  | "获取IC卡用户主键 - 司机:"+code+", 返回:"+ GsonTools.changeGsonToJson(response))); | 
|---|
|  |  |  | if(200==response.getCode()){ | 
|---|
|  |  |  | //查询数据 | 
|---|
|  |  |  | if(response.getData()!=null){ | 
|---|
|  |  |  | if("0".equals(type)){ | 
|---|
|  |  |  | MApplication.getLoginBean().setAutoMemberId(response.getData()); | 
|---|
|  |  |  | //doAction(); | 
|---|
|  |  |  | doAction(6); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | MApplication.getLoginBean().setMemberId(response.getData()); | 
|---|
|  |  |  | MApplication.getLoginBean().setAuthType(1); | 
|---|
|  |  |  | //doAction(); | 
|---|
|  |  |  | doAction(7); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | toast(response.getMessage()); | 
|---|
|  |  |  | //toast(response.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void onComplete() { | 
|---|
|  |  |  | hideLoading(); | 
|---|
|  |  |  | //hideLoading(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | public void alcoholTestAlarm(String data){ | 
|---|
|  |  |  | AlcoholTestAlarmParam param = new AlcoholTestAlarmParam(); | 
|---|
|  |  |  | param.setMemberId(MApplication.getLoginBean().getMemberId()); | 
|---|
|  |  |  | param.setAlcoholNum(data); | 
|---|
|  |  |  | showLoading(true); | 
|---|
|  |  |  | getRetrofitService(Apis.class).alcoholTestAlarm(ParamsUtil.encodeRequestBody(param)) | 
|---|
|  |  |  | .compose(RxUtils.schedulersTransformer()) | 
|---|