|
@@ -1,23 +1,24 @@
|
|
|
package history
|
|
|
|
|
|
import (
|
|
|
- "app.yhyue.com/moapp/jybase/common"
|
|
|
- elastic "app.yhyue.com/moapp/jybase/es"
|
|
|
- "app.yhyue.com/moapp/jybase/log"
|
|
|
- "app.yhyue.com/moapp/jybase/mongodb"
|
|
|
- "app.yhyue.com/moapp/jybase/redis"
|
|
|
"cmplatform/util"
|
|
|
sql "cmplatform/util/sqlmodel"
|
|
|
"context"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
- esV7 "github.com/olivere/elastic/v7"
|
|
|
- "go.mongodb.org/mongo-driver/bson"
|
|
|
- "go.uber.org/zap"
|
|
|
"regexp"
|
|
|
"strings"
|
|
|
"sync"
|
|
|
"time"
|
|
|
+
|
|
|
+ "app.yhyue.com/moapp/jybase/common"
|
|
|
+ elastic "app.yhyue.com/moapp/jybase/es"
|
|
|
+ "app.yhyue.com/moapp/jybase/log"
|
|
|
+ "app.yhyue.com/moapp/jybase/mongodb"
|
|
|
+ "app.yhyue.com/moapp/jybase/redis"
|
|
|
+ esV7 "github.com/olivere/elastic/v7"
|
|
|
+ "go.mongodb.org/mongo-driver/bson"
|
|
|
+ "go.uber.org/zap"
|
|
|
)
|
|
|
|
|
|
type mergeData struct {
|
|
@@ -126,36 +127,36 @@ func (c *Customer) GetDepartments(stype string, departments []map[string]interfa
|
|
|
|
|
|
// 获取数据
|
|
|
func (c *Customer) GetData(stype string, dataSource int) {
|
|
|
- log.Debug("匹配es状态...")
|
|
|
- defer common.Catch()
|
|
|
- esConfig := util.Sysconfig["es"].(map[string]interface{})
|
|
|
- esversion := common.ObjToString(esConfig["version"])
|
|
|
- if esversion == "v1" {
|
|
|
- } else {
|
|
|
- esCon := elastic.VarEs.(*elastic.EsV7)
|
|
|
- for {
|
|
|
- listLen := redis.GetInt("session", "es_status")
|
|
|
- if listLen == 0 {
|
|
|
- log.Debug("es空闲!")
|
|
|
- break
|
|
|
- } else if listLen == 1 || listLen == 2 {
|
|
|
- log.Debug("es繁忙,", zap.Int("listLen", listLen))
|
|
|
- }
|
|
|
- time.Sleep(5 * time.Second)
|
|
|
- }
|
|
|
- for {
|
|
|
- listLens := int(redis.LLEN("datag", "jyqyfw_es_query"))
|
|
|
- if listLens < 2 {
|
|
|
- redis.RPUSH("datag", "jyqyfw_es_query", 1)
|
|
|
- c.EsConGetDataV7(stype, dataSource, esCon)
|
|
|
- redis.LPOP("datag", "jyqyfw_es_query")
|
|
|
- break
|
|
|
- } else {
|
|
|
- log.Debug("企业级服务es进程数过多,", zap.Int("listLens", listLens))
|
|
|
- }
|
|
|
- time.Sleep(5 * time.Second)
|
|
|
- }
|
|
|
- }
|
|
|
+ // log.Debug("匹配es状态...")
|
|
|
+ // defer common.Catch()
|
|
|
+ // esConfig := util.Sysconfig["es"].(map[string]interface{})
|
|
|
+ // esversion := common.ObjToString(esConfig["version"])
|
|
|
+ // if esversion == "v1" {
|
|
|
+ // } else {
|
|
|
+ esCon := elastic.VarEs.(*elastic.EsV7)
|
|
|
+ // for {
|
|
|
+ // listLen := redis.GetInt("session", "es_status")
|
|
|
+ // if listLen == 0 {
|
|
|
+ // log.Debug("es空闲!")
|
|
|
+ // break
|
|
|
+ // } else if listLen == 1 || listLen == 2 {
|
|
|
+ // log.Debug("es繁忙,", zap.Int("listLen", listLen))
|
|
|
+ // }
|
|
|
+ // time.Sleep(5 * time.Second)
|
|
|
+ // }
|
|
|
+ // for {
|
|
|
+ // listLens := int(redis.LLEN("datag", "jyqyfw_es_query"))
|
|
|
+ // if listLens < 2 {
|
|
|
+ // redis.RPUSH("datag", "jyqyfw_es_query", 1)
|
|
|
+ c.EsConGetDataV7(stype, dataSource, esCon)
|
|
|
+ // redis.LPOP("datag", "jyqyfw_es_query")
|
|
|
+ // break
|
|
|
+ // } else {
|
|
|
+ // log.Debug("企业级服务es进程数过多,", zap.Int("listLens", listLens))
|
|
|
+ // }
|
|
|
+ // time.Sleep(5 * time.Second)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *elastic.EsV7) {
|