|
@@ -1,12 +1,14 @@
|
|
package core.ui.activity
|
|
package core.ui.activity
|
|
|
|
|
|
import android.content.Intent
|
|
import android.content.Intent
|
|
|
|
+import android.os.AsyncTask
|
|
import android.os.Bundle
|
|
import android.os.Bundle
|
|
import android.util.Log
|
|
import android.util.Log
|
|
import androidx.viewbinding.ViewBinding
|
|
import androidx.viewbinding.ViewBinding
|
|
import com.blankj.utilcode.util.LogUtils
|
|
import com.blankj.utilcode.util.LogUtils
|
|
import core.util.ifNullOrEmpty
|
|
import core.util.ifNullOrEmpty
|
|
import http.client.ApiRepository
|
|
import http.client.ApiRepository
|
|
|
|
+import http.client.HttpTool
|
|
import http.exception.NetException
|
|
import http.exception.NetException
|
|
import http.vo.request.CommonSignInReq
|
|
import http.vo.request.CommonSignInReq
|
|
import http.vo.response.SignFaceVo
|
|
import http.vo.response.SignFaceVo
|
|
@@ -14,7 +16,7 @@ import http.vo.response.SignInCheckResp
|
|
import org.greenrobot.eventbus.EventBus
|
|
import org.greenrobot.eventbus.EventBus
|
|
import xn.xxp.app.LabApp
|
|
import xn.xxp.app.LabApp
|
|
import xn.xxp.home.auth.AuthType
|
|
import xn.xxp.home.auth.AuthType
|
|
-import xn.xxp.home.auth.PickSignTypeDialog
|
|
|
|
|
|
+import xn.xxp.home.auth.PickSignCheckDialog
|
|
import xn.xxp.home.auth.ResultEnum
|
|
import xn.xxp.home.auth.ResultEnum
|
|
import xn.xxp.home.auth.SafetyCheckResultDialog
|
|
import xn.xxp.home.auth.SafetyCheckResultDialog
|
|
import xn.xxp.home.auth.SignType
|
|
import xn.xxp.home.auth.SignType
|
|
@@ -42,22 +44,39 @@ abstract class BaseSignActivity<VB : ViewBinding> : BaseCountDownActivity<VB>()
|
|
|
|
|
|
protected fun dispatchSignIn(authType: AuthType) {
|
|
protected fun dispatchSignIn(authType: AuthType) {
|
|
LabApp.userVo ?: return
|
|
LabApp.userVo ?: return
|
|
-
|
|
|
|
|
|
+ LogUtils.json("登录用户", LabApp.userVo)
|
|
|
|
+ // 一类人员:巡查签到
|
|
if ("1" == LabApp.userVo?.pageType) {
|
|
if ("1" == LabApp.userVo?.pageType) {
|
|
- // 一类人员:巡查签到
|
|
|
|
- dispatchPatrolSign(authType)
|
|
|
|
|
|
+ if (LabApp.userVo?.isBigDev == true) {
|
|
|
|
+ PickSignCheckDialog(this, false, true, true) { type ->
|
|
|
|
+ if (SignType.PATROL.code == type) {
|
|
|
|
+ dispatchPatrolSign(authType)
|
|
|
|
+ } else if (SignType.BIG_DEV.code == type) {
|
|
|
|
+ dispatchBigDevSign(authType)
|
|
|
|
+ }
|
|
|
|
+ }.show()
|
|
|
|
+ } else {
|
|
|
|
+ dispatchPatrolSign(authType)
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- if ("1" == LabApp.userVo?.isDutyUser) {
|
|
|
|
- // 值班人员:选择巡查签到/准入签到
|
|
|
|
- PickSignTypeDialog(this) { type ->
|
|
|
|
|
|
+ if (LabApp.userVo?.isDutyUser == "1" || LabApp.userVo?.isBigDev == true) {
|
|
|
|
+ PickSignCheckDialog(
|
|
|
|
+ this,
|
|
|
|
+ LabApp.userVo?.pageType == "2",
|
|
|
|
+ LabApp.userVo?.isDutyUser == "1",
|
|
|
|
+ LabApp.userVo?.isBigDev == true
|
|
|
|
+ ) { type ->
|
|
if (SignType.PATROL.code == type) {
|
|
if (SignType.PATROL.code == type) {
|
|
dispatchPatrolSign(authType)
|
|
dispatchPatrolSign(authType)
|
|
- } else {
|
|
|
|
|
|
+ } else if (SignType.ACCESS.code == type) {
|
|
dispatchAccessSign(authType)
|
|
dispatchAccessSign(authType)
|
|
|
|
+ } else if (SignType.BIG_DEV.code == type) {
|
|
|
|
+ dispatchBigDevSign(authType)
|
|
}
|
|
}
|
|
}.show()
|
|
}.show()
|
|
- } else {
|
|
|
|
- // 其它人员:准入签到
|
|
|
|
|
|
+ }
|
|
|
|
+ // 其它人员:准入签到
|
|
|
|
+ else {
|
|
dispatchAccessSign(authType)
|
|
dispatchAccessSign(authType)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -108,6 +127,36 @@ abstract class BaseSignActivity<VB : ViewBinding> : BaseCountDownActivity<VB>()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 大仪
|
|
|
|
+ */
|
|
|
|
+ private fun dispatchBigDevSign(authType: AuthType) {
|
|
|
|
+ showLoading("签到中...")
|
|
|
|
+ AsyncTask.execute {
|
|
|
|
+ val response = HttpTool.bigDevSignIn(labConfig.labId.toString(), LabApp.userVo.userId)
|
|
|
|
+ runOnUiThread {
|
|
|
|
+ dismissLoading()
|
|
|
|
+ if (response.isSuccessful) {
|
|
|
|
+ EventBus.getDefault().post(OnlineUserEvent())
|
|
|
|
+ SafetyCheckResultDialog(
|
|
|
|
+ this,
|
|
|
|
+ ResultEnum.SUCCESS,
|
|
|
|
+ "签到成功",
|
|
|
|
+ 1500
|
|
|
|
+ ).apply {
|
|
|
|
+ setCancelable(false)
|
|
|
|
+ setOnDismissListener { onSignInFinish(true, authType) }
|
|
|
|
+ show()
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ LogUtils.e(response.message)
|
|
|
|
+ showToast(response.message)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// 准入签到检测
|
|
// 准入签到检测
|
|
private fun accessSignCheck(param: CommonSignInReq, callback: (result: SignFaceVo) -> Unit) {
|
|
private fun accessSignCheck(param: CommonSignInReq, callback: (result: SignFaceVo) -> Unit) {
|
|
showLoading("请稍等...")
|
|
showLoading("请稍等...")
|
|
@@ -162,6 +211,7 @@ abstract class BaseSignActivity<VB : ViewBinding> : BaseCountDownActivity<VB>()
|
|
}
|
|
}
|
|
|
|
|
|
private fun callSignApi(signType: SignType, param: CommonSignInReq, authType: AuthType) {
|
|
private fun callSignApi(signType: SignType, param: CommonSignInReq, authType: AuthType) {
|
|
|
|
+ LogUtils.d(signType, param, authType)
|
|
showLoading("签到中...")
|
|
showLoading("签到中...")
|
|
val disposable = ApiRepository.commonSignIn(signType.code, param)
|
|
val disposable = ApiRepository.commonSignIn(signType.code, param)
|
|
.subscribe({
|
|
.subscribe({
|