This commit is contained in:
2026-06-17 21:38:36 +08:00
parent 22e504afcb
commit 880ef950b4
8 changed files with 275 additions and 1 deletions

View File

@@ -127,6 +127,26 @@ type QYGL7HBNReq struct {
EntName string `json:"ent_name" validate:"required,min=1,validEnterpriseName"`
EntCode string `json:"ent_code" validate:"required,validUSCI"`
}
type QCXG8VA3Req struct {
VinCode string `json:"vin_code" validate:"required"`
}
type QCXGCP77Req struct {
PlateNo string `json:"plate_no" validate:"required"`
}
type QCXGX2X6Req struct {
PlateNo string `json:"plate_no" validate:"required"`
VehicleType string `json:"vehicle_type" validate:"omitempty"`
Name string `json:"name" validate:"required,min=1,validName"`
}
type QCXG1S2LReq struct {
VinCode string `json:"vin_code" validplateTypeate:"required"`
}
type YYSYS7Y1Req struct {
MobileNo string `json:"mobile_no" validate:"required,min=11,max=11,validMobileNo"`
Name string `json:"name" validate:"required,min=1,validName"`
IDCard string `json:"id_card" validate:"required,validIDCard"`
}
type JRZQDMLOReq struct {
PhotoData string `json:"photo_data" validate:"required,validBase64Image"`
}

View File

@@ -198,6 +198,10 @@ func registerAllProcessors(combService *comb.CombService) {
"QYGLWV7U": qygl.ProcessQYGLWV7URequest, //人企关联
"QYGL7Z0O": qygl.ProcessQYGL7Z0ORequest, //企业诉讼定制版
"QYGLLUCM": qygl.ProcessQYGLLUCMRequest, //企业案件查询汇博
"QCXG8VA3": qcxg.ProcessQCXG8VA3Request, //全国车辆配置查验(车五项+使用性质+承保)
"QCXGCP77": qcxg.ProcessQCXGCP77Request, //全国车辆配置查验(车辆详情)
"QCXGX2X6": qcxg.ProcessQCXGX2X6Request, //行驶证信息核验V2
"QCXG1S2L": qcxg.ProcessQCXG1S2LRequest, //汽车车辆五项
// YYSY系列处理器
"YYSY0YYV": yysy.ProcessYYSY0YYVRequest, //运营商二要素查询
@@ -210,6 +214,7 @@ func registerAllProcessors(combService *comb.CombService) {
"YYSYXHHO": yysy.ProcessYYSYXHHORequest, //运营商三要素即时版查询
"YYSYGLSF": yysy.ProcessYYSYGLSFRequest, //全网手机三要素验证1979周更新版
"YYSYP7PL": yysy.ProcessYYSYP7PLRequest, //手机二次放号检测查询
"YYSYS7Y1": yysy.ProcessYYSYS7Y1Request, //移动手机号易诉分
// IVYZ系列处理器
"IVYZSQ0E": ivyz.ProcessIVYZSQ0ERequest, //身份证实名认证即时版

View File

@@ -298,7 +298,11 @@ func (s *FormConfigServiceImpl) getDTOStruct(ctx context.Context, apiCode string
"JRZQML9G": &dto.JRZQML9GReq{}, //坤羽模型V3-标签版
"FLXGC4CT": &dto.FLXGC4CTReq{}, //汇博-个人涉诉
"QYGLLUCM": &dto.QYGLLUCMReq{}, //汇博-企业涉诉
"QCXG8VA3": &dto.QCXG8VA3Req{}, //全国车辆配置查验(车五项+使用性质+承保)
"QCXGCP77": &dto.QCXGCP77Req{}, //全国车辆配置查验(车辆详情)
"QCXGX2X6": &dto.QCXGX2X6Req{}, //行驶证信息核验V2
"QCXG1S2L": &dto.QCXG1S2LReq{}, //汽车车辆五项
"YYSYS7Y1": &dto.YYSYS7Y1Req{}, //移动手机号易诉分
}
// 优先返回已配置的DTO

View File

@@ -0,0 +1,48 @@
package qcxg
import (
"context"
"encoding/json"
"errors"
"hyapi-server/internal/domains/api/dto"
"hyapi-server/internal/domains/api/services/processors"
"hyapi-server/internal/infrastructure/external/shujubao"
)
// ProcessQCXG1S2LRequest QCXG1S2L 汽车车辆五项
func ProcessQCXG1S2LRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.QCXG1S2LReq
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)
}
// 构建数据宝入参姓名、身份证、手机号、银行卡号sign 外的业务参数可按需 AES 加密后作为 bodyData
reqParams := map[string]interface{}{
"key": "78ee23dc53ea80ebb80ba3d5aa311bbf",
"vinList": paramsDto.VinCode,
}
// 最终请求 URL = https://api.chinadatapay.com/communication + 拼接接口地址值,如 personal/197
apiPath := "/communication/personal/10480"
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)
}
respBytes, err := json.Marshal(data)
if err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
return respBytes, nil
}

View File

@@ -0,0 +1,48 @@
package qcxg
import (
"context"
"encoding/json"
"errors"
"hyapi-server/internal/domains/api/dto"
"hyapi-server/internal/domains/api/services/processors"
"hyapi-server/internal/infrastructure/external/shujubao"
)
// ProcessQCXGA8V3Request QCXGA8V3 全国车辆配置查验(车五项+使用性质+承保) API 处理方法(使用数据宝服务示例)
func ProcessQCXGA8V3Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.QCXGA8V3Req
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)
}
// 构建数据宝入参姓名、身份证、手机号、银行卡号sign 外的业务参数可按需 AES 加密后作为 bodyData
reqParams := map[string]interface{}{
"key": "5bc08fb21390de1ce8f4cd34d5db26df",
"vin": paramsDto.VinCode,
}
// 最终请求 URL = https://api.chinadatapay.com/communication + 拼接接口地址值,如 personal/197
apiPath := "/government/traffic/10533"
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)
}
respBytes, err := json.Marshal(data)
if err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
return respBytes, nil
}

View File

@@ -0,0 +1,48 @@
package qcxg
import (
"context"
"encoding/json"
"errors"
"hyapi-server/internal/domains/api/dto"
"hyapi-server/internal/domains/api/services/processors"
"hyapi-server/internal/infrastructure/external/shujubao"
)
// ProcessQCXGCP77Request QCXGCP77 全国车辆配置查验(车辆详情)
func ProcessQCXGCP77Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.QCXGCP77Req
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)
}
// 构建数据宝入参姓名、身份证、手机号、银行卡号sign 外的业务参数可按需 AES 加密后作为 bodyData
reqParams := map[string]interface{}{
"key": "6914dd1d707e60f60e8340674315e5ee",
"carNo": paramsDto.VinCode,
}
// 最终请求 URL = https://api.chinadatapay.com/communication + 拼接接口地址值,如 personal/197
apiPath := "/government/traffic/9999"
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)
}
respBytes, err := json.Marshal(data)
if err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
return respBytes, nil
}

View File

@@ -0,0 +1,51 @@
package qcxg
import (
"context"
"encoding/json"
"errors"
"hyapi-server/internal/domains/api/dto"
"hyapi-server/internal/domains/api/services/processors"
"hyapi-server/internal/infrastructure/external/shujubao"
)
// ProcessQCXGX2X6Request QCXGX2X6 行驶证信息核验V2
func ProcessQCXGX2X6Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.QCXGX2X6Req
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)
}
// 构建数据宝入参姓名、身份证、手机号、银行卡号sign 外的业务参数可按需 AES 加密后作为 bodyData
reqParams := map[string]interface{}{
"key": "c46659b6e3525299950799d36089fd2f",
"plate": paramsDto.PlateNo,
"plateType": paramsDto.VehicleType,
"name": paramsDto.Name,
}
// 最终请求 URL = https://api.chinadatapay.com/communication + 拼接接口地址值,如 personal/197
apiPath := "/government/traffic/10300"
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)
}
respBytes, err := json.Marshal(data)
if err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
return respBytes, nil
}

View File

@@ -0,0 +1,50 @@
package qcxg
import (
"context"
"encoding/json"
"errors"
"hyapi-server/internal/domains/api/dto"
"hyapi-server/internal/domains/api/services/processors"
"hyapi-server/internal/infrastructure/external/shujubao"
)
// ProcessYYSYS7Y1Request YYSYS7Y1 移动手机号易诉分
func ProcessYYSYS7Y1Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.YYSYS7Y1Req
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)
}
// 构建数据宝入参姓名、身份证、手机号、银行卡号sign 外的业务参数可按需 AES 加密后作为 bodyData
reqParams := map[string]interface{}{
"key": "40130990be30f9fea6422168d138ff6c",
"phone": paramsDto.MobileNo,
"name": paramsDto.Name,
"idCard": paramsDto.IDCard,
}
// 最终请求 URL = https://api.chinadatapay.com/communication + 拼接接口地址值,如 personal/197
apiPath := "/communication/personal/10502"
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)
}
respBytes, err := json.Marshal(data)
if err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
return respBytes, nil
}