Quellcode durchsuchen

map[string]string to map[string]interface

jaryhe vor 7 Monaten
Ursprung
Commit
43701474da

+ 1 - 1
apis/common.go

@@ -63,7 +63,7 @@ type CommonReply struct {
 
 type ThirdpartRequest struct {
 	Ctx             context.Context
-	Params          map[string]string
+	Params          map[string]interface{}
 	ProviderApiCode string
 	ProviderMap     map[string]MerchantProviderLimitInfo
 	RangeNo         int

+ 19 - 3
common.in/utils/conversion.go

@@ -2,7 +2,7 @@ package utils
 
 import jsoniter "github.com/json-iterator/go"
 
-func Convertion(dest map[string]string, source string) {
+func Convertion(dest map[string]interface{}, source string) {
 	s := make(map[string]string)
 	err := jsoniter.UnmarshalFromString(source, &s)
 	if err != nil {
@@ -12,9 +12,12 @@ func Convertion(dest map[string]string, source string) {
 		// TODO 字段检查是否合规
 		// 判断是否非生产环境,非生产环境检查
 		if value, ok := dest[k]; ok {
-			if value == "" {
+			if _, ok = value.(string); ok && value.(string) == "" {
 				dest[k] = v
 			}
+			/*if value == "" {
+				dest[k] = v
+			}*/
 		} else {
 			dest[k] = v
 		}
@@ -24,7 +27,7 @@ func Convertion(dest map[string]string, source string) {
 }
 
 // 覆盖
-func ConvertionCover(dest map[string]string, source string) {
+func ConvertionCover(dest map[string]interface{}, source string) {
 	s := make(map[string]string)
 	err := jsoniter.UnmarshalFromString(source, &s)
 	if err != nil {
@@ -35,3 +38,16 @@ func ConvertionCover(dest map[string]string, source string) {
 	}
 	return
 }
+
+
+func GetInterfaceString(dest map[string]interface{}, key string) string {
+	if value, ok := dest[key]; ok {
+		if ret, ok := value.(string); ok {
+			return ret
+		}
+		/*if value == "" {
+			dest[k] = v
+		}*/
+	}
+	return ""
+}

+ 1 - 1
impl/thirdparty_impl/adm/a01.go

@@ -7,7 +7,7 @@ import (
 	"github.com/tidwall/gjson"
 )
 
-func A01(req *apis.ThirdpartRequest, respMap map[string]string) error {
+func A01(req *apis.ThirdpartRequest, respMap map[string]interface{}) error {
 	req.ProviderInfo.ThirdpartApiRouter = consts.A01
 	str, err := AdmRequest(req)
 	if err != nil {

+ 1 - 1
impl/thirdparty_impl/adm/a02.go

@@ -32,7 +32,7 @@ import (
 	return nil
 }*/
 
-func A02(req *apis.ThirdpartRequest, respMap map[string]string)  error {
+func A02(req *apis.ThirdpartRequest, respMap map[string]interface{})  error {
 	req.ProviderInfo.ThirdpartApiRouter = consts.A02
 	str, err := AdmRequest(req)
 	if err != nil {

+ 2 - 2
impl/thirdparty_impl/adm/a04.go

@@ -7,9 +7,9 @@ import (
 	gutils "gd_vehicle/common.in/utils"
 )
 
-func A04(req *apis.ThirdpartRequest, respMap map[string]string)  error {
+func A04(req *apis.ThirdpartRequest, respMap map[string]interface{})  error {
 	if req.LReq.Search == ""{
-		req.LReq.Search = req.Params["vin"]
+		req.LReq.Search = gutils.GetInterfaceString(req.Params,"vin")
 	}
 	req.ProviderInfo.ThirdpartApiRouter = consts.A04
 	str, err := AdmRequest(req)

+ 1 - 1
impl/thirdparty_impl/adm/a05.go

@@ -32,7 +32,7 @@ func A05(ctx context.Context, vin string, reply map[string]string, lReqs *[]apis
 	return nil
 }*/
 
-func A05(req *apis.ThirdpartRequest, respMap map[string]string)  error  {
+func A05(req *apis.ThirdpartRequest, respMap map[string]interface{})  error  {
 	//req.LReq.Search = req.Params["vin"]
 	req.ProviderInfo.ThirdpartApiRouter = consts.A05
 	str, err := AdmRequest(req)

+ 1 - 1
impl/thirdparty_impl/adm/f01.go

@@ -7,7 +7,7 @@ import (
 	gutils "gd_vehicle/common.in/utils"
 )
 
-func F01(req *apis.ThirdpartRequest, respMap map[string]string)  error {
+func F01(req *apis.ThirdpartRequest, respMap map[string]interface{})  error {
 	req.ProviderInfo.ThirdpartApiRouter = consts.F01
 	str, err := AdmRequest(req)
 	if err != nil {

+ 1 - 1
impl/thirdparty_impl/adm/is01.go

@@ -32,7 +32,7 @@ func IS01(ctx context.Context, vin string, reply map[string]string, lReqs *[]api
 	return nil
 }*/
 
-func IS01(req *apis.ThirdpartRequest, respMap map[string]string)  error {
+func IS01(req *apis.ThirdpartRequest, respMap map[string]interface{})  error {
 	//req.LReq.Search = req.Params["vin"]
 	req.ProviderInfo.ThirdpartApiRouter = consts.IS01
 	str, err := AdmRequest(req)

+ 1 - 1
impl/thirdparty_impl/adm/u01.go

@@ -7,7 +7,7 @@ import (
 	gutils "gd_vehicle/common.in/utils"
 )
 
-func U01(req *apis.ThirdpartRequest, respMap map[string]string) error{
+func U01(req *apis.ThirdpartRequest, respMap map[string]interface{}) error{
 	req.ProviderInfo.ThirdpartApiRouter = consts.U01
 	str, err := AdmRequest(req)
 	if err != nil {

+ 1 - 1
impl/thirdparty_impl/adm/v01.go

@@ -8,7 +8,7 @@ import (
 	"github.com/tidwall/gjson"
 )
 
-func V01(req *apis.ThirdpartRequest, respMap map[string]string) error {
+func V01(req *apis.ThirdpartRequest, respMap map[string]interface{}) error {
 	//req.LReq.Search = req.Params["plate_no"]
 	req.ProviderInfo.ThirdpartApiRouter = consts.V01
 	str, err := AdmRequest(req)

+ 1 - 1
impl/thirdparty_impl/adm/v02.go

@@ -8,7 +8,7 @@ import (
 	"github.com/tidwall/gjson"
 )
 
-func V02(req *apis.ThirdpartRequest, respMap map[string]string)  error {
+func V02(req *apis.ThirdpartRequest, respMap map[string]interface{})  error {
 	//req.LReq.Search = req.Params["id_card"]
 	req.ProviderInfo.ThirdpartApiRouter = consts.V02
 	str, err := AdmRequest(req)

+ 3 - 20
impl/thirdparty_impl/cdbd/two_element_verify.go

@@ -1,28 +1,11 @@
 package cdbd
 
-import (
-	"fmt"
-	"gd_vehicle/apis"
-	"gd_vehicle/consts"
-	"gd_vehicle/errors"
-	"gd_vehicle/thirdparty"
-	dutils "gd_vehicle/utils"
-	"github.com/astaxie/beego/orm"
-	"strconv"
-	"time"
-
-	"gd_vehicle/common.in/utils"
-	"go.uber.org/zap"
-
-	"github.com/tidwall/gjson"
-)
-
+/*
 func GetCdbdTwoElementVerifyData(rdata string, respMap map[string]string) {
 	isMatch := gjson.Get(rdata, "match_result").String()
 	respMap["is_match"] = isMatch
 	if isMatch == "1" {
 		respMap["state"] = gjson.Get(rdata, "car_detail.car_state").String()
-		//respMap[""] = gjson.Get(rdata,"car_detail.reg_date").String()
 		respMap["brand_name"] = gjson.Get(rdata, "car_detail.model_name").String()
 		respMap["model_no"] = gjson.Get(rdata, "car_detail.model_type").String()
 		respMap["vehicle_type"] = gjson.Get(rdata, "car_detail.vehicle_type").String()
@@ -33,6 +16,7 @@ func GetCdbdTwoElementVerifyData(rdata string, respMap map[string]string) {
 
 func getCdbdKey(req *apis.ThirdpartRequest) string {
 	key := consts.CdbdTwoElementVerifyPre + req.Params["id_card"] + req.Params["plate_num"]
+
 	return key
 }
 
@@ -73,7 +57,6 @@ func StoreDataToMysql(owner string, data map[string]string, respData string) {
 }
 
 func TwoElementVerify(req *apis.ThirdpartRequest) (reply string, err error) {
-	//req.LReq.Search = req.Params["id_card"]
 	owner := req.Params["owner"]
 	delete(req.Params, "owner")
 
@@ -109,4 +92,4 @@ func TwoElementVerify(req *apis.ThirdpartRequest) (reply string, err error) {
 		return reply, err
 
 	}
-}
+}*/

+ 5 - 5
impl/thirdparty_impl/center.go

@@ -11,7 +11,7 @@ import (
 	//"gd_vehicle/impl/thirdparty_impl/dy"
 	//"gd_vehicle/impl/thirdparty_impl/dybd"
 	"gd_vehicle/impl/thirdparty_impl/zr"
-
+	gutils "gd_vehicle/common.in/utils"
 	//"fmt"
 	"gd_vehicle/apis"
 	"gd_vehicle/errors"
@@ -25,8 +25,8 @@ import (
 )
 
 type ThirdpartyFunc struct {
-	LocalFuc       func(req *apis.ThirdpartRequest, respMap map[string]string)  error
-	Function       func(req *apis.ThirdpartRequest, respMap map[string]string)  error
+	LocalFuc       func(req *apis.ThirdpartRequest, respMap map[string]interface{})  error
+	Function       func(req *apis.ThirdpartRequest, respMap map[string]interface{})  error
 	ExistLocalFunc bool
 	ReuseFlag      bool  // 复用标记,true表示调用后依然是复用
 	SearchKey string
@@ -68,7 +68,7 @@ func CheckProviderApiIsAvaliable(code string, providerMap map[string]apis.Mercha
 	return v, nil
 }
 
-func CallThirdparty(req *apis.ThirdpartRequest, respMap map[string]string) (err error) {
+func CallThirdparty(req *apis.ThirdpartRequest, respMap map[string]interface{}) (err error) {
 	defer func() {
 		if r := recover(); r != nil {
 			if e, ok := r.(error); ok {
@@ -106,7 +106,7 @@ func CallThirdparty(req *apis.ThirdpartRequest, respMap map[string]string) (err
 		req.LReq.RequestParams = string(params)
 		startTime := uint64(time.Now().UnixNano())
 		if v.SearchKey != ""{
-			req.LReq.Search = req.Params[v.SearchKey]
+			req.LReq.Search = gutils.GetInterfaceString(req.Params,v.SearchKey)
 		}
 		defer dutils.AppendLog(&req.Reply.LReq, req.LReq, startTime)
 		// 判断是否开启熔断

+ 4 - 17
impl/thirdparty_impl/dy/two_element_verify.go

@@ -1,19 +1,5 @@
 package dy
 
-import (
-	"gd_vehicle/apis"
-	"gd_vehicle/consts"
-	"gd_vehicle/errors"
-	"gd_vehicle/thirdparty"
-	dutils "gd_vehicle/utils"
-	"strconv"
-
-	"gd_vehicle/common.in/utils"
-	"go.uber.org/zap"
-
-	"github.com/tidwall/gjson"
-)
-
 
 /*func GetDyTwoElementVerifyData(rdata string,respMap map[string]string){
 	if rdata == "1"{
@@ -21,10 +7,11 @@ import (
 	}else if rdata == "2"{
 		respMap["is_match"] = "-1"
 	}
-}*/
+}
 
 func getDyKey(req *apis.ThirdpartRequest) string {
-	key := consts.DyTwoElementVerifyPre + req.Params["id_card"] + req.Params["name"]
+	key := req.Params["name"]
+
 	return key
 }
 
@@ -56,7 +43,6 @@ func TwoElementVerifyLocal(req *apis.ThirdpartRequest) (reply string, err error)
 }
 
 func TwoElementVerify(req *apis.ThirdpartRequest) (reply string, err error) {
-	//req.LReq.Search = req.Params["id_card"]
 	ret, err := thirdparty.DyIdentityVerifyHttpPost(req.ProviderInfo.ThirdpartHost+"/"+req.ProviderInfo.ThirdpartApiRouter, req.Params,req.ProviderInfo.Timeout)
 	if err != nil {
 		l.Error("func",
@@ -92,3 +78,4 @@ func TwoElementVerify(req *apis.ThirdpartRequest) (reply string, err error) {
 		return reply, err
 	}
 }
+*/

+ 2 - 19
impl/thirdparty_impl/dybd/two_element_verify.go

@@ -1,27 +1,10 @@
 package dybd
 
-import (
-	"gd_vehicle/apis"
-	"gd_vehicle/consts"
-	"gd_vehicle/errors"
-	"gd_vehicle/thirdparty"
-	dutils "gd_vehicle/utils"
-	"strconv"
-	"time"
-
-	"github.com/astaxie/beego/orm"
-
-	"gd_vehicle/common.in/utils"
-	"go.uber.org/zap"
-
-	"github.com/tidwall/gjson"
-)
-
+/*
 func GetDybdTwoElementVerifyData(rdata string, respMap map[string]string) {
 	arr := gjson.Parse(rdata).Array()
 	for _, v := range arr {
 		respMap["csrq"] = v.Get("csrq").String()
-		//respMap[""] = gjson.Get(rdata,"car_detail.reg_date").String()
 		respMap["xb"] = v.Get("xb").String()
 		respMap["xkzy"] = v.Get("xkzy").String()
 		respMap["xwlb"] = v.Get("xwlb").String()
@@ -91,7 +74,6 @@ func TwoElementVerify(req *apis.ThirdpartRequest) (reply string, err error) {
 		if err == nil {
 			dutils.SetAccessLogReqCodeMsgState(req.LReq, 0, "200", message, true)
 			dutils.StoreDataToRedis(getDybdTwoElementVerifyKey(req), string(ret))
-			//StoreDataToMysql(owner, req.Params, req.LReq.ResponseParams)
 		} else if err == errors.NoRecord {
 			dutils.SetAccessLogReqCodeMsgState(req.LReq, 1100, "gd_1101", message, false)
 			dutils.StoreDataToRedis(getDybdTwoElementVerifyKey(req), string(ret))
@@ -108,3 +90,4 @@ func TwoElementVerify(req *apis.ThirdpartRequest) (reply string, err error) {
 
 	}
 }
+*/

+ 3 - 11
impl/thirdparty_impl/zr/two_element_verify_guangdong.go

@@ -5,13 +5,8 @@ package zr
 
 import (
 	"fmt"
-	"gd_vehicle/apis"
 	"gd_vehicle/common.in/cache"
-	"gd_vehicle/common.in/utils"
-	"gd_vehicle/consts"
-	"gd_vehicle/errors"
 	"gd_vehicle/thirdparty"
-	dutils "gd_vehicle/utils"
 	"github.com/tidwall/gjson"
 	"go.uber.org/zap"
 )
@@ -58,7 +53,7 @@ func getZrToken(hostPath string, tryAgain bool, httpTimeout int) (string, error)
 	}
 }*/
 
-func getZrGuangdongKey(req *apis.ThirdpartRequest) string {
+/*func getZrGuangdongKey(req *apis.ThirdpartRequest) string {
 	key := consts.ZRTwoElementVerifyPre + req.Params["plateNo"] +  req.Params["plateType"] + req.Params["name"]
 	return key
 }
@@ -159,10 +154,7 @@ func TwoElementVerifyGuangdong(req *apis.ThirdpartRequest) (reply string, err er
 			dutils.SetAccessLogReqCodeMsgState(req.LReq, 1100, code, message, false)
 			dutils.StoreDataToRedis(getZrGuangdongKey(req), string(ret))
 		}else if err == errors.UserTokenExpire{
-			/*req.Times = req.Times + 1
-			if req.Times >= 3 {
-				return "", errors.VendorError
-			}*/
+
 			if !req.TryAgain {
 				req.TryAgain = true
 				return TwoElementVerifyGuangdong(req)
@@ -178,5 +170,5 @@ func TwoElementVerifyGuangdong(req *apis.ThirdpartRequest) (reply string, err er
 		}
 		return reply, err
 	}
-}
+}*/
 

+ 8 - 7
impl/thirdparty_impl/zr/two_element_verify_national.go

@@ -11,20 +11,21 @@ import (
 	dutils "gd_vehicle/utils"
 	"go.uber.org/zap"
 	"strings"
-
+	gutils "gd_vehicle/common.in/utils"
 	"github.com/tidwall/gjson"
 )
 
 
 func getZrNationalKey(req *apis.ThirdpartRequest) string {
-    key :=req.ProviderApiCode + ":" +  req.Params["plateNum"] + req.Params["name"]
+
+    key :=req.ProviderApiCode + ":" +  gutils.GetInterfaceString(req.Params,"plateNum")+ gutils.GetInterfaceString(req.Params,"name")
 	//key := consts.ZRNationalTwoElementVerifyPre + req.Params["plateNum"] + req.Params["name"]
 	return key
 }
 
 
 func getZrNationalPlateNoKey(req *apis.ThirdpartRequest) string {
-	key := req.ProviderApiCode + ":"  + req.Params["plateNum"]
+	key := req.ProviderApiCode + ":"  +gutils.GetInterfaceString(req.Params,"plateNum")
 	return key
 }
 
@@ -61,7 +62,7 @@ func paramZrNationalReturn(ret string) (reply string, err error) {
 	return "", errors.VendorError
 }
 
-func TwoElementVerifyNationalLocal(req *apis.ThirdpartRequest, respMap map[string]string)  error {
+func TwoElementVerifyNationalLocal(req *apis.ThirdpartRequest, respMap map[string]interface{})  error {
 	name := req.Params["name"]
 	localOwner, err := dutils.GetRawDataByRedis(getZrNationalPlateNoKey(req), int64(req.Req.ReuseTime))
 	if err == nil {
@@ -81,7 +82,7 @@ func TwoElementVerifyNationalLocal(req *apis.ThirdpartRequest, respMap map[strin
 	return  err
 }
 
-func TwoElementVerifyNational(req *apis.ThirdpartRequest, respMap map[string]string)  error {
+func TwoElementVerifyNational(req *apis.ThirdpartRequest, respMap map[string]interface{})  error {
 	plateNo := req.Params["plateNum"]
 	name := req.Params["name"]
 	/*plateType := req.Params["plateColor"]
@@ -96,7 +97,7 @@ func TwoElementVerifyNational(req *apis.ThirdpartRequest, respMap map[string]str
 	}
 
 
-	req.LReq.Search = plateNo
+	//req.LReq.Search = plateNo
 	token,err := getZrToken(req.ProviderInfo.ThirdpartHost,req.TryAgain,req.ProviderInfo.Timeout)
 	if err != nil{
 		l.Error("thridPart",
@@ -129,7 +130,7 @@ func TwoElementVerifyNational(req *apis.ThirdpartRequest, respMap map[string]str
 				dutils.StoreDataToRedis(getZrNationalKey(req), replyData)
 			}else {
 				// 一致存姓名
-				dutils.StoreDataToRedis(getZrNationalPlateNoKey(req), req.Params["name"])
+				dutils.StoreDataToRedis(getZrNationalPlateNoKey(req),gutils.GetInterfaceString(req.Params,"name"))
 			}
 			dutils.SetAccessLogReqCodeMsgState(req.LReq, 0, code, message, true)
 

+ 8 - 6
impl/thirdparty_impl/zr/vehicle_five.go

@@ -10,17 +10,19 @@ import (
 	"gd_vehicle/thirdparty"
 	dutils "gd_vehicle/utils"
 	"go.uber.org/zap"
-
+	gutils "gd_vehicle/common.in/utils"
 	"github.com/tidwall/gjson"
 )
 
 
+
+
 func getZrVehicleFiveKey(req *apis.ThirdpartRequest) string {
-	key := req.ProviderApiCode + ":" +  req.Params["vinOrPlateNumber"]
+	key := req.ProviderApiCode + ":" + gutils.GetInterfaceString(req.Params,"vinOrPlateNumber")
 	return key
 }
 
-func paramZrVehicleFiveData(rdata string, respMap map[string]string) {
+func paramZrVehicleFiveData(rdata string, respMap map[string]interface{}) {
 	respMap["engine_type"] = gjson.Get(rdata, "fdjxh").String()
 	respMap["engine_no"] = gjson.Get(rdata, "fdjh").String()
 	respMap["model_no"] = gjson.Get(rdata, "clxh").String()
@@ -41,7 +43,7 @@ func paramZrVehicleFiveReturn(ret string) (reply string, err error) {
 	return "", errors.VendorError
 }
 
-func  VehicleFiveNationalLocal(req *apis.ThirdpartRequest, respMap map[string]string)  error {
+func  VehicleFiveNationalLocal(req *apis.ThirdpartRequest, respMap map[string]interface{})  error {
 	rawData, err := dutils.GetRawDataByRedis(getZrVehicleFiveKey(req), int64(req.Req.ReuseTime))
 	if err == nil {
 		paramZrVehicleFiveData(rawData,respMap)
@@ -50,13 +52,13 @@ func  VehicleFiveNationalLocal(req *apis.ThirdpartRequest, respMap map[string]st
 	return  err
 }
 
-func VehicleFiveNational(req *apis.ThirdpartRequest, respMap map[string]string)  error {
+func VehicleFiveNational(req *apis.ThirdpartRequest, respMap map[string]interface{})  error {
 	plateNo := req.Params["vinOrPlateNumber"]
 	if plateNo == ""  {
 		return errors.ArgsError
 	}
 
-	req.LReq.Search = plateNo
+	//req.LReq.Search = plateNo
 	token,err := getZrToken(req.ProviderInfo.ThirdpartHost,req.TryAgain,req.ProviderInfo.Timeout)
 	if err != nil{
 		l.Error("thridPart",

+ 6 - 6
impl/thirdparty_impl/zr/vehicle_info.go

@@ -10,18 +10,18 @@ import (
 	"gd_vehicle/thirdparty"
 	dutils "gd_vehicle/utils"
 	"go.uber.org/zap"
-
+	gutils "gd_vehicle/common.in/utils"
 	"github.com/tidwall/gjson"
 )
 
 
 
 func getZrVehicleInfoKey(req *apis.ThirdpartRequest) string {
-	key := req.ProviderApiCode + ":" +  req.Params["plateNumber"]
+	key := req.ProviderApiCode + ":" +  gutils.GetInterfaceString(req.Params,"plateNumber")
 	return key
 }
 
-func paramZrVehicleInfoData(rdata string, respMap map[string]string) {
+func paramZrVehicleInfoData(rdata string, respMap map[string]interface{}) {
 	//respMap["vehicle_type_detail"] = gjson.Get(rdata, "clfl").String() // "乘用车"
 	respMap["vehicle_type_detail"] = gjson.Get(rdata, "cllb").String()  //"中型车"
 	respMap["vehicle_type"] = ""
@@ -74,7 +74,7 @@ func paramZrVehicleInfoReturn(ret string) (reply string, err error) {
 	return "", errors.VendorError
 }
 
-func  VehicleInfoNationalLocal(req *apis.ThirdpartRequest, respMap map[string]string)  error {
+func  VehicleInfoNationalLocal(req *apis.ThirdpartRequest, respMap map[string]interface{})  error {
 	rawData, err := dutils.GetRawDataByRedis(getZrVehicleInfoKey(req), int64(req.Req.ReuseTime))
 	if err == nil {
 		paramZrVehicleInfoData(rawData,respMap)
@@ -83,13 +83,13 @@ func  VehicleInfoNationalLocal(req *apis.ThirdpartRequest, respMap map[string]st
 	return  err
 }
 
-func VehicleInfoNational(req *apis.ThirdpartRequest, respMap map[string]string)  error {
+func VehicleInfoNational(req *apis.ThirdpartRequest, respMap map[string]interface{})  error {
 	plateNo := req.Params["plateNumber"]
 	if plateNo == ""  {
 		return errors.ArgsError
 	}
 
-	req.LReq.Search = plateNo
+	//req.LReq.Search = plateNo
 	token,err := getZrToken(req.ProviderInfo.ThirdpartHost,req.TryAgain,req.ProviderInfo.Timeout)
 	if err != nil{
 		l.Error("thridPart",

+ 6 - 6
impl/thirdparty_impl/zr/vehicle_vin.go

@@ -10,17 +10,17 @@ import (
 	"gd_vehicle/thirdparty"
 	dutils "gd_vehicle/utils"
 	"go.uber.org/zap"
-
+	gutils "gd_vehicle/common.in/utils"
 	"github.com/tidwall/gjson"
 )
 
 
 func getZrVehicleVinKey(req *apis.ThirdpartRequest) string {
-	key := req.ProviderApiCode + ":" +  req.Params["vinOrPlateNumber"]
+	key := req.ProviderApiCode + ":" +   gutils.GetInterfaceString(req.Params,"vinOrPlateNumber")
 	return key
 }
 
-func paramZrVehicleVinData(rdata string, respMap map[string]string) {
+func paramZrVehicleVinData(rdata string, respMap map[string]interface{}) {
 	respMap["engine_type"] = gjson.Get(rdata, "fdjxh").String()
 	respMap["engine_no"] = gjson.Get(rdata, "fdjh").String()
 	respMap["model_no"] = gjson.Get(rdata, "clxh").String()
@@ -41,7 +41,7 @@ func paramZrVehicleVinReturn(ret string) (reply string, err error) {
 	return "", errors.VendorError
 }
 
-func  VehicleVinNationalLocal(req *apis.ThirdpartRequest, respMap map[string]string)  error {
+func  VehicleVinNationalLocal(req *apis.ThirdpartRequest, respMap map[string]interface{})  error {
 	rawData, err := dutils.GetRawDataByRedis(getZrVehicleVinKey(req), int64(req.Req.ReuseTime))
 	if err == nil {
 		paramZrVehicleVinData(rawData,respMap)
@@ -50,13 +50,13 @@ func  VehicleVinNationalLocal(req *apis.ThirdpartRequest, respMap map[string]str
 	return  err
 }
 
-func VehicleVinNational(req *apis.ThirdpartRequest, respMap map[string]string)  error {
+func VehicleVinNational(req *apis.ThirdpartRequest, respMap map[string]interface{})  error {
 	plateNo := req.Params["vinOrPlateNumber"]
 	if plateNo == ""  {
 		return errors.ArgsError
 	}
 
-	req.LReq.Search = plateNo
+	//req.LReq.Search = plateNo
 	token,err := getZrToken(req.ProviderInfo.ThirdpartHost,req.TryAgain,req.ProviderInfo.Timeout)
 	if err != nil{
 		l.Error("thridPart",

+ 2 - 2
impl/vehicle/center.go

@@ -95,14 +95,14 @@ func Query(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) (e
 				// 调用F01格式化
 				tReq := &apis.ThirdpartRequest{
 					Ctx: ctx,
-					Params: reply.Data.(map[string]string),
+					Params: reply.Data.(map[string]interface{}),
 					ProviderApiCode: dutils.ADMF01,
 					ProviderMap:     req.ProviderMap,
 					RangeNo:         consts.RANGEONE,
 					Req:             req,
 					Reply:           reply,
 				}
-				respData := make(map[string]string)
+				respData := make(map[string]interface{})
 				err := thirdparty_impl.CallThirdparty(tReq,respData)
 				if err == nil {
 					reply.Data = respData

+ 28 - 20
impl/vehicle/group.go

@@ -14,7 +14,7 @@ import (
 	//"strings"
 )
 // 所有人验证组
-func ownerVerifyGroup(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply, reqData  map[string]interface{}, respData map[string]string, providerMap map[string]apis.MerchantProviderLimitInfo, group []string, rangeNo int)error {
+func ownerVerifyGroup(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply, reqData  map[string]interface{}, respData map[string]interface{}, providerMap map[string]apis.MerchantProviderLimitInfo, group []string, rangeNo int)error {
 	plateNo := dutils.GetStringParams(reqData,"plate_no")
 	plateType :=  dutils.GetStringParams(reqData,"plate_type")
 	owner := dutils.GetStringParams(reqData,"owner")
@@ -29,7 +29,7 @@ func ownerVerifyGroup(ctx context.Context, req *apis.CommonReq, reply *apis.Comm
 		}
 		switch v {
 		case utils.ADMV01:
-			tReq.Params = map[string]string{
+			tReq.Params = map[string]interface{}{
 				"owner":   owner,
 				"plate_no": plateNo,
 				"plate_type":plateType,
@@ -55,7 +55,7 @@ func ownerVerifyGroup(ctx context.Context, req *apis.CommonReq, reply *apis.Comm
 			respData["is_match"] = ret
 			return nil*/
 		case utils.ZRTWOELEMENTVERIFYNATIONAL:
-			tReq.Params = map[string]string{
+			tReq.Params = map[string]interface{}{
 				"name":   owner,
 				"plateNum": plateNo,
 				//"plateColor":plateType,
@@ -71,7 +71,7 @@ func ownerVerifyGroup(ctx context.Context, req *apis.CommonReq, reply *apis.Comm
 }
 
 // 身份验证组
-func identityVerifyGroup(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply, reqData  map[string]interface{}, respData map[string]string, providerMap map[string]apis.MerchantProviderLimitInfo, group []string, rangeNo int) error {
+func identityVerifyGroup(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply, reqData  map[string]interface{}, respData map[string]interface{}, providerMap map[string]apis.MerchantProviderLimitInfo, group []string, rangeNo int) error {
 	owner := dutils.GetStringParams(reqData,"owner")
 	idCard :=  dutils.GetStringParams(reqData,"id_card")
 	var err error
@@ -86,7 +86,7 @@ func identityVerifyGroup(ctx context.Context, req *apis.CommonReq, reply *apis.C
 		}
 		switch v {
 		case utils.ADMV02:
-			tReq.Params = map[string]string{
+			tReq.Params = map[string]interface{}{
 				"name":   owner,
 				"id_card": idCard,
 			}
@@ -157,7 +157,7 @@ func identityVerifyGroup(ctx context.Context, req *apis.CommonReq, reply *apis.C
 }
 */
 // 车牌查车档组
-func vehicleInfoByPlateGroup(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply, reqData map[string]interface{}, respData map[string]string, providerMap map[string]apis.MerchantProviderLimitInfo, group []string, rangeNo int) error {
+func vehicleInfoByPlateGroup(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply, reqData map[string]interface{}, respData map[string]interface{}, providerMap map[string]apis.MerchantProviderLimitInfo, group []string, rangeNo int) error {
 	plateNo := dutils.GetStringParams(reqData,"plate_no")
 	plateType := dutils.GetStringParams(reqData,"plate_type")
 	if plateNo == "" || plateType == ""{
@@ -177,7 +177,7 @@ func vehicleInfoByPlateGroup(ctx context.Context, req *apis.CommonReq, reply *ap
 		switch v {
 		// 车牌查车辆信息
 		case utils.ADMA04:
-			tReq.Params = map[string]string{
+			tReq.Params = map[string]interface{}{
 				"plate_no":   plateNo,
 				"plate_type":plateType,
 			}
@@ -199,7 +199,7 @@ func vehicleInfoByPlateGroup(ctx context.Context, req *apis.CommonReq, reply *ap
 
 		// 车牌查vin
 		case utils.ADMA01:
-			tReq.Params = map[string]string{
+			tReq.Params = map[string]interface{}{
 				"plate_no":   plateNo,
 				"plate_type":plateType,
 			}
@@ -210,7 +210,7 @@ func vehicleInfoByPlateGroup(ctx context.Context, req *apis.CommonReq, reply *ap
 			return nil
         // 车牌查车辆信息
 		case utils.ZRVEHICLEINFO:
-			tReq.Params = map[string]string{
+			tReq.Params = map[string]interface{}{
 				"plateNumber":   plateNo,
 			}
 			err = thirdparty_impl.CallThirdparty(tReq,respData)
@@ -220,7 +220,7 @@ func vehicleInfoByPlateGroup(ctx context.Context, req *apis.CommonReq, reply *ap
 			return nil
         // 车牌查vin
 		case utils.ZRVEHICLEVIN:
-			tReq.Params = map[string]string{
+			tReq.Params = map[string]interface{}{
 				"vinOrPlateNumber":   plateNo,
 			}
 			err = thirdparty_impl.CallThirdparty(tReq,respData)
@@ -230,7 +230,7 @@ func vehicleInfoByPlateGroup(ctx context.Context, req *apis.CommonReq, reply *ap
 			return nil
 
 		case utils.ZRVEHICLEFIVE:
-			tReq.Params = map[string]string{
+			tReq.Params = map[string]interface{}{
 				"vinOrPlateNumber":   plateNo,
 			}
 			err = thirdparty_impl.CallThirdparty(tReq,respData)
@@ -246,10 +246,10 @@ func vehicleInfoByPlateGroup(ctx context.Context, req *apis.CommonReq, reply *ap
 }
 
 // vin查车档组
-func vehicleInfoByVinGroup(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply, reqData map[string]interface{}, respData map[string]string, providerMap map[string]apis.MerchantProviderLimitInfo, group []string, rangeNo int) error {
+func vehicleInfoByVinGroup(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply, reqData map[string]interface{}, respData map[string]interface{}, providerMap map[string]apis.MerchantProviderLimitInfo, group []string, rangeNo int) error {
 	vin := dutils.GetStringParams(reqData,"vin")
 	if vin == "" {
-		vin = respData["vin"]
+		vin = dutils.GetStringParams(respData,"vin")
 	}
 
 	if vin == "" {
@@ -269,7 +269,7 @@ func vehicleInfoByVinGroup(ctx context.Context, req *apis.CommonReq, reply *apis
 		switch v {
 		// vin查车辆信息
 		case utils.ADMA05:
-			tReq.Params = map[string]string{
+			tReq.Params = map[string]interface{}{
 				"vin":   vin,
 			}
 			err = thirdparty_impl.CallThirdparty(tReq,respData)
@@ -294,7 +294,7 @@ func vehicleInfoByVinGroup(ctx context.Context, req *apis.CommonReq, reply *apis
 
 		// vin 查车牌
 		case utils.ADMA02:
-			tReq.Params = map[string]string{
+			tReq.Params = map[string]interface{}{
 				"vin":   vin,
 			}
 			err = thirdparty_impl.CallThirdparty(tReq,respData)
@@ -312,6 +312,14 @@ func vehicleInfoByVinGroup(ctx context.Context, req *apis.CommonReq, reply *apis
 	return errors.NoRecord
 }
 
+func getIsMatch(respData map[string]interface{}) string {
+	if v, ok := respData["is_match"]; ok {
+		if _, ok = v.(string); ok && v.(string) != "" {
+			return v.(string)
+		}
+	}
+	return "0"
+}
 func group(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) error {
 	reqData := req.Data.(map[string]interface{})
 	/*MerchantProviderLimitInfoList, err := utils.GetProviderInfo(req.MerchantApiInfo.MerchantChildApiId, req.BaseApiId)
@@ -321,7 +329,7 @@ func group(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) er
 
 	providerMap, providerGroup := utils.GenProviderInfoMapNew(MerchantProviderLimitInfoList)*/
 	var err error
-	respData := make(map[string]string)
+	respData := make(map[string]interface{})
 	reply.Data = respData
 	for groupNum, group := range req.ProviderGroup {
 		rangeNo := groupNum + 1
@@ -329,7 +337,7 @@ func group(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) er
 			switch  v {
 			// 人车核验组
 			case utils.ADMV01:
-				if respData["is_match"] == "-1"{
+				if getIsMatch(respData) == "-1"{
 					continue
 				}
 				err = ownerVerifyGroup(ctx,req,reply,reqData,respData,req.ProviderMap,group,rangeNo)
@@ -338,7 +346,7 @@ func group(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) er
 				}
 			// 人身核验组
 			case utils.ADMV02:
-				if respData["is_match"] == "-1"{
+				if getIsMatch(respData) == "-1"{
 					continue
 				}
 				err = identityVerifyGroup(ctx,req,reply,reqData,respData,req.ProviderMap,group,rangeNo)
@@ -347,7 +355,7 @@ func group(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) er
 				}
 			// 车牌查车辆信息组
 			case utils.ADMA01,utils.ADMA04:
-				if req.NeedVehicleInfo || respData["is_match"] == "1"{
+				if req.NeedVehicleInfo || getIsMatch(respData) == "1"{
 					err = vehicleInfoByPlateGroup(ctx,req,reply,reqData,respData,req.ProviderMap,group,rangeNo)
 					if err != nil {
 						return errors.NoRecord
@@ -355,7 +363,7 @@ func group(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) er
 				}
 			// vin查车辆信息组
 			case  utils.ADMA02,utils.ADMA05:
-				if req.NeedVehicleInfo || respData["is_match"] == "1"{
+				if req.NeedVehicleInfo || getIsMatch(respData) == "1"{
 					err = vehicleInfoByVinGroup(ctx,req,reply,reqData,respData,req.ProviderMap,group,rangeNo)
 					if err != nil {
 						return errors.NoRecord

+ 2 - 2
impl/vehicle/is001.go

@@ -27,7 +27,7 @@ func IS001(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) er
 
 	tReq := &apis.ThirdpartRequest{
 		Ctx: ctx,
-		Params: map[string]string{
+		Params: map[string]interface{}{
 			"plate_no":   plateNo,
 			"plate_type": plateType,
 			"vin":        vin,
@@ -38,7 +38,7 @@ func IS001(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) er
 		Req:             req,
 		Reply:           reply,
 	}
-	respData := make(map[string]string)
+	respData := make(map[string]interface{})
 	err := thirdparty_impl.CallThirdparty(tReq,respData)
 	if err != nil {
 		return errors.NoRecord

+ 2 - 2
impl/vehicle/v002.go

@@ -20,13 +20,13 @@ func V002(ctx context.Context, req *apis.CommonReq, reply *apis.CommonReply) err
 	plateType :=  dutils.GetStringParams(rData,"plate_type")
 	owner := dutils.GetStringParams(rData,"owner")
 
-	respData := make(map[string]string)
+	respData := make(map[string]interface{})
 	reply.Data = respData
 
 
 	tReq := &apis.ThirdpartRequest{
 		Ctx: ctx,
-		Params: map[string]string{
+		Params: map[string]interface{}{
 			"plate_no":   plateNo,
 			"plate_type": plateType,
 			"owner":      owner,

+ 1 - 1
thirdparty/zr.go

@@ -79,7 +79,7 @@ func ZrLogin(hostPath string,httpTimeout int) (body []byte, err error) {
 	return body, nil
 }
 
-func ZrHttpClient(api,token string,data map[string]string, httpTimeout int) (body []byte, err error) {
+func ZrHttpClient(api,token string,data map[string]interface{}, httpTimeout int) (body []byte, err error) {
 
 	defer func() {
 		l.Info("thirdparty",