|
@@ -116,7 +116,7 @@ const (
|
|
|
func GetBuyerList(qstr string, CountQuery string, isCache bool) (buyerNames []string, resp *bxbuyer.BuyerListResp) {
|
|
|
t1 := time.Now()
|
|
|
total := elastic.Count(BuyerIndex, BuyerType, CountQuery) // 总数
|
|
|
- fmt.Println("耗时1:", time.Since(t1))
|
|
|
+ logx.Info("耗时1:", time.Since(t1))
|
|
|
resp = &bxbuyer.BuyerListResp{
|
|
|
Data: &bxbuyer.BuyerData{
|
|
|
Count: total,
|
|
@@ -128,7 +128,7 @@ func GetBuyerList(qstr string, CountQuery string, isCache bool) (buyerNames []st
|
|
|
}
|
|
|
start := time.Now()
|
|
|
rs := elastic.Get(BuyerIndex, BuyerType, qstr) // 采购单位列表
|
|
|
- fmt.Println("采购单位列表 es get查询耗时", time.Since(start))
|
|
|
+ logx.Info("采购单位列表 es get查询耗时", time.Since(start))
|
|
|
if rs == nil || len(*rs) == 0 {
|
|
|
return
|
|
|
}
|
|
@@ -142,7 +142,7 @@ func GetBuyerList(qstr string, CountQuery string, isCache bool) (buyerNames []st
|
|
|
buyerNames = append(buyerNames, tmp.Buyer)
|
|
|
resp.Data.List = append(resp.Data.List, tmp)
|
|
|
}
|
|
|
- fmt.Println("耗时;", time.Since(t1).Seconds(), "秒--", time.Since(t1).Microseconds())
|
|
|
+ logx.Info("耗时;", time.Since(t1).Seconds(), "秒--", time.Since(t1).Microseconds())
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -157,14 +157,14 @@ func SupplyFollowInfo(in *bxbuyer.BuyerListReq, buyerNames []string, resp *bxbuy
|
|
|
if in.IsCheckReceive {
|
|
|
isRws = IsReceived(buyerNames, in.EntUserId)
|
|
|
}
|
|
|
- fmt.Println("客户领取耗时:", time.Since(t2))
|
|
|
+ logx.Info("客户领取耗时:", time.Since(t2))
|
|
|
//客户关注
|
|
|
t3 := time.Now()
|
|
|
isFws := map[string]bool{}
|
|
|
if in.IsCheckFollow {
|
|
|
isFws = IsFollowd(buyerNames, in.UserId)
|
|
|
}
|
|
|
- fmt.Println("采购单位关注耗时:", time.Since(t3))
|
|
|
+ logx.Info("采购单位关注耗时:", time.Since(t3))
|
|
|
for _, bv := range resp.Data.List {
|
|
|
if in.IsCheckReceive {
|
|
|
if isRws[bv.Buyer] != "" {
|
|
@@ -214,7 +214,7 @@ func SupplyBuyerListData(buyerNames []string, resp *bxbuyer.BuyerListResp) *bxbu
|
|
|
// 聚合查
|
|
|
aggs := GetAggs(P_INDEX, P_TYPE, query)
|
|
|
logx.Info("查询语句:", query)
|
|
|
- fmt.Println("项目数量采购规模查询耗时:", time.Since(t1))
|
|
|
+ logx.Info("项目数量采购规模查询耗时:", time.Since(t1))
|
|
|
type BuyerAggStruct struct {
|
|
|
Buckets []struct {
|
|
|
Key string `json:"key,omitempty"`
|
|
@@ -288,7 +288,7 @@ func SupplyBuyerListData(buyerNames []string, resp *bxbuyer.BuyerListResp) *bxbu
|
|
|
|
|
|
}
|
|
|
wg.Wait()
|
|
|
- fmt.Println("SupplyBuyerListData 整体耗时:", time.Since(start))
|
|
|
+ logx.Info("SupplyBuyerListData 整体耗时:", time.Since(start))
|
|
|
|
|
|
//得到所有数据,包括 redis里的,再存一下
|
|
|
go func(respList []*bxbuyer.BuyerList) {
|
|
@@ -347,7 +347,7 @@ func BuyerSupplyInfo(buyerNames []string) (resp *bxbuyer.BuyerSupplyResp) {
|
|
|
// 聚合查
|
|
|
aggs := GetAggs(P_INDEX, P_TYPE, query)
|
|
|
logx.Info("查询语句:", query)
|
|
|
- fmt.Println("项目数量采购规模查询耗时:", time.Since(t1))
|
|
|
+ logx.Info("项目数量采购规模查询耗时:", time.Since(t1))
|
|
|
type BuyerAggStruct struct {
|
|
|
Buckets []struct {
|
|
|
Key string `json:"key,omitempty"`
|
|
@@ -426,7 +426,7 @@ func BuyerSupplyInfo(buyerNames []string) (resp *bxbuyer.BuyerSupplyResp) {
|
|
|
|
|
|
}
|
|
|
wg.Wait()
|
|
|
- fmt.Println(" 整体耗时:", time.Since(start))
|
|
|
+ logx.Info(" 整体耗时:", time.Since(start))
|
|
|
//得到所有数据,包括 redis里的,再存一下
|
|
|
go func(respList []*bxbuyer.SupplyData) {
|
|
|
for i := 0; i < len(respList); i++ {
|
|
@@ -506,7 +506,7 @@ func GetProjectContactCount(buyerName string) int64 {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- fmt.Println("GetProjectContactCount 单次耗时:", time.Since(start))
|
|
|
+ logx.Info("GetProjectContactCount 单次耗时:", time.Since(start))
|
|
|
return int64(len(list))
|
|
|
}
|
|
|
func GetNewBiddingCount(buyer string) int64 {
|
|
@@ -520,7 +520,7 @@ func GetNewBiddingCount(buyer string) int64 {
|
|
|
mustQuery = append(mustQuery, fmt.Sprintf(`{"term": {"buyer": "%s"}}`, buyer))
|
|
|
aa := fmt.Sprintf(`{"query":{"bool":{"must":[%s]}}}`, strings.Join(mustQuery, ","))
|
|
|
count := elastic.Count(biddingIndex, biddingType, aa)
|
|
|
- fmt.Println("GetNewBiddingCount 单次耗时:", time.Since(start))
|
|
|
+ logx.Info("GetNewBiddingCount 单次耗时:", time.Since(start))
|
|
|
return count
|
|
|
}
|
|
|
|