소스 검색

feat:采购单位搜索调整联系人数量es查询语句

fuwencai 2 년 전
부모
커밋
053ad474bf
1개의 변경된 파일4개의 추가작업 그리고 13개의 파일을 삭제
  1. 4 13
      jyBXBuyer/rpc/model/buyerListBYEs.go

+ 4 - 13
jyBXBuyer/rpc/model/buyerListBYEs.go

@@ -118,7 +118,7 @@ const (
 	biddingIndex              = "bidding"
 	biddingType               = "bidding"
 	BuyerSupplyInfoRedisKey   = "BuyerSupplyInfo_%s"  // 采购单位补充信息缓存
-	BuyerSupplyInfoRedisTime  = 2*60 * 60               // 采购单位补充信息缓存时间 一个小时
+	BuyerSupplyInfoRedisTime  = 2 * 60 * 60           // 采购单位补充信息缓存时间 一个小时
 	BuyerProjectInfoRedisKey  = "BuyerProjectInfo_%s" // 采购单位补充项目信息缓存Key  (项目数量采购规模)
 	BuyerProjectInfoRedisTime = 24 * 60 * 60          // 采购单位补充项目信息缓存时间
 )
@@ -575,14 +575,7 @@ func BuyerSupplyInfo(buyerNames []string) (resp *bxbuyer.BuyerSupplyResp) {
 func GetProjectContactCount(buyerName string) int64 {
 	start := time.Now()
 	list := []string{}
-	var musts []string
-	if buyerName != "" {
-		musts = append(musts, fmt.Sprintf(`{"term":{"buyer":"%s"}}`, buyerName))
-	}
-	if musts == nil || len(musts) == 0 {
-		return 0
-	}
-	searchSql := fmt.Sprintf(`{"query":{"bool":{"must":[%s]}},"_source":["list"],"sort":[{"zbtime":"desc"}],"size":500}`, strings.Join(musts, ","))
+	searchSql := fmt.Sprintf(`{"query":{"bool":{"filter":[{"term":{"buyer":"%s"}}]}},"_source":["list.buyerperson","list.buyertel"],"sort":[{"zbtime":"desc"}],"size":500}`,buyerName)
 	projectList := elastic.Get(P_INDEX, P_TYPE, searchSql)
 	logx.Info("GetProjectContactCount esget 耗时", time.Since(start), searchSql)
 	if projectList == nil || len(*projectList) == 0 {
@@ -603,10 +596,8 @@ func GetProjectContactCount(buyerName string) int64 {
 				continue
 			}
 			thisPhone, thisPerson := "", ""
-			if buyerName != "" {
-				if thisPhone, _ = thisMsg["buyertel"].(string); thisPhone != "" {
-					thisPerson, _ = thisMsg["buyerperson"].(string)
-				}
+			if thisPhone, _ = thisMsg["buyertel"].(string); thisPhone != "" {
+				thisPerson, _ = thisMsg["buyerperson"].(string)
 			}
 			if thisPhone == "" { //联系人为空则不展示 dev4.7.3联系人为空展示此记录
 				continue