From fb1b6c4f3eac63ad04f48be4a1e88a372799e95f Mon Sep 17 00:00:00 2001 From: panlei <2799247126@qq.com> Date: 星期四, 12 九月 2019 14:24:13 +0800 Subject: [PATCH] 为调追踪把性别和年龄描述改为id和分值 --- insertdata/insertDataToEs.go | 98 ++++++++++++++++++++++++++----------------------- 1 files changed, 52 insertions(+), 46 deletions(-) diff --git a/insertdata/insertDataToEs.go b/insertdata/insertDataToEs.go index 5c3d630..9618bb6 100644 --- a/insertdata/insertDataToEs.go +++ b/insertdata/insertDataToEs.go @@ -9,6 +9,7 @@ "net" "ruleprocess/cache" "ruleprocess/logger" + "strconv" "time" "basic.com/pubsub/protomsg.git" @@ -206,6 +207,7 @@ } //logger.Info("================灏忓浘鍦板潃:", resp["fileUrl"].(string)) sex := "" + logger.Info(sex) if face.ThftRes.Gender == 1 { sex = "鐢�" } else { @@ -213,11 +215,14 @@ } race := getRaceString(face.ThftRes.Race) ageDescription := getDescription(face.ThftRes.Age) + logger.Info(ageDescription) esDataId := uuid.NewV4().String() linksId := "" if linkId != "" { linksId = linkId } + logger.Info("浜鸿劯鐨刬d:",strconv.FormatUint(face.Id, 10)) + logger.Info("浜鸿劯鐨勫垎鍊硷細",face.Score) pervideo := PerVideoPicture{ esDataId, msg.Cid, @@ -230,9 +235,9 @@ "", alarmRules, time.Now().Format("2006-01-02 15:04:05"), // 鍙娴嬶紝娌℃湁姣斿鏃堕棿 - sex, + strconv.FormatUint(face.Id, 10), //鏆傛敼涓轰汉鑴竔d face.ThftRes.Age, - ageDescription, + strconv.FormatFloat(face.Score, 'E', -1, 64), // 鏆傛敼涓哄垎鍊� race, face.ThftRes.Smile, face.ThftRes.Beauty, @@ -420,52 +425,53 @@ logger.Error("鏌ヨ鎽勫儚鏈轰俊鎭け璐�") } serverIp, err := GetLocalIP() + if resp["fileUrl"] != nil { + url = append(url, resp["fileUrl"].(string)) + esDataId := uuid.NewV4().String() + linksId := "" + if linkId != "" { + linksId = linkId + } + peraction := Personaction{ + esDataId, + msg.Cid, + camera.Name, + camera.Addr, + msg.Tasklab.Taskid, + msg.Tasklab.Taskname, + sdkNames, + "", + alarmRules, + localConfig.ServerId, + localConfig.ServerName, + serverIp, + "", + url, + i.Timestamp, + linksId, + "", + isAlarm, + 0, + 0, + 0, + } + requstbody, err := json.Marshal(peraction) - url = append(url, resp["fileUrl"].(string)) - esDataId := uuid.NewV4().String() - linksId := "" - if linkId != "" { - linksId = linkId - } - peraction := Personaction{ - esDataId, - msg.Cid, - camera.Name, - camera.Addr, - msg.Tasklab.Taskid, - msg.Tasklab.Taskname, - sdkNames, - "", - alarmRules, - localConfig.ServerId, - localConfig.ServerName, - serverIp, - "", - url, - i.Timestamp, - linksId, - "", - isAlarm, - 0, - 0, - 0, - } - requstbody, err := json.Marshal(peraction) + if err != nil { + logger.Info("json parse error ", err) + return - if err != nil { - logger.Info("json parse error ", err) - return - - } - resp1, err2 := EsReq("POST", personAction, requstbody) - if err2 != nil { - logger.Error("寰�ES鎻掑叆鏁版嵁澶辫触", err) - } else { - logger.Debug("鎻掑叆es杩斿洖鐨勬暟鎹俊鎭槸锛�", resp1) - // 鍙戝嚭褰曞儚淇″彿 - ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: esDataId, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, ImgId: i.Id, SdkIds: []string{}, Type: 2}) - logger.Warn("__________________________________________寰�ES鎻掑叆yolo鏁版嵁鎴愬姛") - //os.Exit(1) + } + resp1, err2 := EsReq("POST", personAction, requstbody) + if err2 != nil { + logger.Error("寰�ES鎻掑叆鏁版嵁澶辫触", err) + } else { + logger.Debug("鎻掑叆es杩斿洖鐨勬暟鎹俊鎭槸锛�", resp1) + // 鍙戝嚭褰曞儚淇″彿 + ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: esDataId, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, ImgId: i.Id, SdkIds: []string{}, Type: 2}) + logger.Warn("__________________________________________寰�ES鎻掑叆yolo鏁版嵁鎴愬姛") + //os.Exit(1) + } } } else { logger.Debug("timeLabel鏉′欢閮戒笉绗﹀悎锛�") -- Gitblit v1.8.0