This commit is contained in:
2026-04-27 18:14:07 +08:00
parent fcbd534b57
commit 20b63bde0c

View File

@@ -23,29 +23,18 @@ func ProcessJRZQ0L85Request(ctx context.Context, params []byte, deps *processors
return nil, errors.Join(processors.ErrInvalidParam, err)
}
encryptedName, err := deps.ZhichaService.Encrypt(paramsDto.Name)
if err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
encryptedIDCard, err := deps.ZhichaService.Encrypt(paramsDto.IDCard)
if err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
encryptedMobileNo, err := deps.ZhichaService.Encrypt(paramsDto.MobileNo)
if err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
md5Name := deps.ZhichaService.MD5(paramsDto.Name)
md5IDCard := deps.ZhichaService.MD5(paramsDto.IDCard)
md5MobileNo := deps.ZhichaService.MD5(paramsDto.MobileNo)
reqData := map[string]interface{}{
"name": encryptedName,
"idCard": encryptedIDCard,
"phone": encryptedMobileNo,
"name": md5Name,
"idCard": md5IDCard,
"phone": md5MobileNo,
"authorized": "1",
}
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI021", reqData)
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI084", reqData)
if err != nil {
if errors.Is(err, zhicha.ErrDatasource) {
return nil, errors.Join(processors.ErrDatasource, err)
@@ -56,9 +45,9 @@ func ProcessJRZQ0L85Request(ctx context.Context, params []byte, deps *processors
score := "-1"
if m, ok := respData.(map[string]interface{}); ok {
if raw, exists := m["xyp_cpl0081"]; exists {
if raw, exists := m["scoreafywbase"]; exists {
if v, ok := parseToFloat64(raw); ok {
score = mapXypToGeneralScore(v)
score = mapScoreAfywBaseToGeneralScore(v)
}
}
}
@@ -99,17 +88,18 @@ func parseToFloat64(v interface{}) (float64, bool) {
}
}
func mapXypToGeneralScore(xyp float64) string {
// xyp_cpl0081: 0~1值越大风险越高
// score_120_General: 300~900值越信用越好。
if xyp < 0 {
xyp = 0
func mapScoreAfywBaseToGeneralScore(scoreAfywBase float64) string {
// scoreafywbase: 300~1000分值越高违约概率越低。
// score_120_General: 300~900值越信用越好。
if scoreAfywBase < 300 {
scoreAfywBase = 300
}
if xyp > 1 {
xyp = 1
if scoreAfywBase > 1000 {
scoreAfywBase = 1000
}
score := 900 - xyp*600
// 线性映射300->300, 1000->900
score := 300 + (scoreAfywBase-300)*600/700
scoreInt := int(math.Round(score))
if scoreInt < 300 {
scoreInt = 300