This commit is contained in:
Mrx
2026-06-01 13:15:37 +08:00
parent 21217f4da1
commit 5d2d49f0e8
16 changed files with 1536 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import (
"hyapi-server/internal/application/api/commands"
"hyapi-server/internal/domains/api/repositories"
"hyapi-server/internal/infrastructure/external/alicloud"
"hyapi-server/internal/infrastructure/external/huibo"
"hyapi-server/internal/infrastructure/external/jiguang"
"hyapi-server/internal/infrastructure/external/muzi"
"hyapi-server/internal/infrastructure/external/nuoer"
@@ -42,6 +43,7 @@ type ProcessorDependencies struct {
JiguangService *jiguang.JiguangService
ShumaiService *shumai.ShumaiService
NuoerService *nuoer.NuoerService
HuiboService *huibo.HuiboService
Validator interfaces.RequestValidator
CombService CombServiceInterface // Changed to interface to break import cycle
Options *commands.ApiCallOptions // 添加Options支持
@@ -70,6 +72,7 @@ func NewProcessorDependencies(
jiguangService *jiguang.JiguangService,
shumaiService *shumai.ShumaiService,
nuoerService *nuoer.NuoerService,
huiboService *huibo.HuiboService,
validator interfaces.RequestValidator,
combService CombServiceInterface, // Changed to interface
reportRepo repositories.ReportRepository,
@@ -88,6 +91,7 @@ func NewProcessorDependencies(
JiguangService: jiguangService,
ShumaiService: shumaiService,
NuoerService: nuoerService,
HuiboService: huiboService,
Validator: validator,
CombService: combService,
Options: nil, // 初始化为nil在调用时设置

View File

@@ -0,0 +1,64 @@
package flxg
import (
"context"
"encoding/json"
"errors"
"hyapi-server/internal/domains/api/dto"
"hyapi-server/internal/domains/api/services/processors"
"hyapi-server/internal/infrastructure/external/huibo"
)
// ProcessFLXGHB4FRequest FLXGHB4F API处理方法 - 个人涉诉案件查询汇博
func ProcessFLXGHB4FRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.FLXGHB4FReq
if err := json.Unmarshal(params, &paramsDto); err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
if deps.HuiboService == 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 加密 name 和 idCard
// encryptedName := "MD5:" + huibo.MD5Encrypt(paramsDto.Name, deps.HuiboService.GetConfig().AppKey)
// encryptedIDCard := "MD5:" + huibo.MD5Encrypt(paramsDto.IDCard, deps.HuiboService.GetConfig().AppKey)
reqdata := map[string]interface{}{
"name": paramsDto.Name,
"idCard": paramsDto.IDCard,
}
respBytes, err := deps.HuiboService.CallAPI2(ctx, "P_004_0271", reqdata)
if err != nil {
return nil, errors.Join(processors.ErrDatasource, err)
}
// 解析响应
var response huibo.CallAPI2Response
if err := json.Unmarshal(respBytes, &response); err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
// 处理状态码
switch response.Code {
case huibo.CallAPI2StatusSuccess:
// 查询成功
if response.Data == nil {
return []byte("{}"), nil
}
return respBytes, nil
case huibo.CallAPI2StatusNoData:
// 查询成功,无数据 - 按产品约定按调用成功计费
return []byte("{}"), nil
default:
// 其他错误状态码
message := huibo.GetCallAPI2StatusMessage(response.Code)
return nil, errors.Join(processors.ErrDatasource, errors.New(message))
}
}

View File

@@ -0,0 +1,59 @@
package qygl
import (
"context"
"encoding/json"
"errors"
"hyapi-server/internal/domains/api/dto"
"hyapi-server/internal/domains/api/services/processors"
"hyapi-server/internal/infrastructure/external/huibo"
)
// ProcessQYGLBH7YRequest QYGLBH7Y API处理方法 - 企业案件查询汇博
func ProcessQYGLBH7YRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.QYGLBH7YReq
if err := json.Unmarshal(params, &paramsDto); err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
if deps.HuiboService == nil {
return nil, errors.Join(processors.ErrSystem, errors.New("汇博服务未初始化"))
}
if err := deps.Validator.ValidateStruct(paramsDto); err != nil {
return nil, errors.Join(processors.ErrInvalidParam, err)
}
reqdata := map[string]interface{}{
"companyName": paramsDto.EntName,
}
respBytes, err := deps.HuiboService.CallAPI2(ctx, "E_004_0261", reqdata)
if err != nil {
return nil, errors.Join(processors.ErrDatasource, err)
}
// 解析响应
var response huibo.CallAPI2Response
if err := json.Unmarshal(respBytes, &response); err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
// 处理状态码
switch response.Code {
case huibo.CallAPI2StatusSuccess:
// 查询成功
if response.Data == nil {
return []byte("{}"), nil
}
return respBytes, nil
case huibo.CallAPI2StatusNoData:
// 查询成功,无数据 - 按产品约定按调用成功计费
return []byte("{}"), nil
default:
// 其他错误状态码
message := huibo.GetCallAPI2StatusMessage(response.Code)
return nil, errors.Join(processors.ErrDatasource, errors.New(message))
}
}