|
@@ -12,6 +12,10 @@ 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
|
|
@@ -37,9 +41,11 @@ func (i *InitNetwork) Init() {
|
|
array := []*Connection{}
|
|
array := []*Connection{}
|
|
ids := []string{}
|
|
ids := []string{}
|
|
idMap := map[string]bool{}
|
|
idMap := map[string]bool{}
|
|
|
|
+ yearLimit := NetworkCom.ProjectYearLimit()
|
|
//①业主人脉:当前企业曾经合作过物业项目的采购单位的联系人作为业主人脉
|
|
//①业主人脉:当前企业曾经合作过物业项目的采购单位的联系人作为业主人脉
|
|
|
|
+ index1 := 0
|
|
func() {
|
|
func() {
|
|
- rows, err := ClickhouseConn.Query(context.Background(), `select DISTINCT buyer,buyer_id from information.transaction_info_all prewhere has(winner,?)`, i.EntName)
|
|
|
|
|
|
+ rows, err := ClickhouseConn.Query(context.Background(), `select DISTINCT buyer,buyer_id from information.transaction_info_all prewhere has(winner,?) and zbtime>?`, i.EntName, yearLimit)
|
|
if err != nil {
|
|
if err != nil {
|
|
logx.Error(err)
|
|
logx.Error(err)
|
|
return
|
|
return
|
|
@@ -65,9 +71,15 @@ func (i *InitNetwork) Init() {
|
|
Company_name: buyer,
|
|
Company_name: buyer,
|
|
Itype: 1,
|
|
Itype: 1,
|
|
})
|
|
})
|
|
|
|
+ index1++
|
|
|
|
+ if index1 == InitNetworkMaxSize {
|
|
|
|
+ break
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}()
|
|
}()
|
|
|
|
+ logx.Info("初始化设置业主人脉over。。。", index1)
|
|
//②甲异业渠道(人脉):“当前企业曾经合作过物业项目的采购单位的中标物业企业中”与当前企业不一样业态的企业的联系人列表
|
|
//②甲异业渠道(人脉):“当前企业曾经合作过物业项目的采购单位的中标物业企业中”与当前企业不一样业态的企业的联系人列表
|
|
|
|
+ index2 := 0
|
|
func() {
|
|
func() {
|
|
if i.BusinessType == "" {
|
|
if i.BusinessType == "" {
|
|
return
|
|
return
|
|
@@ -75,7 +87,7 @@ func (i *InitNetwork) Init() {
|
|
args := []interface{}{i.EntName, i.EntName}
|
|
args := []interface{}{i.EntName, i.EntName}
|
|
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, NetworkCom.ProjectYearLimit())
|
|
|
|
|
|
+ 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...)
|
|
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...)
|
|
if err != nil {
|
|
if err != nil {
|
|
logx.Error(err)
|
|
logx.Error(err)
|
|
@@ -102,11 +114,17 @@ func (i *InitNetwork) Init() {
|
|
Company_name: winner,
|
|
Company_name: winner,
|
|
Itype: 3,
|
|
Itype: 3,
|
|
})
|
|
})
|
|
|
|
+ index2++
|
|
|
|
+ if index2 == InitNetworkMaxSize {
|
|
|
|
+ break
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}()
|
|
}()
|
|
|
|
+ logx.Info("初始化设置甲异业渠道人脉over。。。", index2)
|
|
//③招标代理机构(人脉):当前企业曾经合作过的招标代理机构联系人信息
|
|
//③招标代理机构(人脉):当前企业曾经合作过的招标代理机构联系人信息
|
|
|
|
+ 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,?)`, i.EntName, i.EntName)
|
|
|
|
|
|
+ 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)
|
|
if err != nil {
|
|
if err != nil {
|
|
logx.Error(err)
|
|
logx.Error(err)
|
|
return
|
|
return
|
|
@@ -132,11 +150,17 @@ func (i *InitNetwork) Init() {
|
|
Company_name: agency,
|
|
Company_name: agency,
|
|
Itype: 5,
|
|
Itype: 5,
|
|
})
|
|
})
|
|
|
|
+ index3++
|
|
|
|
+ if index3 == InitNetworkMaxSize {
|
|
|
|
+ break
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}()
|
|
}()
|
|
|
|
+ logx.Info("初始化设置招标代理机构人脉over。。。", index2)
|
|
newIds := []string{}
|
|
newIds := []string{}
|
|
cis := map[string]*ContactInfo{}
|
|
cis := map[string]*ContactInfo{}
|
|
cids := map[string]string{}
|
|
cids := map[string]string{}
|
|
|
|
+ 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.BuyerBatch {
|