fix
This commit is contained in:
@@ -298,17 +298,24 @@ type targetReport struct {
|
|||||||
|
|
||||||
// reportSummary 对应 target.json 中 reportSummary 节点
|
// reportSummary 对应 target.json 中 reportSummary 节点
|
||||||
type reportSummary struct {
|
type reportSummary struct {
|
||||||
RuleValidation summaryItem `json:"ruleValidation"`
|
RuleValidation summaryRuleValidation `json:"ruleValidation"`
|
||||||
AntiFraudScore summaryItem `json:"antiFraudScore"`
|
AntiFraudScore summaryAntiFraudScore `json:"antiFraudScore"`
|
||||||
AntiFraudRule summaryItem `json:"antiFraudRule"`
|
AntiFraudRule summaryAntiFraudRule `json:"antiFraudRule"`
|
||||||
AbnormalRulesHit abnormalHit `json:"abnormalRulesHit"`
|
AbnormalRulesHit abnormalHit `json:"abnormalRulesHit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// summaryItem 统一描述包含 code/result/level 的子项
|
type summaryRuleValidation struct {
|
||||||
type summaryItem struct {
|
|
||||||
Code string `json:"code,omitempty"`
|
Code string `json:"code,omitempty"`
|
||||||
Result string `json:"result,omitempty"`
|
Result string `json:"result,omitempty"`
|
||||||
Level string `json:"level,omitempty"`
|
}
|
||||||
|
|
||||||
|
type summaryAntiFraudScore struct {
|
||||||
|
Level string `json:"level,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type summaryAntiFraudRule struct {
|
||||||
|
Level string `json:"level,omitempty"`
|
||||||
|
Code string `json:"code,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// abnormalHit 表示异常规则汇总
|
// abnormalHit 表示异常规则汇总
|
||||||
@@ -336,17 +343,62 @@ type verificationItem struct {
|
|||||||
|
|
||||||
// riskIdentification 对应 target.json 中 riskIdentification 节点
|
// riskIdentification 对应 target.json 中 riskIdentification 节点
|
||||||
type riskIdentification struct {
|
type riskIdentification struct {
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
CaseAnnouncements announcementSection `json:"caseAnnouncements"`
|
CaseAnnouncements caseAnnouncementSection `json:"caseAnnouncements"`
|
||||||
EnforcementAnnouncements announcementSection `json:"enforcementAnnouncements"`
|
EnforcementAnnouncements enforcementAnnouncementSection `json:"enforcementAnnouncements"`
|
||||||
DishonestAnnouncements announcementSection `json:"dishonestAnnouncements"`
|
DishonestAnnouncements dishonestAnnouncementSection `json:"dishonestAnnouncements"`
|
||||||
HighConsumptionRestrictionAnn announcementSection `json:"highConsumptionRestrictionAnnouncements"`
|
HighConsumptionRestrictionAnn highRestrictionAnnouncementSection `json:"highConsumptionRestrictionAnnouncements"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// announcementSection 统一封装列表标题与记录
|
type caseAnnouncementSection struct {
|
||||||
type announcementSection struct {
|
Title string `json:"title"`
|
||||||
Title string `json:"title"`
|
Records []caseAnnouncementRecord `json:"records"`
|
||||||
Records []map[string]string `json:"records"`
|
}
|
||||||
|
|
||||||
|
type caseAnnouncementRecord struct {
|
||||||
|
CaseNumber string `json:"caseNumber"`
|
||||||
|
CaseType string `json:"caseType"`
|
||||||
|
FilingDate string `json:"filingDate"`
|
||||||
|
Authority string `json:"authority"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type enforcementAnnouncementSection struct {
|
||||||
|
Title string `json:"title"`
|
||||||
|
Records []enforcementAnnouncementRecord `json:"records"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type enforcementAnnouncementRecord struct {
|
||||||
|
CaseNumber string `json:"caseNumber"`
|
||||||
|
TargetAmount string `json:"targetAmount"`
|
||||||
|
FilingDate string `json:"filingDate"`
|
||||||
|
Court string `json:"court"`
|
||||||
|
Status string `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type dishonestAnnouncementSection struct {
|
||||||
|
Title string `json:"title"`
|
||||||
|
Records []dishonestAnnouncementRecord `json:"records"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type dishonestAnnouncementRecord struct {
|
||||||
|
DishonestPerson string `json:"dishonestPerson"`
|
||||||
|
IdCard string `json:"idCard"`
|
||||||
|
Court string `json:"court"`
|
||||||
|
FilingDate string `json:"filingDate"`
|
||||||
|
PerformanceStatus string `json:"performanceStatus"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type highRestrictionAnnouncementSection struct {
|
||||||
|
Title string `json:"title"`
|
||||||
|
Records []highRestrictionAnnouncementRecord `json:"records"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type highRestrictionAnnouncementRecord struct {
|
||||||
|
RestrictedPerson string `json:"restrictedPerson"`
|
||||||
|
IdCard string `json:"idCard"`
|
||||||
|
Court string `json:"court"`
|
||||||
|
StartDate string `json:"startDate"`
|
||||||
|
Measure string `json:"measure"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// creditAssessment 对应 target.json 中 creditAssessment 节点
|
// creditAssessment 对应 target.json 中 creditAssessment 节点
|
||||||
@@ -482,16 +534,16 @@ func buildReportSummary(ctx *sourceContext) reportSummary {
|
|||||||
const strategyCode = "STR0042314/贷前-经营性租赁全量策略"
|
const strategyCode = "STR0042314/贷前-经营性租赁全量策略"
|
||||||
|
|
||||||
summary := reportSummary{
|
summary := reportSummary{
|
||||||
RuleValidation: summaryItem{
|
RuleValidation: summaryRuleValidation{
|
||||||
Code: strategyCode,
|
Code: strategyCode,
|
||||||
Result: "未命中",
|
Result: "未命中",
|
||||||
},
|
},
|
||||||
AntiFraudScore: summaryItem{
|
AntiFraudScore: summaryAntiFraudScore{
|
||||||
Level: "未命中",
|
Level: "未命中",
|
||||||
},
|
},
|
||||||
AntiFraudRule: summaryItem{
|
AntiFraudRule: summaryAntiFraudRule{
|
||||||
Code: strategyCode,
|
|
||||||
Level: "未命中",
|
Level: "未命中",
|
||||||
|
Code: strategyCode,
|
||||||
},
|
},
|
||||||
AbnormalRulesHit: abnormalHit{
|
AbnormalRulesHit: abnormalHit{
|
||||||
Count: 0,
|
Count: 0,
|
||||||
@@ -637,21 +689,21 @@ func buildBasicInfo(ctx *sourceContext) reportBasicInfo {
|
|||||||
func buildRiskIdentification(ctx *sourceContext) riskIdentification {
|
func buildRiskIdentification(ctx *sourceContext) riskIdentification {
|
||||||
identification := riskIdentification{
|
identification := riskIdentification{
|
||||||
Title: "风险识别产品",
|
Title: "风险识别产品",
|
||||||
CaseAnnouncements: announcementSection{
|
CaseAnnouncements: caseAnnouncementSection{
|
||||||
Title: "涉案公告列表",
|
Title: "涉案公告列表",
|
||||||
Records: []map[string]string{},
|
Records: make([]caseAnnouncementRecord, 0),
|
||||||
},
|
},
|
||||||
EnforcementAnnouncements: announcementSection{
|
EnforcementAnnouncements: enforcementAnnouncementSection{
|
||||||
Title: "执行公告列表",
|
Title: "执行公告列表",
|
||||||
Records: []map[string]string{},
|
Records: make([]enforcementAnnouncementRecord, 0),
|
||||||
},
|
},
|
||||||
DishonestAnnouncements: announcementSection{
|
DishonestAnnouncements: dishonestAnnouncementSection{
|
||||||
Title: "失信公告列表",
|
Title: "失信公告列表",
|
||||||
Records: []map[string]string{},
|
Records: make([]dishonestAnnouncementRecord, 0),
|
||||||
},
|
},
|
||||||
HighConsumptionRestrictionAnn: announcementSection{
|
HighConsumptionRestrictionAnn: highRestrictionAnnouncementSection{
|
||||||
Title: "限高公告列表",
|
Title: "限高公告列表",
|
||||||
Records: []map[string]string{},
|
Records: make([]highRestrictionAnnouncementRecord, 0),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,7 +719,7 @@ func buildRiskIdentification(ctx *sourceContext) riskIdentification {
|
|||||||
baseID = ctx.BaseData.BaseInfo.IdCard
|
baseID = ctx.BaseData.BaseInfo.IdCard
|
||||||
}
|
}
|
||||||
|
|
||||||
caseRecords := make([]map[string]string, 0)
|
caseRecords := make([]caseAnnouncementRecord, 0)
|
||||||
caseRecords = append(caseRecords, convertCaseAnnouncements(stat.Civil.Cases, "民事案件")...)
|
caseRecords = append(caseRecords, convertCaseAnnouncements(stat.Civil.Cases, "民事案件")...)
|
||||||
caseRecords = append(caseRecords, convertCaseAnnouncements(stat.Criminal.Cases, "刑事案件")...)
|
caseRecords = append(caseRecords, convertCaseAnnouncements(stat.Criminal.Cases, "刑事案件")...)
|
||||||
caseRecords = append(caseRecords, convertCaseAnnouncements(stat.Administrative.Cases, "行政案件")...)
|
caseRecords = append(caseRecords, convertCaseAnnouncements(stat.Administrative.Cases, "行政案件")...)
|
||||||
@@ -1431,21 +1483,18 @@ func pickFirstFloat(contents map[string]string, keys ...string) float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// convertCaseAnnouncements 转换各类案件记录为 target 所需的涉案公告结构
|
// convertCaseAnnouncements 转换各类案件记录为 target 所需的涉案公告结构
|
||||||
func convertCaseAnnouncements(cases []judicialCase, defaultType string) []map[string]string {
|
func convertCaseAnnouncements(cases []judicialCase, defaultType string) []caseAnnouncementRecord {
|
||||||
if len(cases) == 0 {
|
records := make([]caseAnnouncementRecord, 0, len(cases))
|
||||||
return nil
|
|
||||||
}
|
|
||||||
records := make([]map[string]string, 0, len(cases))
|
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
caseType := defaultType
|
caseType := defaultType
|
||||||
if caseType == "" {
|
if caseType == "" {
|
||||||
caseType = caseTypeName(c.CaseType)
|
caseType = caseTypeName(c.CaseType)
|
||||||
}
|
}
|
||||||
record := map[string]string{
|
record := caseAnnouncementRecord{
|
||||||
"caseNumber": c.CaseNumber,
|
CaseNumber: c.CaseNumber,
|
||||||
"authority": c.Court,
|
Authority: c.Court,
|
||||||
"filingDate": c.FilingDate,
|
FilingDate: c.FilingDate,
|
||||||
"caseType": caseType,
|
CaseType: caseType,
|
||||||
}
|
}
|
||||||
records = append(records, record)
|
records = append(records, record)
|
||||||
}
|
}
|
||||||
@@ -1453,18 +1502,15 @@ func convertCaseAnnouncements(cases []judicialCase, defaultType string) []map[st
|
|||||||
}
|
}
|
||||||
|
|
||||||
// convertEnforcementAnnouncements 转换执行案件数据为执行公告列表
|
// convertEnforcementAnnouncements 转换执行案件数据为执行公告列表
|
||||||
func convertEnforcementAnnouncements(cases []judicialCase) []map[string]string {
|
func convertEnforcementAnnouncements(cases []judicialCase) []enforcementAnnouncementRecord {
|
||||||
if len(cases) == 0 {
|
records := make([]enforcementAnnouncementRecord, 0, len(cases))
|
||||||
return nil
|
|
||||||
}
|
|
||||||
records := make([]map[string]string, 0, len(cases))
|
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
record := map[string]string{
|
record := enforcementAnnouncementRecord{
|
||||||
"caseNumber": c.CaseNumber,
|
CaseNumber: c.CaseNumber,
|
||||||
"targetAmount": formatCurrencyYuan(c.ApplyAmount),
|
TargetAmount: formatCurrencyYuan(c.ApplyAmount),
|
||||||
"filingDate": c.FilingDate,
|
FilingDate: c.FilingDate,
|
||||||
"court": c.Court,
|
Court: c.Court,
|
||||||
"status": defaultIfEmpty(c.CaseStatus, "-"),
|
Status: defaultIfEmpty(c.CaseStatus, "-"),
|
||||||
}
|
}
|
||||||
records = append(records, record)
|
records = append(records, record)
|
||||||
}
|
}
|
||||||
@@ -1472,18 +1518,15 @@ func convertEnforcementAnnouncements(cases []judicialCase) []map[string]string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// convertDishonestAnnouncements 将失信记录转为失信公告列表
|
// convertDishonestAnnouncements 将失信记录转为失信公告列表
|
||||||
func convertDishonestAnnouncements(items []breachCase, name, id string) []map[string]string {
|
func convertDishonestAnnouncements(items []breachCase, name, id string) []dishonestAnnouncementRecord {
|
||||||
if len(items) == 0 {
|
records := make([]dishonestAnnouncementRecord, 0, len(items))
|
||||||
return nil
|
|
||||||
}
|
|
||||||
records := make([]map[string]string, 0, len(items))
|
|
||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
record := map[string]string{
|
record := dishonestAnnouncementRecord{
|
||||||
"dishonestPerson": name,
|
DishonestPerson: name,
|
||||||
"idCard": id,
|
IdCard: id,
|
||||||
"court": item.ExecutiveCourt,
|
Court: item.ExecutiveCourt,
|
||||||
"filingDate": defaultIfEmpty(item.FileDate, item.IssueDate),
|
FilingDate: defaultIfEmpty(item.FileDate, item.IssueDate),
|
||||||
"performanceStatus": defaultIfEmpty(item.FulfillStatus, "-"),
|
PerformanceStatus: defaultIfEmpty(item.FulfillStatus, "-"),
|
||||||
}
|
}
|
||||||
records = append(records, record)
|
records = append(records, record)
|
||||||
}
|
}
|
||||||
@@ -1491,18 +1534,15 @@ func convertDishonestAnnouncements(items []breachCase, name, id string) []map[st
|
|||||||
}
|
}
|
||||||
|
|
||||||
// convertConsumptionRestrictions 将限高记录转为限高公告列表
|
// convertConsumptionRestrictions 将限高记录转为限高公告列表
|
||||||
func convertConsumptionRestrictions(items []consumptionRestriction, name, id string) []map[string]string {
|
func convertConsumptionRestrictions(items []consumptionRestriction, name, id string) []highRestrictionAnnouncementRecord {
|
||||||
if len(items) == 0 {
|
records := make([]highRestrictionAnnouncementRecord, 0, len(items))
|
||||||
return nil
|
|
||||||
}
|
|
||||||
records := make([]map[string]string, 0, len(items))
|
|
||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
record := map[string]string{
|
record := highRestrictionAnnouncementRecord{
|
||||||
"restrictedPerson": name,
|
RestrictedPerson: name,
|
||||||
"idCard": id,
|
IdCard: id,
|
||||||
"court": item.ExecutiveCourt,
|
Court: item.ExecutiveCourt,
|
||||||
"startDate": item.IssueDate,
|
StartDate: item.IssueDate,
|
||||||
"measure": "限制高消费",
|
Measure: "限制高消费",
|
||||||
}
|
}
|
||||||
records = append(records, record)
|
records = append(records, record)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user