package controllers import ( "basic.com/fileServer/WeedFSClient.git" esApi "basic.com/pubsub/esutil.git" "basic.com/pubsub/protomsg.git" "basic.com/valib/bhomeclient.git" "basic.com/valib/bhomedbapi.git" "basic.com/valib/logger.git" "github.com/satori/go.uuid" "sort" "strconv" "strings" "time" "vamicro/compTable-service/models" "vamicro/compTable-service/service" "vamicro/compTable-service/vo" "vamicro/config" "vamicro/extend/util" cc "vamicro/gb28181-service/cache" searchM "vamicro/search-service/models" ) type DbPersonController struct { } // @Summary 添加底库人员 // @Description 添加底库人员 // @Accept json // @Produce json // @Tags 底库人员 // @Param obj body models.Dbtablepersons true "底库人员数据" // @Success 200 {string} json "{"code":200, msg:"", success:true}" // @Failure 500 {string} json "{"code":500, msg:"", success:false}" // @Router /data/api-v/dbperson/addDbPerson [PUT] func (dbp DbPersonController) AddDbPerson(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { var dbperson models.Dbtablepersons err := c.BindJSON(&dbperson) if err != nil || dbperson.TableId == "" { return &bhomeclient.Reply{Msg: "参数有误"} } b := false var sv service.DbTablePersonService if dbperson.Id == "" { //新增 dbperson.Id = uuid.NewV4().String() dbperson.FromServerId = config.Server.AnalyServerId //入库serverId dbperson.PriInsert() b, _ = sv.Add(dbperson) } else { //更新 dbperson.PriUpdate() b, _ = sv.Update(dbperson) } if b { return &bhomeclient.Reply{Success: true, Data: dbperson} } else { return &bhomeclient.Reply{Msg: "新增失败"} } } type DbtSearch struct { TableId string `json:"tableId"` OrderName string `json:"orderName"` OrderType string `json:"orderType"` ContentValue string `json:"contentValue"` Page int `json:"page"` Size int `json:"size"` } // @Summary 查询底库人员列表 // @Description 查询库人员列表 // @Accept json // @Produce json // @Tags 底库人员 // @Param argBody body controllers.DbtSearch false "{"tableId":"","orderName":"uuid","orderType":"desc","contentValue":"","page":1,"size":8}" // @Success 200 {string} json "{code:200, msg:"", success:true, data:""}" // @Failure 500 {string} json "{code:500, msg:"", success:false, data:""}" // @Router /data/api-v/dbperson/queryDbPersonsByTbId [POST] func (dbp DbPersonController) QueryDbPersonsByTbId(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { var reqBody DbtSearch c.BindJSON(&reqBody) tableId := "" if reqBody.TableId != "" { tableId = reqBody.TableId } if tableId == "" { return &bhomeclient.Reply{Msg: "参数有误"} } orderName := "id" // 列名 if reqBody.OrderName != "" { orderName = reqBody.OrderName } orderType := "desc" // 排序类型 if reqBody.OrderType != "" { orderType = reqBody.OrderType } contentValue := "" //输入框内容 if reqBody.ContentValue != "" { contentValue = reqBody.ContentValue } page := 1 // 页码 if reqBody.Page > 1 { page = reqBody.Page } size := 8 // 条数 if reqBody.Size > 8 { size = reqBody.Size } from := (page - 1) * size var sv service.DbTablePersonService arr, err := sv.FindPersons(tableId, orderName, orderType, contentValue, from, size) total, _ := sv.GetPersonTotal(tableId) if err == nil { var m = map[string]interface{}{ "total": total, "datalist": arr, } return &bhomeclient.Reply{Success: true, Data: m} } else { var m = map[string]interface{}{ "total": total, "datalist": []interface{}{}, } return &bhomeclient.Reply{Data: m} } } // @Summary 修改底库人员 // @Description 修改底库人员 // @Accept json // @Produce json // @Tags 底库人员 // @Param person body models.Dbtablepersons true "底库人员数据" // @Success 200 {string} json "{"code":200, msg:"目录结构数据", success:true}" // @Failure 500 {string} json "{"code":500, msg:"返回错误信息", success:false}" // @Router /data/api-v/dbperson/updateDbPerson [POST] func (dbp DbPersonController) UpdateDbPerson(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { var dbperson models.Dbtablepersons err := c.BindJSON(&dbperson) if err != nil || dbperson.Id == "" { return &bhomeclient.Reply{Msg: "参数有误"} } dbperson.PriUpdate() var sv service.DbTablePersonService b, _ := sv.Update(dbperson) if b { return &bhomeclient.Reply{Success: true, Data: dbperson} } else { return &bhomeclient.Reply{Msg: "更新失败"} } } type MultiCarNo struct { TableId string `json:"tableId" binding:"required"` CarNos []string `json:"carNos" binding:"required"` } // @Security ApiKeyAuth // @Summary 批量添加底库车辆 // @Description 批量添加底库车辆 // @Accept json // @Produce json // @Tags dbperson 底库人员 // @Param reqBody body controllers.MultiCarNo true "批量车牌号" // @Success 200 {string} json "{"code":200, msg:"", success:true}" // @Failure 500 {string} json "{"code":500, msg:"", success:false}" // @Router /data/api-v/dbperson/multiUploadCarNo [post] func (dbp DbPersonController) MultiUploadCarNo(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { var reqBody MultiCarNo err := c.BindJSON(&reqBody) if err != nil { return &bhomeclient.Reply{Msg: "参数有误"} } logger.Debug("multiUploadCarNo reqBody:", reqBody) var sv service.DbTablePersonService if sv.MultiUploadCardNo(reqBody.TableId, reqBody.CarNos) { return &bhomeclient.Reply{Success: true, Msg: "上传成功"} } else { return &bhomeclient.Reply{Msg: "上传失败"} } } // @Summary 更新底库人脸照片 // @Description 更新底库人脸照片 // @Accept json // @Produce json // @Tags 底库人员 // @Param person body vo.FaceUpdateVo true "人脸更新参数" // @Success 200 {string} json "{"code":200, msg:"", success:true}" // @Failure 500 {string} json "{"code":500, msg:"", success:false}" // @Router /data/api-v/dbperson/updateFace [POST] func (dbp DbPersonController) UpdateFace(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { var arg vo.FaceUpdateVo err := c.BindJSON(&arg) if err != nil || arg.Id == "" || arg.FaceFeature == "" || arg.PersonPicUrl == "" { return &bhomeclient.Reply{Msg: "参数有误"} } var sv service.DbTablePersonService b, _ := sv.UpdateFace(&arg) if b { return &bhomeclient.Reply{Success: true, Msg: "更新成功"} } else { return &bhomeclient.Reply{Msg: "更新失败"} } } // @Summary 删除底库人员 // @Description 删除库人员 // @Accept x-www-form-urlencoded // @Produce json // @Tags 底库人员 // @Param id path string true "底库人员id " // @Success 200 {string} json "{"code":200, msg:"", success:true}" // @Failure 500 {string} json "{"code":500, msg:"", success:false}" // @Router /data/api-v/dbperson/deleteDbPersonById [POST] func (dbp DbPersonController) DeleteDbPerson(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { id := c.Query("id") if id == "" { return &bhomeclient.Reply{Msg: "参数有误"} } var sv service.DbTablePersonService b, _ := sv.DeleteById(id) if b { return &bhomeclient.Reply{Success: true, Msg: "删除成功"} } else { return &bhomeclient.Reply{Msg: "删除失败"} } } type DelMultiPersons struct { Ids []string `json:"ids"` } // @Summary 删除底库人员 // @Description 删除库人员 // @Accept json // @Produce json // @Tags 底库人员 // @Param ids body controllers.DelMultiPersons true "底库人员ids,字符串数组" // @Success 200 {string} json "{code:200, msg:"", success:true}" // @Failure 500 {string} json "{code:500, msg:"", success:false}" // @Router /data/api-v/dbperson/deleteMoreDbPerson [POST] func (dbp DbPersonController) DeleteMoreDbPerson(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { var ids DelMultiPersons err := c.BindJSON(&ids) logger.Debug("DeleteMoreDbPerson ids:", ids) if err != nil || len(ids.Ids) == 0 { return &bhomeclient.Reply{Msg: "参数有误"} } var sv service.DbTablePersonService b, _ := sv.DeleteByPersonIds(ids.Ids) if b { return &bhomeclient.Reply{Success: true, Msg: "删除成功"} } else { return &bhomeclient.Reply{Msg: "删除失败"} } } // @Summary 根据底库id删除底库人员 // @Description 根据底库id删除库人员 // @Accept x-www-form-urlencoded // @Produce json // @Tags 底库人员 // @Param tableId path string true "底库id " // @Success 200 {string} json "{"code":200, msg:"", success:true}" // @Failure 500 {string} json "{"code":500, msg:"", success:false}" // @Router /data/api-v/dbperson/deletePersonsByTbId [POST] func (dbp DbPersonController) DeletePersonsByTbId(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { tableId := c.Query("tableId") if tableId == "" { return &bhomeclient.Reply{Msg: "参数有误"} } var sv service.DbTablePersonService b, _ := sv.DeletePersonsByTbId(tableId) if b { return &bhomeclient.Reply{Success: true, Msg: "删除成功"} } else { return &bhomeclient.Reply{Msg: "删除失败"} } } // @Summary 根据多个人员id查询详情 // @Description 根据多个人员id查询详情 // @Accept json // @Produce json // @Tags 底库人员 // @Param ids body controllers.IdsArr true "人员ids" // @Success 200 {string} json "{"code":200, msg:"", success:true}" // @Failure 500 {string} json "{"code":500, msg:"", success:false}" // @Router /data/api-v/dbperson/dbPersonInfoByIds [POST] func (dbp DbPersonController) DbPersonInfoByIds(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { var idsArr IdsArr err := c.BindJSON(&idsArr) if err != nil || len(idsArr.Ids) == 0 { return &bhomeclient.Reply{Msg: "参数有误"} } var sv service.DbTablePersonService arr, e := sv.FindByPersonIds(idsArr.Ids) if e != nil { return &bhomeclient.Reply{Msg: "查询失败", Data: []interface{}{}} } else { return &bhomeclient.Reply{Success: true, Data: arr} } } // @Summary 获取人员总数 // @Description 获取人员总数 // @Accept x-www-form-urlencoded // @Produce json // @Tags 底库人员 // @Param tableId query string false "底库id" // @Success 200 {string} json "{"code":200, msg:"", success:true}" // @Failure 500 {string} json "{"code":500, msg:"", success:false}" // @Router /data/api-v/dbperson/getPersonTotal [GET] func (dbp DbPersonController) GetPersonTotal(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { tableId := c.Query("tableId") logger.Debug("GetPersonTotal tableId:", tableId) var sv service.DbTablePersonService total, err := sv.GetPersonTotal(tableId) if err != nil { return &bhomeclient.Reply{Msg: "查询失败"} } else { return &bhomeclient.Reply{Success: true, Data: total} } } // @Summary 根据所有底库人员的id和faceFeature,给缓存比对使用 // @Description 根据所有底库人员的id和faceFeature,给缓存比对使用 // @Accept x-www-form-urlencoded // @Produce json // @Tags 底库人员 // @Param from query int true "from" // @Param size query int true "size" // @Success 200 {string} json "{"code":200, msg:"", success:true}" // @Failure 500 {string} json "{"code":500, msg:"", success:false}" // @Router /data/api-v/dbperson/getPersonsCompareCacheBase [GET] func (dbp DbPersonController) GetPersonsCompareCacheBase(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { var sv service.DbTablePersonService fromStr := c.Query("from") sizeStr := c.Query("size") logger.Debug("from:", fromStr, ",size:", sizeStr) from, e1 := strconv.Atoi(fromStr) size, e2 := strconv.Atoi(sizeStr) if e1 != nil || e2 != nil { return &bhomeclient.Reply{Msg: "参数有误"} } arr, err := sv.GetPersonsCompareCacheBase(from, size) if err != nil { return &bhomeclient.Reply{Msg: "查询失败"} } else { return &bhomeclient.Reply{Success: true, Data: arr} } } type JoinDbTArg struct { CaptureId string `json:"captureId"` TableIds []string `json:"tableIds"` } // @Summary 抓拍人脸加入底库 // @Description 抓拍人脸加入底库 // @Accept json // @Produce json // @Tags 底库人员 // @Param obj body controllers.JoinDbTArg true "加入底库参数" // @Success 200 {string} json "{"code":200, msg:"", success:true}" // @Failure 500 {string} json "{"code":500, msg:"", success:false}" // @Router /data/api-v/dbperson/joinDbTable [POST] func (dbp DbPersonController) JoinDbTable(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { var reqBody JoinDbTArg c.BindJSON(&reqBody) if reqBody.CaptureId == "" || len(reqBody.TableIds) == 0 { return &bhomeclient.Reply{Msg: "参数有误"} } var sApi bhomedbapi.SysSetApi flag, localConf := sApi.GetServerInfo() if !flag || localConf.AlarmIp == "" || localConf.AlarmPort == 0 { logger.Debug("localConf err") return &bhomeclient.Reply{Success: false, Msg: "报警设置有误"} } logger.Debug("call joinDb") aiOceans, e := esApi.AIOceaninfosbyid([]string{reqBody.CaptureId}, config.EsInfo.EsIndex.AiOcean.IndexName, localConf.AlarmIp, strconv.Itoa(int(localConf.AlarmPort))) logger.Debug("e:", e, "len(aiOceans):", len(aiOceans)) if e == nil && aiOceans != nil && len(aiOceans) == 1 { var personPicUrl = "" //人脸图片 var feature = "" //特征 if aiOceans[0].TargetInfo != nil && len(aiOceans[0].TargetInfo) > 0 { personPicUrl = aiOceans[0].TargetInfo[0].PicSmUrl } fea, e2 := esApi.GetVideoPersonFaceFeatureById(reqBody.CaptureId, config.EsInfo.EsIndex.AiOcean.IndexName, localConf.AlarmIp, strconv.Itoa(int(localConf.AlarmPort))) logger.Debug("e2:", e2) if e2 == nil && fea != "" { feature = fea } if personPicUrl != "" && feature != "" { //将这张抓拍的照片下载下来上传到collection=persistent的集合中,防止被清理掉 logger.Debug("personPicUrl:", personPicUrl) if !strings.HasPrefix(personPicUrl, "http://") { personPicUrl = "http://" + personPicUrl } picB, e3 := util.DownLoad(personPicUrl) logger.Debug("e3:", e3) if e3 == nil { weedfsUri := "http://" + localConf.WebPicIp + ":" + strconv.Itoa(int(localConf.WebPicPort)) + "/submit?collection=" + localConf.ServerId + "-persistent" newPersonPicUrl, e4 := WeedFSClient.UploadFile(weedfsUri, "capturePerson", picB, 5*time.Second) logger.Debug("e4:", e4, "newPersonPicUrl:", newPersonPicUrl) if e4 == nil { var sv service.DbTablePersonService if b := sv.JoinDbTable(reqBody.TableIds, feature, newPersonPicUrl); b { return &bhomeclient.Reply{Success: true, Msg: "加入成功"} } else { return &bhomeclient.Reply{Msg: "加入失败"} } } else { logger.Debug("upload faceImg err:", e4) } } else { logger.Debug("download personPic ERR:", e3) } } else { logger.Debug("personPicUrl or feature is empty!!!") } } return &bhomeclient.Reply{Msg: "加入失败"} } type LikeCondition struct { TableIds []string `json:"tableIds"` //底库id集合 InputValue string `json:"inputValue"` } // @Summary 根据条件查底库人员id // @Description 根据条件查底库人员id // @Accept json // @Produce json // @Tags 底库人员 // @Success 200 {string} json "{"code":200, msg:"", success:true}" // @Failure 500 {string} json "{"code":500, msg:"", success:false}" // @Router /data/api-v/dbperson/findLikePersonIds [POST] func (dbp DbPersonController) FindLikePersonIds(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { var condition LikeCondition c.BindJSON(&condition) var dbpE models.Dbtablepersons personIds, err := dbpE.FindLikePersonIds(condition.TableIds, condition.InputValue) if err == nil { return &bhomeclient.Reply{Success: true, Data: personIds} } else { return &bhomeclient.Reply{Msg: "查询失败"} } } type DbPersonMove struct { PersonId string `json:"personId"` TableIds []string `json:"tableIds"` } // @Security ApiKeyAuth // @Summary 人员移动 // @Description 人员移动 // @Accept json // @Produce json // @Tags dbperson 底库人员 // @Param obj body controllers.DbPersonMove true "移动参数" // @Success 200 {string} json "{"code":200, msg:"", success:true}" // @Failure 500 {string} json "{"code":500, msg:"", success:false}" // @Router /data/api-v/dbperson/move [POST] func (dbp *DbPersonController) Move(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { var reqBody DbPersonMove c.BindJSON(&reqBody) if reqBody.PersonId == "" || len(reqBody.TableIds) == 0 { return &bhomeclient.Reply{Msg: "参数有误"} } var sv service.DbTablePersonService if sv.Move(reqBody.PersonId, reqBody.TableIds) { return &bhomeclient.Reply{Success: true, Msg: "移动成功"} } else { return &bhomeclient.Reply{Msg: "移动失败"} } } // @Security ApiKeyAuth // @Summary 人员复制 // @Description 人员复制 // @Accept json // @Produce json // @Tags dbperson 底库人员 // @Param obj body controllers.DbPersonMove true "复制参数" // @Success 200 {string} json "{"code":200, msg:"", success:true}" // @Failure 500 {string} json "{"code":500, msg:"", success:false}" // @Router /data/api-v/dbperson/copy [POST] func (dbp *DbPersonController) Copy(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { var reqBody DbPersonMove c.BindJSON(&reqBody) if reqBody.PersonId == "" || len(reqBody.TableIds) == 0 { return &bhomeclient.Reply{Msg: "参数有误"} } var sv service.DbTablePersonService if sv.Copy(reqBody.PersonId, reqBody.TableIds) { return &bhomeclient.Reply{Success: true, Msg: "复制成功"} } else { return &bhomeclient.Reply{Msg: "复制失败"} } } type FaceExtract struct { Url string `json:"url"` FaceBytes []byte `json:"faceBytes"` } var faceExtractedMap = make(map[string]FaceExtract, 0) // @Security ApiKeyAuth // @Summary 人脸提取 // @Description 人脸提取 // @Accept multipart/form-data // @Produce json // @Tags 以图搜图 // @Param file formData file true "人员图片" // @Success 200 {string} json "{"code":200, msg:"", data:"", success:true}" // @Failure 500 {string} json "{"code":500, msg:"", data:"", success:false}" // @Router /data/api-v/dbperson/extract [POST] func (dbp *DbPersonController) FaceExtract(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { file, err := c.FormFile() //image这个是uplaodify参数定义中的 'fileObjName':'image' if err != nil { return &bhomeclient.Reply{Msg: "参数有误"} } _, weedfsUri, err2 := cc.GetWeedfsUri() if err2 != nil { logger.Debug("localConfig is wrong!!!") return &bhomeclient.Reply{Msg: err.Error()} } logger.Debug("weedfsUri:", weedfsUri) resultMap := make(map[string]interface{}, 0) //将上传的图片交人脸检测和人脸提取,获得特征 faceArr, err, pI := service.GetFaceFeaFromSdk(file.Bytes, time.Second*60) if err == nil && len(faceArr) > 0 { //1.提取每一张人脸小图 urlArr := make([]string, 0) for _, r := range faceArr { logger.Debug("faceExtract confidence:", r.Pos.FAngle.Confidence, "Width:", r.Pos.RcFace.Right-r.Pos.RcFace.Left, "Pitch:", r.Pos.FAngle.Pitch, "Roll:", r.Pos.FAngle.Roll, "Yaw:", r.Pos.FAngle.Yaw) rcFace := r.Pos.RcFace cutFaceImgData, cutErr := util.SubCutImg(pI, rcFace, 20) if cutErr != nil { logger.Debug("util.SubCutImg err:", cutErr) continue } weedFilePath, e := WeedFSClient.UploadFile(weedfsUri, "FaceUrl", cutFaceImgData, 5*time.Second) if e == nil { faceExtractedMap[weedFilePath] = FaceExtract{ Url: weedFilePath, FaceBytes: r.Feats, } urlArr = append(urlArr, weedFilePath) } } //2.大图画框,标识人脸位置 drawedB, _ := drawPolygonOnImg(pI, &faceArr) originFilePath, _ := WeedFSClient.UploadFile(weedfsUri, "FaceUrl", *drawedB, 5*time.Second) resultMap["uploadImage"] = originFilePath resultMap["smImage"] = urlArr return &bhomeclient.Reply{Success: true, Data: resultMap} } else { return &bhomeclient.Reply{Msg: "未提取到人脸"} } } func (dbp *DbPersonController) QueryDbPersonsByCompare(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { var searchBody searchM.EsSearch err := c.BindJSON(&searchBody) if err != nil || searchBody.PicUrl == "" || len(searchBody.DataBases) == 0 { return &bhomeclient.Reply{Msg: "参数有误"} } var faceB []byte if face, ok := faceExtractedMap[searchBody.PicUrl]; !ok { return &bhomeclient.Reply{Msg: "请重新上传图片"} } else { faceB = face.FaceBytes } analyServerId := "" conf, err := cc.GetServerInfo() if err != nil && conf.ServerId != "" { analyServerId = conf.ServerId } else { return &bhomeclient.Reply{Msg: "analyServerId为空,配置有误"} } arg := protomsg.CompareArgs{ FaceFeature: faceB, CompareThreshold: searchBody.Threshold, } arg.TableIds = searchBody.DataBases arg.AnalyServerId = analyServerId compareService := service.NewFaceCompareService(arg) var totalData service.CompareList dbPersonTargets, _ := compareService.CompareDbPersons() if dbPersonTargets != nil { totalData = append(totalData, *dbPersonTargets...) } service.SetCompResultByNum(&service.CompareOnce{ CompareNum: compareService.CompareNum, CompareData: &totalData, }) m := make(map[string]interface{}, 3) if totalData != nil && totalData.Len() > 0 { sort.Sort(totalData) total := totalData.Len() m["compareNum"] = compareService.CompareNum m["total"] = total var sCompResult protomsg.SdkCompareResult if total <= searchBody.Size { sCompResult.CompareResult = totalData } else { sCompResult.CompareResult = totalData[0:searchBody.Size] } resultList := FillDbPersonDataToCompareResult(&sCompResult) m["totalList"] = resultList } else { m["total"] = 0 m["compareNum"] = compareService.CompareNum m["totalList"] = []CompareResult{} } return &bhomeclient.Reply{Success: true, Data: m} } //填充向前端返回的数据 func FillDbPersonDataToCompareResult(compResult *protomsg.SdkCompareResult) []models.DbPersonsCompVo { var resultList = make([]models.DbPersonsCompVo, len(compResult.CompareResult)) dbPersonM := make(map[string]ScoreIndex, 0) personIds := make([]string, 0) for idx, v := range compResult.CompareResult { dbPersonM[v.Id] = ScoreIndex{ Index: idx, CompareScore: float64(v.CompareScore), } personIds = append(personIds, v.Id) } logger.Debug("comp len(personIds):", len(personIds)) var dbpersons []models.Dbtablepersons if len(personIds) > 0 { sv := service.DbTablePersonService{} dbpersons, _ = sv.FindByPersonIds(personIds) } if len(dbpersons) > 0 { //var dtApi dbapi.DbTableApi for _, p := range dbpersons { 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 = 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 } } return resultList } func (dbp *DbPersonController) FindDicByType(h *bhomeclient.WrapperHandler, c *bhomeclient.Request) *bhomeclient.Reply { resMap := make(map[string][]models.Dictionary, 0) var dic models.Dictionary cts, _ := dic.FindByType(models.TYPE_VEHICLE_TYPE) //车辆类型 resMap[models.TYPE_VEHICLE_TYPE] = cts cbs, _ := dic.FindByType(models.TYPE_VEHICLE_BRAND) //车辆品牌 resMap[models.TYPE_VEHICLE_BRAND] = cbs ccs, _ := dic.FindByType(models.TYPE_VEHICLE_COLOR) //车身颜色 resMap[models.TYPE_VEHICLE_COLOR] = ccs return &bhomeclient.Reply{Success: true, Data: resMap} }