From 9f7cca3789a13dd0847f5f0444d2bbc06636a431 Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期二, 06 八月 2019 14:01:09 +0800
Subject: [PATCH] 查找底库人员

---
 ruleserver/readyDataForRule.go |   36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/ruleserver/readyDataForRule.go b/ruleserver/readyDataForRule.go
index b405fc6..77e739f 100644
--- a/ruleserver/readyDataForRule.go
+++ b/ruleserver/readyDataForRule.go
@@ -8,6 +8,7 @@
 	"fmt"
 	"github.com/go-yaml/yaml"
 	"io/ioutil"
+	"math"
 	"ruleprocess/cache"
 	"ruleprocess/logger"
 	"strconv"
@@ -50,7 +51,7 @@
 	TableId      string  `json:"tableId"`
 	TableName    string  `json:"tableName"`
 	BwType       string  `json:"bwType"`
-	CompareScore float32 `json:"compareScore"`
+	CompareScore float64 `json:"compareScore"`
 	PersonId     string  `json:"personId"`
 	PersonName   string  `json:"personName"`
 	PersonPicUrl string  `json:"personPicUrl"`
@@ -88,17 +89,16 @@
 
 // 淇濈暀鍥涗綅灏忔暟
 func Retain(f float32) (float64) {
-	s := strconv.FormatFloat(float64(f), 'f', 4, 64)
-	v, err := strconv.ParseFloat(s, 64)
-	if err != nil {
-		logger.Error("淇濈暀鍥涗綅灏忔暟杞崲閿欒")
-	}
-	// float32涓巉loat64浜掕浆浼氭湁浣嶆暟淇濈暀涓嶅噯鐨勯棶棰�
-	return v
+	value1, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", float64(f)), 64)
+	return value1
 }
-func Decimal(value float32) float32 {
-	value1, _ := strconv.ParseFloat(fmt.Sprintf("%.4f", value), 32)
-	return float32(value1)
+func Decimal(value float32) float64 {
+	value1, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", float64(value)), 64)
+	logger.Info("鍒濇淇濈暀涓や綅鎴恠tr:",value1)
+	n10 := math.Pow10(4)
+	value2 := math.Trunc((value1+0.5/n10)*n10) / n10
+	logger.Info("鍒濇淇濈暀涓や綅鎴恠tr::::",value2)
+	return value2
 }
 // 鍙栧嚭鏌愪釜鏃堕棿瑙勫垯鐨勭鍑犲ぉ鐨勮鍒欐闆嗗悎
 func GetTimeById(id string, index int) []TimeRange {
@@ -185,8 +185,8 @@
 			if err != nil || len(table) == 0 {
 				logger.Error("鏍规嵁id鏌ヨ搴曞簱淇℃伅鍑洪敊锛�", err, "--杩斿洖鍊奸暱搴︿负锛�", len(table))
 			}
-			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}
+			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)
 		}
@@ -235,6 +235,15 @@
 						if groupRule.Rules[j].PolygonId == areaMap.areaId {
 							//logger.Info("--------------鐪嬬湅compareFlag鐨勫�煎拰tableId鍜宎reaMap.args鐨勯暱搴︼細",compareFlag,tableIds,len(areaMap.args))
 							for _, arg := range areaMap.args {
+								arg.Liker = arg.Liker[0:0]
+								logger.Info("娓呯┖涔嬪悗鐪嬬湅涔嬪墠鎵撶殑浜鸿劯鏍囩鍙樹簡娌★細")
+								if args.RuleResult["face"] != nil && len(args.RuleResult["face"].([]FaceResult)) > 0 {
+									for _, faceResult := range args.RuleResult["face"].([]FaceResult) {
+										for _,arg := range faceResult.Args {
+											logger.Info("浜哄憳鍒嗗�兼槸锛�",arg.Score,"liker鐨勬暟閲忎负",arg.Liker)
+										}
+									}
+								}
 								if compareFlag == 1 {
 									arg.fillLiker(nil, threshold)
 								}
@@ -277,6 +286,7 @@
 			a.filterData = append(a.filterData, &arg1)
 		}
 	}
+	logger.Info("鍖哄煙鏄細",areaPoints,"鍖哄煙鍐呯洰鏍囨暟閲忎负锛�",a.targetNum,"---",len(a.filterData))
 	a.time = time.Unix(time.Now().Unix(), 0).String()[11:16]
 	a.keepRight = arg.KeepRight
 	a.isStatic = arg.IsStatic

--
Gitblit v1.8.0