| | |
| | | CompareThreshold: searchBody.Threshold, |
| | | } |
| | | |
| | | var hasCompEsPerson = false |
| | | if searchBody.DataBases !=nil { |
| | | for idx,tableId :=range searchBody.DataBases { |
| | | if tableId == "esData" { |
| | | searchBody.DataBases = append(searchBody.DataBases[:idx], searchBody.DataBases[idx+1:]...) |
| | | searchBody.DataBases = append(searchBody.DataBases,service.CaptureTable) |
| | | hasCompEsPerson = true |
| | | break |
| | | } |
| | | } |
| | |
| | | timeStart := time.Now() |
| | | |
| | | compareService := service.NewFaceCompareService(arg) |
| | | compareOnce := compareService.Compare() |
| | | totalData := compareOnce.CompareData |
| | | var totalData service.CompareList |
| | | if len(arg.TableIds) >0 {//有比对底库 |
| | | dbPersonTargets := compareService.CompareDbPersons() |
| | | if dbPersonTargets !=nil { |
| | | totalData = append(totalData,*dbPersonTargets...) |
| | | } |
| | | } |
| | | if hasCompEsPerson {//有比对Es抓拍 |
| | | esPersons := compareService.CompareVideoPersons() |
| | | if esPersons !=nil { |
| | | totalData = append(totalData, *esPersons...) |
| | | } |
| | | } |
| | | |
| | | logger.Debug("comp 比对结束,用时:",time.Since(timeStart)) |
| | | service.SetCompResultByNum(&service.CompareOnce{ |
| | | CompareNum: compareService.CompareNum, |
| | | CompareData: &totalData, |
| | | }) |
| | | |
| | | m := make(map[string]interface{},3) |
| | | if totalData != nil && totalData.Len() > 0{ |
| | | sort.Sort(totalData) |
| | | total := totalData.Len() |
| | | |
| | | m["compareNum"] = compareOnce.CompareNum |
| | | m["compareNum"] = compareService.CompareNum |
| | | m["total"] = total |
| | | var sCompResult protomsg.SdkCompareResult |
| | | if total <= searchBody.Size { |
| | | sCompResult.CompareResult = *totalData |
| | | sCompResult.CompareResult = totalData |
| | | } else { |
| | | sCompResult.CompareResult = (*totalData)[0:searchBody.Size] |
| | | sCompResult.CompareResult = totalData[0:searchBody.Size] |
| | | } |
| | | resultList := FillDataToCompareResult(&sCompResult) |
| | | m["totalList"] = resultList |
| | |
| | | |
| | | } else { |
| | | m["total"] = 0 |
| | | m["compareNum"] = searchBody.CompareNum |
| | | m["compareNum"] = compareService.CompareNum |
| | | m["totalList"] = []CompareResult{} |
| | | } |
| | | util.ResponseFormat(c,code.Success,m) |