xuzhiheng 4 mēneši atpakaļ
vecāks
revīzija
29660969c4
3 mainītis faili ar 28 papildinājumiem un 16 dzēšanām
  1. 1 1
      customerdata/src/main.go
  2. 25 15
      customerdata/src/task.go
  3. 2 0
      customerdata/src/util.go

+ 1 - 1
customerdata/src/main.go

@@ -169,7 +169,7 @@ func init() {
 	// }
 	// }
 	// Es.InitElasticSize()
 	// Es.InitElasticSize()
 	Es = elastic.NewEs(qu.ObjToString(es["version"]), qu.ObjToString(es["addr"]), qu.IntAllDef(es["pool"], 15), qu.ObjToString(es["userName"]), qu.ObjToString(es["password"]))
 	Es = elastic.NewEs(qu.ObjToString(es["version"]), qu.ObjToString(es["addr"]), qu.IntAllDef(es["pool"], 15), qu.ObjToString(es["userName"]), qu.ObjToString(es["password"]))
-	Es2 = elastic.NewEs(qu.ObjToString(es["version"]), "http://172.17.4.184:19908", qu.IntAllDef(es["pool"], 15), qu.ObjToString(es["userName"]), qu.ObjToString(es["password"]))
+	Es2 = elastic.NewEs(qu.ObjToString(es["version"]), "http://172.17.4.184:19905", qu.IntAllDef(es["pool"], 15), qu.ObjToString(es["userName"]), qu.ObjToString(es["password"]))
 	redis.InitRedis(Sysconfig.RedisAddrs)
 	redis.InitRedis(Sysconfig.RedisAddrs)
 	Index = qu.ObjToString(es["index"])
 	Index = qu.ObjToString(es["index"])
 	Itype = qu.ObjToString(es["itype"])
 	Itype = qu.ObjToString(es["itype"])

+ 25 - 15
customerdata/src/task.go

@@ -64,9 +64,9 @@ func GetCustomerData() {
 		exact := qu.IntAll(c["i_exact"])
 		exact := qu.IntAll(c["i_exact"])
 		s_bidding := qu.ObjToString(c["s_bidding"])
 		s_bidding := qu.ObjToString(c["s_bidding"])
 		log.Println("当前客户 ", customer, s_bidding)
 		log.Println("当前客户 ", customer, s_bidding)
-		if appId == "jyFhJXQAYDAANZTEVPFD1U" {
-			continue
-		}
+		// if appId == "jyFhJXQAYDAANZTEVPFD1U" {
+		// 	continue
+		// }
 		cus := &Customer{}
 		cus := &Customer{}
 		cus.SaveDataMap = map[string]map[string]interface{}{}
 		cus.SaveDataMap = map[string]map[string]interface{}{}
 		cus.SaveDataArr = map[string]map[string]interface{}{}
 		cus.SaveDataArr = map[string]map[string]interface{}{}
@@ -335,8 +335,13 @@ func (c *Customer) GetDepartments(stype string) {
 func (c *Customer) GetData(stype string) {
 func (c *Customer) GetData(stype string) {
 	log.Println("开始匹配数据...")
 	log.Println("开始匹配数据...")
 	defer qu.Catch()
 	defer qu.Catch()
-	esCon := Es.(*esv.EsV7)
-	c.EsConGetDataV7(stype, esCon)
+	if stype == "all" {
+		esCon := Es2.(*esv.EsV7)
+		c.EsConGetDataV7(stype, esCon)
+	} else {
+		esCon := Es.(*esv.EsV7)
+		c.EsConGetDataV7(stype, esCon)
+	}
 }
 }
 
 
 type MySource struct {
 type MySource struct {
@@ -355,15 +360,20 @@ func (c *Customer) EsConGetDataV7(stype string, esCon *esv.EsV7) {
 	ctx, _ := context.WithTimeout(context.Background(), 30*time.Minute)
 	ctx, _ := context.WithTimeout(context.Background(), 30*time.Minute)
 	for _, dm := range c.Departments {
 	for _, dm := range c.Departments {
 		for _, sr := range dm.Rules {
 		for _, sr := range dm.Rules {
-			for {
-				listLen := redis.GetInt("session", "es_status")
-				if listLen == 0 {
-					log.Println("es空闲!")
-					break
-				} else if listLen == 1 || listLen == 2 {
-					log.Println("系统繁忙,请稍后再试 ", listLen)
-				}
-				time.Sleep(5 * time.Second)
+			// for {
+			// 	listLen := redis.GetInt("session", "es_status")
+			// 	if listLen == 0 {
+			// 		log.Println("es空闲!")
+			// 		break
+			// 	} else if listLen == 1 || listLen == 2 {
+			// 		log.Println("系统繁忙,请稍后再试 ", listLen)
+			// 	}
+			// 	time.Sleep(5 * time.Second)
+			// }
+			if stype == "all" && c.AppId == "jyFhJXQAYDAANZTEVPFD1U" && sr.ID != "67e64794756e2b3b3b6d5062" {
+				continue
+			} else if stype != "all" && c.AppId == "jyFhJXQAYDAANZTEVPFD1U" && sr.ID == "67e64794756e2b3b3b6d5062" {
+				continue
 			}
 			}
 
 
 			//测试
 			//测试
@@ -377,7 +387,7 @@ func (c *Customer) EsConGetDataV7(stype string, esCon *esv.EsV7) {
 			qstr := sr.EsQuery
 			qstr := sr.EsQuery
 			if stype == "all" {
 			if stype == "all" {
 				esindex = "bidding_all"
 				esindex = "bidding_all"
-				escount = Es.Count(esindex, Itype, qstr)
+				escount = Es2.Count(esindex, Itype, qstr)
 			} else {
 			} else {
 				escount = Es.Count(esindex, Itype, qstr)
 				escount = Es.Count(esindex, Itype, qstr)
 			}
 			}

+ 2 - 0
customerdata/src/util.go

@@ -805,6 +805,8 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, a
 			}
 			}
 		}
 		}
 		if appid == "jyFhJXQAYDAANZTEVPFD1U" {
 		if appid == "jyFhJXQAYDAANZTEVPFD1U" {
+			info["id"] = id
+			tmp = info
 			site = strings.ReplaceAll(site, "军队", "JD")
 			site = strings.ReplaceAll(site, "军队", "JD")
 			site = strings.ReplaceAll(site, "兵团", "BT")
 			site = strings.ReplaceAll(site, "兵团", "BT")
 			site = strings.ReplaceAll(site, "全军", "QJ")
 			site = strings.ReplaceAll(site, "全军", "QJ")