From 2c9e82adc057f330d7c56be04c4333dae92cfd5c Mon Sep 17 00:00:00 2001 From: sunty <1172534965@qq.com> Date: 星期五, 26 七月 2019 19:08:47 +0800 Subject: [PATCH] add Videopersonsinfosbyid --- EsClient.go | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 151 insertions(+), 0 deletions(-) diff --git a/EsClient.go b/EsClient.go index 9972c13..851c42c 100644 --- a/EsClient.go +++ b/EsClient.go @@ -53,6 +53,157 @@ } return } + +//瑙f瀽鎶撴媿搴撲汉鍛樼粨鏋� +func Videopersonsbyid(sources []map[string]interface{}) (tmpinfos []protomsg.Videopersons) { + var ok bool + + var tmpinfo protomsg.Videopersons + for _, source := range sources{ + tmpinfo.Id, ok = source["id"].(string) + if !ok { + continue + } + + tmpinfo.CameraId, ok = source["cameraId"].(string) + if !ok { + continue + } + + tmpinfo.CameraAddr, ok = source["cameraAddr"].(string) + if !ok { + continue + } + + tmpinfo.PicDate,ok = source["picDate"].(string) + Isnil("picDate", ok) + tmpinfo.PicMaxUrl,ok = source["picMaxUrl"].(string) + Isnil("picMaxUrl", ok) + tmpinfo.TaskId,ok = source["taskId"].(string) + Isnil("taskId", ok) + tmpinfo.TaskName,ok = source["taskName"].(string) + Isnil("taskName", ok) + tmpinfo.SdkName,ok = source["sdkName"].(string) + Isnil("sdkName", ok) + tmpinfo.Content,ok = source["content"].(string) + Isnil("content",ok) + tmpinfo.LikeDate,ok = source["likeDate"].(string) + Isnil("likeDate",ok) + tmpinfo.DetectScore,ok = source["detectScore"].(string) + Isnil("detectScore", ok) + tmpinfo.Sex,ok = source["sex"].(string) + Isnil("sex",ok) + + age,ok := source["age"].(float64) + if ok { + tmpinfo.Age= int32(age) + } + Isnil("age", ok) + + tmpinfo.AgeDescription,ok = source["ageDescription"].(string) + Isnil("ageDescription",ok) + tmpinfo.Race,ok = source["race"].(string) + Isnil("race",ok) + tmpinfo.SmileLevel,ok = source["smileLevel"].(string) + Isnil("smileLevel",ok) + tmpinfo.BeautyLevel,ok = source["beautyLevel"].(string) + Isnil("beautyLevel",ok) + tmpinfo.PicSmUrl,ok = source["picSmUrl"].(string) + Isnil("picSmUrl",ok) + tmpinfo.VideoUrl,ok = source["videoUrl"].(string) + Isnil("videoUrl",ok) + tmpinfo.AnalyServerId,ok = source["analyServerId"].(string) + Isnil("analyServerId",ok) + tmpinfo.AnalyServerName,ok = source["analyServerName"].(string) + Isnil("analyServerName",ok) + tmpinfo.AnalyServerIp,ok = source["analyServerIp"].(string) + Isnil("analyServerIp",ok) + tmpinfo.ClusterId,ok = source["clusterId"].(string) + Isnil("clusterId",ok) + tmpinfo.IsAlarm,ok = source["isAlarm"].(string) + Isnil("isAlarm",ok) + tmpinfo.IsAckAlarm,ok = source["isAckAlarm"].(string) + Isnil("isAckAlarm",ok) + + isCollect,ok := source["isCollect"].(float64) + if ok { + tmpinfo.IsDelete= int32(isCollect) + } + Isnil("isDelete", ok) + isDelete,ok := source["isDelete"].(float64) + if ok { + tmpinfo.IsDelete= int32(isDelete) + } + Isnil("isDelete", ok) + if source["alarmRules"] != nil { + fmt.Println(source["alarmRules"]) + for _,v := range source["alarmRules"].([]interface{}) { + m := v.(map[string]interface{}) + ar := protomsg.AlarmRules{} + ar.GroupId,ok = m["groupId"].(string) + Isnil("groupId",ok) + ar.AlarmLevel,ok = m["alarmLevel"].(string) + Isnil("alarmLevel",ok) + ar.RuleText,ok = m["ruleText"].(string) + Isnil("ruleText",ok) + ar.DefenceState,ok = m["defenceState"].(bool) + Isnil("DefenceState",ok) + tmpinfo.AlarmRules = append( tmpinfo.AlarmRules, &ar) + } + + } + if source["baseInfo"] != nil { + fmt.Println(source["baseInfo"]) + for _,v := range source["baseInfo"].([]interface{}) { + m := v.(map[string]interface{}) + fmt.Println("m:",m) + bi := protomsg.BaseInfo{} + bi.TableId,ok = m["tableId"].(string) + Isnil("tableId",ok) + bi.TableName,ok = m["tableName"].(string) + Isnil("tableName",ok) + compareScore,ok := m["compareScore"].(float64) + if ok { + bi.CompareScore= float32(compareScore) + } + Isnil("compareScore", ok) + + bi.PersonId,ok = m["personId"].(string) + Isnil("personId",ok) + bi.PersonName,ok = m["personName"].(string) + Isnil("personName",ok) + bi.PersonPicUrl,ok = m["personPicUrl"].(string) + Isnil("personPicUrl",ok) + bi.PhoneNum,ok = m["phoneNum"].(string) + Isnil("phoneNum",ok) + bi.Sex,ok = m["sex"].(string) + Isnil("sex",ok) + bi.IdCard,ok = m["idCard"].(string) + Isnil("idCard",ok) + bi.MonitorLevel,ok = m["monitorLevel"].(string) + Isnil("monitorLevel",ok) + bi.Content,ok = m["content"].(string) + Isnil("content",ok) + bwType,ok := m["bwType"].(float64) + if ok { + bi.BwType= int32(bwType) + } + Isnil("bwType", ok) + + tmpinfo.BaseInfo = append(tmpinfo.BaseInfo, &bi) + } + + } + + //鏍规嵁 tableid 鑾峰彇 tablename + //name, _:= Dbtablename(tmpinfo.TableId) + //tmpinfo.TableName= name + tmpinfos = append(tmpinfos, tmpinfo) + } + + return tmpinfos +} + //瑙f瀽搴曞簱浜哄憳缁撴瀯 func Dbpersonbyid(sources []map[string]interface{}) (tmpinfos []protomsg.Dbperson) { var ok bool -- Gitblit v1.8.0