diff --git a/internal/domains/api/services/processors/dwbg/dwbg6a2c_map.go b/internal/domains/api/services/processors/dwbg/dwbg6a2c_map.go index 3bcdfd6..6d0c534 100644 --- a/internal/domains/api/services/processors/dwbg/dwbg6a2c_map.go +++ b/internal/domains/api/services/processors/dwbg/dwbg6a2c_map.go @@ -202,10 +202,7 @@ func parseSecurityInfoLevel(level string) map[string]interface{} { continue } switch { - case t == "A": - out["escape"] = 1 - out["icase"] = 1 - case t == "A1", t == "A2", t == "A3", t == "A4", t == "A5": + case isLevelAClass(t): out["front"] = 1 out["icase"] = 1 case t == "C3": @@ -647,6 +644,15 @@ func industryBlacklistHit(level string) bool { return false } +func isLevelAClass(token string) bool { + switch token { + case "A", "A1", "A2", "A3", "A4", "A5": + return true + default: + return false + } +} + func isLevelDClass(token string) bool { switch token { case "D", "D1", "D2", "D3", "D4", "D5": diff --git a/internal/domains/api/services/processors/dwbg/dwbg6a2c_test.go b/internal/domains/api/services/processors/dwbg/dwbg6a2c_test.go index 55c8d21..dc057f3 100644 --- a/internal/domains/api/services/processors/dwbg/dwbg6a2c_test.go +++ b/internal/domains/api/services/processors/dwbg/dwbg6a2c_test.go @@ -202,7 +202,7 @@ func TestMapYYSYH6F3StandLive(t *testing.T) { func TestParseSecurityInfoLevel(t *testing.T) { info := parseSecurityInfoLevel("A,C3") - if info["escape"] != 1 || info["front"] != 0 || info["drug"] != 1 { + if info["front"] != 1 || info["escape"] != 0 || info["drug"] != 1 { t.Fatalf("A,C3 => %+v", info) } info = parseSecurityInfoLevel("A1") @@ -373,7 +373,7 @@ func TestT2SampleJudicialAndSecurityMapping(t *testing.T) { } security := report["securityInfo"].(map[string]interface{}) - if security["escape"] != 1 || security["icase"] != 1 { + if security["front"] != 1 || security["escape"] != 0 || security["icase"] != 1 { t.Fatalf("securityInfo A => %+v", security) } if security["ikey"] != 1 { @@ -420,7 +420,7 @@ func TestT2SampleWithDataWrapper(t *testing.T) { t.Fatalf("wrapped criminalCasesCount = %v, want 4", courtInfo["criminalCasesCount"]) } security := report["securityInfo"].(map[string]interface{}) - if security["escape"] != 1 || security["ikey"] != 1 { + if security["front"] != 1 || security["escape"] != 0 || security["ikey"] != 1 { t.Fatalf("wrapped securityInfo = %+v", security) } riskList := report["riskList"].(map[string]interface{})