Browse Source

Merge branch 'feature/v1.0.4' of https://jygit.jydev.jianyu360.cn/CRM/application into feature/v1.0.4

wangchuanjin 1 year ago
parent
commit
249c21acb6

+ 2 - 0
api/application.api

@@ -200,6 +200,8 @@ type (
 		PositionId       int64  `header:"positionId,optional"`
 		PageSize         int64  `json:"pageSize,optional"`
 		PageIndex        int64  `json:"pageIndex,optional"`
+		ProjectType      string `json:"projectType,optional"`
+		EntAccountId     int64  `header:"entAccountId"`
 	}
 	ProjectListReq {
 		UserId       string `header:"userId,optional"`

+ 2 - 0
api/internal/logic/ownerlistlogic.go

@@ -41,6 +41,8 @@ func (l *OwnerListLogic) OwnerList(req *types.OwnerListReq) (resp *types.Reply,
 		PositionId:       req.PositionId,
 		PageIndex:        req.PageIndex,
 		PageSize:         req.PageSize,
+		ProjectType:      req.ProjectType,
+		EntAccountId:     req.EntAccountId,
 	}
 	data := ownerService.OwnerlList()
 	resp.Data = data

+ 15 - 4
api/internal/service/CoopHistoryService.go

@@ -18,13 +18,14 @@ var (
 	sql_2_1   = `SELECT project_id, project_name, zbtime FROM information.transaction_info WHERE buyer_id = ? AND has(winner, ?) ORDER BY zbtime DESC`
 	sql_2_2   = `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 = ? and  a.itype =1  and  b.itype=4 and  b.status=1 `
 	sql_2_3   = `select a.a_id as a_id, a.b_id as b_id, a.a_name as a_name, a.b_name as b_name, a.code as code, c.legal_person as c_person, d.legal_person d_person from crm.ent_map_code a left join ent_info c on (a.a_id = ? or a.b_id = ? ) and a.code in('0101', '0201') and a.a_id = c.id left join ent_info d on (a.a_id = ? or a.b_id = ? ) and a.code in('0101', '0201') and a.b_id = d.id where (a.a_id = ? or a.b_id = ? ) and a.code in('0101', '0201')`
-	es_query  = `{"query": {"bool": {"must": [{"term": {"buyer": "%s"}}],"must_not": {"term": {"property_form": "%s"}}}},"aggs": {"winner_count": {"terms": {"field": "winner","size": 1000,"order": {"_count": "desc"}},"aggs": {"amount_all": {"sum": {"field": "bidamount"}}}}},"size": 1}`
-	es_query1 = `{"query": {"bool": {"must": [{"term": {"buyer": "%s"}}]}},"aggs": {"agency_count": {"terms": {"field": "agency","size": 1000,"order": {"_count": "desc"}},"aggs": {"amount_all": {"sum": {"field": "bidamount"}}}}},"size": 1}`
+	es_query  = `{"query": {"bool": {"must": [{"term": {"buyer_id": "%s"}}],"must_not": {"term": {"property_form": "%s"}}}},"aggs": {"winner_count": {"terms": {"field": "winner","size": 1000,"order": {"_count": "desc"}},"aggs": {"amount_all": {"sum": {"field": "project_money"}},"ent_id": {"terms": {"field": "winner_id"}}}}},"size": 1}`
+	es_query1 = `{"query": {"bool": {"must": [{"term": {"buyer_id": "%s"}}]}},"aggs": {"agency_count": {"terms": {"field": "agency","size": 1000,"order": {"_count": "desc"}},"aggs": {"amount_all": {"sum": {"field": "project_money"}},"ent_id": {"terms": {"field": "agency_id"}}}}},"size": 1}`
 )
 
 type ResultData struct {
 	SourceType   string  `json:"SourceType"`
 	EntName      string  `json:"EntName"`
+	EntId        string  `json:"EntId"`
 	EntPerson    string  `json:"EntPerson"`
 	Middleman    string  `json:"Middleman"`
 	ProjectNum   int     `json:"ProjectNum"`
@@ -104,6 +105,7 @@ func GetPrList(req *types.CoopHistoryReq) (result []*ResultData, size_1, size_2,
 					tmp := ResultData{
 						SourceType:   "middleman",
 						EntName:      common.ObjToString(m["b_name"]),
+						EntId:        common.ObjToString(m["b_id"]),
 						EntPerson:    common.ObjToString(m["personName"]),
 						Relationship: "业主的关系人",
 						BuyerId:      pTmp.BuyerId,
@@ -122,6 +124,7 @@ func GetPrList(req *types.CoopHistoryReq) (result []*ResultData, size_1, size_2,
 					tmp := ResultData{
 						SourceType:   "sup_sub",
 						EntName:      common.ObjToString(m["b_name"]),
+						EntId:        common.ObjToString(m["b_id"]),
 						EntPerson:    common.ObjToString(m["personName"]),
 						Relationship: common.ObjToString(m["relationship"]),
 						BuyerId:      pTmp.BuyerId,
@@ -143,13 +146,19 @@ func GetData(propertyForm, bid string) (result1, result2 []map[string]interface{
 			Amount_all struct {
 				Value float64 `json:"value,omitempty"`
 			} `json:"amount_all"`
+			EntId struct {
+				Buckets []struct {
+					Key       string `json:"key,omitempty"`
+					Doc_count int64  `json:"doc_count,omitempty"`
+				} `json:"buckets"`
+			} `json:"ent_id"`
 		} `json:"buckets"`
 	}
 	m1 := make(map[string]interface{}) //采购单位-中标单位
 	m2 := make(map[string]interface{}) //采购单位-代理机构
 	if propertyForm != "" {
 		//同甲异态 中标企业
-		aggs, count, res := elastic.GetAggs("bidding", "bidding", fmt.Sprintf(es_query, propertyForm, "中国计量大学"))
+		aggs, count, res := elastic.GetAggs(INDEX_1, INDEX_1, fmt.Sprintf(es_query, bid, propertyForm))
 		logx.Info("es聚合查询结果:", aggs, count, res)
 		var m1Buckets = AggStruct{}
 		if aggs != nil && aggs["winner_count"] != nil {
@@ -164,7 +173,9 @@ func GetData(propertyForm, bid string) (result1, result2 []map[string]interface{
 					logx.Info(err)
 					if len(m1Buckets.Buckets) > 0 {
 						for _, v := range m1Buckets.Buckets {
-							m1[v.Key] = map[string]interface{}{"name": v.Key, "amount": v.Amount_all.Value, "count": v.Doc_count}
+							if v.Key != "" {
+								m1[v.Key] = map[string]interface{}{"name": v.Key, "amount": v.Amount_all.Value, "count": v.Doc_count}
+							}
 						}
 					}
 				}

+ 91 - 62
api/internal/service/owner.go

@@ -43,6 +43,7 @@ type OwnerService struct {
 	WinnerName       string
 	CooperateType    string
 	EntAccountId     int64
+	ProjectType      string
 }
 
 type BuyerProject struct {
@@ -93,18 +94,18 @@ func (t *OwnerService) OwnerlList() map[string]interface{} {
 			ProcessingStatusInit(t.PositionId, dataMap, t.ProcessingStatus)
 		}
 		//监控状态处理
-		//MonitorStatusInit(t.PositionId, dataMap, t.SourceType)
+		MonitorStatusInit(t.PositionId, dataMap, t.SourceType)
 		//项目数量查询
 		buyerArr := []string{}
 		for _, value := range *dataMap {
 			buyerArr = append(buyerArr, fmt.Sprintf(`"%s"`, gconv.String(value["buyerName"])))
 		}
 		//项目数量处理
-		projectMap, _ = ProjectHandle(buyerArr, t.PositionId, t.SearchEntName, t.Area, t.SourceType, t.ProcessingStatus)
+		projectMap, _ = ProjectHandle(buyerArr, t.EntAccountId, t.SearchEntName, t.Area, t.ProjectType)
 	} else if t.SearchEntName != "" {
 		//1 只看转介绍成功率高2只看已监控的
 		//先查找采购单位数据
-		projectMap, dataMap = ProjectHandle([]string{}, t.PositionId, t.SearchEntName, t.Area, t.SourceType, t.ProcessingStatus)
+		projectMap, dataMap = ProjectHandle([]string{}, t.EntAccountId, t.SearchEntName, t.Area, t.ProjectType)
 		a7 := time.Now().Unix()
 		fmt.Println("es用时", a7-startTime)
 		if t.ProcessingStatus != "" {
@@ -113,7 +114,7 @@ func (t *OwnerService) OwnerlList() map[string]interface{} {
 		a8 := time.Now().Unix()
 		fmt.Println("状态用时", a8-a7)
 		//监控状态处理
-		//MonitorStatusInit(t.PositionId, dataMap, t.SourceType)
+		MonitorStatusInit(t.PositionId, dataMap, t.SourceType)
 		a9 := time.Now().Unix()
 		fmt.Println("监控用时", a9-a8)
 	}
@@ -500,53 +501,43 @@ func BuyerProjectMerge(dataMap, projectMap *map[string]map[string]interface{}, s
 	monitorNumber := int64(0)
 	for buyerId, buyerMap := range *dataMap {
 		buyerName := gconv.String(buyerMap["buyerName"])
+		count := int64(0)
 		if _, ok := (*projectMap)[buyerName]; ok {
 			projectMap := (*projectMap)[buyerName]
 			if isMonitor := gconv.Bool(buyerMap["isMonitor"]); isMonitor {
 				monitorNumber++
 			}
-			count := gconv.Int64(projectMap["count"])
+			count = gconv.Int64(projectMap["count"])
 			money := gconv.Int64(projectMap["money"])
 			zbtime := gconv.Int64(projectMap["zbtime"])
+			if count >= 2 {
+				highSuccessNumber++
+			}
 			if sourceType == "1" {
 				if count < 2 {
 					continue
 				}
-				highSuccessNumber++
-				returnData = append(returnData, BuyerProject{
-					BuyerId:   buyerId,
-					BuyerName: buyerName,
-					Project: ProjectEntity{
-						Number:          count,
-						EstimatedAmount: money,
-						Connections:     []map[string]interface{}{},
-					},
-					Area:             gconv.String(projectMap["area"]),
-					Zbtime:           zbtime,
-					IsIgnore:         gconv.Bool(buyerMap["isIgnore"]),
-					IsMonitor:        gconv.Bool(buyerMap["isMonitor"]),
-					IsCreateCustomer: gconv.Bool(buyerMap["isCreateCustomer"]),
-				})
-			} else {
-				if count > 2 {
-					highSuccessNumber++
-				}
-				returnData = append(returnData, BuyerProject{
-					BuyerId:   buyerId,
-					BuyerName: buyerName,
-					Project: ProjectEntity{
-						Number:          count,
-						EstimatedAmount: money,
-						Connections:     []map[string]interface{}{},
-					},
-					Area:             gconv.String(projectMap["area"]),
-					Zbtime:           zbtime,
-					IsIgnore:         gconv.Bool(buyerMap["isIgnore"]),
-					IsMonitor:        gconv.Bool(buyerMap["isMonitor"]),
-					IsCreateCustomer: gconv.Bool(buyerMap["isCreateCustomer"]),
-				})
 			}
+			returnData = append(returnData, BuyerProject{
+				BuyerId:   buyerId,
+				BuyerName: buyerName,
+				Project: ProjectEntity{
+					Number:          count,
+					EstimatedAmount: money,
+					Connections:     []map[string]interface{}{},
+				},
+				Area:             gconv.String(projectMap["area"]),
+				Zbtime:           zbtime,
+				IsIgnore:         gconv.Bool(buyerMap["isIgnore"]),
+				IsMonitor:        gconv.Bool(buyerMap["isMonitor"]),
+				IsCreateCustomer: gconv.Bool(buyerMap["isCreateCustomer"]),
+			})
 		} else {
+			if sourceType == "1" {
+				if count < 2 {
+					continue
+				}
+			}
 			returnData = append(returnData, BuyerProject{
 				BuyerId:   buyerId,
 				BuyerName: buyerName,
@@ -557,10 +548,11 @@ func BuyerProjectMerge(dataMap, projectMap *map[string]map[string]interface{}, s
 				},
 				Area:             "",
 				Zbtime:           0,
-				IsIgnore:         false,
-				IsMonitor:        false,
-				IsCreateCustomer: false,
+				IsIgnore:         gconv.Bool(buyerMap["isIgnore"]),
+				IsMonitor:        gconv.Bool(buyerMap["isMonitor"]),
+				IsCreateCustomer: gconv.Bool(buyerMap["isCreateCustomer"]),
 			})
+
 		}
 		connectionsNumber++
 	}
@@ -587,25 +579,27 @@ func MonitorStatusInit(positionId int64, dataMap *map[string]map[string]interfac
 			v["isMonitor"] = true
 			(*newMap)[k] = v
 		} else {
-			if sourceType != "2" && sourceType != "1" {
+			if sourceType != "2" {
 				v["isMonitor"] = false
 				(*newMap)[k] = v
 			}
 		}
 	}
+	if sourceType == "2" {
+		*dataMap = *newMap
+		return
+	}
 	if newMap != nil {
-		dataMap = newMap
+		*dataMap = *newMap
 	}
 }
-
-// 处理状态初始化
-func ProcessingStatusInit(positionId int64, dataMap *map[string]map[string]interface{}, processingStatus string) {
+func FindStatus(positionId int64) (map[string]bool, map[string]bool, map[string]bool) {
 	//未处理
-	untreatedMap := &map[string]bool{}
+	untreatedMap := map[string]bool{}
 	//已忽略
-	ignoredMap := &map[string]bool{}
+	ignoredMap := map[string]bool{}
 	//已创建
-	createdMap := &map[string]bool{}
+	createdMap := map[string]bool{}
 	processingArr := CrmMysql.Find(entity.CONNECTION_STATUS, map[string]interface{}{
 		"type":        1,
 		"position id": positionId,
@@ -617,38 +611,45 @@ func ProcessingStatusInit(positionId int64, dataMap *map[string]map[string]inter
 			ignore := gconv.Int64(v["is_ignore"])
 			create := gconv.Int64(v["is_create"])
 			if handle == 1 {
-				(*untreatedMap)[entId] = true
+				untreatedMap[entId] = true
 			}
 			if ignore == 1 {
-				(*ignoredMap)[entId] = true
+				ignoredMap[entId] = true
 			}
 			if create == 1 {
-				(*createdMap)[entId] = true
+				createdMap[entId] = true
 			}
 		}
 	}
+	return untreatedMap, ignoredMap, createdMap
+}
+
+// 处理状态初始化
+func ProcessingStatusInit(positionId int64, dataMap *map[string]map[string]interface{}, processingStatus string) {
+	//收录数据处理
+	untreatedMap, ignoredMap, createdMap := FindStatus(positionId)
 	newMap := &map[string]map[string]interface{}{}
 	//所有采购单位和处理状态对比
 	for buyerId, value := range *dataMap {
 		for _, v := range strings.Split(processingStatus, ",") {
 			switch v {
 			case "1":
-				if _, ok := (*untreatedMap)[buyerId]; !ok {
+				if _, ok := untreatedMap[buyerId]; !ok {
 					(*newMap)[buyerId] = value
 				}
 			case "2":
-				if _, ok := (*ignoredMap)[buyerId]; ok {
+				if _, ok := ignoredMap[buyerId]; ok {
 					(*newMap)[buyerId] = value
 				}
 			case "3":
-				if _, ok := (*createdMap)[buyerId]; ok {
+				if _, ok := createdMap[buyerId]; ok {
 					(*newMap)[buyerId] = value
 				}
 			}
 		}
 	}
 	if newMap != nil {
-		dataMap = newMap
+		*dataMap = *newMap
 	}
 }
 
@@ -716,17 +717,30 @@ func BuyerList(partyA, supplier, heterotophy, intermediary, agency string, posit
 }
 
 // 项目数量查询
-func ProjectHandle(buyerArr []string, positionId int64, entName, area, sourceType, processingStatus string) (*map[string]map[string]interface{}, *map[string]map[string]interface{}) {
+func ProjectHandle(buyerArr []string, entAccountId int64, entName, area, projectType string) (*map[string]map[string]interface{}, *map[string]map[string]interface{}) {
 	projectMap := &map[string]map[string]interface{}{}
 	returnMap := &map[string]map[string]interface{}{}
 	sql := ""
 	sqlStr := ""
+	propertyFormStr := ""
+	if projectType == "1" {
+		propertyForm := ""
+		m1 := CrmMysql.FindOne("config_tenant", map[string]interface{}{"account_id": entAccountId}, "probusfor", "")
+		if m1 != nil && len(*m1) > 0 {
+			propertyForm = common.ObjToString((*m1)["probusfor"])
+			if propertyForm != "" {
+				propertyFormStr = fmt.Sprintf(`,{"match":{"property_form":"%s"}}`, propertyForm)
+			}
+
+		}
+
+	}
 	if entName != "" {
-		sql = `{"query":{"bool":{"must":[{"multi_match":{"query":"%s","type":"phrase","fields":["buyer.mbuyer"]}}%s]}},"aggs":{"buyer_count":{"terms":{"field":"buyer","size":500,"order":{"zbtime_count":"desc"}},"aggs":{"area_count":{"terms":{"field":"area"}},"buyer_id":{"terms":{"field":"buyer_id"}},"money_count":{"sum":{"field":"project_money"}},"zbtime_count":{"max":{"field":"zbtime"}}}}},"size":0}`
-		sqlStr = fmt.Sprintf(sql, entName, common.If(area != "", fmt.Sprintf(`,{"term":{"area":"%s"}}`, area), ""))
+		sql = `{"query":{"bool":{"must":[{"multi_match":{"query":"%s","type":"phrase","fields":["buyer.mbuyer"]}}%s%s]}},"aggs":{"buyer_count":{"terms":{"field":"buyer","size":500,"order":{"zbtime_count":"desc"}},"aggs":{"area_count":{"terms":{"field":"area"}},"buyer_id":{"terms":{"field":"buyer_id"}},"money_count":{"sum":{"field":"project_money"}},"zbtime_count":{"max":{"field":"zbtime"}}}}},"size":0}`
+		sqlStr = fmt.Sprintf(sql, entName, common.If(area != "", fmt.Sprintf(`,{"term":{"area":"%s"}}`, area), ""), common.If(projectType == "1", propertyFormStr, ""))
 	} else {
-		sql = `{"query":{"bool":{"must":[{"terms":{"buyer":[%s]}}%s]}},"aggs":{"buyer_count":{"terms":{"field":"buyer","size":500,"order":{"zbtime_count":"desc"}},"aggs":{"area_count":{"terms":{"field":"area"}},"buyer_id":{"terms":{"field":"buyer_id"}},"money_count":{"sum":{"field":"project_money"}},"zbtime_count":{"max":{"field":"zbtime"}}}}},"size":0}`
-		sqlStr = fmt.Sprintf(sql, strings.Join(buyerArr, ","), common.If(area != "", fmt.Sprintf(`,{"term":{"area":"%s"}}`, area), ""))
+		sql = `{"query":{"bool":{"must":[{"terms":{"buyer":[%s]}}%s%s]}},"aggs":{"buyer_count":{"terms":{"field":"buyer","size":500,"order":{"zbtime_count":"desc"}},"aggs":{"area_count":{"terms":{"field":"area"}},"buyer_id":{"terms":{"field":"buyer_id"}},"money_count":{"sum":{"field":"project_money"}},"zbtime_count":{"max":{"field":"zbtime"}}}}},"size":0}`
+		sqlStr = fmt.Sprintf(sql, strings.Join(buyerArr, ","), common.If(area != "", fmt.Sprintf(`,{"term":{"area":"%s"}}`, area), ""), common.If(projectType == "1", propertyFormStr, ""))
 	}
 	startTime := time.Now().Unix()
 	data, _, _ := elastic.GetAggs(INDEX_1, INDEX_1, sqlStr)
@@ -759,7 +773,7 @@ func ProjectHandle(buyerArr []string, positionId int64, entName, area, sourceTyp
 			(*projectMap)[buyerName] = map[string]interface{}{
 				"area":    area,
 				"zbtime":  v.Zbtime_count.Value,
-				"money":   gconv.Int64(common.Float64All(v.Money_count.Value) * 10000),
+				"money":   common.RetainDecimal(common.Float64All(v.Money_count.Value)/10000, 2),
 				"count":   v.Doc_count,
 				"buyerId": buyerId,
 			}
@@ -768,6 +782,14 @@ func ProjectHandle(buyerArr []string, positionId int64, entName, area, sourceTyp
 			}
 		}
 	}
+	if projectType == "1" {
+		for _, v := range *returnMap {
+			buyerName := gconv.String(v["buyerName"])
+			if _, ok := (*projectMap)[buyerName]; !ok {
+				delete(*returnMap, buyerName)
+			}
+		}
+	}
 	return projectMap, returnMap
 }
 
@@ -1086,6 +1108,13 @@ func (t *OwnerService) CandidateChannel() []*ResultData {
 			}
 		}
 	}
+	//状态处理
+	/*if len(returnData) > 0 {
+		untreatedMap, ignoredMap, createdMap := FindStatus(t.PositionId)
+		for k, v := range returnData {
+
+		}
+	}*/
 
 	return returnData
 }

+ 41 - 34
api/internal/service/plistService.go

@@ -2,6 +2,7 @@ package service
 
 import (
 	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jypkg/ent/util"
 	T "bp.jydev.jianyu360.cn/CRM/application/api/common"
 	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
@@ -25,42 +26,43 @@ type ProjectData struct {
 }
 
 type ProjectEntry struct {
-	ProjectId    string          `ch:"project_id"`
-	ProjectName  string          `ch:"project_name"`
-	BusinessType string          `ch:"business_type"`
-	Buyer        string          `ch:"buyer"`
-	BuyerId      string          `ch:"buyer_id"`
-	Area         string          `ch:"area"`
-	City         string          `ch:"city"`
-	District     string          `ch:"district"`
-	ZbTime       int64           `ch:"zbtime"`
-	EndTime      int64           `ch:"endtime"`
-	ProjectMoney decimal.Decimal `ch:"project_money"`
-	InfoId       string          `ch:"info_id"`
-	IsHandle     int             `json:"IsHandle"`
-	IsIgnore     int             `json:"IsIgnore"`
-	IsCreate     int             `json:"IsCreate"`
-	MyConn       bool            `json:"MyConn"`
-	ConnType     int             `json:"ConnType"`
-	HighSuccess  bool            `json:"HighSuccess"`
-	BId          string          `json:"BId"`
-	BName        string          `json:"BName"`
-	RelationShip string          `json:"RelationShip"`
-	SourceType   string          `json:"SourceType"` // firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
-	Person       string          `json:"Person"`
-	Num          int             `json:"Num"`
-	FocusId      string          `json:"FocusId"`
+	ProjectId     string          `ch:"project_id"`
+	ProjectName   string          `ch:"project_name"`
+	BusinessType  string          `ch:"business_type"`
+	Buyer         string          `ch:"buyer"`
+	BuyerId       string          `ch:"buyer_id"`
+	Area          string          `ch:"area"`
+	City          string          `ch:"city"`
+	District      string          `ch:"district"`
+	ZbTime        int64           `ch:"zbtime"`
+	EndTime       int64           `ch:"endtime"`
+	ProjectMoney  decimal.Decimal `ch:"project_money"`
+	InfoId        string          `ch:"info_id"`
+	InformationId string          `ch:"information_id"`
+	InfoIds       string          `ch:"info_ids"`
+	Href          string          `json:"Href"`
+	IsHandle      int             `json:"IsHandle"`
+	IsIgnore      int             `json:"IsIgnore"`
+	IsCreate      int             `json:"IsCreate"`
+	MyConn        bool            `json:"MyConn"`
+	ConnType      int             `json:"ConnType"`
+	HighSuccess   bool            `json:"HighSuccess"`
+	BId           string          `json:"BId"`
+	BName         string          `json:"BName"`
+	RelationShip  string          `json:"RelationShip"`
+	SourceType    string          `json:"SourceType"` // firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
+	Person        string          `json:"Person"`
+	Num           int             `json:"Num"`
+	FocusId       string          `json:"FocusId"`
 }
 
 func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasNextPage bool, total int) {
-
 	buyerM := BuyerList(req.PartyA, req.Supplier, req.Heterotophy, req.Intermediary, req.Agency, req.PositionId)
 	mmp := MonitorStatus(req.UserId) // 项目监控
 	buyerArr := make([]string, len(*buyerM))
 	for b := range *buyerM {
 		buyerArr = append(buyerArr, b)
 	}
-
 	preSales := preSalesStatus(req.PositionId)
 	isSqlPage := false
 	if req.SaleStatus == "0" {
@@ -76,7 +78,7 @@ func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasN
 		project := ProjectEntry{}
 		_ = rows.ScanStruct(&project)
 		//project.ProjectId = encrypt.CommonEncodeArticle("content", project.ProjectId)
-		project.ProjectId = util.EncodeId(project.ProjectId)
+		//project.ProjectId = util.EncodeId(project.ProjectId)
 		resultList = append(resultList, &project)
 	}
 
@@ -172,9 +174,9 @@ func getQuerySql(req *types.ProjectListReq, isPage bool, buyerArr []string) (cou
 	if req.SubClass != "" {
 		arr := []string{}
 		for _, v := range strings.Split(req.SubClass, ",") {
-			arr = append(arr, fmt.Sprintf("'%s'", v))
+			arr = append(arr, fmt.Sprintf("has(a.subclass, '%s')", v))
 		}
-		querys = append(querys, fmt.Sprintf(" a.subclass in (%s) ", strings.Join(regionArr, ",")))
+		querys = append(querys, arr...)
 	}
 	// 项目金额
 	if req.Amount != "" && strings.Contains(req.Amount, "-") {
@@ -192,12 +194,12 @@ func getQuerySql(req *types.ProjectListReq, isPage bool, buyerArr []string) (cou
 	//物业业态
 	if req.PropertyForm != "" {
 		arr := []string{}
-		for _, v := range strings.Split(req.PropertyForm, ",") {
-			arr = append(arr, fmt.Sprintf("'%s'", v))
+		for _, v := range strings.Split(req.SubClass, ",") {
+			arr = append(arr, fmt.Sprintf("has(a.property_form, '%s')", v))
 		}
-		querys = append(querys, fmt.Sprintf(" a.property_form in (%s) ", strings.Join(arr, ",")))
+		querys = append(querys, arr...)
 	}
-	findSql = "select a.project_id, a.project_name, a.business_type, a.buyer, a.buyer_id, a.area, a.city, a.district, a.zbtime, a.endtime, a.project_money, a.info_id "
+	findSql = "select a.project_id, a.project_name, a.business_type, a.buyer, a.buyer_id, a.area, a.city, a.district, a.zbtime, a.endtime, a.project_money, a.info_id, a.information_id, a.info_ids "
 	if len(querys) > 0 {
 		countSql = fmt.Sprintf("select count(1) from %s a where %s ", "information.transaction_info", strings.Join(querys, " and "))
 		findSql = fmt.Sprintf("%s from %s  a  where  %s order by zbtime", findSql, "information.transaction_info", strings.Join(querys, " and "))
@@ -294,6 +296,11 @@ func moreInfo(req *types.ProjectListReq, list []*ProjectEntry) (result []*Projec
 		}
 	}
 	for _, m := range list {
+		// 补充跳转链接
+		if m.BusinessType == "采购意向" || m.BusinessType == "招标项目" {
+			m.Href = fmt.Sprintf("/article/content/%s.html", encrypt.CommonEncodeArticle("content", m.ProjectId))
+		}
+		m.ProjectId = util.EncodeId(m.ProjectId)
 		// 人脉、人脉所在单位项目 conn_type: 1 人脉可转介绍项目; conn_type: 2 人脉所在单位项目
 		if connMap[m.BuyerId] == 1 {
 			m.MyConn = true // 我的人脉

+ 2 - 0
api/internal/types/types.go

@@ -215,6 +215,8 @@ type OwnerListReq struct {
 	PositionId       int64  `header:"positionId,optional"`
 	PageSize         int64  `json:"pageSize,optional"`
 	PageIndex        int64  `json:"pageIndex,optional"`
+	ProjectType      string `json:"projectType,optional"`
+	EntAccountId     int64  `header:"entAccountId"`
 }
 
 type ProjectListReq struct {