liuxiaolong
2019-10-15 b4924f874df4f23e1968151d28bc18110f84146a
fix dbpersoncompare result
2个文件已修改
61 ■■■■■ 已修改文件
controllers/dbtableperson.go 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
models/dbtablepersons.go 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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
        }
    }
models/dbtablepersons.go
@@ -14,3 +14,8 @@
    PicDesc      string `json:"picDesc,omitempty" example:"照片标识"`
    Reserved     string `json:"reserved,omitempty" example:"其他"`
}
type DbPersonsCompVo struct {
    Dbtablepersons
    CompareScore float32 `json:"compareScore"`
}