|
@@ -64,7 +64,7 @@ func GetCustomerData() {
|
|
|
exact := qu.IntAll(c["i_exact"])
|
|
|
s_bidding := qu.ObjToString(c["s_bidding"])
|
|
|
log.Println("当前客户 ", customer, s_bidding)
|
|
|
- if s_bidding == "high" {
|
|
|
+ if appId == "jyFhJXQAYDAANZTEVPFD1U" {
|
|
|
continue
|
|
|
}
|
|
|
cus := &Customer{}
|
|
@@ -113,14 +113,14 @@ func GetCustomerData() {
|
|
|
|
|
|
func GetCustomerDatas() {
|
|
|
defer qu.Catch()
|
|
|
- log.Println("高质量定时任务开始")
|
|
|
+ log.Println("全量数据任务开始")
|
|
|
idRange, idRange2, ok, endTime := GetIdRanges() //获取id区间
|
|
|
if !ok {
|
|
|
return
|
|
|
}
|
|
|
log.Println("此次任务区间:", idRange, idRange2)
|
|
|
//查询企业库开启推送的客户
|
|
|
- customers, _ := MgoTag.Find("euser", map[string]interface{}{"i_push": 1, "b_delete": false, "s_bidding": "high"}, nil, nil)
|
|
|
+ customers, _ := MgoTag.Find("euser", map[string]interface{}{"i_push": 1, "b_delete": false, "s_appid": "jyFhJXQAYDAANZTEVPFD1U"}, nil, nil)
|
|
|
for _, c := range customers {
|
|
|
customerId := mgoutil.BsonTOStringId(c["_id"])
|
|
|
customer := qu.ObjToString(c["s_name"]) //客户名称
|
|
@@ -164,14 +164,14 @@ func GetCustomerDatas() {
|
|
|
cus.GetDepartments("") //获取客户信息
|
|
|
//PrintLog(cus) //打印查看初始化的信息
|
|
|
qu.Debug("customer:", cus.ID, cus.Name, cus.PushModel, cus.AppId, cus.IsTagRule, cus.IsTagRule2, cus.IsTagRule3, cus.IsSearchHosp, cus.IsSearchEnps, len(cus.TagRules), len(cus.TagRules2), len(cus.TagRules3), len(cus.Departments))
|
|
|
- cus.GetData("high") //获取数据
|
|
|
+ cus.GetData("all") //获取数据
|
|
|
cus.RemoveRepeatData() //数据去重
|
|
|
cus.AssembelAndSaveData() //组装、保存数据
|
|
|
}
|
|
|
Sysconfig.LatestId = LatestId
|
|
|
Sysconfig.LatestTimes = endTime
|
|
|
qu.WriteSysConfig(Sysconfig)
|
|
|
- log.Println("高质量定时任务结束-endId-Sysconfig.LatestTimes ", endTime)
|
|
|
+ log.Println("全量数据任务结束-endId-Sysconfig.LatestTimes ", endTime)
|
|
|
}
|
|
|
|
|
|
// 获取客户打标签规则
|
|
@@ -335,18 +335,8 @@ func (c *Customer) GetDepartments(stype string) {
|
|
|
func (c *Customer) GetData(stype string) {
|
|
|
log.Println("开始匹配数据...")
|
|
|
defer qu.Catch()
|
|
|
- esConfig := Sysconfig.Es
|
|
|
- esversion := qu.ObjToString(esConfig["version"])
|
|
|
- if esversion == "v1" {
|
|
|
- } else {
|
|
|
- if stype == "high" {
|
|
|
- esCon := Es.(*esv.EsV7)
|
|
|
- c.EsConGetDataV7(stype, esCon)
|
|
|
- } else {
|
|
|
- esCon := Es.(*esv.EsV7)
|
|
|
- c.EsConGetDataV7(stype, esCon)
|
|
|
- }
|
|
|
- }
|
|
|
+ esCon := Es.(*esv.EsV7)
|
|
|
+ c.EsConGetDataV7(stype, esCon)
|
|
|
}
|
|
|
|
|
|
type MySource struct {
|
|
@@ -384,13 +374,14 @@ func (c *Customer) EsConGetDataV7(stype string, esCon *esv.EsV7) {
|
|
|
// wg := &sync.WaitGroup{}
|
|
|
esindex := Index
|
|
|
escount := int64(0)
|
|
|
- if stype == "high" {
|
|
|
- // esindex = "bidding"
|
|
|
- escount = Es.Count(esindex, Itype, sr.EsQuery)
|
|
|
+ qstr := sr.EsQuery
|
|
|
+ if stype == "all" {
|
|
|
+ esindex = "bidding_all"
|
|
|
+ escount = Es.Count(esindex, Itype, qstr)
|
|
|
} else {
|
|
|
- escount = Es.Count(esindex, Itype, sr.EsQuery)
|
|
|
+ escount = Es.Count(esindex, Itype, qstr)
|
|
|
}
|
|
|
- log.Println("查询总数:", escount, "规则ID:", sr.ID, "EsQuery:", sr.EsQuery, stype)
|
|
|
+ log.Println("查询总数:", escount, "规则ID:", sr.ID, "EsQuery:", qstr, stype)
|
|
|
if escount == 0 {
|
|
|
continue
|
|
|
}
|
|
@@ -398,7 +389,7 @@ func (c *Customer) EsConGetDataV7(stype string, esCon *esv.EsV7) {
|
|
|
// var q esV7.Query
|
|
|
//sr.EsQuery = `{"query":{"filtered":{"filter":{"bool":{"must":[{"bool":{"should":[{"terms":{"city":["上海市"]}}]}},{"terms":{"toptype":["招标","结果"]}},{"range":{"publishtime":{"gte":1588262400,"lt":1608825600}}}]}},"query":{"bool":{"must":[{"bool":{"should":[{"bool":{"must":[{"bool":{"should":[{"bool":{"must":[{"terms":{"buyer":["上海城建职业学院","上海市第一人民医院","中国银联股份有限公司","上海立信会计金融学院法规处","中国东方航空股份有限公司","上海外国语大学","上海小昆山环卫服务有限公司","国家税务总局上海市税务局","中国浦东干部学院","上海市浦东新区老港镇人民政府","咪咕视讯科技有限公司","上海交通大学医学院附属新华医院","交通运输部上海打捞局","松江区体育局","复旦大学附属中山医院","上海交通大学医学院附属瑞金医院","中国科学院上海应用物理研究所"]}}]}}]}}]}}]}}],"must_not":[{"constant_score":{"filter":{"missing":{"field":"filetext"}}}}]}}}}}`
|
|
|
cc := &MySource{
|
|
|
- Querys: sr.EsQuery,
|
|
|
+ Querys: qstr,
|
|
|
}
|
|
|
//游标查询,index不支持别名,只能写索引库的名称
|
|
|
res, err := client.Scroll(esindex).Query(cc).Size(200).Do(ctx) //查询一条获取游标
|