This commit is contained in:
2026-07-23 13:39:55 +08:00
parent 14d96fabbe
commit 507a4fd4d4
8 changed files with 270 additions and 1 deletions

View File

@@ -1360,3 +1360,14 @@ type JRZQ0OO1Req struct {
IDCard string `json:"id_card" validate:"required,validIDCard"`
Name string `json:"name" validate:"required,min=1,validName"`
}
type JRZQT2C1Req struct {
MobileNo string `json:"mobile_no" validate:"required,min=11,max=11,validMobileNo"`
IDCard string `json:"id_card" validate:"required,validIDCard"`
Name string `json:"name" validate:"required,min=1,validName"`
}
type JRZQ2PV2Req struct {
MobileNo string `json:"mobile_no" validate:"required,min=11,max=11,validMobileNo"`
IDCard string `json:"id_card" validate:"required,validIDCard"`
}

View File

@@ -209,6 +209,11 @@ func registerAllProcessors(combService *comb.CombService) {
"JRZQW3L8": jrzq.ProcessJRZQW3L8Request, //信用司南
"JRZQP8D2": jrzq.ProcessJRZQP8D2Request, //全景雷达BH
"JRZQ0OO1": jrzq.ProcessJRZQ0OO1Request, //戎行贷后信息
"JRZQT2C1": jrzq.ProcessJRZQT2C1Request, //探针C
"JRZQT2A1": jrzq.ProcessJRZQT2A1Request, //探针A
"JRZQS74D": jrzq.ProcessJRZQS74DRequest, //申请借贷
"JRZQ2F4W": jrzq.ProcessJRZQ2F4WRequest, //支付行为
"JRZQ2PV2": jrzq.ProcessJRZQ2PV2Request, //租赁通用版v2
// QYGL系列处理器
"QYGL7HBN": qygl.ProcessQYGL7HBNRequest, //企业全景报告(聚合 QYGLUY3S/QYGLJ0Q1/QYGL5S1I

View File

@@ -320,7 +320,11 @@ func (s *FormConfigServiceImpl) getDTOStruct(ctx context.Context, apiCode string
"IVYZX7J9": &dto.IVYZX7J9Req{}, //学籍核验
"QCXG6U5G": &dto.QCXG6U5GReq{}, //车辆核验
"JRZQ0OO1": &dto.JRZQ0OO1Req{}, //戎行贷后信息 Info360
"JRZQT2C1": &dto.JRZQT2C1Req{}, //探针C
"JRZQT2A1": &dto.JRZQT2C1Req{}, //探针A
"JRZQS74D": &dto.JRZQT2C1Req{}, //申请借贷
"JRZQ2F4W": &dto.JRZQT2C1Req{}, //支付行为
"JRZQ2PV2": &dto.JRZQ2PV2Req{}, //租赁通用版v2
}
// 优先返回已配置的DTO

View File

@@ -0,0 +1,50 @@
package jrzq
import (
"context"
"encoding/json"
"errors"
"hyapi-server/internal/domains/api/dto"
"hyapi-server/internal/domains/api/services/processors"
"hyapi-server/internal/infrastructure/external/jiyi"
)
// ProcessJRZQ2F4WRequest 支付行为(上游 jy000017body encryptType=1 MD5 + timestamp
func ProcessJRZQ2F4WRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.JRZQT2C1Req
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)
}
body := map[string]string{
"name": paramsDto.Name,
"idNo": paramsDto.IDCard,
"mobile": paramsDto.MobileNo,
}
apiKey := "jy000039"
apiPath := "/api/v1/payment/index"
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
}

View File

@@ -0,0 +1,49 @@
package jrzq
import (
"context"
"encoding/json"
"errors"
"hyapi-server/internal/domains/api/dto"
"hyapi-server/internal/domains/api/services/processors"
"hyapi-server/internal/infrastructure/external/jiyi"
)
// ProcessJRZQ2PV2Request 租赁通用版v2
func ProcessJRZQ2PV2Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.JRZQ2PV2Req
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)
}
body := map[string]string{
"idNo": paramsDto.IDCard,
"mobile": paramsDto.MobileNo,
}
apiKey := "jy000049"
apiPath := "/api/v1/generlea/agreev2"
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
}

View File

@@ -0,0 +1,50 @@
package jrzq
import (
"context"
"encoding/json"
"errors"
"hyapi-server/internal/domains/api/dto"
"hyapi-server/internal/domains/api/services/processors"
"hyapi-server/internal/infrastructure/external/jiyi"
)
// ProcessJRZQS74DRequest 申请借贷(上游 jy000017body encryptType=1 MD5 + timestamp
func ProcessJRZQS74DRequest(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.JRZQT2C1Req
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)
}
body := map[string]string{
"name": paramsDto.Name,
"idNo": paramsDto.IDCard,
"mobile": paramsDto.MobileNo,
}
apiKey := "jy000048"
apiPath := "/api/v1/pd/loan/behavior"
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
}

View File

@@ -0,0 +1,50 @@
package jrzq
import (
"context"
"encoding/json"
"errors"
"hyapi-server/internal/domains/api/dto"
"hyapi-server/internal/domains/api/services/processors"
"hyapi-server/internal/infrastructure/external/jiyi"
)
// ProcessJRZQT2A1Request 探针A上游 jy000017body encryptType=1 MD5 + timestamp
func ProcessJRZQT2A1Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.JRZQT2C1Req
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)
}
body := map[string]string{
"name": jiyi.MD5Encrypt(paramsDto.Name),
"idCard": jiyi.MD5Encrypt(paramsDto.IDCard),
"mobile": jiyi.MD5Encrypt(paramsDto.MobileNo),
}
apiKey := "jy000017"
apiPath := "/api/v1/probe/a/verify/encrypt"
resp, err := deps.JiyiService.CallAPI(ctx, apiKey, apiPath, body, jiyi.CaveInvestOptions(1))
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
}

View File

@@ -0,0 +1,50 @@
package jrzq
import (
"context"
"encoding/json"
"errors"
"hyapi-server/internal/domains/api/dto"
"hyapi-server/internal/domains/api/services/processors"
"hyapi-server/internal/infrastructure/external/jiyi"
)
// ProcessJRZQT2C1Request 探针C上游 jy000008顶层 encryptionType=2 MD5
func ProcessJRZQT2C1Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
var paramsDto dto.JRZQT2C1Req
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)
}
body := map[string]string{
"name": jiyi.MD5Encrypt(paramsDto.Name),
"idCard": jiyi.MD5Encrypt(paramsDto.IDCard),
"mobile": jiyi.MD5Encrypt(paramsDto.MobileNo),
}
apiKey := "jy000008"
apiPath := "/api/v1/probe/c/verify"
resp, err := deps.JiyiService.CallAPI(ctx, apiKey, apiPath, body, jiyi.TopEncryptionOptions(2))
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
}