|
@@ -12,10 +12,6 @@ import (
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
)
|
|
|
|
|
|
-const (
|
|
|
|
- InitNetworkMaxSize = 100
|
|
|
|
-)
|
|
|
|
-
|
|
|
|
type ContactInfo struct {
|
|
type ContactInfo struct {
|
|
Name string
|
|
Name string
|
|
Phone string
|
|
Phone string
|
|
@@ -45,7 +41,7 @@ func (i *InitNetwork) Init() {
|
|
//①业主人脉:当前企业曾经合作过物业项目的采购单位的联系人作为业主人脉
|
|
//①业主人脉:当前企业曾经合作过物业项目的采购单位的联系人作为业主人脉
|
|
index1 := 0
|
|
index1 := 0
|
|
func() {
|
|
func() {
|
|
- rows, err := ClickhouseConn.Query(context.Background(), `select DISTINCT buyer,buyer_id from information.transaction_info_all prewhere has(winner,?) and zbtime>?`, i.EntName, yearLimit)
|
|
|
|
|
|
+ rows, err := ClickhouseConn.Query(context.Background(), `select DISTINCT buyer,buyer_id from information.transaction_info_all prewhere has(winner,?) and zbtime>? order by zbtime desc limit ?`, i.EntName, yearLimit, C.InitNetworkMaxSize)
|
|
if err != nil {
|
|
if err != nil {
|
|
logx.Error(err)
|
|
logx.Error(err)
|
|
return
|
|
return
|
|
@@ -72,7 +68,7 @@ func (i *InitNetwork) Init() {
|
|
Itype: 1,
|
|
Itype: 1,
|
|
})
|
|
})
|
|
index1++
|
|
index1++
|
|
- if index1 == InitNetworkMaxSize {
|
|
|
|
|
|
+ if index1 == C.InitNetworkMaxSize {
|
|
break
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -88,7 +84,8 @@ func (i *InitNetwork) Init() {
|
|
wh, newArgs := util.WhArgs(strings.Split(i.BusinessType, ","))
|
|
wh, newArgs := util.WhArgs(strings.Split(i.BusinessType, ","))
|
|
args = append(args, newArgs...)
|
|
args = append(args, newArgs...)
|
|
args = append(args, yearLimit)
|
|
args = append(args, yearLimit)
|
|
- rows, err := ClickhouseConn.Query(context.Background(), `select DISTINCT wr,wr_id from information.transaction_info_all ARRAY JOIN winner_id as wr_id,winner as wr where buyer_id IN (SELECT buyer_id from information.transaction_info_all prewhere has(winner,?) and buyer_id<>'') and wr<>? and LENGTH(winner)=LENGTH(winner_id) and hasAny(topscopeclass,[`+wh+`])=0 AND zbtime>?`, args...)
|
|
|
|
|
|
+ args = append(args, C.InitNetworkMaxSize)
|
|
|
|
+ rows, err := ClickhouseConn.Query(context.Background(), `select DISTINCT wr,wr_id from information.transaction_info_all ARRAY JOIN winner_id as wr_id,winner as wr where buyer_id IN (SELECT buyer_id from information.transaction_info_all prewhere has(winner,?) and buyer_id<>'') and wr<>? and LENGTH(winner)=LENGTH(winner_id) and hasAny(topscopeclass,[`+wh+`])=0 and wr_id<>'' AND zbtime>? order by zbtime desc limit ?`, args...)
|
|
if err != nil {
|
|
if err != nil {
|
|
logx.Error(err)
|
|
logx.Error(err)
|
|
return
|
|
return
|
|
@@ -115,7 +112,7 @@ func (i *InitNetwork) Init() {
|
|
Itype: 3,
|
|
Itype: 3,
|
|
})
|
|
})
|
|
index2++
|
|
index2++
|
|
- if index2 == InitNetworkMaxSize {
|
|
|
|
|
|
+ if index2 == C.InitNetworkMaxSize {
|
|
break
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -124,7 +121,7 @@ func (i *InitNetwork) Init() {
|
|
//③招标代理机构(人脉):当前企业曾经合作过的招标代理机构联系人信息
|
|
//③招标代理机构(人脉):当前企业曾经合作过的招标代理机构联系人信息
|
|
index3 := 0
|
|
index3 := 0
|
|
func() {
|
|
func() {
|
|
- rows, err := ClickhouseConn.Query(context.Background(), `select DISTINCT agency,agency_id from information.transaction_info_all prewhere (buyer=? or has(winner,?)) and zbtime>?`, i.EntName, i.EntName, yearLimit)
|
|
|
|
|
|
+ rows, err := ClickhouseConn.Query(context.Background(), `select DISTINCT agency,agency_id from information.transaction_info_all prewhere (buyer=? or has(winner,?)) and agency<>'' and agency_id<>'' and zbtime>? order by zbtime desc limit ?`, i.EntName, i.EntName, yearLimit, C.InitNetworkMaxSize)
|
|
if err != nil {
|
|
if err != nil {
|
|
logx.Error(err)
|
|
logx.Error(err)
|
|
return
|
|
return
|
|
@@ -151,19 +148,19 @@ func (i *InitNetwork) Init() {
|
|
Itype: 5,
|
|
Itype: 5,
|
|
})
|
|
})
|
|
index3++
|
|
index3++
|
|
- if index3 == InitNetworkMaxSize {
|
|
|
|
|
|
+ if index3 == C.InitNetworkMaxSize {
|
|
break
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}()
|
|
}()
|
|
- logx.Info("初始化设置招标代理机构人脉over。。。", index2)
|
|
|
|
|
|
+ logx.Info("初始化设置招标代理机构人脉over。。。", index3)
|
|
newIds := []string{}
|
|
newIds := []string{}
|
|
cis := map[string]*ContactInfo{}
|
|
cis := map[string]*ContactInfo{}
|
|
cids := map[string]string{}
|
|
cids := map[string]string{}
|
|
logx.Info("初始化设置总共企业数量", len(ids))
|
|
logx.Info("初始化设置总共企业数量", len(ids))
|
|
for _, v := range ids {
|
|
for _, v := range ids {
|
|
newIds = append(newIds, v)
|
|
newIds = append(newIds, v)
|
|
- if len(newIds) == C.BuyerBatch {
|
|
|
|
|
|
+ if len(newIds) == C.SelectBatchSize {
|
|
for kk, vv := range i.GetContactInfo(newIds) {
|
|
for kk, vv := range i.GetContactInfo(newIds) {
|
|
cis[kk] = vv
|
|
cis[kk] = vv
|
|
}
|
|
}
|