This commit is contained in:
liangzai 2025-03-16 00:56:17 +08:00
parent 2adef191cb
commit 66124a1cb4

View File

@ -39,28 +39,31 @@ func (l *QueryServiceLogic) QueryService(req *types.QueryServiceReq) (resp *type
}
var productProcessors = map[string]func(*QueryServiceLogic, *types.QueryServiceReq) (*types.QueryServiceResp, error){
"marriage": (*QueryServiceLogic).ProcessMarriageLogic,
"homeservice": (*QueryServiceLogic).ProcessHomeServiceLogic,
"riskassessment": (*QueryServiceLogic).ProcessRiskAssessmentLogic,
"companyinfo": (*QueryServiceLogic).ProcessCompanyInfoLogic,
"rentalinfo": (*QueryServiceLogic).ProcessRentalInfoLogic,
"preloanbackgroundcheck": (*QueryServiceLogic).ProcessPreLoanBackgroundCheckLogic,
"backgroundcheck": (*QueryServiceLogic).ProcessBackgroundCheckLogic,
"toc_Marriage": (*QueryServiceLogic).ProcessTocMarriageLogic,
"toc_PersonalBadRecord": (*QueryServiceLogic).ProcessTocPersonalBadRecordLogic,
"toc_ShareholderBusinessRelation": (*QueryServiceLogic).ProcessTocShareholderBusinessRelationLogic,
"toc_PersonalLawsuit": (*QueryServiceLogic).ProcessTocPersonalLawsuitLogic,
"toc_EnterpriseLawsuit": (*QueryServiceLogic).ProcessTocEnterpriseLawsuitLogic,
"toc_PhoneThreeElements": (*QueryServiceLogic).ProcessTocPhoneThreeElementsLogic,
"toc_PhoneTwoElements": (*QueryServiceLogic).ProcessTocPhoneTwoElementsLogic,
"toc_IDCardTwoElements": (*QueryServiceLogic).ProcessTocIDCardTwoElementsLogic,
"toc_NaturalLifeStatus": (*QueryServiceLogic).ProcessTocNaturalLifeStatusLogic,
"toc_PersonVehicleVerification": (*QueryServiceLogic).ProcessTocPersonVehicleVerificationLogic,
"toc_DualMarriage": (*QueryServiceLogic).ProcessTocDualMarriageLogic,
"toc_PhoneNumberRisk": (*QueryServiceLogic).ProcessTocPhoneNumberRiskLogic,
"toc_NetworkDuration": (*QueryServiceLogic).ProcessTocNetworkDurationLogic,
"toc_PhoneSecondaryCard": (*QueryServiceLogic).ProcessTocPhoneSecondaryCardLogic,
"toc_BankCardFourElements": (*QueryServiceLogic).ProcessTocBankCardFourElementsLogic,
"marriage": (*QueryServiceLogic).ProcessMarriageLogic,
"homeservice": (*QueryServiceLogic).ProcessHomeServiceLogic,
"riskassessment": (*QueryServiceLogic).ProcessRiskAssessmentLogic,
"companyinfo": (*QueryServiceLogic).ProcessCompanyInfoLogic,
"rentalinfo": (*QueryServiceLogic).ProcessRentalInfoLogic,
"preloanbackgroundcheck": (*QueryServiceLogic).ProcessPreLoanBackgroundCheckLogic,
"backgroundcheck": (*QueryServiceLogic).ProcessBackgroundCheckLogic,
"toc_Marriage": (*QueryServiceLogic).ProcessTocMarriageLogic,
"toc_PersonalBadRecord": (*QueryServiceLogic).ProcessTocPersonalBadRecordLogic,
"toc_ShareholderBusinessRelation": (*QueryServiceLogic).ProcessTocShareholderBusinessRelationLogic,
"toc_PersonalLawsuit": (*QueryServiceLogic).ProcessTocPersonalLawsuitLogic,
"toc_EnterpriseLawsuit": (*QueryServiceLogic).ProcessTocEnterpriseLawsuitLogic,
"toc_PhoneThreeElements": (*QueryServiceLogic).ProcessTocPhoneThreeElementsLogic,
"toc_PhoneTwoElements": (*QueryServiceLogic).ProcessTocPhoneTwoElementsLogic,
"toc_IDCardTwoElements": (*QueryServiceLogic).ProcessTocIDCardTwoElementsLogic,
"toc_NaturalLifeStatus": (*QueryServiceLogic).ProcessTocNaturalLifeStatusLogic,
"toc_PersonVehicleVerification": (*QueryServiceLogic).ProcessTocPersonVehicleVerificationLogic,
"toc_DualMarriage": (*QueryServiceLogic).ProcessTocDualMarriageLogic,
"toc_PhoneNumberRisk": (*QueryServiceLogic).ProcessTocPhoneNumberRiskLogic,
"toc_NetworkDuration": (*QueryServiceLogic).ProcessTocNetworkDurationLogic,
"toc_PhoneSecondaryCard": (*QueryServiceLogic).ProcessTocPhoneSecondaryCardLogic,
"toc_BankCardFourElements": (*QueryServiceLogic).ProcessTocBankCardFourElementsLogic,
"toc_PersonalConsumptionRestriction": (*QueryServiceLogic).ProcessTocPersonalConsumptionRestrictionLogic,
"toc_PersonalDiscredit": (*QueryServiceLogic).ProcessTocPersonalDiscreditLogic,
// 车辆部分
"toc_BankCardBlacklist": (*QueryServiceLogic).ProcessTocBankCardBlacklistLogic,
"toc_VehiclesUnderName": (*QueryServiceLogic).ProcessTocVehiclesUnderNameLogic,
@ -1243,6 +1246,76 @@ func (l *QueryServiceLogic) ProcessTocBankCardFourElementsLogic(req *types.Query
return &types.QueryServiceResp{Id: cacheNo}, nil
}
// ProcessTocPersonalConsumptionRestrictionLogic 个人限高
func (l *QueryServiceLogic) ProcessTocPersonalConsumptionRestrictionLogic(req *types.QueryServiceReq) (*types.QueryServiceResp, error) {
userID, getUidErr := ctxdata.GetUidFromCtx(l.ctx)
if getUidErr != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "查询服务, 获取用户信息失败, %+v", getUidErr)
}
// AES解密
decryptData, DecryptDataErr := l.DecryptData(req.Data)
if DecryptDataErr != nil {
return nil, DecryptDataErr
}
// 校验参数
var data types.TocIDCardTwoElements
if unmarshalErr := json.Unmarshal(decryptData, &data); unmarshalErr != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "查询服务, 解密后的数据格式不正确: %+v", unmarshalErr)
}
if validatorErr := validator.Validate(data); validatorErr != nil {
return nil, errors.Wrapf(xerr.NewErrCodeMsg(xerr.PARAM_VERIFICATION_ERROR, validatorErr.Error()), "查询服务, 参数不正确: %+v", validatorErr)
}
params := map[string]interface{}{
"name": data.Name,
"id_card": data.IDCard,
}
cacheNo, cacheDataErr := l.CacheData(params, "toc_PersonalConsumptionRestriction", userID)
if cacheDataErr != nil {
return nil, cacheDataErr
}
return &types.QueryServiceResp{Id: cacheNo}, nil
}
// ProcessTocPersonalDiscreditLogic 个人失信
func (l *QueryServiceLogic) ProcessTocPersonalDiscreditLogic(req *types.QueryServiceReq) (*types.QueryServiceResp, error) {
userID, getUidErr := ctxdata.GetUidFromCtx(l.ctx)
if getUidErr != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "查询服务, 获取用户信息失败, %+v", getUidErr)
}
// AES解密
decryptData, DecryptDataErr := l.DecryptData(req.Data)
if DecryptDataErr != nil {
return nil, DecryptDataErr
}
// 校验参数
var data types.TocIDCardTwoElements
if unmarshalErr := json.Unmarshal(decryptData, &data); unmarshalErr != nil {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "查询服务, 解密后的数据格式不正确: %+v", unmarshalErr)
}
if validatorErr := validator.Validate(data); validatorErr != nil {
return nil, errors.Wrapf(xerr.NewErrCodeMsg(xerr.PARAM_VERIFICATION_ERROR, validatorErr.Error()), "查询服务, 参数不正确: %+v", validatorErr)
}
params := map[string]interface{}{
"name": data.Name,
"id_card": data.IDCard,
}
cacheNo, cacheDataErr := l.CacheData(params, "toc_PersonalDiscredit", userID)
if cacheDataErr != nil {
return nil, cacheDataErr
}
return &types.QueryServiceResp{Id: cacheNo}, nil
}
func (l *QueryServiceLogic) DecryptData(data string) ([]byte, error) {
secretKey := l.svcCtx.Config.Encrypt.SecretKey
key, decodeErr := hex.DecodeString(secretKey)