Jianghan 9 月之前
父节点
当前提交
f8e7707fc4

+ 7 - 6
api/internal/service/CoopHistoryService.go

@@ -89,7 +89,8 @@ func GetPrList(req *types.CoopHistoryReq) (result []*ResultData, size_1, size_2,
 	if err != nil {
 		return nil, 0, 0, 0, 0
 	}
-	propertyForm := T.NetworkCom.GetMyProbusfor(req.EntAccountId)
+	//propertyForm := T.NetworkCom.GetMyProbusfor(req.EntAccountId)
+	scopeClass := FindBusiness(req.EntId, req.EntUserId)
 	// firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构 sup_sub: 上下级
 	// 1、同甲异业数据/ 3、招标代理机构渠道
 	if pTmp.BuyerId != "" {
@@ -131,7 +132,7 @@ func GetPrList(req *types.CoopHistoryReq) (result []*ResultData, size_1, size_2,
 				}
 			}
 		}
-		rs1, rs2 := GetData(propertyForm, pTmp.BuyerId)
+		rs1, rs2 := GetData(strings.Split(scopeClass, ","), pTmp.BuyerId)
 		r1 := rs1[pTmp.BuyerId]
 		r2 := rs2[pTmp.BuyerId]
 		if r1 != nil && len(r1) > 0 {
@@ -174,7 +175,7 @@ func GetPrList(req *types.CoopHistoryReq) (result []*ResultData, size_1, size_2,
 	return
 }
 
-func GetData(propertyForm []string, bid string) (result1, result2 map[string][]map[string]interface{}) {
+func GetData(scopeClass []string, bid string) (result1, result2 map[string][]map[string]interface{}) {
 	result1, result2 = map[string][]map[string]interface{}{}, map[string][]map[string]interface{}{}
 	type AggStruct struct {
 		Buckets []struct {
@@ -200,10 +201,10 @@ func GetData(propertyForm []string, bid string) (result1, result2 map[string][]m
 	m1 := make(map[string]interface{}) //采购单位-中标单位
 	m2 := make(map[string]interface{}) //采购单位-代理机构
 	noIds := []string{}
-	if len(propertyForm) > 0 {
+	if len(scopeClass) > 0 {
 		//同甲异态 中标企业
-		aggs, _, _ := elastic.GetAggs(INDEX_1, INDEX_1, fmt.Sprintf(es_query, strings.ReplaceAll(bid, ",", `","`), strings.Join(propertyForm, "\",\"")))
-		logx.Info("es聚合查询结果:", fmt.Sprintf(es_query, strings.ReplaceAll(bid, ",", `","`), strings.Join(propertyForm, "\",\"")))
+		aggs, _, _ := elastic.GetAggs(INDEX_1, INDEX_1, fmt.Sprintf(es_query, strings.ReplaceAll(bid, ",", `","`), strings.Join(scopeClass, "\",\"")))
+		logx.Info("es聚合查询结果:", fmt.Sprintf(es_query, strings.ReplaceAll(bid, ",", `","`), strings.Join(scopeClass, "\",\"")))
 		var m1Buckets = AggStruct{}
 		if aggs != nil && aggs["winner_count"] != nil {
 			bs, err := aggs["winner_count"].MarshalJSON()

+ 3 - 3
api/internal/service/plistService.go

@@ -8,6 +8,7 @@ import (
 	T "bp.jydev.jianyu360.cn/CRM/networkManage/api/common"
 	"bp.jydev.jianyu360.cn/CRM/networkManage/api/internal/types"
 	"context"
+	"encoding/json"
 	"fmt"
 	"github.com/gogf/gf/v2/util/gconv"
 	"github.com/shopspring/decimal"
@@ -83,8 +84,8 @@ func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasN
 
 	// 缓存
 	rkey := "projectList-" + common.GetMd5String(fmt.Sprintf("%+v", req))
-	if cacheObj := redis.Get("newother", rkey); cacheObj != nil {
-		resultList = cacheObj.([]*ProjectEntry)
+	if ret, err := redis.GetBytes("newother", rkey); err == nil {
+		err = json.Unmarshal(*ret, &resultList)
 	} else {
 		countSql, findSql := getQuerySql(req, true, buyerArr, plist)
 		logx.Info("findSql: ", findSql)
@@ -365,7 +366,6 @@ func moreInfo(req *types.ProjectListReq, plist []string, list []*ProjectEntry) (
 			}
 		}
 	}
-	logx.Info(connMap)
 	for _, m := range list {
 		// 中间人的项目 默认 我的人脉
 		if len(plist) > 0 {

+ 1 - 1
api/internal/types/types.go

@@ -42,7 +42,7 @@ type AssociateReq struct {
 type CoopHistoryReq struct {
 	EntAccountId int64  `header:"entAccountId,optional"` //企业账户id
 	PositionId   int64  `header:"positionId,optional"`
-	EntId        string `header:"entId,optional"`
+	EntId        int64  `header:"entId,optional"`
 	EntUserId    string `header:"entUserId,optional"`
 	DeptId       string `header:"deptId,optional"` //部门id
 	Pid          string `json:"projectId"`

+ 3 - 3
api/networkmanage.api

@@ -55,11 +55,11 @@ type (
 	CoopHistoryReq {
 		EntAccountId int64  `header:"entAccountId,optional"` //企业账户id
 		PositionId   int64  `header:"positionId,optional"`
-		EntId        string `header:"entId,optional"`
+		EntId        int64  `header:"entId,optional"`
 		EntUserId    string `header:"entUserId,optional"`
 		DeptId       string `header:"deptId,optional"` //部门id
-		Pid          string `json:"projectId"`
-		Bid          string `json:"infoId"`
+		Pid          string `json:"projectId,optional"`
+		Bid          string `json:"infoId,optional"`
 		ChannelType  string `json:"channelType"`
 	}
 	AddOrUpdateReq {