This commit is contained in:
Mrx
2026-06-01 20:47:44 +08:00
parent 8ab2a6d81d
commit aed109d589
2 changed files with 46 additions and 25 deletions

View File

@@ -6,32 +6,29 @@ import (
"strings" "strings"
) )
// riskCode 位序(从左至右 1-25到 level 代码映射,见 2.md / 1.md。 // riskCode 位序(从左至右 1-25到 level 代码映射,见 1.md。
var riskCodeBitLevelMappings = map[int]string{ var riskCodeBitLevelMappings = map[int]string{
1: "A", 1: "A", // 是否 SX
2: "B2", 2: "B2", // 近5年破坏金融管理秩序
3: "B", 3: "B", // 近5年非法吸收公众存款
4: "B", 4: "B", // 近5年违法发放贷款
5: "B4", 5: "B4", // 近5年洗钱
6: "B3", 6: "B3", // 近5年金融诈骗
7: "B3", 7: "B3", // 近5年集资诈骗
8: "B3", 8: "B3", // 近5年贷款诈骗
9: "B3", 9: "B3", // 近5年信用卡诈骗
10: "B3", 10: "B3", // 近5年保险诈骗
11: "A", 11: "A", // 近5年其他 SX 案
12: "B", 12: "B", // 5年前 SX 案
13: "J", 14: "C3", // 是否 SD
14: "C3", 15: "C3", // 是否 XD
15: "C3", 16: "A", // 是否 ZT
16: "A", 17: "D4", // 是否 ZD / SK 人员
17: "D", 18: "D2", // 是否 ZD / SW 人员
18: "D4", 19: "D5", // 是否 ZD / 其他 ZD 人员
19: "D2", 20: "E", // 是否 SJTLAJ / 近5年危险驾驶
20: "D", 21: "E", // 是否 SJTLAJ / 近5年交通肇事
21: "E", 22: "E", // 是否 SJTLAJ / 5年前 SJTLAJ
22: "E",
23: "E",
24: "E",
} }
// mapNuoerIdRiskToResponse 将 nuoer 响应2json.md转为对外结构1json.md // mapNuoerIdRiskToResponse 将 nuoer 响应2json.md转为对外结构1json.md

View File

@@ -0,0 +1,24 @@
package flxg
import "testing"
func TestMapRiskCodeToLevel(t *testing.T) {
tests := []struct {
riskCode string
want string
}{
{"1000000000010000100100000", "A,B,D4,E"},
{"0000000000000000000000001", "0"},
{"1001000000010000100100000", "A,B,D4,E"},
{"0000000000000000100000000", "D4"},
{"0000000000000000010000000", "D2"},
{"0000000000000000001000000", "D5"},
{"0000000000000000000100000", "E"},
}
for _, tt := range tests {
got := mapRiskCodeToLevel(tt.riskCode)
if got != tt.want {
t.Errorf("mapRiskCodeToLevel(%q) = %q, want %q", tt.riskCode, got, tt.want)
}
}
}