浏览代码

情报详情

Jianghan 1 年之前
父节点
当前提交
a414659b45

+ 7 - 0
api/application.api

@@ -290,6 +290,9 @@ type (
 		Source     int    `json:"source,optional"`
 		Action     int    `json:"action,optional"`
 	}
+	InfoDetailReq {
+		InfoId string `json:"infoId"`
+	}
 )
 
 @server (
@@ -380,5 +383,9 @@ service crmApplication {
 	@doc "忽略操作"
 	@handler ignoreAction
 	post /crmApplication/ignore/action (IgnoreReq) returns (Reply)
+
+	@doc "情报详情"
+	@handler infoDetail
+	post /crmApplication/infomation/detail (InfoDetailReq) returns (Reply)
 }
 

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

+ 5 - 0
api/internal/handler/routes.go

@@ -67,6 +67,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 				Path:    "/crmApplication/info/push",
 				Handler: pushMsgHandler(serverCtx),
 			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/crmApplication/infomation/detail",
+				Handler: infoDetailHandler(serverCtx),
+			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/crmApplication/information/transfer",

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

@@ -0,0 +1,56 @@
+package logic
+
+import (
+	"app.yhyue.com/moapp/jybase/common"
+	T "bp.jydev.jianyu360.cn/CRM/application/api/common"
+	"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 InfoDetailLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewInfoDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *InfoDetailLogic {
+	return &InfoDetailLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+type Infomation struct {
+	Title       string `json:"title"`
+	Summary     string `json:"summary"`
+	Content     string `json:"content"`
+	DataJsonId  string `json:"datajson_id"`
+	Area        string `json:"area"`
+	City        string `json:"city"`
+	Basis       string `json:"basis"`
+	ProjectName string `json:"project_name"`
+}
+
+func (l *InfoDetailLogic) InfoDetail(req *types.InfoDetailReq) (resp *types.Reply, err error) {
+	resp = &types.Reply{}
+	sql := `SELECT title, summary, content, datajson_id, area, city, basis FROM information.information WHERE id = ?`
+	info := &Infomation{}
+	err = T.ClickhouseConn.QueryRow(context.TODO(), sql, req.InfoId).ScanStruct(info)
+	if err != nil {
+		binfo, b := T.MgoBidding.FindById("bidding", info.DataJsonId, map[string]interface{}{"title": 1, "projectname": 1})
+		if b && binfo != nil && len(*binfo) > 0 {
+			info.ProjectName = common.ObjToString((*binfo)["projectname"])
+		}
+		resp.Data = info
+	} else {
+		resp.Error_code = -1
+		resp.Error_msg = "未查询到情报信息"
+	}
+
+	return
+}

+ 26 - 3
api/internal/service/CoopHistoryService.go

@@ -15,6 +15,7 @@ var (
 	INDEX_1  = "transaction_info"
 	sql_2_0  = `SELECT buyer, buyer_id, agency, agency_id, property_form FROM information.transaction_info WHERE project_id = ?`
 	sql_2_1  = `SELECT project_id, project_name, zbtime FROM information.transaction_info WHERE buyer_id = ? AND winner winner IN ? ORDER BY zbtime DESC`
+	sql_2_2  = `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 b.position_id =%d AND a.connection_id = b.id AND b.state = 1 AND a.itype = 1 AND b.itype = 4 AND a.relate_Id = %s`
 	es_query = `{
 	  "query": {
 		"bool": {
@@ -99,7 +100,7 @@ func GetPrList(req *types.CoopHistoryReq) (result []*ResultData) {
 	// 1、同甲异业数据/招标代理机构渠道
 	if propertyForm != "" {
 		r1, r2 := getData(propertyForm, common.ObjToString(pMap["buyer_id"]))
-		if len(r1) > 0 {
+		if r1 != nil && len(r1) > 0 {
 			tmp := &ResultData{
 				channelType: 1,
 				channel:     "同甲异业渠道",
@@ -108,16 +109,28 @@ func GetPrList(req *types.CoopHistoryReq) (result []*ResultData) {
 			}
 			result = append(result, tmp)
 		}
-		if len(r2) > 0 {
+		if r2 != nil && len(r2) > 0 {
 			tmp := &ResultData{
 				channelType: 1,
 				channel:     "招标代理机构",
-				size:        len(r1),
+				size:        len(r2),
 				data:        r2,
 			}
 			result = append(result, tmp)
 		}
 	}
+	// 中间人可介绍业主
+	r3 := getData1(req)
+	if r3 != nil && len(r3) > 0 {
+		tmp := &ResultData{
+			channelType: 1,
+			channel:     "中间人",
+			size:        len(r3),
+			data:        r3,
+		}
+		result = append(result, tmp)
+	}
+
 	return
 }
 
@@ -217,3 +230,13 @@ func getData(propertyForm, bid string) (result1, result2 []map[string]interface{
 	}
 	return
 }
+
+func getData1(req *types.CoopHistoryReq) (result []map[string]interface{}) {
+	info := T.CrmMysql.SelectBySql(sql_2_2, req.PositionId, req.Pid)
+	if info != nil && len(*info) > 0 {
+		for _, m := range *info {
+			result = append(result, map[string]interface{}{"name": m["company_name"], "pserson": m["contact_name"]})
+		}
+	}
+	return
+}

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

@@ -44,7 +44,7 @@ type ProjectEntry struct {
 func GetProjectList(req *types.ProjectListReq) (resultList []map[string]interface{}, hasNextPage bool, total int) {
 
 	buyerM := service.BuyerList(req.PartyA, req.Supplier, req.Heterotophy, req.Intermediary, req.Agency)
-	service.MonitorStatusInit(req.PositionId, buyerM, t.SourceType)
+	service.MonitorStatusInit(req.PositionId, buyerM, "0")
 
 	preSales := preSalesStatus(req.PositionId)
 	isSqlPage := false

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

@@ -174,6 +174,10 @@ type IgnoreReq struct {
 	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"`