From 789d38603d73dabe8ae5f79c1a35a8d84c130b00 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期三, 04 三月 2020 18:20:47 +0800
Subject: [PATCH] update protomsg
---
controllers/fileController.go | 44 +++++++++++++++++++++++++-------------------
1 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/controllers/fileController.go b/controllers/fileController.go
index d66b079..7ac8606 100644
--- a/controllers/fileController.go
+++ b/controllers/fileController.go
@@ -132,7 +132,7 @@
logger.Debug("localConfig is wrong!!!")
return
}
- var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit"
+ var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit?collection=persistent"
logger.Debug("weedfsUri:",weedfsUri)
resultMap :=make(map[string]interface{},0)
//灏嗕笂浼犵殑鍥剧墖浜や汉鑴告娴嬪拰浜鸿劯鎻愬彇锛岃幏寰楃壒寰�
@@ -190,8 +190,7 @@
PicDate string `json:"picDate"`
Content string `json:"content"`
IsAlarm bool `json:"isAlarm"`
- PicMaxUrl string `json:"picMaxUrl"`
- PicSmUrl []string `json:"picSmUrl"`
+ PicMaxUrl []string `json:"picMaxUrl"`
TargetInfo []TargetInfo `json:"targetInfo"`
TaskId string `json:"taskId"`
TaskName string `json:"taskName"`
@@ -203,6 +202,7 @@
type TargetInfo struct {
TargetId string `json:"targetId"`
+ TargetType string `json:"targetType"`
TargetScore float64 `json:"targetScore"`
Feature string `json:"feature"`
PicSmUrl string `json:"picSmUrl"`
@@ -215,15 +215,16 @@
}
type DbPersonVo struct {
+ TableId string `json:"tableId"`
+ TableName string `json:"tableName"`
BwType string `json:"bwType"`
CompareScore float64 `json:"compareScore"`
- MonitorLevel string `json:"monitorLevel"`
TargetId string `json:"targetId"`
TargetName string `json:"targetName"`
TargetPicUrl string `json:"targetPicUrl"`
+ MonitorLevel string `json:"monitorLevel"`
Labels string `json:"labels"`
- TableId string `json:"tableId"`
- TableName string `json:"tableName"`
+ Content string `json:"content"`
Enable int32 `json:"enable"`
}
@@ -253,13 +254,13 @@
if v.Tableid == service.CaptureTable {
captureM[v.Id] = ScoreIndex{
Index: idx,
- CompareScore: float64(v.CompareScore),
+ CompareScore: util.ParseScore64(float64(v.CompareScore)),
}
captureIds = append(captureIds,v.Id)
} else {
dbPersonM[v.Id] = ScoreIndex{
Index: idx,
- CompareScore: float64(v.CompareScore),
+ CompareScore: util.ParseScore64(float64(v.CompareScore)),
}
personIds = append(personIds,v.Id)
}
@@ -282,8 +283,9 @@
MonitorLevel: p.MonitorLevel,
TargetName: p.PersonName,
TargetPicUrl: p.PersonPicUrl,
- Labels: p.Sex+" / "+p.IdCard+" / "+p.IdCard,
+ Labels: p.PhoneNum+"/"+p.Sex+"/"+p.IdCard,
TableId: p.TableId,
+ Content: p.Reserved,
Enable: p.Enable,
}
dbTableInfos, _ := dtApi.DbtablesById([]string{ p.TableId })
@@ -311,8 +313,8 @@
for _,p :=range vp.BaseInfo {
bi = append(bi, DbPersonVo{
TargetId: p.TargetId,
- CompareScore: float64(p.CompareScore),
- MonitorLevel: parseMonitorLevel(p.MonitorLevel),
+ CompareScore: util.ParseScore64(p.CompareScore),
+ MonitorLevel: p.MonitorLevel,
TargetName: p.TargetName,
TargetPicUrl: p.TargetPicUrl,
Labels: p.Labels,
@@ -336,7 +338,7 @@
}
var ti = make([]TargetInfo,0)
if vp.TargetInfo !=nil {
- for _,vti :=range ti {
+ for _,vti :=range vp.TargetInfo {
tl := protomsg.Location{
X: vti.TargetLocation.TopLeft.X,
Y: vti.TargetLocation.TopLeft.Y,
@@ -347,6 +349,7 @@
}
tInfo := TargetInfo{
TargetId: vti.TargetId,
+ TargetType: vti.TargetType,
TargetScore: vti.TargetScore,
Feature: vti.Feature,
PicSmUrl: vti.PicSmUrl,
@@ -362,6 +365,7 @@
Id: vp.Id,
CompareScore: captureM[vp.Id].CompareScore,
CameraId: vp.CameraId,
+ CameraName: vp.CameraName,
CameraAddr: vp.CameraAddr,
PicDate: vp.PicDate,
PicMaxUrl: vp.PicMaxUrl,
@@ -399,7 +403,7 @@
logger.Debug("localConfig is wrong!!!")
return nil,"",nil,errors.New("localConf err")
}
- var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit"
+ var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit?collection=persistent"
logger.Debug("weedfsUri:",weedfsUri)
faceArr, err, pI := service.GetFaceFeaFromSdk(fileBytes, time.Second*60)
if err ==nil && len(faceArr) ==1 {
@@ -521,8 +525,9 @@
} else {
arg.TableIds = []string{}
}
+ alarmLevelTypes := strings.Replace(strings.Trim(fmt.Sprint(getAlarmLevel(searchBody.AlarmLevel)), "[]"), " ", "\",\"", -1)
arg.Source = true // 鏍囪瘑鏉ユ簮鏄痺eb
- arg.AlarmLevel = searchBody.AlarmLevel
+ arg.AlarmLevel = alarmLevelTypes
arg.Tasks = searchBody.Tasks
arg.TreeNodes = searchBody.TreeNodes
arg.Tabs = searchBody.Tabs
@@ -607,8 +612,9 @@
}
localConf, err := cache.GetServerInfo()
if err ==nil && localConf.AlarmIp != "" && localConf.ServerId != "" {
+ alarmLevelTypes := strings.Replace(strings.Trim(fmt.Sprint(getAlarmLevel(searchBody.AlarmLevel)), "[]"), " ", "\",\"", -1)
arg.Source = true // 鏍囪瘑鏉ユ簮鏄痺eb
- arg.AlarmLevel = searchBody.AlarmLevel
+ arg.AlarmLevel = alarmLevelTypes
arg.Tasks = searchBody.Tasks
arg.TreeNodes = searchBody.TreeNodes
arg.Tabs = searchBody.Tabs
@@ -616,7 +622,7 @@
arg.InputValue = searchBody.InputValue
arg.Collection = searchBody.Collection
arg.AnalyServerId = localConf.ServerId
- alarmLevelTypes := strings.Replace(strings.Trim(fmt.Sprint(getAlarmLevel(searchBody.AlarmLevel)), "[]"), " ", "\",\"", -1)
+
captureIds := esApi.GetAllLocalVideopersonsId(arg, config.EsInfo.EsIndex.AiOcean.IndexName, localConf.AlarmIp, strconv.Itoa(int(localConf.AlarmPort)), alarmLevelTypes)
logger.Debug("searchPhoto first Result.len:",len(*co.CompareData),"twice len(captureIds):",len(captureIds))
if captureIds !=nil {
@@ -736,7 +742,7 @@
logger.Debug("localConfig is wrong!!!")
return
}
- var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit"
+ var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit?collection=persistent"
//灏嗕笂浼犵殑鍥剧墖浜や汉鑴告娴嬪拰浜鸿劯鎻愬彇锛岃幏寰楃壒寰�
fileBytes, _ := ioutil.ReadAll(file)
@@ -800,7 +806,7 @@
logger.Debug("localConfig is wrong!!!")
return "",nil,err2
}
- var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit"
+ var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit?collection=persistent"
//鏍规嵁浜鸿劯鍧愭爣鎵e嚭浜鸿劯灏忓浘
t1 := time.Now()
cutFaceImgData := util.SubImg(*pI, int(rcFace.Left), int(rcFace.Top), int(rcFace.Right), int(rcFace.Bottom))
@@ -960,7 +966,7 @@
logger.Debug("localConfig is wrong!!!")
return
}
- var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit"
+ var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit?collection=persistent"
{
uri := weedfsUri
fileInfo, e := esutil.PostFormBufferData(uri, filename, "file", uploadData)
--
Gitblit v1.8.0