f
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"tyapi-server/internal/domains/api/dto"
|
||||
"tyapi-server/internal/domains/api/services/processors"
|
||||
"tyapi-server/internal/infrastructure/external/zhicha"
|
||||
"tyapi-server/internal/infrastructure/external/nuoer"
|
||||
)
|
||||
|
||||
// ProcessQYGL5S1IReq QYGL5S1I API处理方法 - 企业司法涉诉V2
|
||||
@@ -21,36 +21,33 @@ func ProcessQYGL5S1IRequest(ctx context.Context, params []byte, deps *processors
|
||||
if err := deps.Validator.ValidateStruct(paramsDto); err != nil {
|
||||
return nil, errors.Join(processors.ErrInvalidParam, err)
|
||||
}
|
||||
|
||||
encryptedEntName, err := deps.ZhichaService.Encrypt(paramsDto.EntName)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
encryptedEntCode, err := deps.ZhichaService.Encrypt(paramsDto.EntCode)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
body := map[string]string{
|
||||
"entCode": paramsDto.EntCode,
|
||||
"entName": paramsDto.EntName,
|
||||
}
|
||||
|
||||
// 按企业名称时传 enterpriseNo(加密名),按统一信用代码时传 enterpriseName(加密代码)
|
||||
reqData := map[string]interface{}{}
|
||||
if paramsDto.EntName != "" {
|
||||
reqData["enterpriseName"] = encryptedEntName
|
||||
}
|
||||
if paramsDto.EntCode != "" {
|
||||
reqData["enterpriseNo"] = encryptedEntCode
|
||||
}
|
||||
nuoerDoCheckAPIKey := "personalLawsuit_cv2"
|
||||
ApiPath := "/v1/doCheck"
|
||||
|
||||
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI088", reqData)
|
||||
resp, err := deps.NuoerService.CallAPI(ctx, nuoerDoCheckAPIKey, ApiPath, body)
|
||||
if err != nil {
|
||||
if errors.Is(err, zhicha.ErrDatasource) {
|
||||
if errors.Is(err, nuoer.ErrDatasource) {
|
||||
return nil, errors.Join(processors.ErrDatasource, err)
|
||||
} else {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
if errors.Is(err, nuoer.ErrNotFound) {
|
||||
return nil, errors.Join(processors.ErrNotFound, err)
|
||||
}
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
// 将响应数据转换为JSON字节
|
||||
respBytes, err := json.Marshal(respData)
|
||||
rawData, ok := resp.Data.(map[string]interface{})
|
||||
if !ok {
|
||||
return processors.MarshalRawResponse(resp.Data)
|
||||
}
|
||||
|
||||
result := mapQYGL5S1IToResponse(rawData, paramsDto.EntName)
|
||||
|
||||
respBytes, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,505 @@
|
||||
package qygl
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// mapQYGL5S1IToResponse 将 nuoer 响应(1.json / 1.md)转为 QYGL5S1I 对外结构(res1.json / 2.md)。
|
||||
func mapQYGL5S1IToResponse(data map[string]interface{}, entName string) map[string]interface{} {
|
||||
if data == nil {
|
||||
return defaultQYGL5S1IResponse()
|
||||
}
|
||||
if _, ok := data["entout"]; ok {
|
||||
if _, hasResult := data["result"]; !hasResult {
|
||||
return normalizeQYGL5S1IFlatResponse(data, entName)
|
||||
}
|
||||
}
|
||||
|
||||
flat := unwrapNuoerEnterpriseLawsuitData(data)
|
||||
return buildQYGL5S1IResponse(flat, entName)
|
||||
}
|
||||
|
||||
func defaultQYGL5S1IResponse() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"sxbzxr": []interface{}{},
|
||||
"xgbzxr": []interface{}{},
|
||||
"entout": defaultQYGL5S1IEntout(),
|
||||
}
|
||||
}
|
||||
|
||||
func buildQYGL5S1IResponse(flat map[string]interface{}, entName string) map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"sxbzxr": mapQYGL5S1ISxbzxr(coerceSlice(asSlice(flat["breachCaseList"]))),
|
||||
"xgbzxr": mapQYGL5S1IXgbzxr(coerceSlice(asSlice(flat["consumptionRestrictionList"])), entName),
|
||||
"entout": mapQYGL5S1IEntout(asMap(flat["lawsuitStat"])),
|
||||
}
|
||||
}
|
||||
|
||||
func coerceSlice(list []interface{}) []interface{} {
|
||||
if list == nil {
|
||||
return []interface{}{}
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
func normalizeQYGL5S1IFlatResponse(data map[string]interface{}, entName string) map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"sxbzxr": mapQYGL5S1ISxbzxr(extractQYGL5S1ISxbzxrList(data["sxbzxr"])),
|
||||
"xgbzxr": mapQYGL5S1IXgbzxr(extractQYGL5S1IXgbzxrList(data["xgbzxr"]), entName),
|
||||
"entout": mapQYGL5S1IEntout(asMap(data["entout"])),
|
||||
}
|
||||
}
|
||||
|
||||
func extractQYGL5S1ISxbzxrList(raw interface{}) []interface{} {
|
||||
switch v := raw.(type) {
|
||||
case []interface{}:
|
||||
return v
|
||||
case map[string]interface{}:
|
||||
if data := asMap(v["data"]); data != nil {
|
||||
if list := asSlice(data["sxbzxr"]); list != nil {
|
||||
return list
|
||||
}
|
||||
}
|
||||
if list := asSlice(v["sxbzxr"]); list != nil {
|
||||
return list
|
||||
}
|
||||
}
|
||||
return []interface{}{}
|
||||
}
|
||||
|
||||
func extractQYGL5S1IXgbzxrList(raw interface{}) []interface{} {
|
||||
switch v := raw.(type) {
|
||||
case []interface{}:
|
||||
return v
|
||||
case map[string]interface{}:
|
||||
if data := asMap(v["data"]); data != nil {
|
||||
if list := asSlice(data["xgbzxr"]); list != nil {
|
||||
return list
|
||||
}
|
||||
}
|
||||
if list := asSlice(v["xgbzxr"]); list != nil {
|
||||
return list
|
||||
}
|
||||
}
|
||||
return []interface{}{}
|
||||
}
|
||||
|
||||
func mapQYGL5S1ISxbzxr(items []interface{}) []interface{} {
|
||||
if len(items) == 0 {
|
||||
return []interface{}{}
|
||||
}
|
||||
out := make([]interface{}, 0, len(items))
|
||||
seen := make(map[string]struct{})
|
||||
for _, item := range items {
|
||||
m := normalizeQYGL5S1ISxbzxrItem(asMap(item))
|
||||
if len(m) == 0 {
|
||||
continue
|
||||
}
|
||||
key, _ := m["ah"].(string)
|
||||
if key == "" {
|
||||
continue
|
||||
}
|
||||
if _, ok := seen[key]; ok {
|
||||
continue
|
||||
}
|
||||
seen[key] = struct{}{}
|
||||
out = append(out, m)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func mapQYGL5S1IXgbzxr(items []interface{}, entName string) []interface{} {
|
||||
if len(items) == 0 {
|
||||
return []interface{}{}
|
||||
}
|
||||
out := make([]interface{}, 0, len(items))
|
||||
seen := make(map[string]struct{})
|
||||
for _, item := range items {
|
||||
m := normalizeQYGL5S1IXgbzxrItem(asMap(item), entName)
|
||||
if len(m) == 0 {
|
||||
continue
|
||||
}
|
||||
key, _ := m["ah"].(string)
|
||||
if key == "" {
|
||||
continue
|
||||
}
|
||||
if _, ok := seen[key]; ok {
|
||||
continue
|
||||
}
|
||||
seen[key] = struct{}{}
|
||||
out = append(out, m)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func normalizeQYGL5S1ISxbzxrItem(item map[string]interface{}) map[string]interface{} {
|
||||
if len(item) == 0 {
|
||||
return nil
|
||||
}
|
||||
out := map[string]interface{}{
|
||||
"ah": "", "entityId": "", "entityPerson": "", "fbrq": "", "larq": "",
|
||||
"lxqk": "", "pjje_gj": "", "sf": "", "xb": "", "xwqx": "", "yw": "",
|
||||
"zxfy": "", "zxyjdw": "", "zxyjwh": "",
|
||||
}
|
||||
setScalar(out, "ah", item["ah"])
|
||||
setScalar(out, "fbrq", firstOf(item["fbrq"]))
|
||||
setScalar(out, "larq", firstOf(item["larq"]))
|
||||
setScalar(out, "lxqk", firstOf(item["lxqk"]))
|
||||
setScalar(out, "sf", firstOf(item["sf"]))
|
||||
setScalar(out, "xb", firstOf(item["xb"]))
|
||||
setScalar(out, "xwqx", firstOf(item["xwqx"]))
|
||||
setScalar(out, "yw", firstOf(item["yw"]))
|
||||
setScalar(out, "zxfy", firstOf(item["zxfy"]))
|
||||
setScalar(out, "zxyjdw", firstOf(item["zxyjdw"]))
|
||||
setScalar(out, "zxyjwh", firstOf(item["zxyjwh"]))
|
||||
setScalar(out, "entityId", firstOf(item["entityId"], item["zzjgdm"]))
|
||||
setScalar(out, "entityPerson", firstOf(item["entityPerson"], item["qyfr"]))
|
||||
setScalar(out, "pjje_gj", formatPjjeGj(firstOf(item["pjje_gj"], item["pjjeGj"])))
|
||||
return out
|
||||
}
|
||||
|
||||
func normalizeQYGL5S1IXgbzxrItem(item map[string]interface{}, entName string) map[string]interface{} {
|
||||
if len(item) == 0 {
|
||||
return nil
|
||||
}
|
||||
out := map[string]interface{}{
|
||||
"ah": "", "entLegalPerson": "", "entName": "", "fbrq": "", "id": "",
|
||||
"queryId": entName, "versionYear": "", "zxfy": "",
|
||||
}
|
||||
setScalar(out, "ah", item["ah"])
|
||||
setScalar(out, "fbrq", firstOf(item["fbrq"]))
|
||||
setScalar(out, "id", firstOf(item["id"]))
|
||||
setScalar(out, "zxfy", firstOf(item["zxfy"]))
|
||||
setScalar(out, "entLegalPerson", firstOf(item["entLegalPerson"], item["qyfr"]))
|
||||
setScalar(out, "entName", firstOf(item["entName"], item["qymc"]))
|
||||
if entName != "" {
|
||||
out["queryId"] = entName
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
var qygl5s1iEntoutCategories = []string{
|
||||
"jurisdict", "preservation", "administrative", "civil", "criminal",
|
||||
"compensate", "bankrupt", "implement",
|
||||
}
|
||||
|
||||
func emptyQYGL5S1ICategory() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"cases": []interface{}{},
|
||||
"count": map[string]interface{}{},
|
||||
}
|
||||
}
|
||||
|
||||
func defaultQYGL5S1IEntout() map[string]interface{} {
|
||||
entout := map[string]interface{}{
|
||||
"cases_tree": map[string]interface{}{},
|
||||
}
|
||||
for _, key := range qygl5s1iEntoutCategories {
|
||||
entout[key] = emptyQYGL5S1ICategory()
|
||||
}
|
||||
return entout
|
||||
}
|
||||
|
||||
func mapQYGL5S1IEntout(lawsuitStat map[string]interface{}) map[string]interface{} {
|
||||
if len(lawsuitStat) == 0 {
|
||||
return defaultQYGL5S1IEntout()
|
||||
}
|
||||
|
||||
entout := make(map[string]interface{}, len(qygl5s1iEntoutCategories)+2)
|
||||
for k, v := range lawsuitStat {
|
||||
switch k {
|
||||
case "cases_tree", "crc", "has_case":
|
||||
continue
|
||||
case "count":
|
||||
entout[k] = stringifyCountMap(asMap(v))
|
||||
default:
|
||||
if isQYGL5S1IEntoutCategory(k) {
|
||||
entout[k] = normalizeQYGL5S1ICategory(asMap(v))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, key := range qygl5s1iEntoutCategories {
|
||||
if _, ok := entout[key]; !ok {
|
||||
entout[key] = emptyQYGL5S1ICategory()
|
||||
}
|
||||
}
|
||||
entout["cases_tree"] = map[string]interface{}{}
|
||||
return entout
|
||||
}
|
||||
|
||||
func isQYGL5S1IEntoutCategory(key string) bool {
|
||||
for _, k := range qygl5s1iEntoutCategories {
|
||||
if k == key {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var qygl5s1iCaseScalarFields = []string{
|
||||
"c_ah", "c_ah_hx", "c_ah_ys", "c_gkws_dsr", "c_gkws_glah", "c_gkws_id", "c_gkws_pjjg",
|
||||
"c_id", "c_slfsxx", "c_ssdy", "d_jarq", "d_larq", "n_ajbs", "n_ajjzjd", "n_ajlx",
|
||||
"n_bqqpcje", "n_bqqpcje_level", "n_ccxzxje", "n_ccxzxje_gj", "n_ccxzxje_gj_level", "n_ccxzxje_level",
|
||||
"n_crc", "n_dzzm", "n_dzzm_tree", "n_fzje", "n_fzje_level", "n_jaay", "n_jaay_tag", "n_jaay_tree",
|
||||
"n_jabdje", "n_jabdje_gj", "n_jabdje_gj_level", "n_jabdje_level", "n_jafs", "n_jbfy", "n_jbfy_cj",
|
||||
"n_laay", "n_laay_tag", "n_laay_tree", "n_pcjg", "n_pcpcje", "n_pcpcje_gj", "n_pcpcje_gj_level",
|
||||
"n_pcpcje_level", "n_pj_victory", "n_qsbdje", "n_qsbdje_gj", "n_qsbdje_gj_level", "n_qsbdje_level",
|
||||
"n_sjdwje", "n_slcx", "n_sqbqbdw", "n_sqbqse", "n_sqbqse_level", "n_sqzxbdje", "n_ssdw", "n_ssdw_ys", "n_wzxje",
|
||||
}
|
||||
|
||||
func normalizeQYGL5S1ICategory(src map[string]interface{}) map[string]interface{} {
|
||||
dst := emptyQYGL5S1ICategory()
|
||||
if len(src) == 0 {
|
||||
return dst
|
||||
}
|
||||
if v, ok := src["cases"]; ok {
|
||||
cases := asSlice(v)
|
||||
normalized := make([]interface{}, 0, len(cases))
|
||||
for _, c := range cases {
|
||||
if m := normalizeQYGL5S1ICase(asMap(c)); len(m) > 0 {
|
||||
normalized = append(normalized, m)
|
||||
}
|
||||
}
|
||||
dst["cases"] = normalized
|
||||
}
|
||||
if v, ok := src["count"]; ok {
|
||||
dst["count"] = stringifyCountMap(asMap(v))
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
func normalizeQYGL5S1ICase(src map[string]interface{}) map[string]interface{} {
|
||||
if len(src) == 0 {
|
||||
return nil
|
||||
}
|
||||
out := make(map[string]interface{}, len(qygl5s1iCaseScalarFields)+1)
|
||||
for _, key := range qygl5s1iCaseScalarFields {
|
||||
out[key] = ""
|
||||
}
|
||||
for k, v := range src {
|
||||
if k == "c_dsrxx" {
|
||||
out[k] = v
|
||||
continue
|
||||
}
|
||||
for _, field := range qygl5s1iCaseScalarFields {
|
||||
if k == field {
|
||||
out[k] = stringifyScalar(v)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if _, ok := out["c_dsrxx"]; !ok {
|
||||
if v, ok := src["c_dsrxx"]; ok {
|
||||
out["c_dsrxx"] = v
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func stringifyCountMap(src map[string]interface{}) map[string]interface{} {
|
||||
if len(src) == 0 {
|
||||
return map[string]interface{}{}
|
||||
}
|
||||
dst := make(map[string]interface{}, len(src))
|
||||
for k, v := range src {
|
||||
dst[k] = stringifyScalar(v)
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
func stringifyScalar(v interface{}) string {
|
||||
if v == nil {
|
||||
return ""
|
||||
}
|
||||
switch val := v.(type) {
|
||||
case string:
|
||||
return val
|
||||
case float64:
|
||||
if val == float64(int64(val)) {
|
||||
return strconv.FormatInt(int64(val), 10)
|
||||
}
|
||||
return strconv.FormatFloat(val, 'f', -1, 64)
|
||||
case int:
|
||||
return strconv.Itoa(val)
|
||||
case int64:
|
||||
return strconv.FormatInt(val, 10)
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func formatPjjeGj(v interface{}) string {
|
||||
s := stringifyScalar(v)
|
||||
if s == "" {
|
||||
return ""
|
||||
}
|
||||
if i := strings.IndexByte(s, '.'); i >= 0 {
|
||||
return s[:i]
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func setScalar(dst map[string]interface{}, key string, v interface{}) {
|
||||
dst[key] = stringifyScalar(v)
|
||||
}
|
||||
|
||||
func firstOf(values ...interface{}) interface{} {
|
||||
for _, v := range values {
|
||||
if v == nil {
|
||||
continue
|
||||
}
|
||||
if s, ok := v.(string); ok && s == "" {
|
||||
continue
|
||||
}
|
||||
return v
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// unwrapNuoerEnterpriseLawsuitData 解包 nuoer result.detail[],提取 lawsuitStat / breachCaseList / consumptionRestrictionList。
|
||||
func unwrapNuoerEnterpriseLawsuitData(data map[string]interface{}) map[string]interface{} {
|
||||
if _, ok := data["lawsuitStat"]; ok {
|
||||
return data
|
||||
}
|
||||
if result, ok := data["result"].(map[string]interface{}); ok {
|
||||
for _, item := range asSlice(result["detail"]) {
|
||||
if flat := extractQYGL5S1IDetailItem(asMap(item)); len(flat) > 0 {
|
||||
return flat
|
||||
}
|
||||
}
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
func extractQYGL5S1IDetailItem(item map[string]interface{}) map[string]interface{} {
|
||||
if len(item) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
lawsuitStat := extractQYGL5S1ILawsuitStat(item)
|
||||
if !isQYGL5S1ILawsuitStatPayload(asMap(lawsuitStat)) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return map[string]interface{}{
|
||||
"lawsuitStat": lawsuitStat,
|
||||
"breachCaseList": extractQYGL5S1IBreachCaseRecords(item),
|
||||
"consumptionRestrictionList": extractQYGL5S1IConsumptionRestrictionRecords(item),
|
||||
}
|
||||
}
|
||||
|
||||
func extractQYGL5S1ILawsuitStat(item map[string]interface{}) interface{} {
|
||||
for _, v := range asSlice(item["breachCaseList"]) {
|
||||
if m := asMap(v); m != nil {
|
||||
if ls := asMap(m["lawsuitStat"]); isQYGL5S1ILawsuitStatPayload(ls) {
|
||||
return ls
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, v := range asSlice(item["consumptionRestrictionList"]) {
|
||||
if m := asMap(v); m != nil {
|
||||
if ls := asMap(m["lawsuitStat"]); isQYGL5S1ILawsuitStatPayload(ls) {
|
||||
return ls
|
||||
}
|
||||
}
|
||||
}
|
||||
if lsWrap := asMap(item["lawsuitStat"]); lsWrap != nil {
|
||||
if ls := extractQYGL5S1ILawsuitStatFromWrapper(lsWrap); ls != nil {
|
||||
return ls
|
||||
}
|
||||
}
|
||||
return map[string]interface{}{}
|
||||
}
|
||||
|
||||
func extractQYGL5S1ILawsuitStatFromWrapper(wrap map[string]interface{}) map[string]interface{} {
|
||||
if isQYGL5S1ILawsuitStatPayload(wrap) {
|
||||
return wrap
|
||||
}
|
||||
for _, v := range asSlice(wrap["detail"]) {
|
||||
if m := asMap(v); m != nil {
|
||||
if ls := asMap(m["lawsuitStat"]); isQYGL5S1ILawsuitStatPayload(ls) {
|
||||
return ls
|
||||
}
|
||||
if isQYGL5S1ILawsuitStatPayload(m) {
|
||||
return m
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func isQYGL5S1ILawsuitStatPayload(m map[string]interface{}) bool {
|
||||
if len(m) == 0 {
|
||||
return false
|
||||
}
|
||||
keys := []string{
|
||||
"criminal", "civil", "administrative", "cases_tree", "count", "crc",
|
||||
"implement", "preservation", "bankrupt", "jurisdict", "compensate",
|
||||
}
|
||||
for _, k := range keys {
|
||||
if _, ok := m[k]; ok {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func extractQYGL5S1IBreachCaseRecords(item map[string]interface{}) []interface{} {
|
||||
out := make([]interface{}, 0)
|
||||
collectQYGL5S1IBreachCaseRecords(asSlice(item["breachCaseList"]), &out)
|
||||
if lsWrap := asMap(item["lawsuitStat"]); lsWrap != nil {
|
||||
for _, v := range asSlice(lsWrap["detail"]) {
|
||||
collectQYGL5S1IBreachCaseRecords(asSlice(asMap(v)["breachCaseList"]), &out)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func collectQYGL5S1IBreachCaseRecords(list []interface{}, out *[]interface{}) {
|
||||
for _, v := range list {
|
||||
m := asMap(v)
|
||||
if len(m) == 0 {
|
||||
continue
|
||||
}
|
||||
if _, isWrapper := m["lawsuitStat"]; isWrapper {
|
||||
if inner := asSlice(m["breachCaseList"]); len(inner) > 0 {
|
||||
collectQYGL5S1IBreachCaseRecords(inner, out)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if _, hasAh := m["ah"]; hasAh {
|
||||
*out = append(*out, m)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func extractQYGL5S1IConsumptionRestrictionRecords(item map[string]interface{}) []interface{} {
|
||||
out := make([]interface{}, 0)
|
||||
collectQYGL5S1IConsumptionRestrictionRecords(asSlice(item["consumptionRestrictionList"]), &out)
|
||||
if lsWrap := asMap(item["lawsuitStat"]); lsWrap != nil {
|
||||
for _, v := range asSlice(lsWrap["detail"]) {
|
||||
collectQYGL5S1IConsumptionRestrictionRecords(asSlice(asMap(v)["consumptionRestrictionList"]), &out)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func collectQYGL5S1IConsumptionRestrictionRecords(list []interface{}, out *[]interface{}) {
|
||||
for _, v := range list {
|
||||
m := asMap(v)
|
||||
if len(m) == 0 {
|
||||
continue
|
||||
}
|
||||
if _, isWrapper := m["lawsuitStat"]; isWrapper {
|
||||
if inner := asSlice(m["consumptionRestrictionList"]); len(inner) > 0 {
|
||||
collectQYGL5S1IConsumptionRestrictionRecords(inner, out)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if _, hasAh := m["ah"]; hasAh {
|
||||
*out = append(*out, m)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user