|
@@ -45,9 +45,10 @@ type ElasticComprehensiveDetail struct {
|
|
|
SubjectNames string `description:"标的名称"`
|
|
|
}
|
|
|
|
|
|
-func init() {
|
|
|
- AddComprehensiveIndustrialSource("Yx", 0)
|
|
|
-}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
func AddComprehensiveArticle(articleId int) {
|
|
@@ -170,7 +171,7 @@ func AddComprehensiveIndustrialSource(sourceType string, articleId int) {
|
|
|
item.Source = industrialsource
|
|
|
item.IndustryName = v.IndustryName
|
|
|
item.SubjectNames = strings.Join(mapActivitySubject[v.IndustrialManagementId], ",")
|
|
|
- item.PublishDate = v.PublishDate
|
|
|
+ item.PublishDate = v.PublishDate + " 00:00:00"
|
|
|
EsAddOrEditComprehensiveData(item)
|
|
|
fmt.Println(item)
|
|
|
}
|
|
@@ -633,11 +634,245 @@ func EsDeleteComprehensiveData(item *ElasticComprehensiveDetail) (err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|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
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*SearchComprehensiveItem, total int64, err error) {
|
|
|
indexName := utils.IndexNameComprehensive
|
|
|
client := utils.Client
|
|
|
- var keyWordArr []string
|
|
|
- keyWordArr = append(keyWordArr, keyWord)
|
|
|
+ keyWordArr, err := GetIndustryMapNameSliceV3(keyWord)
|
|
|
+ keyWordArr = RemoveDuplicatesAndEmpty(keyWordArr)
|
|
|
+ keyWordLen := len(keyWordArr)
|
|
|
+ if keyWordLen <= 0 {
|
|
|
+ keyWordArr = append(keyWordArr, keyWord)
|
|
|
+ keyWordLen = len(keyWordArr)
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -648,6 +883,8 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
mustNotMap := make([]interface{}, 0)
|
|
|
shouldNotMap := make(map[string]interface{}, 0)
|
|
|
shouldNotMapquery := make([]interface{}, 0)
|
|
|
+
|
|
|
+
|
|
|
var boost int
|
|
|
|
|
|
for k, v := range keyWordArr {
|
|
@@ -696,18 +933,18 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
},
|
|
|
})
|
|
|
|
|
|
- shouldMapquery = append(shouldMapquery, map[string]interface{}{
|
|
|
- "function_score": map[string]interface{}{
|
|
|
- "query": map[string]interface{}{
|
|
|
- "multi_match": map[string]interface{}{
|
|
|
-
|
|
|
- "boost": boost,
|
|
|
- "fields": []interface{}{"BodyText"},
|
|
|
- "query": v,
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
shouldMapquery = append(shouldMapquery, map[string]interface{}{
|
|
|
"function_score": map[string]interface{}{
|
|
@@ -761,7 +998,7 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
highlightMap := make(map[string]interface{}, 0)
|
|
|
highlightMap = map[string]interface{}{
|
|
|
"fields": map[string]interface{}{
|
|
|
- "BodyText": map[string]interface{}{},
|
|
|
+
|
|
|
"Title": map[string]interface{}{},
|
|
|
"Abstract": map[string]interface{}{},
|
|
|
"Annotation": map[string]interface{}{},
|
|
@@ -775,15 +1012,10 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
mustMap = append(mustMap, map[string]interface{}{
|
|
|
"bool": shouldMap,
|
|
|
})
|
|
|
-
|
|
|
mustNotMap = append(mustNotMap, map[string]interface{}{
|
|
|
- "term": shouldNotMap,
|
|
|
+ "bool": shouldNotMap,
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
queryMap := map[string]interface{}{
|
|
|
"query": map[string]interface{}{
|
|
|
"bool": map[string]interface{}{
|
|
@@ -832,7 +1064,7 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
|
|
|
searchItem.Body = append(searchItem.Body, vText)
|
|
|
}
|
|
|
}
|
|
|
- searchItem.IsSummary = article.IsSummary
|
|
|
+
|
|
|
if len(searchItem.Body) == 0 {
|
|
|
bodyRune := []rune(article.BodyText)
|
|
|
bodyRuneLen := len(bodyRune)
|
|
@@ -875,14 +1107,14 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
item := new(models.CygxResourceDataResp)
|
|
|
item.SourceId = v.SourceId
|
|
|
item.Source = v.Source
|
|
|
- if v.IsSummary == 1 {
|
|
|
- item.BodyHighlight = v.Body
|
|
|
- titleHighlight[v.SourceId] = v.Title
|
|
|
- bodyHighlight[v.SourceId] = v.Body
|
|
|
-
|
|
|
- } else {
|
|
|
- item.BodyHighlight = make([]string, 0)
|
|
|
- }
|
|
|
+
|
|
|
+ item.BodyHighlight = v.Body
|
|
|
+ titleHighlight[v.SourceId] = v.Title
|
|
|
+ bodyHighlight[v.SourceId] = v.Body
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
item.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
|
|
|
mapItems[fmt.Sprint(v.Source, v.SourceId)] = item
|
|
|
}
|
|
@@ -898,7 +1130,8 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
var minutessummaryIds []int
|
|
|
var meetingreviewchaptIds []int
|
|
|
var productinteriorIds []int
|
|
|
- var industrialResourceIds []int
|
|
|
+ var industrialResourceIdsHz []int
|
|
|
+ var industrialResourceIdsYx []int
|
|
|
|
|
|
for _, v := range list {
|
|
|
if v.Source == "article" {
|
|
@@ -923,8 +1156,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)
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1062,7 +1297,6 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
mapChart[chartName] = imgUrlChart
|
|
|
}
|
|
|
var imgUrlResp string
|
|
|
- fmt.Println(activityIds)
|
|
|
|
|
|
if len(activityIds) > 0 {
|
|
|
for _, vss := range activityIds {
|
|
@@ -1110,22 +1344,56 @@ 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 + `) `
|
|
|
- listIndustrialResourceIds, e := models.GetSearchResourceList(user.UserId, condition, 0, len(industrialResourceIds))
|
|
|
+ condition = ` AND m.industrial_management_id IN (` + industrialId + `) AND a.article_type = 0 `
|
|
|
+ listIndustrialResourceIds, e := models.GetSearchResourceList(user.UserId, condition, 0, len(industrialResourceIdsHz))
|
|
|
if e != nil {
|
|
|
err = errors.New("GetSearchResourceList, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- listSubjcet, e := models.GetIndustrialSubjectAllByIndustrialId(industrialResourceIds)
|
|
|
+ listSubjcet, e := models.GetIndustrialSubjectAllByIndustrialId(industrialResourceIdsHz)
|
|
|
+ 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, "Hz", v.SubjectName)] == 0 {
|
|
|
+ listIndustrialResourceIds[k2].IndustrialSubjectList = append(listIndustrialResourceIds[k2].IndustrialSubjectList, v)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for _, v := range listIndustrialResourceIds {
|
|
|
+ v.Source = 1
|
|
|
+ mapItems[fmt.Sprint("industrialsourceHz", v.IndustrialManagementId)].IndustrialResource = v
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(industrialResourceIdsYx) > 0 {
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
+
|
|
|
+ var industrialResourceIdstring []string
|
|
|
+ for _, v := range industrialResourceIdsYx {
|
|
|
+ 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(user.UserId, condition, 0, len(industrialResourceIdsYx))
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetSearchResourceList, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ listSubjcet, e := models.GetIndustrialSubjectAllByIndustrialId(industrialResourceIdsYx)
|
|
|
if e != nil {
|
|
|
e = errors.New("GetIndustrialSubjectAllByIndustrialId, Err: " + e.Error())
|
|
|
return
|
|
@@ -1139,7 +1407,8 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
}
|
|
|
}
|
|
|
for _, v := range listIndustrialResourceIds {
|
|
|
- mapItems[fmt.Sprint("industrialsource", v.IndustrialManagementId)].IndustrialResource = v
|
|
|
+ v.Source = 2
|
|
|
+ mapItems[fmt.Sprint("industrialsourceYx", v.IndustrialManagementId)].IndustrialResource = v
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1321,12 +1590,46 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
for _, vList := range list {
|
|
|
for _, v := range mapItems {
|
|
|
|
|
|
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.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.Source = "industrialsource"
|
|
|
+ }
|
|
|
if v.SourceId == vList.SourceId {
|
|
|
items = append(items, v)
|
|
|
}
|