f
This commit is contained in:
@@ -32,6 +32,7 @@ import (
|
||||
"tyapi-server/internal/infrastructure/external/westdex"
|
||||
"tyapi-server/internal/infrastructure/external/xingwei"
|
||||
"tyapi-server/internal/infrastructure/external/yushan"
|
||||
"tyapi-server/internal/infrastructure/external/yuyuecha"
|
||||
"tyapi-server/internal/infrastructure/external/zhicha"
|
||||
"tyapi-server/internal/shared/interfaces"
|
||||
)
|
||||
@@ -72,6 +73,7 @@ func NewApiRequestService(
|
||||
huiboService *huibo.HuiboService,
|
||||
nuoerService *nuoer.NuoerService,
|
||||
haiyuapiService *haiyuapi.HaiyuapiService,
|
||||
yuyuechaService *yuyuecha.YuyuechaService,
|
||||
validator interfaces.RequestValidator,
|
||||
productManagementService *services.ProductManagementService,
|
||||
cfg *appconfig.Config,
|
||||
@@ -90,6 +92,7 @@ func NewApiRequestService(
|
||||
huiboService,
|
||||
nuoerService,
|
||||
haiyuapiService,
|
||||
yuyuechaService,
|
||||
validator,
|
||||
productManagementService,
|
||||
cfg,
|
||||
@@ -113,6 +116,7 @@ func NewApiRequestServiceWithRepos(
|
||||
huiboService *huibo.HuiboService,
|
||||
nuoerService *nuoer.NuoerService,
|
||||
haiyuapiService *haiyuapi.HaiyuapiService,
|
||||
yuyuechaService *yuyuecha.YuyuechaService,
|
||||
validator interfaces.RequestValidator,
|
||||
productManagementService *services.ProductManagementService,
|
||||
cfg *appconfig.Config,
|
||||
@@ -142,6 +146,7 @@ func NewApiRequestServiceWithRepos(
|
||||
huiboService,
|
||||
nuoerService,
|
||||
haiyuapiService,
|
||||
yuyuechaService,
|
||||
validator,
|
||||
combService,
|
||||
reportRepo,
|
||||
@@ -240,10 +245,10 @@ func registerAllProcessors(combService *comb.CombService) {
|
||||
"JRZQV7MD": jrzq.ProcessJRZQV7MDRequest, // 特殊名单
|
||||
"JRZQ5T8S": jrzq.ProcessJRZQ5T8SRequest, // 借贷意向验证V2
|
||||
"JRZQT57Z": jrzq.ProcessJRZQT57ZRequest, // 团伙欺诈风险识别
|
||||
"JRZQK9P2": jrzq.ProcessJRZQK9P2Request, // 洞侦1.0(海宇,查空计费)
|
||||
"JRZQR4N7": jrzq.ProcessJRZQR4N7Request, // 借贷意向验证3.0(海宇,查空计费)
|
||||
"JRZQP8D2": jrzq.ProcessJRZQP8D2Request, // 全景雷达BH(海宇,查空不计费)
|
||||
"JRZQ0OO1": jrzq.ProcessJRZQ0OO1Request, // 戎行贷后信息 Info360(海宇)
|
||||
"JRZQK9P2": jrzq.ProcessJRZQK9P2Request, // 洞侦1.0(海宇,查空计费)
|
||||
"JRZQR4N7": jrzq.ProcessJRZQR4N7Request, // 借贷意向验证3.0(海宇,查空计费)
|
||||
"JRZQP8D2": jrzq.ProcessJRZQP8D2Request, // 全景雷达BH(海宇,查空不计费)
|
||||
"JRZQ0OO1": jrzq.ProcessJRZQ0OO1Request, // 戎行贷后信息 Info360(海宇)
|
||||
|
||||
// QYGL系列处理器
|
||||
"QYGL8261": qygl.ProcessQYGL8261Request,
|
||||
@@ -284,6 +289,7 @@ func registerAllProcessors(combService *comb.CombService) {
|
||||
"QYGL2YSB": qygl.ProcessQYGL2YSBRequest, //企业二要素认证shumai
|
||||
"QYGLDG77": qygl.ProcessQYGLDG77Request, //企业对公打款认证shumai
|
||||
"QYGLBH7Y": qygl.ProcessQYGLBH7YRequest, //企业涉诉案件查询海宇
|
||||
"QYGL101A": qygl.ProcessQYGL101ARequest, //企业关系查询(北京正信 A01,示例)
|
||||
|
||||
// YYSY系列处理器
|
||||
"YYSY35TA": yysy.ProcessYYSY35TARequest, //运营商归属地数卖
|
||||
@@ -419,7 +425,7 @@ func registerAllProcessors(combService *comb.CombService) {
|
||||
"QYGLVR76": qygl.ProcessQYGLVR76Request, //名下企业诺尔
|
||||
"QCXG1S2L": qcxg.ProcessQCXG1S2LRequest, //车辆车五项信息核验V2
|
||||
"QCXGA8V3": qcxg.ProcessQCXGA8V3Request, //全国车辆配置查验(车五项+使用性质+承保)
|
||||
"QCXGCP77": qcxg.ProcessQCXGCP77Request, //全国车辆配置查验(车辆详情)
|
||||
"QCXGCP77": qcxg.ProcessQCXGCP77Request, //全国车辆配置查验(车辆详情)
|
||||
"QCXG6U5G": qcxg.ProcessQCXG6U5GRequest, //名下车辆核验
|
||||
// DWBG系列处理器 - 多维报告
|
||||
"DWBG6A2C": dwbg.ProcessDWBG6A2CRequest,
|
||||
|
||||
@@ -352,6 +352,7 @@ func (s *FormConfigServiceImpl) getDTOStruct(ctx context.Context, apiCode string
|
||||
"QCXG6U5G": &dto.QCXG6U5GReq{}, //名下车辆核验
|
||||
"IVYZ2MA8": &dto.IVYZ2MA8Req{}, //学历核验
|
||||
"IVYZHY87": &dto.IVYZHY87Req{}, //婚姻状态查询
|
||||
"QYGL101A": &dto.QYGL101AReq{}, //企业关系查询(北京正信 A01,示例)
|
||||
}
|
||||
|
||||
// 优先返回已配置的DTO
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
"tyapi-server/internal/infrastructure/external/westdex"
|
||||
"tyapi-server/internal/infrastructure/external/xingwei"
|
||||
"tyapi-server/internal/infrastructure/external/yushan"
|
||||
"tyapi-server/internal/infrastructure/external/yuyuecha"
|
||||
"tyapi-server/internal/infrastructure/external/zhicha"
|
||||
"tyapi-server/internal/shared/interfaces"
|
||||
)
|
||||
@@ -46,6 +47,7 @@ type ProcessorDependencies struct {
|
||||
HuiboService *huibo.HuiboService
|
||||
NuoerService *nuoer.NuoerService
|
||||
HaiyuapiService *haiyuapi.HaiyuapiService
|
||||
YuyuechaService *yuyuecha.YuyuechaService
|
||||
Validator interfaces.RequestValidator
|
||||
CombService CombServiceInterface // Changed to interface to break import cycle
|
||||
Options *commands.ApiCallOptions // 添加Options支持
|
||||
@@ -76,6 +78,7 @@ func NewProcessorDependencies(
|
||||
huiboService *huibo.HuiboService,
|
||||
nuoerService *nuoer.NuoerService,
|
||||
haiyuapiService *haiyuapi.HaiyuapiService,
|
||||
yuyuechaService *yuyuecha.YuyuechaService,
|
||||
validator interfaces.RequestValidator,
|
||||
combService CombServiceInterface, // Changed to interface
|
||||
reportRepo repositories.ReportRepository,
|
||||
@@ -96,6 +99,7 @@ func NewProcessorDependencies(
|
||||
HuiboService: huiboService,
|
||||
NuoerService: nuoerService,
|
||||
HaiyuapiService: haiyuapiService,
|
||||
YuyuechaService: yuyuechaService,
|
||||
Validator: validator,
|
||||
CombService: combService,
|
||||
Options: nil, // 初始化为nil,在调用时设置
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"tyapi-server/internal/domains/api/dto"
|
||||
"tyapi-server/internal/domains/api/services/processors"
|
||||
"tyapi-server/internal/infrastructure/external/nuoer"
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package qygl
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"tyapi-server/internal/domains/api/dto"
|
||||
"tyapi-server/internal/domains/api/services/processors"
|
||||
"tyapi-server/internal/infrastructure/external/yuyuecha"
|
||||
)
|
||||
|
||||
// ProcessQYGL101ARequest QYGL101A - 企业关系查询(愉悦查 A01 示例)
|
||||
//
|
||||
// 扣费策略(对齐上游 9.2 / 9.3):
|
||||
// - HTTP 200 + success:按 X-Billable / billing.billable 决定是否平台扣费
|
||||
// - 沙箱 / 幂等重放通常 billable=false → SuccessNoBillError(返回数据但不扣费)
|
||||
// - 正式环境 resultCode=0/1 且 billable=true → 正常成功并扣费
|
||||
// - 4xx/5xx / success=false → 哨兵错误,不扣费
|
||||
func ProcessQYGL101ARequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||
var paramsDto dto.QYGL101AReq
|
||||
if err := json.Unmarshal(params, ¶msDto); err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
if err := deps.Validator.ValidateStruct(paramsDto); err != nil {
|
||||
return nil, errors.Join(processors.ErrInvalidParam, err)
|
||||
}
|
||||
|
||||
if deps.YuyuechaService == nil {
|
||||
return nil, errors.Join(processors.ErrSystem, errors.New("北京正信服务未初始化"))
|
||||
}
|
||||
|
||||
// apiPath 入参;CallAPI 内拼接为 /openapi/v1/a01/person-company-relations
|
||||
// 上游 idCard 要求 32 位 MD5(兼容 64 位 SHA-256),平台侧收明文后在此做摘要
|
||||
result, err := deps.YuyuechaService.CallAPI(ctx, "a01/person-company-relations", map[string]interface{}{
|
||||
"name": paramsDto.Name,
|
||||
"idCard": yuyuecha.HashIDCard(paramsDto.IDCard),
|
||||
})
|
||||
if err != nil {
|
||||
if errors.Is(err, yuyuecha.ErrNotFound) {
|
||||
return nil, errors.Join(processors.ErrNotFound, err)
|
||||
}
|
||||
if errors.Is(err, yuyuecha.ErrDatasource) {
|
||||
return nil, errors.Join(processors.ErrDatasource, err)
|
||||
}
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
if !result.Billable {
|
||||
return nil, &processors.SuccessNoBillError{Response: result.Data}
|
||||
}
|
||||
|
||||
return result.Data, nil
|
||||
}
|
||||
Reference in New Issue
Block a user