|
@@ -57,6 +57,7 @@ type BuyerProject struct {
|
|
IsIgnore bool
|
|
IsIgnore bool
|
|
Area string
|
|
Area string
|
|
Zbtime int64
|
|
Zbtime int64
|
|
|
|
+ BuyerType string
|
|
}
|
|
}
|
|
type ProjectEntity struct {
|
|
type ProjectEntity struct {
|
|
Number int64
|
|
Number int64
|
|
@@ -551,6 +552,7 @@ func BuyerProjectMerge(dataMap, projectMap *map[string]map[string]interface{}, s
|
|
returnData = append(returnData, BuyerProject{
|
|
returnData = append(returnData, BuyerProject{
|
|
BuyerId: buyerId,
|
|
BuyerId: buyerId,
|
|
BuyerName: buyerName,
|
|
BuyerName: buyerName,
|
|
|
|
+ BuyerType: gconv.String(buyerMap["buyerType"]),
|
|
Project: ProjectEntity{
|
|
Project: ProjectEntity{
|
|
Number: count,
|
|
Number: count,
|
|
EstimatedAmount: money,
|
|
EstimatedAmount: money,
|
|
@@ -571,6 +573,7 @@ func BuyerProjectMerge(dataMap, projectMap *map[string]map[string]interface{}, s
|
|
returnData = append(returnData, BuyerProject{
|
|
returnData = append(returnData, BuyerProject{
|
|
BuyerId: buyerId,
|
|
BuyerId: buyerId,
|
|
BuyerName: buyerName,
|
|
BuyerName: buyerName,
|
|
|
|
+ BuyerType: gconv.String(buyerMap["buyerType"]),
|
|
Project: ProjectEntity{
|
|
Project: ProjectEntity{
|
|
Number: 0,
|
|
Number: 0,
|
|
EstimatedAmount: 0,
|
|
EstimatedAmount: 0,
|
|
@@ -706,7 +709,7 @@ func BuyerList(partyA, supplier, heterotophy, intermediary, agency string, posit
|
|
}
|
|
}
|
|
if len(partyA) > 0 {
|
|
if len(partyA) > 0 {
|
|
partyASql := fmt.Sprintf(`select id as buyer_id,company_name as buyer from ent_info where id in (%s)`, strings.Join(intermediaryArr, ","))
|
|
partyASql := fmt.Sprintf(`select id as buyer_id,company_name as buyer from ent_info where id in (%s)`, strings.Join(intermediaryArr, ","))
|
|
- FindHandle(partyASql, dataMap)
|
|
|
|
|
|
+ FindHandle(partyASql, dataMap, "firstparty")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//供应商 //同甲异业
|
|
//供应商 //同甲异业
|
|
@@ -718,17 +721,22 @@ func BuyerList(partyA, supplier, heterotophy, intermediary, agency string, posit
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if len(findInSetArr) > 0 {
|
|
|
|
+ sqlStr := fmt.Sprintf(`SELECT buyer_id,buyer FROM transaction_info where hasAny(winner_id,[%s]) `, strings.Join(findInSetArr, ","))
|
|
|
|
+ FindHandle(sqlStr, dataMap, "supplier")
|
|
|
|
+ }
|
|
//同甲异业
|
|
//同甲异业
|
|
|
|
+ findheterotophyArr := []string{}
|
|
if heterotophy != "" {
|
|
if heterotophy != "" {
|
|
for _, v := range strings.Split(heterotophy, ",") {
|
|
for _, v := range strings.Split(heterotophy, ",") {
|
|
if v != "" {
|
|
if v != "" {
|
|
- findInSetArr = append(findInSetArr, fmt.Sprintf("'%s'", v))
|
|
|
|
|
|
+ findheterotophyArr = append(findheterotophyArr, fmt.Sprintf("'%s'", v))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if len(findInSetArr) > 0 {
|
|
|
|
- sqlStr := fmt.Sprintf(`SELECT buyer_id,buyer FROM transaction_info where hasAny(winner_id,[%s]) `, strings.Join(findInSetArr, ","))
|
|
|
|
- FindHandle(sqlStr, dataMap)
|
|
|
|
|
|
+ if len(findheterotophyArr) > 0 {
|
|
|
|
+ sqlStr := fmt.Sprintf(`SELECT buyer_id,buyer FROM transaction_info where hasAny(winner_id,[%s]) `, strings.Join(findheterotophyArr, ","))
|
|
|
|
+ FindHandle(sqlStr, dataMap, "adiffb")
|
|
}
|
|
}
|
|
//中间人
|
|
//中间人
|
|
if intermediary != "" {
|
|
if intermediary != "" {
|
|
@@ -741,6 +749,7 @@ func BuyerList(partyA, supplier, heterotophy, intermediary, agency string, posit
|
|
buyerName := gconv.String(m["relate_name"])
|
|
buyerName := gconv.String(m["relate_name"])
|
|
(*dataMap)[buyerId] = map[string]interface{}{
|
|
(*dataMap)[buyerId] = map[string]interface{}{
|
|
"buyerName": buyerName,
|
|
"buyerName": buyerName,
|
|
|
|
+ "buyerType": "middleman",
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -752,7 +761,7 @@ func BuyerList(partyA, supplier, heterotophy, intermediary, agency string, posit
|
|
agencyArr = append(agencyArr, fmt.Sprintf("'%s'", s))
|
|
agencyArr = append(agencyArr, fmt.Sprintf("'%s'", s))
|
|
}
|
|
}
|
|
sqlStr := fmt.Sprintf(`SELECT buyer_id,buyer FROM transaction_info where agency_id in (%s) `, strings.Join(agencyArr, ","))
|
|
sqlStr := fmt.Sprintf(`SELECT buyer_id,buyer FROM transaction_info where agency_id in (%s) `, strings.Join(agencyArr, ","))
|
|
- FindHandle(sqlStr, dataMap)
|
|
|
|
|
|
+ FindHandle(sqlStr, dataMap, "agency")
|
|
}
|
|
}
|
|
return dataMap
|
|
return dataMap
|
|
}
|
|
}
|
|
@@ -823,6 +832,7 @@ func ProjectHandle(buyerArr []string, entAccountId int64, entName, area, project
|
|
}
|
|
}
|
|
(*returnMap)[buyerId] = map[string]interface{}{
|
|
(*returnMap)[buyerId] = map[string]interface{}{
|
|
"buyerName": buyerName,
|
|
"buyerName": buyerName,
|
|
|
|
+ "buyerType": "firstparty",
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -874,7 +884,7 @@ type BuyerAggStruct struct {
|
|
}
|
|
}
|
|
|
|
|
|
// 采购单位查询sql
|
|
// 采购单位查询sql
|
|
-func FindHandle(sqlStr string, dataMap *map[string]map[string]interface{}) {
|
|
|
|
|
|
+func FindHandle(sqlStr string, dataMap *map[string]map[string]interface{}, buyerType string) {
|
|
rows, err := ClickhouseConn.Query(context.Background(), sqlStr)
|
|
rows, err := ClickhouseConn.Query(context.Background(), sqlStr)
|
|
if err != nil {
|
|
if err != nil {
|
|
logx.Error("查询失败", sqlStr, err)
|
|
logx.Error("查询失败", sqlStr, err)
|
|
@@ -885,6 +895,7 @@ func FindHandle(sqlStr string, dataMap *map[string]map[string]interface{}) {
|
|
if data.BuyerId != "" {
|
|
if data.BuyerId != "" {
|
|
(*dataMap)[data.BuyerId] = map[string]interface{}{
|
|
(*dataMap)[data.BuyerId] = map[string]interface{}{
|
|
"buyerName": data.Buyer,
|
|
"buyerName": data.Buyer,
|
|
|
|
+ "buyerType": buyerType,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|