Selaa lähdekoodia

Merge branch 'dev3.4.1' of http://192.168.3.207:10080/qmx/jy-data-extract into dev3.4.1

apple 4 vuotta sitten
vanhempi
commit
5535de4715
3 muutettua tiedostoa jossa 25 lisäystä ja 16 poistoa
  1. 13 10
      projectinfo/src/task.go
  2. 6 6
      src/jy/extract/extract.go
  3. 6 0
      src/jy/extract/score_jsondata.go

+ 13 - 10
projectinfo/src/task.go

@@ -197,18 +197,21 @@ func GetProjectData(sid, eid string) {
 			//buyerclass
 			ent, _ := MixMgo.FindOne(CollEnt, bson.M{"buyer_name": buyer})
 			if len(*ent) > 0 && (*ent)["buyerclass"] != nil {
-				arr := (*ent)["buyerclass"].([]interface{})
-				if len(arr) == 1 {
-					pro["buyerclass"] = arr
-				} else {
-					var arrTmp []string
-					for _, v := range arr {
-						val := qu.ObjToString(v)
-						if val != "其它" {
-							arrTmp = append(arrTmp, val)
+				if buyerclassStr, ok := (*ent)["buyerclass"].(string); ok {
+					pro["buyerclass"] = []string{buyerclassStr}
+				} else if buyerclassArr, ok := (*ent)["buyerclass"].([]interface{}); ok {
+					if len(buyerclassArr) == 1 {
+						pro["buyerclass"] = buyerclassArr
+					} else {
+						var arrTmp []string
+						for _, v := range buyerclassArr {
+							val := qu.ObjToString(v)
+							if val != "其它" {
+								arrTmp = append(arrTmp, val)
+							}
 						}
+						pro["buyerclass"] = arrTmp
 					}
-					pro["buyerclass"] = arrTmp
 				}
 			}
 			maps := []map[string]interface{}{}

+ 6 - 6
src/jy/extract/extract.go

@@ -647,8 +647,8 @@ func (e *ExtractTask) ExtractDetail(j *ju.Job, isSite bool, codeSite string) {
 		for key, val := range j.Result {
 			for i, v := range val {
 				if v.Field == "project_duration" {
-					arr:=clear.ObjToMoney([]interface{}{v.Value, j.Content},j.SpiderCode, j.IsClearnMoney)
-					if len(arr)>0 {
+					arr := clear.ObjToMoney([]interface{}{v.Value, j.Content}, j.SpiderCode, j.IsClearnMoney)
+					if len(arr) > 0 {
 						v.Value = arr[0]
 					}
 				}
@@ -988,7 +988,7 @@ func ExtRuleCoreByReg(extfrom string, doc map[string]interface{}, j *ju.Job, in
 				AddExtLog("extract", j.SourceMid, nil, extinfo, in, et.TaskInfo) //抽取日志
 			}
 		} else if in.Field == "qualifies" {
-			extinfo := extRegCoreToResult(extfrom,pretreated.HtmlToText(qu.ObjToString(doc[extfrom]) ), &map[string]string{}, j, in, isSite)
+			extinfo := extRegCoreToResult(extfrom, pretreated.HtmlToText(qu.ObjToString(doc[extfrom])), &map[string]string{}, j, in, isSite)
 			if len(extinfo) > 0 {
 				AddExtLog("extract", j.SourceMid, nil, extinfo, in, et.TaskInfo) //抽取日志
 			}
@@ -1807,7 +1807,7 @@ func AnalysisSaveResult(j, jf *ju.Job, e *ExtractTask) {
 					delete(v, "bidamount")
 				}
 				j.Winnerorder = nil
-				if jf!= nil && jf.Winnerorder!= nil{
+				if jf != nil && jf.Winnerorder != nil {
 					jf.Winnerorder = nil
 				}
 			}
@@ -1968,7 +1968,7 @@ func AnalysisSaveResult(j, jf *ju.Job, e *ExtractTask) {
 					if v.Score > -1 {
 						ffield[v.Field] = v.Value
 						if tmp[v.Field] == nil {
-							if (v.Field == "bidamount" || v.Field == "budget") && v.IsTrue {
+							if (v.Field == "bidamount" || v.Field == "budget") && v.IsTrue && v.Value.(float64) > 100 && v.Value.(float64) < 50000000000 {
 								tmp[v.Field] = v.Value
 								break
 							}
@@ -2202,7 +2202,7 @@ func checkFields(tmp map[string]interface{}) map[string]interface{} {
 	}
 
 	//工期单位-清理
-	if tmp["project_timeunit"]=="年" && tmp["project_duration"] == nil {
+	if tmp["project_timeunit"] == "年" && tmp["project_duration"] == nil {
 		delete(tmp, "project_timeunit")
 	}
 	tmp["repeat"] = 0

+ 6 - 0
src/jy/extract/score_jsondata.go

@@ -194,6 +194,8 @@ func JsonDataMergeProcessing(j *util.Job, e *ExtractTask) map[string][]*util.Ext
 			oneScore := j.Result[v][0].Score
 			if oneScore < 0 {
 				oneScore = 0
+			}else {
+				oneScore -= 0.5
 			}
 			if v == "budget" || v == "bidamount" {
 				lockclear.Lock()
@@ -209,11 +211,15 @@ func JsonDataMergeProcessing(j *util.Job, e *ExtractTask) map[string][]*util.Ext
 					if jdextweight > 1 {
 						if oneScore < 0 {
 							oneScore = 0.1
+						}else {
+							oneScore -= 0.5
 						}
 						extFields = append(extFields, &util.ExtField{Code: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), Field: v, ExtFrom: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), SourceValue: (*j.Jsondata)[v], Value: newNum[0], Score: oneScore + 1, IsTrue: newNum[len(newNum)-1].(bool)})
 					} else {
 						if oneScore < 0 {
 							oneScore = 0.1
+						}else {
+							oneScore -= 0.5
 						}
 						extFields = append(extFields, &util.ExtField{Code: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), Field: v, ExtFrom: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), SourceValue: (*j.Jsondata)[v], Value: newNum[0], Score: oneScore, IsTrue: newNum[len(newNum)-1].(bool)})
 					}