Commit 9d08009c authored by yinjiacheng's avatar yinjiacheng

update 认证流程

parent 78608c60
......@@ -23,5 +23,6 @@ class HawkConfig {
const val Mobile = "mobile"
const val Nickname = "nickname"
const val Avatar = "avatar"
const val LifeAccountId = "lifeAccountId"
}
}
\ No newline at end of file
......@@ -20,7 +20,7 @@ class XRouterPathConstants {
const val ID_CARD_TEST = "/idCardTest"
const val LIFE_ACCOUNT_ENTERPRISE_CERTIFICATION = "/lifeAccountEnterpriseCertification"
const val LIFE_ACCOUNT_PERSONAL_AUTH = "/lifeAccountPersonalAuth"
const val LIFE_ACCOUNT_CREATE = "/createLiveAccountActivity"
const val LIFE_ACCOUNT_CREATE = "/lifeAccountCreate"
const val LIFE_ACCOUNT_PERSONAL_AUTH_COMPLETE = "/lifeAccountPersonalAuthComplete"
const val LIFE_ACCOUNT_ENTERPRISE_AUTH_COMPLETE = "/lifeAccountEnterpriseAuthComplete"
const val LIFE_ACCOUNT_ENTERPRISE_AUTH = "/lifeAccountEnterpriseAuth"
......
......@@ -33,7 +33,7 @@ class URLs {
const val sendMsgCode = "/user/user/send_sms_code"
const val mobileLogin = "/user/user/login"
const val accountList = "/merchant/auth/account_list"
const val createLifeAccount = "/merchant/enterprise/create_life"
const val createLifeAccount = "/merchant/enterprise/check_life"
const val authPersonalCheck = "/merchant/auth/personal_check"
const val authLiveIdentity = "/merchant/auth/live_identity"
const val authComplete = "/merchant/auth/complete"
......
......@@ -84,7 +84,7 @@
android:name=".ui.LifeAccountEnterpriseCertificationActivity"
android:theme="@style/Transparent" />
<activity
android:name=".ui.auth.LiveAccountCreateActivity"
android:name=".ui.auth.LifeAccountCreateActivity"
android:theme="@style/Transparent"
android:windowSoftInputMode="stateHidden|adjustResize" />
......
......@@ -6,6 +6,7 @@ import com.yidian.common.XRouterPathConstants.Companion.FLASH
import com.yidian.common.XRouterPathConstants.Companion.GALLERY
import com.yidian.common.XRouterPathConstants.Companion.ID_CARD_TEST
import com.yidian.common.XRouterPathConstants.Companion.LIFE_ACCOUNT_AUTH
import com.yidian.common.XRouterPathConstants.Companion.LIFE_ACCOUNT_CREATE
import com.yidian.common.XRouterPathConstants.Companion.LIFE_ACCOUNT_ENTERPRISE_AUTH
import com.yidian.common.XRouterPathConstants.Companion.LIFE_ACCOUNT_ENTERPRISE_AUTH_COMPLETE
import com.yidian.common.XRouterPathConstants.Companion.LIFE_ACCOUNT_ENTERPRISE_CERTIFICATION
......@@ -191,6 +192,18 @@ class NewsContentApplication : YdBaseApplication() {
}
}),
XPageNode(LIFE_ACCOUNT_CREATE, XPageNodePageType.NATIVE, object : XPageHandler {
override fun handler(params: Map<String, Any?>?) {
val intent = Intent()
if (params != null) {
intent.putExtra(XRouterPathConstants.ParamsKey, params as HashMap)
}
intent.setClass(context, LifeAccountCreateActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
context.startActivity(intent)
}
}),
XPageNode(NEWS_CONTENT, XPageNodePageType.NATIVE, object : XPageHandler {
override fun handler(params: Map<String, Any?>?) {
val intent = Intent()
......
package com.yidian.shenghuoquan.newscontent.bean
class CreateLifeAccountBean {
/**
* life_account_name 是 str 生活号名称
* code 是 str 企业社会统一识别码
* user_id 是 str 用id
*/
data class Request(
var life_account_name: String,
var code: String,
var user_id: String
)
}
\ No newline at end of file
......@@ -8,9 +8,9 @@ package com.yidian.shenghuoquan.newscontent.bean
class LifeAccountMerchantAuthData {
var merchantType: Int = 0
var isBusinessLicenseUpload: Boolean = false
var businessLicenseObjectKey: String = ""
var registrationName: String = ""
var registrationCode: String = ""
var businessLicenseObjectKey: String? = null
var registrationName: String? = null
var registrationCode: String? = null
var authRecordId: Long? = null
var lifeAccountId: Long? = null
var isRecoverAuthProcess: Boolean = false // 是否为恢复认证流程
......
......@@ -18,13 +18,13 @@ class LifeAccountPersonalAuthData {
var isIDCardNationalEmblemFaceUpload: Boolean = false
var idCardPortraitFaceCompleteness: Int = -1
var idCardNationalEmblemFaceCompleteness: Int = -1
var liveDetectBizToken: String = ""
var liveDetectObjectKey: String = ""
var liveDetectBucket: String = ""
var liveDetectBizToken: String? = null
var liveDetectObjectKey: String? = null
var liveDetectBucket: String? = null
var isFaceAuthPass: Boolean = false
// 身份证相关信息
var gender: String = ""
var gender: String? = null
var address: String? = null
var nationality: String? = null
var validDateStart: String? = null
......
......@@ -242,24 +242,6 @@ class ApiService {
})
}
fun createLifeAccount(callback:ICreateLifeAccountCallback, requestParams: HashMap<String, String?>){
val timeStamp = System.currentTimeMillis()
val publicParamsMap = HttpParamsUtils.getPublicParamsMap(timeStamp)
val privateParamsMap = HttpParamsUtils.getPrivateParamsMap(requestParams, timeStamp)
ServiceFactory.getInstance().createService(CommonService::class.java)
.createLifeAccount(publicParamsMap, privateParamsMap)
.compose(TransformUtil.defaultSchedulers())
.subscribe(object :HttpResultSubscriber<Any?>(){
override fun onSuccess(result: HttpResult<Any?>?) {
callback.createLifeAccountCallback(true)
}
override fun onFailer(result: HttpResult<Any?>?) {
callback.createLifeAccountCallback(false)
}
})
}
// 101 身份信息校验接口
fun authPersonalCheck(apiCallback: IAuthPersonalCheckCallback, requestParams: HashMap<String, String?>) {
val timeStamp = System.currentTimeMillis()
......@@ -447,5 +429,24 @@ class ApiService {
}
})
}
// 407 生活号名检查与修改
fun createLifeAccount(callback:ICreateLifeAccountCallback, requestParams: HashMap<String, String?>){
val timeStamp = System.currentTimeMillis()
val publicParamsMap = HttpParamsUtils.getPublicParamsMap(timeStamp)
val privateParamsMap = HttpParamsUtils.getPrivateParamsMap(requestParams, timeStamp)
ServiceFactory.getInstance().createService(CommonService::class.java)
.createLifeAccount(publicParamsMap, privateParamsMap)
.compose(TransformUtil.defaultSchedulers())
.subscribe(object :HttpResultSubscriber<Any?>(){
override fun onSuccess(result: HttpResult<Any?>?) {
callback.createLifeAccountCallback(true)
}
override fun onFailer(result: HttpResult<Any?>?) {
callback.createLifeAccountCallback(false)
}
})
}
}
}
......@@ -2,8 +2,6 @@ package com.yidian.shenghuoquan.newscontent.http
import com.yidian.common.http.HttpResult
import com.yidian.common.http.URLs
import com.yidian.shenghuoquan.newscontent.bean.CreateLifeAccountBean
import com.yidian.shenghuoquan.newscontent.http.httpbean.*
import io.reactivex.rxjava3.core.Observable
import okhttp3.MultipartBody
import retrofit2.Call
......@@ -22,9 +20,6 @@ interface CommonService {
@POST(URLs.authPersonalGetToken)
fun authPersonalGetToken(@QueryMap commonParams: Map<String, String>, @Body requestParams: Map<String, String?>): Observable<HttpResult<Any?>>
// @(URLs.authPersonalGetToken)
// fun authPersonalGetToken(@QueryMap commonParams: Map<String, String>, @QueryMap requestParams: Map<String, String>): Observable<HttpResult<Any?>>
@Headers("Content-Type: application/json")
@POST(URLs.getKSYunToken)
fun getKSYunToken(@QueryMap commonParams: Map<String, String>, @Body requestParams: Map<String, String?>): Call<HttpResult<Any?>>
......
......@@ -18,7 +18,7 @@ class AuthMerchantCheckBean : Serializable{
val audit_status: Int,
val code: String,
val data_type: Int,
val enterprise_auth_record_id: Int,
val enterprise_auth_record_id: Long,
val entterprise_image: String,
val legal_back_id_card: String,
val legal_front_id_card: String,
......
package com.yidian.shenghuoquan.newscontent.http.httpbean
/**
* API /merchant/enterprise/check_life
*/
class LifeAccountCreateBean {
data class Request(
var life_account_id: Long,
var life_account_name: String
)
}
\ No newline at end of file
......@@ -3,6 +3,8 @@ package com.yidian.shenghuoquan.newscontent.ui.auth
import com.yidian.shenghuoquan.newscontent.bean.LifeAccountMerchantAuthData
import com.yidian.shenghuoquan.newscontent.bean.LifeAccountPersonalAuthData
import com.yidian.shenghuoquan.newscontent.constant.Constant
import com.yidian.shenghuoquan.newscontent.http.httpbean.AuthAuthenticationBean
import com.yidian.shenghuoquan.newscontent.http.httpbean.AuthMerchantCheckBean
import com.yidian.shenghuoquan.newscontent.http.httpbean.BusinessLicenseOCRBean
import com.yidian.shenghuoquan.newscontent.http.httpbean.GetIDCardOCRBean
......@@ -52,6 +54,17 @@ object LifeAccountAuthDataManager {
}
}
/**
* 填入个人认证流程回显数据
*/
// TODO: 6/10/21 完善数据
fun generatePersonalAuthData(data: AuthAuthenticationBean.Response) {
personalAuthData.isFaceAuthPass = data.live_identity_status == Constant.ALIVE_DETECT_SUCCESS
personalAuthData.realName = data.full_name
personalAuthData.idCardNum = data.id_card
personalAuthData.occupation = data.occupation
}
/**
* 生成身份信息校验接口请求体
*/
......@@ -96,6 +109,22 @@ object LifeAccountAuthDataManager {
merchantAuthData.date_issue = data.date_issue
}
/**
* 填入企业认证回显数据
*/
// TODO: 6/10/21 完善数据
fun generateMerchantAuthData(data: AuthMerchantCheckBean.Response) {
merchantAuthData.authRecordId = data.enterprise_auth_record_id
merchantAuthData.registrationName = data.name
merchantAuthData.registrationCode = data.code
personalAuthData.realName = data.legal_person
personalAuthData.idCardNum = data.legal_id_card
personalAuthData.phoneNum = data.mobile
merchantAuthData.merchantType = data.data_type
personalAuthData.isFaceAuthPass = data.live_identity_status == Constant.ALIVE_DETECT_SUCCESS
merchantAuthData.isBusinessLicenseUpload = true
}
/**
* 生成营业执照上传接口请求体
*/
......
......@@ -85,7 +85,7 @@ class LifeAccountBusinessLicenseAuthFragment :
private fun initData() {
// 还原认证数据
val authData =
arguments?.getSerializable(LifeAccountIDCardAuthFragment.EXTRA_AUTH_DATA) ?: return
arguments?.getSerializable(EXTRA_AUTH_DATA) ?: return
fillAuthInfo(authData as AuthMerchantCheckBean.Response)
}
......@@ -93,28 +93,15 @@ class LifeAccountBusinessLicenseAuthFragment :
* 认证流程中断,下次进入认证流程时还原进度
*/
private fun fillAuthInfo(data: AuthMerchantCheckBean.Response) {
LifeAccountAuthDataManager.merchantAuthData.registrationName = data.name
LifeAccountAuthDataManager.merchantAuthData.registrationCode = data.code
LifeAccountAuthDataManager.merchantAuthData.isBusinessLicenseUpload = true
// UI
// 营业执照区域
Glide.with(this).load(data.entterprise_image).into(viewBinding.ivBusinessLicense)
viewBinding.ivClear.isVisible = true
viewBinding.clBusinessLicenseUpload.isEnabled = false
// 填入注册名称和注册码
viewBinding.evRegistrationName.fillEditContent(data.name)
viewBinding.evRegistrationCode.fillEditContent(data.code)
// 检查下一步条件
(activity as LifeAccountEnterpriseAuthActivity).checkNextCondition()
lockAuthInfo()
}
/**
* 锁定当前输入状态
*/
private fun lockAuthInfo() {
viewBinding.ivClear.isVisible = false
viewBinding.clBusinessLicenseUpload.isEnabled = false
viewBinding.evRegistrationName.disableModify()
viewBinding.evRegistrationCode.disableModify()
(activity as LifeAccountEnterpriseAuthActivity).disableModifyMerchantType()
}
override fun onClick(v: View?) {
......@@ -276,7 +263,7 @@ class LifeAccountBusinessLicenseAuthFragment :
override fun onTaskSuccess(bucket: String?, objectKey: String?) {
LifeAccountAuthDataManager.merchantAuthData.isBusinessLicenseUpload = true
objectKey?.let { LifeAccountAuthDataManager.merchantAuthData.businessLicenseObjectKey = it }
LifeAccountAuthDataManager.merchantAuthData.businessLicenseObjectKey = objectKey
// 执行营业执照OCR
startBusinessLicenseOCR(objectKey, bucket)
}
......
......@@ -3,7 +3,6 @@ package com.yidian.shenghuoquan.newscontent.ui.auth
import android.annotation.SuppressLint
import android.os.Bundle
import android.text.Editable
import android.util.Log
import androidx.core.view.isVisible
import com.orhanobut.hawk.Hawk
import com.yidian.common.HawkConfig
......@@ -11,34 +10,33 @@ import com.yidian.common.XRouterPathConstants
import com.yidian.common.XRouterPathConstants.Companion.LIFE_ACCOUNT_CREATE
import com.yidian.common.base.BaseActivity
import com.yidian.shenghuoquan.newscontent.R
import com.yidian.shenghuoquan.newscontent.bean.CreateLifeAccountBean
import com.yidian.shenghuoquan.newscontent.bean.ICreateLifeAccountCallback
import com.yidian.shenghuoquan.newscontent.databinding.ActivityCreateAccountBinding
import com.yidian.shenghuoquan.newscontent.databinding.ActivityLifeAccountCreateBinding
import com.yidian.shenghuoquan.newscontent.http.ApiService
import com.yidian.shenghuoquan.newscontent.utils.TextWatcherAdapter
import com.yidian.utils.ToastUtil
import com.yidian.xpage.XPageManager
class LiveAccountCreateActivity : BaseActivity<ActivityCreateAccountBinding>(),
class LifeAccountCreateActivity : BaseActivity<ActivityLifeAccountCreateBinding>(),
ICreateLifeAccountCallback {
companion object {
private const val TAG = "LiveAccountCreate"
const val ENTERPRISE_CODE = "enterprise_code"
const val ACCOUNT_NAME = "account_name"
private const val TAG = "LifeAccountCreate"
const val LIFE_ACCOUNT_ID = "life_account_id"
const val LIFE_ACCOUNT_NAME = "life_account_name"
}
override fun createViewBinding(): ActivityCreateAccountBinding {
return ActivityCreateAccountBinding.inflate(layoutInflater)
override fun createViewBinding(): ActivityLifeAccountCreateBinding {
return ActivityLifeAccountCreateBinding.inflate(layoutInflater)
}
override fun getXPageName(): String {
return LIFE_ACCOUNT_CREATE
}
private val accountMaxLength = 40
private var accountName = ""
private var enterpriseCode = ""
private var userId = ""
private val accountMaxLength = 20
private var lifeAccountId: Long = 0
private var lifeAccountName: String = ""
override fun init(savedInstanceState: Bundle?) {
super.init(savedInstanceState)
initView()
......@@ -49,17 +47,11 @@ class LiveAccountCreateActivity : BaseActivity<ActivityCreateAccountBinding>(),
private fun initData() {
val params = intent.getSerializableExtra(XRouterPathConstants.ParamsKey)
if (params != null && params is HashMap<*, *>) {
try {
accountName = params[ACCOUNT_NAME] as String? ?: ""
enterpriseCode = params[ENTERPRISE_CODE] as String? ?: ""
} catch (e: Exception) {
Log.e(TAG, "LiveAccountCreateActivity: $e" )
}
lifeAccountId = params[LIFE_ACCOUNT_ID] as Long
}
viewBind.etAccount.setText(accountName)
val name = Hawk.get<String>(HawkConfig.Nickname) ?: ""
val phone = Hawk.get<String>(HawkConfig.Mobile) ?: ""
userId = Hawk.get<String>(HawkConfig.UserId) ?: ""
// 设置管理员信息
val name = Hawk.get(HawkConfig.Nickname, "")
val phone = Hawk.get(HawkConfig.Mobile, "")
setUserName(name, phone)
}
......@@ -67,8 +59,6 @@ class LiveAccountCreateActivity : BaseActivity<ActivityCreateAccountBinding>(),
private fun initView() {
viewBind.btnCreateAccount.alpha = 0.32f
viewBind.btnCreateAccount.isEnabled = false
//设置最大的名称限制
viewBind.etAccount.maxHeight = accountMaxLength + 1
}
private fun initListener() {
......@@ -80,27 +70,26 @@ class LiveAccountCreateActivity : BaseActivity<ActivityCreateAccountBinding>(),
}
})
viewBind.btnCreateAccount.setOnClickListener {
createNewAccount()
createLifeAccount()
}
}
private fun createNewAccount() {
//模拟网络请求成功
accountName = viewBind.etAccount.text.toString()
if (accountName.isEmpty()){
ToastUtil.showToast(this,"生活号不能为空")
/**
* 请求接口创建生活号
*/
private fun createLifeAccount() {
lifeAccountName = viewBind.etAccount.text.toString()
if (lifeAccountName.isEmpty()) {
ToastUtil.showToast(this, "生活号名称不能为空")
return
}
if (enterpriseCode.isEmpty() || userId.isEmpty()){
ToastUtil.showToast(this,"生活号信息异常,请退出重试!")
return
}
val requestParams = HashMap<String, String?>()
requestParams["life_account_name"] = accountName
requestParams["code"] = enterpriseCode
requestParams["user_id"] = userId
ApiService.createLifeAccount(this, requestParams)
ApiService.createLifeAccount(
this,
hashMapOf(
Pair(LIFE_ACCOUNT_ID, lifeAccountId.toString()),
Pair(LIFE_ACCOUNT_NAME, lifeAccountName)
)
)
}
......@@ -113,6 +102,7 @@ class LiveAccountCreateActivity : BaseActivity<ActivityCreateAccountBinding>(),
private fun formatNumber(number: String): String {
return number.replace("(\\d{3})\\d{4}(\\d{4})".toRegex(), "$1****$2")
}
@Suppress("DEPRECATION")
private fun checkAccount(s: String) {
if (s.isEmpty()) {
......@@ -140,11 +130,11 @@ class LiveAccountCreateActivity : BaseActivity<ActivityCreateAccountBinding>(),
override fun createLifeAccountCallback(result: Boolean) {
//创建生活号的回调
if (result) {
val params = hashMapOf(Pair(LifeNumberActivity.ACCOUNT_NAME, accountName))
XPageManager.push(XRouterPathConstants.LIFE_NUMBER, params)
XPageManager.push(
XRouterPathConstants.LIFE_NUMBER,
hashMapOf(Pair(LifeNumberActivity.ACCOUNT_NAME, lifeAccountName))
)
} else {
// todo 创建失败,失败逻辑
ToastUtil.showToast(this, "生活号创建失败")
}
}
......
......@@ -4,6 +4,8 @@ import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.fragment.app.Fragment
import com.orhanobut.hawk.Hawk
import com.yidian.common.HawkConfig
import com.yidian.common.XRouterPathConstants
import com.yidian.common.base.BaseActivity
import com.yidian.shenghuoquan.newscontent.R
......@@ -13,9 +15,12 @@ import com.yidian.shenghuoquan.newscontent.constant.Constant
import com.yidian.shenghuoquan.newscontent.databinding.ActivityLifeAccountEnterpriseAuthBinding
import com.yidian.shenghuoquan.newscontent.http.ApiService
import com.yidian.shenghuoquan.newscontent.http.callback.IAuthBusinessLicenseCommitCallback
import com.yidian.shenghuoquan.newscontent.http.callback.IAuthIndividualBusinessCompleteCallback
import com.yidian.shenghuoquan.newscontent.http.callback.IAuthEnterpriseLegalIdentityCommitCallback
import com.yidian.shenghuoquan.newscontent.http.httpbean.*
import com.yidian.shenghuoquan.newscontent.http.callback.IAuthIndividualBusinessCompleteCallback
import com.yidian.shenghuoquan.newscontent.http.httpbean.AuthBusinessLicenseCommitBean
import com.yidian.shenghuoquan.newscontent.http.httpbean.AuthEnterpriseLegalIdentityCommitBean
import com.yidian.shenghuoquan.newscontent.http.httpbean.AuthIndividualBusinessCompleteBean
import com.yidian.shenghuoquan.newscontent.http.httpbean.AuthMerchantCheckBean
import com.yidian.shenghuoquan.newscontent.ui.dialog.BottomSelectDialog
import com.yidian.shenghuoquan.newscontent.widget.LifeAccountAuthProcessView
import com.yidian.xpage.XPageManager
......@@ -85,13 +90,12 @@ class LifeAccountEnterpriseAuthActivity : BaseActivity<ActivityLifeAccountEnterp
super.init(savedInstanceState)
initView()
initListener()
// 默认企业资质Fragment
viewBind.pvAuthProcess.setProcess(LifeAccountAuthProcessView.PROCESS_ENTERPRISE_QUALIFICATION)
initFragment()
initData()
}
private fun initView() {
viewBind.viewCommonHeader.tvTitle.text = resources.getString(R.string.enterprise_auth)
viewBind.pvAuthProcess.setProcess(LifeAccountAuthProcessView.PROCESS_ENTERPRISE_QUALIFICATION)
}
private fun initListener() {
......@@ -107,8 +111,8 @@ class LifeAccountEnterpriseAuthActivity : BaseActivity<ActivityLifeAccountEnterp
if (viewBind.pvAuthProcess.curProcess == LifeAccountAuthProcessView.PROCESS_ENTERPRISE_QUALIFICATION
&& LifeAccountAuthDataManager.merchantAuthData.merchantType != 0
&& LifeAccountAuthDataManager.merchantAuthData.isBusinessLicenseUpload
&& LifeAccountAuthDataManager.merchantAuthData.registrationName.isNotEmpty()
&& LifeAccountAuthDataManager.merchantAuthData.registrationCode.isNotEmpty()
&& !LifeAccountAuthDataManager.merchantAuthData.registrationName.isNullOrEmpty()
&& !LifeAccountAuthDataManager.merchantAuthData.registrationCode.isNullOrEmpty()
) {
viewBind.btnNext.alpha = 1f
viewBind.btnNext.isEnabled = true
......@@ -141,30 +145,22 @@ class LifeAccountEnterpriseAuthActivity : BaseActivity<ActivityLifeAccountEnterp
viewBind.svMerchantType.enableSelect(false)
}
private fun initFragment() {
if (authData == null) {
switchFragment(fragmentList[0])
} else {
// 如果有已存在的认证流程则还原进度
private fun initData() {
// 如果有已存在的认证流程则还原进度
authData?.let { LifeAccountAuthDataManager.generateMerchantAuthData(it) }
authData?.data_type?.let {
viewBind.svMerchantType.setContentResult(
if (authData?.data_type == Constant.TYPE_INDIVIDUAL_BUSINESS) {
if (it == Constant.TYPE_INDIVIDUAL_BUSINESS) {
Constant.ITEM_INDIVIDUAL_BUSINESSES
} else {
Constant.ITEM_COMMON_ENTERPRISE
}
)
LifeAccountAuthDataManager.merchantAuthData.merchantType =
if (authData?.data_type == Constant.TYPE_AUTH_INDIVIDUAL_BUSINESS) {
Constant.TYPE_INDIVIDUAL_BUSINESS
} else {
Constant.TYPE_COMMON_ENTERPRISE
}
val bundle = Bundle()
bundle.putSerializable(LifeAccountBusinessLicenseAuthFragment.EXTRA_AUTH_DATA, authData)
fragmentList[0].arguments = bundle
switchFragment(fragmentList[0])
LifeAccountAuthDataManager.merchantAuthData.isRecoverAuthProcess = true
}
val bundle = Bundle()
bundle.putSerializable(LifeAccountBusinessLicenseAuthFragment.EXTRA_AUTH_DATA, authData)
fragmentList[0].arguments = bundle
switchFragment(fragmentList[0])
}
/**
......@@ -227,22 +223,6 @@ class LifeAccountEnterpriseAuthActivity : BaseActivity<ActivityLifeAccountEnterp
if (viewBind.pvAuthProcess.curProcess == LifeAccountAuthProcessView.PROCESS_ENTERPRISE_QUALIFICATION) {
// personalLifeAccountId不为null则是由个人生活号升级为企业生活号情况
// personalLifeAccountId为null则是直接进行企业认证情况
if (LifeAccountAuthDataManager.merchantAuthData.isRecoverAuthProcess) {
viewBind.pvAuthProcess.setProcess(++viewBind.pvAuthProcess.curProcess)
// 向身份信息fragment传参
val fragment = fragmentList[viewBind.pvAuthProcess.curProcess]
val bundle = Bundle()
bundle.putInt(
Constant.TYPE_AUTH,
LifeAccountAuthDataManager.merchantAuthData.merchantType
)
bundle.putSerializable(
LifeAccountIDCardAuthFragment.EXTRA_AUTH_DATA,
authData
)
fragment.arguments = bundle
switchFragment(fragment)
}
ApiService.authBusinessLicenseCommit(
this,
LifeAccountAuthDataManager.generateAuthBusinessLicenseCommitRequest(
......@@ -309,8 +289,34 @@ class LifeAccountEnterpriseAuthActivity : BaseActivity<ActivityLifeAccountEnterp
}
override fun authEnterpriseLegalIdentityCommitSuccess(result: AuthEnterpriseLegalIdentityCommitBean.Response?) {
// 本地保存生活号id
Hawk.put(HawkConfig.LifeAccountId, result?.life_account_id)
// 普通企业法人身份信息提交成功
// TODO: 6/6/21 跳转提交成功页面
XPageManager.push(
XRouterPathConstants.LIFE_ACCOUNT_ENTERPRISE_AUTH_COMPLETE,
hashMapOf(
Pair(
LifeAccountEnterpriseAuthCompleteActivity.REGISTRATION_NAME,
LifeAccountAuthDataManager.merchantAuthData.registrationName
),
Pair(
LifeAccountEnterpriseAuthCompleteActivity.REGISTRATION_CODE,
LifeAccountAuthDataManager.merchantAuthData.registrationCode
),
Pair(
LifeAccountEnterpriseAuthCompleteActivity.ID_CARD_NAME,
LifeAccountAuthDataManager.personalAuthData.realName
),
Pair(
LifeAccountEnterpriseAuthCompleteActivity.ID_CARD_NUM,
LifeAccountAuthDataManager.personalAuthData.idCardNum
),
Pair(
LifeAccountEnterpriseAuthCompleteActivity.LIFE_ACCOUNT_ID,
result?.life_account_id
)
)
)
}
override fun authEnterpriseLegalIdentityCommitFailure(message: String?) {
......@@ -321,8 +327,34 @@ class LifeAccountEnterpriseAuthActivity : BaseActivity<ActivityLifeAccountEnterp
}
override fun authIndividualBusinessCompleteSuccess(result: AuthIndividualBusinessCompleteBean.Response?) {
// 本地保存生活号id
Hawk.put(HawkConfig.LifeAccountId, result?.life_account_id)
// 个体工商户认证完成
// TODO: 6/6/21 跳转提交成功页面
XPageManager.push(
XRouterPathConstants.LIFE_ACCOUNT_ENTERPRISE_AUTH_COMPLETE,
hashMapOf(
Pair(
LifeAccountEnterpriseAuthCompleteActivity.REGISTRATION_NAME,
LifeAccountAuthDataManager.merchantAuthData.registrationName
),
Pair(
LifeAccountEnterpriseAuthCompleteActivity.REGISTRATION_CODE,
LifeAccountAuthDataManager.merchantAuthData.registrationCode
),
Pair(
LifeAccountEnterpriseAuthCompleteActivity.ID_CARD_NAME,
LifeAccountAuthDataManager.personalAuthData.realName
),
Pair(
LifeAccountEnterpriseAuthCompleteActivity.ID_CARD_NUM,
LifeAccountAuthDataManager.personalAuthData.idCardNum
),
Pair(
LifeAccountEnterpriseAuthCompleteActivity.LIFE_ACCOUNT_ID,
result?.life_account_id
)
)
)
}
override fun authIndividualBusinessCompleteFailure(message: String?) {
......
......@@ -22,6 +22,7 @@ class LifeAccountEnterpriseAuthCompleteActivity :
const val REGISTRATION_CODE = "registrationCode"
const val ID_CARD_NAME = "idCardName"
const val ID_CARD_NUM = "idCardNum"
const val LIFE_ACCOUNT_ID = "lifeAccountId"
}
/**
......@@ -55,8 +56,8 @@ class LifeAccountEnterpriseAuthCompleteActivity :
XRouterPathConstants.LIFE_ACCOUNT_CREATE,
hashMapOf(
Pair(
LiveAccountCreateActivity.ENTERPRISE_CODE,
params[REGISTRATION_CODE]
LifeAccountCreateActivity.LIFE_ACCOUNT_ID,
params[LIFE_ACCOUNT_ID]
)
)
)
......
......@@ -36,6 +36,17 @@ class LifeAccountPersonalAuthActivity :
*/
private val fragment by lazy { LifeAccountIDCardAuthFragment() }
/**
* 认证数据 还原认证流程用
*/
private val authData by lazy {
intent.getSerializableExtra(XRouterPathConstants.ParamsKey)?.let {
(it as HashMap<*, *>)[EXTRA_AUTH_DATA]?.let { data ->
data as AuthAuthenticationBean.Response
}
}
}
override fun createViewBinding(): ActivityLifeAccountPersonalAuthBinding {
return ActivityLifeAccountPersonalAuthBinding.inflate(layoutInflater)
}
......@@ -48,7 +59,7 @@ class LifeAccountPersonalAuthActivity :
super.init(savedInstanceState)
initView()
initListener()
initFragment()
initData()
}
private fun initView() {
......@@ -62,22 +73,15 @@ class LifeAccountPersonalAuthActivity :
viewBind.btnNext.setOnClickListener(this)
}
private fun initFragment() {
val authData = intent.getSerializableExtra(XRouterPathConstants.ParamsKey)?.let {
(it as HashMap<*, *>)[EXTRA_AUTH_DATA]?.let { data ->
data as AuthAuthenticationBean.Response
}
}
private fun initData() {
// 如果有已存在的认证流程则还原进度
authData?.let { LifeAccountAuthDataManager.generatePersonalAuthData(it) }
authData?.occupation?.let { viewBind.svOccupation.setContentResult(it) }
val bundle = Bundle()
bundle.putSerializable(LifeAccountIDCardAuthFragment.EXTRA_AUTH_DATA, authData)
fragment.arguments = bundle
supportFragmentManager.beginTransaction()
.add(R.id.fragment_container, fragment).commit()
authData?.occupation?.let {
viewBind.svOccupation.setContentResult(it)
LifeAccountAuthDataManager.personalAuthData.occupation = it
}
}
/**
......
......@@ -68,7 +68,7 @@ class LifeAccountAuthImageView @JvmOverloads constructor(
* 填充图片
* @param url 图片url
*/
fun addImage(context: Context, url: String) {
fun addImage(url: String) {
Glide.with(context).load(url).into(viewBinding.ivContent)
isEnabled = false
viewBinding.ivClear.isVisible = true
......
......@@ -20,14 +20,15 @@
android:id="@+id/iv_back"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:paddingTop="5dp"
android:paddingEnd="10dp"
android:paddingBottom="5dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="20dp"
android:scaleType="centerCrop"
android:src="@drawable/big_back"
android:visibility="gone"
tools:ignore="ContentDescription" />
<TextView
......@@ -50,33 +51,37 @@
android:textColor="@color/gray_333"
android:textSize="16sp"
tools:ignore="RtlSymmetry" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/et_account"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginEnd="20dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:background="@null"
android:textSize="16sp"
android:textCursorDrawable="@drawable/comment_dialog_cursor"
android:textColorHint="@color/account_hint"
android:textColor="@color/gray_333"
android:gravity="center_vertical"
android:hint="@string/account_create_tips" />
android:hint="@string/account_create_tips"
android:maxLength="21"
android:textColor="@color/gray_333"
android:textColorHint="@color/account_hint"
android:textCursorDrawable="@drawable/comment_dialog_cursor"
android:textSize="16sp" />
<View
android:id="@+id/v_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginEnd="20dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:background="@color/divider_white" />
<TextView
android:id="@+id/tv_error_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:paddingBottom="6dp"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:text="@string/account_error_tips"
android:textColor="@color/red_account_tips"
android:textSize="12sp"
......@@ -100,39 +105,41 @@
android:layout_height="60dp"
android:gravity="center_vertical"
android:paddingStart="20dp"
tools:text="蓝小花15800000001"
android:textColor="@color/gray_333"
android:textSize="16sp"
android:textStyle="bold"
tools:ignore="RtlSymmetry" />
tools:ignore="RtlSymmetry"
tools:text="蓝小花15800000001" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginEnd="20dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:background="@color/divider_white" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:paddingEnd="20dp"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:text="@string/account_create_desc"
android:textColor="@color/content_other_text"
android:textSize="12sp"
tools:ignore="RtlSymmetry" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btn_create_account"
android:layout_width="315dp"
android:layout_height="44dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="34dp"
android:textSize="18sp"
android:gravity="center"
android:alpha="0.32"
android:textColor="@color/white"
android:text="@string/create_account"
android:layout_gravity="center_horizontal|bottom"
android:background="@drawable/account_btn_gradient_bg"
android:layout_width="315dp"
android:layout_height="44dp"/>
android:gravity="center"
android:text="@string/create_account"
android:textColor="@color/white"
android:textSize="18sp" />
</FrameLayout>
\ No newline at end of file
......@@ -51,7 +51,7 @@
<string name="create_account">确认创建</string>
<string name="account_create_tips">同企业下生活号名称不可复用</string>
<string name="account_create_desc">生活号作为企业服务管理载体,请正确使用生活号权益,新申请生活号默认当前申请人作为默认管理员,申请成功 后可在销售APP内进行更改</string>
<string name="account_error_tips">名称超限,最多40个字符</string>
<string name="account_error_tips">名称超限,最多20个字符</string>
<string name="account_manager">管理员</string>
<string name="account_name">生活号名称</string>
<string name="account_title">创建生活号</string>
......
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