|
@@ -2,11 +2,13 @@ package service
|
|
|
|
|
|
import (
|
|
import (
|
|
"app.yhyue.com/moapp/jybase/common"
|
|
"app.yhyue.com/moapp/jybase/common"
|
|
|
|
+ "app.yhyue.com/moapp/jybase/encrypt"
|
|
elastic "app.yhyue.com/moapp/jybase/es"
|
|
elastic "app.yhyue.com/moapp/jybase/es"
|
|
"app.yhyue.com/moapp/jybase/mongodb"
|
|
"app.yhyue.com/moapp/jybase/mongodb"
|
|
T "bp.jydev.jianyu360.cn/CRM/networkManage/api/common"
|
|
T "bp.jydev.jianyu360.cn/CRM/networkManage/api/common"
|
|
"bp.jydev.jianyu360.cn/CRM/networkManage/api/internal/types"
|
|
"bp.jydev.jianyu360.cn/CRM/networkManage/api/internal/types"
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "github.com/zeromicro/go-zero/core/logx"
|
|
"strings"
|
|
"strings"
|
|
)
|
|
)
|
|
|
|
|
|
@@ -14,7 +16,7 @@ var (
|
|
esQ1 = `{"query": {"bool": {"must": [{"terms": {"buyer": ["%s"]}},{"terms": {"toptype": ["采购意向","预告","招标"]}}], "should": [%s], "minimum_should_match": 1}}, "_source": ["%s"], "sort": {"comeintime": {"order": "desc"}}, "from": %d, "size": %d}`
|
|
esQ1 = `{"query": {"bool": {"must": [{"terms": {"buyer": ["%s"]}},{"terms": {"toptype": ["采购意向","预告","招标"]}}], "should": [%s], "minimum_should_match": 1}}, "_source": ["%s"], "sort": {"comeintime": {"order": "desc"}}, "from": %d, "size": %d}`
|
|
esQ2 = `{"query": {"bool": {"must": [{"terms": {"buyer": ["%s"]}},{"terms": {"toptype": ["采购意向","预告","招标"]}}]}}, "_source": ["%s"], "sort": {"comeintime": {"order": "desc"}}, "from": %d, "size": %d}`
|
|
esQ2 = `{"query": {"bool": {"must": [{"terms": {"buyer": ["%s"]}},{"terms": {"toptype": ["采购意向","预告","招标"]}}]}}, "_source": ["%s"], "sort": {"comeintime": {"order": "desc"}}, "from": %d, "size": %d}`
|
|
shouldMul = `{"multi_match": {"query": "%s","type": "phrase", "fields": ["s_topscopeclass"]}}`
|
|
shouldMul = `{"multi_match": {"query": "%s","type": "phrase", "fields": ["s_topscopeclass"]}}`
|
|
- fields = []string{"_id", "title", "publishtime", "dataweight", "toptype", "subtype", "type", "area", "city", "s_topscopeclass", "s_subscopeclass", "bidamount", "budget", "buyerclass", "buyer", "winner", "bidopentime", "buyertel", "buyerperson", "agency", "agencytel", "agencyperson", "s_winner", "winnertel", "winnerperson", "signendtime", "bidendtime", "projectinfo", "entidlist"}
|
|
|
|
|
|
+ fields = []string{"_id", "title", "publishtime", "dataweight", "detail", "site", "spidercode", "toptype", "subtype", "type", "area", "city", "s_topscopeclass", "s_subscopeclass", "bidamount", "budget", "buyerclass", "buyer", "winner", "bidopentime", "buyertel", "buyerperson", "agency", "agencytel", "agencyperson", "s_winner", "winnertel", "winnerperson", "signendtime", "bidendtime", "projectinfo", "entidlist"}
|
|
)
|
|
)
|
|
|
|
|
|
func GetMonitorList(req *types.PrMonitorListReq) (resultList *[]map[string]interface{}, total int64) {
|
|
func GetMonitorList(req *types.PrMonitorListReq) (resultList *[]map[string]interface{}, total int64) {
|
|
@@ -40,6 +42,9 @@ func GetMonitorList(req *types.PrMonitorListReq) (resultList *[]map[string]inter
|
|
esQuery1 = fmt.Sprintf(esQ2, strings.ReplaceAll(strings.Join(bName, ","), ",", `","`), strings.ReplaceAll(strings.Join(fields, ","), ",", `","`), pageStart, req.PageSize)
|
|
esQuery1 = fmt.Sprintf(esQ2, strings.ReplaceAll(strings.Join(bName, ","), ",", `","`), strings.ReplaceAll(strings.Join(fields, ","), ",", `","`), pageStart, req.PageSize)
|
|
}
|
|
}
|
|
total, resultList = elastic.GetWithCount("bidding", "bidding", "", esQuery1)
|
|
total, resultList = elastic.GetWithCount("bidding", "bidding", "", esQuery1)
|
|
|
|
+ for _, m := range *resultList {
|
|
|
|
+ m["_id"] = encrypt.CommonEncodeArticle("content", common.ObjToString(m["_id"]))
|
|
|
|
+ }
|
|
return
|
|
return
|
|
} else {
|
|
} else {
|
|
return nil, 0
|
|
return nil, 0
|
|
@@ -48,18 +53,20 @@ func GetMonitorList(req *types.PrMonitorListReq) (resultList *[]map[string]inter
|
|
|
|
|
|
func GetCollectList(req *types.PrCollectListReq) (resultList []map[string]interface{}, total int64) {
|
|
func GetCollectList(req *types.PrCollectListReq) (resultList []map[string]interface{}, total int64) {
|
|
scopeClass := FindBusiness(req.EntId, req.MgoUserId)
|
|
scopeClass := FindBusiness(req.EntId, req.MgoUserId)
|
|
- info := T.JianyuMysql.Find("bdcollection", map[string]interface{}{"userid": req.UserId}, "", `{id: 1}`, -1, -1)
|
|
|
|
|
|
+ info := T.JianyuMysql.Find("bdcollection", map[string]interface{}{"userid": req.UserId}, "", "id desc", -1, -1)
|
|
var ids []interface{}
|
|
var ids []interface{}
|
|
|
|
+ if info == nil || len(*info) == 0 {
|
|
|
|
+ return make([]map[string]interface{}, 0), 0
|
|
|
|
+ }
|
|
for _, m := range *info {
|
|
for _, m := range *info {
|
|
if bid := common.ObjToString(m["bid"]); bid != "" {
|
|
if bid := common.ObjToString(m["bid"]); bid != "" {
|
|
ids = append(ids, mongodb.StringTOBsonId(bid))
|
|
ids = append(ids, mongodb.StringTOBsonId(bid))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if len(ids) == 0 {
|
|
|
|
- return make([]map[string]interface{}, 0), 0
|
|
|
|
- }
|
|
|
|
- if len(ids) > 100 {
|
|
|
|
- ids = ids[:100]
|
|
|
|
|
|
+ logx.Info("scopeClass---", scopeClass)
|
|
|
|
+ logx.Info("ids---", ids)
|
|
|
|
+ if len(ids) > 200 {
|
|
|
|
+ ids = ids[:200]
|
|
}
|
|
}
|
|
fs := make(map[string]interface{})
|
|
fs := make(map[string]interface{})
|
|
for _, f := range fields {
|
|
for _, f := range fields {
|
|
@@ -71,6 +78,7 @@ func GetCollectList(req *types.PrCollectListReq) (resultList []map[string]interf
|
|
if tp := common.ObjToString(m["toptype"]); tp == "采购意向" || tp == "预告" || tp == "招标" {
|
|
if tp := common.ObjToString(m["toptype"]); tp == "采购意向" || tp == "预告" || tp == "招标" {
|
|
for _, s := range strings.Split(scopeClass, ",") {
|
|
for _, s := range strings.Split(scopeClass, ",") {
|
|
if top := common.ObjToString("s_topscopeclass"); strings.Contains(top, s) {
|
|
if top := common.ObjToString("s_topscopeclass"); strings.Contains(top, s) {
|
|
|
|
+ m["_id"] = encrypt.CommonEncodeArticle("content", common.ObjToString(m["_id"]))
|
|
resultList = append(resultList, m)
|
|
resultList = append(resultList, m)
|
|
break
|
|
break
|
|
}
|
|
}
|