---
panlei
2019-11-19 af45035c0d893c3bbe7b1076b2bbc433755f36c5
insertdata/insertDataToEs.go
@@ -97,7 +97,7 @@
type Target struct {
   TargetId       string  `json:"targetId"`
   TargetScore    float64 `json:"targetScore"`
   FaceFeature    string  `json:"feature"`
   Feature        string  `json:"feature"`
   PicSmUrl       string  `json:"picSmUrl"`
   TargetLocation Points  `json:"targetLocation"`
}
@@ -111,33 +111,6 @@
   X float64 `json:"x"`
   Y float64 `json:"y"`
}
//  yolo行为的数据结构
//type Personaction struct {
//   Id              string      `json:"id"`
//   CameraId        string      `json:"cameraId"`
//   CameraName      string      `json:"cameraName"`
//   CameraAddr      string      `json:"cameraAddr"`
//   TaskId          string      `json:"taskId"`
//   TaskName        string      `json:"taskName"`
//   SdkName         string      `json:"sdkName"`
//   Content         string      `json:"content"`
//   AlarmRules      []AlarmRule `json:"alarmRules"`
//   AnalyServerId   string      `json:"analyServerId"`
//   AnalyServerName string      `json:"analyServerName"`
//   AnalyServerIp   string      `json:"analyServerIp"`
//   ClusterId       string      `json:"clusterId"`
//   PicSmUrl        []string    `json:"picSmUrl"`
//   PicDate         string      `json:"picDate"`
//   VideoUrl        string      `json:"videoUrl"`
//   IsAlarm         int         `json:"isAlarm"`
//   IsAckAlarm      int         `json:"isAckAlarm"`
//   IsCollect       int         `json:"isCollect"`
//   IsDelete        int         `json:"isDelete"`
//   TargetInfo      []Target    `json:"targetInfo"`
//   LinkTag         string      `json:"linkTag"`
//   LinkTagInfo     []*LinkInfo `json:"linkTagInfo"`
//}
type AlarmRule struct {
   GroupId      string `json:"groupId"`
@@ -154,11 +127,11 @@
}
func InsertToEs(msg structure.ResultMsg) {
   //defer func() {
   //   if err := recover(); err != nil {
   //      logger.Error("es模块儿的异常捕获:", err)
   //   }
   //}()
   defer func() {
      if err := recover(); err != nil {
         logger.Error("es模块儿的异常捕获:", err)
      }
   }()
   localConfig1, err := cache.GetServerInfo()
   if err != nil {
      panic("配置文件不合法")
@@ -214,7 +187,7 @@
                  var target = new(Target)
                  target.TargetId = face.Id
                  target.TargetScore = face.Score
                  target.FaceFeature = base64.StdEncoding.EncodeToString(face.Feature)
                  target.Feature = base64.StdEncoding.EncodeToString(face.Feature)
                  target.PicSmUrl = resp["fileUrl"].(string)
                  target.TargetLocation = Points{TopLeft: Point{face.Location.X, face.Location.Y}, BottomRight: Point{face.Location.X + face.Location.Width, face.Location.Y + face.Location.Height}}
                  var targetInfos []Target
@@ -266,7 +239,7 @@
                  if err1 != nil {
                     logger.Error("上传ES出错!---", err1)
                  } else {
                     logger.Info("插入es返回的信息:", sdkname,"---",resp1)
                     logger.Info("插入es返回的信息:", sdkname, "---", resp1)
                     // 发出录像信号
                     ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: face.Uuid, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, VideoUrl: msg.Push.VideoUrl, ImgId: i.Id, SdkIds: []string{"-1"}, Type: 1})
                  }
@@ -620,7 +593,7 @@
                  false,
                  false,
                  nil,
                  nil,
                  targetInfos,
                  linkTag,
                  linkTagInfos,
               }
@@ -771,14 +744,15 @@
      }
      race := getRaceString(obj.ThftRes.Race)
      ageDescription := getDescription(obj.ThftRes.Age)
      lable = sex + "/" + ageDescription + "/" + race + "/"
      lable = sex + "/" + ageDescription + "/" + race
      lableAttach = strconv.Itoa(int(obj.ThftRes.Age)) + "岁" + "/" + "微笑值:" + strconv.Itoa(int(obj.ThftRes.Smile)) + "/" + "颜值:" + strconv.Itoa(int(obj.ThftRes.Beauty))
   case "plate":
      // 车牌运动方向,0 unknown, 1 left, 2 right, 3 up, 4 down
      logger.Info("车辆车牌信息:", obj.Car.NColor, obj.Car.NCarColor, obj.Car.NCarLogo, obj.Car.NCarType, obj.Car.NDirection)
      lable = obj.Car.License + "/" + cache.GetDic("nColor"+strconv.Itoa(int(obj.Car.NColor))) + "车牌" + "/" +
         cache.GetDic("nCarColor"+strconv.Itoa(int(obj.Car.NCarColor))) + "车辆" + "/" + cache.GetDic("nCarLogo"+strconv.Itoa(int(obj.Car.NCarLogo))) + "/" + cache.GetDic("nCarLogo"+strconv.Itoa(int(obj.Car.NCarType)))
      lableAttach = cache.GetDic("nDirection"+strconv.Itoa(int(obj.Car.NDirection))) + "/" + "车牌置信度:" + strconv.Itoa(int(obj.Car.NConfidence)) + "/" +
         cache.GetDic("nCarColor"+strconv.Itoa(int(obj.Car.NCarColor))) + "车辆" + "/" + "品牌:" + cache.GetDic("nCarLogo"+strconv.Itoa(int(obj.Car.NCarLogo))) + "/" + "型号:" + cache.GetDic("nCarType"+strconv.Itoa(int(obj.Car.NCarType)))
      lableAttach = "运动方向:" + cache.GetDic("nDirection"+strconv.Itoa(int(obj.Car.NDirection))) + "/" + "车牌置信度:" + strconv.Itoa(int(obj.Car.NConfidence)) + "/" +
         "车牌亮度:" + strconv.Itoa(int(obj.Car.NBright)) + "/" + "车的亮度:" + strconv.Itoa(int(obj.Car.NCarBright)) + "/" + "识别时间:" + strconv.Itoa(int(obj.Car.NTime))
   }
   return lable, lableAttach