|
|
@@ -10,7 +10,6 @@ import com.grkj.iscs.modbus.ModBusController
|
|
|
import com.grkj.iscs.model.Constants
|
|
|
import com.grkj.iscs.model.DeviceConst.DEVICE_TYPE_CARD
|
|
|
import com.grkj.iscs.model.vo.FileStreamReqParam
|
|
|
-import com.grkj.iscs.model.vo.card.CardInfoRespVO
|
|
|
import com.grkj.iscs.model.vo.user.UserInfoRespVO
|
|
|
import com.grkj.iscs.util.BitmapUtil
|
|
|
import com.grkj.iscs.util.Executor
|
|
|
@@ -23,7 +22,7 @@ import com.grkj.iscs.view.iview.ILoginView
|
|
|
|
|
|
class LoginPresenter : BasePresenter<ILoginView>() {
|
|
|
|
|
|
- fun login(context: Context, account: String, pwd: String, callBack: (Boolean, CardInfoRespVO?, UserInfoRespVO?) -> Unit) {
|
|
|
+ fun login(context: Context, account: String, pwd: String, callBack: (Boolean, UserInfoRespVO?) -> Unit) {
|
|
|
if (account.isEmpty()) {
|
|
|
ToastUtils.tip(context.getString(R.string.please_input_account))
|
|
|
return
|
|
|
@@ -37,50 +36,49 @@ class LoginPresenter : BasePresenter<ILoginView>() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fun cardLogin(card: String, callBack: (Boolean, CardInfoRespVO?, UserInfoRespVO?) -> Unit) {
|
|
|
+ fun cardLogin(card: String, callBack: (Boolean, UserInfoRespVO?) -> Unit) {
|
|
|
BusinessManager.sendLoadingEventMsg(mContext?.getString(R.string.doing_login))
|
|
|
NetApi.cardLogin(card) {
|
|
|
commonProcess(it, callBack)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fun fingerprintLogin(bitmap: Bitmap, callBack: (Boolean, CardInfoRespVO?, UserInfoRespVO?) -> Unit) {
|
|
|
+ fun fingerprintLogin(bitmap: Bitmap, callBack: (Boolean, UserInfoRespVO?) -> Unit) {
|
|
|
BusinessManager.sendLoadingEventMsg(mContext?.getString(R.string.doing_login))
|
|
|
NetApi.loginByFingerprint(mutableListOf(FileStreamReqParam("file", BitmapUtil.bitmapToByteArray(bitmap), ".bmp"))) {
|
|
|
commonProcess(it, callBack)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fun faceLogin(bitmap: Bitmap, callBack: (Boolean, CardInfoRespVO?, UserInfoRespVO?) -> Unit) {
|
|
|
+ fun faceLogin(bitmap: Bitmap, callBack: (Boolean, UserInfoRespVO?) -> Unit) {
|
|
|
BusinessManager.sendLoadingEventMsg(mContext?.getString(R.string.doing_login))
|
|
|
NetApi.loginByFace(mutableListOf(FileStreamReqParam("file", BitmapUtil.bitmapToByteArray(bitmap), ".bmp"))) {
|
|
|
commonProcess(it, callBack)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private fun commonProcess(loginRst: Boolean?, callBack: (Boolean, CardInfoRespVO?, UserInfoRespVO?) -> Unit) {
|
|
|
+ private fun commonProcess(loginRst: Boolean?, callBack: (Boolean, UserInfoRespVO?) -> Unit) {
|
|
|
if (loginRst == true) {
|
|
|
NetApi.getUserInfo { userInfo ->
|
|
|
- NetApi.getCardInfoByLoginUser { itInfo ->
|
|
|
- NetApi.getSystemAttributePage(1, -1) { itSys ->
|
|
|
- BusinessManager.sendLoadingEventMsg(null, false)
|
|
|
- itSys?.let { sys ->
|
|
|
- SPUtils.saveSystemAttribute(mContext!!, sys.records)
|
|
|
- }
|
|
|
- Constants.updateRole(mContext!!)
|
|
|
- itInfo?.let { info ->
|
|
|
- SPUtils.setLoginUser(mContext!!, info)
|
|
|
- }
|
|
|
- Executor.runOnMain {
|
|
|
- callBack.invoke(loginRst, itInfo, userInfo)
|
|
|
- }
|
|
|
+ println("haha1 : $userInfo")
|
|
|
+ userInfo?.let { info ->
|
|
|
+ SPUtils.setLoginUser(mContext!!, info)
|
|
|
+ }
|
|
|
+ NetApi.getSystemAttributePage(1, -1) { itSys ->
|
|
|
+ BusinessManager.sendLoadingEventMsg(null, false)
|
|
|
+ itSys?.let { sys ->
|
|
|
+ SPUtils.saveSystemAttribute(mContext!!, sys.records)
|
|
|
+ }
|
|
|
+ Constants.updateRole(mContext!!)
|
|
|
+ Executor.runOnMain {
|
|
|
+ callBack.invoke(loginRst, userInfo)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
Executor.runOnMain {
|
|
|
BusinessManager.sendLoadingEventMsg(null, false)
|
|
|
- callBack.invoke(false, null, null)
|
|
|
+ callBack.invoke(false, null)
|
|
|
}
|
|
|
}
|
|
|
}
|