Jianghan 1 год назад
Родитель
Сommit
fab5a2bdaa

+ 80 - 67
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,18 +183,30 @@ 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
 	}
 	ProjectListReq {
-
+		pageNum      int64  `json:"pageNum"`
+		pageSize     int64  `json:"pageSize"`
+		businessType string `json:"businessType"`
+		saleStatus   string `json:"saleStatus"`
+		projectName  string `json:"projectName"`
+		startTime    int64  `json:"startTime"`
+		entTime      int64  `json:"entTime"`
+		area         string `json:"area"`
+		city         string `json:"city"`
+		district     string `json:"district"`
+		propertyForm string `json:"propertyForm"`
+		subClass     string `json:"subClass"`
+		amount       string `json:"amount"`
 	}
 	PnameAssReq {
-		ProjectName		string `json:"projectName"`
+		ProjectName string `json:"projectName"`
 	}
 	CoopHistoryReq {
-		ProjectName		string `json:"projectName"`
+		Pid string `json:"porjectId"`
 	}
 )
 
@@ -253,13 +265,14 @@ service crmApplication {
 
 	@doc "人脉可达商机列表"
 	@handler projectList
-	post /crmApplication/network/project/list (ProjectListReq) returns ()
+	post /crmApplication/network/project/list (ProjectListReq) returns (Reply)
 
 	@doc "项目公关渠道分析-项目名称联想"
 	@handler PrPnameAss
-	post /crmApplication/pr/pname/ass (PnameAssReq) returns ()
+	post /crmApplication/pr/pname/ass (PnameAssReq) returns (Reply)
 
 	@doc "项目公关渠道分析-与业主合作历史"
 	@handler CoopHistoryList
-	post /crmApplication/pr/coop/history (CoopHistoryReq) returns ()
-}
+	post /crmApplication/pr/coop/history (CoopHistoryReq) returns (Reply)
+}
+

BIN
api/application_api


+ 28 - 0
api/internal/handler/coophistorylisthandler.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 CoopHistoryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.CoopHistoryReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := logic.NewCoopHistoryListLogic(r.Context(), svcCtx)
+		err := l.CoopHistoryList(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.Ok(w)
+		}
+	}
+}

+ 28 - 0
api/internal/handler/projectlisthandler.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 projectListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.ProjectListReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := logic.NewProjectListLogic(r.Context(), svcCtx)
+		err := l.ProjectList(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.Ok(w)
+		}
+	}
+}

+ 28 - 0
api/internal/handler/prpnameasshandler.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 PrPnameAssHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.PnameAssReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := logic.NewPrPnameAssLogic(r.Context(), svcCtx)
+		err := l.PrPnameAss(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.Ok(w)
+		}
+	}
+}

+ 33 - 18
api/internal/handler/routes.go

@@ -19,8 +19,18 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/saleChance/add",
-				Handler: saleChanceAddHandler(serverCtx),
+				Path:    "/crmApplication/custom/add",
+				Handler: customAddHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/crmApplication/employ/distribute",
+				Handler: employDistributeHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/crmApplication/employ/info",
+				Handler: employInfoHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
@@ -29,8 +39,13 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/information/transfer",
-				Handler: transferHandler(serverCtx),
+				Path:    "/crmApplication/ent/info",
+				Handler: entinfoHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/crmApplication/file/upload",
+				Handler: fileUploadHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
@@ -39,38 +54,38 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/employ/info",
-				Handler: employInfoHandler(serverCtx),
+				Path:    "/crmApplication/info/canAdd",
+				Handler: canAddReqHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/custom/add",
-				Handler: customAddHandler(serverCtx),
+				Path:    "/crmApplication/info/push",
+				Handler: pushMsgHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/file/upload",
-				Handler: fileUploadHandler(serverCtx),
+				Path:    "/crmApplication/information/transfer",
+				Handler: transferHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/employ/distribute",
-				Handler: employDistributeHandler(serverCtx),
+				Path:    "/crmApplication/network/project/list",
+				Handler: projectListHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/ent/info",
-				Handler: entinfoHandler(serverCtx),
+				Path:    "/crmApplication/pr/coop/history",
+				Handler: CoopHistoryListHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/info/push",
-				Handler: pushMsgHandler(serverCtx),
+				Path:    "/crmApplication/pr/pname/ass",
+				Handler: PrPnameAssHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/crmApplication/info/canAdd",
-				Handler: canAddReqHandler(serverCtx),
+				Path:    "/crmApplication/saleChance/add",
+				Handler: saleChanceAddHandler(serverCtx),
 			},
 		},
 		rest.WithMaxBytes(104857600),

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

@@ -0,0 +1,29 @@
+package logic
+
+import (
+	"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 CoopHistoryListLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewCoopHistoryListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CoopHistoryListLogic {
+	return &CoopHistoryListLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *CoopHistoryListLogic) CoopHistoryList(req *types.CoopHistoryReq) (resp *types.Reply, err error) {
+
+	return
+}

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

@@ -0,0 +1,36 @@
+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 ProjectListLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewProjectListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ProjectListLogic {
+	return &ProjectListLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *ProjectListLogic) ProjectList(req *types.ProjectListReq) (resp *types.Reply, err error) {
+	resp = &types.Reply{}
+	list, hasNextPage, count := service.GetProjectList(req)
+	resp.Data = map[string]interface{}{
+		"list":        list,
+		"count":       count,
+		"hasNextPage": hasNextPage,
+	}
+	return
+}

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

@@ -0,0 +1,45 @@
+package logic
+
+import (
+	elastic "app.yhyue.com/moapp/jybase/esv7"
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/svc"
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
+	"context"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+var (
+	INDEX      = "bidding"
+	findfields = `"projectp_name", "project_id"`
+)
+
+type PrPnameAssLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewPrPnameAssLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PrPnameAssLogic {
+	return &PrPnameAssLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *PrPnameAssLogic) PrPnameAss(req *types.PnameAssReq) (resp *types.Reply, err error) {
+	resp = &types.Reply{}
+	if req.ProjectName != "" {
+		esq := `{"query": {"bool": {"must": [{"match": {"projectname.pname": [` + req.ProjectName + ` ]}}]}}}`
+		binfo := elastic.GetAllByNgram(INDEX, INDEX, esq, findfields, "", "", 0, 10, 0, false)
+		if binfo != nil && len(*binfo) > 0 {
+			resp.Error_code = 0
+			resp.Data = *binfo
+		}
+	} else {
+		resp.Error_code = -1
+		resp.Error_msg = "项目名称不能为空"
+	}
+	return
+}

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

@@ -0,0 +1,133 @@
+package service
+
+import (
+	"app.yhyue.com/moapp/jybase/common"
+	P "app.yhyue.com/moapp/jybase/mapping"
+	"bp.jydev.jianyu360.cn/CRM/application/api/internal/types"
+	"fmt"
+	"strings"
+)
+
+const (
+	pageSize = 100
+)
+
+type ProjectData struct {
+	count       int64
+	hasNextPage bool
+	pList       []*ProjectEntry
+}
+
+type ProjectEntry struct {
+	projectName string
+}
+
+func GetProjectList(req *types.ProjectListReq) (resultList []interface{}, hasNextPage bool, total int) {
+
+	getSql(req)
+
+	total = len(resultList)
+	if total > pageSize {
+		resultList = resultList[:pageSize]
+		hasNextPage = true
+	}
+	return
+}
+
+func getSql(req *types.ProjectListReq) (countSql, findSql string) {
+	querys := []string{}
+	//	商机类型
+	if req.BusinessType != "" {
+		querys = append(querys, fmt.Sprintf(" a.business_type in (%s) ", req.BusinessType))
+	}
+	if req.ProjectName != "" {
+		querys = append(querys, " a.projectname like '% "+req.ProjectName+"%'")
+	}
+	if req.StartTime > 0 && req.EntTime > 0 {
+		st := req.StartTime + 90*24*60*60
+		et := req.StartTime + 90*24*60*60
+		querys = append(querys, fmt.Sprintf("  a.endtime>=%d and a.endtime<=%d", st, et))
+	} else if req.StartTime > 0 && req.EntTime == 0 {
+		st := req.StartTime + 90*24*60*60
+		querys = append(querys, fmt.Sprintf(" a.endtime>=%d", st))
+	} else if req.StartTime == 0 && req.EntTime > 0 {
+		et := req.StartTime + 90*24*60*60
+		querys = append(querys, fmt.Sprintf(" a.endtime<=%d", et))
+	} else {
+		querys = append(querys, " a.endtime>0")
+	}
+	var regionArr = []string{}
+	if req.Area != "" || req.City != "" || req.District != "" {
+		//城市
+		city := []string{}
+		for _, v := range strings.Split(req.City, ",") {
+			if P.BidCodeMapping.City[v] != "" {
+				city = append(city, fmt.Sprint(P.BidCodeMapping.City[v]))
+			}
+		}
+		if len(city) > 0 {
+			regionArr = append(regionArr, fmt.Sprintf(" a.city in (%s) ", strings.Join(city, ",")))
+		}
+		//区域
+		area := []string{}
+		for _, v := range strings.Split(req.Area, ",") {
+			if P.BidCodeMapping.Area[v] != "" {
+				area = append(area, fmt.Sprint(P.BidCodeMapping.Area[v]))
+			}
+		}
+		if len(area) > 0 {
+			regionArr = append(regionArr, fmt.Sprintf(" a.area in (%s) ", strings.Join(area, ",")))
+		}
+		//区域
+		district := []string{}
+		if req.District != "" {
+			for _, v := range strings.Split(req.District, ",") {
+				cityName := strings.Split(v, "_")[0]
+				districtName := strings.Split(v, "_")[1]
+				if P.BidCodeMapping.District[cityName][districtName] != "" {
+					district = append(district, fmt.Sprint(P.BidCodeMapping.District[cityName][districtName]))
+				}
+			}
+		}
+		if len(district) > 0 {
+			regionArr = append(regionArr, fmt.Sprintf(" a.district in (%s) ", strings.Join(district, ",")))
+		}
+		if len(regionArr) > 0 {
+			querys = append(querys, fmt.Sprintf("(%s)", strings.Join(regionArr, "or")))
+		}
+	}
+	if req.SubClass != "" {
+		arr := []string{}
+		for _, v := range strings.Split(req.SubClass, ",") {
+			arr = append(arr, fmt.Sprintf(`"物业_%s"`, v))
+		}
+		querys = append(querys, fmt.Sprintf(" a.subclass in (%s) ", strings.Join(regionArr, ",")))
+	}
+	// 项目金额
+	if req.Amount != "" && strings.Contains(req.Amount, "-") {
+		minPriceStr, maxPriceStr := strings.Split(req.Amount, "-")[0], strings.Split(req.Amount, "-")[1]
+		minPrice := common.Int64All(common.Float64All(minPriceStr) * 10000) //换成元
+		maxPrice := common.Int64All(common.Float64All(maxPriceStr) * 10000) //换成元
+		if minPriceStr != "" && maxPriceStr != "" {
+			querys = append(querys, fmt.Sprintf("((a.project_money>=%d and a.project_money<=%d))", minPrice, maxPrice))
+		} else if minPriceStr != "" {
+			querys = append(querys, fmt.Sprintf("(a.project_money>=%d)", minPrice))
+		} else if maxPriceStr != "" {
+			querys = append(querys, fmt.Sprintf("(a.project_money<=%d)", maxPrice))
+		}
+	}
+	//物业业态
+	if req.PropertyForm != "" {
+		arr := []string{}
+		for _, v := range strings.Split(req.PropertyForm, ",") {
+			arr = append(arr, fmt.Sprintf(`"%s"`, v))
+		}
+		querys = append(querys, fmt.Sprintf(" a.property_form in (%s) ", strings.Join(arr, ",")))
+	}
+
+	//查询数量
+	countSql = fmt.Sprintf("select count(1) as count from %s  a  where  %s   %s", "", userStr, strings.Join(querys, " and "))
+	//列表查询语句
+	findSql = "select a.id,a.date,a.infoid,a.matchways,a.isvisit,REPLACE(a.matchkeys,'+',' ') as matchkeys,a.type,a.attachment_count"
+	return
+}

+ 134 - 110
api/internal/types/types.go

@@ -1,17 +1,17 @@
 // Code generated by goctl. DO NOT EDIT.
 package types
 
-type Reply struct {
-	Error_code int64       `json:"error_code"`
-	Error_msg  string      `json:"error_msg"`
-	Data       interface{} `json:"data"`
-}
-
-type InfoReply struct {
-	Error_code  int64       `json:"error_code"`
-	Error_msg   string      `json:"error_msg"`
-	Data        interface{} `json:"data"`
-	BatchEmploy int64       `json:"batchEmploy"`
+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 ClueAddReq struct {
@@ -33,81 +33,8 @@ type ClueAddReq struct {
 	Channel      string  `json:"channel"`               //渠道来源:网页、手动创建
 }
 
-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"`
-	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 CoopHistoryReq struct {
+	Pid string `json:"porjectId"`
 }
 
 type CustomAddReq struct {
@@ -142,15 +69,10 @@ type CustomAddReq struct {
 	BusinessId           int64   `json:"businessId,optional"`              //商机收录id(人脉)
 }
 
-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 DistributePerson struct {
+	PositionId int64 `json:"positionId"`
+	EntUserId  int64 `json:"entUserId"`
+	EntDeptId  int64 `json:"entDeptId"`
 }
 
 type EmployDistributeReq struct {
@@ -165,16 +87,88 @@ type EmployDistributeReq struct {
 	EntDeptId   int64              `header:"entDeptId,optional"`
 }
 
-type DistributePerson struct {
-	PositionId int64 `json:"positionId"`
-	EntUserId  int64 `json:"entUserId"`
-	EntDeptId  int64 `json:"entDeptId"`
+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 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 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 PnameAssReq struct {
+	ProjectName string `json:"projectName"`
+}
+
+type ProjectListReq struct {
+	PageNum      int64  `json:"pageNum"`
+	PageSize     int64  `json:"pageSize"`
+	BusinessType string `json:"businessType"`
+	SaleStatus   string `json:"saleStatus"`
+	ProjectName  string `json:"projectName"`
+	StartTime    int64  `json:"startTime"`
+	EntTime      int64  `json:"entTime"`
+	Area         string `json:"area"`
+	City         string `json:"city"`
+	District     string `json:"district"`
+	PropertyForm string `json:"propertyForm"`
+	SubClass     string `json:"subClass"`
+	Amount       string `json:"amount"`
+}
+
 type PushMsgReq struct {
 	AppId      string  `header:"appId,default=10000"`
 	BaseUserId int64   `header:"newUserId"`
@@ -189,15 +183,45 @@ type PushMsgReq struct {
 	MsgType    string  `json:"msgType"`       //消息类型 1-活动优惠 2-服务通知 3-订阅消息 4-项目动态 5-企业动态 6-分析报告 7-系统通知 11-待办
 }
 
-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 Reply struct {
+	Error_code int64       `json:"error_code"`
+	Error_msg  string      `json:"error_msg"`
+	Data       interface{} `json:"data"`
+}
+
+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 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"`
 }