|
@@ -1,6 +1,7 @@
|
|
|
package service
|
|
|
|
|
|
import (
|
|
|
+ "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
"context"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
@@ -170,7 +171,7 @@ func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[st
|
|
|
"b_name": companyName,
|
|
|
"a_name": relateName,
|
|
|
"a_id": relateId,
|
|
|
- "sourceType": "intermediary",
|
|
|
+ "sourceType": "middleman",
|
|
|
"relationship": "业主的关系人",
|
|
|
"personName": gconv.String(v["contact_person"]),
|
|
|
})
|
|
@@ -204,7 +205,7 @@ func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[st
|
|
|
"b_name": v.Bname,
|
|
|
"a_name": v.Aname,
|
|
|
"a_id": v.Aid,
|
|
|
- "sourceType": "buyer",
|
|
|
+ "sourceType": "firstparty",
|
|
|
"relationship": "业主的上级机构",
|
|
|
"personName": v.Dperson,
|
|
|
})
|
|
@@ -215,7 +216,7 @@ func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[st
|
|
|
"b_name": v.Bname,
|
|
|
"a_name": v.Aname,
|
|
|
"a_id": v.Aid,
|
|
|
- "sourceType": "buyer",
|
|
|
+ "sourceType": "firstparty",
|
|
|
"relationship": "业主的股东",
|
|
|
"personName": v.Dperson,
|
|
|
})
|
|
@@ -230,7 +231,7 @@ func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[st
|
|
|
"b_name": v.Aname,
|
|
|
"a_name": v.Bname,
|
|
|
"a_id": v.Bid,
|
|
|
- "sourceType": "buyer",
|
|
|
+ "sourceType": "firstparty",
|
|
|
"relationship": "业主的下级机构",
|
|
|
"personName": v.Cperson,
|
|
|
})
|
|
@@ -240,9 +241,9 @@ func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[st
|
|
|
}
|
|
|
}
|
|
|
//供应商 采购单位 供应商 招标代理机构 采购单位 招标代理机构 需要计算合作次数
|
|
|
- winnerSql := fmt.Sprintf(`SELECT DISTINCT a.zbtime as zbtime ,a.project_id as project_id,a.buyer_id as buyer_id,a.buyer as buyer,a.agency_id as agency_id,a.agency as agency,c.company_name as company_name ,b.name as personName ,a.winnerId as awinnerId
|
|
|
+ winnerSql := fmt.Sprintf(`SELECT DISTINCT a.project_name as project_name,a.project_id as project_id , a.zbtime as zbtime ,a.buyer_id as buyer_id,a.buyer as buyer,a.agency_id as agency_id,a.agency as agency,c.company_name as company_name ,b.name as personName ,a.winnerId as awinnerId
|
|
|
FROM
|
|
|
- (select zbtime,project_id,buyer_id,buyer,agency_id,agency,winner_id as winnerId from transaction_info
|
|
|
+ (select zbtime,project_id,project_name,project_id,buyer_id,buyer,agency_id,agency,winner_id as winnerId from transaction_info
|
|
|
ARRAY JOIN winner_id ) a
|
|
|
inner join ent_contact b on a.buyer_id in (%s) and a.winnerId=b.id
|
|
|
inner join ent_info c on a.winnerId=c.id order by a.zbtime,a.winnerId`, strings.Join(buyerArr, ","))
|
|
@@ -257,7 +258,8 @@ func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[st
|
|
|
winnerId := m.AwinnerId
|
|
|
agency := m.Agency
|
|
|
agencyId := m.Agency_id
|
|
|
- projectId := m.Project_id
|
|
|
+ projectId := encrypt.EncodeArticleId2ByCheck(m.Project_id)
|
|
|
+ projectName := m.Project_name
|
|
|
zbtime := m.Zbtime
|
|
|
personName := m.PersonName
|
|
|
key := fmt.Sprintf("%s_%s", buyerId, winnerId)
|
|
@@ -274,8 +276,10 @@ func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[st
|
|
|
data["count"] = gconv.Int64(data["data"]) + 1
|
|
|
dataList := gconv.Maps(data["list"])
|
|
|
dataList = append(dataList, map[string]interface{}{
|
|
|
- "zbtime": zbtime,
|
|
|
- "entName": winner,
|
|
|
+ "zbtime": zbtime,
|
|
|
+ "entName": winner,
|
|
|
+ "projectId": projectId,
|
|
|
+ "projectName": projectName,
|
|
|
})
|
|
|
data["list"] = dataList
|
|
|
winnerMap[key] = data
|
|
@@ -290,8 +294,10 @@ func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[st
|
|
|
"count": 1,
|
|
|
"list": []map[string]interface{}{
|
|
|
{
|
|
|
- "zbtime": zbtime,
|
|
|
- "entName": winner,
|
|
|
+ "zbtime": zbtime,
|
|
|
+ "entName": winner,
|
|
|
+ "projectId": projectId,
|
|
|
+ "projectName": projectName,
|
|
|
},
|
|
|
},
|
|
|
}
|
|
@@ -302,8 +308,10 @@ func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[st
|
|
|
data["count"] = gconv.Int64(data["data"]) + 1
|
|
|
dataList := gconv.Maps(data["list"])
|
|
|
dataList = append(dataList, map[string]interface{}{
|
|
|
- "zbtime": zbtime,
|
|
|
- "entName": winner,
|
|
|
+ "zbtime": zbtime,
|
|
|
+ "entName": winner,
|
|
|
+ "projectId": projectId,
|
|
|
+ "projectName": projectName,
|
|
|
})
|
|
|
data["list"] = dataList
|
|
|
agencyMap[key] = data
|
|
@@ -313,13 +321,15 @@ func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[st
|
|
|
"b_name": agency,
|
|
|
"a_name": buyer,
|
|
|
"a_id": buyerId,
|
|
|
- "sourceType": "agent",
|
|
|
+ "sourceType": "agency",
|
|
|
"count": 1,
|
|
|
"personName": personName,
|
|
|
"list": []map[string]interface{}{
|
|
|
{
|
|
|
- "zbtime": zbtime,
|
|
|
- "entName": agency,
|
|
|
+ "zbtime": zbtime,
|
|
|
+ "entName": agency,
|
|
|
+ "projectId": projectId,
|
|
|
+ "projectName": projectName,
|
|
|
},
|
|
|
},
|
|
|
}
|
|
@@ -334,6 +344,7 @@ func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[st
|
|
|
"sourceType": gconv.String(m["sourceType"]),
|
|
|
"relationship": gconv.String(m["relationship"]),
|
|
|
"count": gconv.Int64(m["count"]),
|
|
|
+ "list": m["list"],
|
|
|
})
|
|
|
}
|
|
|
for _, m := range agencyMap {
|
|
@@ -345,6 +356,7 @@ func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[st
|
|
|
"sourceType": gconv.String(m["sourceType"]),
|
|
|
"relationship": gconv.String(m["relationship"]),
|
|
|
"count": gconv.Int64(m["count"]),
|
|
|
+ "list": m["list"],
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -741,18 +753,21 @@ type ConnectionsEntity struct {
|
|
|
Dperson string `ch:"d_person"`
|
|
|
}
|
|
|
type SupplierConnectionsEntity struct {
|
|
|
- Zbtime int64 `ch:"zbtime"`
|
|
|
+ Project_name string `ch:"project_name"`
|
|
|
Project_id string `ch:"project_id"`
|
|
|
+ Zbtime int64 `ch:"zbtime"`
|
|
|
Buyer_id string `ch:"buyer_id"`
|
|
|
Buyer string `ch:"buyer"`
|
|
|
Agency_id string `ch:"agency_id"`
|
|
|
Agency string `ch:"agency"`
|
|
|
Company_name string `ch:"company_name"`
|
|
|
PersonName string `ch:"personName"`
|
|
|
- AwinnerId string `ch:"AwinnerId "`
|
|
|
+ AwinnerId string `ch:"awinnerId"`
|
|
|
}
|
|
|
type TimeConnectionsEntity struct {
|
|
|
- Zbtime int64 `ch:"zbtime"`
|
|
|
+ Zbtime int64 `ch:"zbtime"`
|
|
|
+ Project_id string `ch:"project_id"`
|
|
|
+ Project_name string `ch:"project_name"`
|
|
|
}
|
|
|
|
|
|
// 采购单位人脉信息查询sql
|
|
@@ -779,7 +794,8 @@ func SupplierFindConnectionsHandle(sqlStr string) []SupplierConnectionsEntity {
|
|
|
}
|
|
|
for rows.Next() {
|
|
|
data := SupplierConnectionsEntity{}
|
|
|
- rows.ScanStruct(&data)
|
|
|
+ err = rows.ScanStruct(&data)
|
|
|
+ logx.Info(err)
|
|
|
returnData = append(returnData, data)
|
|
|
}
|
|
|
return returnData
|
|
@@ -843,24 +859,26 @@ func (t *OwnerService) OwnerCooperate() []map[string]interface{} {
|
|
|
dataArr := []TimeConnectionsEntity{}
|
|
|
if t.CooperateType == "supplier" {
|
|
|
//供应商
|
|
|
- supplierSql := fmt.Sprintf(`SELECT DISTINCT a.zbtime as zbtime
|
|
|
+ supplierSql := fmt.Sprintf(`SELECT DISTINCT a.zbtime as zbtime,a.project_id as project_id,a.project_name as project_name
|
|
|
FROM
|
|
|
- (select zbtime,project_id,buyer_id,buyer,agency_id,agency,winner_id as winnerId from transaction_info
|
|
|
+ (select zbtime,project_id,project_name,winner_id as winnerId from transaction_info
|
|
|
ARRAY JOIN winner_id ) a
|
|
|
inner join ent_contact b on a.buyer_id = '%s' and a.winnerId='%s' and a.winnerId=b.id
|
|
|
inner join ent_info c on a.winnerId=c.id order by a.zbtime,a.winnerId`, t.BuyerId, t.WinnerId)
|
|
|
dataArr = TimeFindConnectionsHandle(supplierSql)
|
|
|
- } else if t.CooperateType == "agent" {
|
|
|
+ } else if t.CooperateType == "agency" {
|
|
|
//代理机构
|
|
|
- agentSql := fmt.Sprintf(`select zbtime from transaction_info where buyer_id ='%s' and agency_id ='%s' order by zbtime,winner_id `, t.BuyerId, t.WinnerId)
|
|
|
+ agentSql := fmt.Sprintf(`select zbtime,project_id,project_name from transaction_info where buyer_id ='%s' and agency_id ='%s' order by zbtime,winner_id `, t.BuyerId, t.WinnerId)
|
|
|
dataArr = TimeFindConnectionsHandle(agentSql)
|
|
|
}
|
|
|
if dataArr != nil && len(dataArr) > 0 {
|
|
|
for _, m := range dataArr {
|
|
|
zbtime := m.Zbtime
|
|
|
returData = append(returData, map[string]interface{}{
|
|
|
- "zbtime": zbtime,
|
|
|
- "entName": t.WinnerName,
|
|
|
+ "zbtime": zbtime,
|
|
|
+ "entName": t.WinnerName,
|
|
|
+ "project_id": encrypt.EncodeArticleId2ByCheck(m.Project_id),
|
|
|
+ "project_name": m.Project_name,
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -878,7 +896,7 @@ func (t *OwnerService) CandidateChannel() []*ResultData {
|
|
|
if m1 != nil && len(*m1) > 0 {
|
|
|
propertyForm = common.ObjToString((*m1)["probusfor"])
|
|
|
}
|
|
|
- for buyerId, _ := range *dataMap {
|
|
|
+ for buyerId := range *dataMap {
|
|
|
logx.Info(buyerId)
|
|
|
r1, r2 := GetData(propertyForm, buyerId)
|
|
|
if r1 != nil && len(r1) > 0 {
|
|
@@ -911,6 +929,7 @@ func (t *OwnerService) CandidateChannel() []*ResultData {
|
|
|
}
|
|
|
GetData2(buyerId)
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
return returnData
|
|
|
}
|