|
@@ -50,7 +50,6 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
keyWordArr = append(keyWordArr, keyWord)
|
|
|
keyWordLen = len(keyWordArr)
|
|
|
}
|
|
|
- fmt.Println(keyWordArr)
|
|
|
|
|
|
//Es 的高级查询有 自定义排序 文档一时半会儿撸不懂,先做多次查询手动过滤 2023.2.2
|
|
|
//ikType 查询方式 ,0:查所有 、 1:查询键入词 、 2:查询除了查询键入词之外的联想词
|
|
@@ -206,8 +205,8 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
queryMap["from"] = startSize
|
|
|
queryMap["size"] = pageSize
|
|
|
queryMap["highlight"] = highlightMap
|
|
|
- jsonBytes, _ := json.Marshal(queryMap)
|
|
|
- fmt.Println(string(jsonBytes))
|
|
|
+ //jsonBytes, _ := json.Marshal(queryMap)
|
|
|
+ //fmt.Println(string(jsonBytes))
|
|
|
//utils.FileLog.Info(string(jsonBytes))
|
|
|
request := client.Search(indexName).Source(queryMap) // sets the JSON request
|
|
|
searchByMatch, err := request.Do(context.Background())
|
|
@@ -224,7 +223,7 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
if err != nil {
|
|
|
return nil, 0, err
|
|
|
}
|
|
|
- fmt.Println(article.SourceId, article.Title, article.Source)
|
|
|
+ //fmt.Println(article.SourceId, article.Title, article.Source)
|
|
|
searchItem := new(SearchComprehensiveItem)
|
|
|
searchItem.SourceId = article.SourceId
|
|
|
if len(v.Highlight["Annotation"]) > 0 {
|
|
@@ -740,30 +739,26 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
item.SourceId = v.SourceId
|
|
|
item.Source = v.Source
|
|
|
item.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
|
|
|
- //if v.IsSummary == 1 {
|
|
|
item.BodyHighlight = v.Body
|
|
|
item.TitleHighlight = v.Title
|
|
|
titleHighlight[v.SourceId] = v.Title
|
|
|
bodyHighlight[v.SourceId] = v.Body
|
|
|
- //fmt.Println(v.Title)
|
|
|
- //} else {
|
|
|
- // item.BodyHighlight = make([]string, 0)
|
|
|
- //}
|
|
|
mapItems[fmt.Sprint(v.Source, v.SourceId)] = item
|
|
|
}
|
|
|
|
|
|
- var articleIds []int //报告
|
|
|
- var newchartIds []int //图表
|
|
|
- var roadshowIds []string //微路演
|
|
|
- var activityIds []int //活动
|
|
|
- var activityvideoIds []string // 活动视频
|
|
|
- var activityvoiceIds []string //活动音频
|
|
|
- var activityspecialIds []int //专项调研活动
|
|
|
- var researchsummaryIds []int //本周研究汇总
|
|
|
- var minutessummaryIds []int //上周纪要汇总
|
|
|
- var meetingreviewchaptIds []int //晨会精华
|
|
|
- var productinteriorIds []int //产品内测
|
|
|
- var industrialResourceIds []int // 产业资源包
|
|
|
+ var articleIds []int //报告
|
|
|
+ var newchartIds []int //图表
|
|
|
+ var roadshowIds []string //微路演
|
|
|
+ var activityIds []int //活动
|
|
|
+ var activityvideoIds []string // 活动视频
|
|
|
+ var activityvoiceIds []string //活动音频
|
|
|
+ var activityspecialIds []int //专项调研活动
|
|
|
+ var researchsummaryIds []int //本周研究汇总
|
|
|
+ var minutessummaryIds []int //上周纪要汇总
|
|
|
+ var meetingreviewchaptIds []int //晨会精华
|
|
|
+ var productinteriorIds []int //产品内测
|
|
|
+ var industrialResourceIdsHz []int // 弘则产业资源包
|
|
|
+ var industrialResourceIdsYx []int // 研选产业资源包
|
|
|
//Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt 、 产品内测:productinterior
|
|
|
for _, v := range list {
|
|
|
if v.Source == "article" {
|
|
@@ -788,8 +783,10 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
meetingreviewchaptIds = append(meetingreviewchaptIds, v.SourceId)
|
|
|
} else if v.Source == "productinterior" {
|
|
|
productinteriorIds = append(productinteriorIds, v.SourceId)
|
|
|
- } else if v.Source == "industrialsource" {
|
|
|
- industrialResourceIds = append(industrialResourceIds, v.SourceId)
|
|
|
+ } else if v.Source == "industrialsourceHz" {
|
|
|
+ industrialResourceIdsHz = append(industrialResourceIdsHz, v.SourceId)
|
|
|
+ } else if v.Source == "industrialResourceIdsYx" {
|
|
|
+ industrialResourceIdsHz = append(industrialResourceIdsYx, v.SourceId)
|
|
|
}
|
|
|
}
|
|
|
detail, e := models.GetConfigByCode("city_img_url")
|
|
@@ -970,22 +967,22 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
}
|
|
|
|
|
|
//产业资源包
|
|
|
- if len(industrialResourceIds) > 0 {
|
|
|
+ if len(industrialResourceIdsHz) > 0 {
|
|
|
pars = make([]interface{}, 0)
|
|
|
|
|
|
var industrialResourceIdstring []string
|
|
|
- for _, v := range industrialResourceIds {
|
|
|
+ for _, v := range industrialResourceIdsHz {
|
|
|
industrialResourceIdstring = append(industrialResourceIdstring, strconv.Itoa(v))
|
|
|
}
|
|
|
industrialId := strings.Join(industrialResourceIdstring, ",")
|
|
|
- condition = ` AND m.industrial_management_id IN (` + industrialId + `) `
|
|
|
+ condition = ` AND m.industrial_management_id IN (` + industrialId + `) AND a.article_type = 0 `
|
|
|
listIndustrialResourceIds, e := models.GetSearchResourceList(condition)
|
|
|
if e != nil {
|
|
|
err = errors.New("GetSearchResourceList, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
- conditionSubject := condition + ` AND m.industrial_management_id IN (` + utils.GetOrmInReplace(len(industrialResourceIds)) + `)`
|
|
|
- pars = append(pars, industrialResourceIds)
|
|
|
+ conditionSubject := condition + ` AND m.industrial_management_id IN (` + utils.GetOrmInReplace(len(industrialResourceIdsHz)) + `)`
|
|
|
+ pars = append(pars, industrialResourceIdsHz)
|
|
|
listSubjcet, e := models.GetIndustrialSubjectAllByIndustrialId(pars, conditionSubject)
|
|
|
//合并产业关联的标的
|
|
|
if e != nil {
|
|
@@ -1003,7 +1000,47 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
}
|
|
|
//listIndustrialResourceIds, _ = HandleIndustryList(listIndustrialResourceIds, user, "Hz")
|
|
|
for _, v := range listIndustrialResourceIds {
|
|
|
- mapItems[fmt.Sprint("industrialsource", v.IndustrialManagementId)].IndustrialResource = v
|
|
|
+ v.Source = 1
|
|
|
+ mapItems[fmt.Sprint("industrialsourceHz", v.IndustrialManagementId)].IndustrialResource = v
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //产业资源包
|
|
|
+ if len(industrialResourceIdsHz) > 0 {
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
+
|
|
|
+ var industrialResourceIdstring []string
|
|
|
+ for _, v := range industrialResourceIdsHz {
|
|
|
+ industrialResourceIdstring = append(industrialResourceIdstring, strconv.Itoa(v))
|
|
|
+ }
|
|
|
+ industrialId := strings.Join(industrialResourceIdstring, ",")
|
|
|
+ condition = ` AND m.industrial_management_id IN (` + industrialId + `) AND a.article_type > 0 `
|
|
|
+ listIndustrialResourceIds, e := models.GetSearchResourceList(condition)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetSearchResourceList, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ conditionSubject := condition + ` AND m.industrial_management_id IN (` + utils.GetOrmInReplace(len(industrialResourceIdsHz)) + `)`
|
|
|
+ pars = append(pars, industrialResourceIdsHz)
|
|
|
+ listSubjcet, e := models.GetIndustrialSubjectAllByIndustrialId(pars, conditionSubject)
|
|
|
+ //合并产业关联的标的
|
|
|
+ if e != nil {
|
|
|
+ e = errors.New("GetIndustrialSubjectAllByIndustrialId, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapIndustrial := make(map[string]int)
|
|
|
+ for _, v := range listSubjcet {
|
|
|
+ for k2, v2 := range listIndustrialResourceIds {
|
|
|
+ if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, v.SubjectName)] == 0 {
|
|
|
+ listIndustrialResourceIds[k2].IndustrialSubjectList = append(listIndustrialResourceIds[k2].IndustrialSubjectList, v)
|
|
|
+ mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, v.SubjectName)] = 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //listIndustrialResourceIds, _ = HandleIndustryList(listIndustrialResourceIds, user, "Yx")
|
|
|
+ for _, v := range listIndustrialResourceIds {
|
|
|
+ v.Source = 2
|
|
|
+ mapItems[fmt.Sprint("industrialsourceYx", v.IndustrialManagementId)].IndustrialResource = v
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1193,15 +1230,43 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
if v.Article == nil && v.Newchart == nil && v.Roadshow == nil && v.Activity == nil && v.Activityvideo == nil && v.Activityvoice == nil && v.Activityspecial == nil && v.Researchsummary == nil && v.Minutessummary == nil && v.Meetingreviewchapt == nil && v.ProductInterior == nil && v.IndustrialResource == nil {
|
|
|
continue
|
|
|
}
|
|
|
- if v.SourceId == vList.SourceId {
|
|
|
- items = append(items, v)
|
|
|
+ if v.Article != nil {
|
|
|
+ v.Article.Title = vList.Title
|
|
|
}
|
|
|
if v.Newchart != nil {
|
|
|
v.Newchart.Title = vList.Title
|
|
|
}
|
|
|
+ if v.Roadshow != nil {
|
|
|
+ v.Roadshow.Title = vList.Title
|
|
|
+ }
|
|
|
if v.Activity != nil {
|
|
|
v.Activity.ActivityName = vList.Title
|
|
|
}
|
|
|
+ if v.Activityvideo != nil {
|
|
|
+ v.Activityvideo.Title = vList.Title
|
|
|
+ }
|
|
|
+ if v.Activityvoice != nil {
|
|
|
+ v.Activityvoice.Title = vList.Title
|
|
|
+ }
|
|
|
+ if v.Activityspecial != nil {
|
|
|
+ v.Activityspecial.ResearchTheme = vList.Title
|
|
|
+ }
|
|
|
+ if v.Researchsummary != nil {
|
|
|
+ v.Researchsummary.Title = vList.Title
|
|
|
+ }
|
|
|
+ if v.Minutessummary != nil {
|
|
|
+ v.Minutessummary.Title = vList.Title
|
|
|
+ }
|
|
|
+ if v.ProductInterior != nil {
|
|
|
+ v.ProductInterior.Title = vList.Title
|
|
|
+ }
|
|
|
+ if v.IndustrialResource != nil {
|
|
|
+ v.IndustrialResource.UpdateTime = v.PublishDate
|
|
|
+ v.Source = "industrialsource"
|
|
|
+ }
|
|
|
+ if v.SourceId == vList.SourceId {
|
|
|
+ items = append(items, v)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return
|