This commit is contained in:
2026-07-22 17:16:35 +08:00
52 changed files with 6336 additions and 293 deletions

View File

@@ -11,9 +11,10 @@ import (
"hyapi-server/internal/infrastructure/external/jiyi"
"hyapi-server/internal/infrastructure/external/muzi"
"hyapi-server/internal/infrastructure/external/nuoer"
"hyapi-server/internal/infrastructure/external/rongxing"
"hyapi-server/internal/infrastructure/external/shujubao"
"hyapi-server/internal/infrastructure/external/tianyuanapi"
"hyapi-server/internal/infrastructure/external/tianyancha"
"hyapi-server/internal/infrastructure/external/tianyuanapi"
"hyapi-server/internal/infrastructure/external/westdex"
"hyapi-server/internal/infrastructure/external/xingwei"
"hyapi-server/internal/infrastructure/external/yushan"
@@ -33,23 +34,24 @@ type CallContext struct {
// ProcessorDependencies 处理器依赖容器
type ProcessorDependencies struct {
WestDexService *westdex.WestDexService
ShujubaoService *shujubao.ShujubaoService
MuziService *muzi.MuziService
YushanService *yushan.YushanService
TianYanChaService *tianyancha.TianYanChaService
AlicloudService *alicloud.AlicloudService
ZhichaService *zhicha.ZhichaService
XingweiService *xingwei.XingweiService
JiguangService *jiguang.JiguangService
WestDexService *westdex.WestDexService
ShujubaoService *shujubao.ShujubaoService
MuziService *muzi.MuziService
YushanService *yushan.YushanService
TianYanChaService *tianyancha.TianYanChaService
AlicloudService *alicloud.AlicloudService
ZhichaService *zhicha.ZhichaService
XingweiService *xingwei.XingweiService
JiguangService *jiguang.JiguangService
TianyuanapiService *tianyuanapi.TianyuanapiService
NuoerService *nuoer.NuoerService
JiyiService *jiyi.JiyiService
HuiboService *huibo.HuiboService
Validator interfaces.RequestValidator
CombService CombServiceInterface // Changed to interface to break import cycle
Options *commands.ApiCallOptions // 添加Options支持
CallContext *CallContext // 添加CallApi调用上下文
NuoerService *nuoer.NuoerService
JiyiService *jiyi.JiyiService
HuiboService *huibo.HuiboService
RongxingService *rongxing.RongxingService
Validator interfaces.RequestValidator
CombService CombServiceInterface // Changed to interface to break import cycle
Options *commands.ApiCallOptions // 添加Options支持
CallContext *CallContext // 添加CallApi调用上下文
// 企业报告记录仓储,用于持久化 QYGLJ1U9 生成的企业报告
ReportRepo repositories.ReportRepository
@@ -76,6 +78,7 @@ func NewProcessorDependencies(
nuoerService *nuoer.NuoerService,
jiyiService *jiyi.JiyiService,
huiboService *huibo.HuiboService,
rongxingService *rongxing.RongxingService,
validator interfaces.RequestValidator,
combService CombServiceInterface, // Changed to interface
reportRepo repositories.ReportRepository,
@@ -96,6 +99,7 @@ func NewProcessorDependencies(
NuoerService: nuoerService,
JiyiService: jiyiService,
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
}