فهرست منبع

wip:提交查询

wangkaiyue 2 سال پیش
والد
کامیت
685ca4d6c7
2فایلهای تغییر یافته به همراه33 افزوده شده و 4 حذف شده
  1. 14 3
      jyBXSubscribe/rpc/internal/logic/getsublistlogic.go
  2. 19 1
      jyBXSubscribe/rpc/model/push.go

+ 14 - 3
jyBXSubscribe/rpc/internal/logic/getsublistlogic.go

@@ -6,6 +6,7 @@ import (
 	"jyBXSubscribe/rpc/internal/svc"
 	"jyBXSubscribe/rpc/model"
 	"jyBXSubscribe/rpc/type/bxsubscribe"
+	"strings"
 	"time"
 
 	"app.yhyue.com/moapp/jybase/common"
@@ -39,6 +40,13 @@ func (l *GetSubListLogic) GetSubList(in *bxsubscribe.SubscribeInfosReq) (*bxsubs
 	if in.PageNum == 1 {
 		go model.UpdateUserPushUnread(in.UserId, in.UserType)
 	}
+	//分发员工
+	var staffIds []string
+	for _, staffId := range strings.Split(in.Staffs, ",") {
+		if staffId != "" {
+			staffIds = append(staffIds, staffId)
+		}
+	}
 	spqp := &model.SubPushQueryParam{
 		Mgo_bidding:      IC.MgoBidding,                      //mongo
 		Bidding:          IC.DB.Mongo.Bidding.Collection,     //招标信息 表
@@ -55,9 +63,12 @@ func (l *GetSubListLogic) GetSubList(in *bxsubscribe.SubscribeInfosReq) (*bxsubs
 		Key:              in.KeyWords,                        //关键词
 		Price:            in.Price,                           //价格区间
 		FileExists:       in.FileExists,                      //是否有附件
-		EntId:            in.EntId,                           //商机管理企业id
-		EntUserId:        in.EntUserId,                       //商机管理用户id
-		DeptId:           in.DeptId,                          //商机管理部门id
+		IsRead:           in.IsRead,
+		Source:           in.Source,
+		Staffs:           staffIds,
+		EntId:            in.EntId,     //商机管理企业id
+		EntUserId:        in.EntUserId, //商机管理用户id
+		DeptId:           in.DeptId,    //商机管理部门id
 		NewUserId:        in.NewUserId,
 		BaseServiceMysql: IC.BaseServiceMysql,
 		IsEnt:            in.IsEnt,

+ 19 - 1
jyBXSubscribe/rpc/model/push.go

@@ -98,6 +98,9 @@ type SubPushQueryParam struct {
 	FileExists       string             //是否有附件;默认全部;1:有附件;-1:无附件
 	EntUserId        string             //商机管理用户id
 	DeptId           string             //商机管理用户部门id
+	IsRead           string             //是否已读
+	Source           string             //信息来源
+	Staffs           []string           //分发人员
 	BaseServiceMysql *mysql.Mysql
 	NewUserId        int64
 	IsEnt            bool
@@ -370,6 +373,19 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 		} else if starttime == 0 && endtime > 0 {
 			userStr += fmt.Sprintf(" and a.date<=%d", endtime)
 		}
+		// 是否已读
+		if spqp.IsRead != "" {
+			if spqp.IsRead == "0" {
+				userStr += " and a.isvisit=0"
+			} else if spqp.IsRead == "1" {
+				userStr += " and a.isvisit=1"
+			}
+		}
+		// 信息来源
+		if spqp.Source == "1" || spqp.Source == "2" || spqp.Source == "3" {
+			userStr += " and a.source=" + spqp.Source
+		}
+
 		if spqp.Area != "" || spqp.City != "" {
 			var sqlAreaCity = ""
 			//城市
@@ -509,7 +525,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 			}
 			//判断是企业管理员还是部门管理员 部门管理员获取所有子部门
 			userEnt := EntInfo(common.IntAll(spqp.EntId), common.IntAll(spqp.EntUserId))
-			if userEnt.Role_admin_department { //部门管理员 获取所有部门和子部门员工
+			if userEnt.Role_admin_department && len(spqp.Staffs) == 0 { //部门管理员 获取所有部门和子部门员工
 				users := GetDisUsers(common.IntAll(spqp.EntId), userEnt.Dept.Id)
 				var userIds []string
 				if users != nil && len(*users) > 0 {
@@ -522,6 +538,8 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 					result = []*bxsubscribe.SubscribeInfo{}
 					return
 				}
+			} else if len(spqp.Staffs) != 0 {
+				userStr += fmt.Sprintf(" and  a.userid in (%s)  ", strings.Join(spqp.Staffs, ","))
 			}
 
 			//查询数量(需要去重)