Commit e9571a6b authored by shiyl's avatar shiyl

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

parent 21e3394a
......@@ -15,6 +15,7 @@ import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import androidx.lifecycle.lifecycleScope
import com.tbruyelle.rxpermissions3.RxPermissions
import com.umeng.umcrash.UMCrash
import com.yidian.bcommon.base.BaseFragment
import com.yidian.bcommon.utils.ImageCompressUtils
import com.yidian.framework.mobile.insight.config.IdentityCardType
......@@ -256,12 +257,17 @@ class LifeAccountIDCardAuthFragmentV2 : BaseFragment<FragmentLifeAccountIdCardAu
RxPermissions(this).request(Manifest.permission.CAMERA).subscribe {
if (it) {
// 调用XInsight进行身份证采集
XInsight.startIdentityCardOcr(
this,
ScreenOrientation.VERTICAL,
if (curFace == Constant.ID_CARD_PORTRAIT_FACE) IdentityCardType.PORTRAIT else IdentityCardType.NATIONAL_EMBLEM,
Constant.REQUEST_CODE_ID_CARD_CAPTURE
)
try {
XInsight.startIdentityCardOcr(
this,
ScreenOrientation.VERTICAL,
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 {
ToastUtil.showToast(activity, "请在设置里同意相关权限")
}
......@@ -369,59 +375,64 @@ class LifeAccountIDCardAuthFragmentV2 : BaseFragment<FragmentLifeAccountIdCardAu
File(cachePath + Constant.FILE_PATH_ID_CARD_NATIONAL_EMBLEM_FACE)
}
}
XInsight.identityCardVerify(
if (face == Constant.ID_CARD_PORTRAIT_FACE) IdentityCardType.PORTRAIT else IdentityCardType.NATIONAL_EMBLEM,
uploadFile,
object : IdentityCardVerifyCallBack {
override fun onSucceed(identityCardResult: IdentityCardResult?, result: String?) {
activity?.runOnUiThread {
if (face == Constant.ID_CARD_PORTRAIT_FACE) {
identityCardResult?.let { LifeAccountAuthDataManagerV2.generateIDCardPortraitFaceData(it) }
// 回显OCR结果
viewBinding.evRealName.fillEditContent(identityCardResult?.posit?.name)
viewBinding.evIdCardNumber.fillEditContent(identityCardResult?.posit?.idcard_number)
// 此时身份证人像面已上传并OCR识别完成 删除本地临时存储文件
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() }
} 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() }
try {
XInsight.identityCardVerify(
if (face == Constant.ID_CARD_PORTRAIT_FACE) IdentityCardType.PORTRAIT else IdentityCardType.NATIONAL_EMBLEM,
uploadFile,
object : IdentityCardVerifyCallBack {
override fun onSucceed(identityCardResult: IdentityCardResult?, result: String?) {
activity?.runOnUiThread {
if (face == Constant.ID_CARD_PORTRAIT_FACE) {
identityCardResult?.let { LifeAccountAuthDataManagerV2.generateIDCardPortraitFaceData(it) }
// 回显OCR结果
viewBinding.evRealName.fillEditContent(identityCardResult?.posit?.name)
viewBinding.evIdCardNumber.fillEditContent(identityCardResult?.posit?.idcard_number)
// 此时身份证人像面已上传并OCR识别完成 删除本地临时存储文件
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() }
} else {
activity?.let { (it as LifeAccountEnterpriseAuthActivity).checkNextCondition() }
}
} 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?) {
if (face == Constant.ID_CARD_PORTRAIT_FACE) {
LifeAccountAuthDataManagerV2.personalAuthData.isIDCardPortraitFaceUpload =
true
LifeAccountAuthDataManagerV2.personalAuthData.idCardPortraitFaceUrl = positImageUrl
} else {
LifeAccountAuthDataManagerV2.personalAuthData.isIDCardNationalEmblemFaceUpload =
true
LifeAccountAuthDataManagerV2.personalAuthData.idCardNationalEmblemFaceUrl = backImageUrl
override fun onUploadTask(positImageUrl: String?, backImageUrl: String?) {
if (face == Constant.ID_CARD_PORTRAIT_FACE) {
LifeAccountAuthDataManagerV2.personalAuthData.isIDCardPortraitFaceUpload =
true
LifeAccountAuthDataManagerV2.personalAuthData.idCardPortraitFaceUrl = positImageUrl
} else {
LifeAccountAuthDataManagerV2.personalAuthData.isIDCardNationalEmblemFaceUpload =
true
LifeAccountAuthDataManagerV2.personalAuthData.idCardNationalEmblemFaceUrl = backImageUrl
}
}
}
})
})
} catch (e: Exception) {
e.printStackTrace()
UMCrash.generateCustomLog(e,"AuthenticationException")
}
}
}
......
......@@ -35,7 +35,7 @@ allprojects {
ext {
group_id = 'com.yidian.yacmodule.shenghuoquan'
artifact_id = ''
version_name = '0.0.30-SNAPSHOT'
version_name = '0.0.31-SNAPSHOT'
}
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