|
@@ -26,13 +26,37 @@ func PotentialCustomizeAnalysis(userid, keyWord string) map[string]interface{} {
|
|
|
log.Printf("[SEARCH-ERR]关键词格式化化失败 userid:%s,keyWord:%s", userid, keyWord)
|
|
|
return nil
|
|
|
}
|
|
|
+ finalSqlCount := fmt.Sprintf(mae.GetCommonQuerySqlWithAggs(), project_count, mae.Size, "")
|
|
|
+ resData, _, _ := public.GetAggs("projectset", "projectset", finalSqlCount)
|
|
|
+ if resData == nil || len(resData) == 0 {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ thisRow := Aggregation{}
|
|
|
+ for name, object := range resData {
|
|
|
+ bArr, err := object.MarshalJSON()
|
|
|
+ if len(bArr) == 0 || err != nil {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if name == "project_count" {
|
|
|
+ if json.Unmarshal(bArr, &thisRow.ProjectCount) != nil {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if thisRow.ProjectCount.DocCount == 0 {
|
|
|
+ log.Println("未查询到项目数据", userid)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ if thisRow.ProjectCount.DocCount > vars.Config.ProjectNumLimit {
|
|
|
+ log.Println("项目数量超出上限", userid, vars.Config.ProjectNumLimit)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
finalSql := fmt.Sprintf(mae.GetCommonQuerySqlWithAggs(), strings.Join(aggs, ","), mae.Size, "")
|
|
|
log.Printf("[SEARCH-INFO]定制化分析报告userid:%s,es查询:%s", userid, finalSql)
|
|
|
res, _, _ := public.GetAggs("projectset", "projectset", finalSql)
|
|
|
if res == nil || len(res) == 0 {
|
|
|
return nil
|
|
|
}
|
|
|
- thisRow := Aggregation{}
|
|
|
for name, object := range res {
|
|
|
bArr, err := object.MarshalJSON()
|
|
|
if len(bArr) == 0 || err != nil {
|
|
@@ -42,10 +66,6 @@ func PotentialCustomizeAnalysis(userid, keyWord string) map[string]interface{} {
|
|
|
if json.Unmarshal(bArr, &thisRow.ProjectAmount) != nil {
|
|
|
continue
|
|
|
}
|
|
|
- } else if name == "project_count" {
|
|
|
- if json.Unmarshal(bArr, &thisRow.ProjectCount) != nil {
|
|
|
- continue
|
|
|
- }
|
|
|
} else if name == "buyer_amount_distribution" {
|
|
|
if json.Unmarshal(bArr, &thisRow.BuyerAmountDistribution) != nil {
|
|
|
continue
|
|
@@ -60,14 +80,6 @@ func PotentialCustomizeAnalysis(userid, keyWord string) map[string]interface{} {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if thisRow.ProjectCount.DocCount == 0 {
|
|
|
- log.Println("未查询到项目数据", userid)
|
|
|
- return nil
|
|
|
- }
|
|
|
- if thisRow.ProjectCount.DocCount > vars.Config.ProjectNumLimit {
|
|
|
- log.Println("项目数量超出上限", userid, vars.Config.ProjectNumLimit)
|
|
|
- return nil
|
|
|
- }
|
|
|
var rMap = sync.Map{}
|
|
|
sy := sync.WaitGroup{}
|
|
|
sy.Add(3)
|