Эх сурвалжийг харах

Merge branch 'feature/v1.0.4' into dev/v1.0.4_wjh

* feature/v1.0.4:
  列表数据排序
  feat:xiugai
  列表数据排序
  feat:xiugai
  feat:xiugai
  feat:xiugai
  tijiao
  feat:xiugai

# Conflicts:
#	api/internal/handler/routes.go
#	api/internal/logic/plistpathlogic.go
#	api/internal/service/plistService.go
#	api/internal/types/types.go
Jianghan 1 жил өмнө
parent
commit
9d58f4e79b

+ 105 - 75
api/application.api

@@ -20,15 +20,15 @@ type (
 		EntId        int64   `header:"entId,optional"`
 		AccountId    int64   `header:"accountId,optional"`
 		EntDeptId    int64   `header:"entDeptId,optional"`
-		CluesSource  string  `json:"cluesSource"` //线索来源
-		ClueName     string  `json:"clueName"` //线索名称
-		Summary      string  `json:"summary"` //概要信息
+		CluesSource  string  `json:"cluesSource"`           //线索来源
+		ClueName     string  `json:"clueName"`              //线索名称
+		Summary      string  `json:"summary"`               //概要信息
 		FollowUpTime int64   `json:"followUpTime,optional"` //下次跟进时间(时间戳)
-		Types        int64   `json:"types"` //处理方式 1自办;2转办;3待处理
-		User         []int64 `json:"user,optional"` //企业用户id
+		Types        int64   `json:"types"`                 //处理方式 1自办;2转办;3待处理
+		User         []int64 `json:"user,optional"`         //企业用户id
 		EmployInfoId int64   `json:"employInfoId,optional"` //资讯收录id
-		CreateName   string  `json:"createName"` //创建人
-		Channel      string  `json:"channel"` //渠道来源:网页、手动创建
+		CreateName   string  `json:"createName"`            //创建人
+		Channel      string  `json:"channel"`               //渠道来源:网页、手动创建
 	}
 	SaleChanceReq {
 		AppId             string  `header:"appId,default=10000"`
@@ -38,23 +38,23 @@ type (
 		EntId             int64   `header:"entId,optional"`
 		AccountId         int64   `header:"accountId,optional"`
 		EntDeptId         int64   `header:"entDeptId,optional"`
-		ChanceName        string  `json:"chanceName"` //机会名称
-		Summary           string  `json:"summary"` //概要信息
-		ChanceClassify    int64   `json:"chanceClassify"` //机会分类
+		ChanceName        string  `json:"chanceName"`                 //机会名称
+		Summary           string  `json:"summary"`                    //概要信息
+		ChanceClassify    int64   `json:"chanceClassify"`             //机会分类
 		ExpectedOrderTime int64   `json:"expectedOrderTime,optional"` //最初预计落单段时间 时间戳
-		ExpectedMoney     float64 `json:"expectedMoney,optional"` //最初预计落单金额
-		CustomName        string  `json:"customName"` //客户全称
-		BusinessType      int64   `json:"businessType"` //业务类型  1新客户需求 2老客户需求 3简易项目流程
-		Remarks           string  `json:"remarks,optional"` //备注
-		NextfollowUpTime  int64   `json:"nextfollowUpTime,optional"` //下次跟进时间戳
-		Types             int64   `json:"types"` //处理方式 1自办;2转办;3待处理
-		User              []int64 `json:"user,optional"` //企业用户id
-		EmployInfoId      int64   `json:"employInfoId,optional"` //资讯收录id
-		CustomId          int64   `json:"customId,optional"` //客户id
-		CreateName        string  `json:"createName"` //创建人
-		ChanceSource      int64   `json:"chanceSource"` //机会来源
-		OwnerId           int64   `json:"ownerId,optional"` //潜客收录id(人脉)
-		BusinessId        int64   `json:"businessId,optional"` //商机收录id(人脉)
+		ExpectedMoney     float64 `json:"expectedMoney,optional"`     //最初预计落单金额
+		CustomName        string  `json:"customName"`                 //客户全称
+		BusinessType      int64   `json:"businessType"`               //业务类型  1新客户需求 2老客户需求 3简易项目流程
+		Remarks           string  `json:"remarks,optional"`           //备注
+		NextfollowUpTime  int64   `json:"nextfollowUpTime,optional"`  //下次跟进时间戳
+		Types             int64   `json:"types"`                      //处理方式 1自办;2转办;3待处理
+		User              []int64 `json:"user,optional"`              //企业用户id
+		EmployInfoId      int64   `json:"employInfoId,optional"`      //资讯收录id
+		CustomId          int64   `json:"customId,optional"`          //客户id
+		CreateName        string  `json:"createName"`                 //创建人
+		ChanceSource      int64   `json:"chanceSource"`               //机会来源
+		OwnerId           int64   `json:"ownerId,optional"`           //潜客收录id(人脉)
+		BusinessId        int64   `json:"businessId,optional"`        //商机收录id(人脉)
 	}
 	EmployOperateReq {
 		AppId      string `header:"appId,default=10000"`
@@ -62,8 +62,8 @@ type (
 		PositionId int64  `header:"positionId,optional"`
 		EntUserId  int64  `header:"entUserId,optional"`
 		EntId      int64  `header:"entId,optional"`
-		IdArr      string `json:"idArr"` //信息id多条信息
-		IsEmploy   bool   `json:"isEmploy"` //是否收录true收录 false取消收录
+		IdArr      string `json:"idArr"`      //信息id多条信息
+		IsEmploy   bool   `json:"isEmploy"`   //是否收录true收录 false取消收录
 		EmployType int64  `json:"employType"` //来源方式来源;1招标采购、2企业、3采购单位、4拟在建项目
 		EntDeptId  int64  `header:"entDeptId,optional"`
 		From       string `json:"from,optional"` //来源
@@ -83,8 +83,8 @@ type (
 		PositionId int64  `header:"positionId,optional"`
 		EntUserId  int64  `header:"entUserId,optional"`
 		EntId      int64  `header:"entId,optional"`
-		IdArr      string `json:"idArr"` //id集合
-		IsIgnore   bool   `json:"isIgnore"` //是否忽略 true 忽略 false取消忽略
+		IdArr      string `json:"idArr"`      //id集合
+		IsIgnore   bool   `json:"isIgnore"`   //是否忽略 true 忽略 false取消忽略
 		EmployType int64  `json:"employType"` //来源方式来源;1招标采购、2企业、3采购单位、4拟在建项目
 	}
 	InfoEmployinfoReq {
@@ -94,13 +94,13 @@ type (
 		EntUserId    int64  `header:"entUserId,optional"`
 		EntId        int64  `header:"entId,optional"`
 		EmployType   int64  `json:"employType"` //1标采购、2企业、3采购单位、4拟在建项目
-		IdArr        string `json:"idArr"` //id
+		IdArr        string `json:"idArr"`      //id
 		EntNicheDis  int64  `header:"entNicheDis,optional"`
 		EntDeptId    int64  `header:"entDeptId,optional"`
 		PositionType int64  `header:"positionType,optional"` //职位类型 0个人 1企业
-		AccountId    int64  `header:"accountId,optional"` //账户id
+		AccountId    int64  `header:"accountId,optional"`    //账户id
 		EntAccountId int64  `header:"entAccountId,optional"` //企业账户id
-		From         string `json:"from,optional"` //来源
+		From         string `json:"from,optional"`           //来源
 	}
 	CustomAddReq {
 		AppId                string  `header:"appId,default=10000"`
@@ -110,28 +110,28 @@ type (
 		EntId                int64   `header:"entId,optional"`
 		AccountId            int64   `header:"accountId,optional"`
 		EntDeptId            int64   `header:"entDeptId,optional"`
-		CustomType           int64   `json:"customType"` //客户类型
-		Summary              string  `json:"summary"` //概要信息
-		CustomAllName        string  `json:"customAllName"` //客户全称
-		CustomAbbreviation   string  `json:"customAbbreviation"` //客户简称
-		CustomLevel          int64   `json:"customLevel,optional"` //客户级别
-		CustomIndustry       int64   `json:"customIndustry"` //客户行业
-		CustomDetailIndustry int64   `json:"customDetailIndustry"` //客户细分行业
-		Province             string  `json:"province,optional"` //省份
-		City                 string  `json:"city,optional"` //城市
-		District             string  `json:"district,optional"` //地区
-		Address              string  `json:"address,optional"` //详细地址
-		CompanyPhone         string  `json:"companyPhone,optional"` //公司电话
-		NextfollowUpTime     int64   `json:"nextfollowUpTime,optional"` //下次跟进时间戳
-		Types                int64   `json:"types"` //处理方式 1自办;2转办
-		User                 []int64 `json:"user,optional"` //转办用户
+		CustomType           int64   `json:"customType"`                       //客户类型
+		Summary              string  `json:"summary"`                          //概要信息
+		CustomAllName        string  `json:"customAllName"`                    //客户全称
+		CustomAbbreviation   string  `json:"customAbbreviation"`               //客户简称
+		CustomLevel          int64   `json:"customLevel,optional"`             //客户级别
+		CustomIndustry       int64   `json:"customIndustry"`                   //客户行业
+		CustomDetailIndustry int64   `json:"customDetailIndustry"`             //客户细分行业
+		Province             string  `json:"province,optional"`                //省份
+		City                 string  `json:"city,optional"`                    //城市
+		District             string  `json:"district,optional"`                //地区
+		Address              string  `json:"address,optional"`                 //详细地址
+		CompanyPhone         string  `json:"companyPhone,optional"`            //公司电话
+		NextfollowUpTime     int64   `json:"nextfollowUpTime,optional"`        //下次跟进时间戳
+		Types                int64   `json:"types"`                            //处理方式 1自办;2转办
+		User                 []int64 `json:"user,optional"`                    //转办用户
 		EmployCustomId       int64   `json:"employCustomId,optional,optional"` //客户收录id
-		EmployInfoId         int64   `json:"employInfoId,optional,optional"` //资讯收录id
-		Remarks              string  `json:"remarks,optional"` //备注
-		CreateName           string  `json:"createName"` //创建人
-		Source               string  `json:"source,optional"` //来源
-		OwnerId              int64   `json:"ownerId,optional"` //潜客收录id(人脉)
-		BusinessId           int64   `json:"businessId,optional"` //商机收录id(人脉)
+		EmployInfoId         int64   `json:"employInfoId,optional,optional"`   //资讯收录id
+		Remarks              string  `json:"remarks,optional"`                 //备注
+		CreateName           string  `json:"createName"`                       //创建人
+		Source               string  `json:"source,optional"`                  //来源
+		OwnerId              int64   `json:"ownerId,optional"`                 //潜客收录id(人脉)
+		BusinessId           int64   `json:"businessId,optional"`              //商机收录id(人脉)
 	}
 	FileUploadReq {
 		AppId      string `header:"appId,default=10000"`
@@ -140,8 +140,8 @@ type (
 		EntUserId  int64  `header:"entUserId,optional"`
 		EntId      int64  `header:"entId,optional"`
 		BusinessId int64  `form:"businessId"` //业务id
-		Types      int64  `form:"type"` //类型;1:跟进记录-线下 2:跟进记录-线上 3:跟进记录-备忘 4:销售机会-项目文档 5:客户-客户档案
-		FileType   int64  `form:"fileType"` //文件类型,产品介绍、项目方案、立项报告、报价文件、招标文件、投标文件、中标通知书、合同、发票、其他文件
+		Types      int64  `form:"type"`       //类型;1:跟进记录-线下 2:跟进记录-线上 3:跟进记录-备忘 4:销售机会-项目文档 5:客户-客户档案
+		FileType   int64  `form:"fileType"`   //文件类型,产品介绍、项目方案、立项报告、报价文件、招标文件、投标文件、中标通知书、合同、发票、其他文件
 	}
 	EmployDistributeReq {
 		AppId       string             `header:"appId,default=10000"`
@@ -168,12 +168,12 @@ type (
 		PositionId int64   `header:"positionId,optional"`
 		EntUserId  int64   `header:"entUserId,optional"`
 		EntId      int64   `header:"entId,optional"`
-		Title      string  `json:"title"` //标题
-		Content    string  `json:"content"` //内容
-		PcHref     string  `json:"pcHref"` //pc跳转地址
-		MobileHref string  `json:"mobileHref"` //移动端跳转地址
+		Title      string  `json:"title"`         //标题
+		Content    string  `json:"content"`       //内容
+		PcHref     string  `json:"pcHref"`        //pc跳转地址
+		MobileHref string  `json:"mobileHref"`    //移动端跳转地址
 		User       []int64 `json:"user,optional"` //企业用户id
-		MsgType    string  `json:"msgType"` //消息类型 1-活动优惠 2-服务通知 3-订阅消息 4-项目动态 5-企业动态 6-分析报告 7-系统通知 11-待办
+		MsgType    string  `json:"msgType"`       //消息类型 1-活动优惠 2-服务通知 3-订阅消息 4-项目动态 5-企业动态 6-分析报告 7-系统通知 11-待办
 	}
 	CanAddReq {
 		AppId          string `header:"appId,default=10000"`
@@ -183,20 +183,20 @@ type (
 		EntId          int64  `header:"entId,optional"`
 		AccountId      int64  `header:"accountId,optional"`
 		EntDeptId      int64  `header:"entDeptId,optional"`
-		EmployInfoId   int64  `json:"employInfoId"` //资讯收录id
+		EmployInfoId   int64  `json:"employInfoId"`            //资讯收录id
 		EmployCustomId int64  `json:"employCustomId,optional"` //客户收录id
-		Key            string `json:"key"` //创建线索:more_create_clue 创建机会:more_create_chance 创建客户:more_create_custom
+		Key            string `json:"key"`                     //创建线索:more_create_clue 创建机会:more_create_chance 创建客户:more_create_custom
 	}
 	OwnerListReq {
-		PartyA           string `json:"partyA,optional"` //甲方
-		Supplier         string `json:"supplier,optional"` //供应商
-		Heterotophy      string `json:"heterotophy,optional"` //同甲异业
-		Intermediary     string `json:"intermediary,optional"` //中间人
-		Agency           string `json:"agency,optional"` //代理机构
-		SearchEntName    string `json:"searchEntName,optional"` //搜索企业名称
-		SourceType       string `json:"sourceType,optional"` //搜索类型 1 只看转介绍成功率高2只看已监控的
+		PartyA           string `json:"partyA,optional"`           //甲方
+		Supplier         string `json:"supplier,optional"`         //供应商
+		Heterotophy      string `json:"heterotophy,optional"`      //同甲异业
+		Intermediary     string `json:"intermediary,optional"`     //中间人
+		Agency           string `json:"agency,optional"`           //代理机构
+		SearchEntName    string `json:"searchEntName,optional"`    //搜索企业名称
+		SourceType       string `json:"sourceType,optional"`       //搜索类型 1 只看转介绍成功率高2只看已监控的
 		ProcessingStatus string `json:"processingStatus,optional"` //处理状态1未处理2已忽略3已建客户
-		Area             string `json:"area,optional"` //项目地区
+		Area             string `json:"area,optional"`             //项目地区
 		PositionId       int64  `header:"positionId,optional"`
 		PageSize         int64  `json:"pageSize,optional"`
 		PageIndex        int64  `json:"pageIndex,optional"`
@@ -205,12 +205,12 @@ type (
 		PositionId   int64  `header:"positionId,optional"`
 		EntId        string `header:"entId,optional"`
 		EntUserId    string `header:"entUserId,optional"`
-		DeptId       string `header:"deptId,optional"` //部门id
-		PartyA       string `json:"partyA,optional"` //甲方
-		Supplier     string `json:"supplier,optional"` //供应商
-		Heterotophy  string `json:"heterotophy,optional"` //同甲异业
+		DeptId       string `header:"deptId,optional"`     //部门id
+		PartyA       string `json:"partyA,optional"`       //甲方
+		Supplier     string `json:"supplier,optional"`     //供应商
+		Heterotophy  string `json:"heterotophy,optional"`  //同甲异业
 		Intermediary string `json:"intermediary,optional"` //中间人
-		Agency       string `json:"agency,optional"` //代理机构
+		Agency       string `json:"agency,optional"`       //代理机构
 		PageNum      int64  `json:"pageNum"`
 		PageSize     int64  `json:"pageSize"`
 		BusinessType string `json:"businessType"`
@@ -267,6 +267,7 @@ type (
 		Id           string `json:"id,optional"`
 	}
 	NetWorkListReq {
+		EntAccountId       int64  `header:"entAccountId"`
 		PositionId         int64  `header:"positionId"`
 		Type               string `json:"type,optional"`
 		Name               string `json:"name,optional"`
@@ -297,6 +298,25 @@ type (
 		BuyerId  string `json:"buyerId"`
 		WinnerId string `json:"winnerId"`
 	}
+	ChannelListReq {
+		PartyA       string `json:"partyA,optional"`       //甲方
+		Supplier     string `json:"supplier,optional"`     //供应商
+		Heterotophy  string `json:"heterotophy,optional"`  //同甲异业
+		Intermediary string `json:"intermediary,optional"` //中间人
+		Agency       string `json:"agency,optional"`       //代理机构
+		PositionId   int64  `header:"positionId,optional"`
+	}
+	RouteOwnerListReq {
+		BuyerId   string `json:"buyerId,optional"`
+		BuyerName string `json:"buyerName,optional"`
+	}
+	CooperateOwnerListReq {
+		BuyerId       string `json:"buyerId,optional"`
+		BuyerName     string `json:"buyerName,optional"`
+		WinnerId      string `json:"winnerId,optional"`
+		WinnerName    string `json:"winnerName,optional"`
+		CooperateType string `json:"cooperateType,optional"`
+	}
 )
 
 @server (
@@ -354,7 +374,7 @@ service crmApplication {
 
 	@doc "人脉可达潜客业主列表"
 	@handler ownerList
-	post /crmApplication/owner/List (OwnerListReq) returns (Reply)
+	post /crmApplication/owner/list (OwnerListReq) returns (Reply)
 
 	@doc "人脉可达商机列表"
 	@handler projectList
@@ -395,5 +415,15 @@ service crmApplication {
 	@doc "人脉项目分析-业主合作历史"
 	@handler projectHistory
 	post /crmApplication/pr/project/history (PrjectHistoryReq) returns (Reply)
-}
+	@doc "可介绍业主路径"
+	@handler ownerRoute
+	post /crmApplication/owner/route (RouteOwnerListReq) returns (Reply)
+
+	@doc "可介绍业主合作次数"
+	@handler ownerCooperate
+	post /crmApplication/owner/cooperate (CooperateOwnerListReq) returns (Reply)
 
+	@doc "候选渠道列表"
+	@handler candidateChannel
+	post /crmApplication/candidate/channel (ChannelListReq) returns (Reply)
+}

+ 14 - 2
api/common/network.go

@@ -52,7 +52,7 @@ func (n *networkCom) GetMyProbusfor(entAccoutId int64) []string {
 	return strings.Split(probusfor, ",")
 }
 
-//
+//获取总数封装
 func (n *networkCom) Count(query string, args ...interface{}) int64 {
 	row := ClickhouseConn.QueryRow(context.Background(), query, args...)
 	var count uint64
@@ -63,7 +63,19 @@ func (n *networkCom) Count(query string, args ...interface{}) int64 {
 	return int64(count)
 }
 
-//
+//获取我监控的企业
+func (n *networkCom) EntMonitor(positionId int64) map[string]bool {
+	m := map[string]bool{}
+	list := CrmMysql.SelectBySql(`select * from base_service.follow_ent_monitor where s_userid=?`, positionId)
+	for _, v := range *list {
+		if entName := ObjToString(v["s_entname"]); entName != "" {
+			m[entName] = true
+		}
+	}
+	return m
+}
+
+//获取问号占位符数量及对应的参数值
 func (n *networkCom) WhArgs(args []string) (string, []interface{}) {
 	newArgs := make([]interface{}, len(args))
 	wh := make([]string, len(args))

+ 1 - 1
api/etc/db.yaml

@@ -69,6 +69,6 @@ clickhouse:
     Addr: 192.168.3.207:19000
     UserName: jytop
     Password: pwdTopJy123
-    DbName: jianyu
+    DbName: information
     MaxIdleConns: 5
     MaxOpenConns: 30

+ 28 - 0
api/internal/handler/candidatechannelhandler.go

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"net/http"
+
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/logic"
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func candidateChannelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.ChannelListReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := logic.NewCandidateChannelLogic(r.Context(), svcCtx)
+		resp, err := l.CandidateChannel(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 28 - 0
api/internal/handler/ownercooperatehandler.go

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"net/http"
+
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/logic"
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func ownerCooperateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.CooperateOwnerListReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := logic.NewOwnerCooperateLogic(r.Context(), svcCtx)
+		resp, err := l.OwnerCooperate(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 28 - 0
api/internal/handler/ownerroutehandler.go

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"net/http"
+
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/logic"
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func ownerRouteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.RouteOwnerListReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := logic.NewOwnerRouteLogic(r.Context(), svcCtx)
+		resp, err := l.OwnerRoute(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 72 - 27
api/internal/handler/routes.go

@@ -19,48 +19,48 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/custom/add",
-				Handler: customAddHandler(serverCtx),
+				Path:    "/crmApplication/saleChance/add",
+				Handler: saleChanceAddHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/employ/distribute",
-				Handler: employDistributeHandler(serverCtx),
+				Path:    "/crmApplication/employ/operate",
+				Handler: employOperateHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/employ/info",
-				Handler: employInfoHandler(serverCtx),
+				Path:    "/crmApplication/information/transfer",
+				Handler: transferHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/employ/operate",
-				Handler: employOperateHandler(serverCtx),
+				Path:    "/crmApplication/ignore/operate",
+				Handler: ignoreOperateHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/ent/info",
-				Handler: entinfoHandler(serverCtx),
+				Path:    "/crmApplication/employ/info",
+				Handler: employInfoHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/file/upload",
-				Handler: fileUploadHandler(serverCtx),
+				Path:    "/crmApplication/custom/add",
+				Handler: customAddHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/ignore/action",
-				Handler: ignoreActionHandler(serverCtx),
+				Path:    "/crmApplication/file/upload",
+				Handler: fileUploadHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/ignore/operate",
-				Handler: ignoreOperateHandler(serverCtx),
+				Path:    "/crmApplication/employ/distribute",
+				Handler: employDistributeHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/info/canAdd",
-				Handler: canAddReqHandler(serverCtx),
+				Path:    "/crmApplication/ent/info",
+				Handler: entinfoHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
@@ -69,11 +69,12 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/infomation/detail",
-				Handler: infoDetailHandler(serverCtx),
+				Path:    "/crmApplication/info/canAdd",
+				Handler: canAddReqHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
+<<<<<<< HEAD
 				Path:    "/crmApplication/information/transfer",
 				Handler: transferHandler(serverCtx),
 			},
@@ -96,17 +97,16 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 				Method:  http.MethodPost,
 				Path:    "/crmApplication/network/networkList",
 				Handler: networkListHandler(serverCtx),
+=======
+				Path:    "/crmApplication/owner/list",
+				Handler: ownerListHandler(serverCtx),
+>>>>>>> feature/v1.0.4
 			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/crmApplication/network/project/list",
 				Handler: projectListHandler(serverCtx),
 			},
-			{
-				Method:  http.MethodPost,
-				Path:    "/crmApplication/owner/List",
-				Handler: ownerListHandler(serverCtx),
-			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/crmApplication/pr/pname/ass",
@@ -117,6 +117,41 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 				Path:    "/crmApplication/pr/project/analyse",
 				Handler: CoopHistoryListHandler(serverCtx),
 			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/crmApplication/network/addOrUpdate",
+				Handler: addOrUpdateHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/crmApplication/network/associate",
+				Handler: associateHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/crmApplication/network/allProject",
+				Handler: allProjectHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/crmApplication/network/networkList",
+				Handler: networkListHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/crmApplication/ignore/action",
+				Handler: ignoreActionHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/crmApplication/infomation/detail",
+				Handler: infoDetailHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/crmApplication/network/plist/pathway",
+				Handler: plistPathHandler(serverCtx),
+			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/crmApplication/pr/project/history",
@@ -124,8 +159,18 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/saleChance/add",
-				Handler: saleChanceAddHandler(serverCtx),
+				Path:    "/crmApplication/owner/route",
+				Handler: ownerRouteHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/crmApplication/owner/cooperate",
+				Handler: ownerCooperateHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/crmApplication/candidate/channel",
+				Handler: candidateChannelHandler(serverCtx),
 			},
 		},
 		rest.WithMaxBytes(104857600),

+ 41 - 0
api/internal/logic/candidatechannellogic.go

@@ -0,0 +1,41 @@
+package logic
+
+import (
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/service"
+	"context"
+
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type CandidateChannelLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewCandidateChannelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CandidateChannelLogic {
+	return &CandidateChannelLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *CandidateChannelLogic) CandidateChannel(req *types.ChannelListReq) (resp *types.Reply, err error) {
+	// todo: add your logic here and delete this line
+	resp = &types.Reply{}
+	ownerService := &service.OwnerService{
+		PartyA:       req.PartyA,
+		Supplier:     req.Supplier,
+		Intermediary: req.Intermediary,
+		Heterotophy:  req.Heterotophy,
+		Agency:       req.Agency,
+		PositionId:   req.PositionId,
+	}
+	data := ownerService.CandidateChannel()
+	resp.Data = data
+	return
+}

+ 41 - 0
api/internal/logic/ownercooperatelogic.go

@@ -0,0 +1,41 @@
+package logic
+
+import (
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/service"
+	"context"
+
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type OwnerCooperateLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewOwnerCooperateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *OwnerCooperateLogic {
+	return &OwnerCooperateLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *OwnerCooperateLogic) OwnerCooperate(req *types.CooperateOwnerListReq) (resp *types.Reply, err error) {
+	// todo: add your logic here and delete this line
+
+	resp = &types.Reply{}
+	ownerService := &service.OwnerService{
+		BuyerId:       req.BuyerId,
+		BuyerName:     req.BuyerName,
+		WinnerName:    req.WinnerName,
+		WinnerId:      req.WinnerName,
+		CooperateType: req.CooperateType,
+	}
+	data := ownerService.OwnerCooperate()
+	resp.Data = data
+	return
+}

+ 1 - 1
api/internal/logic/ownerlistlogic.go

@@ -1,7 +1,7 @@
 package logic
 
 import (
-	"bp.jydev.jianyu360.cn/CRM/application/service"
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/service"
 	"context"
 
 	"bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"

+ 37 - 0
api/internal/logic/ownerroutelogic.go

@@ -0,0 +1,37 @@
+package logic
+
+import (
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/service"
+	"context"
+
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type OwnerRouteLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewOwnerRouteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *OwnerRouteLogic {
+	return &OwnerRouteLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *OwnerRouteLogic) OwnerRoute(req *types.RouteOwnerListReq) (resp *types.Reply, err error) {
+	// todo: add your logic here and delete this line
+	resp = &types.Reply{}
+	ownerService := &service.OwnerService{
+		BuyerId:   req.BuyerId,
+		BuyerName: req.BuyerName,
+	}
+	data := ownerService.OwnerRoute()
+	resp.Data = data
+	return
+}

+ 32 - 0
api/internal/logic/plistpathlogic.go

@@ -0,0 +1,32 @@
+package logic
+
+import (
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/service"
+	"context"
+
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type PlistPathLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewPlistPathLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PlistPathLogic {
+	return &PlistPathLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *PlistPathLogic) PlistPath(req *types.PListPathReq) (resp *types.Reply, err error) {
+
+	service.ConnectionsHandle([]string{req.BuyerId}, req.PositionId, true)
+
+	return
+}

+ 395 - 175
api/internal/service/network.go

@@ -4,16 +4,19 @@ import (
 	"context"
 	"database/sql"
 	"fmt"
-	"log"
 	"math"
+	"sort"
 	"strings"
 	"sync"
 
 	. "app.yhyue.com/moapp/jybase/common"
 	. "app.yhyue.com/moapp/jybase/date"
+	"app.yhyue.com/moapp/jybase/encrypt"
 	. "app.yhyue.com/moapp/jybase/es"
+	. "app.yhyue.com/moapp/jybase/sort"
 	. "bp.jydev.jianyu360.cn/CRM/application/api/common"
 	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
+	"github.com/shopspring/decimal"
 	"github.com/zeromicro/go-zero/core/logx"
 )
 
@@ -22,20 +25,27 @@ var Network = &network{}
 type network struct {
 }
 type networkTree struct {
-	Count    int64
-	Name     string
-	Children []*networkTreeChild
+	Count    int64               `json:"count"`
+	Name     string              `json:"name"`
+	Children []*networkTreeChild `json:"children"`
 }
 type networkTreeChild struct {
-	Count int64
-	Name  string
-	Id    string
-	Type  int
+	Count int64  `json:"count"`
+	Name  string `json:"name"`
+	Id    string `json:"id"`
+	Type  int    `json:"type"`
 }
 type projectInfo struct {
-	BuyerCount    int
-	ProjectCount  int
+	BuyerCount    int64
+	ProjectCount  int64
 	ProjectAmount float64
+	MonitorCount  int64
+	ExportId      []string
+}
+type firstpartyNetwork struct {
+	CompanyId   string
+	CompanyName string
+	Name        string
 }
 
 //人脉库-添加/修改人脉
@@ -192,68 +202,45 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
 	lock := &sync.Mutex{}
 	reply = &types.Reply{}
 	wh, newArgs := NetworkCom.WhArgs(NetworkCom.GetMyProbusfor(in.EntAccountId))
+	var count int64
+	var list []*networkTree
 	if in.Id != "" {
 		if in.Type == 1 {
-			q := `select c.id as company_id,c.company_name,b.name from information.ent_map_code a 
-				inner join information.ent_code b on (a.a_id=? and b.pcode in ('0100','0200') and a.code=b.code) 
-				inner join information.ent_info c on (a.b_id=c.id)`
-			args := []interface{}{in.Id}
-			if in.Name != "" {
-				q += ` where c.company_name like ?`
-				args = append(args, "%"+in.Name+"%")
-			}
-			q += ` order by b.name,c.company_name`
-			rows, err := ClickhouseConn.Query(context.Background(), q, args...)
-			if err != nil {
-				logx.Error(err)
-				return
-			}
-			nameIndex := map[string]int{}
-			list := []*networkTree{}
-			for rows.Next() {
-				var (
-					company_id   string
-					company_name string
-					name         string
-				)
-				if err := rows.Scan(&company_id, &company_name, &name); err != nil {
-					logx.Error(err)
-					continue
-				}
-				log.Println(company_id, company_name, name)
-				if _, ok := nameIndex[name]; !ok {
-					nameIndex[name] = len(list)
-					list = append(list, &networkTree{
-						Name: name,
-					})
-				}
-				pool <- true
-				wait.Add(1)
-				go func(cIndex int, cId, cName string) {
-					defer func() {
-						<-pool
-						wait.Done()
-					}()
-					ntc := &networkTreeChild{
-						Name: cName,
-						Id:   cId,
-						Type: 1,
-					}
-					if wh != "" {
-						thisArgs := []interface{}{ntc.Id}
-						thisArgs = append(thisArgs, newArgs...)
-						ntc.Count = NetworkCom.Count(`select count(1) from information.transaction_info where buyer_id=? and hasAny(property_form,[`+wh+`])`, thisArgs...)
+			result := n.FirstpartyNetwork(in.Name, []string{in.Id})
+			if result[in.Id] != nil {
+				nameIndex := map[string]int{}
+				for _, v := range result[in.Id] {
+					if _, ok := nameIndex[v.Name]; !ok {
+						nameIndex[v.Name] = len(list)
+						list = append(list, &networkTree{
+							Name: v.Name,
+						})
 					}
-					lock.Lock()
-					list[cIndex].Count += ntc.Count
-					list[cIndex].Children = append(list[cIndex].Children, ntc)
-					lock.Unlock()
-				}(nameIndex[name], company_id, company_name)
-			}
-			wait.Wait()
-			rows.Close()
-			if err := rows.Err(); err != nil {
-				logx.Error(err)
+					pool <- true
+					wait.Add(1)
+					go func(cIndex int, cId, cName string) {
+						defer func() {
+							<-pool
+							wait.Done()
+						}()
+						ntc := &networkTreeChild{
+							Name: cName,
+							Id:   cId,
+							Type: 1,
+						}
+						if wh != "" {
+							thisArgs := []interface{}{ntc.Id}
+							thisArgs = append(thisArgs, newArgs...)
+							ntc.Count = NetworkCom.Count(`select count(1) from information.transaction_info where buyer_id=? and hasAny(property_form,[`+wh+`])`, thisArgs...)
+						}
+						lock.Lock()
+						count++
+						list[cIndex].Count += ntc.Count
+						list[cIndex].Children = append(list[cIndex].Children, ntc)
+						lock.Unlock()
+					}(nameIndex[v.Name], v.CompanyId, v.CompanyName)
+				}
+				wait.Wait()
 			}
 		}
 	} else {
@@ -266,22 +253,26 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
 		}
 		q += ` GROUP BY a.id ORDER BY a.create_time DESC`
 		datas := CrmMysql.SelectBySql(q, args...)
-		var count int64
-		list := []*networkTree{
+		list = []*networkTree{
 			&networkTree{
-				Name: "甲方",
+				Name:     "甲方",
+				Children: []*networkTreeChild{},
 			},
 			&networkTree{
-				Name: "供应商",
+				Name:     "供应商",
+				Children: []*networkTreeChild{},
 			},
 			&networkTree{
-				Name: "同甲异业渠道",
+				Name:     "同甲异业渠道",
+				Children: []*networkTreeChild{},
 			},
 			&networkTree{
-				Name: "中间人",
+				Name:     "中间人",
+				Children: []*networkTreeChild{},
 			},
 			&networkTree{
-				Name: "招标代理",
+				Name:     "招标代理",
+				Children: []*networkTreeChild{},
 			},
 		}
 		//
@@ -306,13 +297,13 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
 					thisArgs := []interface{}{ntc.Id}
 					thisArgs = append(thisArgs, newArgs...)
 					if itype == 1 {
-						ntc.Count = NetworkCom.Count(`select count(1) from information.transaction_info where buyer_id=? and hasAny(b.property_form,[`+wh+`])`, thisArgs)
+						ntc.Count = NetworkCom.Count(`select count(1) from information.transaction_info where buyer_id=? and hasAny(property_form,[`+wh+`])`, thisArgs...)
 					} else if itype == 2 || itype == 3 {
-						ntc.Count = NetworkCom.Count(`select count(1) from information.transaction_info where winner_id=? and hasAny(b.property_form,[`+wh+`])`, thisArgs)
+						ntc.Count = NetworkCom.Count(`select count(1) from information.transaction_info where has(winner_id,?) and hasAny(property_form,[`+wh+`])`, thisArgs...)
 					} else if itype == 4 {
 						ntc.Count = Int64All(v["ipc"])
 					} else if itype == 5 {
-						ntc.Count = NetworkCom.Count(`select count(1) from information.transaction_info where agency_id=? and hasAny(b.property_form,[`+wh+`])`, thisArgs)
+						ntc.Count = NetworkCom.Count(`select count(1) from information.transaction_info where agency_id=? and hasAny(property_form,[`+wh+`])`, thisArgs...)
 					}
 				}
 				lock.Lock()
@@ -323,19 +314,19 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
 			}(vt)
 		}
 		wait.Wait()
-		reply = &types.Reply{
-			Data: map[string]interface{}{
-				"count": count,
-				"list":  list,
-			},
-		}
+	}
+	reply = &types.Reply{
+		Data: map[string]interface{}{
+			"count": count,
+			"list":  list,
+		},
 	}
 	return reply
 }
 
 //人脉库-列表
 func (n *network) List(in *types.NetWorkListReq) *types.Reply {
-	q := `select a.company_id,a.company_name,a.itype,a.contact_person as person,a.contact_phone as phone,count(if(b.itype=1,1,null)) as buyer_count,count(if(b.itype=2,1,null)) as project_count,GROUP_CONCAT(b.relate_id) as relate_id,a.create_time from crm.connection a 
+	q := `select a.company_id,a.company_name,a.itype,a.contact_person as person,a.contact_phone as phone,count(DISTINCT if(b.itype=1,b.relate_id,null)) as buyer_count,count(DISTINCT if(b.itype=2,b.relate_id,null)) as project_count,GROUP_CONCAT(IF(b.itype=1,b.relate_id,NULL)) AS relate_buyer_id,GROUP_CONCAT(IF(b.itype=2,b.relate_id,NULL)) AS relate_project_id,a.create_time from crm.connection a 
 		left join crm.connection_introduce b on (a.id=b.connection_id) where a.position_id=?`
 	args := []interface{}{in.PositionId}
 	if in.Type != "" {
@@ -356,16 +347,18 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 	}
 	q += ` GROUP BY a.id order by a.create_time desc`
 	listTemp := CrmMysql.SelectBySql(q, args...)
-	supplier_array, adiffb_array, agency_array, middleman_array := []string{}, []string{}, []string{}, []string{}
+	firstparty_array, supplier_array, adiffb_array, agency_array, middleman_project_array := []string{}, []string{}, []string{}, []string{}, []string{}
 	for _, v := range *listTemp {
 		switch Int64All(v["itype"]) {
+		case 1:
+			firstparty_array = append(firstparty_array, ObjToString(v["company_id"]))
 		case 2:
 			supplier_array = append(supplier_array, ObjToString(v["company_id"]))
 		case 3:
 			adiffb_array = append(adiffb_array, ObjToString(v["company_id"]))
 		case 4:
-			if relate_id := ObjToString(v["relate_id"]); relate_id != "" {
-				middleman_array = append(middleman_array, strings.Split(relate_id, ",")...)
+			if relate_project_id := ObjToString(v["relate_project_id"]); relate_project_id != "" {
+				middleman_project_array = append(middleman_project_array, strings.Split(relate_project_id, ",")...)
 			}
 		case 5:
 			agency_array = append(agency_array, ObjToString(v["company_id"]))
@@ -373,76 +366,170 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 	}
 	//
 	firstparty_count, supplier_count, adiffb_count, middleman_count, agency_count := 0, 0, 0, 0, 0
-	list := []map[string]interface{}{}
-	supplier_project := n.Introduce_Agency(supplier_array)
-	adiffb_project := n.Introduce_Supplier(adiffb_array)
-	agency_project := n.Introduce_Agency(agency_array)
-	middleman_project := n.Introduce_Middleman(middleman_array)
-	for _, v := range *listTemp {
-		itype := ""
-		buyer_count, project_count, expect_amount := 0, 0, float64(0)
-		company_id := ObjToString(v["company_id"])
-		switch Int64All(v["itype"]) {
-		case 1:
-			itype = "甲方"
-			firstparty_count++
-		case 2:
-			itype = "供应商"
-			supplier_count++
-			if supplier_project[company_id] != nil {
-				buyer_count = supplier_project[company_id].BuyerCount
-				project_count = supplier_project[company_id].ProjectCount
-				expect_amount = supplier_project[company_id].ProjectAmount
-			}
-		case 3:
-			itype = "同甲异业渠道"
-			adiffb_count++
-			if adiffb_project[company_id] != nil {
-				buyer_count = adiffb_project[company_id].BuyerCount
-				project_count = adiffb_project[company_id].ProjectCount
-				expect_amount = adiffb_project[company_id].ProjectAmount
-			}
-		case 4:
-			itype = "中间人"
-			middleman_count++
-			buyer_count = IntAll(v["buyer_count"])
-			project_count = IntAll(v["project_count"])
-			if relate_id := ObjToString(v["relate_id"]); relate_id != "" {
-				for _, v := range strings.Split(relate_id, ",") {
-					if middleman_project[v] != nil {
-						expect_amount += middleman_project[v].ProjectAmount
+	list := []*map[string]interface{}{}
+	isGoNextSetp := true
+	probusfors := []string{}
+	if in.Project_matchme == 1 {
+		probusfors = NetworkCom.GetMyProbusfor(in.EntAccountId)
+		if len(probusfors) == 0 {
+			isGoNextSetp = false
+		}
+	}
+	if isGoNextSetp {
+		entMonitor := NetworkCom.EntMonitor(in.PositionId)
+		fpn := n.FirstpartyNetwork("", firstparty_array)
+		firstparty_project := n.Introduce_Firstparty(fpn, entMonitor, in.Project_matchme, probusfors)
+		supplier_project := n.Introduce_Supplier(supplier_array, entMonitor, in.Project_matchme, probusfors)
+		adiffb_project := n.Introduce_Supplier(adiffb_array, entMonitor, in.Project_matchme, probusfors)
+		agency_project := n.Introduce_Agency(agency_array, entMonitor, in.Project_matchme, probusfors)
+		middleman_project := n.Introduce_Middleman(middleman_project_array, entMonitor, in.Project_matchme, probusfors)
+		for _, v := range *listTemp {
+			itype := ""
+			buyer_count, project_count, expect_amount, monitor_count := int64(0), int64(0), float64(0), int64(0)
+			company_id := ObjToString(v["company_id"])
+			export_id := []string{}
+			jump_type, jump_id := "", ""
+			switch Int64All(v["itype"]) {
+			case 1:
+				itype = "甲方"
+				jump_type = "firstparty"
+				for _, vv := range fpn[company_id] {
+					if jump_id != "" {
+						jump_id += ","
 					}
+					jump_id += vv.CompanyId
+				}
+				firstparty_count++
+				if firstparty_project[company_id] != nil {
+					buyer_count = firstparty_project[company_id].BuyerCount
+					project_count = firstparty_project[company_id].ProjectCount
+					expect_amount = firstparty_project[company_id].ProjectAmount
+					monitor_count = firstparty_project[company_id].MonitorCount
+					export_id = firstparty_project[company_id].ExportId
+				}
+			case 2:
+				itype = "供应商"
+				jump_type = "supplier"
+				jump_id = company_id
+				supplier_count++
+				if supplier_project[company_id] != nil {
+					buyer_count = supplier_project[company_id].BuyerCount
+					project_count = supplier_project[company_id].ProjectCount
+					expect_amount = supplier_project[company_id].ProjectAmount
+					monitor_count = supplier_project[company_id].MonitorCount
+					export_id = supplier_project[company_id].ExportId
+				}
+			case 3:
+				itype = "同甲异业渠道"
+				jump_type = "adiffb"
+				jump_id = company_id
+				adiffb_count++
+				if adiffb_project[company_id] != nil {
+					buyer_count = adiffb_project[company_id].BuyerCount
+					project_count = adiffb_project[company_id].ProjectCount
+					expect_amount = adiffb_project[company_id].ProjectAmount
+					monitor_count = adiffb_project[company_id].MonitorCount
+					export_id = adiffb_project[company_id].ExportId
+				}
+			case 4:
+				itype = "中间人"
+				jump_type = "middleman"
+				jump_id = company_id
+				middleman_count++
+				buyer_count = Int64All(v["buyer_count"])
+				project_count = Int64All(v["project_count"])
+				if relate_buyer_id := ObjToString(v["relate_buyer_id"]); relate_buyer_id != "" {
+					for _, v := range strings.Split(relate_buyer_id, ",") {
+						if v == "" {
+							continue
+						}
+						if entMonitor[v] {
+							monitor_count++
+						}
+					}
+				}
+				if relate_project_id := ObjToString(v["relate_project_id"]); relate_project_id != "" {
+					export_id = strings.Split(relate_project_id, ",")
+					for _, v := range export_id {
+						if middleman_project[v] != nil {
+							expect_amount += middleman_project[v].ProjectAmount
+						}
+					}
+				}
+				if middleman_project[company_id] != nil {
+					expect_amount = middleman_project[company_id].ProjectAmount
+				}
+			case 5:
+				itype = "招标代理机构"
+				jump_type = "agency"
+				jump_id = company_id
+				agency_count++
+				if agency_project[company_id] != nil {
+					buyer_count = agency_project[company_id].BuyerCount
+					project_count = agency_project[company_id].ProjectCount
+					expect_amount = agency_project[company_id].ProjectAmount
+					monitor_count = agency_project[company_id].MonitorCount
+					export_id = agency_project[company_id].ExportId
 				}
 			}
-			if middleman_project[company_id] != nil {
-				expect_amount = middleman_project[company_id].ProjectAmount
+			if buyer_count < in.Buyercount_start {
+				continue
+			} else if buyer_count > in.Buyercount_end {
+				continue
+			} else if in.Monitor == 1 && monitor_count <= 0 {
+				continue
+			} else if in.Monitor == -1 && monitor_count > 0 {
+				continue
+			} else if monitor_count < in.Monitorcount_start {
+				continue
+			} else if monitor_count > in.Monitorcount_end {
+				continue
+			} else if in.Project_matchme == 1 && project_count == 0 {
+				continue
 			}
-		case 5:
-			itype = "招标代理机构"
-			agency_count++
-			if agency_project[company_id] != nil {
-				buyer_count = agency_project[company_id].BuyerCount
-				project_count = agency_project[company_id].ProjectCount
-				expect_amount = agency_project[company_id].ProjectAmount
+			exportId := ""
+			if len(export_id) > 0 {
+				exportId = encrypt.SE.EncodeStringByCheck(strings.Join(export_id, ","))
 			}
+			company_name, _ := v["company_name"].(string)
+			list = append(list, &map[string]interface{}{
+				"company_id":    company_id,
+				"company_name":  company_name,
+				"type":          itype,
+				"jump_type":     jump_type,
+				"jump_id":       jump_id,
+				"person":        v["person"],
+				"phone":         v["phone"],
+				"buyer_count":   buyer_count,
+				"monitor_count": 0,
+				"expect_amount": RetainDecimal(expect_amount/10000, 2),
+				"project_count": project_count,
+				"create_time":   v["create_time"],
+				"export_id":     exportId,
+				"url":           "/swordfish/page_big_pc/unit_portrayal/" + company_name,
+			})
 		}
-		list = append(list, map[string]interface{}{
-			"company_id":    company_id,
-			"company_name":  v["company_name"],
-			"type":          itype,
-			"person":        v["person"],
-			"phone":         v["phone"],
-			"buyer_count":   buyer_count,
-			"monitor_count": 0,
-			"expect_amount": expect_amount,
-			"project_count": project_count,
-			"create_time":   v["create_time"],
-		})
 	}
-	length := int64(len(list))
-	var pageSize int64 = 10
+	csList := &ComSortList{
+		SortKeys: []*ComSortKey{
+			&ComSortKey{
+				Keys:  []string{"expect_amount"},
+				Order: 1,
+				Type:  "float",
+			},
+		},
+		List: list,
+	}
+	if in.Order_amount == -1 {
+		csList.SortKeys[0].Order = -1
+	}
+	if in.Order_amount != 0 {
+		sort.Sort(csList)
+	}
+	length := int64(len(csList.List))
+	var pageSize int64 = 100
 	total_page := int64(math.Ceil(float64(length) / float64(pageSize)))
-	finalList := []map[string]interface{}{}
+	finalList := []*map[string]interface{}{}
 	if length > 0 {
 		if in.Current_page <= 0 {
 			in.Current_page = 1
@@ -455,7 +542,7 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 		if end > length {
 			end = length
 		}
-		finalList = list[start:end]
+		finalList = csList.List[start:end]
 	}
 	return &types.Reply{
 		Data: map[string]interface{}{
@@ -471,15 +558,123 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 }
 
 //
-func (n *network) Introduce_Supplier(values []string) map[string]*projectInfo {
+func (n *network) FirstpartyNetwork(name string, values []string) map[string][]*firstpartyNetwork {
+	result := map[string][]*firstpartyNetwork{}
+	wh, args := NetworkCom.WhArgs(values)
+	q := `select DISTINCT a.a_id,a.b_id as company_id,a.b_name as company_name,b.name from information.ent_map_code a 
+				inner join information.ent_code b on (a.a_id in (` + wh + `) and b.pcode in ('0100','0200') and a.code=b.code)`
+	if name != "" {
+		q += ` where c.company_name like ?`
+		args = append(args, "%"+name+"%")
+	}
+	q += ` order by a.a_id,b.name,a.b_name`
+	rows, err := ClickhouseConn.Query(context.Background(), q, args...)
+	if err != nil {
+		logx.Error(err)
+		return result
+	}
+	for rows.Next() {
+		var (
+			a_id         string
+			company_id   string
+			company_name string
+			name         string
+		)
+		if err := rows.Scan(&a_id, &company_id, &company_name, &name); err != nil {
+			logx.Error(err)
+			continue
+		}
+		result[a_id] = append(result[a_id], &firstpartyNetwork{
+			CompanyId:   company_id,
+			CompanyName: company_name,
+			Name:        name,
+		})
+	}
+	return result
+}
+
+//
+func (n *network) Introduce_Firstparty(fpn map[string][]*firstpartyNetwork, entMonitor map[string]bool, matchme int64, probusfors []string) map[string]*projectInfo {
+	values := []string{}
+	vm := map[string]*projectInfo{}
+	for _, v := range fpn {
+		for _, vv := range v {
+			vm[vv.CompanyId] = &projectInfo{}
+			values = append(values, vv.CompanyId)
+		}
+	}
+	wh, args := NetworkCom.WhArgs(values)
+	q := `select buyer_id,count(project_id) AS project_count,sum(project_money) AS project_amount,groupUniqArray(project_id) from information.transaction_info where buyer_id in (` + wh + `)`
+	if matchme == 1 {
+		newWh, newArgs := NetworkCom.WhArgs(probusfors)
+		q += ` hasAny(property_form,[` + newWh + `])`
+		args = append(args, newArgs...)
+	}
+	q += ` group by buyer_id`
+	rows, err := ClickhouseConn.Query(context.Background(), q, args...)
+	if err != nil {
+		logx.Error(err)
+		return nil
+	}
+	for rows.Next() {
+		var (
+			buyer_id       string
+			project_count  uint64
+			project_amount decimal.Decimal
+			project_id     []string
+		)
+		if err := rows.Scan(&buyer_id, &project_count, &project_amount, &project_id); err != nil {
+			logx.Error(err)
+			continue
+		}
+		if vm[buyer_id] == nil {
+			continue
+		}
+		vm[buyer_id].ProjectCount += int64(project_count)
+		pf, _ := project_amount.Float64()
+		vm[buyer_id].ProjectAmount += pf
+		vm[buyer_id].ExportId = project_id
+	}
+	rows.Close()
+	if err := rows.Err(); err != nil {
+		logx.Error(err)
+	}
+	result := map[string]*projectInfo{}
+	for k, v := range fpn {
+		if result[k] == nil {
+			result[k] = &projectInfo{}
+		}
+		result[k].BuyerCount = int64(len(v))
+		for _, vv := range v {
+			if entMonitor[vv.CompanyName] {
+				result[k].MonitorCount++
+			}
+			if vm[vv.CompanyId] == nil {
+				continue
+			}
+			result[k].ProjectCount += vm[vv.CompanyId].ProjectCount
+			result[k].ProjectAmount += vm[vv.CompanyId].ProjectAmount
+		}
+	}
+	return result
+}
+
+//
+func (n *network) Introduce_Supplier(values []string, entMonitor map[string]bool, matchme int64, probusfors []string) map[string]*projectInfo {
 	vm := map[string]*projectInfo{}
 	for _, v := range values {
 		vm[v] = &projectInfo{}
 	}
-	wh, newArgs := NetworkCom.WhArgs(values)
-	rows, err := ClickhouseConn.Query(context.Background(), `select a.winner_id,count(a.buyer_id) AS buyer_count,count(b.project_id) AS project_count,sum(b.project_money) AS project_amount from information.transaction_info a 
-		inner join information.transaction_info b on (hasAny(a.winner_id,[`+wh+`]) and a.buyer_id=b.buyer_id)
-		group by a.winner_id`, newArgs...)
+	wh, args := NetworkCom.WhArgs(values)
+	q := `select a.winner_id,count(DISTINCT b.buyer_id) AS buyer_count,count(DISTINCT b.project_id) AS project_count,sum(b.project_money) AS project_amount,groupUniqArray(b.buyer),groupUniqArray(b.project_id) from information.transaction_info a 
+		inner join information.transaction_info b on (hasAny(a.winner_id,[` + wh + `]) and a.buyer_id<>'' and a.buyer_id=b.buyer_id`
+	if matchme == 1 {
+		newWh, newArgs := NetworkCom.WhArgs(probusfors)
+		q += ` hasAny(b.property_form,[` + newWh + `])`
+		args = append(args, newArgs...)
+	}
+	q += `) group by a.winner_id`
+	rows, err := ClickhouseConn.Query(context.Background(), q, args...)
 	if err != nil {
 		logx.Error(err)
 		return nil
@@ -489,9 +684,11 @@ func (n *network) Introduce_Supplier(values []string) map[string]*projectInfo {
 			winner_id      []string
 			buyer_count    uint64
 			project_count  uint64
-			project_amount float64
+			project_amount decimal.Decimal
+			buyers         []string
+			project_id     []string
 		)
-		if err := rows.Scan(&winner_id, &buyer_count, &project_count, &project_amount); err != nil {
+		if err := rows.Scan(&winner_id, &buyer_count, &project_count, &project_amount, &buyers, &project_id); err != nil {
 			logx.Error(err)
 			continue
 		}
@@ -499,9 +696,16 @@ func (n *network) Introduce_Supplier(values []string) map[string]*projectInfo {
 			if vm[v] == nil {
 				continue
 			}
-			vm[v].BuyerCount += int(buyer_count)
-			vm[v].ProjectCount += int(project_count)
-			vm[v].ProjectAmount += project_amount
+			vm[v].BuyerCount += int64(buyer_count)
+			vm[v].ProjectCount += int64(project_count)
+			pf, _ := project_amount.Float64()
+			vm[v].ProjectAmount += pf
+			vm[v].ExportId = project_id
+			for _, v := range buyers {
+				if entMonitor[v] {
+					vm[v].MonitorCount++
+				}
+			}
 		}
 	}
 	rows.Close()
@@ -512,15 +716,21 @@ func (n *network) Introduce_Supplier(values []string) map[string]*projectInfo {
 }
 
 //
-func (n *network) Introduce_Agency(values []string) map[string]*projectInfo {
+func (n *network) Introduce_Agency(values []string, entMonitor map[string]bool, matchme int64, probusfors []string) map[string]*projectInfo {
 	vm := map[string]*projectInfo{}
 	for _, v := range values {
 		vm[v] = &projectInfo{}
 	}
-	wh, newArgs := NetworkCom.WhArgs(values)
-	rows, err := ClickhouseConn.Query(context.Background(), `select a.agency_id,count(a.buyer_id) AS buyer_count,count(b.project_id) AS project_count,sum(b.project_money) AS project_amount from information.transaction_info a 
-		inner join information.transaction_info b on (agency_id in (`+wh+`) and a.buyer_id=b.buyer_id)
-		group by a.agency_id`, newArgs...)
+	wh, args := NetworkCom.WhArgs(values)
+	q := `select a.agency_id,count(DISTINCT b.buyer_id) AS buyer_count,count(DISTINCT b.project_id) AS project_count,sum(b.project_money) AS project_amount,groupUniqArray(b.buyer),groupUniqArray(b.project_id) from information.transaction_info a 
+		inner join information.transaction_info b on (a.agency_id in (` + wh + `) and a.buyer_id<>'' and a.buyer_id=b.buyer_id`
+	if matchme == 1 {
+		newWh, newArgs := NetworkCom.WhArgs(probusfors)
+		q += ` hasAny(b.property_form,[` + newWh + `])`
+		args = append(args, newArgs...)
+	}
+	q += `) group by a.agency_id`
+	rows, err := ClickhouseConn.Query(context.Background(), q, args...)
 	if err != nil {
 		logx.Error(err)
 		return nil
@@ -530,18 +740,27 @@ func (n *network) Introduce_Agency(values []string) map[string]*projectInfo {
 			agency_id      string
 			buyer_count    uint64
 			project_count  uint64
-			project_amount float64
+			project_amount decimal.Decimal
+			buyers         []string
+			project_id     []string
 		)
-		if err := rows.Scan(&agency_id, &buyer_count, &project_count, &project_amount); err != nil {
+		if err := rows.Scan(&agency_id, &buyer_count, &project_count, &project_amount, &buyers); err != nil {
 			logx.Error(err)
 			continue
 		}
 		if vm[agency_id] == nil {
 			continue
 		}
-		vm[agency_id].BuyerCount += int(buyer_count)
-		vm[agency_id].ProjectCount += int(project_count)
-		vm[agency_id].ProjectAmount += project_amount
+		vm[agency_id].BuyerCount += int64(buyer_count)
+		vm[agency_id].ProjectCount += int64(project_count)
+		pf, _ := project_amount.Float64()
+		vm[agency_id].ProjectAmount += pf
+		vm[agency_id].ExportId = project_id
+		for _, v := range buyers {
+			if entMonitor[v] {
+				vm[agency_id].MonitorCount++
+			}
+		}
 	}
 	rows.Close()
 	if err := rows.Err(); err != nil {
@@ -551,7 +770,7 @@ func (n *network) Introduce_Agency(values []string) map[string]*projectInfo {
 }
 
 //
-func (n *network) Introduce_Middleman(values []string) map[string]*projectInfo {
+func (n *network) Introduce_Middleman(values []string, entMonitor map[string]bool, matchme int64, probusfors []string) map[string]*projectInfo {
 	vm := map[string]*projectInfo{}
 	wh, newArgs := NetworkCom.WhArgs(values)
 	rows, err := ClickhouseConn.Query(context.Background(), `select project_id,project_money from information.transaction_info where project_id in (`+wh+`)`, newArgs...)
@@ -562,14 +781,15 @@ func (n *network) Introduce_Middleman(values []string) map[string]*projectInfo {
 	for rows.Next() {
 		var (
 			project_id    string
-			project_money float64
+			project_money decimal.Decimal
 		)
 		if err := rows.Scan(&project_id, &project_money); err != nil {
 			logx.Error(err)
 			continue
 		}
+		pf, _ := project_money.Float64()
 		vm[project_id] = &projectInfo{
-			ProjectAmount: project_money,
+			ProjectAmount: pf,
 		}
 	}
 	rows.Close()

+ 17 - 4
api/internal/service/network_test.go

@@ -84,17 +84,30 @@ func TestNetWorkList(t *testing.T) {
 	initDb()
 	//类型;firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
 	res := Network.List(&types.NetWorkListReq{
-		PositionId: 943,
+		PositionId:         943,
+		Order_amount:       1,
+		Monitorcount_start: 1,
+		Monitorcount_end:   1,
+		//Monitor:      0,
+		//Project_matchme: 1,
 	})
-	log.Println(res.Data.(map[string]interface{})["total_page"])
-	for _, v := range res.Data.(map[string]interface{})["list"].([]map[string]interface{}) {
+	for k, v := range res.Data.(map[string]interface{}) {
+		if k == "list" {
+			continue
+		}
+		log.Println(k, v)
+	}
+	for _, v := range res.Data.(map[string]interface{})["list"].([]*map[string]interface{}) {
 		log.Println(v)
 	}
 }
 func TestAllProject(t *testing.T) {
 	initDb()
 	res := Network.AllProject(&types.AllprojectReq{
-		PositionId: 943,
+		EntAccountId: 64,
+		PositionId:   943,
+		//Id:           "wcj_11111111a",
+		//Type:         1,
 	})
 	b, _ := json.Marshal(res.Data)
 	log.Println(string(b))

+ 935 - 0
api/internal/service/owner.go

@@ -0,0 +1,935 @@
+package service
+
+import (
+	"app.yhyue.com/moapp/jybase/encrypt"
+	"context"
+	"encoding/json"
+	"fmt"
+	"sort"
+	"strings"
+
+	"app.yhyue.com/moapp/jybase/common"
+	elastic "app.yhyue.com/moapp/jybase/es"
+	. "bp.jydev.jianyu360.cn/CRM/application/api/common"
+	"bp.jydev.jianyu360.cn/CRM/application/entity"
+	"github.com/gogf/gf/v2/util/gconv"
+	"github.com/shopspring/decimal"
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+const (
+	EntINDEX = "ent_info"
+	EntTYPE  = "ent_info"
+)
+
+type OwnerService struct {
+	PartyA           string
+	Supplier         string
+	Heterotophy      string
+	Intermediary     string
+	Agency           string
+	SearchEntName    string
+	SourceType       string
+	ProcessingStatus string
+	Area             string
+	PositionId       int64
+	PageIndex        int64
+	PageSize         int64
+	BuyerId          string
+	BuyerName        string
+	WinnerId         string
+	WinnerName       string
+	CooperateType    string
+	EntAccountId     int64
+}
+
+type BuyerProject struct {
+	BuyerId          string
+	BuyerName        string
+	Project          ProjectEntity
+	IsMonitor        bool
+	IsCreateCustomer bool
+	IsIgnore         bool
+	Area             string
+	Zbtime           int64
+}
+type ProjectEntity struct {
+	Number          int64
+	zbtime          int64
+	EstimatedAmount int64
+	Connections     []map[string]interface{}
+}
+type Recommend struct {
+	buyerId string `ch:"buyer_id"`
+	buyer   string `ch:"buyer"`
+}
+type Project struct {
+	BuyerId    string          `ch:"buyer_id"`
+	Area       string          `ch:"area"`
+	GroupCount uint64          `ch:"group_count"`
+	Zbtime     int64           `ch:"zbtime"`
+	Money      decimal.Decimal `ch:"money"`
+}
+
+func (t *OwnerService) OwnerlList() map[string]interface{} {
+	//先查询采购单位列表
+	dataMap := &map[string]map[string]interface{}{}
+	projectMap := &map[string]map[string]interface{}{}
+	if t.PartyA != "" || t.Supplier != "" || t.Heterotophy != "" || t.Intermediary != "" || t.Agency != "" {
+		dataMap = BuyerList(t.PartyA, t.Supplier, t.Heterotophy, t.Intermediary, t.Agency)
+		//处理状态初始化
+		if t.ProcessingStatus != "" {
+			ProcessingStatusInit(t.PositionId, dataMap, t.ProcessingStatus)
+		}
+		//监控状态处理
+		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.Area)
+		logx.Info(projectMap)
+	} else if t.SearchEntName != "" {
+		//1 只看转介绍成功率高2只看已监控的
+		if t.SourceType == "2" {
+			buyerArr := FindMonitor(t.PositionId, t.SearchEntName)
+			if len(buyerArr) > 0 {
+				projectMap = ProjectHandle(buyerArr, "", t.Area)
+			}
+		} else {
+			projectMap = ProjectHandle([]string{}, t.SearchEntName, t.Area)
+		}
+		dataMap = FindBuyer(t.SearchEntName)
+	}
+	if len(*dataMap) == 0 {
+		return map[string]interface{}{}
+	}
+	//采购单位和项目合并
+	returnData, connectionsNumber, highSuccessNumber, monitorNumber := BuyerProjectMerge(dataMap, projectMap, t.SourceType)
+	//数组排序
+	//分页数据处理
+	if t.PageSize == 0 {
+		t.PageSize = 10
+	}
+	if t.PageIndex == 0 {
+		t.PageIndex = 1
+	}
+	startIndex := (t.PageIndex - 1) * t.PageSize
+	endIndex := t.PageIndex * t.PageSize
+	sort.Slice(returnData, func(i, j int) bool {
+		return returnData[i].Zbtime < returnData[j].Zbtime
+	})
+	if startIndex < gconv.Int64(len(returnData)) {
+		if endIndex > gconv.Int64(len(returnData)) {
+			endIndex = gconv.Int64(len(returnData))
+		}
+		returnData = returnData[startIndex:endIndex]
+	} else {
+		return map[string]interface{}{}
+	}
+	buyerIdArr := []string{}
+	for _, value := range returnData {
+		buyerIdArr = append(buyerIdArr, fmt.Sprintf("'%s'", value.BuyerId))
+	}
+	//可介绍业主人脉处理
+	companyList := ConnectionsHandle(buyerIdArr, t.PositionId, false)
+	for _, v := range companyList {
+		buyerId := gconv.String(v["a_id"])
+		for i, v1 := range returnData {
+			aBuyerId := v1.BuyerId
+			if buyerId == aBuyerId {
+				//组装数据
+				returnData[i].Project.Connections = append(returnData[i].Project.Connections, v)
+			}
+		}
+	}
+	//返回数据组装
+	return map[string]interface{}{
+		"connectionsNumber": connectionsNumber,
+		"highSuccessNumber": highSuccessNumber,
+		"monitorNumber":     monitorNumber,
+		"list":              returnData,
+	}
+}
+
+// 可介绍业主人脉列表
+func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[string]interface{} {
+	returnData := []map[string]interface{}{}
+	//中间人  作为可介绍业主    企业名称
+	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, ",")))
+	for _, v := range *companyArr {
+		companyId := gconv.String(v["company_id"])
+		companyName := gconv.String(v["company_name"])
+		relateName := gconv.String(v["relate_name"])
+		relateId := gconv.String(v["relate_id"])
+		//key := fmt.Sprintf("%s_%s", relateId, companyId)
+		returnData = append(returnData, map[string]interface{}{
+			"b_id":         companyId,
+			"b_name":       companyName,
+			"a_name":       relateName,
+			"a_id":         relateId,
+			"sourceType":   "middleman",
+			"relationship": "业主的关系人",
+			"personName":   gconv.String(v["contact_person"]),
+		})
+	}
+	if isAll && len(returnData) > 0 {
+		return returnData
+	}
+	//采购单位 投资关系  管辖关系
+	//buyerSql := fmt.Sprintf("select  a_id,b_id,a_name,b_name,code  from  ent_map_code a  where ( a_name  in  (%s) or b_name  in  (%s)  ) and   code in('0101','0201')", strings.Join(buyerArr, ","), strings.Join(buyerArr, ","))
+	buyerSql := fmt.Sprintf(`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  ent_map_code   a   
+	left join  ent_info  c on  (a.a_id  in  (%s) or a.b_id  in  (%s)  ) and  a.code in('0101','0201')   and  a.a_id =c.id  
+	left join  ent_info  d on  (a.a_id  in  (%s) or a.b_id  in  (%s) ) and   a.code in('0101','0201')  and a.b_id =d.id  
+	where (a.a_id  in  (%s) or a.b_id  in  (%s)  ) and   a.code in('0101','0201')`,
+		strings.Join(buyerArr, ","),
+		strings.Join(buyerArr, ","),
+		strings.Join(buyerArr, ","),
+		strings.Join(buyerArr, ","),
+		strings.Join(buyerArr, ","),
+		strings.Join(buyerArr, ","))
+	relationshipArr := BuyerFindConnectionsHandle(buyerSql)
+	if relationshipArr != nil && len(relationshipArr) > 0 {
+		for _, v := range relationshipArr {
+			for _, v1 := range buyerArr {
+				code := v.Code
+				if fmt.Sprintf("'%s'", v.Aid) == v1 {
+					//key := fmt.Sprintf("%s_%s", a_id, b_id)
+					switch code {
+					case "0101": //管辖关系
+						returnData = append(returnData, map[string]interface{}{
+							"b_id":         v.Bid,
+							"b_name":       v.Bname,
+							"a_name":       v.Aname,
+							"a_id":         v.Aid,
+							"sourceType":   "firstparty",
+							"relationship": "业主的上级机构",
+							"personName":   v.Dperson,
+						})
+
+					case "0201": //投资关系
+						returnData = append(returnData, map[string]interface{}{
+							"b_id":         v.Bid,
+							"b_name":       v.Bname,
+							"a_name":       v.Aname,
+							"a_id":         v.Aid,
+							"sourceType":   "firstparty",
+							"relationship": "业主的股东",
+							"personName":   v.Dperson,
+						})
+					}
+				}
+				if fmt.Sprintf("'%s'", v.Bid) == v1 {
+					//key := fmt.Sprintf("%s_%s", b_id, a_id)
+					if code == "0101" {
+						//"0101":管辖关系
+						returnData = append(returnData, map[string]interface{}{
+							"b_id":         v.Aid,
+							"b_name":       v.Aname,
+							"a_name":       v.Bname,
+							"a_id":         v.Bid,
+							"sourceType":   "firstparty",
+							"relationship": "业主的下级机构",
+							"personName":   v.Cperson,
+						})
+					}
+				}
+			}
+		}
+	}
+	//供应商  采购单位 供应商     招标代理机构  采购单位  招标代理机构  需要计算合作次数
+	winnerSql := fmt.Sprintf(`SELECT DISTINCT a.project_name as  project_name,a.project_id as project_id , a.zbtime as zbtime ,a.buyer_id as buyer_id,a.buyer as  buyer,a.agency_id as agency_id,a.agency as  agency,c.company_name as company_name ,b.name as personName ,a.winnerId  as awinnerId
+	FROM 
+	   (select zbtime,project_id,project_name,project_id,buyer_id,buyer,agency_id,agency,winner_id as winnerId   from  transaction_info     
+	ARRAY JOIN  winner_id ) a 
+	inner join ent_contact  b   on a.buyer_id in (%s) and  a.winnerId=b.id 
+	inner join ent_info  c   on a.winnerId=c.id order by a.zbtime,a.winnerId`, strings.Join(buyerArr, ","))
+	winnerArr := SupplierFindConnectionsHandle(winnerSql)
+	if winnerArr != nil && len(winnerArr) > 0 {
+		winnerMap := map[string]map[string]interface{}{}
+		agencyMap := map[string]map[string]interface{}{}
+		for _, m := range winnerArr {
+			buyerId := m.Buyer_id
+			winner := m.Company_name
+			buyer := m.Buyer
+			winnerId := m.AwinnerId
+			agency := m.Agency
+			agencyId := m.Agency_id
+			projectId := encrypt.EncodeArticleId2ByCheck(m.Project_id)
+			projectName := m.Project_name
+			zbtime := m.Zbtime
+			personName := m.PersonName
+			key := fmt.Sprintf("%s_%s", buyerId, winnerId)
+			returnData = append(returnData, map[string]interface{}{
+				"b_id":       winnerId,
+				"b_name":     winner,
+				"a_name":     buyer,
+				"a_id":       buyerId,
+				"sourceType": "supplier",
+				"personName": personName,
+			})
+			if _, ok := winnerMap[key]; ok {
+				data := winnerMap[key]
+				data["count"] = gconv.Int64(data["data"]) + 1
+				dataList := gconv.Maps(data["list"])
+				dataList = append(dataList, map[string]interface{}{
+					"zbtime":      zbtime,
+					"entName":     winner,
+					"projectId":   projectId,
+					"projectName": projectName,
+				})
+				data["list"] = dataList
+				winnerMap[key] = data
+			} else {
+				winnerMap[key] = map[string]interface{}{
+					"b_id":       winnerId,
+					"b_name":     winner,
+					"a_name":     buyer,
+					"a_id":       buyerId,
+					"sourceType": "supplier",
+					"personName": personName,
+					"count":      1,
+					"list": []map[string]interface{}{
+						{
+							"zbtime":      zbtime,
+							"entName":     winner,
+							"projectId":   projectId,
+							"projectName": projectName,
+						},
+					},
+				}
+			}
+			key = fmt.Sprintf("%s_%s_%s", buyerId, agencyId, projectId)
+			if _, ok := agencyMap[key]; ok {
+				data := agencyMap[key]
+				data["count"] = gconv.Int64(data["data"]) + 1
+				dataList := gconv.Maps(data["list"])
+				dataList = append(dataList, map[string]interface{}{
+					"zbtime":      zbtime,
+					"entName":     winner,
+					"projectId":   projectId,
+					"projectName": projectName,
+				})
+				data["list"] = dataList
+				agencyMap[key] = data
+			} else {
+				agencyMap[key] = map[string]interface{}{
+					"b_id":       agencyId,
+					"b_name":     agency,
+					"a_name":     buyer,
+					"a_id":       buyerId,
+					"sourceType": "agency",
+					"count":      1,
+					"personName": personName,
+					"list": []map[string]interface{}{
+						{
+							"zbtime":      zbtime,
+							"entName":     agency,
+							"projectId":   projectId,
+							"projectName": projectName,
+						},
+					},
+				}
+			}
+		}
+		for _, m := range winnerMap {
+			returnData = append(returnData, map[string]interface{}{
+				"b_id":         gconv.String(m["b_id"]),
+				"b_name":       gconv.String(m["b_name"]),
+				"a_name":       gconv.String(m["a_name"]),
+				"a_id":         gconv.String(m["a_id"]),
+				"sourceType":   gconv.String(m["sourceType"]),
+				"relationship": gconv.String(m["relationship"]),
+				"count":        gconv.Int64(m["count"]),
+				"list":         m["list"],
+			})
+		}
+		for _, m := range agencyMap {
+			returnData = append(returnData, map[string]interface{}{
+				"b_id":         gconv.String(m["b_id"]),
+				"b_name":       gconv.String(m["b_name"]),
+				"a_name":       gconv.String(m["a_name"]),
+				"a_id":         gconv.String(m["a_id"]),
+				"sourceType":   gconv.String(m["sourceType"]),
+				"relationship": gconv.String(m["relationship"]),
+				"count":        gconv.Int64(m["count"]),
+				"list":         m["list"],
+			})
+		}
+	}
+	return returnData
+}
+
+// 采购单位和项目合并
+func BuyerProjectMerge(dataMap, projectMap *map[string]map[string]interface{}, sourceType string) ([]BuyerProject, int64, int64, int64) {
+	returnData := []BuyerProject{}
+	connectionsNumber := int64(0)
+	highSuccessNumber := int64(0)
+	monitorNumber := int64(0)
+	for buyerId, buyerMap := range *dataMap {
+		buyerName := gconv.String(buyerMap["buyerName"])
+		if _, ok := (*projectMap)[buyerId]; ok {
+			projectMap := (*projectMap)[buyerId]
+			if isMonitor := gconv.Bool(buyerMap["isMonitor"]); isMonitor {
+				monitorNumber++
+			}
+			count := gconv.Int64(projectMap["count"])
+			money := gconv.Int64(projectMap["money"])
+			zbtime := gconv.Int64(projectMap["zbtime"])
+			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,
+				})
+			} 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,
+				})
+			}
+		} else {
+			returnData = append(returnData, BuyerProject{
+				BuyerId:   buyerId,
+				BuyerName: buyerName,
+				Project: ProjectEntity{
+					Number:          0,
+					EstimatedAmount: 0,
+					Connections:     []map[string]interface{}{},
+				},
+				Area:   "",
+				Zbtime: 0,
+			})
+		}
+		connectionsNumber++
+	}
+	return returnData, connectionsNumber, highSuccessNumber, monitorNumber
+}
+
+// 已监控数据处理
+func MonitorStatusInit(positionId int64, dataMap *map[string]map[string]interface{}, sourceType string) {
+	monitorMap := map[string]bool{}
+	query := map[string]interface{}{
+		"userId": positionId,
+	}
+	clist, ok := Mgo.Find("follow_customer", query, ``, `{"name":1}`, false, -1, -1)
+	if ok && clist != nil && len(*clist) > 0 {
+		for _, v := range *clist {
+			monitorMap[gconv.String(v["name"])] = true
+		}
+
+	}
+	//采购单位和自己监控的对比
+	newMap := &map[string]map[string]interface{}{}
+	for k, v := range *dataMap {
+		buyerName := gconv.String(v["buyerName"])
+		if _, ok1 := monitorMap[gconv.String(buyerName)]; ok1 {
+			v["isMonitor"] = true
+			(*newMap)[k] = v
+		} else {
+			if sourceType != "2" && sourceType != "1" {
+				v["isMonitor"] = false
+				(*newMap)[k] = v
+			}
+		}
+	}
+	if newMap != nil {
+		dataMap = newMap
+	}
+}
+
+// 监控数据查询初始化
+func FindMonitor(positionId int64, entName string) []string {
+	nameArr := []string{}
+	clist, ok := Mgo.Find("", map[string]interface{}{
+		"userId": positionId,
+		"name":   fmt.Sprintf(" /.*%s.*/i", entName),
+	}, "", `{"name":1}`, false, -1, -1)
+	if ok && clist != nil && len(*clist) > 0 {
+		for _, v := range *clist {
+			nameArr = append(nameArr, fmt.Sprintf(`"%s"`, gconv.String(v["name"])))
+		}
+
+	}
+	return nameArr
+}
+
+// 处理状态初始化
+func ProcessingStatusInit(positionId int64, dataMap *map[string]map[string]interface{}, processingStatus string) {
+	//未处理
+	untreatedMap := &map[string]bool{}
+	//已忽略
+	ignoredMap := &map[string]bool{}
+	//已创建
+	createdMap := &map[string]bool{}
+	processingArr := CrmMysql.Find(entity.CONNECTION_STATUS, map[string]interface{}{
+		"type":        1,
+		"position id": positionId,
+	}, "relate_id,is_handle,is_ignore,is_create", "", -1, -1)
+	if len(*processingArr) > 0 {
+		for _, v := range *processingArr {
+			entId := gconv.String(v["relate_id"])
+			handle := gconv.Int64(v["is_handle"])
+			ignore := gconv.Int64(v["is_ignore"])
+			create := gconv.Int64(v["is_create"])
+			if handle == 1 {
+				(*untreatedMap)[entId] = true
+			}
+			if ignore == 1 {
+				(*ignoredMap)[entId] = true
+			}
+			if create == 1 {
+				(*createdMap)[entId] = true
+			}
+		}
+	}
+	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 {
+					(*newMap)[buyerId] = value
+				}
+			case "2":
+				if _, ok := (*ignoredMap)[buyerId]; ok {
+					(*newMap)[buyerId] = value
+				}
+			case "3":
+				if _, ok := (*createdMap)[buyerId]; ok {
+					(*newMap)[buyerId] = value
+				}
+			}
+		}
+	}
+	if newMap != nil {
+		dataMap = newMap
+	}
+}
+
+// 采购单位查询
+func BuyerList(partyA, supplier, heterotophy, intermediary, agency string) *map[string]map[string]interface{} {
+	dataMap := &map[string]map[string]interface{}{}
+	//甲方
+	if partyA != "" {
+		for _, v := range strings.Split(partyA, ",") {
+			intermediaryArr := strings.Split(v, "_")
+			if len(intermediaryArr) == 2 {
+				(*dataMap)[intermediaryArr[0]] = map[string]interface{}{
+					"buyerName": intermediaryArr[1],
+				}
+			}
+		}
+	}
+	//供应商 //同甲异业
+	if supplier != "" || heterotophy != "" {
+		findInSetArr := []string{}
+		for _, v := range strings.Split(supplier, ",") {
+			findInSetArr = append(findInSetArr, fmt.Sprintf("'%s'", v))
+		}
+		for _, v := range strings.Split(heterotophy, ",") {
+			findInSetArr = append(findInSetArr, fmt.Sprintf("'%s'", v))
+		}
+		sqlStr := fmt.Sprintf(`SELECT buyer, buyer_id FROM transaction_info where  hasAny(winner_id,[%s])    `, strings.Join(findInSetArr, ","))
+		FindHandle(sqlStr, dataMap)
+	}
+	//中间人
+	if intermediary != "" {
+		for _, v := range strings.Split(intermediary, ",") {
+			intermediaryArr := strings.Split(v, "_")
+			if len(intermediaryArr) == 2 {
+				(*dataMap)[intermediaryArr[0]] = map[string]interface{}{
+					"buyerName": intermediaryArr[1],
+				}
+			}
+		}
+	}
+	//招标代理
+	if agency != "" {
+		agencyArr := []string{}
+		for _, s := range strings.Split(agency, ",") {
+			agencyArr = append(agencyArr, fmt.Sprintf("'%s'", s))
+		}
+		sqlStr := fmt.Sprintf(`SELECT buyer, buyer_id FROM transaction_info  where agency_id in (%s)   order by  userid`, strings.Join(agencyArr, ","))
+		FindHandle(sqlStr, dataMap)
+	}
+	return dataMap
+}
+
+// 项目数量查询
+func ProjectHandle(buyerArr []string, entName, area string) *map[string]map[string]interface{} {
+	projectMap := &map[string]map[string]interface{}{}
+	sql := ""
+	sqlStr := ""
+	if entName != "" {
+		sql = `{"query":{"bool":{"must":[{"terms":{"buyer":[%s]%s}}]}},"aggs":{"buyer_count":{"terms":{"field":"buyer","size":1000,"order":{"_count":"desc"}},"aggs":{"project_count":{"terms":{"field":"winner"}}}},"area_count":{"terms":{"field":"buyer","size":1000,"order":{"_count":"desc"}},"aggs":{"area_count":{"terms":{"field":"area"}}}},"money_count":{"terms":{"field":"buyer","size":1000,"order":{"_count":"desc"}},"aggs":{"money_count":{"sum":{"field":"bidendtime"}}}},"zbtime_count":{"terms":{"field":"buyer","size":1000,"order":{"_count":"desc"}},"aggs":{"zbtime_count":{"max":{"field":"bidendtime"}}}}},"size":%d}`
+		sqlStr = fmt.Sprintf(sql, strings.Join(buyerArr, ","), common.If(area != "", fmt.Sprintf(`,{"term":{"area":"%s"}}`, area), ""), len(buyerArr))
+
+	} else {
+		sql = `{"query":{"bool":{"must":[{"terms":{"buyer":[%s]%s}}]}},"aggs":{"buyer_count":{"terms":{"field":"buyer","size":1000,"order":{"_count":"desc"}},"aggs":{"project_count":{"terms":{"field":"winner"}}}},"area_count":{"terms":{"field":"buyer","size":1000,"order":{"_count":"desc"}},"aggs":{"area_count":{"terms":{"field":"area"}}}},"money_count":{"terms":{"field":"buyer","size":1000,"order":{"_count":"desc"}},"aggs":{"money_count":{"sum":{"field":"bidendtime"}}}},"zbtime_count":{"terms":{"field":"buyer","size":1000,"order":{"_count":"desc"}},"aggs":{"zbtime_count":{"max":{"field":"bidendtime"}}}}},"size":%d}`
+		sqlStr = fmt.Sprintf(sql, strings.Join(buyerArr, ","), common.If(area != "", fmt.Sprintf(`,{"term":{"area":"%s"}}`, area), ""), len(buyerArr))
+
+	}
+	data, _, _ := elastic.GetAggs(INDEX, TYPE, sqlStr)
+	for name, object := range data {
+		switch name {
+		case "buyer_count":
+			buyerArr := BuyerAggStruct{}
+			bs, ok := object.MarshalJSON()
+			if ok != nil {
+				logx.Error("解析项目数据失败", object)
+				continue
+			}
+			json.Unmarshal(bs, &buyerArr)
+			for _, v := range buyerArr.Buckets {
+				key := v.Key
+				if (*projectMap)[key] != nil {
+					value := (*projectMap)[key]
+					value["count"] = v.Doc_count
+					(*projectMap)[key] = value
+				} else {
+					(*projectMap)[key] = map[string]interface{}{
+						"count": v.Doc_count,
+					}
+				}
+			}
+		case "area_count":
+			areaArr := AreaAggStruct{}
+			bs, ok := object.MarshalJSON()
+			if ok != nil {
+				logx.Error("解析项目数据失败", object)
+				continue
+			}
+			json.Unmarshal(bs, &areaArr)
+			logx.Info(areaArr)
+			for _, v := range areaArr.Buckets {
+				key := v.Key
+				area := ""
+				for _, v1 := range v.Area_count.Buckets {
+					area = Deduplication(area, v1.Key)
+				}
+				if (*projectMap)[key] != nil {
+					value := (*projectMap)[key]
+					value["area"] = area
+					(*projectMap)[key] = value
+				} else {
+
+					(*projectMap)[key] = map[string]interface{}{
+						"area": area,
+					}
+				}
+			}
+		case "money_count":
+			moneyArr := MoneyAggStruct{}
+			bs, ok := object.MarshalJSON()
+			if ok != nil {
+				logx.Error("解析项目数据失败", object)
+				continue
+			}
+			json.Unmarshal(bs, &moneyArr)
+			logx.Info(moneyArr)
+			for _, v := range moneyArr.Buckets {
+				key := v.Key
+				if (*projectMap)[key] != nil {
+					value := (*projectMap)[key]
+					value["money"] = v.Money_count.Value
+					(*projectMap)[key] = value
+				} else {
+					(*projectMap)[key] = map[string]interface{}{
+						"money": v.Money_count.Value,
+					}
+				}
+			}
+		case "zbtime_count":
+			timeArr := TimeAggStruct{}
+			bs, ok := object.MarshalJSON()
+			if ok != nil {
+				logx.Error("解析项目数据失败", object)
+				continue
+			}
+			a := json.Unmarshal(bs, &timeArr)
+			logx.Info(timeArr, a)
+			for _, v := range timeArr.Buckets {
+				key := v.Key
+				if (*projectMap)[key] != nil {
+					value := (*projectMap)[key]
+					value["zbtime"] = v.Zbtime_count.Value
+					(*projectMap)[key] = value
+				} else {
+					(*projectMap)[key] = map[string]interface{}{
+						"zbtime": v.Zbtime_count.Value,
+					}
+				}
+			}
+		}
+	}
+	return projectMap
+}
+
+type TimeAggStruct struct {
+	Buckets []struct {
+		Key          string `json:"key,omitempty"`
+		Zbtime_count struct {
+			Value interface{} `json:"value,omitempty"`
+		} `json:"zbtime_count,omitempty"`
+	}
+}
+type MoneyAggStruct struct {
+	Buckets []struct {
+		Key         string `json:"key,omitempty"`
+		Money_count struct {
+			Value interface{} `json:"value,omitempty"`
+		} `json:"money_count,omitempty"`
+	}
+}
+type BuyerAggStruct struct {
+	Buckets []struct {
+		Key         string `json:"key,omitempty"`
+		Doc_count   int64  `json:"doc_count,omitempty"`
+		Buyer_count struct {
+			value string `json:"value,omitempty"`
+		} `json:"buyer_count,omitempty"`
+	}
+}
+type AreaAggStruct struct {
+	Buckets []struct {
+		Key        string `json:"key,omitempty"`
+		Area_count struct {
+			Buckets []struct {
+				Key       string `json:"key,omitempty"`
+				Doc_count int64  `json:"doc_count,omitempty"`
+			}
+		} `json:"area_count"`
+	}
+}
+
+// 采购单位查询sql
+func FindHandle(sqlStr string, dataMap *map[string]map[string]interface{}) {
+	rows, err := ClickhouseConn.Query(context.Background(), sqlStr)
+	if err != nil {
+		logx.Error("查询失败", sqlStr, err)
+	}
+	for rows.Next() {
+		data := Recommend{}
+		rows.ScanStruct(&data)
+		(*dataMap)[data.buyerId] = map[string]interface{}{
+			"buyerName": data.buyer,
+		}
+	}
+	return
+}
+
+type ConnectionsEntity struct {
+	Aid     string `ch:"a_id"`
+	Bid     string `ch:"b_id"`
+	Aname   string `ch:"a_name"`
+	Bname   string `ch:"b_name"`
+	Code    string `ch:"code"`
+	Cperson string `ch:"c_person"`
+	Dperson string `ch:"d_person"`
+}
+type SupplierConnectionsEntity struct {
+	Project_name string `ch:"project_name"`
+	Project_id   string `ch:"project_id"`
+	Zbtime       int64  `ch:"zbtime"`
+	Buyer_id     string `ch:"buyer_id"`
+	Buyer        string `ch:"buyer"`
+	Agency_id    string `ch:"agency_id"`
+	Agency       string `ch:"agency"`
+	Company_name string `ch:"company_name"`
+	PersonName   string `ch:"personName"`
+	AwinnerId    string `ch:"awinnerId"`
+}
+type TimeConnectionsEntity struct {
+	Zbtime       int64  `ch:"zbtime"`
+	Project_id   string `ch:"project_id"`
+	Project_name string `ch:"project_name"`
+}
+
+// 采购单位人脉信息查询sql
+func BuyerFindConnectionsHandle(sqlStr string) []ConnectionsEntity {
+	returnData := []ConnectionsEntity{}
+	rows, err := ClickhouseConn.Query(context.Background(), sqlStr)
+	if err != nil {
+		logx.Error("查询失败", sqlStr, err)
+	}
+	for rows.Next() {
+		data := ConnectionsEntity{}
+		rows.ScanStruct(&data)
+		returnData = append(returnData, data)
+	}
+	return returnData
+}
+
+// 供应商
+func SupplierFindConnectionsHandle(sqlStr string) []SupplierConnectionsEntity {
+	returnData := []SupplierConnectionsEntity{}
+	rows, err := ClickhouseConn.Query(context.Background(), sqlStr)
+	if err != nil {
+		logx.Error("查询失败", sqlStr, err)
+	}
+	for rows.Next() {
+		data := SupplierConnectionsEntity{}
+		err = rows.ScanStruct(&data)
+		logx.Info(err)
+		returnData = append(returnData, data)
+	}
+	return returnData
+}
+
+// 合作时间查询
+func TimeFindConnectionsHandle(sqlStr string) []TimeConnectionsEntity {
+	returnData := []TimeConnectionsEntity{}
+	rows, err := ClickhouseConn.Query(context.Background(), sqlStr)
+	if err != nil {
+		logx.Error("查询失败", sqlStr, err)
+	}
+	for rows.Next() {
+		data := TimeConnectionsEntity{}
+		rows.ScanStruct(&data)
+		returnData = append(returnData, data)
+	}
+	return returnData
+}
+
+// 去重处理
+func Deduplication(a, b string) string {
+	newArr := []string{}
+	if b == "全国" {
+		return a
+	}
+	if a != "" {
+		newArr = append(newArr, a)
+	}
+	if b != "" {
+		newArr = append(newArr, b)
+	}
+	return strings.Join(newArr, ",")
+}
+func FindBuyer(searchName string) *map[string]map[string]interface{} {
+	sql := `{"query":{"bool":{"must":[{"match":{"company_name":"%s"}}]}},"sort":[{"_id":"asc"}],"_source":["id","company_name"],"from":0,"size":10}`
+	sqlStr := fmt.Sprintf(sql, searchName)
+	data := elastic.Get(EntINDEX, EntTYPE, sqlStr)
+	dataMap := &map[string]map[string]interface{}{}
+	for _, m := range *data {
+		id := gconv.String(m["id"])
+		name := gconv.String(m["company_name"])
+		(*dataMap)[id] = map[string]interface{}{
+			"buyerName": name,
+		}
+	}
+	return dataMap
+}
+
+// 路径列表
+func (t *OwnerService) OwnerRoute() []map[string]interface{} {
+	companyList := ConnectionsHandle([]string{
+		fmt.Sprintf("'%s'", t.BuyerId),
+	}, t.PositionId, false)
+	return companyList
+}
+
+// 合作列表
+func (t *OwnerService) OwnerCooperate() []map[string]interface{} {
+	returData := []map[string]interface{}{}
+	dataArr := []TimeConnectionsEntity{}
+	if t.CooperateType == "supplier" {
+		//供应商
+		supplierSql := fmt.Sprintf(`SELECT DISTINCT  a.zbtime as zbtime,a.project_id as project_id,a.project_name as project_name 
+	FROM 
+	   (select zbtime,project_id,project_name,winner_id as winnerId   from  transaction_info     
+	ARRAY JOIN  winner_id ) a 
+	inner join ent_contact  b   on a.buyer_id = '%s' and a.winnerId='%s' and  a.winnerId=b.id
+	inner join ent_info  c   on a.winnerId=c.id order by a.zbtime,a.winnerId`, t.BuyerId, t.WinnerId)
+		dataArr = TimeFindConnectionsHandle(supplierSql)
+	} else if t.CooperateType == "agency" {
+		//代理机构
+		agentSql := fmt.Sprintf(`select  zbtime,project_id,project_name  from   transaction_info  where  buyer_id ='%s' and  agency_id ='%s' order by zbtime,winner_id `, t.BuyerId, t.WinnerId)
+		dataArr = TimeFindConnectionsHandle(agentSql)
+	}
+	if dataArr != nil && len(dataArr) > 0 {
+		for _, m := range dataArr {
+			zbtime := m.Zbtime
+			returData = append(returData, map[string]interface{}{
+				"zbtime":       zbtime,
+				"entName":      t.WinnerName,
+				"project_id":   encrypt.EncodeArticleId2ByCheck(m.Project_id),
+				"project_name": m.Project_name,
+			})
+		}
+	}
+	return returData
+}
+func (t *OwnerService) CandidateChannel() []*ResultData {
+	returnData := []*ResultData{}
+	dataMap := &map[string]map[string]interface{}{}
+	if t.PartyA != "" || t.Supplier != "" || t.Heterotophy != "" || t.Intermediary != "" || t.Agency != "" {
+		dataMap = BuyerList(t.PartyA, t.Supplier, t.Heterotophy, t.Intermediary, t.Agency)
+	}
+	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"])
+		}
+		for buyerId := range *dataMap {
+			logx.Info(buyerId)
+			r1, r2 := GetData(propertyForm, buyerId)
+			if r1 != nil && len(r1) > 0 {
+				tmp := &ResultData{
+					channelType: 1,
+					channel:     "同甲异业渠道",
+					size:        len(r1),
+					data:        r1,
+				}
+				returnData = append(returnData, tmp)
+			}
+			if r2 != nil && len(r2) > 0 {
+				tmp := &ResultData{
+					channelType: 1,
+					channel:     "招标代理机构",
+					size:        len(r2),
+					data:        r2,
+				}
+				returnData = append(returnData, tmp)
+			}
+			r3 := GetData1(t.PositionId, buyerId)
+			if r3 != nil && len(r3) > 0 {
+				tmp := &ResultData{
+					channelType: 1,
+					channel:     "中间人",
+					size:        len(r3),
+					data:        r3,
+				}
+				returnData = append(returnData, tmp)
+			}
+			GetData2(buyerId)
+		}
+
+	}
+	return returnData
+}

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

@@ -5,8 +5,6 @@ import (
 	"fmt"
 	"strings"
 
-	"bp.jydev.jianyu360.cn/CRM/application/service"
-
 	"app.yhyue.com/moapp/jybase/common"
 	P "app.yhyue.com/moapp/jybase/mapping"
 	T "bp.jydev.jianyu360.cn/CRM/application/api/common"
@@ -47,8 +45,8 @@ type ProjectEntry struct {
 
 func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasNextPage bool, total int) {
 
-	buyerM := service.BuyerList(req.PartyA, req.Supplier, req.Heterotophy, req.Intermediary, req.Agency)
-	service.MonitorStatusInit(req.PositionId, buyerM, "0")
+	buyerM := BuyerList(req.PartyA, req.Supplier, req.Heterotophy, req.Intermediary, req.Agency)
+	MonitorStatusInit(req.PositionId, buyerM, "0")
 	buyerArr := make([]string, len(*buyerM))
 	for b := range *buyerM {
 		buyerArr = append(buyerArr, b)
@@ -281,7 +279,7 @@ func moreInfo(req *types.ProjectListReq, list []*ProjectEntry) (result []*Projec
 		// 人脉路径
 		// 有我的人脉标签时不需要查询人脉路径信息
 		if m.MyConn == false {
-			service.ConnectionsHandle([]string{m.BuyerId}, req.PositionId, false)
+			ConnectionsHandle([]string{m.BuyerId}, req.PositionId, false)
 		}
 	}
 

+ 226 - 183
api/internal/types/types.go

@@ -1,49 +1,17 @@
 // Code generated by goctl. DO NOT EDIT.
 package types
 
-type AddOrUpdateReq struct {
-	PositionId             int64  `header:"positionId"`
-	EntUserId              int64  `header:"entUserId,optional"`
-	EntId                  int64  `header:"entId,optional"`
-	EntDeptId              int64  `header:"entDeptId,optional"`
-	Company_id             string `json:"company_id,optional"`
-	Company_name           string `json:"company_name,optional"`
-	Contact_person         string `json:"contact_person,optional"`
-	Contact_phone          string `json:"contact_phone,optional"`
-	Introduce_owner_id     string `json:"introduce_owner_id,optional"`
-	Introduce_owner_name   string `json:"introduce_owner_name,optional"`
-	Introduce_project_id   string `json:"introduce_project_id,optional"`
-	Introduce_project_name string `json:"introduce_project_name,optional"`
-	Id                     int64  `json:"id,optional"`
-	Type                   string `json:"type,optional"`
-}
-
-type AllprojectReq struct {
-	EntAccountId int64  `header:"entAccountId"`
-	PositionId   int64  `header:"positionId"`
-	Name         string `json:"name,optional"`
-	Type         int64  `json:"type,optional"`
-	Id           string `json:"id,optional"`
-}
-
-type AssociateReq struct {
-	EntAccountId int64  `header:"entAccountId"`
-	EntName      string `header:"entName"`
-	Name         string `json:"name"`
-	Type         string `json:"type"`
+type Reply struct {
+	Error_code int64       `json:"error_code"`
+	Error_msg  string      `json:"error_msg"`
+	Data       interface{} `json:"data"`
 }
 
-type CanAddReq struct {
-	AppId          string `header:"appId,default=10000"`
-	BaseUserId     int64  `header:"newUserId"`
-	PositionId     int64  `header:"positionId,optional"`
-	EntUserId      int64  `header:"entUserId,optional"`
-	EntId          int64  `header:"entId,optional"`
-	AccountId      int64  `header:"accountId,optional"`
-	EntDeptId      int64  `header:"entDeptId,optional"`
-	EmployInfoId   int64  `json:"employInfoId"`            //资讯收录id
-	EmployCustomId int64  `json:"employCustomId,optional"` //客户收录id
-	Key            string `json:"key"`                     //创建线索:more_create_clue 创建机会:more_create_chance 创建客户:more_create_custom
+type InfoReply struct {
+	Error_code  int64       `json:"error_code"`
+	Error_msg   string      `json:"error_msg"`
+	Data        interface{} `json:"data"`
+	BatchEmploy int64       `json:"batchEmploy"`
 }
 
 type ClueAddReq struct {
@@ -65,14 +33,81 @@ type ClueAddReq struct {
 	Channel      string  `json:"channel"`               //渠道来源:网页、手动创建
 }
 
-type CoopHistoryReq struct {
-	EntAccountId int64  `header:"entAccountId,optional"` //企业账户id
+type SaleChanceReq struct {
+	AppId             string  `header:"appId,default=10000"`
+	BaseUserId        int64   `header:"newUserId"`
+	PositionId        int64   `header:"positionId,optional"`
+	EntUserId         int64   `header:"entUserId,optional"`
+	EntId             int64   `header:"entId,optional"`
+	AccountId         int64   `header:"accountId,optional"`
+	EntDeptId         int64   `header:"entDeptId,optional"`
+	ChanceName        string  `json:"chanceName"`                 //机会名称
+	Summary           string  `json:"summary"`                    //概要信息
+	ChanceClassify    int64   `json:"chanceClassify"`             //机会分类
+	ExpectedOrderTime int64   `json:"expectedOrderTime,optional"` //最初预计落单段时间 时间戳
+	ExpectedMoney     float64 `json:"expectedMoney,optional"`     //最初预计落单金额
+	CustomName        string  `json:"customName"`                 //客户全称
+	BusinessType      int64   `json:"businessType"`               //业务类型  1新客户需求 2老客户需求 3简易项目流程
+	Remarks           string  `json:"remarks,optional"`           //备注
+	NextfollowUpTime  int64   `json:"nextfollowUpTime,optional"`  //下次跟进时间戳
+	Types             int64   `json:"types"`                      //处理方式 1自办;2转办;3待处理
+	User              []int64 `json:"user,optional"`              //企业用户id
+	EmployInfoId      int64   `json:"employInfoId,optional"`      //资讯收录id
+	CustomId          int64   `json:"customId,optional"`          //客户id
+	CreateName        string  `json:"createName"`                 //创建人
+	ChanceSource      int64   `json:"chanceSource"`               //机会来源
+	OwnerId           int64   `json:"ownerId,optional"`           //潜客收录id(人脉)
+	BusinessId        int64   `json:"businessId,optional"`        //商机收录id(人脉)
+}
+
+type EmployOperateReq struct {
+	AppId      string `header:"appId,default=10000"`
+	BaseUserId int64  `header:"newUserId"`
+	PositionId int64  `header:"positionId,optional"`
+	EntUserId  int64  `header:"entUserId,optional"`
+	EntId      int64  `header:"entId,optional"`
+	IdArr      string `json:"idArr"`      //信息id多条信息
+	IsEmploy   bool   `json:"isEmploy"`   //是否收录true收录 false取消收录
+	EmployType int64  `json:"employType"` //来源方式来源;1招标采购、2企业、3采购单位、4拟在建项目
+	EntDeptId  int64  `header:"entDeptId,optional"`
+	From       string `json:"from,optional"` //来源
+}
+
+type TransferReq struct {
+	AppId         string   `header:"appId,default=10000"`
+	BaseUserId    int64    `header:"newUserId"`
+	PositionId    int64    `header:"positionId,optional"`
+	EntUserId     int64    `header:"entUserId,optional"`
+	EntId         int64    `header:"entId,optional"`
+	EmplouIdArr   []string `json:"emplouIdArr"`
+	PositionIdArr []string `json:"positionIdArr"`
+}
+
+type IgnoreOperateReq struct {
+	AppId      string `header:"appId,default=10000"`
+	BaseUserId int64  `header:"newUserId"`
+	PositionId int64  `header:"positionId,optional"`
+	EntUserId  int64  `header:"entUserId,optional"`
+	EntId      int64  `header:"entId,optional"`
+	IdArr      string `json:"idArr"`      //id集合
+	IsIgnore   bool   `json:"isIgnore"`   //是否忽略 true 忽略 false取消忽略
+	EmployType int64  `json:"employType"` //来源方式来源;1招标采购、2企业、3采购单位、4拟在建项目
+}
+
+type InfoEmployinfoReq struct {
+	AppId        string `header:"appId,default=10000"`
+	BaseUserId   int64  `header:"newUserId"`
 	PositionId   int64  `header:"positionId,optional"`
-	EntId        string `header:"entId,optional"`
-	EntUserId    string `header:"entUserId,optional"`
-	DeptId       string `header:"deptId,optional"` //部门id
-	Pid          string `json:"porjectId"`
-	ChannelType  int    `json:"channelType"`
+	EntUserId    int64  `header:"entUserId,optional"`
+	EntId        int64  `header:"entId,optional"`
+	EmployType   int64  `json:"employType"` //1标采购、2企业、3采购单位、4拟在建项目
+	IdArr        string `json:"idArr"`      //id
+	EntNicheDis  int64  `header:"entNicheDis,optional"`
+	EntDeptId    int64  `header:"entDeptId,optional"`
+	PositionType int64  `header:"positionType,optional"` //职位类型 0个人 1企业
+	AccountId    int64  `header:"accountId,optional"`    //账户id
+	EntAccountId int64  `header:"entAccountId,optional"` //企业账户id
+	From         string `json:"from,optional"`           //来源
 }
 
 type CustomAddReq struct {
@@ -107,10 +142,15 @@ type CustomAddReq struct {
 	BusinessId           int64   `json:"businessId,optional"`              //商机收录id(人脉)
 }
 
-type DistributePerson struct {
-	PositionId int64 `json:"positionId"`
-	EntUserId  int64 `json:"entUserId"`
-	EntDeptId  int64 `json:"entDeptId"`
+type FileUploadReq struct {
+	AppId      string `header:"appId,default=10000"`
+	BaseUserId int64  `header:"newUserId"`
+	PositionId int64  `header:"positionId,optional"`
+	EntUserId  int64  `header:"entUserId,optional"`
+	EntId      int64  `header:"entId,optional"`
+	BusinessId int64  `form:"businessId"` //业务id
+	Types      int64  `form:"type"`       //类型;1:跟进记录-线下 2:跟进记录-线上 3:跟进记录-备忘 4:销售机会-项目文档 5:客户-客户档案
+	FileType   int64  `form:"fileType"`   //文件类型,产品介绍、项目方案、立项报告、报价文件、招标文件、投标文件、中标通知书、合同、发票、其他文件
 }
 
 type EmployDistributeReq struct {
@@ -125,96 +165,41 @@ type EmployDistributeReq struct {
 	EntDeptId   int64              `header:"entDeptId,optional"`
 }
 
-type EmployOperateReq struct {
-	AppId      string `header:"appId,default=10000"`
-	BaseUserId int64  `header:"newUserId"`
-	PositionId int64  `header:"positionId,optional"`
-	EntUserId  int64  `header:"entUserId,optional"`
-	EntId      int64  `header:"entId,optional"`
-	IdArr      string `json:"idArr"`      //信息id多条信息
-	IsEmploy   bool   `json:"isEmploy"`   //是否收录true收录 false取消收录
-	EmployType int64  `json:"employType"` //来源方式来源;1招标采购、2企业、3采购单位、4拟在建项目
-	EntDeptId  int64  `header:"entDeptId,optional"`
-	From       string `json:"from,optional"` //来源
+type DistributePerson struct {
+	PositionId int64 `json:"positionId"`
+	EntUserId  int64 `json:"entUserId"`
+	EntDeptId  int64 `json:"entDeptId"`
 }
 
 type EntInfoReq struct {
 	EntName string `json:"entName"`
 }
 
-type FileUploadReq struct {
-	AppId      string `header:"appId,default=10000"`
-	BaseUserId int64  `header:"newUserId"`
-	PositionId int64  `header:"positionId,optional"`
-	EntUserId  int64  `header:"entUserId,optional"`
-	EntId      int64  `header:"entId,optional"`
-	BusinessId int64  `form:"businessId"` //业务id
-	Types      int64  `form:"type"`       //类型;1:跟进记录-线下 2:跟进记录-线上 3:跟进记录-备忘 4:销售机会-项目文档 5:客户-客户档案
-	FileType   int64  `form:"fileType"`   //文件类型,产品介绍、项目方案、立项报告、报价文件、招标文件、投标文件、中标通知书、合同、发票、其他文件
-}
-
-type IgnoreOperateReq struct {
-	AppId      string `header:"appId,default=10000"`
-	BaseUserId int64  `header:"newUserId"`
-	PositionId int64  `header:"positionId,optional"`
-	EntUserId  int64  `header:"entUserId,optional"`
-	EntId      int64  `header:"entId,optional"`
-	IdArr      string `json:"idArr"`      //id集合
-	IsIgnore   bool   `json:"isIgnore"`   //是否忽略 true 忽略 false取消忽略
-	EmployType int64  `json:"employType"` //来源方式来源;1招标采购、2企业、3采购单位、4拟在建项目
-}
-
-type IgnoreReq struct {
-	PositionId int64  `header:"positionId"`
-	EntUserId  int64  `header:"entUserId,optional"`
-	EntId      int64  `header:"entId,optional"`
-	EntDeptId  int64  `header:"entDeptId,optional"`
-	RelateId   string `json:"relateId,optional"`
-	Source     int    `json:"source,optional"`
-	Action     int    `json:"action,optional"`
-}
-
-type InfoDetailReq struct {
-	InfoId string `json:"infoId"`
-}
-
-type InfoEmployinfoReq struct {
-	AppId        string `header:"appId,default=10000"`
-	BaseUserId   int64  `header:"newUserId"`
-	PositionId   int64  `header:"positionId,optional"`
-	EntUserId    int64  `header:"entUserId,optional"`
-	EntId        int64  `header:"entId,optional"`
-	EmployType   int64  `json:"employType"` //1标采购、2企业、3采购单位、4拟在建项目
-	IdArr        string `json:"idArr"`      //id
-	EntNicheDis  int64  `header:"entNicheDis,optional"`
-	EntDeptId    int64  `header:"entDeptId,optional"`
-	PositionType int64  `header:"positionType,optional"` //职位类型 0个人 1企业
-	AccountId    int64  `header:"accountId,optional"`    //账户id
-	EntAccountId int64  `header:"entAccountId,optional"` //企业账户id
-	From         string `json:"from,optional"`           //来源
-}
-
-type InfoReply struct {
-	Error_code  int64       `json:"error_code"`
-	Error_msg   string      `json:"error_msg"`
-	Data        interface{} `json:"data"`
-	BatchEmploy int64       `json:"batchEmploy"`
+type PushMsgReq struct {
+	AppId      string  `header:"appId,default=10000"`
+	BaseUserId int64   `header:"newUserId"`
+	PositionId int64   `header:"positionId,optional"`
+	EntUserId  int64   `header:"entUserId,optional"`
+	EntId      int64   `header:"entId,optional"`
+	Title      string  `json:"title"`         //标题
+	Content    string  `json:"content"`       //内容
+	PcHref     string  `json:"pcHref"`        //pc跳转地址
+	MobileHref string  `json:"mobileHref"`    //移动端跳转地址
+	User       []int64 `json:"user,optional"` //企业用户id
+	MsgType    string  `json:"msgType"`       //消息类型 1-活动优惠 2-服务通知 3-订阅消息 4-项目动态 5-企业动态 6-分析报告 7-系统通知 11-待办
 }
 
-type NetWorkListReq struct {
-	PositionId         int64  `header:"positionId"`
-	Type               string `json:"type,optional"`
-	Name               string `json:"name,optional"`
-	Monitor            int64  `json:"monitor,optional"`
-	Starttime          string `json:"starttime,optional"`
-	Endtime            string `json:"endtime,optional"`
-	Order_amount       int64  `json:"order_amount,optional"`
-	Current_page       int64  `json:"current_page,optional"`
-	Project_matchme    int64  `json:"project_matchme,optional"`
-	Buyercount_start   int64  `json:"buyercount_start,optional"`
-	Buyercount_end     int64  `json:"buyercount_end,optional"`
-	Monitorcount_start int64  `json:"monitorcount_start,optional"`
-	Monitorcount_end   int64  `json:"monitorcount_end,optional"`
+type CanAddReq struct {
+	AppId          string `header:"appId,default=10000"`
+	BaseUserId     int64  `header:"newUserId"`
+	PositionId     int64  `header:"positionId,optional"`
+	EntUserId      int64  `header:"entUserId,optional"`
+	EntId          int64  `header:"entId,optional"`
+	AccountId      int64  `header:"accountId,optional"`
+	EntDeptId      int64  `header:"entDeptId,optional"`
+	EmployInfoId   int64  `json:"employInfoId"`            //资讯收录id
+	EmployCustomId int64  `json:"employCustomId,optional"` //客户收录id
+	Key            string `json:"key"`                     //创建线索:more_create_clue 创建机会:more_create_chance 创建客户:more_create_custom
 }
 
 type OwnerListReq struct {
@@ -232,6 +217,7 @@ type OwnerListReq struct {
 	PageIndex        int64  `json:"pageIndex,optional"`
 }
 
+<<<<<<< HEAD
 type PnameAssReq struct {
 	ProjectName string `json:"projectName"`
 }
@@ -241,6 +227,8 @@ type PrjectHistoryReq struct {
 	WinnerId string `json:"winnerId"`
 }
 
+=======
+>>>>>>> feature/v1.0.4
 type ProjectListReq struct {
 	PositionId   int64  `header:"positionId,optional"`
 	EntId        string `header:"entId,optional"`
@@ -266,59 +254,114 @@ type ProjectListReq struct {
 	Amount       string `json:"amount,optional"`
 }
 
-type PushMsgReq struct {
-	AppId      string  `header:"appId,default=10000"`
-	BaseUserId int64   `header:"newUserId"`
-	PositionId int64   `header:"positionId,optional"`
-	EntUserId  int64   `header:"entUserId,optional"`
-	EntId      int64   `header:"entId,optional"`
-	Title      string  `json:"title"`         //标题
-	Content    string  `json:"content"`       //内容
-	PcHref     string  `json:"pcHref"`        //pc跳转地址
-	MobileHref string  `json:"mobileHref"`    //移动端跳转地址
-	User       []int64 `json:"user,optional"` //企业用户id
-	MsgType    string  `json:"msgType"`       //消息类型 1-活动优惠 2-服务通知 3-订阅消息 4-项目动态 5-企业动态 6-分析报告 7-系统通知 11-待办
+type PnameAssReq struct {
+	ProjectName string `json:"projectName"`
 }
 
-type Reply struct {
-	Error_code int64       `json:"error_code"`
-	Error_msg  string      `json:"error_msg"`
-	Data       interface{} `json:"data"`
+type CoopHistoryReq struct {
+	EntAccountId int64  `header:"entAccountId,optional"` //企业账户id
+	PositionId   int64  `header:"positionId,optional"`
+	EntId        string `header:"entId,optional"`
+	EntUserId    string `header:"entUserId,optional"`
+	DeptId       string `header:"deptId,optional"` //部门id
+	Pid          string `json:"porjectId"`
+	ChannelType  int    `json:"channelType"`
 }
 
-type SaleChanceReq struct {
-	AppId             string  `header:"appId,default=10000"`
-	BaseUserId        int64   `header:"newUserId"`
-	PositionId        int64   `header:"positionId,optional"`
-	EntUserId         int64   `header:"entUserId,optional"`
-	EntId             int64   `header:"entId,optional"`
-	AccountId         int64   `header:"accountId,optional"`
-	EntDeptId         int64   `header:"entDeptId,optional"`
-	ChanceName        string  `json:"chanceName"`                 //机会名称
-	Summary           string  `json:"summary"`                    //概要信息
-	ChanceClassify    int64   `json:"chanceClassify"`             //机会分类
-	ExpectedOrderTime int64   `json:"expectedOrderTime,optional"` //最初预计落单段时间 时间戳
-	ExpectedMoney     float64 `json:"expectedMoney,optional"`     //最初预计落单金额
-	CustomName        string  `json:"customName"`                 //客户全称
-	BusinessType      int64   `json:"businessType"`               //业务类型  1新客户需求 2老客户需求 3简易项目流程
-	Remarks           string  `json:"remarks,optional"`           //备注
-	NextfollowUpTime  int64   `json:"nextfollowUpTime,optional"`  //下次跟进时间戳
-	Types             int64   `json:"types"`                      //处理方式 1自办;2转办;3待处理
-	User              []int64 `json:"user,optional"`              //企业用户id
-	EmployInfoId      int64   `json:"employInfoId,optional"`      //资讯收录id
-	CustomId          int64   `json:"customId,optional"`          //客户id
-	CreateName        string  `json:"createName"`                 //创建人
-	ChanceSource      int64   `json:"chanceSource"`               //机会来源
-	OwnerId           int64   `json:"ownerId,optional"`           //潜客收录id(人脉)
-	BusinessId        int64   `json:"businessId,optional"`        //商机收录id(人脉)
+type AddOrUpdateReq struct {
+	PositionId             int64  `header:"positionId"`
+	EntUserId              int64  `header:"entUserId,optional"`
+	EntId                  int64  `header:"entId,optional"`
+	EntDeptId              int64  `header:"entDeptId,optional"`
+	Company_id             string `json:"company_id,optional"`
+	Company_name           string `json:"company_name,optional"`
+	Contact_person         string `json:"contact_person,optional"`
+	Contact_phone          string `json:"contact_phone,optional"`
+	Introduce_owner_id     string `json:"introduce_owner_id,optional"`
+	Introduce_owner_name   string `json:"introduce_owner_name,optional"`
+	Introduce_project_id   string `json:"introduce_project_id,optional"`
+	Introduce_project_name string `json:"introduce_project_name,optional"`
+	Id                     int64  `json:"id,optional"`
+	Type                   string `json:"type,optional"`
 }
 
-type TransferReq struct {
-	AppId         string   `header:"appId,default=10000"`
-	BaseUserId    int64    `header:"newUserId"`
-	PositionId    int64    `header:"positionId,optional"`
-	EntUserId     int64    `header:"entUserId,optional"`
-	EntId         int64    `header:"entId,optional"`
-	EmplouIdArr   []string `json:"emplouIdArr"`
-	PositionIdArr []string `json:"positionIdArr"`
+type AssociateReq struct {
+	EntAccountId int64  `header:"entAccountId"`
+	EntName      string `header:"entName"`
+	Name         string `json:"name"`
+	Type         string `json:"type"`
+}
+
+type AllprojectReq struct {
+	EntAccountId int64  `header:"entAccountId"`
+	PositionId   int64  `header:"positionId"`
+	Name         string `json:"name,optional"`
+	Type         int64  `json:"type,optional"`
+	Id           string `json:"id,optional"`
+}
+
+type NetWorkListReq struct {
+	EntAccountId       int64  `header:"entAccountId"`
+	PositionId         int64  `header:"positionId"`
+	Type               string `json:"type,optional"`
+	Name               string `json:"name,optional"`
+	Monitor            int64  `json:"monitor,optional"`
+	Starttime          string `json:"starttime,optional"`
+	Endtime            string `json:"endtime,optional"`
+	Order_amount       int64  `json:"order_amount,optional"`
+	Current_page       int64  `json:"current_page,optional"`
+	Project_matchme    int64  `json:"project_matchme,optional"`
+	Buyercount_start   int64  `json:"buyercount_start,optional"`
+	Buyercount_end     int64  `json:"buyercount_end,optional"`
+	Monitorcount_start int64  `json:"monitorcount_start,optional"`
+	Monitorcount_end   int64  `json:"monitorcount_end,optional"`
+}
+
+type IgnoreReq struct {
+	PositionId int64  `header:"positionId"`
+	EntUserId  int64  `header:"entUserId,optional"`
+	EntId      int64  `header:"entId,optional"`
+	EntDeptId  int64  `header:"entDeptId,optional"`
+	RelateId   string `json:"relateId,optional"`
+	Source     int    `json:"source,optional"`
+	Action     int    `json:"action,optional"`
+}
+
+type InfoDetailReq struct {
+	InfoId string `json:"infoId"`
+}
+
+type PListPathReq struct {
+	PositionId int64  `header:"positionId"`
+	EntUserId  int64  `header:"entUserId,optional"`
+	EntId      int64  `header:"entId,optional"`
+	EntDeptId  int64  `header:"entDeptId,optional"`
+	BuyerId    string `json:"buyerId"`
+}
+
+type PrjectHistoryReq struct {
+	BuyerId  string `json:"buyerId"`
+	WinnerId string `json:"winnerId"`
+}
+
+type ChannelListReq struct {
+	PartyA       string `json:"partyA,optional"`       //甲方
+	Supplier     string `json:"supplier,optional"`     //供应商
+	Heterotophy  string `json:"heterotophy,optional"`  //同甲异业
+	Intermediary string `json:"intermediary,optional"` //中间人
+	Agency       string `json:"agency,optional"`       //代理机构
+	PositionId   int64  `header:"positionId,optional"`
+}
+
+type RouteOwnerListReq struct {
+	BuyerId   string `json:"buyerId,optional"`
+	BuyerName string `json:"buyerName,optional"`
+}
+
+type CooperateOwnerListReq struct {
+	BuyerId       string `json:"buyerId,optional"`
+	BuyerName     string `json:"buyerName,optional"`
+	WinnerId      string `json:"winnerId,optional"`
+	WinnerName    string `json:"winnerName,optional"`
+	CooperateType string `json:"cooperateType,optional"`
 }

+ 4 - 5
go.mod

@@ -3,9 +3,8 @@ module bp.jydev.jianyu360.cn/CRM/application
 go 1.19
 
 require (
-	app.yhyue.com/moapp/jybase v0.0.0-20230901064756-2fc66b18db40
+	app.yhyue.com/moapp/jybase v0.0.0-20240422010359-27408422af30
 	app.yhyue.com/moapp/jypkg v0.0.0-20230825092743-3bfc415bb5bb
-	app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae
 	bp.jydev.jianyu360.cn/BaseService/fileCenter v0.0.0-20231016051530-64b559fee531
 	bp.jydev.jianyu360.cn/BaseService/gateway v1.3.4
 	bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.14-0.20230821092053-934ffe439a9d
@@ -14,9 +13,8 @@ require (
 	github.com/ClickHouse/clickhouse-go/v2 v2.2.0
 	github.com/RoaringBitmap/roaring v1.5.0
 	github.com/gogf/gf/v2 v2.0.6
-	github.com/golang/protobuf v1.5.3
+	github.com/shopspring/decimal v1.3.1
 	github.com/zeromicro/go-zero v1.5.5
-	google.golang.org/grpc v1.57.0
 )
 
 require (
@@ -49,6 +47,7 @@ require (
 	github.com/gogo/protobuf v1.3.2 // indirect
 	github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
 	github.com/golang/mock v1.6.0 // indirect
+	github.com/golang/protobuf v1.5.3 // indirect
 	github.com/golang/snappy v0.0.4 // indirect
 	github.com/gomodule/redigo v2.0.0+incompatible // indirect
 	github.com/google/gnostic v0.5.7-v3refs // indirect
@@ -88,7 +87,6 @@ require (
 	github.com/prometheus/common v0.42.0 // indirect
 	github.com/prometheus/procfs v0.10.1 // indirect
 	github.com/rivo/uniseg v0.2.0 // indirect
-	github.com/shopspring/decimal v1.3.1 // indirect
 	github.com/spaolacci/murmur3 v1.1.0 // indirect
 	github.com/xdg-go/pbkdf2 v1.0.0 // indirect
 	github.com/xdg-go/scram v1.1.2 // indirect
@@ -125,6 +123,7 @@ require (
 	google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 // indirect
 	google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 // indirect
 	google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
+	google.golang.org/grpc v1.57.0 // indirect
 	google.golang.org/protobuf v1.31.0 // indirect
 	gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
 	gopkg.in/inf.v0 v0.9.1 // indirect

+ 3 - 85
go.sum

@@ -3,21 +3,17 @@ app.yhyue.com/moapp/esv1 v0.0.0-20220414031211-3da4123e648d/go.mod h1:91/lSD/hS+
 app.yhyue.com/moapp/jyInfo v1.0.0/go.mod h1:+RjyGNvk7PT1P8cglkVlaj1lLlBXuPB+f5LipoOtgPs=
 app.yhyue.com/moapp/jyMarketing v0.0.2-0.20230304035551-21bb1eedf547 h1:cCmWQW8DUBD2nuZNDz9aIe6MrlioxTbdaA2YiJhlzjY=
 app.yhyue.com/moapp/jyMarketing v0.0.2-0.20230304035551-21bb1eedf547/go.mod h1:JvIs8uKjdT963+7JnZGIEcL4ctBiBjwkoz0kNyigE78=
-app.yhyue.com/moapp/jyPoints v1.1.1/go.mod h1:SvP8p5L3jGrejHiH2LXfgCg/NPlFiKBC5Yd0gsI12FU=
 app.yhyue.com/moapp/jybase v0.0.0-20220415064050-37ce64b3e2d4/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220418104200-46c3fff161c7/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220419023055-f406279ff7e3/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220420032112-668025915ee4/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220421060131-a1001013ba46/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
-app.yhyue.com/moapp/jybase v0.0.0-20220427020729-974c1a148186/go.mod h1:qNRA0sHuYqcLoYoP8irpaWnW9YsXixe6obBIkwaXpD0=
 app.yhyue.com/moapp/jybase v0.0.0-20220706083640-79084ff2be42/go.mod h1:FjBF25AYoBrPhVKTXGXWcmEAbBT0ATTK6KJMOA+I80Q=
 app.yhyue.com/moapp/jybase v0.0.0-20230117032034-ad7c00ffe11a/go.mod h1:zB47XTeJvpcbtBRYgkQuxOICWNexiZfbUO+7aUf6mNs=
-app.yhyue.com/moapp/jybase v0.0.0-20230901064756-2fc66b18db40 h1:/FcBvpf/KW8g6GBfTkypVW1pGbNs+iNhDrUGUi+KNjc=
-app.yhyue.com/moapp/jybase v0.0.0-20230901064756-2fc66b18db40/go.mod h1:Hv9U/7oHRucqH315Tr1+d03NCvS9mOKPfk8pwwlOIwQ=
+app.yhyue.com/moapp/jybase v0.0.0-20240422010359-27408422af30 h1:d3EW7fnnsIUtXCeYvPRvRr7NfrKRZwQRWOV8DJpN+T4=
+app.yhyue.com/moapp/jybase v0.0.0-20240422010359-27408422af30/go.mod h1:XHNATN6tsJKHdCB0DbUtFdPPHXexTUFyB3RlO+lUUoM=
 app.yhyue.com/moapp/jypkg v0.0.0-20230825092743-3bfc415bb5bb h1:J9CQ60meKlABYqeOB6zdZXJtBHAsJqnHeWhd/OOCUtU=
 app.yhyue.com/moapp/jypkg v0.0.0-20230825092743-3bfc415bb5bb/go.mod h1:VaHDi3twSg4G84k2+UFOe7ZCw5EqUZVAkW2N2dHeMbU=
-app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae h1:6rDDaz6yxvE8viTSzEBwKYOFWq14TMfuBivSazUZMz4=
-app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae/go.mod h1:b0zZHev3gmJao1Fo+2Z2KPVjsuLOJVvVxf+kCnu9WkA=
 bp.jydev.jianyu360.cn/BP/jynsq v0.0.0-20220222052708-ebc43af90698/go.mod h1:ojo/AUH9Yr1wzarEjOaNMkj1Cet/9r8IgLyba64Z52E=
 bp.jydev.jianyu360.cn/BaseService/entManageApplication v0.0.0-20230214091519-89a98c01ab0e h1:h+VEI3o1qC0jeCzkFGTrLI4f27cfa/W/y+0sXokWMgE=
 bp.jydev.jianyu360.cn/BaseService/entManageApplication v0.0.0-20230214091519-89a98c01ab0e/go.mod h1:7Xhygw0KBuL4h0G76FnFg4otQcA9bmOO0c8M0FCjAyQ=
@@ -450,13 +446,11 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
 github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
 github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
-github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
 github.com/ClickHouse/clickhouse-go v1.5.1/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
 github.com/ClickHouse/clickhouse-go v1.5.4/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
 github.com/ClickHouse/clickhouse-go/v2 v2.0.14/go.mod h1:iq2DUGgpA4BBki2CVwrF8x43zqBjdgHtbexkFkh5a6M=
 github.com/ClickHouse/clickhouse-go/v2 v2.2.0 h1:dj00TDKY+xwuTJdbpspCSmTLFyWzRJerTHwaBxut1C0=
 github.com/ClickHouse/clickhouse-go/v2 v2.2.0/go.mod h1:8f2XZUi7XoeU+uPIytSi1cvx8fmJxi7vIgqpvYTF1+o=
-github.com/DATA-DOG/go-sqlmock v1.4.1/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
 github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
 github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
 github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
@@ -477,7 +471,6 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF
 github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
 github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk=
 github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
-github.com/alicebob/miniredis/v2 v2.14.1/go.mod h1:uS970Sw5Gs9/iK3yBg0l9Uj9s25wXxSpQUE9EaJ/Blg=
 github.com/alicebob/miniredis/v2 v2.17.0/go.mod h1:gquAfGbzn92jvtrSC69+6zZnwSODVXVpYDRaGhWaL6I=
 github.com/alicebob/miniredis/v2 v2.21.0/go.mod h1:XNqvJdQJv5mSuVMc0ynneafpnL/zv52acZ6kqeS0t88=
 github.com/alicebob/miniredis/v2 v2.22.0/go.mod h1:XNqvJdQJv5mSuVMc0ynneafpnL/zv52acZ6kqeS0t88=
@@ -486,10 +479,7 @@ github.com/alicebob/miniredis/v2 v2.30.5 h1:3r6kTHdKnuP4fkS8k2IrvSfxpxUTcW1SOL0w
 github.com/aliyun/aliyun-oss-go-sdk v2.2.2+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
 github.com/aliyun/aliyun-oss-go-sdk v2.2.4+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
 github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
-github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
 github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
-github.com/antlr/antlr4 v0.0.0-20210105212045-464bcbc32de2/go.mod h1:T7PbCXFs94rrTttyxjbyT5+/1V8T2TYDejxUfHJjw1Y=
-github.com/antlr/antlr4 v0.0.0-20210319025552-3590d4d5e18c/go.mod h1:T7PbCXFs94rrTttyxjbyT5+/1V8T2TYDejxUfHJjw1Y=
 github.com/antonlindstrom/pgstore v0.0.0-20200229204646-b08ebf1105e0/go.mod h1:2Ti6VUHVxpC0VSmTZzEvpzysnaGAfGBOoMIz5ykPyyw=
 github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
 github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
@@ -503,7 +493,6 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
 github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
 github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
-github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
 github.com/bits-and-blooms/bitset v1.2.0 h1:Kn4yilvwNtMACtf1eYDlG8H77R07mZSPbMjLyS07ChA=
 github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
 github.com/bkaradzic/go-lz4 v1.0.0/go.mod h1:0YdlkowM3VswSROI7qDxhRvJ3sLhlFrRRwjwegp5jy4=
@@ -542,20 +531,16 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH
 github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
 github.com/cncf/xds/go v0.0.0-20230105202645-06c439db220b/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
 github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
-github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
-github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
 github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
 github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
 github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
 github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
 github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
-github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
 github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
 github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
 github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
 github.com/coscms/tagfast v0.0.0-20150925144250-2b69b2496250/go.mod h1:zX8vynptAghuV/KG8BOZlDeo4DsTKWfBQ154RWlkay0=
 github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
-github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
 github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
 github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -570,7 +555,6 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cu
 github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
 github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
 github.com/donnie4w/go-logger v0.0.0-20170827050443-4740c51383f4/go.mod h1:L7S4x0R7vv3xoOhGuyAJyCO2MYzWOpccM4Isn8jIUgY=
-github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
 github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
 github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
 github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
@@ -580,7 +564,6 @@ github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkg
 github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
 github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE=
 github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
-github.com/emicklei/proto v1.9.0/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A=
 github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
 github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
 github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
@@ -597,19 +580,15 @@ github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0+
 github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
 github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
 github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
-github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
-github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
 github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
 github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
 github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
 github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
-github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
 github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNun8eiPw=
 github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
 github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
 github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
 github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
-github.com/frankban/quicktest v1.7.2/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o=
 github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
 github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
@@ -667,7 +646,6 @@ github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvSc
 github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
 github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
 github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
-github.com/go-redis/redis v6.15.7+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
 github.com/go-redis/redis/v8 v8.11.4/go.mod h1:2Z2wHZXdQpCDXEGzqMockDpNyYvi2l4Pxt6RJr792+w=
 github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
 github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
@@ -682,7 +660,6 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me
 github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
 github.com/go-test/deep v1.0.7 h1:/VSMRlnY/JSyqxQUzQLKVMAskpY/NZKFA5j2P+0pP2M=
 github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
-github.com/go-xorm/builder v0.3.4/go.mod h1:KxkQkNN1DpPKTedxXyTQcmH+rXfvk4LZ9SOOBoZBAxw=
 github.com/go-xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:56xuuqnHyryaerycW3BfssRdxQstACi0Epw/yC5E2xM=
 github.com/go-xorm/xorm v0.7.9/go.mod h1:XiVxrMMIhFkwSkh96BW7PACl7UhLtx2iJIHMdmjh5sQ=
 github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0=
@@ -709,7 +686,6 @@ github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWe
 github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ=
 github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0=
 github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw=
-github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
 github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
 github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
 github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
@@ -717,8 +693,6 @@ github.com/gogf/gf/v2 v2.0.6 h1:2etb4FMpbQKWIJO+UjtIWrZUp01HUsFb6Po8pgizAWk=
 github.com/gogf/gf/v2 v2.0.6/go.mod h1:8uYzw7qNzuq8vrhVlWke1b1925FFqOJIgmyYW1sr/0M=
 github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
 github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
-github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
-github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
 github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
 github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
 github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
@@ -731,7 +705,6 @@ github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2V
 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
 github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
 github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE=
-github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
 github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
 github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@@ -820,7 +793,6 @@ github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLe
 github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
 github.com/google/pprof v0.0.0-20211214055906-6f57359322fd/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg=
 github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
-github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
@@ -851,7 +823,6 @@ github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB7
 github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
 github.com/gorilla/sessions v1.1.1/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w=
 github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
-github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
 github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
 github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
 github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
@@ -859,10 +830,7 @@ github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad
 github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
 github.com/grokify/html-strip-tags-go v0.0.1 h1:0fThFwLbW7P/kOiTBs03FsJSV9RM2M/Q/MOnCQxKMo0=
 github.com/grokify/html-strip-tags-go v0.0.1/go.mod h1:2Su6romC5/1VXOQMaWL2yb618ARB8iVo6/DR99A6d78=
-github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
-github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
-github.com/grpc-ecosystem/grpc-gateway v1.14.3/go.mod h1:6CwZWGDSPRJidgKAtJVvND6soZe6fT7iteq8wDPdhb0=
 github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
 github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks=
 github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w=
@@ -875,8 +843,6 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
 github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
 github.com/howeyc/fsnotify v0.9.0/go.mod h1:41HzSPxBGeFRQKEEwgh49TRw/nKBsYZ2cF1OzPjSJsA=
 github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
-github.com/iancoleman/strcase v0.1.2/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=
-github.com/iancoleman/strcase v0.1.3/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=
 github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
 github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
 github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
@@ -950,12 +916,10 @@ github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHW
 github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
 github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
 github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
-github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
 github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
 github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
 github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
 github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
-github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
 github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
 github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
 github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@@ -969,8 +933,6 @@ github.com/justinas/alice v1.2.0/go.mod h1:fN5HRH/reO/zrUflLfTN43t3vXvKzvZIENsNE
 github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4=
 github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=
 github.com/kidstuff/mongostore v0.0.0-20181113001930-e650cd85ee4b/go.mod h1:g2nVr8KZVXJSS97Jo8pJ0jgq29P6H7dG0oplUA86MQw=
-github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
-github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
 github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
 github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
 github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
@@ -1003,7 +965,6 @@ github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
 github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
 github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
 github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
-github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
 github.com/longbridgeapp/sqlparser v0.3.1 h1:iWOZWGIFgQrJRgobLXUNJdvqGRpbVXkyKUKUA5CNJBE=
 github.com/longbridgeapp/sqlparser v0.3.1/go.mod h1:GIHaUq8zvYyHLCLMJJykx1CdM6LHtkUih/QaJXySSx4=
 github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
@@ -1015,28 +976,22 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0
 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
 github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE=
 github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0=
-github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
 github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
 github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
-github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
 github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
 github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
 github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
 github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
 github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
-github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
 github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
 github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
 github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
 github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
-github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
 github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
 github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
 github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
 github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
 github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
-github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
-github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
 github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
 github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
 github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
@@ -1078,8 +1033,6 @@ github.com/nsqio/go-nsq v1.1.0/go.mod h1:vKq36oyeVXgsS5Q8YEO7WghqidAVXQlcFxzQbQT
 github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
 github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
 github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
-github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
-github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
 github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
 github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
 github.com/olivere/elastic v6.2.37+incompatible h1:UfSGJem5czY+x/LqxgeCBgjDn6St+z8OnsCuxwD3L0U=
@@ -1099,7 +1052,6 @@ github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3
 github.com/onsi/ginkgo/v2 v2.7.0 h1:/XxtEV3I3Eif/HobnVx9YmJgk8ENdRsuUmM+fLCFNow=
 github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
 github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
-github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
 github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
 github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
 github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
@@ -1125,7 +1077,6 @@ github.com/pelletier/go-toml/v2 v2.0.9 h1:uH2qQXheeefCCkuBBSLi7jCiSmj3VRh2+Goq2N
 github.com/pelletier/go-toml/v2 v2.0.9/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
 github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
 github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
-github.com/pierrec/lz4 v2.5.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
 github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
 github.com/pierrec/lz4/v4 v4.1.14/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
 github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
@@ -1144,7 +1095,6 @@ github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P
 github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
 github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
 github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
-github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
 github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
 github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
 github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
@@ -1162,7 +1112,6 @@ github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvq
 github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
 github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
 github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
-github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
 github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
 github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
 github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
@@ -1173,7 +1122,6 @@ github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr
 github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
 github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
 github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
-github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
 github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
 github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
 github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
@@ -1187,7 +1135,6 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqn
 github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
 github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
 github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
-github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
 github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
 github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
 github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
@@ -1197,7 +1144,6 @@ github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
 github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
 github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
 github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
-github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
 github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
 github.com/shirou/gopsutil v2.19.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
 github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
@@ -1217,7 +1163,6 @@ github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic
 github.com/smartystreets/assertions v1.1.1/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
 github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
 github.com/smartystreets/gunit v1.4.2/go.mod h1:ZjM1ozSIMJlAz/ay4SG8PeKF00ckUp+zMHZXV9/bvak=
-github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
 github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
 github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
 github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
@@ -1227,7 +1172,6 @@ github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z
 github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
 github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
 github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
-github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
 github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
 github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
 github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
@@ -1251,16 +1195,11 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
 github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
 github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
 github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
-github.com/tal-tech/go-zero v1.1.5/go.mod h1:LbN0C7/rbl2+LUWTSUYx5leXmgedeMWjt1jc3/8/zFA=
 github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
 github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk=
 github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ=
-github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
-github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
 github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
 github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
-github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
-github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
 github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
 github.com/wader/gormstore/v2 v2.0.0/go.mod h1:3BgNKFxRdVo2E4pq3e/eiim8qRDZzaveaIcIvu2T8r0=
 github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
@@ -1275,8 +1214,6 @@ github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6
 github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
 github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
 github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
-github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
-github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2/go.mod h1:hzfGeIUDq/j97IG+FhNqkowIyEcD88LrW6fyU3K3WqY=
 github.com/yl2chen/cidranger v1.0.2/go.mod h1:9U1yz7WPYDwf0vpNWFaeRh0bjwz5RVgRy/9UEQfHl0g=
 github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=
 github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
@@ -1287,7 +1224,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
 github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
 github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
 github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
-github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
 github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
 github.com/yuin/gopher-lua v0.0.0-20210529063254-f4c35e4016d9/go.mod h1:E1AXubJBdNmFERAOucpDIxNzeGfLzg0mYh+UfMWdChA=
 github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
@@ -1301,8 +1237,6 @@ github.com/zeromicro/go-zero v1.4.4/go.mod h1:5WSUwtJm0bYdDZ69GlckigcT6D0EyAPbDa
 github.com/zeromicro/go-zero v1.5.5 h1:qEHnDuCBu/gDBmfWEZXYow6ZmWmzsrJTjtjSMVm4SiY=
 github.com/zeromicro/go-zero v1.5.5/go.mod h1:AGCspTFitHzYjl5ddAmYWLfdt341+BrhefqlwO45UbU=
 github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
-go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
-go.etcd.io/etcd v0.0.0-20200402134248-51bdeb39e698/go.mod h1:YoUyTScD3Vcv2RBm3eGVOq7i1ULiz3OuXoQFWOirmAM=
 go.etcd.io/etcd/api/v3 v3.5.2/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A=
 go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A=
 go.etcd.io/etcd/api/v3 v3.5.5/go.mod h1:KFtNaxGDw4Yx/BA4iPPwevUTAuqcsPxzyX8PHydchN8=
@@ -1399,7 +1333,6 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
 go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
 go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
 go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
-go.uber.org/automaxprocs v1.3.0/go.mod h1:9CWT6lKIep8U41DDaPiH6eFscnTyjfTANNQNx6LrIcA=
 go.uber.org/automaxprocs v1.4.0/go.mod h1:/mTEdr7LvHhs0v7mjdxDreTz1OG5zdZGqgOnhWiR/+Q=
 go.uber.org/automaxprocs v1.5.1/go.mod h1:BF4eumQw0P9GtnuxxovUd06vwm1o18oMzFtK66vU6XU=
 go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8=
@@ -1417,7 +1350,6 @@ go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTV
 go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
 go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
 go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
-go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
 go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
 go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
 go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
@@ -1432,7 +1364,6 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
 golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
-golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
@@ -1494,7 +1425,6 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r
 golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -1509,7 +1439,6 @@ golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLL
 golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
@@ -1611,7 +1540,6 @@ golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -1657,7 +1585,6 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7w
 golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -1745,7 +1672,6 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
 golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
 golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
 golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
-golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -1757,10 +1683,8 @@ golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxb
 golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
 golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
-golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
@@ -1802,7 +1726,6 @@ golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapK
 golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
 golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
 golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
-golang.org/x/tools v0.0.0-20200410132612-ae9902aceb98/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
@@ -1909,7 +1832,6 @@ google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRn
 google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
 google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
-google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
 google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
 google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
 google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
@@ -2030,7 +1952,6 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi
 google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
 google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
 google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
-google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA=
 google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
 google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
 google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
@@ -2095,22 +2016,19 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8
 gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
-gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
 gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
 gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
 gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE=
 gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df/go.mod h1:LRQQ+SO6ZHR7tOkpBDuZnXENFzX8qRjMDMyPD6BRkCw=
-gopkg.in/h2non/gock.v1 v1.0.15/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdODlynE=
 gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=
 gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0=
 gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
 gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
 gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
-gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
+gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
 gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
 gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
-gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
 gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

+ 0 - 574
service/owner.go

@@ -1,574 +0,0 @@
-package service
-
-import (
-	. "bp.jydev.jianyu360.cn/CRM/application/api/common"
-	"bp.jydev.jianyu360.cn/CRM/application/entity"
-	"context"
-	"fmt"
-	"github.com/gogf/gf/v2/util/gconv"
-	"github.com/zeromicro/go-zero/core/logx"
-	"strings"
-)
-
-type OwnerService struct {
-	PartyA           string
-	Supplier         string
-	Heterotophy      string
-	Intermediary     string
-	Agency           string
-	SearchEntName    string
-	SourceType       string
-	ProcessingStatus string
-	Area             string
-	PositionId       int64
-	PageIndex        int64
-	PageSize         int64
-}
-
-type BuyerProject struct {
-	BuyerId          string
-	BuyerName        string
-	Project          ProjectEntity
-	IsMonitor        bool
-	IsCreateCustomer bool
-	IsIgnore         bool
-	Area             string
-	Zbtime           int64
-}
-type ProjectEntity struct {
-	Number          int64
-	zbtime          int64
-	EstimatedAmount int64
-	Connections     []map[string]interface{}
-}
-type Recommend struct {
-	buyerId string `ch:"buyer_id"`
-	buyer   string `ch:"buyer"`
-}
-type Project struct {
-	BuyerId    string `ch:"buyer_id"`
-	Area       string `ch:"area"`
-	GroupCount int64  `ch:"group_count"`
-	Money      int64  `ch:"money"`
-	Zbtime     int64  `ch:"zbtime"`
-}
-
-func (t *OwnerService) OwnerlList() map[string]interface{} {
-	//先查询采购单位列表
-	dataMap := &map[string]map[string]interface{}{}
-	if t.PartyA != "" || t.Supplier != "" || t.Heterotophy != "" || t.Intermediary != "" || t.Agency != "" {
-		dataMap = BuyerList(t.PartyA, t.Supplier, t.Heterotophy, t.Intermediary, t.Agency)
-	}
-	if len(*dataMap) == 0 {
-		return map[string]interface{}{}
-	}
-	if t.SearchEntName != "" {
-		//es查询
-	}
-	//处理状态初始化
-	if t.ProcessingStatus != "" {
-		ProcessingStatusInit(t.PositionId, dataMap, t.ProcessingStatus)
-	}
-	//监控状态处理
-	MonitorStatusInit(t.PositionId, dataMap, t.SourceType)
-	//项目数量查询
-	buyerArr := []string{}
-	for key := range *dataMap {
-		buyerArr = append(buyerArr, fmt.Sprintf(`'%s'`, gconv.String(key)))
-	}
-	//项目数量处理
-	projectMap := ProjectHandle(buyerArr, t.Area)
-	//采购单位和项目合并
-	returnData, monitorNumber, highSuccessNumber, connectionsNumber := BuyerProjectMerge(dataMap, projectMap, t.SourceType)
-	//分页数据处理
-	if t.PageSize == 0 {
-		t.PageSize = 10
-	}
-	if t.PageIndex == 0 {
-		t.PageIndex = 10
-	}
-	startIndex := (t.PageIndex - 1) * t.PageSize
-	endIndex := t.PageIndex * t.PageSize
-	if startIndex < connectionsNumber {
-		if endIndex > connectionsNumber {
-			endIndex = connectionsNumber
-		}
-		returnData = returnData[startIndex:endIndex]
-	} else {
-		return map[string]interface{}{}
-	}
-	buyerIdArr := []string{}
-	for _, value := range returnData {
-		buyerIdArr = append(buyerIdArr, fmt.Sprintf("'%s'", value.BuyerId))
-	}
-	//业主人脉处理
-	projectList := ConnectionsHandle(buyerIdArr, t.PositionId, false)
-	for _, v := range projectList {
-		buyerId := gconv.String(v["a_id"])
-		for i, v1 := range returnData {
-			aBuyerId := v1.BuyerId
-			if buyerId == aBuyerId {
-				//组装数据
-				returnData[i].Project.Connections = append(returnData[i].Project.Connections, v)
-			}
-		}
-	}
-	//返回数据组装
-	return map[string]interface{}{
-		"connectionsNumber": connectionsNumber,
-		"highSuccessNumber": highSuccessNumber,
-		"monitorNumber":     monitorNumber,
-		"list":              returnData,
-	}
-}
-func ConnectionsHandle(buyerArr []string, positionId int64, isAll bool) []map[string]interface{} {
-	returnData := []map[string]interface{}{}
-	//中间人  作为可介绍业主    企业名称
-	companyArr := CrmMysql.SelectBySql(
-		fmt.Sprintf("select  b.company_id,b.company_name,b.contact_name,a.relate_id,a.relate_name   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.type =1  and  b.type=4 and  b.state=1 ", positionId, strings.Join(buyerArr, ",")))
-	for _, v := range *companyArr {
-		companyId := gconv.String(v["company_id"])
-		companyName := gconv.String(v["company_name"])
-		relateName := gconv.String(v["relate_name"])
-		relateId := gconv.String(v["relate_id"])
-		//key := fmt.Sprintf("%s_%s", relateId, companyId)
-		returnData = append(returnData, map[string]interface{}{
-			"b_id":         companyId,
-			"b_name":       companyName,
-			"a_name":       relateName,
-			"a_id":         relateId,
-			"sourceType":   "中间人",
-			"relationship": "业主的关系人",
-		})
-	}
-	if isAll && len(returnData) > 0 {
-		return returnData
-	}
-	//采购单位 投资关系  管辖关系
-	buyerSql := fmt.Sprintf("select  a_id,b_id,a_name,b_name,code  from  ent_map_code  where ( a_name  in  (%s) or b_name  in  (%s)  ) and   code in('0101','0201')", strings.Join(buyerArr, ","), strings.Join(buyerArr, ","))
-	relationshipArr := FindConnectionsHandle(buyerSql)
-	if relationshipArr != nil && len(relationshipArr) > 0 {
-		for _, v := range relationshipArr {
-			a_id := gconv.String(v["a_id"])
-			b_id := gconv.String(v["b_id"])
-			a_name := gconv.String(v["a_name"])
-			b_name := gconv.String(v["b_name"])
-			for _, v1 := range buyerArr {
-				code := gconv.String(v["a_id"])
-				if a_id == v1 {
-					//key := fmt.Sprintf("%s_%s", a_id, b_id)
-					switch code {
-					case "0101": //管辖关系
-						returnData = append(returnData, map[string]interface{}{
-							"b_id":         b_id,
-							"b_name":       b_name,
-							"a_name":       a_name,
-							"a_id":         a_id,
-							"sourceType":   "甲方",
-							"relationship": "业主的上级机构",
-						})
-
-					case "0201": //投资关系
-						returnData = append(returnData, map[string]interface{}{
-							"b_id":       b_id,
-							"b_name":     b_name,
-							"a_name":     a_name,
-							"a_id":       a_id,
-							"sourceType": "业主的股东",
-						})
-					}
-				}
-				if b_id == v1 {
-					//key := fmt.Sprintf("%s_%s", b_id, a_id)
-					if code == "0101" {
-						//"0101":管辖关系
-						returnData = append(returnData, map[string]interface{}{
-							"b_id":         a_id,
-							"b_name":       a_name,
-							"a_name":       b_name,
-							"a_id":         b_id,
-							"sourceType":   "甲方",
-							"relationship": "业主的下级机构",
-						})
-					}
-				}
-			}
-		}
-	}
-	//供应商  采购单位 供应商     招标代理机构  采购单位  招标代理机构  需要计算合作次数
-	winnerSql := fmt.Sprintf("SELECT  zbtime,project_id,buyer_id,buyer,winner,winner_id,agency_id,agency  FROM  transaction_info WHERE  buyer_id in (%s)", strings.Join(buyerArr, ","))
-	winnerArr := FindConnectionsHandle(winnerSql)
-	if winnerArr != nil && len(winnerArr) > 0 {
-		winnerMap := map[string]map[string]interface{}{}
-		agencyMap := map[string]map[string]interface{}{}
-		for _, m := range winnerArr {
-			buyerId := gconv.String(m["buyer_id"])
-			winner := gconv.String(m["winner"])
-			buyer := gconv.String(m["buyer"])
-			winnerId := gconv.String(m["winner_id"])
-			agency := gconv.String(m["agency"])
-			agencyId := gconv.String(m["agency_id"])
-			projectId := gconv.String(m["project_id"])
-			zbtime := gconv.String(m["zbtime"])
-			key := fmt.Sprintf("%s_%s", buyerId, winnerId)
-			returnData = append(returnData, map[string]interface{}{
-				"b_id":       winnerId,
-				"b_name":     winner,
-				"a_name":     buyer,
-				"a_id":       buyerId,
-				"sourceType": "供应商",
-			})
-			if _, ok := winnerMap[key]; ok {
-				data := winnerMap[key]
-				data["count"] = gconv.Int64(data["data"]) + 1
-				dataList := gconv.Maps(data["list"])
-				dataList = append(dataList, map[string]interface{}{
-					"zbtime":  zbtime,
-					"entName": winner,
-				})
-				data["list"] = dataList
-				winnerMap[key] = data
-			} else {
-				winnerMap[key] = map[string]interface{}{
-					"b_id":       winnerId,
-					"b_name":     winner,
-					"a_name":     buyer,
-					"a_id":       buyerId,
-					"sourceType": "供应商",
-					"count":      1,
-					"list": []map[string]interface{}{
-						{
-							"zbtime":  zbtime,
-							"entName": winner,
-						},
-					},
-				}
-			}
-			key = fmt.Sprintf("%s_%s_%s", buyerId, agencyId, projectId)
-			if _, ok := agencyMap[key]; ok {
-				data := agencyMap[key]
-				data["count"] = gconv.Int64(data["data"]) + 1
-				dataList := gconv.Maps(data["list"])
-				dataList = append(dataList, map[string]interface{}{
-					"zbtime":  zbtime,
-					"entName": winner,
-				})
-				data["list"] = dataList
-				agencyMap[key] = data
-			} else {
-				agencyMap[key] = map[string]interface{}{
-					"b_id":       agencyId,
-					"b_name":     agency,
-					"a_name":     buyer,
-					"a_id":       buyerId,
-					"sourceType": "招标代理",
-					"count":      1,
-					"list": []map[string]interface{}{
-						{
-							"zbtime":  zbtime,
-							"entName": agency,
-						},
-					},
-				}
-			}
-		}
-		for _, m := range winnerMap {
-			returnData = append(returnData, map[string]interface{}{
-				"b_id":         gconv.String(m["b_id"]),
-				"b_name":       gconv.String(m["b_name"]),
-				"a_name":       gconv.String(m["a_name"]),
-				"a_id":         gconv.String(m["a_id"]),
-				"sourceType":   gconv.String(m["sourceType"]),
-				"relationship": gconv.String(m["relationship"]),
-				"count":        gconv.Int64(m["count"]),
-			})
-		}
-		for _, m := range agencyMap {
-			returnData = append(returnData, map[string]interface{}{
-				"b_id":         gconv.String(m["b_id"]),
-				"b_name":       gconv.String(m["b_name"]),
-				"a_name":       gconv.String(m["a_name"]),
-				"a_id":         gconv.String(m["a_id"]),
-				"sourceType":   gconv.String(m["sourceType"]),
-				"relationship": gconv.String(m["relationship"]),
-				"count":        gconv.Int64(m["count"]),
-			})
-		}
-	}
-	return returnData
-}
-
-// 采购单位和项目合并
-func BuyerProjectMerge(dataMap, projectMap *map[string]map[string]interface{}, sourceType string) ([]BuyerProject, int64, int64, int64) {
-	returnData := []BuyerProject{}
-	connectionsNumber := int64(0)
-	highSuccessNumber := int64(0)
-	monitorNumber := int64(0)
-	for buyerId, buyerMap := range *dataMap {
-		if _, ok := (*projectMap)[buyerId]; ok {
-			projectMap := (*projectMap)[buyerId]
-			buyerName := gconv.String(buyerMap["buyerName"])
-			if isMonitor := gconv.Bool(buyerMap["isMonitor"]); isMonitor {
-				monitorNumber++
-			}
-			count := gconv.Int64(projectMap["count"])
-			money := gconv.Int64(projectMap["money"])
-			zbtime := gconv.Int64(projectMap["zbtime"])
-			if sourceType == "1" {
-				if count < 2 {
-					continue
-				}
-				highSuccessNumber++
-				returnData = append(returnData, BuyerProject{
-					BuyerId:   buyerId,
-					BuyerName: buyerName,
-					Project: ProjectEntity{
-						Number:          count,
-						EstimatedAmount: money,
-						Connections:     nil,
-					},
-					Area:   gconv.String(projectMap["area"]),
-					Zbtime: zbtime,
-				})
-			} else {
-				if count > 2 {
-					highSuccessNumber++
-				}
-				returnData = append(returnData, BuyerProject{
-					BuyerId:   buyerId,
-					BuyerName: buyerName,
-					Project: ProjectEntity{
-						Number:          count,
-						EstimatedAmount: money,
-						Connections:     nil,
-					},
-					Area:   gconv.String(projectMap["area"]),
-					Zbtime: zbtime,
-				})
-			}
-		}
-		connectionsNumber++
-	}
-	return returnData, connectionsNumber, highSuccessNumber, monitorNumber
-}
-
-// 已监控数据处理
-func MonitorStatusInit(positionId int64, dataMap *map[string]map[string]interface{}, sourceType string) {
-	monitorMap := map[string]bool{}
-	query := map[string]interface{}{
-		"userId": positionId,
-	}
-	clist, ok := Mgo.Find("follow_customer", query, ``, `{"name":1}`, false, -1, -1)
-	if ok && clist != nil && len(*clist) > 0 {
-		for _, v := range *clist {
-			monitorMap[gconv.String(v["name"])] = true
-		}
-
-	}
-	//采购单位和自己监控的对比
-	newMap := &map[string]map[string]interface{}{}
-	for k, v := range *dataMap {
-		buyerName := gconv.String(v["buyerName"])
-		if _, ok1 := monitorMap[gconv.String(buyerName)]; ok1 {
-			v["isMonitor"] = true
-			(*newMap)[k] = v
-		} else {
-			if sourceType != "2" && sourceType != "1" {
-				v["isMonitor"] = false
-				(*newMap)[k] = v
-			}
-		}
-	}
-	if newMap != nil {
-		dataMap = newMap
-	}
-}
-
-// 处理状态初始化
-func ProcessingStatusInit(positionId int64, dataMap *map[string]map[string]interface{}, processingStatus string) {
-	//未处理
-	untreatedMap := &map[string]bool{}
-	//已忽略
-	ignoredMap := &map[string]bool{}
-	//已创建
-	createdMap := &map[string]bool{}
-	processingArr := CrmMysql.Find(entity.CONNECTION_STATUS, map[string]interface{}{
-		"type":        1,
-		"position id": positionId,
-	}, "relate_id,is_handle,is_ignore,is_create", "", -1, -1)
-	if len(*processingArr) > 0 {
-		for _, v := range *processingArr {
-			entId := gconv.String(v["relate_id"])
-			handle := gconv.Int64(v["is_handle"])
-			ignore := gconv.Int64(v["is_ignore"])
-			create := gconv.Int64(v["is_create"])
-			if handle == 1 {
-				(*untreatedMap)[entId] = true
-			}
-			if ignore == 1 {
-				(*ignoredMap)[entId] = true
-			}
-			if create == 1 {
-				(*createdMap)[entId] = true
-			}
-		}
-	}
-	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 {
-					(*newMap)[buyerId] = value
-				}
-			case "2":
-				if _, ok := (*ignoredMap)[buyerId]; ok {
-					(*newMap)[buyerId] = value
-				}
-			case "3":
-				if _, ok := (*createdMap)[buyerId]; ok {
-					(*newMap)[buyerId] = value
-				}
-			}
-		}
-	}
-	if newMap != nil {
-		dataMap = newMap
-	}
-}
-
-// 采购单位查询
-func BuyerList(partyA, supplier, heterotophy, intermediary, agency string) *map[string]map[string]interface{} {
-	dataMap := &map[string]map[string]interface{}{}
-	//甲方
-	if partyA != "" {
-		for _, v := range strings.Split(partyA, ",") {
-			intermediaryArr := strings.Split(v, "_")
-			if len(intermediaryArr) == 2 {
-				(*dataMap)[intermediaryArr[1]] = map[string]interface{}{
-					"buyerName": intermediaryArr[0],
-				}
-			}
-		}
-	}
-	//供应商 //同甲异业
-	if supplier != "" || heterotophy != "" {
-		findInSetArr := []string{}
-		for _, v := range strings.Split(supplier, ",") {
-			findInSetArr = append(findInSetArr, fmt.Sprintf(" (%s)  in   winner_id", v))
-		}
-		for _, v := range strings.Split(heterotophy, ",") {
-			findInSetArr = append(findInSetArr, fmt.Sprintf(" (%s)  in   winner_id", v))
-		}
-		sqlStr := fmt.Sprintf(`SELECT buyer, buyer_id FROM transaction_info where  (%s)    `, strings.Join(findInSetArr, " or "))
-		FindHandle(sqlStr, dataMap)
-	}
-	//中间人
-	if intermediary != "" {
-		for _, v := range strings.Split(intermediary, ",") {
-			intermediaryArr := strings.Split(v, "_")
-			if len(intermediaryArr) == 2 {
-				(*dataMap)[intermediaryArr[1]] = map[string]interface{}{
-					"buyerName": intermediaryArr[0],
-				}
-			}
-		}
-	}
-	//招标代理
-	if agency != "" {
-		agencyArr := []string{}
-		for _, s := range strings.Split(agency, ",") {
-			agencyArr = append(agencyArr, fmt.Sprintf("'%s'"), s)
-		}
-		sqlStr := fmt.Sprintf(`SELECT buyer, buyer_id FROM transaction_info  where agency_id in (%s)   order by  userid`, strings.Join(agencyArr, ","))
-		FindHandle(sqlStr, dataMap)
-	}
-	return dataMap
-}
-
-// 项目数量查询
-func ProjectHandle(buyerArr []string, area string) *map[string]map[string]interface{} {
-	sqlStr := ""
-	if area != "" {
-		sqlStr = fmt.Sprintf(`SELECT buyer_id,area, count(1)  AS group_count FROM information.transaction_info WHERE buyer_id IN (%s) and  area ="%s" GROUP BY buyer_id,area `, strings.Join(buyerArr, ","), area)
-	} else {
-		sqlStr = fmt.Sprintf(`SELECT buyer_id,area, count(1)  AS group_count FROM information.transaction_info WHERE buyer_id IN (%s) GROUP BY buyer_id,area `, strings.Join(buyerArr, ","))
-	}
-	logx.Info(sqlStr)
-	rows, err := ClickhouseConn.Query(context.Background(), sqlStr)
-	projectMap := &map[string]map[string]interface{}{}
-	if err != nil {
-		return projectMap
-	}
-	for rows.Next() {
-		data := Project{}
-		rows.ScanStruct(&data)
-		if (*projectMap)[data.BuyerId] != nil {
-			dataMap := (*projectMap)[data.BuyerId]
-			dataMap[data.BuyerId] = map[string]interface{}{
-				"area":   Deduplication(gconv.String(dataMap["area"]), data.Area),
-				"count":  gconv.Int64(dataMap["count"]) + data.GroupCount,
-				"money":  gconv.Int64(dataMap["money"]) + data.Money,
-				"zbtime": gconv.Int64(dataMap["Zbtime"]),
-			}
-		} else {
-			(*projectMap)[data.BuyerId] = map[string]interface{}{
-				"area":   gconv.String(data.Area),
-				"count":  data.GroupCount,
-				"money":  data.Money,
-				"zbtime": data.Zbtime,
-			}
-		}
-	}
-	return projectMap
-}
-
-// 采购单位查询sql
-func FindHandle(sqlStr string, dataMap *map[string]map[string]interface{}) {
-	rows, err := ClickhouseConn.Query(context.Background(), sqlStr)
-	if err != nil {
-		logx.Error("查询失败", sqlStr, err)
-	}
-	for rows.Next() {
-		data := Recommend{}
-		rows.ScanStruct(&data)
-		(*dataMap)[data.buyerId] = map[string]interface{}{
-			"buyerName": data.buyer,
-		}
-	}
-	return
-}
-
-// 人脉信息查询sql
-func FindConnectionsHandle(sqlStr string) []map[string]interface{} {
-	returnData := []map[string]interface{}{}
-	rows, err := ClickhouseConn.Query(context.Background(), sqlStr)
-	if err != nil {
-		logx.Error("查询失败", sqlStr, err)
-	}
-	for rows.Next() {
-		data := map[string]interface{}{}
-		rows.ScanStruct(&data)
-		returnData = append(returnData, data)
-	}
-	return returnData
-}
-
-// 去重处理
-func Deduplication(a, b string) string {
-	newArr := []string{}
-	if a != "" || b != "" {
-		foo := false
-		newArr := strings.Split(a, ",")
-		for _, v := range newArr {
-			if v == b {
-				foo = true
-			}
-		}
-		if !foo {
-			newArr = append(newArr, b)
-		}
-	}
-	return strings.Join(newArr, ",")
-}