|
@@ -4,7 +4,6 @@ import (
|
|
|
"context"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
- "log"
|
|
|
"sort"
|
|
|
"strings"
|
|
|
"time"
|
|
@@ -108,7 +107,7 @@ func (t *OwnerService) OwnerlList() *OwnerlListRes {
|
|
|
comKey := common.GetMd5String(fmt.Sprintf("%+v business:%s", t, businessStr))
|
|
|
listKey := fmt.Sprintf(NetworkManageOwnerlList, t.PositionId, comKey)
|
|
|
// 检查 Redis 中是否存在列表缓存
|
|
|
- if ok, err := redis.Exists("newother", listKey); ok && err == nil && t.SourceType != "2" {
|
|
|
+ if ok, err := redis.Exists("newother", listKey); false && ok && err == nil && t.SourceType != "2" {
|
|
|
olr = handleRedisCache(listKey)
|
|
|
} else {
|
|
|
// 没有缓存时的处理逻辑
|
|
@@ -150,7 +149,12 @@ func (t *OwnerService) OwnerlList() *OwnerlListRes {
|
|
|
return aa > bb
|
|
|
})
|
|
|
}*/
|
|
|
- buyerIdArr := getBuyerIdArr(olr.ReturnData)
|
|
|
+ buyerIdArr := []string{}
|
|
|
+ for _, value := range olr.ReturnData {
|
|
|
+ if value.BuyerId != "" {
|
|
|
+ buyerIdArr = append(buyerIdArr, value.BuyerId)
|
|
|
+ }
|
|
|
+ }
|
|
|
// 可介绍业主人脉处理
|
|
|
a3 := time.Now().Unix()
|
|
|
routeList := ConnectionsHandle(buyerIdArr, t.PositionId, false)
|
|
@@ -194,17 +198,6 @@ func getBuyerArr(dataMap *map[string]map[string]interface{}) []string {
|
|
|
return buyerArr
|
|
|
}
|
|
|
|
|
|
-// getBuyerIdArr 从返回数据中获取企业ID 数组
|
|
|
-func getBuyerIdArr(returnData []BuyerProject) []string {
|
|
|
- buyerIdArr := []string{}
|
|
|
- for _, value := range returnData {
|
|
|
- if value.BuyerId != "" {
|
|
|
- buyerIdArr = append(buyerIdArr, fmt.Sprintf("'%s'", value.BuyerId))
|
|
|
- }
|
|
|
- }
|
|
|
- return buyerIdArr
|
|
|
-}
|
|
|
-
|
|
|
// updateReturnDataWithRoutes 将路线信息更新到返回数据中
|
|
|
func updateReturnDataWithRoutes(returnData []BuyerProject, routeList []map[string]interface{}) {
|
|
|
for _, v := range routeList {
|
|
@@ -437,8 +430,10 @@ func FindMiddleman(buyerArr []string, positionId int64, returnData []map[string]
|
|
|
return returnData
|
|
|
}
|
|
|
//中间人 作为可介绍业主 企业名称
|
|
|
- companyArr := CrmMysql.SelectBySql(
|
|
|
- fmt.Sprintf("select DISTINCT b.company_id,b.company_name,a.relate_id,a.relate_name,b.contact_person from connection_introduce a INNER JOIN connection b on a.position_id=%d and a.connection_id=b.id and a.relate_Id in (%s) and a.itype =1 and b.itype=4 and b.status=1 ", positionId, strings.Join(buyerArr, ",")))
|
|
|
+ wh, args := common.WhArgs(buyerArr)
|
|
|
+ newArgs := []interface{}{positionId}
|
|
|
+ newArgs = append(newArgs, args...)
|
|
|
+ companyArr := CrmMysql.SelectBySql(`select DISTINCT b.company_id,b.company_name,a.relate_id,a.relate_name,b.contact_person from connection_introduce a INNER JOIN connection b on a.position_id=? and a.connection_id=b.id and a.relate_Id in (`+wh+`) and a.itype =1 and b.itype=4 and b.status=1`, newArgs...)
|
|
|
for _, v := range *companyArr {
|
|
|
companyId := gconv.String(v["company_id"])
|
|
|
companyName := gconv.String(v["company_name"])
|
|
@@ -721,7 +716,6 @@ func ProjectHandle(buyerArr []string, area, businessStr string, dataMap *map[str
|
|
|
countSql := fmt.Sprintf("select count(1) as count from (%s) b ", sqlStr)
|
|
|
sqlStr += " limit ?,?"
|
|
|
//总数查询
|
|
|
- log.Println(sqlStr)
|
|
|
rows, err1 := ClickhouseConn.Query(context.TODO(), sqlStr, startIndex, PageSize)
|
|
|
count = T.NetworkCom.Count(countSql)
|
|
|
if err1 != nil {
|
|
@@ -909,9 +903,7 @@ func (t *OwnerService) OwnerRoute() []map[string]interface{} {
|
|
|
if t.BuyerId == "" {
|
|
|
return []map[string]interface{}{}
|
|
|
}
|
|
|
- routeList := ConnectionsHandle([]string{
|
|
|
- fmt.Sprintf("'%s'", t.BuyerId),
|
|
|
- }, t.PositionId, false)
|
|
|
+ routeList := ConnectionsHandle([]string{t.BuyerId}, t.PositionId, false)
|
|
|
for i, routeMap := range routeList {
|
|
|
sourceType := gconv.String(routeMap["sourceType"])
|
|
|
if sourceType == "agency" || sourceType == "supplier" {
|