---
panlei
2019-08-02 a01794cd55da360bdc6496ec4415db011d618345
ruleserver/readyDataForRule.go
@@ -50,7 +50,7 @@
   TableId      string  `json:"tableId"`
   TableName    string  `json:"tableName"`
   BwType       string  `json:"bwType"`
   CompareScore float64 `json:"compareScore"`
   CompareScore float32 `json:"compareScore"`
   PersonId     string  `json:"personId"`
   PersonName   string  `json:"personName"`
   PersonPicUrl string  `json:"personPicUrl"`
@@ -70,6 +70,10 @@
      if task.TaskId == taskId {
         taskGroup = task
      }
   }
   logger.Debug("当前数据帧要匹配的规则组:-------------------------")
   for _,ruleGroup := range taskGroup.GroupRules{
      logger.Info(ruleGroup.GroupText)
   }
   return taskGroup
}
@@ -92,7 +96,10 @@
   // float32与float64互转会有位数保留不准的问题
   return v
}
func Decimal(value float32) float32 {
   value1, _ := strconv.ParseFloat(fmt.Sprintf("%.4f", value), 32)
   return float32(value1)
}
// 取出某个时间规则的第几天的规则段集合
func GetTimeById(id string, index int) []TimeRange {
   _, cameraTimeRule := cache.GetTimeRuleById(id)
@@ -172,14 +179,14 @@
      for _, baseinfo := range baseinfos {
         // 根据tableId查询底库信息给liker赋值
         //logger.Info("---------看看每个底库人员的信息:",baseinfo.Id,baseinfo.PersonName)
         var tableIds []string
         tableIds := []string{}
         tableIds = append(tableIds, baseinfo.TableId) // 虽然是传入数组返回数组的接口,但我按单个的使用了
         table, err := esutil.Dbtablefosbyid(tableIds, "dbtables", serverIp, serverPort)
         if err != nil || len(table) == 0 {
            logger.Error("根据id查询底库信息出错!", err, "--返回值长度为:", len(table))
         }
         logger.Debug("看看这个base的对比值是多少:",Retain(m[baseinfo.Id]) * 100)
         base := BaseInfo{TableId: baseinfo.TableId, TableName: table[0].TableName, BwType: table[0].BwType, CompareScore: Retain(m[baseinfo.Id]) * 100, PersonId: baseinfo.Id, PersonName: baseinfo.PersonName, PersonPicUrl: baseinfo.PersonPicUrl, PhoneNum: baseinfo.PhoneNum, Sex: baseinfo.Sex, IdCard: baseinfo.IdCard, MonitorLevel: baseinfo.MonitorLevel, Content: baseinfo.Reserved}
         logger.Debug("看看这个base的对比值是多少:", Decimal(m[baseinfo.Id]) * 100)
         base := BaseInfo{TableId: baseinfo.TableId, TableName: table[0].TableName, BwType: table[0].BwType, CompareScore: Decimal(m[baseinfo.Id]) * 100, PersonId: baseinfo.Id, PersonName: baseinfo.PersonName, PersonPicUrl: baseinfo.PersonPicUrl, PhoneNum: baseinfo.PhoneNum, Sex: baseinfo.Sex, IdCard: baseinfo.IdCard, MonitorLevel: baseinfo.MonitorLevel, Content: baseinfo.Reserved}
         //os.Exit(1)
         arg.Liker = append(arg.Liker, &base)
      }
@@ -264,7 +271,7 @@
      if threshold <= obj.Score && size <= float64(obj.Rects.Width*obj.Rects.Height) && intersectionper <= PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale) {
         // 这步要备齐表达式里所需要的所有参数
         a.targetNum++
         arg1 := Arg{obj.Score, PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), obj.IsYolo, obj.Rects, obj.Feature, obj.ThftRes, []*BaseInfo{}}
         arg1 := Arg{obj.Id,obj.Score, PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), obj.IsYolo, obj.Rects, obj.Feature, obj.ThftRes, []*BaseInfo{}}
         //logger.Println("放进去的arg:-------", arg1)
         a.args = append(a.args, &arg1)
         a.filterData = append(a.filterData, &arg1)