This commit is contained in:
2026-07-22 12:16:27 +08:00
parent 5a56491740
commit ec2e336310
22 changed files with 955 additions and 28 deletions

View File

@@ -8,6 +8,7 @@ import (
"hyapi-server/internal/infrastructure/external/alicloud"
"hyapi-server/internal/infrastructure/external/huibo"
"hyapi-server/internal/infrastructure/external/jiguang"
"hyapi-server/internal/infrastructure/external/rongxing"
"hyapi-server/internal/infrastructure/external/muzi"
"hyapi-server/internal/infrastructure/external/nuoer"
"hyapi-server/internal/infrastructure/external/shujubao"
@@ -44,6 +45,7 @@ type ProcessorDependencies struct {
TianyuanapiService *tianyuanapi.TianyuanapiService
NuoerService *nuoer.NuoerService
HuiboService *huibo.HuiboService
RongxingService *rongxing.RongxingService
Validator interfaces.RequestValidator
CombService CombServiceInterface // Changed to interface to break import cycle
Options *commands.ApiCallOptions // 添加Options支持
@@ -73,6 +75,7 @@ func NewProcessorDependencies(
tianyuanapiService *tianyuanapi.TianyuanapiService,
nuoerService *nuoer.NuoerService,
huiboService *huibo.HuiboService,
rongxingService *rongxing.RongxingService,
validator interfaces.RequestValidator,
combService CombServiceInterface, // Changed to interface
reportRepo repositories.ReportRepository,
@@ -92,6 +95,7 @@ func NewProcessorDependencies(
TianyuanapiService: tianyuanapiService,
NuoerService: nuoerService,
HuiboService: huiboService,
RongxingService: rongxingService,
Validator: validator,
CombService: combService,
Options: nil, // 初始化为nil在调用时设置

View File

@@ -0,0 +1,46 @@
package jrzq
import (
"context"
"encoding/json"
"errors"
"hyapi-server/internal/domains/api/dto"
"hyapi-server/internal/domains/api/services/processors"
"hyapi-server/internal/infrastructure/external/rongxing"
)
func ProcessJRZQ0OO1Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.JRZQ0OO1Req
if err := json.Unmarshal(params, &paramsDto); err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
if deps.RongxingService == nil {
return nil, errors.Join(processors.ErrSystem, errors.New("戎行服务未初始化"))
}
if err := deps.Validator.ValidateStruct(paramsDto); err != nil {
return nil, errors.Join(processors.ErrInvalidParam, err)
}
// 业务入参在处理器侧组装;三要素按接口要求 MD5 大写后入请求体
reqdata := map[string]interface{}{
"phone": rongxing.MD5Upper(paramsDto.MobileNo),
"idCard": rongxing.MD5Upper(paramsDto.IDCard),
"name": rongxing.MD5Upper(paramsDto.Name),
}
respBytes, err := deps.RongxingService.CallAPI(ctx, "/third/loan/info360", reqdata)
if err != nil {
if errors.Is(err, rongxing.ErrNotFound) {
return nil, errors.Join(processors.ErrNotFound, err)
}
if errors.Is(err, rongxing.ErrDatasource) {
return nil, errors.Join(processors.ErrDatasource, err)
}
return nil, errors.Join(processors.ErrSystem, err)
}
return respBytes, nil
}