fadd
This commit is contained in:
@@ -1375,3 +1375,26 @@ type JRZQ2PV2Req 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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type QCXGV20OReq struct {
|
||||||
|
VinCode string `json:"vin_code" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type QCXGVP00Req struct {
|
||||||
|
VinCode string `json:"vin_code" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type QCXGVJ70Req struct {
|
||||||
|
PlateNo string `json:"plate_no" validate:"required"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type QCXG2Y8XReq struct {
|
||||||
|
PlateNo string `json:"plate_no" validate:"omitempty"`
|
||||||
|
IDCard string `json:"id_card" validate:"omitempty,validIDCard"`
|
||||||
|
VinCode string `json:"vin_code" validate:"omitempty"`
|
||||||
|
}
|
||||||
|
type QCXG74YTReq struct {
|
||||||
|
PlateNo string `json:"plate_no" validate:"omitempty"`
|
||||||
|
IDCard string `json:"id_card" validate:"omitempty,validIDCard"`
|
||||||
|
VinCode string `json:"vin_code" validate:"omitempty"`
|
||||||
|
}
|
||||||
|
|||||||
@@ -229,6 +229,11 @@ func registerAllProcessors(combService *comb.CombService) {
|
|||||||
"QCXGCP77": qcxg.ProcessQCXGCP77Request, //全国车辆配置查验(车辆详情)
|
"QCXGCP77": qcxg.ProcessQCXGCP77Request, //全国车辆配置查验(车辆详情)
|
||||||
"QCXGX2X6": qcxg.ProcessQCXGX2X6Request, //行驶证信息核验V2
|
"QCXGX2X6": qcxg.ProcessQCXGX2X6Request, //行驶证信息核验V2
|
||||||
"QCXG1S2L": qcxg.ProcessQCXG1S2LRequest, //汽车车辆五项
|
"QCXG1S2L": qcxg.ProcessQCXG1S2LRequest, //汽车车辆五项
|
||||||
|
"QCXGV20O": qcxg.ProcessQCXGV20ORequest, //车VIN查询估值
|
||||||
|
"QCXGVP00": qcxg.ProcessQCXGVP00Request, //车VIN查车牌号
|
||||||
|
"QCXGVJ70": qcxg.ProcessQCXGVJ70Request, //车牌号查vin
|
||||||
|
"QCXG2Y8X": qcxg.ProcessQCXG2Y8XRequest, //商业险有效性
|
||||||
|
"QCXG74YT": qcxg.ProcessQCXG74YTRequest, //交强险有效性
|
||||||
|
|
||||||
// YYSY系列处理器
|
// YYSY系列处理器
|
||||||
"YYSY0YYV": yysy.ProcessYYSY0YYVRequest, //运营商二要素查询
|
"YYSY0YYV": yysy.ProcessYYSY0YYVRequest, //运营商二要素查询
|
||||||
|
|||||||
@@ -326,6 +326,11 @@ func (s *FormConfigServiceImpl) getDTOStruct(ctx context.Context, apiCode string
|
|||||||
"JRZQ2F4W": &dto.JRZQT2C1Req{}, //支付行为
|
"JRZQ2F4W": &dto.JRZQT2C1Req{}, //支付行为
|
||||||
"JRZQ2PV2": &dto.JRZQ2PV2Req{}, //租赁通用版v2
|
"JRZQ2PV2": &dto.JRZQ2PV2Req{}, //租赁通用版v2
|
||||||
"FLXLLD77": &dto.FLXLLD77Req{}, //劳动仲裁查询天远
|
"FLXLLD77": &dto.FLXLLD77Req{}, //劳动仲裁查询天远
|
||||||
|
"QCXGV20O": &dto.QCXGV20OReq{}, //车VIN查询估值
|
||||||
|
"QCXGVP00": &dto.QCXGVP00Req{}, //车VIN查车牌号
|
||||||
|
"QCXGVJ70": &dto.QCXGVJ70Req{}, //车牌号查vin
|
||||||
|
"QCXG2Y8X": &dto.QCXG2Y8XReq{}, //商业险有效性
|
||||||
|
"QCXG74YT": &dto.QCXG74YTReq{}, //交强险有效性
|
||||||
}
|
}
|
||||||
|
|
||||||
// 优先返回已配置的DTO
|
// 优先返回已配置的DTO
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
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/jiyi"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ProcessQCXG2Y8XRequest 商业险有效性
|
||||||
|
func ProcessQCXG2Y8XRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||||
|
var paramsDto dto.QCXG2Y8XReq
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
if paramsDto.PlateNo == "" && paramsDto.IDCard == "" && paramsDto.VinCode == "" {
|
||||||
|
return nil, errors.Join(processors.ErrInvalidParam, errors.New("plate_no、id_card、vin_code 至少需要传其中一个"))
|
||||||
|
}
|
||||||
|
|
||||||
|
body := map[string]string{
|
||||||
|
"licenseNo": paramsDto.PlateNo,
|
||||||
|
"idNo": paramsDto.IDCard,
|
||||||
|
"vin": paramsDto.VinCode,
|
||||||
|
"nonce": uuid.New().String(),
|
||||||
|
}
|
||||||
|
|
||||||
|
apiKey := "jy000019"
|
||||||
|
apiPath := "/api/v1/commercial/validity"
|
||||||
|
|
||||||
|
resp, err := deps.JiyiService.CallAPI(ctx, apiKey, apiPath, body, jiyi.DefaultCallOptions())
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, jiyi.ErrDatasource) {
|
||||||
|
return nil, errors.Join(processors.ErrDatasource, err)
|
||||||
|
}
|
||||||
|
if errors.Is(err, jiyi.ErrNotFound) {
|
||||||
|
return nil, errors.Join(processors.ErrNotFound, err)
|
||||||
|
}
|
||||||
|
return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
respBytes, err := json.Marshal(resp.Data)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return respBytes, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
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/jiyi"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ProcessQCXG74YTRequest 交强险有效性
|
||||||
|
func ProcessQCXG74YTRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||||
|
var paramsDto dto.QCXG74YTReq
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
if paramsDto.PlateNo == "" && paramsDto.IDCard == "" && paramsDto.VinCode == "" {
|
||||||
|
return nil, errors.Join(processors.ErrInvalidParam, errors.New("plate_no、id_card、vin_code 至少需要传其中一个"))
|
||||||
|
}
|
||||||
|
|
||||||
|
body := map[string]string{
|
||||||
|
"licenseNo": paramsDto.PlateNo,
|
||||||
|
"idNo": paramsDto.IDCard,
|
||||||
|
"vin": paramsDto.VinCode,
|
||||||
|
"nonce": uuid.New().String(),
|
||||||
|
}
|
||||||
|
|
||||||
|
apiKey := "jy000020"
|
||||||
|
apiPath := "/api/v1/compulsory/validity"
|
||||||
|
|
||||||
|
resp, err := deps.JiyiService.CallAPI(ctx, apiKey, apiPath, body, jiyi.DefaultCallOptions())
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, jiyi.ErrDatasource) {
|
||||||
|
return nil, errors.Join(processors.ErrDatasource, err)
|
||||||
|
}
|
||||||
|
if errors.Is(err, jiyi.ErrNotFound) {
|
||||||
|
return nil, errors.Join(processors.ErrNotFound, err)
|
||||||
|
}
|
||||||
|
return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
respBytes, err := json.Marshal(resp.Data)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return respBytes, nil
|
||||||
|
}
|
||||||
@@ -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/jiyi"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ProcessQCXGV20ORequest 车VIN查询估值
|
||||||
|
func ProcessQCXGV20ORequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||||
|
var paramsDto dto.QCXGV20OReq
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
body := map[string]string{
|
||||||
|
"vin": paramsDto.VinCode,
|
||||||
|
}
|
||||||
|
|
||||||
|
apiKey := "jy000025"
|
||||||
|
apiPath := "/api/v1/vehicle/valuation"
|
||||||
|
|
||||||
|
resp, err := deps.JiyiService.CallAPI(ctx, apiKey, apiPath, body, jiyi.DefaultCallOptions())
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, jiyi.ErrDatasource) {
|
||||||
|
return nil, errors.Join(processors.ErrDatasource, err)
|
||||||
|
}
|
||||||
|
if errors.Is(err, jiyi.ErrNotFound) {
|
||||||
|
return nil, errors.Join(processors.ErrNotFound, err)
|
||||||
|
}
|
||||||
|
return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
respBytes, err := json.Marshal(resp.Data)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return respBytes, nil
|
||||||
|
}
|
||||||
@@ -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/jiyi"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ProcessQCXGVJ70Request 车牌号查vin
|
||||||
|
func ProcessQCXGVJ70Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||||
|
var paramsDto dto.QCXGVJ70Req
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
body := map[string]string{
|
||||||
|
"plateNo": paramsDto.PlateNo,
|
||||||
|
}
|
||||||
|
|
||||||
|
apiKey := "jy000018"
|
||||||
|
apiPath := "/api/v1/car/vin"
|
||||||
|
|
||||||
|
resp, err := deps.JiyiService.CallAPI(ctx, apiKey, apiPath, body, jiyi.DefaultCallOptions())
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, jiyi.ErrDatasource) {
|
||||||
|
return nil, errors.Join(processors.ErrDatasource, err)
|
||||||
|
}
|
||||||
|
if errors.Is(err, jiyi.ErrNotFound) {
|
||||||
|
return nil, errors.Join(processors.ErrNotFound, err)
|
||||||
|
}
|
||||||
|
return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
respBytes, err := json.Marshal(resp.Data)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return respBytes, nil
|
||||||
|
}
|
||||||
@@ -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/jiyi"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ProcessQCXGVP00Request 车VIN查车牌号
|
||||||
|
func ProcessQCXGVP00Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||||
|
var paramsDto dto.QCXGVP00Req
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
body := map[string]string{
|
||||||
|
"vin": paramsDto.VinCode,
|
||||||
|
}
|
||||||
|
|
||||||
|
apiKey := "jy000028"
|
||||||
|
apiPath := "/api/v1/plateNumber/vin"
|
||||||
|
|
||||||
|
resp, err := deps.JiyiService.CallAPI(ctx, apiKey, apiPath, body, jiyi.DefaultCallOptions())
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, jiyi.ErrDatasource) {
|
||||||
|
return nil, errors.Join(processors.ErrDatasource, err)
|
||||||
|
}
|
||||||
|
if errors.Is(err, jiyi.ErrNotFound) {
|
||||||
|
return nil, errors.Join(processors.ErrNotFound, err)
|
||||||
|
}
|
||||||
|
return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
respBytes, err := json.Marshal(resp.Data)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Join(processors.ErrSystem, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return respBytes, nil
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user