f
This commit is contained in:
@@ -1990,6 +1990,83 @@ func buildOverdueRiskProduct(apiData map[string]interface{}, log *zap.Logger) ma
|
||||
return overdueRiskProduct
|
||||
}
|
||||
|
||||
// formatFLXGAmountField 从 FLXG7E8F 执行案件明细中提取金额字段(n_sqzxbdje / n_sjdwje 等)
|
||||
func formatFLXGAmountField(caseMap map[string]interface{}, field string) string {
|
||||
val, exists := caseMap[field]
|
||||
if !exists || val == nil {
|
||||
return ""
|
||||
}
|
||||
switch v := val.(type) {
|
||||
case string:
|
||||
return v
|
||||
case float64:
|
||||
return strconv.FormatFloat(v, 'f', -1, 64)
|
||||
case int:
|
||||
return strconv.Itoa(v)
|
||||
case int64:
|
||||
return strconv.FormatInt(v, 10)
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// formatNumericValue 格式化 FLXG7E8F 中的数值字段(如 estimatedJudgementAmount)
|
||||
func formatNumericValue(val interface{}) string {
|
||||
if val == nil {
|
||||
return ""
|
||||
}
|
||||
switch v := val.(type) {
|
||||
case string:
|
||||
return v
|
||||
case float64:
|
||||
return strconv.FormatFloat(v, 'f', -1, 64)
|
||||
case int:
|
||||
return strconv.Itoa(v)
|
||||
case int64:
|
||||
return strconv.FormatInt(v, 10)
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
// buildImplementCaseRawIndex 按案号索引 implement.cases 原始明细(案号精确匹配)
|
||||
func buildImplementCaseRawIndex(lawsuitStat map[string]interface{}) map[string]map[string]interface{} {
|
||||
index := make(map[string]map[string]interface{})
|
||||
implement, ok := lawsuitStat["implement"].(map[string]interface{})
|
||||
if !ok {
|
||||
return index
|
||||
}
|
||||
cases, ok := implement["cases"].([]interface{})
|
||||
if !ok {
|
||||
return index
|
||||
}
|
||||
for _, item := range cases {
|
||||
caseMap, ok := item.(map[string]interface{})
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
caseNumber, ok := caseMap["c_ah"].(string)
|
||||
if !ok || caseNumber == "" {
|
||||
continue
|
||||
}
|
||||
index[caseNumber] = caseMap
|
||||
}
|
||||
return index
|
||||
}
|
||||
|
||||
// applyImplementAmountFields 用执行案件字段填充 executionAmount / repaidAmount
|
||||
func applyImplementAmountFields(caseInfo map[string]interface{}, implementCase map[string]interface{}) {
|
||||
if implementCase == nil {
|
||||
return
|
||||
}
|
||||
if amount := formatFLXGAmountField(implementCase, "n_sqzxbdje"); amount != "" {
|
||||
caseInfo["executionAmount"] = amount
|
||||
}
|
||||
if amount := formatFLXGAmountField(implementCase, "n_sjdwje"); amount != "" {
|
||||
caseInfo["repaidAmount"] = amount
|
||||
}
|
||||
}
|
||||
|
||||
// buildMultCourtInfo 构建司法风险核验产品
|
||||
func buildMultCourtInfo(apiData map[string]interface{}, log *zap.Logger) map[string]interface{} {
|
||||
multCourtInfo := make(map[string]interface{})
|
||||
@@ -2010,8 +2087,12 @@ func buildMultCourtInfo(apiData map[string]interface{}, log *zap.Logger) map[str
|
||||
if flxg7e8fMap, ok := flxg7e8fData.(map[string]interface{}); ok {
|
||||
// 获取judicial_data
|
||||
if judicialData, ok := flxg7e8fMap["judicial_data"].(map[string]interface{}); ok {
|
||||
implementIndex := make(map[string]map[string]interface{})
|
||||
|
||||
// 处理lawsuitStat
|
||||
if lawsuitStat, ok := judicialData["lawsuitStat"].(map[string]interface{}); ok {
|
||||
implementIndex = buildImplementCaseRawIndex(lawsuitStat)
|
||||
|
||||
// 收集所有涉案公告案件(民事、刑事、行政、保全、破产)- 都归到legalCases
|
||||
legalCases := make([]interface{}, 0)
|
||||
|
||||
@@ -2126,7 +2207,11 @@ func buildMultCourtInfo(apiData map[string]interface{}, log *zap.Logger) map[str
|
||||
disinCases := make([]interface{}, 0)
|
||||
for _, caseItem := range breachCaseList {
|
||||
if caseMap, ok := caseItem.(map[string]interface{}); ok {
|
||||
disinCase := convertBreachCase(caseMap)
|
||||
var linkedImplement map[string]interface{}
|
||||
if caseNumber, ok := caseMap["caseNumber"].(string); ok {
|
||||
linkedImplement = implementIndex[caseNumber]
|
||||
}
|
||||
disinCase := convertBreachCase(caseMap, linkedImplement)
|
||||
if disinCase != nil {
|
||||
disinCases = append(disinCases, disinCase)
|
||||
}
|
||||
@@ -2143,7 +2228,11 @@ func buildMultCourtInfo(apiData map[string]interface{}, log *zap.Logger) map[str
|
||||
limitCases := make([]interface{}, 0)
|
||||
for _, caseItem := range consumptionRestrictionList {
|
||||
if caseMap, ok := caseItem.(map[string]interface{}); ok {
|
||||
limitCase := convertLimitCase(caseMap)
|
||||
var linkedImplement map[string]interface{}
|
||||
if caseNumber, ok := caseMap["caseNumber"].(string); ok {
|
||||
linkedImplement = implementIndex[caseNumber]
|
||||
}
|
||||
limitCase := convertLimitCase(caseMap, linkedImplement)
|
||||
if limitCase != nil {
|
||||
limitCases = append(limitCases, limitCase)
|
||||
}
|
||||
@@ -2297,58 +2386,11 @@ func convertExecutionCase(caseMap map[string]interface{}) map[string]interface{}
|
||||
caseInfo["caseStatus"] = ""
|
||||
}
|
||||
|
||||
// 执行金额(支持字符串、数字和interface{}类型)
|
||||
var executionAmountStr string
|
||||
if nSqzxbdjeVal, exists := caseMap["n_sqzxbdje"]; exists && nSqzxbdjeVal != nil {
|
||||
switch v := nSqzxbdjeVal.(type) {
|
||||
case string:
|
||||
if v != "" {
|
||||
executionAmountStr = v
|
||||
}
|
||||
case float64:
|
||||
executionAmountStr = strconv.FormatFloat(v, 'f', -1, 64)
|
||||
case int:
|
||||
executionAmountStr = strconv.Itoa(v)
|
||||
case int64:
|
||||
executionAmountStr = strconv.FormatInt(v, 10)
|
||||
}
|
||||
}
|
||||
// 如果n_sqzxbdje没有值,尝试使用n_jabdje
|
||||
if executionAmountStr == "" {
|
||||
if nJabdjeVal, exists := caseMap["n_jabdje"]; exists && nJabdjeVal != nil {
|
||||
switch v := nJabdjeVal.(type) {
|
||||
case string:
|
||||
if v != "" {
|
||||
executionAmountStr = v
|
||||
}
|
||||
case float64:
|
||||
executionAmountStr = strconv.FormatFloat(v, 'f', -1, 64)
|
||||
case int:
|
||||
executionAmountStr = strconv.Itoa(v)
|
||||
case int64:
|
||||
executionAmountStr = strconv.FormatInt(v, 10)
|
||||
}
|
||||
}
|
||||
}
|
||||
caseInfo["executionAmount"] = executionAmountStr
|
||||
// 执行金额:申请执行标的金额 n_sqzxbdje
|
||||
caseInfo["executionAmount"] = formatFLXGAmountField(caseMap, "n_sqzxbdje")
|
||||
|
||||
// 已还款金额(从结案金额n_jabdje获取)
|
||||
var repaidAmountStr string
|
||||
if nJabdjeVal, exists := caseMap["n_jabdje"]; exists && nJabdjeVal != nil {
|
||||
switch v := nJabdjeVal.(type) {
|
||||
case string:
|
||||
if v != "" {
|
||||
repaidAmountStr = v
|
||||
}
|
||||
case float64:
|
||||
repaidAmountStr = strconv.FormatFloat(v, 'f', -1, 64)
|
||||
case int:
|
||||
repaidAmountStr = strconv.Itoa(v)
|
||||
case int64:
|
||||
repaidAmountStr = strconv.FormatInt(v, 10)
|
||||
}
|
||||
}
|
||||
caseInfo["repaidAmount"] = repaidAmountStr
|
||||
// 已还款金额:实际到位金额 n_sjdwje
|
||||
caseInfo["repaidAmount"] = formatFLXGAmountField(caseMap, "n_sjdwje")
|
||||
|
||||
// 案由
|
||||
if nLaay, ok := caseMap["n_laay"].(string); ok {
|
||||
@@ -2376,8 +2418,8 @@ func convertExecutionCase(caseMap map[string]interface{}) map[string]interface{}
|
||||
return caseInfo
|
||||
}
|
||||
|
||||
// convertBreachCase 转换失信案件
|
||||
func convertBreachCase(caseMap map[string]interface{}) map[string]interface{} {
|
||||
// convertBreachCase 转换失信案件;同案号执行明细 linkedImplement 可补充 n_sqzxbdje / n_sjdwje
|
||||
func convertBreachCase(caseMap map[string]interface{}, linkedImplement map[string]interface{}) map[string]interface{} {
|
||||
caseInfo := make(map[string]interface{})
|
||||
|
||||
// 案号
|
||||
@@ -2425,14 +2467,12 @@ func convertBreachCase(caseMap map[string]interface{}) map[string]interface{} {
|
||||
caseInfo["caseStatus"] = ""
|
||||
}
|
||||
|
||||
// 执行金额
|
||||
if estimatedJudgementAmount, ok := caseMap["estimatedJudgementAmount"].(float64); ok {
|
||||
caseInfo["executionAmount"] = strconv.FormatFloat(estimatedJudgementAmount, 'f', -1, 64)
|
||||
} else {
|
||||
caseInfo["executionAmount"] = ""
|
||||
}
|
||||
|
||||
caseInfo["repaidAmount"] = ""
|
||||
applyImplementAmountFields(caseInfo, linkedImplement)
|
||||
if caseInfo["executionAmount"] == "" {
|
||||
caseInfo["executionAmount"] = formatNumericValue(caseMap["estimatedJudgementAmount"])
|
||||
}
|
||||
|
||||
// 案由
|
||||
if obligation, ok := caseMap["obligation"].(string); ok {
|
||||
@@ -2453,8 +2493,8 @@ func convertBreachCase(caseMap map[string]interface{}) map[string]interface{} {
|
||||
return caseInfo
|
||||
}
|
||||
|
||||
// convertLimitCase 转换限高案件
|
||||
func convertLimitCase(caseMap map[string]interface{}) map[string]interface{} {
|
||||
// convertLimitCase 转换限高案件;同案号执行明细 linkedImplement 可补充 n_sqzxbdje / n_sjdwje
|
||||
func convertLimitCase(caseMap map[string]interface{}, linkedImplement map[string]interface{}) map[string]interface{} {
|
||||
caseInfo := make(map[string]interface{})
|
||||
|
||||
// 案号
|
||||
@@ -2489,6 +2529,7 @@ func convertLimitCase(caseMap map[string]interface{}) map[string]interface{} {
|
||||
caseInfo["caseStatus"] = "未结案"
|
||||
caseInfo["executionAmount"] = ""
|
||||
caseInfo["repaidAmount"] = ""
|
||||
applyImplementAmountFields(caseInfo, linkedImplement)
|
||||
caseInfo["caseReason"] = "未知"
|
||||
caseInfo["disposalMethod"] = ""
|
||||
caseInfo["judgmentResult"] = ""
|
||||
|
||||
Reference in New Issue
Block a user