瀏覽代碼

Merge branch 'dev1.4' of http://192.168.3.207:10080/qmx/datatag into dev1.4

fuwencai 4 年之前
父節點
當前提交
68b2e73bed
共有 4 個文件被更改,包括 52 次插入8 次删除
  1. 8 1
      src/config.json
  2. 5 5
      src/history/task.go
  3. 27 2
      src/history/util_history.go
  4. 12 0
      src/util/config.go

+ 8 - 1
src/config.json

@@ -139,5 +139,12 @@
 		"password": "Topnet123",
 		"address": "192.168.3.11:3366",
 		"dbName": "jianyu"
-	}
+	},
+	"bidding_mgo": {
+		"addr": "192.168.3.207:27092",
+		"coll": "bidding",
+		"db": "qfw_data",
+		"size": 15
+	},
+	"file_downloadurl": "http://jy-datafile.oss-cn-beijing.aliyuncs.com/"
 }

+ 5 - 5
src/history/task.go

@@ -426,7 +426,7 @@ func (c *Customer) AssembelAndSaveData(historyId string, isFilter, noticeFilter,
 	wg := &sync.WaitGroup{}
 	var datalock = sync.RWMutex{}
 	n := 0
-	if c.PushModel == 0 && len(c.SaveDataMap) > 0 {
+	if (c.PushModel == 0 || c.PushModel == 1 || c.PushModel == 4) && len(c.SaveDataMap) > 0 {
 		for _, tmp := range c.SaveDataMap {
 			wg.Add(1)
 			ch <- true
@@ -445,7 +445,7 @@ func (c *Customer) AssembelAndSaveData(historyId string, isFilter, noticeFilter,
 			}
 		}
 		wg.Wait()
-	} else if c.PushModel == 1 || c.PushModel == 2 || c.PushModel == 3 {
+	} else if c.PushModel == 2 || c.PushModel == 3 {
 		for _, dm := range c.Departments {
 			if len(dm.SaveDataMap) > 0 {
 				for _, tmp := range dm.SaveDataMap {
@@ -468,8 +468,8 @@ func (c *Customer) AssembelAndSaveData(historyId string, isFilter, noticeFilter,
 			}
 		}
 		wg.Wait()
-	} else if c.PushModel == 4 && len(c.SaveDataArr) > 0 {
-		for _, tmp := range c.SaveDataArr {
+	} /*else if c.PushModel == 4 && len(c.SaveDataMap) > 0 {
+		for _, tmp := range c.SaveDataMap {
 			wg.Add(1)
 			ch <- true
 			go func(data map[string]interface{}) {
@@ -487,7 +487,7 @@ func (c *Customer) AssembelAndSaveData(historyId string, isFilter, noticeFilter,
 			}
 		}
 		wg.Wait()
-	}
+	}*/
 	log.Println("数据保存完毕...		Save Number:", n)
 }
 

+ 27 - 2
src/history/util_history.go

@@ -564,10 +564,12 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
 			}
 			log.Println("项目id去重,项目id:", projectId, isOk)
 		}
+	} else {
+		tmp["projectId"] = ""
 	}
 
 	//河南移动/盈峰科技
-	if NeedProjectidAppidMap[appid] {
+	/*if NeedProjectidAppidMap[appid] {
 		projectId := GetProjectId(id)
 		if projectId != "" {
 			//projectIds := strings.Split(projectId, ",")
@@ -576,7 +578,8 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
 		} else {
 			tmp["projectId"] = ""
 		}
-	}
+	}*/
+
 	// 标识第一条数据是否拆过包
 	var isDis bool = false
 	if DisPackageAppidMap[appid] {
@@ -682,6 +685,28 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
 			MgoSave.Save(SaveCollbid, tmp)
 		}
 	}
+	//匹配公告附件
+	info := MgoBidding.FindOne(BiddingColl, map[string]interface{}{"_id": mongodb.StringTOBsonId(id)})
+	if info != nil && len(info) > 0 {
+		if info["projectinfo"] != nil {
+			projectInfo := qu.ObjToMap(info["projectinfo"])
+			if (*projectInfo)["attachments"] != nil {
+				filesArr := []map[string]interface{}{}
+				fileUrl := qu.ObjToString(Sysconfig["file_downloadurl"])
+				attachments := (*projectInfo)["attachments"].(map[string]interface{})
+				for _, v := range attachments {
+					atta := v.(map[string]interface{})
+					fileMap := map[string]interface{}{
+						"filename": atta["filename"],
+						"url":      fileUrl + qu.ObjToString(atta["fid"]),
+					}
+					filesArr = append(filesArr, fileMap)
+				}
+				log.Println("查询附件结果:", id, "附件数量:", len(filesArr))
+				tmp["filehref"] = filesArr
+			}
+		}
+	}
 	if isOk {
 		if dataTable == 0 { //存到usermail_history
 			MgoSaveCache <- tmp

+ 12 - 0
src/util/config.go

@@ -31,6 +31,8 @@ var (
 	MgoBuyer        *mgo.MongodbSim //医院等级信息
 	MgoEnps         *mgo.MongodbSim //企业信息
 	MgoExtract      *mgo.MongodbSim //抽取
+	MgoBidding		*mgo.MongodbSim //bidding
+	BiddingColl		string
 	SaveColl        string
 	HospColl        string
 	BuyerEntColl    string
@@ -289,6 +291,16 @@ func initdb() {
 	}
 	MgoExtract.InitPool()
 
+	//bidding库
+	bidding := Sysconfig["bidding_mgo"].(map[string]interface{})
+	BiddingColl = qu.ObjToString(bidding["coll"])
+	MgoBidding = &mgo.MongodbSim{
+		MongodbAddr: qu.ObjToString(bidding["addr"]),
+		DbName:      qu.ObjToString(bidding["db"]),
+		Size:        qu.IntAll(bidding["size"]),
+	}
+	MgoBidding.InitPool()
+
 	//es
 	es := Sysconfig["es"].(map[string]interface{})
 	Es = &elastic.Elastic{