|
@@ -58,6 +58,7 @@ type BuyerProject struct {
|
|
Area string
|
|
Area string
|
|
Zbtime int64
|
|
Zbtime int64
|
|
BuyerType string
|
|
BuyerType string
|
|
|
|
+ CId string
|
|
}
|
|
}
|
|
type ProjectEntity struct {
|
|
type ProjectEntity struct {
|
|
Number int64
|
|
Number int64
|
|
@@ -139,8 +140,8 @@ func (t *OwnerService) OwnerlList() map[string]interface{} {
|
|
startIndex := (t.PageIndex - 1) * t.PageSize
|
|
startIndex := (t.PageIndex - 1) * t.PageSize
|
|
endIndex := t.PageIndex * t.PageSize
|
|
endIndex := t.PageIndex * t.PageSize
|
|
sort.Slice(returnData, func(i, j int) bool {
|
|
sort.Slice(returnData, func(i, j int) bool {
|
|
- aa := fmt.Sprintf("%s%s", returnData[i].Zbtime, returnData[i].BuyerId)
|
|
|
|
- bb := fmt.Sprintf("%s%s", returnData[j].Zbtime, returnData[j].BuyerId)
|
|
|
|
|
|
+ aa := fmt.Sprintf("%d%s", returnData[i].Zbtime, returnData[i].BuyerId)
|
|
|
|
+ bb := fmt.Sprintf("%d%s", returnData[j].Zbtime, returnData[j].BuyerId)
|
|
return aa > bb
|
|
return aa > bb
|
|
})
|
|
})
|
|
if startIndex < gconv.Int64(len(returnData)) {
|
|
if startIndex < gconv.Int64(len(returnData)) {
|
|
@@ -203,7 +204,6 @@ func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[st
|
|
return returnData
|
|
return returnData
|
|
}
|
|
}
|
|
a5 := time.Now().Unix()
|
|
a5 := time.Now().Unix()
|
|
-
|
|
|
|
returnData = append(returnData, Findwinner(buyerArr)...)
|
|
returnData = append(returnData, Findwinner(buyerArr)...)
|
|
a6 := time.Now().Unix()
|
|
a6 := time.Now().Unix()
|
|
logx.Info("供应商", a6-a5)
|
|
logx.Info("供应商", a6-a5)
|
|
@@ -397,7 +397,6 @@ func FindMiddleman(buyerArr []string, positionId int64, returnData []map[string]
|
|
companyName := gconv.String(v["company_name"])
|
|
companyName := gconv.String(v["company_name"])
|
|
relateName := gconv.String(v["relate_name"])
|
|
relateName := gconv.String(v["relate_name"])
|
|
relateId := gconv.String(v["relate_id"])
|
|
relateId := gconv.String(v["relate_id"])
|
|
- //key := fmt.Sprintf("%s_%s", relateId, companyId)
|
|
|
|
returnData = append(returnData, map[string]interface{}{
|
|
returnData = append(returnData, map[string]interface{}{
|
|
"b_id": companyId,
|
|
"b_id": companyId,
|
|
"b_name": companyName,
|
|
"b_name": companyName,
|
|
@@ -453,7 +452,7 @@ func Findfirstparty(buyerArr []string, returnData []map[string]interface{}) []ma
|
|
}
|
|
}
|
|
personMap := map[string]string{}
|
|
personMap := map[string]string{}
|
|
if len(entIdArr) > 0 {
|
|
if len(entIdArr) > 0 {
|
|
- personSql := fmt.Sprintf(`select id,name from ent_contact where id in (%s) ORDER by name`, strings.Join(entIdArr, ","))
|
|
|
|
|
|
+ personSql := fmt.Sprintf(`select id,name as personName from ent_contact where id in (%s) ORDER by name`, strings.Join(entIdArr, ","))
|
|
personArr := PersonFindConnectionsHandle(personSql)
|
|
personArr := PersonFindConnectionsHandle(personSql)
|
|
//联系人处理
|
|
//联系人处理
|
|
for _, v := range personArr {
|
|
for _, v := range personArr {
|
|
@@ -500,7 +499,7 @@ func Findfirstparty(buyerArr []string, returnData []map[string]interface{}) []ma
|
|
"a_id": v.Aid,
|
|
"a_id": v.Aid,
|
|
"sourceType": "firstparty",
|
|
"sourceType": "firstparty",
|
|
"relationship": "业主的上级机构",
|
|
"relationship": "业主的上级机构",
|
|
- "personName": gconv.String(personMap[v.Aid]),
|
|
|
|
|
|
+ "personName": gconv.String(personMap[v.Bid]),
|
|
})
|
|
})
|
|
}
|
|
}
|
|
if code == "0201" {
|
|
if code == "0201" {
|
|
@@ -511,7 +510,7 @@ func Findfirstparty(buyerArr []string, returnData []map[string]interface{}) []ma
|
|
"a_id": v.Aid,
|
|
"a_id": v.Aid,
|
|
"sourceType": "firstparty",
|
|
"sourceType": "firstparty",
|
|
"relationship": "业主的股东",
|
|
"relationship": "业主的股东",
|
|
- "personName": gconv.String(personMap[v.Aid]),
|
|
|
|
|
|
+ "personName": gconv.String(personMap[v.Bid]),
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -560,6 +559,7 @@ func BuyerProjectMerge(dataMap, projectMap *map[string]map[string]interface{}, s
|
|
IsIgnore: gconv.Bool(buyerMap["isIgnore"]),
|
|
IsIgnore: gconv.Bool(buyerMap["isIgnore"]),
|
|
IsMonitor: gconv.Bool(buyerMap["isMonitor"]),
|
|
IsMonitor: gconv.Bool(buyerMap["isMonitor"]),
|
|
IsCreateCustomer: gconv.Bool(buyerMap["isCreateCustomer"]),
|
|
IsCreateCustomer: gconv.Bool(buyerMap["isCreateCustomer"]),
|
|
|
|
+ CId: gconv.String(buyerMap["cId"]),
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
if sourceType == "1" {
|
|
if sourceType == "1" {
|
|
@@ -581,6 +581,7 @@ func BuyerProjectMerge(dataMap, projectMap *map[string]map[string]interface{}, s
|
|
IsIgnore: gconv.Bool(buyerMap["isIgnore"]),
|
|
IsIgnore: gconv.Bool(buyerMap["isIgnore"]),
|
|
IsMonitor: gconv.Bool(buyerMap["isMonitor"]),
|
|
IsMonitor: gconv.Bool(buyerMap["isMonitor"]),
|
|
IsCreateCustomer: gconv.Bool(buyerMap["isCreateCustomer"]),
|
|
IsCreateCustomer: gconv.Bool(buyerMap["isCreateCustomer"]),
|
|
|
|
+ CId: gconv.String(buyerMap["cId"]),
|
|
})
|
|
})
|
|
|
|
|
|
}
|
|
}
|
|
@@ -739,7 +740,7 @@ func BuyerList(partyA, supplier, heterotophy, intermediary, agency string, posit
|
|
if intermediary != "" {
|
|
if intermediary != "" {
|
|
wh, args := common.WhArgs(strings.Split(intermediary, ","))
|
|
wh, args := common.WhArgs(strings.Split(intermediary, ","))
|
|
args = append(args, positionId)
|
|
args = append(args, positionId)
|
|
- intermediaryArr := CrmMysql.SelectBySql(`select b.relate_id as relate_id,b.relate_name as relate_name from crm.connection a inner join crm.connection_introduce b on ( a.id in (`+wh+`) and a.position_id=? and a.id=b.connection_id and b.itype=1)`, args...)
|
|
|
|
|
|
+ intermediaryArr := CrmMysql.SelectBySql(`select a.id,b.relate_id as relate_id,b.relate_name as relate_name from crm.connection a inner join crm.connection_introduce b on ( a.id in (`+wh+`) and a.position_id=? and a.id=b.connection_id and b.itype=1)`, args...)
|
|
if intermediaryArr != nil && len(*intermediaryArr) > 0 {
|
|
if intermediaryArr != nil && len(*intermediaryArr) > 0 {
|
|
for _, m := range *intermediaryArr {
|
|
for _, m := range *intermediaryArr {
|
|
buyerId := gconv.String(m["relate_id"])
|
|
buyerId := gconv.String(m["relate_id"])
|
|
@@ -747,6 +748,7 @@ func BuyerList(partyA, supplier, heterotophy, intermediary, agency string, posit
|
|
(*dataMap)[buyerId] = map[string]interface{}{
|
|
(*dataMap)[buyerId] = map[string]interface{}{
|
|
"buyerName": buyerName,
|
|
"buyerName": buyerName,
|
|
"buyerType": "middleman",
|
|
"buyerType": "middleman",
|
|
|
|
+ "cId": gconv.String(m["id"]),
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1087,8 +1089,14 @@ func (t *OwnerService) CandidateChannel() ([]*ResultData, int, int, int, int) {
|
|
a1, a2, a3, a4 := 0, 0, 0, 0
|
|
a1, a2, a3, a4 := 0, 0, 0, 0
|
|
if len(*dataMap) > 0 && dataMap != nil {
|
|
if len(*dataMap) > 0 && dataMap != nil {
|
|
propertyForm := NetworkCom.GetMyProbusfor(t.EntAccountId)
|
|
propertyForm := NetworkCom.GetMyProbusfor(t.EntAccountId)
|
|
|
|
+ buyerIds := []string{}
|
|
|
|
+ for buyerId := range *dataMap {
|
|
|
|
+ buyerIds = append(buyerIds, buyerId)
|
|
|
|
+ }
|
|
|
|
+ rs1, rs2 := GetData(propertyForm, strings.Join(buyerIds, ","))
|
|
for buyerId := range *dataMap {
|
|
for buyerId := range *dataMap {
|
|
- r1, r2 := GetData(propertyForm, buyerId)
|
|
|
|
|
|
+ r1 := rs1[buyerId]
|
|
|
|
+ r2 := rs2[buyerId]
|
|
if r1 != nil && len(r1) > 0 {
|
|
if r1 != nil && len(r1) > 0 {
|
|
for _, m := range r1 {
|
|
for _, m := range r1 {
|
|
near, zbtime := LastTimeCoop(buyerId, common.ObjToString(m["name"]), "adiffb")
|
|
near, zbtime := LastTimeCoop(buyerId, common.ObjToString(m["name"]), "adiffb")
|
|
@@ -1102,6 +1110,9 @@ func (t *OwnerService) CandidateChannel() ([]*ResultData, int, int, int, int) {
|
|
RecentTime: zbtime,
|
|
RecentTime: zbtime,
|
|
NearlyYears: near,
|
|
NearlyYears: near,
|
|
}
|
|
}
|
|
|
|
+ if tmp.BuyerId == "" {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
a1++
|
|
a1++
|
|
returnData = append(returnData, &tmp)
|
|
returnData = append(returnData, &tmp)
|
|
}
|
|
}
|
|
@@ -1119,6 +1130,9 @@ func (t *OwnerService) CandidateChannel() ([]*ResultData, int, int, int, int) {
|
|
EntId: common.ObjToString(m["nameId"]),
|
|
EntId: common.ObjToString(m["nameId"]),
|
|
BuyerId: buyerId,
|
|
BuyerId: buyerId,
|
|
}
|
|
}
|
|
|
|
+ if tmp.BuyerId == "" {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
a2++
|
|
a2++
|
|
returnData = append(returnData, &tmp)
|
|
returnData = append(returnData, &tmp)
|
|
}
|
|
}
|
|
@@ -1137,6 +1151,9 @@ func (t *OwnerService) CandidateChannel() ([]*ResultData, int, int, int, int) {
|
|
EntId: common.ObjToString(m["b_id"]),
|
|
EntId: common.ObjToString(m["b_id"]),
|
|
BuyerId: buyerId,
|
|
BuyerId: buyerId,
|
|
}
|
|
}
|
|
|
|
+ if tmp.BuyerId == "" {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
a3++
|
|
a3++
|
|
returnData = append(returnData, &tmp)
|
|
returnData = append(returnData, &tmp)
|
|
}
|
|
}
|
|
@@ -1154,6 +1171,9 @@ func (t *OwnerService) CandidateChannel() ([]*ResultData, int, int, int, int) {
|
|
EntId: common.ObjToString(m["b_id"]),
|
|
EntId: common.ObjToString(m["b_id"]),
|
|
BuyerId: buyerId,
|
|
BuyerId: buyerId,
|
|
}
|
|
}
|
|
|
|
+ if tmp.BuyerId == "" {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
a4++
|
|
a4++
|
|
returnData = append(returnData, &tmp)
|
|
returnData = append(returnData, &tmp)
|
|
}
|
|
}
|
|
@@ -1179,8 +1199,6 @@ func (t *OwnerService) CandidateChannel() ([]*ResultData, int, int, int, int) {
|
|
returnData[k] = value
|
|
returnData[k] = value
|
|
if t.Type != "" && t.Type != value.SourceType {
|
|
if t.Type != "" && t.Type != value.SourceType {
|
|
continue
|
|
continue
|
|
- } else if value.BuyerId == "" {
|
|
|
|
- continue
|
|
|
|
}
|
|
}
|
|
result = append(result, value)
|
|
result = append(result, value)
|
|
}
|
|
}
|