zhangjinkun 5 роки тому
батько
коміт
ed8025e9d7
1 змінених файлів з 21 додано та 0 видалено
  1. 21 0
      udpcreateindex/src/projectindex.go

+ 21 - 0
udpcreateindex/src/projectindex.go

@@ -1,6 +1,9 @@
 package main
 
 import (
+	"strconv"
+	"strings"
+
 	//"fmt"
 	"log"
 	"qfw/util"
@@ -73,6 +76,24 @@ func projectTask(data []byte, mapInfo map[string]interface{}) {
 		if len(pk1) > 0 {
 			tmp["package1"] = pk1
 		}
+		budget := util.Float64All(tmp["budget"])
+		bidamount := util.Float64All(tmp["bidamount"])
+		if float64(budget) > 0 && float64(bidamount) > 0 {
+			rate := float64(1) - float64(bidamount)/float64(budget)
+			f, _ := strconv.ParseFloat(strconv.FormatFloat(rate, 'f', 2, 64), 64)
+			tmp["project_rate"] = f
+		}
+		if topscopeclass, ok := tmp["topscopeclass"].([]interface{}); ok {
+			tc := []string{}
+			for _, v := range topscopeclass {
+				str := util.ObjToString(v)
+				str = strings.ReplaceAll(str, "t", "")
+				str = strings.ReplaceAll(str, "d", "")
+				str = strings.ReplaceAll(str, "p", "")
+				tc = append(tc, str)
+			}
+			tmp["topscopeclass"] = tc
+		}
 		//不生索引字段
 		delete(tmp, "package")
 		delete(tmp, "winnerorder")