Commit e9571a6b authored by shiyl's avatar shiyl

对认证相关的拍照对身份证识别的逻辑进行异常捕获并上报

parent 21e3394a
...@@ -15,6 +15,7 @@ import androidx.core.content.ContextCompat ...@@ -15,6 +15,7 @@ import androidx.core.content.ContextCompat
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.tbruyelle.rxpermissions3.RxPermissions import com.tbruyelle.rxpermissions3.RxPermissions
import com.umeng.umcrash.UMCrash
import com.yidian.bcommon.base.BaseFragment import com.yidian.bcommon.base.BaseFragment
import com.yidian.bcommon.utils.ImageCompressUtils import com.yidian.bcommon.utils.ImageCompressUtils
import com.yidian.framework.mobile.insight.config.IdentityCardType import com.yidian.framework.mobile.insight.config.IdentityCardType
...@@ -256,12 +257,17 @@ class LifeAccountIDCardAuthFragmentV2 : BaseFragment<FragmentLifeAccountIdCardAu ...@@ -256,12 +257,17 @@ class LifeAccountIDCardAuthFragmentV2 : BaseFragment<FragmentLifeAccountIdCardAu
RxPermissions(this).request(Manifest.permission.CAMERA).subscribe { RxPermissions(this).request(Manifest.permission.CAMERA).subscribe {
if (it) { if (it) {
// 调用XInsight进行身份证采集 // 调用XInsight进行身份证采集
XInsight.startIdentityCardOcr( try {
this, XInsight.startIdentityCardOcr(
ScreenOrientation.VERTICAL, this,
if (curFace == Constant.ID_CARD_PORTRAIT_FACE) IdentityCardType.PORTRAIT else IdentityCardType.NATIONAL_EMBLEM, ScreenOrientation.VERTICAL,
Constant.REQUEST_CODE_ID_CARD_CAPTURE if (curFace == Constant.ID_CARD_PORTRAIT_FACE) IdentityCardType.PORTRAIT else IdentityCardType.NATIONAL_EMBLEM,
) Constant.REQUEST_CODE_ID_CARD_CAPTURE
)
} catch (e: Exception) {
e.printStackTrace()
UMCrash.generateCustomLog(e,"AuthenticationException")
}
} else { } else {
ToastUtil.showToast(activity, "请在设置里同意相关权限") ToastUtil.showToast(activity, "请在设置里同意相关权限")
} }
...@@ -369,59 +375,64 @@ class LifeAccountIDCardAuthFragmentV2 : BaseFragment<FragmentLifeAccountIdCardAu ...@@ -369,59 +375,64 @@ class LifeAccountIDCardAuthFragmentV2 : BaseFragment<FragmentLifeAccountIdCardAu
File(cachePath + Constant.FILE_PATH_ID_CARD_NATIONAL_EMBLEM_FACE) File(cachePath + Constant.FILE_PATH_ID_CARD_NATIONAL_EMBLEM_FACE)
} }
} }
XInsight.identityCardVerify( try {
if (face == Constant.ID_CARD_PORTRAIT_FACE) IdentityCardType.PORTRAIT else IdentityCardType.NATIONAL_EMBLEM, XInsight.identityCardVerify(
uploadFile, if (face == Constant.ID_CARD_PORTRAIT_FACE) IdentityCardType.PORTRAIT else IdentityCardType.NATIONAL_EMBLEM,
object : IdentityCardVerifyCallBack { uploadFile,
override fun onSucceed(identityCardResult: IdentityCardResult?, result: String?) { object : IdentityCardVerifyCallBack {
activity?.runOnUiThread { override fun onSucceed(identityCardResult: IdentityCardResult?, result: String?) {
if (face == Constant.ID_CARD_PORTRAIT_FACE) { activity?.runOnUiThread {
identityCardResult?.let { LifeAccountAuthDataManagerV2.generateIDCardPortraitFaceData(it) } if (face == Constant.ID_CARD_PORTRAIT_FACE) {
// 回显OCR结果 identityCardResult?.let { LifeAccountAuthDataManagerV2.generateIDCardPortraitFaceData(it) }
viewBinding.evRealName.fillEditContent(identityCardResult?.posit?.name) // 回显OCR结果
viewBinding.evIdCardNumber.fillEditContent(identityCardResult?.posit?.idcard_number) viewBinding.evRealName.fillEditContent(identityCardResult?.posit?.name)
// 此时身份证人像面已上传并OCR识别完成 删除本地临时存储文件 viewBinding.evIdCardNumber.fillEditContent(identityCardResult?.posit?.idcard_number)
File(cachePath + Constant.FILE_PATH_ID_CARD_PORTRAIT_FACE).apply { // 此时身份证人像面已上传并OCR识别完成 删除本地临时存储文件
if (exists()) delete() File(cachePath + Constant.FILE_PATH_ID_CARD_PORTRAIT_FACE).apply {
} if (exists()) delete()
// 检查下一步条件 }
if (authType == Constant.TYPE_AUTH_PERSONAL) { // 检查下一步条件
activity?.let { (it as LifeAccountPersonalAuthActivity).checkNextCondition() } if (authType == Constant.TYPE_AUTH_PERSONAL) {
} else { activity?.let { (it as LifeAccountPersonalAuthActivity).checkNextCondition() }
activity?.let { (it as LifeAccountEnterpriseAuthActivity).checkNextCondition() } } else {
} activity?.let { (it as LifeAccountEnterpriseAuthActivity).checkNextCondition() }
} else { }
identityCardResult?.let { LifeAccountAuthDataManagerV2.generateIDCardNationEmblemFaceData(it) }
// 此时身份证国徽面已上传并OCR识别完成 删除本地临时存储文件
File(cachePath + Constant.FILE_PATH_ID_CARD_NATIONAL_EMBLEM_FACE).apply {
if (exists()) delete()
}
// 检查下一步条件
if (authType == Constant.TYPE_AUTH_PERSONAL) {
activity?.let { (it as LifeAccountPersonalAuthActivity).checkNextCondition() }
} else { } else {
activity?.let { (it as LifeAccountEnterpriseAuthActivity).checkNextCondition() } identityCardResult?.let { LifeAccountAuthDataManagerV2.generateIDCardNationEmblemFaceData(it) }
// 此时身份证国徽面已上传并OCR识别完成 删除本地临时存储文件
File(cachePath + Constant.FILE_PATH_ID_CARD_NATIONAL_EMBLEM_FACE).apply {
if (exists()) delete()
}
// 检查下一步条件
if (authType == Constant.TYPE_AUTH_PERSONAL) {
activity?.let { (it as LifeAccountPersonalAuthActivity).checkNextCondition() }
} else {
activity?.let { (it as LifeAccountEnterpriseAuthActivity).checkNextCondition() }
}
} }
} }
} }
}
override fun onFail(code: Int, errMsg: String?, errDomain: String?) { override fun onFail(code: Int, errMsg: String?, errDomain: String?) {
} }
override fun onUploadTask(positImageUrl: String?, backImageUrl: String?) { override fun onUploadTask(positImageUrl: String?, backImageUrl: String?) {
if (face == Constant.ID_CARD_PORTRAIT_FACE) { if (face == Constant.ID_CARD_PORTRAIT_FACE) {
LifeAccountAuthDataManagerV2.personalAuthData.isIDCardPortraitFaceUpload = LifeAccountAuthDataManagerV2.personalAuthData.isIDCardPortraitFaceUpload =
true true
LifeAccountAuthDataManagerV2.personalAuthData.idCardPortraitFaceUrl = positImageUrl LifeAccountAuthDataManagerV2.personalAuthData.idCardPortraitFaceUrl = positImageUrl
} else { } else {
LifeAccountAuthDataManagerV2.personalAuthData.isIDCardNationalEmblemFaceUpload = LifeAccountAuthDataManagerV2.personalAuthData.isIDCardNationalEmblemFaceUpload =
true true
LifeAccountAuthDataManagerV2.personalAuthData.idCardNationalEmblemFaceUrl = backImageUrl LifeAccountAuthDataManagerV2.personalAuthData.idCardNationalEmblemFaceUrl = backImageUrl
}
} }
} })
}) } catch (e: Exception) {
e.printStackTrace()
UMCrash.generateCustomLog(e,"AuthenticationException")
}
} }
} }
......
...@@ -35,7 +35,7 @@ allprojects { ...@@ -35,7 +35,7 @@ allprojects {
ext { ext {
group_id = 'com.yidian.yacmodule.shenghuoquan' group_id = 'com.yidian.yacmodule.shenghuoquan'
artifact_id = '' artifact_id = ''
version_name = '0.0.30-SNAPSHOT' version_name = '0.0.31-SNAPSHOT'
} }
task clean(type: Delete) { task clean(type: Delete) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment