From c738ec5996011f51549d18dd2ff2417e509f1399 Mon Sep 17 00:00:00 2001
From: sunty <1172534965@qq.com>
Date: 星期四, 20 八月 2020 22:25:52 +0800
Subject: [PATCH] add get person data

---
 EsClient.go |   39 +++++++++++++++++++++++++++++++--------
 1 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/EsClient.go b/EsClient.go
index 96be3c7..4e1f551 100644
--- a/EsClient.go
+++ b/EsClient.go
@@ -497,7 +497,7 @@
 	if len(buckets) == 0 {
 		return nil, nil
 	}
-	allSource := make([]map[string]interface{},0)
+	allSource := make([]map[string]interface{}, 0)
 	for _, inf := range buckets {
 		//tmpSources := make(map[string]interface{}, 0)
 		hitsSources := make([]map[string]interface{}, 0)
@@ -536,8 +536,8 @@
 					hitsSources[len(hitsSources)-1]["endTime"] = tmpTime
 					continue
 				} else {
-					if sinTime.Sub(mTime).Seconds() == 0{
-						sinTime.Add(time.Second*1)
+					if sinTime.Sub(mTime).Seconds() == 0 {
+						sinTime.Add(time.Second * 1)
 						sinTime.Format("2006-01-02 15:04:05")
 						hitsSources[len(hitsSources)-1]["endTime"] = sinTime
 					}
@@ -563,11 +563,11 @@
 			tmpHitSource["endTFacePicUrl"] = targetInfo["picSmUrl"].(string)
 			hitsSources = append(hitsSources, tmpHitSource)
 		}
-		allSource = append(allSource,hitsSources...)
-	//	tmpSources["groupKey"] = groupKey
-	//	tmpSources["doc_count"] = docCount
-	//	tmpSources["hits_sources"] = hitsSources
-	//	sources = append(sources, tmpSources)
+		allSource = append(allSource, hitsSources...)
+		//	tmpSources["groupKey"] = groupKey
+		//	tmpSources["doc_count"] = docCount
+		//	tmpSources["hits_sources"] = hitsSources
+		//	sources = append(sources, tmpSources)
 	}
 	count := len(allSource)
 	fmt.Println(count)
@@ -577,6 +577,29 @@
 	return s, nil
 }
 
+//瑙f瀽鎶撴媿搴撲汉鍛樼粨鏋�
+func PerSonAnalysis(preData []map[string]interface{}) (sources []map[string]interface{}, err error) {
+	source := make(map[string]interface{}, 0)
+	for _, key := range preData {
+		info := key
+		targetInfo := info["targetInfo"].([]interface{})[0].(map[string]interface{})
+		source["personId"] = targetInfo["belongsTargetId"].(string)
+		source["cameraId"] = info["cameraId"].(string)
+		source["cameraName"] = info["cameraName"].(string)
+		source["cameraAddr"] = info["cameraAddr"].(string)
+		source["targetScore"] = int(targetInfo["targetScore"].(float64))
+		source["personRect"] = targetInfo["targetLocation"].(map[string]interface{})
+		source["startTime"] = info["picDate"].(string)
+		pixMaxUrl := info["picMaxUrl"].([]interface{})
+		source["startBackGroundPicUrl"] = pixMaxUrl[0]
+		source["endTime"] = info["updateTime"].(string)
+		source["endBackGroundPicUrl"] = pixMaxUrl[len(pixMaxUrl)-1]
+		sources = append(sources, source)
+	}
+
+	return sources, nil
+}
+
 func Sourcelist(buf []byte) (sources []map[string]interface{}, err error) {
 	var info interface{}
 	json.Unmarshal(buf, &info)

--
Gitblit v1.8.0