Browse Source

新增winnerorder字段

maxiaoshan 4 years ago
parent
commit
a1b6821289

+ 20 - 1
udpcreateindex/src/biddingall.go

@@ -304,7 +304,25 @@ func biddingAllTask(data []byte, mapInfo map[string]interface{}) {
 							if len(purchasinglist_new) > 0 {
 								newTmp[v] = purchasinglist_new
 							}
-
+							/*} else if v == "winnerorder" { //中标候选
+							winnerorder_new := []map[string]interface{}{}
+							if winnerorder, _ := tmp[v].([]interface{}); len(winnerorder) > 0 {
+								for _, win := range winnerorder {
+									winMap_new := make(map[string]interface{})
+									winMap := win.(bson.M)
+									for _, wf := range winnerorderlistFields {
+										if winMap[wf] != nil {
+											winMap_new[wf] = winMap[wf]
+										}
+									}
+									if winMap_new != nil && len(winMap_new) > 0 {
+										winnerorder_new = append(winnerorder_new, winMap_new)
+									}
+								}
+							}
+							if len(winnerorder_new) > 0 {
+								newTmp[v] = winnerorder_new
+							}*/
 						} else {
 							if v == "detail" {
 								detail, _ := tmp[v].(string)
@@ -323,6 +341,7 @@ func biddingAllTask(data []byte, mapInfo map[string]interface{}) {
 				arrEs = append(arrEs, newTmp)
 			}
 			if len(update) > 0 {
+				//delete(update, "winnerorder") //winnerorder不需要更新到bindding表,删除
 				queryId := map[string]interface{}{"_id": tmp["_id"]}
 				set := map[string]interface{}{"$set": update}
 				if len(del) > 0 { //删除的数据

+ 21 - 0
udpcreateindex/src/biddingindex.go

@@ -353,6 +353,26 @@ func doIndex(infos []map[string]interface{}, eMap map[string]map[string]interfac
 						if len(purchasinglist_new) > 0 {
 							newTmp[v] = purchasinglist_new
 						}
+						/*} else if v == "winnerorder" { //中标候选
+						winnerorder_new := []map[string]interface{}{}
+						if winnerorder, _ := tmp[v].([]interface{}); len(winnerorder) > 0 {
+							for _, win := range winnerorder {
+								winMap_new := make(map[string]interface{})
+								winMap := win.(map[string]interface{})
+								for _, wf := range winnerorderlistFields {
+									if winMap[wf] != nil {
+										winMap_new[wf] = winMap[wf]
+									}
+								}
+								if winMap_new != nil && len(winMap_new) > 0 {
+									winnerorder_new = append(winnerorder_new, winMap_new)
+								}
+							}
+						}
+						if len(winnerorder_new) > 0 {
+							newTmp[v] = winnerorder_new
+						}
+						*/
 					} else {
 						if v == "detail" {
 							detail, _ := tmp[v].(string)
@@ -369,6 +389,7 @@ func doIndex(infos []map[string]interface{}, eMap map[string]map[string]interfac
 			arrEs = append(arrEs, newTmp)
 		}
 		if len(update) > 0 {
+			//delete(update, "winnerorder") //winnerorder不需要更新到bindding表,删除
 			arr = append(arr, []map[string]interface{}{
 				map[string]interface{}{
 					"_id": tmp["_id"],

+ 11 - 10
udpcreateindex/src/config.json

@@ -1,6 +1,11 @@
 {
     "udpport": ":1483",
     "msg_server": "10.171.112.160:7070",
+     "mongodb": {
+        "addr": "192.168.3.207:27092",
+        "pool": 10,
+        "db": "mxs"
+    },
 	"savedb": {
         "addr": "192.168.3.207:27092",
         "size": 10,
@@ -30,17 +35,18 @@
     },
     "bidding": {
         "db": "mxs",
-        "collect": "test",
+        "collect": "bidding",
         "index": "bidding_v1",
         "type": "bidding",
         "extractdb": "mxs",
         "extractcollect": "extract",
         "indexfields":[ 
-        "buyerzipcode","winnertel","winnerperson","contractcode","winneraddr","agencyaddr","buyeraddr","signaturedate","projectperiod","projectaddr","agencytel","agencyperson","buyerperson","agency","projectscope","projectcode","bidopentime","supervisorrate","buyertel","bidamount","winner","buyer","budget","projectname","bidstatus","buyerclass","topscopeclass","s_topscopeclass","s_subscopeclass","area","city","district","s_winner","_id","title","detail","site","comeintime","href","infoformat","publishtime","s_sha","spidercode","subtype","toptype","projectinfo","purchasing","purchasinglist","filetext","channel"
+        "buyerzipcode","winnertel","winnerperson","contractcode","winneraddr","agencyaddr","buyeraddr","signaturedate","projectperiod","projectaddr","agencytel","agencyperson","buyerperson","agency","projectscope","projectcode","bidopentime","supervisorrate","buyertel","bidamount","winner","buyer","budget","projectname","bidstatus","buyerclass","topscopeclass","s_topscopeclass","s_subscopeclass","area","city","district","s_winner","_id","title","detail","site","comeintime","href","infoformat","publishtime","s_sha","spidercode","subtype","toptype","projectinfo","purchasing","purchasinglist","filetext","channel","winnerorder"
         ],
-        "fields": "buyerzipcode,winnertel,winnerperson,contractcode,winneraddr,agencyaddr,buyeraddr,signaturedate,projectperiod,projectaddr,agencytel,agencyperson,buyerperson,agency,projectscope,projectcode,bidopentime,supervisorrate,buyertel,bidamount,winner,buyer,budget,projectname,buyerclass,topscopeclass,s_topscopeclass,area,city,district,s_winner,toptype,subtype,subscopeclass,s_subscopeclass,dataging",
+        "fields": "buyerzipcode,winnertel,winnerperson,contractcode,winneraddr,agencyaddr,buyeraddr,signaturedate,projectperiod,projectaddr,agencytel,agencyperson,buyerperson,agency,projectscope,projectcode,bidopentime,supervisorrate,buyertel,bidamount,winner,buyer,budget,projectname,buyerclass,topscopeclass,s_topscopeclass,area,city,district,s_winner,toptype,subtype,subscopeclass,s_subscopeclass,dataging,winnerorder",
         "projectinfo": "approvecode,approvecontent,approvestatus,approvetime,approvedept,approvenumber,projecttype,approvecity",
-        "purchasinglist":"itemname,model,unitname,number",
+        "purchasinglist": "itemname,model,unitname,number",
+        "winnerorder": "sort,sortstr,entname",
         "multiIndex": ""
     },
     "filelength": 50000,
@@ -88,13 +94,8 @@
        		"type": "agencyent"
 		}
     },
-    "mongodb": {
-        "addr": "192.168.3.207:27092",
-        "pool": 10,
-        "db": "mxs"
-    },
     "elastic": {
-        "addr": "http://192.168.3.11:9800",
+        "addr": "http://192.168.3.128:9800",
         "pool": 12
     }
 }

+ 23 - 16
udpcreateindex/src/main.go

@@ -14,22 +14,23 @@ import (
 )
 
 var (
-	Sysconfig            map[string]interface{} //配置文件
-	mgo                  *mongodb.MongodbSim    //mongodb操作对象
-	extractmgo           *mongodb.MongodbSim    //mongodb操作对象
-	project2db           *mongodb.MongodbSim    //mongodb操作对象
-	mgostandard          *mongodb.MongodbSim    //mongodb操作对象
-	qyxydb               *mongodb.MongodbSim    //mongodb操作对象
-	udpclient            mu.UdpClient           //udp对象
-	updport              string
-	savesizei            = 500
-	biddingIndexFields   = []string{"_id", "buyerclass", "s_winner", "title", "detail", "detail_bak", "area", "areaval", "site", "type", "amount", "bidopendate", "bidopentime", "buyer", "channel", "city", "comeintime", "contenthtml", "descript", "description", "extracttype", "href", "infoformat", "keywords", "projectcode", "projectname", "publishtime", "s_sha", "spidercode", "subtype", "summary", "toptype", "urltop", "winner", "agency", "budget", "bidamount", "s_subscopeclass", "projectscope", "bidstatus"}
-	projectinfoFields    []string
-	multiIndex           []string
-	purchasinglistFields []string
-	BulkSize             = 400
-	detailLength         = 50000
-	fileLength           = 50000
+	Sysconfig             map[string]interface{} //配置文件
+	mgo                   *mongodb.MongodbSim    //mongodb操作对象
+	extractmgo            *mongodb.MongodbSim    //mongodb操作对象
+	project2db            *mongodb.MongodbSim    //mongodb操作对象
+	mgostandard           *mongodb.MongodbSim    //mongodb操作对象
+	qyxydb                *mongodb.MongodbSim    //mongodb操作对象
+	udpclient             mu.UdpClient           //udp对象
+	updport               string
+	savesizei             = 500
+	biddingIndexFields    = []string{"_id", "buyerclass", "s_winner", "title", "detail", "detail_bak", "area", "areaval", "site", "type", "amount", "bidopendate", "bidopentime", "buyer", "channel", "city", "comeintime", "contenthtml", "descript", "description", "extracttype", "href", "infoformat", "keywords", "projectcode", "projectname", "publishtime", "s_sha", "spidercode", "subtype", "summary", "toptype", "urltop", "winner", "agency", "budget", "bidamount", "s_subscopeclass", "projectscope", "bidstatus"}
+	projectinfoFields     []string
+	multiIndex            []string
+	purchasinglistFields  []string
+	winnerorderlistFields []string
+	BulkSize              = 400
+	detailLength          = 50000
+	fileLength            = 50000
 	//bidding_other连接信息
 	bidding_other_es *elastic.Elastic
 	other_index      string
@@ -130,6 +131,12 @@ func init() {
 			purchasinglistFields = strings.Split(pcl, ",")
 		}
 	}
+	// if bidding["winnerorder"] != nil {
+	// 	winnerorder := util.ObjToString(bidding["winnerorder"])
+	// 	if winnerorder != "" {
+	// 		winnerorderlistFields = strings.Split(winnerorder, ",")
+	// 	}
+	// }
 	if bidding["multiIndex"] != nil {
 		mi := util.ObjToString(bidding["multiIndex"])
 		if mi != "" {