add jiyi
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
"hyapi-server/internal/infrastructure/external/alicloud"
|
||||
"hyapi-server/internal/infrastructure/external/huibo"
|
||||
"hyapi-server/internal/infrastructure/external/jiguang"
|
||||
jiyiext "hyapi-server/internal/infrastructure/external/jiyi"
|
||||
"hyapi-server/internal/infrastructure/external/muzi"
|
||||
nuoerext "hyapi-server/internal/infrastructure/external/nuoer"
|
||||
"hyapi-server/internal/infrastructure/external/shujubao"
|
||||
@@ -66,6 +67,7 @@ func NewApiRequestService(
|
||||
jiguangService *jiguang.JiguangService,
|
||||
tianyuanapiService *tianyuanapi.TianyuanapiService,
|
||||
nuoerService *nuoerext.NuoerService,
|
||||
jiyiService *jiyiext.JiyiService,
|
||||
huiboService *huibo.HuiboService,
|
||||
validator interfaces.RequestValidator,
|
||||
productManagementService *services.ProductManagementService,
|
||||
@@ -83,6 +85,7 @@ func NewApiRequestService(
|
||||
jiguangService,
|
||||
tianyuanapiService,
|
||||
nuoerService,
|
||||
jiyiService,
|
||||
huiboService,
|
||||
validator,
|
||||
productManagementService,
|
||||
@@ -105,6 +108,7 @@ func NewApiRequestServiceWithRepos(
|
||||
jiguangService *jiguang.JiguangService,
|
||||
tianyuanapiService *tianyuanapi.TianyuanapiService,
|
||||
nuoerService *nuoerext.NuoerService,
|
||||
jiyiService *jiyiext.JiyiService,
|
||||
huiboService *huibo.HuiboService,
|
||||
validator interfaces.RequestValidator,
|
||||
productManagementService *services.ProductManagementService,
|
||||
@@ -133,6 +137,7 @@ func NewApiRequestServiceWithRepos(
|
||||
jiguangService,
|
||||
tianyuanapiService,
|
||||
nuoerService,
|
||||
jiyiService,
|
||||
huiboService,
|
||||
validator,
|
||||
combService,
|
||||
@@ -193,6 +198,10 @@ func registerAllProcessors(combService *comb.CombService) {
|
||||
"JRZQTH74": jrzq.ProcessJRZQTH74Request, //团伙欺诈
|
||||
"JRZQGJ99": jrzq.ProcessJRZQGJ99Request, //公积金核验
|
||||
"JRZQFC59": jrzq.ProcessJRZQFC59Request, //房产核验
|
||||
"JRZQK9P2": jrzq.ProcessJRZQK9P2Request, //洞侦1.0
|
||||
"JRZQR4N7": jrzq.ProcessJRZQR4N7Request, //借贷意向验证3.0
|
||||
"JRZQH6M3": jrzq.ProcessJRZQH6M3Request, //无间司南-纯黑A版
|
||||
"JRZQW3L8": jrzq.ProcessJRZQW3L8Request, //信用司南
|
||||
|
||||
// QYGL系列处理器
|
||||
"QYGL7HBN": qygl.ProcessQYGL7HBNRequest, //企业全景报告(聚合 QYGLUY3S/QYGLJ0Q1/QYGL5S1I)
|
||||
|
||||
@@ -312,6 +312,10 @@ func (s *FormConfigServiceImpl) getDTOStruct(ctx context.Context, apiCode string
|
||||
"JRZQTH74": &dto.JRZQTH74Req{}, //团伙欺诈
|
||||
"JRZQGJ99": &dto.JRZQGJ99Req{}, //公积金核验
|
||||
"JRZQFC59": &dto.JRZQFC59Req{}, //房产核验
|
||||
"JRZQK9P2": &dto.JRZQK9P2Req{}, //洞侦1.0
|
||||
"JRZQR4N7": &dto.JRZQR4N7Req{}, //借贷意向验证3.0
|
||||
"JRZQH6M3": &dto.JRZQH6M3Req{}, //无间司南-纯黑A版
|
||||
"JRZQW3L8": &dto.JRZQW3L8Req{}, //信用司南
|
||||
"IVYZX7J9": &dto.IVYZX7J9Req{}, //学籍核验
|
||||
"QCXG6U5G": &dto.QCXG6U5GReq{}, //车辆核验
|
||||
"QCXG7K2N": &dto.QCXG7K2NReq{}, //人车核验加强版
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"hyapi-server/internal/infrastructure/external/alicloud"
|
||||
"hyapi-server/internal/infrastructure/external/huibo"
|
||||
"hyapi-server/internal/infrastructure/external/jiguang"
|
||||
"hyapi-server/internal/infrastructure/external/jiyi"
|
||||
"hyapi-server/internal/infrastructure/external/muzi"
|
||||
"hyapi-server/internal/infrastructure/external/nuoer"
|
||||
"hyapi-server/internal/infrastructure/external/shujubao"
|
||||
@@ -43,6 +44,7 @@ type ProcessorDependencies struct {
|
||||
JiguangService *jiguang.JiguangService
|
||||
TianyuanapiService *tianyuanapi.TianyuanapiService
|
||||
NuoerService *nuoer.NuoerService
|
||||
JiyiService *jiyi.JiyiService
|
||||
HuiboService *huibo.HuiboService
|
||||
Validator interfaces.RequestValidator
|
||||
CombService CombServiceInterface // Changed to interface to break import cycle
|
||||
@@ -72,6 +74,7 @@ func NewProcessorDependencies(
|
||||
jiguangService *jiguang.JiguangService,
|
||||
tianyuanapiService *tianyuanapi.TianyuanapiService,
|
||||
nuoerService *nuoer.NuoerService,
|
||||
jiyiService *jiyi.JiyiService,
|
||||
huiboService *huibo.HuiboService,
|
||||
validator interfaces.RequestValidator,
|
||||
combService CombServiceInterface, // Changed to interface
|
||||
@@ -91,6 +94,7 @@ func NewProcessorDependencies(
|
||||
JiguangService: jiguangService,
|
||||
TianyuanapiService: tianyuanapiService,
|
||||
NuoerService: nuoerService,
|
||||
JiyiService: jiyiService,
|
||||
HuiboService: huiboService,
|
||||
Validator: validator,
|
||||
CombService: combService,
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
// ProcessJRZQH6M3Request 无间司南-纯黑A版(上游 jy000052)
|
||||
func ProcessJRZQH6M3Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||
var paramsDto dto.JRZQH6M3Req
|
||||
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{
|
||||
"name": paramsDto.Name,
|
||||
"idNo": paramsDto.IDCard,
|
||||
"mobile": paramsDto.MobileNo,
|
||||
}
|
||||
|
||||
apiKey := "jy000052"
|
||||
apiPath := "/api/v1/wujsinan/blacka"
|
||||
|
||||
resp, err := deps.JiyiService.CallAPI(ctx, apiKey, apiPath, body, jiyi.TopEncryptionOptions(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
|
||||
}
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
// ProcessJRZQK9P2Request 洞侦1.0(上游 jy000022)
|
||||
func ProcessJRZQK9P2Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||
var paramsDto dto.JRZQK9P2Req
|
||||
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{
|
||||
"name": paramsDto.Name,
|
||||
"idNo": paramsDto.IDCard,
|
||||
"mobile": paramsDto.MobileNo,
|
||||
}
|
||||
|
||||
apiKey := "jy000022"
|
||||
apiPath := "/api/v1/cave/invest"
|
||||
|
||||
resp, err := deps.JiyiService.CallAPI(ctx, apiKey, apiPath, body, jiyi.CaveInvestOptions(0))
|
||||
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,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"
|
||||
)
|
||||
|
||||
// ProcessJRZQR4N7Request 借贷意向验证3.0(上游 jy000042)
|
||||
func ProcessJRZQR4N7Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||
var paramsDto dto.JRZQR4N7Req
|
||||
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{
|
||||
"name": paramsDto.Name,
|
||||
"idNo": paramsDto.IDCard,
|
||||
"mobile": paramsDto.MobileNo,
|
||||
}
|
||||
|
||||
apiKey := "jy000042"
|
||||
apiPath := "/api/v1/loaninten/ver3"
|
||||
|
||||
resp, err := deps.JiyiService.CallAPI(ctx, apiKey, apiPath, body, jiyi.TopEncryptionOptions(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
|
||||
}
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
// ProcessJRZQW3L8Request 信用司南(上游 jy000004,查空不计费)
|
||||
func ProcessJRZQW3L8Request(ctx context.Context, params []byte, deps *processors.ProcessorDependencies) ([]byte, error) {
|
||||
var paramsDto dto.JRZQW3L8Req
|
||||
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{
|
||||
"name": paramsDto.Name,
|
||||
"idCard": paramsDto.IDCard,
|
||||
"mobile": paramsDto.MobileNo,
|
||||
}
|
||||
|
||||
apiKey := "jy000004"
|
||||
apiPath := "/api/v1/credit/panorama"
|
||||
|
||||
resp, err := deps.JiyiService.CallAPI(ctx, apiKey, apiPath, body, jiyi.TopEncryptionOptions(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
|
||||
}
|
||||
Reference in New Issue
Block a user