瀏覽代碼

融合全量-修改备份

apple 4 年之前
父節點
當前提交
7e2dd72772
共有 5 個文件被更改,包括 226 次插入323 次删除
  1. 2 2
      udpfusion/src/config.json
  2. 142 142
      udpfusion/src/fusionFullData.go
  3. 70 178
      udpfusion/src/weightFusion.go
  4. 2 0
      udpfusion/src/weightFusionMethod.go
  5. 10 1
      udpfusion/src/weightValue.go

+ 2 - 2
udpfusion/src/config.json

@@ -13,7 +13,7 @@
   },
   "es": {
     "addr": "http://127.0.0.1:12003",
-    "size":50,
+    "size":20,
     "es_pool": 10,
     "index": "zktest",
     "type": "zktest"
@@ -21,7 +21,7 @@
   "group_coll_name":"zk_fusion_group",
   "fusion_coll_name":"zk_fusiondata",
   "record_coll_name":"zk_recorddata",
-  "isgroupfn": 1000,
+  "isgroupfn": 10000,
   "jkmail": {
     "to": "zhengkun@topnet.net.cn",
     "api": "http://10.171.112.160:19281/_send/_mail"

+ 142 - 142
udpfusion/src/fusionFullData.go

@@ -11,153 +11,17 @@ import (
 	es_elastic "qfw/common/src/gopkg.in/olivere/elastic.v1"
 )
 
-func exportFusionMongoData()  {
-
-	start := int(time.Now().Unix())
-	log.Println("开始导出融合组数据......")
-	//遍历索引
-	esclient := elastic.GetEsConn()
-	defer elastic.DestoryEsConn(esclient)
-
-	if esclient == nil {
-		log.Println("连接池异常")
-	}
-	q :=es_elastic.NewBoolQuery()
-	cursor, err := esclient.Scan(esIndex).Query(es_elastic.NewBoolQuery().Must(q)).
-		Size(200).Do()
-	if err != nil {
-		log.Println("cursor",err)
-	}
-	if cursor.Results == nil {
-		log.Println("results != nil; got nil")
-	}
-	if cursor.Results.Hits == nil {
-		log.Println("expected results.Hits != nil; got nil")
-	}
-	log.Println("查询正常-总数:",cursor.TotalHits())
-	//多线程 - 处理数据
-	pool_es := make(chan bool, es_pool)
-	wg_es := &sync.WaitGroup{}
-	pages,numDocs := 0,0
-	for {
-		searchResult, err := cursor.Next()
-		if err != nil {
-			if err.Error() == "EOS" {
-				break
-			}else {
-				log.Println("cursor searchResult",err)
-			}
-		}
-		pages++
-		isLog := false
-		for _, hit := range searchResult.Hits.Hits {
-			tmp := make(map[string]interface{})
-			err := json.Unmarshal(*hit.Source, &tmp)
-			if err != nil {
-				log.Println("json Unmarshal error")
-				continue
-			}
-			if !isLog && numDocs%10000==0 {
-				log.Println("当前条数:", numDocs, "Es数据:", tmp["_id"])
-				isLog = true
-			}
-
-			numDocs++
-			fusion_ids := qu.ObjToString(tmp["allids"])
-			sourceid := qu.ObjToString(tmp["_id"])
-			pool_es <- true
-			wg_es.Add(1)
-			go func(sourceid string, fusionArr string) {
-				defer func() {
-					<-pool_es
-					wg_es.Done()
-				}()
-				AddGroupPool.pool <- map[string]interface{}{
-					"_id":StringTOBsonId(sourceid),
-					"allids":fusion_ids,
-				}
-			}(sourceid, fusion_ids)
-		}
-
-	}
-	log.Println("遍历Es结束......")
-	wg_es.Wait()
-
-	log.Println("fusion group over :",numDocs,"用时:",int(time.Now().Unix())-start,"秒")
-}
-
-func startFusionData()  {
-	log.Println("开始全量融合流程...")
-	defer qu.Catch()
-	//可以开多程序-不同id段执行融合
-	q := map[string]interface{}{}
-	sess := mgo.GetMgoConn()
-	defer mgo.DestoryMongoConn(sess)
-	it := sess.DB(mgo.DbName).C(group_coll_name).Find(&q).Iter()
-	index,start :=0, int(time.Now().Unix())
-	//多线程保存数据
-	pool_mgo := make(chan bool, mgo_pool)
-	wg_mgo := &sync.WaitGroup{}
-	for tmp := make(map[string]interface{}); it.Next(&tmp); index++ {
-		if index%10000==0 {
-			log.Println("current index",index,tmp["_id"])
-		}
-		fusion_ids := qu.ObjToString(tmp["allids"])
-		fusionArr := strings.Split(fusion_ids, ",")
-		sourceid := BsonTOStringId(tmp["_id"])
-		pool_mgo <- true
-		wg_mgo.Add(1)
-		go func(sourceid string, fusionArr []string) {
-			defer func() {
-				<-pool_mgo
-				wg_mgo.Done()
-			}()
-			weight := NewWeightData(fusionArr)
-			weight.analyzeBuildStandardData()
-
-			saveFusionData, saveRecordData:= map[string]interface{}{},map[string]interface{}{}
-			if len(fusionArr) <= 1 {
-				saveFusionData, saveRecordData = weight.dealWithAddFusionStruct()
-			}else {
-				saveFusionData, saveRecordData = weight.dealWithMultipleAddFusionStruct()
-			}
-			//新增融合表
-			saveid := mgo.Save(fusion_coll_name, saveFusionData)
-			saveRecordData["_id"] = saveid
-			//批量新增日志表
-			AddRecordPool.pool <- saveRecordData
-			//批量更新分组表
-			UpdateGroupPool.pool <- []map[string]interface{}{
-				map[string]interface{}{
-					"_id": StringTOBsonId(sourceid),
-				},
-				map[string]interface{}{
-					"$set": map[string]interface{}{
-						"fusion_id": BsonTOStringId(saveid),
-						"template_id":qu.ObjToString(saveFusionData["fusion_templateid"]),
-					},
-				},
-			}
-		}(sourceid, fusionArr)
-
-		tmp = make(map[string]interface{})
-	}
-	wg_mgo.Wait()
-
-	log.Println("fusion is over:",index,"总用时:",int(time.Now().Unix())-start,"秒")
-
-}
-
 
 func startTaskFullData(data []byte, mapInfo map[string]interface{}) {
 
+	//临时测试
 	//先到处具体需要融合组数据-存mongo
 	exportFusionMongoData()
-	time.Sleep(30 * time.Second)
+	time.Sleep(60 * time.Second)
 
 	//具体融合数据的方法
 	startFusionData()
-	time.Sleep(30 * time.Second)
+	time.Sleep(60 * time.Second)
 	return
 
 
@@ -276,14 +140,14 @@ func startTaskFullData(data []byte, mapInfo map[string]interface{}) {
 
 	}
 	log.Println("索引准备完毕睡眠30s......耗时:",int(time.Now().Unix())-start,"秒")
-	time.Sleep(30 * time.Second)
+	time.Sleep(60 * time.Second)
 
 	//先到处具体需要融合组数据-存mongo
 	exportFusionMongoData()
-	time.Sleep(30 * time.Second)
+	time.Sleep(60 * time.Second)
 	//具体融合数据的方法
 	startFusionData()
-	time.Sleep(30 * time.Second)
+	time.Sleep(60 * time.Second)
 
 	taskSendFusionUdp(mapInfo)
 }
@@ -291,3 +155,139 @@ func startTaskFullData(data []byte, mapInfo map[string]interface{}) {
 
 
 
+func exportFusionMongoData()  {
+
+	start := int(time.Now().Unix())
+	log.Println("开始导出融合组数据......")
+	//遍历索引
+	esclient := elastic.GetEsConn()
+	defer elastic.DestoryEsConn(esclient)
+
+	if esclient == nil {
+		log.Println("连接池异常")
+	}
+	q :=es_elastic.NewBoolQuery()
+	cursor, err := esclient.Scan(esIndex).Query(es_elastic.NewBoolQuery().Must(q)).
+		Size(200).Do()
+	if err != nil {
+		log.Println("cursor",err)
+	}
+	if cursor.Results == nil {
+		log.Println("results != nil; got nil")
+	}
+	if cursor.Results.Hits == nil {
+		log.Println("expected results.Hits != nil; got nil")
+	}
+	log.Println("查询正常-总数:",cursor.TotalHits())
+	//多线程 - 处理数据
+	pool_es := make(chan bool, es_pool)
+	wg_es := &sync.WaitGroup{}
+	pages,numDocs := 0,0
+	for {
+		searchResult, err := cursor.Next()
+		if err != nil {
+			if err.Error() == "EOS" {
+				break
+			}else {
+				log.Println("cursor searchResult",err)
+			}
+		}
+		pages++
+		isLog := false
+		for _, hit := range searchResult.Hits.Hits {
+			tmp := make(map[string]interface{})
+			err := json.Unmarshal(*hit.Source, &tmp)
+			if err != nil {
+				log.Println("json Unmarshal error")
+				continue
+			}
+			if !isLog && numDocs%10000==0 {
+				log.Println("当前条数:", numDocs, "Es数据:", tmp["_id"])
+				isLog = true
+			}
+
+			numDocs++
+			fusion_ids := qu.ObjToString(tmp["allids"])
+			sourceid := qu.ObjToString(tmp["_id"])
+			pool_es <- true
+			wg_es.Add(1)
+			go func(sourceid string, fusionArr string) {
+				defer func() {
+					<-pool_es
+					wg_es.Done()
+				}()
+				AddGroupPool.pool <- map[string]interface{}{
+					"_id":StringTOBsonId(sourceid),
+					"allids":fusion_ids,
+				}
+			}(sourceid, fusion_ids)
+		}
+
+	}
+	log.Println("遍历Es结束......")
+	wg_es.Wait()
+
+	log.Println("fusion group over :",numDocs,"用时:",int(time.Now().Unix())-start,"秒")
+}
+
+func startFusionData()  {
+	log.Println("开始全量融合流程...")
+	defer qu.Catch()
+	//可以开多程序-不同id段执行融合
+	q := map[string]interface{}{}
+	sess := mgo.GetMgoConn()
+	defer mgo.DestoryMongoConn(sess)
+	it := sess.DB(mgo.DbName).C(group_coll_name).Find(&q).Iter()
+	index,start :=0, int(time.Now().Unix())
+	//多线程保存数据
+	pool_mgo := make(chan bool, mgo_pool)
+	wg_mgo := &sync.WaitGroup{}
+	for tmp := make(map[string]interface{}); it.Next(&tmp); index++ {
+		if index%10000==0 {
+			log.Println("current index",index,tmp["_id"])
+		}
+		fusion_ids := qu.ObjToString(tmp["allids"])
+		fusionArr := strings.Split(fusion_ids, ",")
+		sourceid := BsonTOStringId(tmp["_id"])
+		pool_mgo <- true
+		wg_mgo.Add(1)
+		go func(sourceid string, fusionArr []string) {
+			defer func() {
+				<-pool_mgo
+				wg_mgo.Done()
+			}()
+			weight := NewWeightData(fusionArr)
+			weight.analyzeBuildStandardData()
+
+			saveFusionData, saveRecordData:= map[string]interface{}{},map[string]interface{}{}
+			if len(fusionArr) <= 1 {
+				saveFusionData, saveRecordData = weight.dealWithAddFusionStruct()
+			}else {
+				saveFusionData, saveRecordData = weight.dealWithMultipleAddFusionStruct()
+			}
+			//新增融合表
+			saveid := mgo.Save(fusion_coll_name, saveFusionData)
+			saveRecordData["_id"] = saveid
+			//批量新增日志表
+			AddRecordPool.pool <- saveRecordData
+			//批量更新分组表
+			UpdateGroupPool.pool <- []map[string]interface{}{
+				map[string]interface{}{
+					"_id": StringTOBsonId(sourceid),
+				},
+				map[string]interface{}{
+					"$set": map[string]interface{}{
+						"fusion_id": BsonTOStringId(saveid),
+						"template_id":qu.ObjToString(saveFusionData["fusion_templateid"]),
+					},
+				},
+			}
+		}(sourceid, fusionArr)
+
+		tmp = make(map[string]interface{})
+	}
+	wg_mgo.Wait()
+
+	log.Println("fusion is over:",index,"总用时:",int(time.Now().Unix())-start,"秒")
+
+}

+ 70 - 178
udpfusion/src/weightFusion.go

@@ -32,13 +32,11 @@ func (weight *weightDataMap) dealWithAddFusionStruct ()(map[string]interface{},m
 	dict["fusion_templateid"] = weight.templateid
 	//站点,质量分
 	dict["fusion_score"] = weight.dealWithLevelAndScoreRecord()
-
-
-
+	//记录所有href
+	dict["fusion_all_hrefs"] = weight.allhrefs
 	//采用新增id
 	delete(dict,"_id")
-
-
+	//日志相关处理
 	recordDict := make(map[string]interface{},0)
 	recordDict["1"] = map[string]interface{}{
 		"data":map[string]interface{}{},
@@ -67,9 +65,17 @@ func (weight *weightDataMap) dealWithMultipleAddFusionStruct ()(map[string]inter
 	dict["fusion_templateid"] = weight.templateid
 	//站点,质量分
 	dict["fusion_score"] = weight.dealWithLevelAndScoreRecord()
+	//当前更新时间
+	dict["fusion_time"] = qu.IntAll(time.Now().Unix())
+	//融合生成时间
+	dict["fusion_updatetime"] = qu.IntAll(time.Now().Unix())
+	//记录所有href
+	dict["fusion_all_hrefs"] = weight.allhrefs
 
 
 
+	//采用新增id
+	delete(dict,"_id")
 	//日志记录
 	recordDict := make(map[string]interface{},0)
 	//结构体字段逻辑处理
@@ -82,20 +88,6 @@ func (weight *weightDataMap) dealWithMultipleAddFusionStruct ()(map[string]inter
 	for k,v:=range otherFieldData {
 		dict[k] = v
 	}
-
-	//if len(recordDict)>0 {
-	//	log.Println("有更新数据:",len(recordDict))
-	//}
-
-	//当前更新时间
-	dict["fusion_time"] = qu.IntAll(time.Now().Unix())
-	//融合生成时间
-	dict["fusion_updatetime"] = qu.IntAll(time.Now().Unix())
-
-
-	//采用新增id
-	delete(dict,"_id")
-
 	newRecordDict := make(map[string]interface{},0)
 	newRecordDict["1"] = map[string]interface{}{
 		"data":recordDict,
@@ -103,64 +95,9 @@ func (weight *weightDataMap) dealWithMultipleAddFusionStruct ()(map[string]inter
 	}
 	newRecordDict["number"] = qu.Int64All(1)
 
+	//融合表记录的字段
+	dict["fusion_fields"] = weight.dealWithFusionFields(recordDict)
 
-	//分析recordDict记录在融合表里
-	/*
-		{
-            "item" : {
-                "id" : "603c7addf021652bdeb21fc6",
-                "value" : "建材"
-            }
-	 		"bidamount" : {
-                "id" : "603bc7d036baf5b8f2bb159a",
-                "value" : 8005829.82
-            }
-			"attach_text" : [
-                {
-                    "id" : "5ff1f441c2c0c99d52d74130",
-                    "value" : {
-                        "0" : {
-                            "file_name" : "技术参数.docx",
-                            "attach_url" : "93736308-4de4-11eb-9409-0242ac120005"
-                        }
-                    }
-                }
-            ],
-
-	}
-	*/
-
-	//attach_text需要单独处理
-	fieldCal := make(map[string]interface{},0)
-	for k,v:=range recordDict{
-		if k=="attach_text" {
-			if attachArr,b := v.([]map[string]interface{});b {
-				for _,v1:=range attachArr {
-					dict := *qu.ObjToMap(v1)
-					tmp_id := qu.ObjToString(dict["id"])
-					if fieldCal[tmp_id]==nil {
-						fieldCal[tmp_id] = []interface{}{k}
-					}else {
-						arr := fieldCal[tmp_id].([]interface{})
-						arr = append(arr,k)
-						fieldCal[tmp_id] = arr
-					}
-				}
-			}
-		}else {
-			dict := *qu.ObjToMap(v)
-			tmp_id := qu.ObjToString(dict["id"])
-			if fieldCal[tmp_id]==nil {
-				fieldCal[tmp_id] = []interface{}{k}
-			}else {
-				arr := fieldCal[tmp_id].([]interface{})
-				arr = append(arr,k)
-				fieldCal[tmp_id] = arr
-			}
-		}
-	}
-
-	dict["fusion_fields"] = fieldCal
 
 	//返回,更新数据,日志记录数据
 	return dict,newRecordDict
@@ -181,11 +118,16 @@ func (weight *weightDataMap) dealWithMultipleUpdateFusionStruct (tmpData map[str
 	dict["fusion_saveids"] = weight.saveids
 	//融合模板
 	dict["fusion_templateid"] = weight.templateid
+	//记录所有href
+	dict["fusion_all_hrefs"] = weight.allhrefs
 	//站点,质量分
 	dict["fusion_score"] = weight.dealWithLevelAndScoreRecord()
-
-
-
+	//融合生成时间-取融合表第一次融合时间
+	dict["fusion_time"] = tmpData["fusion_time"]
+	//当前更新时间
+	dict["fusion_updatetime"] = qu.IntAll(time.Now().Unix())
+	//删除_id
+	delete(dict,"_id")
 
 
 	//日志记录-还有快照页面 等等
@@ -200,19 +142,6 @@ func (weight *weightDataMap) dealWithMultipleUpdateFusionStruct (tmpData map[str
 	for k,v:=range otherFieldData {
 		dict[k] = v
 	}
-
-	//if len(recordDict)>0 {
-	//	log.Println("有更新数据:",len(recordDict))
-	//}
-
-
-	//融合生成时间-取融合表第一次融合时间
-	dict["fusion_time"] = tmpData["fusion_time"]
-	//当前更新时间
-	dict["fusion_updatetime"] = qu.IntAll(time.Now().Unix())
-	//删除_id
-	delete(dict,"_id")
-
 	newRecordDict := make(map[string]interface{},0)
 	newRecordDict = mgo.FindById(record_coll_name,BsonTOStringId(tmpData["_id"]))
 	number:=qu.Int64All(newRecordDict["number"])
@@ -224,71 +153,19 @@ func (weight *weightDataMap) dealWithMultipleUpdateFusionStruct (tmpData map[str
 	}
 	newRecordDict["number"] = number
 
-
-	/*
-	"data" : {
-            "attach_text" : [
-                {
-                    "id" : "5ff1f441c2c0c99d52d74130",
-                    "value" : {
-                        "0" : {
-                            "file_name" : "技术参数.docx",
-                            "attach_url" : "93736308-4de4-11eb-9409-0242ac120005"
-                        }
-                    }
-                }
-            ],
-            "isextFile" : {
-                "id" : "5ff1f441c2c0c99d52d74130",
-                "value" : true
-            }
-        }
-	*/
-
-	//attach_text需要单独处理
-	fieldCal := make(map[string]interface{},0)
-	for k,v:=range recordDict{
-		if k=="attach_text" {
-			if attachArr,b := v.([]map[string]interface{});b {
-				for _,v1:=range attachArr {
-					dict := *qu.ObjToMap(v1)
-					tmp_id := qu.ObjToString(dict["id"])
-					if fieldCal[tmp_id]==nil {
-						fieldCal[tmp_id] = []interface{}{k}
-					}else {
-						arr := fieldCal[tmp_id].([]interface{})
-						arr = append(arr,k)
-						fieldCal[tmp_id] = arr
-					}
-				}
-			}
-		}else {
-			dict := *qu.ObjToMap(v)
-			tmp_id := qu.ObjToString(dict["id"])
-			if fieldCal[tmp_id]==nil {
-				fieldCal[tmp_id] = []interface{}{k}
-			}else {
-				arr := fieldCal[tmp_id].([]interface{})
-				arr = append(arr,k)
-				fieldCal[tmp_id] = arr
-			}
-		}
-	}
-
-	dict["fusion_fields"] = fieldCal
-
-
+	//融合表记录的字段
+	dict["fusion_fields"] = weight.dealWithFusionFields(recordDict)
 
 	//返回,更新数据,日志记录数据
 	return dict,newRecordDict
 }
 
 
-
-
-
-
-
+/*
+	字段处理方法
+	**********************
+	**********************
+*/
 
 //处理其他字段数据
 func (weight *weightDataMap)dealWithOtherFieldData(recordDict *map[string]interface{}) map[string]interface{} {
@@ -296,9 +173,7 @@ func (weight *weightDataMap)dealWithOtherFieldData(recordDict *map[string]interf
 	//模板id 数据
 	templateid := weight.templateid
 	templateTmp := weight.data[templateid].data
-
 	modifyData := make(map[string]interface{}, 0) //返回修改的数据
-
 	//找到非空数据
 	arr := make([]string,0)
 	for key,value:=range templateTmp {
@@ -340,8 +215,6 @@ func (weight *weightDataMap)dealWithOtherFieldData(recordDict *map[string]interf
 			}
 		}
 	}
-
-
 	//log.Println("待替换key:",arr,"修改后:",modifyData)
 
 	//第二步-集合最大化
@@ -392,40 +265,19 @@ func (weight *weightDataMap)dealWithStructData(recordDict *map[string]interface{
 
 	modifyData :=make(map[string]interface{},0)
 
-	//附件attach_text
-	/*
-		"attach_text" : {
-        "1" : {
-            "0" : {
-                "file_name" : "政采贷融资.doc",
-                "attach_url" : "d5ca0944-6af1-11eb-a8bb-0242ac120002"
-            }
-        },
-        "0" : {
-            "0" : {
-                "file_name" : "01永嘉县人民医院发光免疫试剂采购及设备租赁项目公开招标文件(电子招标).doc",
-                "attach_url" : "7827b2d4-6adb-11eb-bd40-0242ac120002"
-            }
-        }
-    },
-	*/
-
 	attach_text,isAttach:=make(map[string]interface{},0),false
 	if tmp_arr,b := templateTmp["attach_text"].(map[string]interface{});b {
 		//有值符合-
 		attach_text = tmp_arr
-		//log.Println("默认初始:",attach_text)
 	}
 	//附件判重-并合并新增
 	keyIndex := -1
-	//找到当前最大keyIndex
 	for k,_:=range attach_text {
 		key:=qu.IntAll(k)
 		if key>keyIndex {
 			keyIndex = key
 		}
 	}
-	//log.Println("当前keyIndex",keyIndex)
 	for _,value_id :=range weight.saveids {
 		if templateid == value_id {
 			continue
@@ -435,13 +287,11 @@ func (weight *weightDataMap)dealWithStructData(recordDict *map[string]interface{
 			if len(attachData)>0  { //有值
 				for _,v:=range attachData { //子元素
 					if attach,isOK := v.(map[string]interface{});isOK {
-						//log.Println(attach)
 						if !dealWithRepeatAttachData(attach_text,attach) {
 							//符合条件-不重复直接添加
 							keyIndex++
 							saveKey := fmt.Sprintf("%v",keyIndex)
 							attach_text[saveKey] = attach //key累加
-							//log.Println(attach_text)
 							isAttach = true
 
 							//多条情况-融合
@@ -538,6 +388,12 @@ func (weight *weightDataMap)dealWithStructData(recordDict *map[string]interface{
 }
 
 
+
+/*
+	以下方法-记录统计
+	******************************
+	******************************
+*/
 func (weight *weightDataMap) dealWithLevelAndScoreRecord () map[string]interface{}{
 	dict := make(map[string]interface{},0)
 	saveids:= weight.saveids
@@ -549,3 +405,39 @@ func (weight *weightDataMap) dealWithLevelAndScoreRecord () map[string]interface
 	}
 	return dict
 }
+//处理-融合的哪些字段记录
+func (weight *weightDataMap)dealWithFusionFields(data map[string]interface{}) map[string]interface{} {
+	fieldCal := make(map[string]interface{},0)
+	for k,v:=range data{
+		if k=="attach_text" {
+			if attachArr,b := v.([]map[string]interface{});b {
+				for _,v1:=range attachArr {
+					dict := *qu.ObjToMap(v1)
+					tmp_id := qu.ObjToString(dict["id"])
+					if fieldCal[tmp_id]==nil {
+						href:=qu.ObjToString(weight.data[tmp_id].data["href"])
+						fieldCal[tmp_id] = []interface{}{href,k}
+					}else {
+						arr := fieldCal[tmp_id].([]interface{})
+						arr = append(arr,k)
+						fieldCal[tmp_id] = arr
+					}
+				}
+			}
+		}else {
+			dict := *qu.ObjToMap(v)
+			tmp_id := qu.ObjToString(dict["id"])
+			if fieldCal[tmp_id]==nil {
+				href:=qu.ObjToString(weight.data[tmp_id].data["href"])
+				fieldCal[tmp_id] = []interface{}{href,k}
+			}else {
+				arr := fieldCal[tmp_id].([]interface{})
+				arr = append(arr,k)
+				fieldCal[tmp_id] = arr
+			}
+		}
+	}
+
+	return fieldCal
+}
+

+ 2 - 0
udpfusion/src/weightFusionMethod.go

@@ -6,6 +6,8 @@ import (
 	"strconv"
 )
 
+
+
 //处理-重复附件数据
 func dealWithRepeatAttachData(attach map[string]interface{},data map[string]interface{}) bool {
 	/*

+ 10 - 1
udpfusion/src/weightValue.go

@@ -1,5 +1,9 @@
 package main
 
+import (
+	qu "qfw/util"
+	"fmt"
+)
 type weightInfo struct {
 	maxLevel 		bool
 	minLevel		bool
@@ -14,18 +18,23 @@ type weightDataMap struct {
 	data   map[string]*weightInfo
 	allids    []string
 	saveids    []string
+	allhrefs	map[string]string
 	templateid 	string 	//模板id
 }
 
 func NewWeightData(arr []string) *weightDataMap {
 
-	weight := &weightDataMap{map[string]*weightInfo{},[]string{},[]string{},""}
+	weight := &weightDataMap{map[string]*weightInfo{},[]string{},[]string{}, map[string]string{},""}
 
 	data := make(map[string]*weightInfo,0)
 	for _,v:=range arr {
 		dict := mgo.FindById(coll_name,v)
 		if dict!=nil && len(dict)>2{
 			data[v] = analyzeTheSoureData(dict)
+			hrefs:= weight.allhrefs
+			keyid := fmt.Sprintf(BsonTOStringId(dict["_id"]))
+			hrefs[keyid] = qu.ObjToString(dict["href"])
+			weight.allhrefs = hrefs
 		}
 	}