duxin 2 ani în urmă
părinte
comite
3f419ddb15

+ 25 - 17
jyBXSubscribe/rpc/internal/logic/bypushhistorylogic.go

@@ -2,6 +2,7 @@ package logic
 
 
 import (
 import (
 	"context"
 	"context"
+	"fmt"
 	"github.com/zeromicro/go-zero/core/logx"
 	"github.com/zeromicro/go-zero/core/logx"
 	IC "jyBXSubscribe/rpc/init"
 	IC "jyBXSubscribe/rpc/init"
 	"jyBXSubscribe/rpc/internal/svc"
 	"jyBXSubscribe/rpc/internal/svc"
@@ -31,24 +32,31 @@ func (l *ByPushHistoryLogic) ByPushHistory(in *bxsubscribe.SubscribeInfosReq) (*
 	// todo: add your logic here and delete this line
 	// todo: add your logic here and delete this line
 	vipType := in.UserType
 	vipType := in.UserType
 	spqp := &model.SubPushQueryParam{
 	spqp := &model.SubPushQueryParam{
-		Mgo_bidding:   IC.MgoBidding,                      //mongo
-		Bidding:       IC.DB.Mongo.Bidding.Collection,     //招标信息 表
-		Bidding_back:  IC.DB.Mongo.Bidding.CollectionBack, //招标信息备份数据 表名
-		UserId:        in.UserId,                          //用户id
-		PageNum:       1,                                  //当前页码
-		PageSize:      20000,
-		Export:        true,
-		SelectTime:    in.SelectTime, //时间跨度
-		Area:          in.Area,       //省份
-		City:          in.City,       //城市
-		Buyerclass:    in.BuyerClass, //采购单位类型
-		Subtype:       in.Subtype,    //信息类型
-		Subscopeclass: in.Industry,   //行业
-		Key:           in.KeyWords,   //关键词
-		Price:         in.Price,      //价格区间
-		FileExists:    in.FileExists, //是否有附件
+		Mgo_bidding:      IC.MgoBidding,                      //mongo
+		Bidding:          IC.DB.Mongo.Bidding.Collection,     //招标信息 表
+		Bidding_back:     IC.DB.Mongo.Bidding.CollectionBack, //招标信息备份数据 表名
+		UserId:           in.UserId,                          //用户id
+		PageNum:          1,                                  //当前页码
+		PageSize:         20000,                              //每页多少条数据
+		SelectTime:       in.SelectTime,                      //时间跨度
+		Area:             in.Area,                            //省份
+		City:             in.City,                            //城市
+		Export:           true,
+		Buyerclass:       in.BuyerClass, //采购单位类型
+		Subtype:          in.Subtype,    //信息类型
+		Subscopeclass:    in.Industry,   //行业
+		Key:              in.KeyWords,   //关键词
+		Price:            in.Price,      //价格区间
+		FileExists:       in.FileExists, //是否有附件
+		EntId:            in.EntId,      //商机管理企业id
+		EntUserId:        in.EntUserId,  //商机管理用户id
+		DeptId:           in.DeptId,     //商机管理部门id
+		NewUserId:        in.NewUserId,
+		BaseServiceMysql: IC.BaseServiceMysql,
+		IsEnt:            in.IsEnt,
 	}
 	}
 	if selectIds := strings.TrimSpace(in.SelectIds); selectIds != "" {
 	if selectIds := strings.TrimSpace(in.SelectIds); selectIds != "" {
+		fmt.Println("00000000000")
 		//encodeArr := strings.Split(selectIds, ",")
 		//encodeArr := strings.Split(selectIds, ",")
 		//idArr := make([]string, 0, len(encodeArr))
 		//idArr := make([]string, 0, len(encodeArr))
 		//for _, encodeId := range encodeArr {
 		//for _, encodeId := range encodeArr {
@@ -69,7 +77,7 @@ func (l *ByPushHistoryLogic) ByPushHistory(in *bxsubscribe.SubscribeInfosReq) (*
 	keyWords := make([]string, 0, len(list))
 	keyWords := make([]string, 0, len(list))
 	for _, pushData := range list {
 	for _, pushData := range list {
 		if pushData.XId != "" {
 		if pushData.XId != "" {
-			if xid := util.EncodeId(pushData.XId); len(xid) > 0 {
+			if xid := util.DecodeId(pushData.XId); len(xid) > 0 {
 				ids = append(ids, xid)
 				ids = append(ids, xid)
 				keyWords = append(keyWords, strings.Join(pushData.MatchKeys, ","))
 				keyWords = append(keyWords, strings.Join(pushData.MatchKeys, ","))
 			}
 			}

+ 30 - 11
jyBXSubscribe/rpc/model/push.go

@@ -313,8 +313,15 @@ func (s *subscribePush) Datas(spqp *SubPushQueryParam) (hasNextPage bool, total
 
 
 func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, endtime int64, size int, isLimit bool) (result []*bxsubscribe.SubscribeInfo, count int64) {
 func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, endtime int64, size int, isLimit bool) (result []*bxsubscribe.SubscribeInfo, count int64) {
 	querys := []string{}
 	querys := []string{}
-	if len(spqp.SelectInfoIds) != 0 {
-		querys = append(querys, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
+	var (
+		searchSql, findSql string
+	)
+	if spqp.SelectInfoIds != nil && len(spqp.SelectInfoIds) > 0 {
+		searchSql = fmt.Sprintf(" from %s a LEFT JOIN %s b ON a.infoid = b.infoid where %s order by a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
+		fmt.Println("searchSql", searchSql)
+		//查询总数
+		count = spqp.BaseServiceMysql.CountBySql(fmt.Sprintf("select count(a.id)" + searchSql))
+		findSql = "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,b.isvalidfile as attachment_count"
 	} else {
 	} else {
 		if spqp.IsEnt {
 		if spqp.IsEnt {
 			querys = []string{fmt.Sprintf("a.entid='%s'", spqp.EntId)}
 			querys = []string{fmt.Sprintf("a.entid='%s'", spqp.EntId)}
@@ -458,15 +465,14 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 				querys = append(querys, fmt.Sprintf("b.isvalidfile =0 "))
 				querys = append(querys, fmt.Sprintf("b.isvalidfile =0 "))
 			}
 			}
 		}
 		}
+		searchSql = fmt.Sprintf(" from %s  a LEFT JOIN %s b ON a.infoid = b.infoid LEFT JOIN %s t on t.infoid = b.infoid and t.labelcode=2  where %s"+
+			" order by a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, BidTags, strings.Join(querys, " and "))
+		fmt.Println("searchSql", searchSql)
+		//查询总数
+		count = spqp.BaseServiceMysql.CountBySql(fmt.Sprintf("select count(a.id)" + searchSql))
+		logx.Info("count:", count, "---", s.ModuleFlag)
+		findSql = "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,b.isvalidfile as attachment_count"
 	}
 	}
-
-	searchSql := fmt.Sprintf(" from %s  a LEFT JOIN %s b ON a.infoid = b.infoid LEFT JOIN %s t on t.infoid = b.infoid and t.labelcode=2  where %s"+
-		" order by a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, BidTags, strings.Join(querys, " and "))
-	fmt.Println("searchSql", searchSql)
-	//查询总数
-	count = spqp.BaseServiceMysql.CountBySql(fmt.Sprintf("select count(a.id)" + searchSql))
-	logx.Info("count:", count, "---", s.ModuleFlag)
-	findSql := "select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,b.isvalidfile as attachment_count"
 	if s.ModuleFlag != MemberFlag && s.ModuleFlag != EntnicheFlag {
 	if s.ModuleFlag != MemberFlag && s.ModuleFlag != EntnicheFlag {
 		findSql += ",isvip"
 		findSql += ",isvip"
 	}
 	}
@@ -478,13 +484,26 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 	list := spqp.BaseServiceMysql.SelectBySql(findSql)
 	list := spqp.BaseServiceMysql.SelectBySql(findSql)
 	if list != nil && len(*list) > 0 {
 	if list != nil && len(*list) > 0 {
 		pushCas := s.GetJyPushs(*list)
 		pushCas := s.GetJyPushs(*list)
-		result = s.GetInfoByIds(spqp.Mgo_bidding, spqp.Bidding, spqp.Bidding_back, pushCas)
+		if !spqp.Export {
+			result = s.GetInfoByIds(spqp.Mgo_bidding, spqp.Bidding, spqp.Bidding_back, pushCas)
+		} else {
+			result = s.GetOnlyExportInfo(pushCas)
+		}
 	} else {
 	} else {
 		result = []*bxsubscribe.SubscribeInfo{}
 		result = []*bxsubscribe.SubscribeInfo{}
 	}
 	}
 	return
 	return
 }
 }
 
 
+// GetOnlyInfoId 获取信息id
+func (s *subscribePush) GetOnlyExportInfo(pushCas []*PushCa) []*bxsubscribe.SubscribeInfo {
+	array := make([]*bxsubscribe.SubscribeInfo, len(pushCas))
+	for k, v := range pushCas {
+		array[k] = &bxsubscribe.SubscribeInfo{XId: encrypt.EncodeArticleId2ByCheck(v.InfoId), MatchKeys: v.Keys}
+	}
+	return array
+}
+
 // 根据id取内容
 // 根据id取内容
 func (s *subscribePush) GetInfoByIds(Mgo_bidding mongodb.MongodbSim, bidding, bidding_back string, pushCas []*PushCa) []*bxsubscribe.SubscribeInfo {
 func (s *subscribePush) GetInfoByIds(Mgo_bidding mongodb.MongodbSim, bidding, bidding_back string, pushCas []*PushCa) []*bxsubscribe.SubscribeInfo {
 	array := make([]*bxsubscribe.SubscribeInfo, len(pushCas))
 	array := make([]*bxsubscribe.SubscribeInfo, len(pushCas))