f
This commit is contained in:
@@ -665,6 +665,11 @@ type QYGLDJ12Req struct {
|
|||||||
EntCode string `json:"ent_code" validate:"omitempty,validUSCI"`
|
EntCode string `json:"ent_code" validate:"omitempty,validUSCI"`
|
||||||
EntRegNo string `json:"ent_reg_no" validate:"omitempty"`
|
EntRegNo string `json:"ent_reg_no" validate:"omitempty"`
|
||||||
}
|
}
|
||||||
|
type QYGLDJ33Req struct {
|
||||||
|
EntName string `json:"ent_name" validate:"omitempty,min=1,validEnterpriseName"`
|
||||||
|
EntCode string `json:"ent_code" validate:"omitempty,validUSCI"`
|
||||||
|
EntRegNo string `json:"ent_reg_no" validate:"omitempty"`
|
||||||
|
}
|
||||||
type YYSY6D9AReq struct {
|
type YYSY6D9AReq struct {
|
||||||
MobileNo string `json:"mobile_no" validate:"required,min=11,max=11,validMobileNo"`
|
MobileNo string `json:"mobile_no" validate:"required,min=11,max=11,validMobileNo"`
|
||||||
IDCard string `json:"id_card" validate:"required,validIDCard"`
|
IDCard string `json:"id_card" validate:"required,validIDCard"`
|
||||||
|
|||||||
@@ -248,6 +248,7 @@ func registerAllProcessors(combService *comb.CombService) {
|
|||||||
"QYGLUY3S": qygl.ProcessQYGLUY3SRequest, //企业经营状态全景查询
|
"QYGLUY3S": qygl.ProcessQYGLUY3SRequest, //企业经营状态全景查询
|
||||||
"QYGLDJ12": qygl.ProcessQYGLDJ12Request, //企业年报信息核验
|
"QYGLDJ12": qygl.ProcessQYGLDJ12Request, //企业年报信息核验
|
||||||
"QYGL8848": qygl.ProcessQYGL8848Request, //企业税收违法核查
|
"QYGL8848": qygl.ProcessQYGL8848Request, //企业税收违法核查
|
||||||
|
"QYGLDJ33": qygl.ProcessQYGLDJ33Request, //企业年报信息核验
|
||||||
|
|
||||||
// YYSY系列处理器
|
// YYSY系列处理器
|
||||||
"YYSY35TA": yysy.ProcessYYSY35TARequest, //运营商归属地数卖
|
"YYSY35TA": yysy.ProcessYYSY35TARequest, //运营商归属地数卖
|
||||||
|
|||||||
@@ -275,6 +275,7 @@ func (s *FormConfigServiceImpl) getDTOStruct(ctx context.Context, apiCode string
|
|||||||
"IVYZ48SR": &dto.IVYZ48SRReq{}, //婚姻状态核验V2(双人)
|
"IVYZ48SR": &dto.IVYZ48SRReq{}, //婚姻状态核验V2(双人)
|
||||||
"IVYZ5E22": &dto.IVYZ5E22Req{}, //双人婚姻评估查询zhicha版本
|
"IVYZ5E22": &dto.IVYZ5E22Req{}, //双人婚姻评估查询zhicha版本
|
||||||
"DWBG5SAM": &dto.DWBG5SAMReq{}, //天远指迷报告
|
"DWBG5SAM": &dto.DWBG5SAMReq{}, //天远指迷报告
|
||||||
|
"QYGLDJ33": &dto.QYGLDJ33Req{}, //企业年报信息核验
|
||||||
}
|
}
|
||||||
|
|
||||||
// 优先返回已配置的DTO
|
// 优先返回已配置的DTO
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
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/shujubao"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ProcessQYGLDJ33Request QYGLDJ33 企业进出口信用核查 API 处理方法(使用数据宝服务示例)
|
||||||
|
func ProcessQYGLDJ33Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||||
|
var paramsDto dto.QYGLDJ33Req
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 企业名称(entName)、统一社会信用代码(creditCode)、企业注册号(entRegNo) 至少传其一;多填时优先用 creditCode 传参
|
||||||
|
hasEntName := paramsDto.EntName != ""
|
||||||
|
hasEntCode := paramsDto.EntCode != ""
|
||||||
|
hasEntRegNo := paramsDto.EntRegNo != ""
|
||||||
|
if !hasEntName && !hasEntCode && !hasEntRegNo { // 三个都未填才报错
|
||||||
|
return nil, errors.Join(processors.ErrInvalidParam, errors.New("ent_name、ent_code、ent_reg_no 至少需要传其中一个"))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建数据宝入参(sign 外的业务参数可按需 AES 加密后作为 bodyData)
|
||||||
|
reqParams := map[string]interface{}{
|
||||||
|
"key": "112813815e2cc281ad8f552deb7a3c7f",
|
||||||
|
}
|
||||||
|
if hasEntCode {
|
||||||
|
reqParams["creditCode"] = paramsDto.EntCode
|
||||||
|
} else if hasEntName {
|
||||||
|
reqParams["entName"] = paramsDto.EntName
|
||||||
|
} else if hasEntRegNo {
|
||||||
|
reqParams["regCode"] = paramsDto.EntRegNo
|
||||||
|
}
|
||||||
|
// 最终请求 URL = https://api.chinadatapay.com/communication + 拼接接口地址值,如 personal/197
|
||||||
|
apiPath := "/communication/personal/10254"
|
||||||
|
data, err := deps.ShujubaoService.CallAPI(ctx, apiPath, reqParams)
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, shujubao.ErrDatasource) {
|
||||||
|
return nil, errors.Join(processors.ErrDatasource, err)
|
||||||
|
}
|
||||||
|
if errors.Is(err, shujubao.ErrQueryEmpty) {
|
||||||
|
return nil, errors.Join(processors.ErrNotFound, err)
|
||||||
|
}
|
||||||
|
return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析响应中的 JSON 字符串(使用 qyglb4c0 中的 RecursiveParse)
|
||||||
|
parsedResp, err := RecursiveParse(data)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
respBytes, err := json.Marshal(parsedResp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
}
|
||||||
|
return respBytes, nil
|
||||||
|
}
|
||||||
@@ -9,4 +9,37 @@ import (
|
|||||||
// ProcessYYSY8C2DRequest YYSY8C2D API处理方法 - 运营商三要素查询
|
// ProcessYYSY8C2DRequest YYSY8C2D API处理方法 - 运营商三要素查询
|
||||||
func ProcessYYSY8C2DRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
func ProcessYYSY8C2DRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||||
return ProcessYYSY9A1BRequest(ctx, params, deps)
|
return ProcessYYSY9A1BRequest(ctx, params, deps)
|
||||||
|
|
||||||
|
// var paramsDto dto.YYSY8C2DReq
|
||||||
|
// 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)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 构建请求数据,将项目规范的字段名转换为 XingweiService 需要的字段名
|
||||||
|
// reqData := map[string]interface{}{
|
||||||
|
// "name": paramsDto.Name,
|
||||||
|
// "idCardNum": paramsDto.IDCard,
|
||||||
|
// "phoneNumber": paramsDto.MobileNo,
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // 调用行为数据API,使用指定的project_id
|
||||||
|
// projectID := "CDJ-1100244702166183936"
|
||||||
|
// respBytes, err := deps.XingweiService.CallAPI(ctx, projectID, reqData)
|
||||||
|
// if err != nil {
|
||||||
|
// if errors.Is(err, xingwei.ErrNotFound) {
|
||||||
|
// return nil, errors.Join(processors.ErrNotFound, err)
|
||||||
|
// } else if errors.Is(err, xingwei.ErrDatasource) {
|
||||||
|
// return nil, errors.Join(processors.ErrDatasource, err)
|
||||||
|
// } else if errors.Is(err, xingwei.ErrSystem) {
|
||||||
|
// return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
// } else {
|
||||||
|
// return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return respBytes, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user