Jianghan 1 jaar geleden
bovenliggende
commit
c9d16622f9

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

@@ -5,6 +5,7 @@ import (
 	"bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
 	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
 	"context"
+	"fmt"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )
@@ -24,6 +25,7 @@ func NewCoopHistoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *C
 }
 
 func (l *CoopHistoryListLogic) CoopHistoryList(req *types.CoopHistoryReq) (resp *types.Reply, err error) {
+	logx.Info(fmt.Sprintf("%+v", req))
 	resp = &types.Reply{}
 	result, size1, size2, size3, size4 := service.GetPrList(req)
 	resp.Data = map[string]interface{}{

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

@@ -4,6 +4,7 @@ import (
 	"app.yhyue.com/moapp/jybase/date"
 	T "bp.jydev.jianyu360.cn/CRM/application/api/common"
 	"context"
+	"fmt"
 	"time"
 
 	"bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
@@ -27,6 +28,7 @@ func NewIgnoreActionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Igno
 }
 
 func (l *IgnoreActionLogic) IgnoreAction(req *types.IgnoreReq) (resp *types.Reply, err error) {
+	logx.Info(fmt.Sprintf("%+v", req))
 	resp = &types.Reply{}
 	query := map[string]interface{}{
 		"position_id": req.PositionId,

+ 1 - 0
api/internal/logic/infodetaillogic.go

@@ -40,6 +40,7 @@ type Infomation struct {
 }
 
 func (l *InfoDetailLogic) InfoDetail(req *types.InfoDetailReq) (resp *types.Reply, err error) {
+	logx.Info(fmt.Sprintf("%+v", req))
 	resp = &types.Reply{}
 	sql := `SELECT title, summary, content, basis, area, city, datajson_id FROM information.information WHERE id = ?`
 	info := Infomation{}

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

@@ -3,6 +3,7 @@ package logic
 import (
 	"bp.jydev.jianyu360.cn/CRM/application/api/internal/service"
 	"context"
+	"fmt"
 
 	"bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
 	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
@@ -25,6 +26,7 @@ func NewProjectHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Pr
 }
 
 func (l *ProjectHistoryLogic) ProjectHistory(req *types.PrjectHistoryReq) (resp *types.Reply, err error) {
+	logx.Info(fmt.Sprintf("%+v", req))
 	resp = &types.Reply{}
 	if req.BuyerId != "" && req.WinnerId != "" {
 		data := service.GetData3(req.BuyerId, req.WinnerId)

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

@@ -3,6 +3,7 @@ package logic
 import (
 	"bp.jydev.jianyu360.cn/CRM/application/api/internal/service"
 	"context"
+	"fmt"
 
 	"bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
 	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
@@ -25,6 +26,7 @@ func NewProjectListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Proje
 }
 
 func (l *ProjectListLogic) ProjectList(req *types.ProjectListReq) (resp *types.Reply, err error) {
+	logx.Info(fmt.Sprintf("%+v", req))
 	resp = &types.Reply{}
 	list, hasNextPage, count := service.GetProjectList(req)
 	resp.Data = map[string]interface{}{

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

@@ -5,6 +5,7 @@ import (
 	"bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
 	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
 	"context"
+	"fmt"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )
@@ -28,6 +29,7 @@ func NewPrPnameAssLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PrPnam
 }
 
 func (l *PrPnameAssLogic) PrPnameAss(req *types.PnameAssReq) (resp *types.Reply, err error) {
+	logx.Info(fmt.Sprintf("%+v", req))
 	resp = &types.Reply{}
 	if req.ProjectName != "" {
 		esq := `{"query": {"bool": {"must": [{"match": {"project_name.pname": "` + req.ProjectName + `" }}]}}}`

+ 10 - 12
api/internal/service/CoopHistoryService.go

@@ -9,6 +9,7 @@ import (
 	"encoding/json"
 	"fmt"
 	"github.com/zeromicro/go-zero/core/logx"
+	"strings"
 	"time"
 )
 
@@ -18,7 +19,7 @@ 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_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_query  = `{"query": {"bool": {"must": [{"term": {"buyer_id": "%s"}}],"must_not": {"terms": {"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}`
 )
 
@@ -52,11 +53,7 @@ func GetPrList(req *types.CoopHistoryReq) (result []*ResultData, size_1, size_2,
 	if err != nil {
 		return nil, 0, 0, 0, 0
 	}
-	propertyForm := ""
-	m1 := T.CrmMysql.FindOne("config_tenant", map[string]interface{}{"entAccountId": req.EntAccountId}, "probusfor", "")
-	if m1 != nil && len(*m1) > 0 {
-		propertyForm = common.ObjToString((*m1)["probusfor"])
-	}
+	propertyForm := T.NetworkCom.GetMyProbusfor(req.EntAccountId)
 	// firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构 sup_sub: 上下级
 	// 1、同甲异业数据/ 3、招标代理机构渠道
 	if req.ChannelType == "0" || req.ChannelType == "1" || req.ChannelType == "3" {
@@ -138,7 +135,7 @@ func GetPrList(req *types.CoopHistoryReq) (result []*ResultData, size_1, size_2,
 	return
 }
 
-func GetData(propertyForm, bid string) (result1, result2 []map[string]interface{}) {
+func GetData(propertyForm []string, bid string) (result1, result2 []map[string]interface{}) {
 	type AggStruct struct {
 		Buckets []struct {
 			Key        string `json:"key,omitempty"`
@@ -156,9 +153,9 @@ func GetData(propertyForm, bid string) (result1, result2 []map[string]interface{
 	}
 	m1 := make(map[string]interface{}) //采购单位-中标单位
 	m2 := make(map[string]interface{}) //采购单位-代理机构
-	if propertyForm != "" {
+	if len(propertyForm) > 0 {
 		//同甲异态 中标企业
-		aggs, count, res := elastic.GetAggs(INDEX_1, INDEX_1, fmt.Sprintf(es_query, bid, propertyForm))
+		aggs, count, res := elastic.GetAggs(INDEX_1, INDEX_1, fmt.Sprintf(es_query, bid, strings.Join(propertyForm, ",")))
 		logx.Info("es聚合查询结果:", aggs, count, res)
 		var m1Buckets = AggStruct{}
 		if aggs != nil && aggs["winner_count"] != nil {
@@ -191,8 +188,7 @@ func GetData(propertyForm, bid string) (result1, result2 []map[string]interface{
 		}
 	}
 	//代理机构
-	aggs1, count1, res1 := elastic.GetAggs("bidding", "bidding", fmt.Sprintf(es_query1, "中国计量大学"))
-	logx.Info("es聚合查询结果:", aggs1, count1, res1)
+	aggs1, _, _ := elastic.GetAggs(INDEX_1, INDEX_1, fmt.Sprintf(es_query1, bid))
 	var m2Buckets = AggStruct{}
 	if aggs1 != nil && aggs1["agency_count"] != nil {
 		bs, err := aggs1["agency_count"].MarshalJSON()
@@ -206,7 +202,9 @@ func GetData(propertyForm, bid string) (result1, result2 []map[string]interface{
 				logx.Info(err)
 				if len(m2Buckets.Buckets) > 0 {
 					for _, v := range m2Buckets.Buckets {
-						m2[v.Key] = map[string]interface{}{"name": v.Key, "amount": v.Amount_all.Value, "count": v.Doc_count}
+						if v.Key != "" {
+							m2[v.Key] = map[string]interface{}{"name": v.Key, "amount": v.Amount_all.Value, "count": v.Doc_count}
+						}
 					}
 				}
 			}

+ 1 - 5
api/internal/service/owner.go

@@ -1053,11 +1053,7 @@ func (t *OwnerService) CandidateChannel() []*ResultData {
 		dataMap = BuyerList(t.PartyA, t.Supplier, t.Heterotophy, t.Intermediary, t.Agency, t.PositionId)
 	}
 	if len(*dataMap) > 0 && dataMap != nil {
-		propertyForm := ""
-		m1 := CrmMysql.FindOne("config_tenant", map[string]interface{}{"account_id": t.EntAccountId}, "probusfor", "")
-		if m1 != nil && len(*m1) > 0 {
-			propertyForm = common.ObjToString((*m1)["probusfor"])
-		}
+		propertyForm := NetworkCom.GetMyProbusfor(t.EntAccountId)
 		for buyerId := range *dataMap {
 			r1, r2 := GetData(propertyForm, buyerId)
 			if r1 != nil && len(r1) > 0 {

+ 0 - 2
api/internal/service/plistService.go

@@ -77,8 +77,6 @@ func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasN
 	for rows.Next() {
 		project := ProjectEntry{}
 		_ = rows.ScanStruct(&project)
-		//project.ProjectId = encrypt.CommonEncodeArticle("content", project.ProjectId)
-		//project.ProjectId = util.EncodeId(project.ProjectId)
 		resultList = append(resultList, &project)
 	}