Forráskód Böngészése

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

* dev/v1.0.4_wjh:
  xg
Jianghan 1 éve
szülő
commit
3c4e02d56e

+ 6 - 7
api/common/initconfig.go

@@ -22,7 +22,6 @@ import (
 	"github.com/ClickHouse/clickhouse-go/v2/lib/driver"
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/core/logx"
-	"github.com/zeromicro/go-zero/zrpc"
 )
 
 var configFile = flag.String("fs", "etc/crmapplication.yaml", "the config file")
@@ -170,12 +169,12 @@ func InitConf() {
 		NewEs(DB.Es.Version, DB.Es.Addr, DB.Es.Size, DB.Es.UserName, DB.Es.Password)
 	}
 
-	UserCenterRpc = usercenter.NewUserCenter(zrpc.MustNewClient(C.UserCenterRpc))
-	FileCenterRpc = filecenter.NewFileCenter(zrpc.MustNewClient(C.FileCenterRpc))
-	BaseCenterRpc = basecenter.NewBaseCenter(zrpc.MustNewClient(C.BaseCenterRpc))
-	SocialPlatformRpc = social.NewSocial(zrpc.MustNewClient(C.SocialPlatformRpc))
-	Middleground = middleground.NewMiddleground(C.BaseCenterRpc.Etcd.Hosts).
-		RegResourceCenter(C.ResourceCenterKey)
+	//UserCenterRpc = usercenter.NewUserCenter(zrpc.MustNewClient(C.UserCenterRpc))
+	//FileCenterRpc = filecenter.NewFileCenter(zrpc.MustNewClient(C.FileCenterRpc))
+	//BaseCenterRpc = basecenter.NewBaseCenter(zrpc.MustNewClient(C.BaseCenterRpc))
+	//SocialPlatformRpc = social.NewSocial(zrpc.MustNewClient(C.SocialPlatformRpc))
+	//Middleground = middleground.NewMiddleground(C.BaseCenterRpc.Etcd.Hosts).
+	//	RegResourceCenter(C.ResourceCenterKey)
 	/*	Middleground = middleground.NewMiddleground([]string{"192.168.3.206:2379"}).
 		RegResourceCenter(C.ResourceCenterKey)*/
 	conf.MustLoad(*pushFile, &Push)

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

@@ -1,32 +0,0 @@
-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
-}

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

@@ -29,7 +29,7 @@ func (l *ProjectListLogic) ProjectList(req *types.ProjectListReq) (resp *types.R
 	list, hasNextPage, count := service.GetProjectList(req)
 	resp.Data = map[string]interface{}{
 		"list":        list,
-		"count":       count,
+		"total":       count,
 		"hasNextPage": hasNextPage,
 	}
 	return

+ 22 - 19
api/internal/service/plistService.go

@@ -26,21 +26,22 @@ type ProjectData struct {
 
 type ProjectEntry struct {
 	ProjectId   string   `ch:"project_id"`
-	projectName string   `ch:"project_name"`
+	ProjectName string   `ch:"project_name"`
 	Buyer       string   `ch:"buyer"`
 	BuyerId     string   `ch:"buyer_id"`
 	Winner      []string `ch:"winner"`
+	WinnerId    []string `ch:"winner_id"`
 	Area        string   `ch:"area"`
-	city        string   `ch:"city"`
+	City        string   `ch:"city"`
 	District    string   `ch:"district"`
 	ZbTime      int64    `ch:"zbtime"`
 	EndTime     int64    `ch:"endtime"`
-	IsHandle    int      `json:"is_handle"`
-	IsIgnore    int      `json:"is_ignore"`
-	IsCreate    int      `json:"is_create"`
-	MyConn      bool     `json:"my_conn"`
-	ConnType    int      `json:"conn_type"`
-	HighSuccess bool     `json:"high_success"`
+	IsHandle    int      `json:"IsHandle"`
+	IsIgnore    int      `json:"IsIgnore"`
+	IsCreate    int      `json:"IsCreate"`
+	MyConn      bool     `json:"MyConn"`
+	ConnType    int      `json:"ConnType"`
+	HighSuccess bool     `json:"HighSuccess"`
 }
 
 func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasNextPage bool, total int) {
@@ -57,7 +58,7 @@ func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasN
 	if req.SaleStatus == 0 {
 		isSqlPage = true // 是否sql分页
 	}
-	findSql := getQuerySql(req, isSqlPage, buyerArr)
+	countSql, findSql := getQuerySql(req, isSqlPage, buyerArr)
 	rows, err := T.ClickhouseConn.Query(context.TODO(), findSql)
 	defer rows.Close()
 	if err != nil {
@@ -65,7 +66,7 @@ func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasN
 	}
 	for rows.Next() {
 		project := ProjectEntry{}
-		rows.Scan(&project)
+		_ = rows.ScanStruct(&project)
 		resultList = append(resultList, &project)
 	}
 
@@ -79,14 +80,15 @@ func GetProjectList(req *types.ProjectListReq) (resultList []*ProjectEntry, hasN
 			resultList = resultList[:pageSize]
 		}
 		total = len(resultList)
-		if total > pageSize {
-			hasNextPage = true
-		} else {
-			hasNextPage = false
-		}
+	} else {
+		_ = T.ClickhouseConn.QueryRow(context.TODO(), countSql).Scan(&total) //sql分页,查询总数
 	}
-
-	moreInfo(req, resultList)
+	if total > pageSize {
+		hasNextPage = true
+	} else {
+		hasNextPage = false
+	}
+	moreInfo(req, resultList) //  补充信息
 
 	return
 }
@@ -105,7 +107,7 @@ func preSalesStatus(posid int64) (m1 map[string]interface{}) {
 	return m1
 }
 
-func getQuerySql(req *types.ProjectListReq, isPage bool, buyerArr []string) (findSql string) {
+func getQuerySql(req *types.ProjectListReq, isPage bool, buyerArr []string) (countSql, findSql string) {
 	querys := []string{}
 	// 左侧选中的业主id
 	if len(buyerArr) > 0 {
@@ -197,6 +199,7 @@ func getQuerySql(req *types.ProjectListReq, isPage bool, buyerArr []string) (fin
 		}
 		querys = append(querys, fmt.Sprintf(" a.property_form in (%s) ", strings.Join(arr, ",")))
 	}
+	countSql = fmt.Sprintf("select count(1) from %s where %s ", "information.transaction_info", strings.Join(querys, " and "))
 	findSql = "select a.project_id, a.project_name, a.buyer, a.buyer_id, a.winner, a.winner_id, a.area, a.city, a.district, a.zbtime, a.endtime "
 	findSql = fmt.Sprintf("%s from %s  a  where  %s ", findSql, "information.transaction_info", strings.Join(querys, " and "))
 	if isPage {
@@ -278,7 +281,7 @@ func moreInfo(req *types.ProjectListReq, list []*ProjectEntry) (result []*Projec
 
 		// 人脉路径
 		// 有我的人脉标签时不需要查询人脉路径信息
-		if m.MyConn == false {
+		if m.MyConn == false && m.BuyerId != "" {
 			ConnectionsHandle([]string{m.BuyerId}, req.PositionId, false)
 		}
 	}