|
@@ -36,6 +36,7 @@ func (i *InitNetwork) Init() {
|
|
|
logx.Info("进行初始化设置", fmt.Sprintf("%+v", i))
|
|
|
array := []*Connection{}
|
|
|
ids := []string{}
|
|
|
+ idMap := map[string]bool{}
|
|
|
//①业主人脉:当前企业曾经合作过物业项目的采购单位的联系人作为业主人脉
|
|
|
func() {
|
|
|
rows, err := ClickhouseConn.Query(context.Background(), `select DISTINCT buyer,buyer_id from information.transaction_info_all prewhere has(winner,?)`, i.EntName)
|
|
@@ -55,7 +56,10 @@ func (i *InitNetwork) Init() {
|
|
|
if buyer == "" || buyer_id == "" {
|
|
|
continue
|
|
|
}
|
|
|
- ids = append(ids, buyer_id)
|
|
|
+ if !idMap[buyer_id] {
|
|
|
+ ids = append(ids, buyer_id)
|
|
|
+ idMap[buyer_id] = true
|
|
|
+ }
|
|
|
array = append(array, &Connection{
|
|
|
Company_id: buyer_id,
|
|
|
Company_name: buyer,
|
|
@@ -89,7 +93,10 @@ func (i *InitNetwork) Init() {
|
|
|
if winner == "" || winner_id == "" {
|
|
|
continue
|
|
|
}
|
|
|
- ids = append(ids, winner_id)
|
|
|
+ if !idMap[winner_id] {
|
|
|
+ ids = append(ids, winner_id)
|
|
|
+ idMap[winner_id] = true
|
|
|
+ }
|
|
|
array = append(array, &Connection{
|
|
|
Company_id: winner_id,
|
|
|
Company_name: winner,
|
|
@@ -116,7 +123,10 @@ func (i *InitNetwork) Init() {
|
|
|
if agency == "" || agency_id == "" {
|
|
|
continue
|
|
|
}
|
|
|
- ids = append(ids, agency_id)
|
|
|
+ if !idMap[agency_id] {
|
|
|
+ ids = append(ids, agency_id)
|
|
|
+ idMap[agency_id] = true
|
|
|
+ }
|
|
|
array = append(array, &Connection{
|
|
|
Company_id: agency_id,
|
|
|
Company_name: agency,
|
|
@@ -124,8 +134,30 @@ func (i *InitNetwork) Init() {
|
|
|
})
|
|
|
}
|
|
|
}()
|
|
|
- cis := i.GetContactInfo(ids)
|
|
|
- cids := i.GetCompanyId(ids)
|
|
|
+ newIds := []string{}
|
|
|
+ cis := map[string]*ContactInfo{}
|
|
|
+ cids := map[string]string{}
|
|
|
+ for _, v := range ids {
|
|
|
+ newIds = append(newIds, v)
|
|
|
+ if len(newIds) == C.BuyerBatch {
|
|
|
+ for kk, vv := range i.GetContactInfo(newIds) {
|
|
|
+ cis[kk] = vv
|
|
|
+ }
|
|
|
+ for kk, vv := range i.GetCompanyId(newIds) {
|
|
|
+ cids[kk] = vv
|
|
|
+ }
|
|
|
+ newIds = []string{}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(newIds) > 0 {
|
|
|
+ for kk, vv := range i.GetContactInfo(newIds) {
|
|
|
+ cis[kk] = vv
|
|
|
+ }
|
|
|
+ for kk, vv := range i.GetCompanyId(newIds) {
|
|
|
+ cids[kk] = vv
|
|
|
+ }
|
|
|
+ newIds = []string{}
|
|
|
+ }
|
|
|
for _, v := range array {
|
|
|
if cis[v.Company_id] != nil {
|
|
|
v.ContactInfo = cis[v.Company_id]
|