From b4924f874df4f23e1968151d28bc18110f84146a Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期二, 15 十月 2019 15:02:48 +0800 Subject: [PATCH] fix dbpersoncompare result --- controllers/dbtableperson.go | 56 ++++++++++++++++++++++++++++++++------------------------ 1 files changed, 32 insertions(+), 24 deletions(-) diff --git a/controllers/dbtableperson.go b/controllers/dbtableperson.go index 0f7ea9b..c96ed64 100644 --- a/controllers/dbtableperson.go +++ b/controllers/dbtableperson.go @@ -129,15 +129,16 @@ } else { faceB = face.FaceBytes } - var sysSetApi dbapi.SysSetApi + analyServerId := "" - flag, sysconf := sysSetApi.GetServerInfo() - if flag { - analyServerId = sysconf.ServerId + conf, e := cache.GetServerInfo() + if e ==nil && conf.ServerId != "" { + analyServerId = conf.ServerId } else { util.ResponseFormat(c, code.ComError, "analyServerId涓虹┖锛岄厤缃湁璇�") return } + arg := protomsg.CompareArgs{ FaceFeature: faceB, CompareThreshold: 0.6, @@ -182,9 +183,9 @@ } //濉厖鍚戝墠绔繑鍥炵殑鏁版嵁 -func FillDbPersonDataToCompareResult(compResult *protomsg.SdkCompareResult) []DbPersonVo { +func FillDbPersonDataToCompareResult(compResult *protomsg.SdkCompareResult) []models.DbPersonsCompVo { - var resultList = make([]DbPersonVo, len(compResult.CompareResult)) + var resultList = make([]models.DbPersonsCompVo, len(compResult.CompareResult)) dbPersonM := make(map[string]ScoreIndex, 0) personIds := make([]string,0) @@ -204,25 +205,32 @@ } if len(dbpersons) >0 { - var dtApi dbapi.DbTableApi + //var dtApi dbapi.DbTableApi for _,p :=range dbpersons { - var dbP = DbPersonVo { - PersonId: p.Id, - IdCard: p.IdCard, - CompareScore: util.ParseScore(dbPersonM[p.Id].CompareScore), - MonitorLevel: p.MonitorLevel, - PersonName: p.PersonName, - PersonPicUrl: p.PersonPicUrl, - PhoneNum: p.PhoneNum, - Sex: p.Sex, - TableId: p.TableId, - Enable: p.Enable, - } - dbTableInfos, _ := dtApi.DbtablesById([]string{ p.TableId }) - if dbTableInfos !=nil{ - dbP.BwType = dbTableInfos[0].BwType - dbP.TableName = dbTableInfos[0].TableName - } + var dbP models.DbPersonsCompVo + + dbP.Id = p.Id + dbP.TableId = p.TableId + dbP.FaceFeature = p.FaceFeature + dbP.PersonPicUrl = p.PersonPicUrl + dbP.PersonName = p.PersonName + dbP.Age = p.Age + dbP.Sex = p.Sex + dbP.IdCard = p.IdCard + dbP.PhoneNum = p.PhoneNum + dbP.MonitorLevel = p.MonitorLevel + dbP.Reserved = p.Reserved + dbP.IsDelete = int(p.IsDelete) + dbP.Enable = int(p.Enable) + dbP.CreateTime = p.CreateTime + dbP.UpdateTime = p.UpdateTime + dbP.CreateBy = p.CreateBy + dbP.CompareScore = util.ParseScore(dbPersonM[p.Id].CompareScore) + //dbTableInfos, _ := dtApi.DbtablesById([]string{ p.TableId }) + //if dbTableInfos !=nil{ + // dbP.BwType = dbTableInfos[0].BwType + // dbP.TableName = dbTableInfos[0].TableName + //} resultList[dbPersonM[p.Id].Index] = dbP } } -- Gitblit v1.8.0