This commit is contained in:
Mrx
2026-05-27 13:00:51 +08:00
parent b7fb2a73c9
commit 5cee8ff035
15 changed files with 569 additions and 146 deletions

View File

@@ -488,6 +488,24 @@ type IVYZ2A8BReq struct {
Authorized string `json:"authorized" validate:"required,oneof=0 1"`
}
type QYGL4YABReq struct {
EntName string `json:"ent_name" validate:"required,min=1,validEnterpriseName"`
EntCode string `json:"ent_code" validate:"required,validUSCI"`
IDCard string `json:"id_card" validate:"required,validIDCard"`
Name string `json:"name" validate:"required,min=1,validName"`
}
type QYGL3YSBReq struct {
Name string `json:"name" validate:"required,min=1,validName"`
EntCode string `json:"ent_code" validate:"required,validUSCI"`
EntName string `json:"ent_name" validate:"required,min=1,validEnterpriseName"`
}
type QYGL2YSBReq struct {
EntCode string `json:"ent_code" validate:"required,validUSCI"`
Name string `json:"name" validate:"required,min=1,validName"`
}
type IVYZ7C9DReq struct {
IDCard string `json:"id_card" validate:"required,validIDCard"`
Name string `json:"name" validate:"required,min=1,validName"`

View File

@@ -256,7 +256,9 @@ func registerAllProcessors(combService *comb.CombService) {
"QYGL8848": qygl.ProcessQYGL8848Request, //企业税收违法核查
"QYGLDJ33": qygl.ProcessQYGLDJ33Request, //企业年报信息核验
"QYGLBH7Y": qygl.ProcessQYGLBH7YRequest, //企业涉诉案件查询汇博
"QYGL4YAB": qygl.ProcessQYGL4YABRequest, //企业四要素认证shumai
"QYGL3YSB": qygl.ProcessQYGL3YSBRequest, //企业三要素认证shumai
"QYGL2YSB": qygl.ProcessQYGL2YSBRequest, //企业二要素认证shumai
// YYSY系列处理器
"YYSY35TA": yysy.ProcessYYSY35TARequest, //运营商归属地数卖
"YYSYD50F": yysy.ProcessYYSYD50FRequest,

View File

@@ -283,6 +283,9 @@ func (s *FormConfigServiceImpl) getDTOStruct(ctx context.Context, apiCode string
"IVYZ2MN7": &dto.IVYZ2MN6Req{}, //学历Bzhicha
"FLXGHB4F": &dto.FLXGHB4FReq{}, //个人涉诉案件查询汇博
"QYGLBH7Y": &dto.QYGLBH7YReq{}, //企业涉诉案件查询汇博
"QYGL4YAB": &dto.QYGL4YABReq{}, //企业四要素认证shumai
"QYGL3YSB": &dto.QYGL3YSBReq{}, //企业三要素认证shumai
"QYGL2YSB": &dto.QYGL2YSBReq{}, //企业二要素认证shumai
}
// 优先返回已配置的DTO

View File

@@ -0,0 +1,47 @@
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/shumai"
)
// ProcessQYGL2YSBRequest QYGL2YSB API处理方法 - 企业二要素认证
func ProcessQYGL2YSBRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.QYGL2YSBReq
if err := json.Unmarshal(params, &paramsDto); err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
if err := deps.Validator.ValidateStruct(paramsDto); err != nil {
return nil, errors.Join(processors.ErrInvalidParam, err)
}
reqFormData := map[string]interface{}{
"legalPerson": paramsDto.Name,
"creditNo": paramsDto.EntCode,
}
apiPath := "/v4/company/two/check" // 接口路径,根据数脉文档填写(如 v4/xxx
respBytes, err := deps.ShumaiService.CallAPIForm(ctx, apiPath, reqFormData)
if err != nil {
if errors.Is(err, shumai.ErrDatasource) {
// 数据源错误
return nil, errors.Join(processors.ErrDatasource, err)
} else if errors.Is(err, shumai.ErrSystem) {
// 系统错误
return nil, errors.Join(processors.ErrSystem, err)
} else if errors.Is(err, shumai.ErrNotFound) {
// 查无记录
return nil, errors.Join(processors.ErrNotFound, err)
} else {
// 其他未知错误
return nil, errors.Join(processors.ErrSystem, err)
}
}
return respBytes, nil
}

View File

@@ -0,0 +1,48 @@
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/shumai"
)
// ProcessQYGL3YSBRequest QYGL3YSB API处理方法 - 企业三要素认证
func ProcessQYGL3YSBRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.QYGL3YSBReq
if err := json.Unmarshal(params, &paramsDto); err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
if err := deps.Validator.ValidateStruct(paramsDto); err != nil {
return nil, errors.Join(processors.ErrInvalidParam, err)
}
reqFormData := map[string]interface{}{
"legalPerson": paramsDto.Name,
"companyName": paramsDto.EntName,
"creditNo": paramsDto.EntCode,
}
apiPath := "/v4/company-three/check" // 接口路径,根据数脉文档填写(如 v4/xxx
respBytes, err := deps.ShumaiService.CallAPIForm(ctx, apiPath, reqFormData)
if err != nil {
if errors.Is(err, shumai.ErrDatasource) {
// 数据源错误
return nil, errors.Join(processors.ErrDatasource, err)
} else if errors.Is(err, shumai.ErrSystem) {
// 系统错误
return nil, errors.Join(processors.ErrSystem, err)
} else if errors.Is(err, shumai.ErrNotFound) {
// 查无记录
return nil, errors.Join(processors.ErrNotFound, err)
} else {
// 其他未知错误
return nil, errors.Join(processors.ErrSystem, err)
}
}
return respBytes, nil
}

View File

@@ -0,0 +1,49 @@
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/shumai"
)
// ProcessQYGL4YABRequest QYGL4YAB API处理方法 - 企业四要素认证
func ProcessQYGL4YABRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.QYGL4YABReq
if err := json.Unmarshal(params, &paramsDto); err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
if err := deps.Validator.ValidateStruct(paramsDto); err != nil {
return nil, errors.Join(processors.ErrInvalidParam, err)
}
reqFormData := map[string]interface{}{
"idCard": paramsDto.IDCard,
"legalPerson": paramsDto.Name,
"companyName": paramsDto.EntName,
"creditNo": paramsDto.EntCode,
}
apiPath := "/v4/company-four/check" // 接口路径,根据数脉文档填写(如 v4/xxx
respBytes, err := deps.ShumaiService.CallAPIForm(ctx, apiPath, reqFormData)
if err != nil {
if errors.Is(err, shumai.ErrDatasource) {
// 数据源错误
return nil, errors.Join(processors.ErrDatasource, err)
} else if errors.Is(err, shumai.ErrSystem) {
// 系统错误
return nil, errors.Join(processors.ErrSystem, err)
} else if errors.Is(err, shumai.ErrNotFound) {
// 查无记录
return nil, errors.Join(processors.ErrNotFound, err)
} else {
// 其他未知错误
return nil, errors.Join(processors.ErrSystem, err)
}
}
return respBytes, nil
}