浏览代码

Merge branch 'cygx_10.6' of http://8.136.199.33:3000/hongze/hongze_cygx

xingzai 1 年之前
父节点
当前提交
a3fe9e1c6f

+ 0 - 17
controllers/report.go

@@ -326,23 +326,6 @@ func (this *ReportController) ArticleCategoryList() {
 		}
 		categoryMap[v.CategoryId] = v.CategoryId
 		list = append(list, v)
-		//recordCount, err := models.IndustrialUserRecordArticleCount(uid, industrialManagementId, v.CategoryId)
-		//if err != nil && err.Error() != utils.ErrNoRow() {
-		//	br.Msg = "获取信息失败"
-		//	br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
-		//	return
-		//}
-		//Newdetail, err := models.GetNewIndustrialUserRecordArticle(industrialManagementId, v.CategoryId)
-		//if err != nil && err.Error() != utils.ErrNoRow() {
-		//	br.Msg = "获取信息失败"
-		//	br.ErrMsg = "获取信息失败,Err:" + err.Error()
-		//	return
-		//}
-		//if Newdetail != nil {
-		//	if recordCount == 0 && user.CreatedTime.Before(utils.StrTimeToTime(Newdetail.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(Newdetail.PublishDate)) {
-		//		list[k].IsRed = true
-		//	}
-		//}
 	}
 
 	// 用户权限

+ 72 - 9
controllers/search.go

@@ -671,15 +671,14 @@ func (this *SearchController) ListHomeArtAndChartPage() {
 		}
 	}
 	//记录用户搜索关键词
-	var source int
-	if listType == 1 {
-		source = 3
-	} else if listType == 2 {
-		source = 1
-	} else {
-		source = 2
-	}
-	go services.AddSearchKeyWord(user, keyWord, source)
+	//var source int
+	//if listType == 1 {
+	//	source = 3
+	//} else if listType == 2 {
+	//	source = 1
+	//} else {
+	//	source = 2
+	//}
 
 	if chartTotal > int(total) {
 		total = int64(chartTotal)
@@ -698,3 +697,67 @@ func (this *SearchController) ListHomeArtAndChartPage() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 综合搜索接口
+// @Description 综合搜索接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   KeyWord   query   string  true       "搜索关键词"
+// @Success 200 {object} models.SearchItem
+// @router /comprehensive/list [get]
+func (this *SearchController) ComprehensiveList() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = paging.StartIndex(currentIndex, pageSize)
+	keyWord := this.GetString("KeyWord")
+	if keyWord == "" {
+		br.Msg = "请输入搜索词"
+		br.ErrMsg = "请输入搜索词"
+		return
+	}
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	resp := new(models.HomeResourceDataListResp)
+	tmpResult, tmpTotalResult, err := services.EsComprehensiveSearch(keyWord, startSize, pageSize)
+	if err != nil {
+		br.Msg = "检索失败"
+		br.ErrMsg = "检索失败,Err:" + err.Error()
+		return
+	}
+	//for _, v := range tmpResult {
+	//	fmt.Println(v.Title, "Title", v.IsSummary)
+	//}
+	list, err := services.GetResourceDataEsList(tmpResult, user)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	if currentIndex == 1 {
+		go services.AddSearchKeyWord(user, keyWord, 1)
+	}
+
+	resp.List = list
+	page := paging.GetPaging(currentIndex, pageSize, int(tmpTotalResult))
+	resp.Paging = page
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 33 - 31
models/activity_special.go

@@ -3,41 +3,43 @@ package models
 import (
 	//"fmt"
 	"github.com/beego/beego/v2/client/orm"
+	"time"
 )
 
 // 专项调研活动列表
 type CygxActivitySpecialDetail struct {
-	ActivityId            int    `description:"活动ID "`
-	ActivityTypeName      string `description:"活动名称"`
-	SpecialType           int    `description:"调研形式、 1 线上 , 2 线下"`
-	City                  string `description:"调研城市"`
-	ChartPermissionName   string `description:"行业名称"`
-	ChartPermissionId     int    `description:"行业Id"`
-	ResearchTheme         string `description:"调研主题"`
-	ActivityTimeText      string `description:"活动预期时间带文字"`
-	TripImgLink           string `description:"行程图片链接"`
-	IsSignup              int    `description:"是否感兴趣 1是 ,0 否"`
-	Label                 string `description:"主题标签"`
-	ImgUrl                string `description:"图片链接"`
-	ImgUrlText            string `description:"图片链接文字"`
-	IndustrialName        string `description:"产业名称"`
-	IndustrialSubjectName string `description:"标的名称(相关公司)"`
-	Scale                 string `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
-	CustomerTypeIds       string `description:"活动可见的客户类型,多个ID用 , 隔开"`
-	IsTrip                int    `description:"是否报名 1是 ,0 否"`
-	TripNum               int    `description:"已报名人数"`
-	Days                  int    `description:"调研天数"`
-	Host                  string `description:"主持人"`
-	PersonInCharge        string `description:"纪要负责人"`
-	LimitPeopleNum        int    `description:"限制人数数量"`
-	TripImgLinkFix        string `description:"确定行程之后的图片链接"`
-	ActivityTimeTextByDay string `description:"活动预期时间带周日"`
-	ActivityTime          string `description:"活动预期时间"`
-	ActivityTimeEnd       string `description:"活动预期结束时间"`
-	ActiveState           int    `description:"活动进行状态 未开始:1、进行中2、已结束3"`
-	TripStatus            int    `description:"行程进行状态 1:预报名,2:确定行程"`
-	Explain               string `description:"说明"`
-	AdminId               int    `description:"管理员ID"`
+	ActivityId            int       `description:"活动ID "`
+	ActivityTypeName      string    `description:"活动名称"`
+	SpecialType           int       `description:"调研形式、 1 线上 , 2 线下"`
+	City                  string    `description:"调研城市"`
+	ChartPermissionName   string    `description:"行业名称"`
+	ChartPermissionId     int       `description:"行业Id"`
+	ResearchTheme         string    `description:"调研主题"`
+	ActivityTimeText      string    `description:"活动预期时间带文字"`
+	TripImgLink           string    `description:"行程图片链接"`
+	IsSignup              int       `description:"是否感兴趣 1是 ,0 否"`
+	Label                 string    `description:"主题标签"`
+	ImgUrl                string    `description:"图片链接"`
+	ImgUrlText            string    `description:"图片链接文字"`
+	IndustrialName        string    `description:"产业名称"`
+	IndustrialSubjectName string    `description:"标的名称(相关公司)"`
+	Scale                 string    `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
+	CustomerTypeIds       string    `description:"活动可见的客户类型,多个ID用 , 隔开"`
+	IsTrip                int       `description:"是否报名 1是 ,0 否"`
+	TripNum               int       `description:"已报名人数"`
+	Days                  int       `description:"调研天数"`
+	Host                  string    `description:"主持人"`
+	PersonInCharge        string    `description:"纪要负责人"`
+	LimitPeopleNum        int       `description:"限制人数数量"`
+	TripImgLinkFix        string    `description:"确定行程之后的图片链接"`
+	ActivityTimeTextByDay string    `description:"活动预期时间带周日"`
+	ActivityTime          string    `description:"活动预期时间"`
+	ActivityTimeEnd       string    `description:"活动预期结束时间"`
+	ActiveState           int       `description:"活动进行状态 未开始:1、进行中2、已结束3"`
+	TripStatus            int       `description:"行程进行状态 1:预报名,2:确定行程"`
+	Explain               string    `description:"说明"`
+	AdminId               int       `description:"管理员ID"`
+	LastUpdatedTime       time.Time `description:"更新时间"`
 }
 
 // 获取数量

+ 1 - 0
models/activity_video.go

@@ -42,6 +42,7 @@ type CygxActivityVideoListResp struct {
 	Title         string `orm:"column(video_name)";description:"视频名称"`
 	ResourceUrl   string `orm:"column(video_url)";description:"视频地址"`
 	VideoDuration string `description:"视频时长"`
+	ActivityTime  string `description:"活动时间"`
 }
 
 type CygxActivityVideoListRep struct {

+ 2 - 1
models/activity_voice.go

@@ -30,6 +30,7 @@ type CygxActivityVoiceResp struct {
 	CreateTime          string `description:"创建时间"`
 	ChartPermissionId   int    `description:"权限id"`
 	ChartPermissionName string `description:"行业名称"`
+	ActivityTime        string `description:"活动时间"`
 }
 
 // ActivityVoiceReq 音频数据
@@ -102,7 +103,7 @@ func GetCygxActivityVoiceByActivityId(activityId int) (item *CygxActivityVoice,
 func GetActivityVoiceList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivityVoiceResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
-	v.*,art.chart_permission_id
+	v.*,art.chart_permission_id,art.activity_time
 FROM
 	cygx_activity_voice AS v 
 	INNER JOIN cygx_activity as art ON art.activity_id = v.activity_id    WHERE 1= 1  `

+ 7 - 3
models/article.go

@@ -115,6 +115,7 @@ type HomeArticle struct {
 	ArticleResponse     int                  `description:"报告类型 0:啥也不是,1研选报告,2:研选纪要,3:研选沙龙,4;研选观点"`
 	Readnum             int                  `description:"阅读数量"`
 	Cover               string               `description:"封面图片"`
+	BodyHighlight       []string             `description:"搜索高亮展示结果"`
 	List                []*IndustrialManagementIdInt
 }
 
@@ -170,6 +171,7 @@ type ArticleDetail struct {
 	IsFollowButton          bool   `description:"是否关注"`
 	IsRoadShow              bool   `description:"是否是路演精华"`
 	ReportType              int    `description:"报告类型,1行业报告,2产业报告,0无"`
+	FieldName               string `description:"策略平台的领域字段名称"`
 }
 
 type ArticleDetailFileLink struct {
@@ -279,13 +281,15 @@ func GetArticleDetailTestById(articleId int) (item *ArticleDetail, err error) {
 
 func GetArticleAll() (item []*ArticleDetail, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_article WHERE is_summary=1`
+	//sql := `SELECT * FROM cygx_article WHERE 1=1  is_summary=1`
+	sql := `SELECT * FROM cygx_article WHERE 1=1   AND publish_status = 1 `
 	_, err = o.Raw(sql).QueryRows(&item)
 	return
 }
 func GetArticleAllDate(endDate string) (item []*ArticleDetail, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_article WHERE is_summary=1 AND publish_date >= ?   `
+	//sql := `SELECT * FROM cygx_article WHERE is_summary=1 AND publish_date >= ?   `
+	sql := `SELECT * FROM cygx_article WHERE 1=1 AND publish_date >= ?   `
 	_, err = o.Raw(sql, endDate).QueryRows(&item)
 	return
 }
@@ -300,7 +304,7 @@ func GetArticleAll2() (item []*ArticleDetail, err error) {
 // 获取文章列表
 func GetArticleList(condition string, pars []interface{}) (items []*ArticleDetail, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT	article_id FROM cygx_article  WHERE 1= 1 ` + condition
+	sql := `SELECT 	*  FROM cygx_article  WHERE 1= 1 ` + condition
 	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }

+ 0 - 16
models/industrial_activity_group_management.go

@@ -13,22 +13,6 @@ type CygxIndustrialActivityGroupManagement struct {
 	CreateTime             time.Time `description:"创建时间"`
 }
 
-type CygxIndustrialActivityGroupSubject struct {
-	Id                  int       `orm:"column(id);pk" description:"主键ID"`
-	ActivityId          int       `description:"活动ID"`
-	IndustrialSubjectId int       `description:"cygx_industrial_subject表的文章ID"`
-	Source              int       `description:"来源,1 活动,2专项调研"`
-	CreateTime          time.Time `description:"创建时间"`
-}
-
-type CygxIndustrialSubject struct {
-	IndustrialSubjectId    int       `orm:"column(industrial_subject_id);pk" description:"标的id"`
-	IndustrialManagementId int       `description:"产业id"`
-	SubjectName            string    `description:"标的名称"`
-	CreateTime             time.Time `description:"创建时间"`
-	Source                 int       `description:"来源,1正常添加,2:通过文章添加,3通过活动添加(默认为1)"`
-}
-
 // 获取标的列表
 func GetCygxIndustrialSubjectList(subjectName string) (items []*CygxIndustrialSubject, err error) {
 	o := orm.NewOrm()

+ 34 - 0
models/industrial_activity_group_subject.go

@@ -0,0 +1,34 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxIndustrialActivityGroupSubject struct {
+	Id                  int       `orm:"column(id);pk" description:"主键ID"`
+	ActivityId          int       `description:"活动ID"`
+	IndustrialSubjectId int       `description:"cygx_industrial_subject表的文章ID"`
+	Source              int       `description:"来源,1 活动,2专项调研"`
+	CreateTime          time.Time `description:"创建时间"`
+}
+
+type SubjectActivityGroupManagementRep struct {
+	IndustrialSubjectId int    `description:"产业id"`
+	SubjectName         string `description:"标的名称"`
+}
+
+// GetCygxIndustrialActivityGroupSubjectList 获取列表
+func GetCygxIndustrialActivityGroupSubjectList(condition string, pars []interface{}) (list []*CygxIndustrialActivityGroupSubject, err error) {
+	sql := `SELECT
+			*
+			FROM
+			cygx_industrial_activity_group_subject
+			WHERE
+				1 = 1 `
+	if condition != `` {
+		sql += condition
+	}
+	_, err = orm.NewOrm().Raw(sql, pars).QueryRows(&list)
+	return
+}

+ 19 - 1
models/industrial_article_group_subject.go

@@ -23,7 +23,7 @@ type SubjectArticlGroupList struct {
 func GetSubjectArticleGroupManagementList(condition string, pars []interface{}) (items []*CygxIndustrialArticleGroupSubject, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
-			ag.industrial_subject_id 
+				* 
 			FROM
 			cygx_industrial_article_group_subject AS ag
 			WHERE
@@ -46,3 +46,21 @@ func GetSubjectArticlGroupList(condition string, pars []interface{}) (items []*S
 	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }
+
+// 标的列表
+func GetIndustrialArticleGroupSubjectListByHz(IndustrialManagementId int) (items []*IndustrialSubject, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			i.* 
+		FROM
+			cygx_industrial_subject AS i
+			INNER JOIN cygx_industrial_article_group_subject AS sg ON sg.industrial_subject_id = i.industrial_subject_id
+			INNER JOIN cygx_article AS a ON a.article_id = sg.article_id 
+		WHERE
+			i.industrial_management_id = ? 
+			AND a.article_type_id = 0 
+		GROUP BY
+			i.industrial_subject_id `
+	_, err = o.Raw(sql, IndustrialManagementId).QueryRows(&items)
+	return
+}

+ 12 - 0
models/industrial_management.go

@@ -21,6 +21,18 @@ type IndustrialManagementRep struct {
 	IndustryNewLabel       bool   `description:"是否产业新标签"`
 }
 
+// 列表
+func GetIndustrialManagementRepList(condition string, pars []interface{}, startSize, pageSize int) (items []*IndustrialManagementRep, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_industrial_management as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,?  `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
 type IndustrialManagementCount struct {
 	IndustrialManagementId int `orm:"column(industrial_management_id);pk" description:"产业id"`
 }

+ 24 - 0
models/industrial_subject.go

@@ -0,0 +1,24 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxIndustrialSubject struct {
+	IndustrialSubjectId    int       `orm:"column(industrial_subject_id);pk" description:"标的id"`
+	IndustrialManagementId int       `description:"产业id"`
+	SubjectName            string    `description:"标的名称"`
+	CreateTime             time.Time `description:"创建时间"`
+	Source                 int       `description:"来源,1正常添加,2:通过文章添加,3通过活动添加(默认为1)"`
+}
+
+// 获取标的列表
+func GetCygxIndustrialSubjectListCondition(condition string, pars []interface{}) (items []*CygxIndustrialSubject, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * 
+		FROM
+			cygx_industrial_subject WHERE 1 = 1 ` + condition
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 4 - 0
models/micro_roadshow.go

@@ -53,6 +53,7 @@ type MicroRoadShowPageList struct {
 	ChartPermissionId   int    `description:"行业ID"`
 	ChartPermissionName string `description:"行业名称"`
 	IndustryName        string `description:"产业名称"`
+	IndustryId          int    `description:"产业id"`
 	PlaySeconds         string `description:"音视频时长"`
 	ActivityId          int    `description:"活动ID"`
 	IsCollect           bool   `description:"是否收藏"`
@@ -75,6 +76,7 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 			video_duration AS play_seconds,
 			img_url AS background_img,            
 			industry_name,
+			industry_id,
 			share_img_url AS share_img,
 			"" as  activity_id
 		FROM
@@ -102,6 +104,7 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 			"" AS play_seconds,
 			"" AS background_img,
 			"" AS industry_name,
+			"",
 			"" AS share_img,
 			v.activity_id
 		FROM
@@ -128,6 +131,7 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 			a.voice_play_seconds AS play_seconds,
 			a.img_url AS background_img,
 			"" AS industry_name,
+			"",
 			"" AS share_img,
 			a.activity_id 
 		FROM

+ 3 - 0
models/resource_data.go

@@ -19,6 +19,8 @@ type CygxResourceData struct {
 
 type CygxResourceDataResp struct {
 	Id                 int                                     `orm:"column(id);pk"`
+	BodyHighlight      []string                                `description:"搜索高亮展示结果"`
+	IsSummary          int                                     `description:"是否是纪要"`
 	SourceId           int                                     `description:"资源ID"`
 	Source             string                                  `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
 	PublishDate        string                                  `description:"发布时间"`
@@ -33,6 +35,7 @@ type CygxResourceDataResp struct {
 	Minutessummary     *CygxReportSelectionRep                 `description:"上周纪要汇总"`
 	Meetingreviewchapt *CygxMorningMeetingGatherDetailListResp `description:"晨会精华"`
 	ProductInterior    *CygxProductInteriorResp                `description:"产品内测"`
+	IndustrialResource *IndustrialManagementHotResp            `description:"产业资源包"`
 }
 
 // Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`

+ 9 - 0
routers/commentsRouter.go

@@ -1249,6 +1249,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:SearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:SearchController"],
+        beego.ControllerComments{
+            Method: "ComprehensiveList",
+            Router: `/comprehensive/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:SearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:SearchController"],
         beego.ControllerComments{
             Method: "SearchList",

+ 7 - 3
services/article.go

@@ -694,7 +694,10 @@ func GetArticleListByApi(cont context.Context) (err error) {
 //	//	for _, v := range allList {
 //	//		HandleArticleListByApi(v.ArticleId)
 //	//	}
-//	HandleArticleListByApi(8785)
+//
+//	for i := 8648; i < 9004; i++ {
+//		HandleArticleListByApi(i)
+//	}
 //
 //}
 
@@ -1156,8 +1159,9 @@ func HandleArticleListByApi(artcleId int) (err error) {
 		//}
 	}
 	go models.UpdateCygxArticleCeluePush(artcleId)
-
-	GetSummarytoEs(artcleId)
+	AddComprehensiveArticle(artcleId)                // 同步到综合页面的搜索引擎
+	AddComprehensiveIndustrialSource("Yx", artcleId) // 同步到综合页面的搜索引擎(添加产业资源包)
+	GetSummarytoEs(artcleId)                         // 同步到ES搜索引擎
 	GetIndustrialManagementArticleNewPublishData()
 	if len(listArticleData) > 0 {
 		for _, v := range listArticleData {

+ 2 - 0
services/chart.go

@@ -587,6 +587,8 @@ func GetChartDetailByApi(chartId int) (err error) {
 			}
 		}
 	}
+
+	go AddComprehensiveChart(chartId) //同步图表到综合页面的搜索
 	return
 
 }

+ 1465 - 0
services/es_comprehensive.go

@@ -0,0 +1,1465 @@
+package services
+
+import (
+	"context"
+	"encoding/json"
+	"fmt"
+	"github.com/PuerkitoBio/goquery"
+	"github.com/olivere/elastic/v7"
+	"strconv"
+
+	//"go/doc"
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+	"html"
+	//"strconv"
+	"errors"
+	"strings"
+	"time"
+)
+
+type SearchComprehensiveItem struct {
+	SourceId     int    `description:"资源ID"`
+	IsSummary    int    `description:"是否是纪要"`
+	Source       string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt  、 产品内测:productinterior"`
+	Title        string `description:"标题"`
+	BodyText     string `description:"内容"`
+	PublishDate  string `description:"发布时间"`
+	Abstract     string `description:"摘要"`
+	Annotation   string `description:"核心观点"`
+	IndustryName string `description:"产业名称"`
+	SubjectNames string `description:"标的名称"`
+	Body         []string
+}
+
+type ElasticComprehensiveDetail struct {
+	SourceId     int    `description:"资源ID"`
+	IsSummary    int    `description:"是否是纪要"`
+	Source       string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt  、 产品内测:productinterior 、 产业资源包:industrialsource"`
+	Title        string `description:"标题"`
+	BodyText     string `description:"内容"`
+	PublishDate  string `description:"发布时间"`
+	Abstract     string `description:"摘要"`
+	Annotation   string `description:"核心观点"`
+	IndustryName string `description:"产业名称"`
+	SubjectNames string `description:"标的名称"`
+}
+
+//func init() {
+//	AddComprehensiveIndustrialSource("Hz", 0)
+//	// AddComprehensiveArticle(0)
+//	// AddComprehensiveMeetingreviewchapt()
+//}
+
+// 添加文章:报告、纪要
+func AddComprehensiveArticle(articleId int) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("删除数据综合页面数据Es失败"+err.Error(), 2)
+		}
+	}()
+
+	IndustrialManagementRespMap, _ := GetIndustrialManagementRespMap()
+	IndustrialSubjectMap, _ := GetCygxIndustrialSubjectMap()
+	var condition1 string
+	var pars1 []interface{}
+	mapActivityIndustrialManagement := make(map[int][]string)
+	industrialgroupList, e := models.GetIndustrialArticleGroupManagementList(condition1, pars1)
+	if e != nil {
+		fmt.Println(e)
+		return
+	}
+	for _, v := range industrialgroupList {
+		if v.ArticleId == 0 {
+			continue
+		}
+		mapActivityIndustrialManagement[v.ArticleId] = append(mapActivityIndustrialManagement[v.ArticleId], IndustrialManagementRespMap[v.IndustrialManagementId])
+	}
+
+	mapActivitySubject := make(map[int][]string)
+	SubjectgroupList, e := models.GetSubjectArticleGroupManagementList(condition1, pars1)
+	if e != nil {
+		fmt.Println(e)
+		return
+	}
+	for _, v := range SubjectgroupList {
+		if v.ArticleId == 0 {
+			continue
+		}
+		mapActivitySubject[v.ArticleId] = append(mapActivitySubject[v.ArticleId], IndustrialSubjectMap[v.IndustrialSubjectId])
+	}
+
+	var condition string
+	var pars []interface{}
+	condition += ` AND publish_status  = 1  `
+	if articleId > 0 {
+		condition = ` AND article_id = ? `
+		pars = append(pars, articleId)
+	}
+	articleList, e := models.GetArticleList(condition, pars)
+
+	if e != nil {
+		err = errors.New("GetArticleList, Err: " + e.Error())
+		return
+	}
+	//indexName := utils.IndexNameComprehensive
+	for _, v := range articleList {
+		content := html.UnescapeString(v.Body)
+		doc, err := goquery.NewDocumentFromReader(strings.NewReader(content))
+		if err != nil {
+			fmt.Println("create doc err:", err.Error())
+			return
+		}
+		bodyText := doc.Text()
+		item := new(ElasticComprehensiveDetail)
+		item.SourceId = v.ArticleId
+		item.IsSummary = v.IsSummary
+		item.Source = "article"
+		item.Title = v.Title
+		item.PublishDate = v.PublishDate
+		item.BodyText = bodyText
+		if v.IsSummary == 0 {
+			item.SubjectNames = strings.Join(mapActivitySubject[v.ArticleId], ",") + "," + v.FieldName
+			item.IndustryName = strings.Join(mapActivityIndustrialManagement[v.ArticleId], ",")
+		}
+		item.Annotation, _ = GetReportContentTextSubNew(v.Annotation)
+		item.Abstract, _ = GetReportContentTextSubNew(v.Abstract)
+		EsAddOrEditComprehensiveData(item)
+		fmt.Println(item.IndustryName)
+		fmt.Println(item.SubjectNames)
+	}
+}
+
+// 添加图表
+func AddComprehensiveChart(chartId int) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("AddComprehensiveChart Err"+err.Error()+fmt.Sprint(chartId), 2)
+		}
+	}()
+	var condition string
+	var pars []interface{}
+	condition += ` AND publish_status  = 1 `
+	if chartId > 0 {
+		condition = ` AND chart_id = ? `
+		pars = append(pars, chartId)
+	}
+	list, e := models.GetChartList(condition, pars, 0, 1000000)
+	if e != nil {
+		err = errors.New("GetChartList, Err: " + e.Error())
+		return
+	}
+	//indexName := utils.IndexNameComprehensive
+	for _, v := range list {
+		item := new(ElasticComprehensiveDetail)
+		item.SourceId = v.ChartId
+		item.Source = "newchart"
+		item.Title = v.Title
+		item.PublishDate = v.CreateDate
+		EsAddOrEditComprehensiveData(item)
+		fmt.Println(v.ChartId)
+	}
+}
+
+// 添加产业资源包
+func AddComprehensiveIndustrialSource(sourceType string, articleId int) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("AddComprehensiveIndustrialSource"+err.Error(), 2)
+		}
+	}()
+	var condition string
+	var pars []interface{}
+	mapActivitySubject := make(map[int][]string, 0)
+	maplistMeetingTime := make(map[int]time.Time, 0)
+
+	listMeeting, err := models.GetCygxMorningMeetingReviewChapterList(" GROUP BY c.industry_id  ORDER BY r.publish_time DESC ", pars)
+	for _, v := range listMeeting {
+		resultTime := utils.StrTimeToTime(v.PublishTime)
+		maplistMeetingTime[v.IndustryId] = resultTime
+	}
+	listsubject, e := models.GetCygxIndustrialSubjectListCondition(condition, pars)
+	if e != nil {
+		err = errors.New("GetIndustrialManagementRepList, Err: " + e.Error())
+		return
+	}
+	for _, v := range listsubject {
+		mapActivitySubject[v.IndustrialManagementId] = append(mapActivitySubject[v.IndustrialManagementId], v.SubjectName)
+	}
+	var industrialsource string
+	if sourceType == "Hz" {
+		condition = " AND a.article_type_id  = 0  " // 弘则资源包
+		industrialsource = "industrialsourceHz"
+	} else {
+		condition = " AND a.article_type_id  > 0  " //研选资源包
+		industrialsource = "industrialsourceYx"
+	}
+	if articleId > 0 {
+		condition += "  AND a.article_id = " + strconv.Itoa(articleId)
+	}
+	list, err := models.GetSearchResourceList(0, condition, 0, 0)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	//indexName := utils.IndexNameComprehensive
+	for _, v := range list {
+		item := new(ElasticComprehensiveDetail)
+		item.SourceId = v.IndustrialManagementId
+		item.Source = industrialsource
+		item.IndustryName = v.IndustryName
+		item.SubjectNames = strings.Join(mapActivitySubject[v.IndustrialManagementId], ",")
+		item.PublishDate = v.PublishDate + " 00:00:00"
+		if sourceType == "Hz" {
+			//如果时间晚就进行替换
+			resultTime := utils.StrTimeToTime(item.PublishDate)
+			if maplistMeetingTime[v.IndustrialManagementId].After(resultTime) {
+				item.PublishDate = maplistMeetingTime[v.IndustrialManagementId].Format(utils.FormatDateTime)
+			}
+		}
+		fmt.Println(item)
+		EsAddOrEditComprehensiveData(item)
+	}
+}
+
+// 添加晨会精华
+func AddComprehensiveMeetingreviewchapt() {
+	var condition string
+	var pars []interface{}
+	IndustrialManagementRespMap, _ := GetIndustrialManagementRespMap()
+	list, err := models.GetCygxMorningMeetingReviewChapterList(condition, pars)
+
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	//indexName := utils.IndexNameComprehensive
+	for _, v := range list {
+		content := html.UnescapeString(v.Content)
+		doc, err := goquery.NewDocumentFromReader(strings.NewReader(content))
+		if err != nil {
+			fmt.Println("create doc err:", err.Error())
+			return
+		}
+		bodyText := doc.Text()
+		item := new(ElasticComprehensiveDetail)
+		item.SourceId = v.Id
+		item.Source = "meetingreviewchapt"
+		item.IndustryName = IndustrialManagementRespMap[v.IndustryId]
+		item.PublishDate = v.PublishTime
+		item.Abstract = bodyText
+		EsAddOrEditComprehensiveData(item)
+		fmt.Println(item)
+	}
+}
+
+// 添加活动
+func AddComprehensiveActivity() {
+	var condition string
+	var pars []interface{}
+	condition = ` AND publish_status = 1 `
+	//condition = ` AND publish_status = 1  AND  activity_id = 2407 `
+	list, err := models.GetCygxActivityList(condition, pars, 0, 100000)
+
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	IndustrialManagementRespMap, _ := GetIndustrialManagementRespMap()
+	IndustrialSubjectMap, _ := GetCygxIndustrialSubjectMap()
+	var condition1 string
+	var pars1 []interface{}
+	mapActivityIndustrialManagement := make(map[int][]string)
+	industrialgroupList, e := models.GetCygxIndustrialActivityGroupManagementList(condition1+"  AND  source = 1 ", pars1)
+	if e != nil {
+		fmt.Println(e)
+		return
+	}
+	for _, v := range industrialgroupList {
+		if v.ActivityId == 0 {
+			continue
+		}
+		mapActivityIndustrialManagement[v.ActivityId] = append(mapActivityIndustrialManagement[v.ActivityId], IndustrialManagementRespMap[v.IndustrialManagementId])
+	}
+
+	mapActivitySubject := make(map[int][]string)
+	SubjectgroupList, e := models.GetCygxIndustrialActivityGroupSubjectList(condition1+"  AND  source = 1 ", pars1)
+	if e != nil {
+		fmt.Println(e)
+		return
+	}
+	for _, v := range SubjectgroupList {
+		if v.ActivityId == 0 {
+			continue
+		}
+		mapActivitySubject[v.ActivityId] = append(mapActivitySubject[v.ActivityId], IndustrialSubjectMap[v.IndustrialSubjectId])
+	}
+
+	//return
+	for _, v := range list {
+		item := new(ElasticComprehensiveDetail)
+		item.SourceId = v.ActivityId
+		//item.IsSummary = v.IsSummary
+		item.Source = "activity"
+		//item.SubjectNames = json.Sprint(mapActivitySubject[v.ActivityId])
+		item.SubjectNames = strings.Join(mapActivitySubject[v.ActivityId], ",")
+		item.IndustryName = strings.Join(mapActivityIndustrialManagement[v.ActivityId], ",")
+		item.Title = v.ActivityName
+		item.PublishDate = v.ActivityTime
+		//item.BodyText = bodyText
+		//item.Annotation, _ = GetReportContentTextSubNew(v.Annotation)
+		//item.Abstract, _ = GetReportContentTextSubNew(v.Abstract)
+
+		//EsAddOrEditComprehensiveData(indexName, item)
+		EsAddOrEditComprehensiveData(item)
+		fmt.Println(item)
+	}
+}
+
+// 添加专项调研活动
+func AddComprehensiveActivitySpecial() {
+	var condition string
+	var pars []interface{}
+	condition = ` AND publish_status = 1 `
+	list, err := models.GetActivitySpecialListAll(condition, pars, 0, 100000)
+
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	//indexName := utils.IndexNameComprehensive
+	IndustrialManagementRespMap, _ := GetIndustrialManagementRespMap() // 产业标签
+	IndustrialSubjectMap, _ := GetCygxIndustrialSubjectMap()           // 标的标签
+	var condition1 string
+	var pars1 []interface{}
+	mapActivityIndustrialManagement := make(map[int][]string)
+	industrialgroupList, e := models.GetCygxIndustrialActivityGroupManagementList(condition1+"  AND  source = 2 ", pars1)
+	if e != nil {
+		fmt.Println(e)
+		return
+	}
+	for _, v := range industrialgroupList {
+		if v.ActivityId == 0 {
+			continue
+		}
+		mapActivityIndustrialManagement[v.ActivityId] = append(mapActivityIndustrialManagement[v.ActivityId], IndustrialManagementRespMap[v.IndustrialManagementId])
+	}
+
+	mapActivitySubject := make(map[int][]string)
+	SubjectgroupList, e := models.GetCygxIndustrialActivityGroupSubjectList(condition1+"  AND  source = 2 ", pars1)
+	if e != nil {
+		fmt.Println(e)
+		return
+	}
+	for _, v := range SubjectgroupList {
+		if v.ActivityId == 0 {
+			continue
+		}
+		mapActivitySubject[v.ActivityId] = append(mapActivitySubject[v.ActivityId], IndustrialSubjectMap[v.IndustrialSubjectId])
+	}
+	for _, v := range list {
+		item := new(ElasticComprehensiveDetail)
+		item.SourceId = v.ActivityId
+		item.Source = "activityspecial"
+		item.Title = v.ResearchTheme
+		item.PublishDate = v.ActivityTime
+		if v.ActivityTime == utils.FormatDateTimeInit {
+			item.PublishDate = v.LastUpdatedTime.Format(utils.FormatDateTime)
+		} else {
+			item.PublishDate = v.ActivityTime
+		}
+		item.SubjectNames = strings.Join(mapActivitySubject[v.ActivityId], ",")
+		item.IndustryName = strings.Join(mapActivityIndustrialManagement[v.ActivityId], ",")
+		EsAddOrEditComprehensiveData(item)
+	}
+}
+
+// 添加活动视频
+func AddComprehensiveActivityVideo() {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("添加活动视频综合页面数据Es失败"+err.Error(), 2)
+		}
+	}()
+	var condition string
+	var pars []interface{}
+
+	list, e := models.GetActivityVideoListAll(condition, pars, 0, 100000)
+	if e != nil {
+		err = errors.New("GetActivityVideoListAll, Err: " + e.Error())
+		return
+	}
+	if len(list) == 0 {
+		return
+	}
+	var activityIds []int
+	for _, v := range list {
+		activityIds = append(activityIds, v.ActivityId)
+	}
+
+	pars = make([]interface{}, 0)
+	condition = ` AND publish_status = 1  AND art.activity_id IN (` + utils.GetOrmInReplace(len(activityIds)) + `)`
+	pars = append(pars, activityIds)
+	listArt, e := models.GetCygxActivityList(condition, pars, 0, 100000)
+	if e != nil {
+		err = errors.New("GetCygxActivityList, Err: " + e.Error())
+		return
+	}
+	mapActivity := make(map[int]string)
+
+	for _, v := range listArt {
+		mapActivity[v.ActivityId] = v.ActivityName
+	}
+
+	IndustrialManagementRespMap, _ := GetIndustrialManagementRespMap()
+	IndustrialSubjectMap, _ := GetCygxIndustrialSubjectMap()
+	var condition1 string
+	var pars1 []interface{}
+	mapActivityIndustrialManagement := make(map[int][]string)
+	industrialgroupList, e := models.GetCygxIndustrialActivityGroupManagementList(condition1+"  AND  source = 1 ", pars1)
+	if e != nil {
+		fmt.Println(e)
+		return
+	}
+	//产业名称
+	for _, v := range industrialgroupList {
+		if v.ActivityId == 0 {
+			continue
+		}
+		mapActivityIndustrialManagement[v.ActivityId] = append(mapActivityIndustrialManagement[v.ActivityId], IndustrialManagementRespMap[v.IndustrialManagementId])
+	}
+
+	//标的名称
+	mapActivitySubject := make(map[int][]string)
+	SubjectgroupList, e := models.GetCygxIndustrialActivityGroupSubjectList(condition1+"  AND  source = 1 ", pars1)
+	if e != nil {
+		fmt.Println(e)
+		return
+	}
+	for _, v := range SubjectgroupList {
+		if v.ActivityId == 0 {
+			continue
+		}
+		mapActivitySubject[v.ActivityId] = append(mapActivitySubject[v.ActivityId], IndustrialSubjectMap[v.IndustrialSubjectId])
+	}
+
+	//indexName := utils.IndexNameComprehensive
+	for _, v := range list {
+		item := new(ElasticComprehensiveDetail)
+		item.SourceId = v.Id
+		item.Source = "activityvideo"
+		item.Title = v.Title
+		item.PublishDate = v.ActivityTime
+		item.BodyText = mapActivity[v.ActivityId]
+		item.SubjectNames = strings.Join(mapActivitySubject[v.ActivityId], ",")
+		item.IndustryName = strings.Join(mapActivityIndustrialManagement[v.ActivityId], ",")
+		EsAddOrEditComprehensiveData(item)
+		fmt.Println(item)
+	}
+}
+
+// 添加活动音频
+func AddComprehensiveActivityVoice() {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("AddComprehensiveActivityVoice"+err.Error(), 2)
+		}
+	}()
+	var condition string
+	var pars []interface{}
+
+	list, err := models.GetActivityVoiceList(condition, pars, 0, 100000)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	if len(list) == 0 {
+		return
+	}
+	var activityIds []int
+	for _, v := range list {
+		activityIds = append(activityIds, v.ActivityId)
+	}
+
+	pars = make([]interface{}, 0)
+	condition = ` AND publish_status = 1  AND art.activity_id IN (` + utils.GetOrmInReplace(len(activityIds)) + `)`
+	pars = append(pars, activityIds)
+	listArt, e := models.GetCygxActivityList(condition, pars, 0, 100000)
+	if e != nil {
+		err = errors.New("GetCygxActivityList, Err: " + e.Error())
+		return
+	}
+	mapActivity := make(map[int]string)
+
+	for _, v := range listArt {
+		mapActivity[v.ActivityId] = v.ActivityName
+	}
+
+	IndustrialManagementRespMap, _ := GetIndustrialManagementRespMap()
+	IndustrialSubjectMap, _ := GetCygxIndustrialSubjectMap()
+	var condition1 string
+	var pars1 []interface{}
+	mapActivityIndustrialManagement := make(map[int][]string)
+	industrialgroupList, e := models.GetCygxIndustrialActivityGroupManagementList(condition1+"  AND  source = 1 ", pars1)
+	if e != nil {
+		fmt.Println(e)
+		return
+	}
+	//产业名称
+	for _, v := range industrialgroupList {
+		if v.ActivityId == 0 {
+			continue
+		}
+		mapActivityIndustrialManagement[v.ActivityId] = append(mapActivityIndustrialManagement[v.ActivityId], IndustrialManagementRespMap[v.IndustrialManagementId])
+	}
+
+	//标的名称
+	mapActivitySubject := make(map[int][]string)
+	SubjectgroupList, e := models.GetCygxIndustrialActivityGroupSubjectList(condition1+"  AND  source = 1 ", pars1)
+	if e != nil {
+		fmt.Println(e)
+		return
+	}
+	for _, v := range SubjectgroupList {
+		if v.ActivityId == 0 {
+			continue
+		}
+		mapActivitySubject[v.ActivityId] = append(mapActivitySubject[v.ActivityId], IndustrialSubjectMap[v.IndustrialSubjectId])
+	}
+	//indexName := utils.IndexNameComprehensive
+	for _, v := range list {
+		item := new(ElasticComprehensiveDetail)
+		item.SourceId = v.ActivityVoiceId
+		item.Source = "activityvoice"
+		item.Title = v.VoiceName
+		item.PublishDate = v.ActivityTime
+		item.BodyText = mapActivity[v.ActivityId]
+		item.SubjectNames = strings.Join(mapActivitySubject[v.ActivityId], ",")
+		item.IndustryName = strings.Join(mapActivityIndustrialManagement[v.ActivityId], ",")
+		EsAddOrEditComprehensiveData(item)
+		fmt.Println(item)
+	}
+}
+
+// 微路演
+func AddComprehensiveRoadshow() {
+	var condition string
+	var pars []interface{}
+	IndustrialManagementRespMap, _ := GetIndustrialManagementRespMap()
+	list, err := models.GetMicroRoadshowVideoListBycondition(condition, pars, 0, 100000)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	//indexName := utils.IndexNameComprehensive
+	for _, v := range list {
+		item := new(ElasticComprehensiveDetail)
+		item.SourceId = v.VideoId
+		item.Source = "roadshow"
+		item.IndustryName = IndustrialManagementRespMap[v.IndustryId]
+		item.Title = v.VideoName
+		item.PublishDate = v.PublishDate.Format(utils.FormatDateTime)
+		EsAddOrEditComprehensiveData(item)
+		fmt.Println(item)
+	}
+}
+
+// 新增和修改数据
+func EsAddOrEditComprehensiveData(item *ElasticComprehensiveDetail) (err error) {
+	indexName := utils.IndexNameComprehensive
+	//return
+	defer func() {
+		if err != nil {
+			fmt.Println(err, item.SourceId)
+			//go utils.SendAlarmMsg("更新综合页面数据Es失败"+err.Error()+fmt.Sprint(item), 2)
+		}
+	}()
+	client := utils.Client
+	mustMap := make([]interface{}, 0)
+	mustMap = append(mustMap, map[string]interface{}{
+		"term": map[string]interface{}{
+			"SourceId": item.SourceId,
+		},
+	})
+	mustMap = append(mustMap, map[string]interface{}{
+		"term": map[string]interface{}{
+			"Source": item.Source,
+		},
+	})
+	queryMap := map[string]interface{}{
+		"query": map[string]interface{}{
+			"bool": map[string]interface{}{
+				"must": mustMap,
+			},
+		},
+	}
+	requestTotalHits := client.Count(indexName).BodyJson(queryMap)
+	total, e := requestTotalHits.Do(context.Background())
+	if e != nil {
+		err = errors.New("requestTotalHits.Do(context.Background()), Err: " + e.Error())
+		return
+	}
+	//return
+	//根据来源以及ID ,判断内容是否存在,如果存在就新增,如果不存在就修改
+	if total == 0 {
+		resp, e := client.Index().Index(indexName).BodyJson(item).Do(context.Background())
+		if e != nil {
+			err = errors.New("client.Index().Index(indexName).BodyJson(item).Do(context.Background()), Err: " + e.Error())
+			return
+		}
+		if resp.Status == 0 && resp.Result == "created" {
+			//fmt.Println("新增成功")
+			//err = nil
+			return
+		} else {
+			//err = errors.New(fmt.Sprint(resp))
+			err = errors.New(fmt.Sprint("articleId", item.SourceId))
+			return
+		}
+	} else {
+		//拼接需要改动的前置条件
+		bool_query := elastic.NewBoolQuery()
+		bool_query.Must(elastic.NewTermQuery("SourceId", item.SourceId))
+		bool_query.Must(elastic.NewTermQuery("Source", item.Source))
+		//设置需要改动的内容
+		var script string
+		script += fmt.Sprint("ctx._source['SubjectNames'] = '", item.SubjectNames, "';")
+		script += fmt.Sprint("ctx._source['PublishDate'] = '", item.PublishDate, "';")
+		script += fmt.Sprint("ctx._source['IsSummary'] = ", item.IsSummary, ";")
+		script += fmt.Sprint("ctx._source['Abstract'] = '", item.Abstract, "';")
+		script += fmt.Sprint("ctx._source['Title'] = '", item.Title, "';")
+		script += fmt.Sprint("ctx._source['BodyText'] = '", item.BodyText, "';")
+		script += fmt.Sprint("ctx._source['Annotation'] = '", item.Annotation, "';")
+		script += fmt.Sprint("ctx._source['IndustryName'] = '", item.IndustryName, "'")
+
+		_, e = client.UpdateByQuery(indexName).
+			Query(bool_query).
+			Script(elastic.NewScriptInline(script)).
+			Refresh("true").
+			Do(context.Background())
+
+		if e != nil && e.Error() != "elastic: Error 400 (Bad Request): compile error [type=script_exception]" {
+			//文本内容过长的时候,修改会报 400 的错误,暂时先不处理
+			//fmt.Println("err", e.Error())
+			////err = e
+			//err = errors.New("client.UpdateByQuery(indexName), Err: " + e.Error())
+			return
+		}
+	}
+	return
+}
+
+// 删除数据
+func EsDeleteComprehensiveData(item *ElasticComprehensiveDetail) (err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("删除数据综合页面数据Es失败"+err.Error()+fmt.Sprint(item), 2)
+		}
+	}()
+	indexName := utils.IndexNameComprehensive
+	client := utils.Client
+	//拼接需要删除的前置条件
+	bool_query := elastic.NewBoolQuery()
+	bool_query.Must(elastic.NewTermQuery("SourceId", item.SourceId))
+	bool_query.Must(elastic.NewTermQuery("Source", item.Source))
+	_, e := client.DeleteByQuery(indexName).
+		Query(bool_query).
+		Do(context.Background())
+	if e != nil {
+		err = errors.New(" client.DeleteByQuery(indexName), Err: " + e.Error())
+		return
+	}
+	return
+}
+
+func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*SearchComprehensiveItem, total int64, err error) {
+	indexName := utils.IndexNameComprehensive
+	client := utils.Client
+	keyWordArr, err := GetIndustryMapNameSliceV3(keyWord)
+	keyWordArr = RemoveDuplicatesAndEmpty(keyWordArr)
+	keyWordLen := len(keyWordArr)
+	if keyWordLen <= 0 {
+		keyWordArr = append(keyWordArr, keyWord)
+		keyWordLen = len(keyWordArr)
+	}
+
+	//Es 的高级查询有 自定义排序 文档一时半会儿撸不懂,先做多次查询手动过滤 2023.2.2
+	//ikType 查询方式 ,0:查所有 、 1:查询键入词 、 2:查询除了查询键入词之外的联想词
+	mustMap := make([]interface{}, 0)
+	shouldMap := make(map[string]interface{}, 0)
+	shouldMapquery := make([]interface{}, 0)
+
+	mustNotMap := make([]interface{}, 0)
+	shouldNotMap := make(map[string]interface{}, 0)
+	shouldNotMapquery := make([]interface{}, 0)
+	// @Param   OrderColumn   query   int  true       "排序字段 ,Comprehensive综合 ,Matching匹配度 ,PublishDate 发布时间 "
+	//keyWordWeight := GetWeight(keyWordLen)
+	var boost int
+	//lenkeyWordArr := len(keyWordArr)
+	for k, v := range keyWordArr {
+		if k > 0 {
+			continue
+		}
+		if k == 0 {
+			boost = 2 * 1000
+		} else {
+			boost = 1
+		}
+
+		if v != "" {
+			shouldMapquery = append(shouldMapquery, map[string]interface{}{
+				"function_score": map[string]interface{}{
+					"query": map[string]interface{}{
+						"multi_match": map[string]interface{}{
+							//"boost":  (lenkeyWordArr - k) * boost, //给查询的值赋予权重
+							"boost":  boost, //给查询的值赋予权重
+							"fields": []interface{}{"Title"},
+							"query":  v,
+						},
+					},
+				},
+			})
+			shouldMapquery = append(shouldMapquery, map[string]interface{}{
+				"function_score": map[string]interface{}{
+					"query": map[string]interface{}{
+						"multi_match": map[string]interface{}{
+							"boost":  boost, //给查询的值赋予权重
+							"fields": []interface{}{"Abstract"},
+							"query":  v,
+						},
+					},
+				},
+			})
+			shouldMapquery = append(shouldMapquery, map[string]interface{}{
+				"function_score": map[string]interface{}{
+					"query": map[string]interface{}{
+						"multi_match": map[string]interface{}{
+							"boost":  boost, //给查询的值赋予权重
+							"fields": []interface{}{"Annotation"},
+							"query":  v,
+						},
+					},
+				},
+			})
+
+			//shouldMapquery = append(shouldMapquery, map[string]interface{}{
+			//	"function_score": map[string]interface{}{
+			//		"query": map[string]interface{}{
+			//			"multi_match": map[string]interface{}{
+			//				//"boost":  (lenkeyWordArr-k)*boost - 1, //给查询的值赋予权重
+			//				"boost":  boost, //给查询的值赋予权重
+			//				"fields": []interface{}{"BodyText"},
+			//				"query":  v,
+			//			},
+			//		},
+			//	},
+			//})
+
+			shouldMapquery = append(shouldMapquery, map[string]interface{}{
+				"function_score": map[string]interface{}{
+					"query": map[string]interface{}{
+						"multi_match": map[string]interface{}{
+							//"boost":  (lenkeyWordArr-k)*boost - 1, //给查询的值赋予权重
+							"boost":  boost, //给查询的值赋予权重
+							"fields": []interface{}{"IndustryName"},
+							"query":  v,
+						},
+					},
+				},
+			})
+
+			shouldMapquery = append(shouldMapquery, map[string]interface{}{
+				"function_score": map[string]interface{}{
+					"query": map[string]interface{}{
+						"multi_match": map[string]interface{}{
+							//"boost":  (lenkeyWordArr-k)*boost - 1, //给查询的值赋予权重
+							"boost":  boost, //给查询的值赋予权重
+							"fields": []interface{}{"SubjectNames"},
+							"query":  v,
+						},
+					},
+				},
+			})
+		}
+	}
+	shouldMap = map[string]interface{}{
+		"should": shouldMapquery,
+	}
+
+	shouldNotMap = map[string]interface{}{
+		"should": shouldNotMapquery,
+	}
+	//排序
+	sortMap := make([]interface{}, 0)
+
+	//时间
+	sortMap = append(sortMap, map[string]interface{}{
+		"PublishDate": map[string]interface{}{
+			"order": "desc",
+		},
+	})
+	//sortMap = append(sortMap, map[string]interface{}{
+	//	"_score": map[string]interface{}{
+	//		"order": "desc",
+	//	},
+	//})
+	//高亮
+	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{}{},
+		},
+		//样式 红色
+		"post_tags":     []interface{}{"</font>"},
+		"pre_tags":      []interface{}{"<font color='red'>"},
+		"fragment_size": 50,
+	}
+
+	mustMap = append(mustMap, map[string]interface{}{
+		"bool": shouldMap,
+	})
+	mustNotMap = append(mustNotMap, map[string]interface{}{
+		"bool": shouldNotMap,
+	})
+
+	queryMap := map[string]interface{}{
+		"query": map[string]interface{}{
+			"bool": map[string]interface{}{
+				"must": mustMap,
+			},
+		},
+	}
+
+	queryMap["sort"] = sortMap
+	queryMap["from"] = startSize
+	queryMap["size"] = pageSize
+	queryMap["highlight"] = highlightMap
+	//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())
+	if searchByMatch != nil {
+		if searchByMatch.Hits != nil {
+			for _, v := range searchByMatch.Hits.Hits {
+				var isAppend bool
+				articleJson, err := v.Source.MarshalJSON()
+				if err != nil {
+					return nil, 0, err
+				}
+				article := new(ElasticComprehensiveDetail)
+				err = json.Unmarshal(articleJson, &article)
+				if err != nil {
+					return nil, 0, err
+				}
+				//fmt.Println(article.SourceId, article.Title, article.Source)
+				searchItem := new(SearchComprehensiveItem)
+				searchItem.SourceId = article.SourceId
+				if len(v.Highlight["Annotation"]) > 0 {
+					for _, vText := range v.Highlight["Annotation"] {
+						searchItem.Body = append(searchItem.Body, vText)
+					}
+				}
+				if len(v.Highlight["Abstract"]) > 0 {
+					for _, vText := range v.Highlight["Abstract"] {
+						searchItem.Body = append(searchItem.Body, vText)
+					}
+				}
+				if len(v.Highlight["BodyText"]) > 0 {
+					for _, vText := range v.Highlight["BodyText"] {
+						searchItem.Body = append(searchItem.Body, vText)
+					}
+				}
+				//searchItem.IsSummary = article.IsSummary
+				//if len(searchItem.Body) == 0 {
+				//	bodyRune := []rune(article.BodyText)
+				//	bodyRuneLen := len(bodyRune)
+				//	if bodyRuneLen > 100 {
+				//		bodyRuneLen = 100
+				//	}
+				//	body := string(bodyRune[:bodyRuneLen])
+				//	searchItem.Body = []string{body}
+				//}
+				var title string
+				if len(v.Highlight["Title"]) > 0 {
+					title = v.Highlight["Title"][0]
+				} else {
+					title = article.Title
+				}
+				searchItem.Title = title
+				searchItem.Source = article.Source
+				searchItem.PublishDate = article.PublishDate
+
+				if !isAppend {
+					result = append(result, searchItem)
+				}
+			}
+		}
+		total = searchByMatch.Hits.TotalHits.Value
+	}
+	return
+}
+
+func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserItem) (items []*models.CygxResourceDataResp, err error) {
+	var condition string
+	var pars []interface{}
+	uid := user.UserId
+	titleHighlight := make(map[int]string)
+	bodyHighlight := make(map[int][]string)
+	//var bodyHighlight []string
+	mapItems := make(map[string]*models.CygxResourceDataResp)
+	for _, v := range list {
+		//预处理文章
+		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
+		//fmt.Println(v.Title)
+		//} else {
+		//	item.BodyHighlight = make([]string, 0)
+		//}
+		item.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
+		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 industrialResourceIdsHz []int // 弘则产业资源包
+	var industrialResourceIdsYx []int // 研选产业资源包
+	//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt "`
+	for _, v := range list {
+		if v.Source == "article" {
+			articleIds = append(articleIds, v.SourceId)
+		} else if v.Source == "newchart" {
+			newchartIds = append(newchartIds, v.SourceId)
+		} else if v.Source == "roadshow" {
+			roadshowIds = append(roadshowIds, strconv.Itoa(v.SourceId))
+		} else if v.Source == "activity" {
+			activityIds = append(activityIds, v.SourceId)
+		} else if v.Source == "activityvideo" {
+			activityvideoIds = append(activityvideoIds, strconv.Itoa(v.SourceId))
+		} else if v.Source == "activityvoice" {
+			activityvoiceIds = append(activityvoiceIds, strconv.Itoa(v.SourceId))
+		} else if v.Source == "activityspecial" {
+			activityspecialIds = append(activityspecialIds, v.SourceId)
+		} else if v.Source == "researchsummary" {
+			researchsummaryIds = append(researchsummaryIds, v.SourceId)
+		} else if v.Source == "minutessummary" {
+			minutessummaryIds = append(minutessummaryIds, v.SourceId)
+		} else if v.Source == "meetingreviewchapt" {
+			meetingreviewchaptIds = append(meetingreviewchaptIds, v.SourceId)
+		} else if v.Source == "productinterior" {
+			productinteriorIds = append(productinteriorIds, v.SourceId)
+		} else if v.Source == "industrialsourceHz" {
+			industrialResourceIdsHz = append(industrialResourceIdsHz, v.SourceId)
+		} else if v.Source == "industrialsourceYx" {
+			industrialResourceIdsYx = append(industrialResourceIdsYx, v.SourceId)
+		}
+	}
+	//处理文章
+	if len(articleIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = ` AND a.article_id IN (` + utils.GetOrmInReplace(len(articleIds)) + `)`
+		pars = append(pars, articleIds)
+
+		listArticle, e := models.GetHomeList(condition, pars, 0, len(articleIds))
+		if e != nil {
+			err = errors.New("GetResourceDataList, Err: " + e.Error())
+			return
+		}
+
+		listArticle, e = HandleArticleCategoryImg(listArticle)
+		if e != nil {
+			err = errors.New("HandleArticleCategoryImg, Err: " + e.Error())
+			return
+		}
+		for _, v := range listArticle {
+			v.Body = ""
+			v.BodyHtml = ""
+			if titleHighlight[v.ArticleId] != "" {
+				v.Title = titleHighlight[v.ArticleId]
+			}
+			if len(bodyHighlight[v.ArticleId]) > 0 {
+				v.Abstract = ""
+				v.Annotation = ""
+				v.BodyHighlight = bodyHighlight[v.ArticleId]
+			} else {
+				v.BodyHighlight = make([]string, 0)
+			}
+			mapItems[fmt.Sprint("article", v.ArticleId)].Article = v
+		}
+	}
+
+	//处理晨会精华
+	if len(meetingreviewchaptIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = ` AND c.id IN (` + utils.GetOrmInReplace(len(meetingreviewchaptIds)) + `)`
+		pars = append(pars, meetingreviewchaptIds)
+
+		listrMeet, e := models.GetCygxMorningMeetingReviewChapterList(condition, pars)
+		if e != nil {
+			err = errors.New("GetResourceDataList, Err: " + e.Error())
+			return
+		}
+		for _, v := range listrMeet {
+			v.Content = AnnotationHtml(v.Content)
+			v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)
+			mapItems[fmt.Sprint("meetingreviewchapt", v.Id)].Meetingreviewchapt = v
+		}
+	}
+
+	//处理上周纪要汇总
+	if len(minutessummaryIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = ` AND article_id IN (` + utils.GetOrmInReplace(len(minutessummaryIds)) + `)`
+		pars = append(pars, minutessummaryIds)
+
+		listresearchsummary, e := models.GetReportSelectionListHome(condition, "cygx_minutes_summary", pars, 0, len(minutessummaryIds))
+		if e != nil {
+			err = errors.New("GetResourceDataList, Err: " + e.Error())
+			return
+		}
+		for _, v := range listresearchsummary {
+			v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
+			mapItems[fmt.Sprint("minutessummary", v.ArticleId)].Minutessummary = v
+		}
+	}
+
+	//处理本周纪要汇总
+	if len(researchsummaryIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = ` AND article_id IN (` + utils.GetOrmInReplace(len(researchsummaryIds)) + `)`
+		pars = append(pars, researchsummaryIds)
+
+		listresearchsummary, e := models.GetReportSelectionListHome(condition, "cygx_research_summary", pars, 0, len(researchsummaryIds))
+		if e != nil {
+			err = errors.New("GetReportSelectionListHome, Err: " + e.Error())
+			return
+		}
+		for _, v := range listresearchsummary {
+			v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
+			mapItems[fmt.Sprint("researchsummary", v.ArticleId)].Researchsummary = v
+		}
+	}
+
+	//处理产品内测
+	if len(productinteriorIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = `  AND art.status = 1 AND art.product_interior_id  IN (` + utils.GetOrmInReplace(len(productinteriorIds)) + `)`
+		pars = append(pars, productinteriorIds)
+		listProductInterior, e := models.GetCygxProductInteriorList(condition, pars, 0, len(productinteriorIds))
+		if e != nil {
+			err = errors.New("GetCygxProductInteriorList, Err: " + e.Error())
+			return
+		}
+		for _, v := range listProductInterior {
+			v.Body = ProductInteriorHtml(v.Body)
+			v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)
+			mapItems[fmt.Sprint("productinterior", v.ProductInteriorId)].ProductInterior = v
+		}
+	}
+
+	detail, e := models.GetConfigByCode("city_img_url")
+	if e != nil {
+		err = errors.New("GetResourceDataList, Err: " + e.Error())
+		return
+	}
+	detailChart, e := models.GetConfigByCode("chart_img_url")
+	if e != nil {
+		err = errors.New("GetResourceDataList, Err: " + e.Error())
+		return
+	}
+	addressList := strings.Split(detail.ConfigValue, "{|}")
+	mapAddress := make(map[string]string)
+	chartList := strings.Split(detailChart.ConfigValue, "{|}")
+	mapChart := make(map[string]string)
+	var cityName string
+	var chartName string
+	var imgUrl string
+	var imgUrlChart string
+	for _, v := range addressList {
+		vslice := strings.Split(v, "_")
+		cityName = vslice[0]
+		imgUrl = vslice[len(vslice)-1]
+		mapAddress[cityName] = imgUrl
+	}
+	for _, v := range chartList {
+		vslice := strings.Split(v, "_")
+		chartName = vslice[0]
+		imgUrlChart = vslice[len(vslice)-1]
+		mapChart[chartName] = imgUrlChart
+	}
+	var imgUrlResp string
+	//处理活动
+	if len(activityIds) > 0 {
+		for _, vss := range activityIds {
+			imgUrlResp += strconv.Itoa(vss) + ","
+		}
+		pars = make([]interface{}, 0)
+		condition = ` AND art.activity_id IN (` + utils.GetOrmInReplace(len(activityIds)) + `)`
+		pars = append(pars, activityIds)
+		activityList, e := models.GetActivityListNew(condition, pars, uid, 0, len(activityIds), 0, 0, "")
+		if e != nil {
+			err = errors.New("GetResourceDataList, Err: " + e.Error())
+			return
+		}
+		//处理不同的报名方式按钮回显
+		mapActivitySignup, e := GetActivitySignupResp(activityIds, user)
+		if e != nil {
+			e = errors.New("GetActivitySignupResp, Err: " + e.Error())
+			return
+		}
+
+		var activityListRersp []*models.ActivityDetail
+		for _, v := range activityList {
+			v.SignupType = mapActivitySignup[v.ActivityId]
+			activityListRersp = append(activityListRersp, ActivityButtonShow(v))
+		}
+		for _, v := range activityListRersp {
+			if v == nil {
+				continue
+			}
+			if v.ActivityType == 0 {
+				if mapAddress[v.City] != "" {
+					imgUrlResp = mapAddress[v.City]
+				} else {
+					imgUrlResp = mapAddress["其它"]
+				}
+			} else {
+				if mapChart[v.ChartPermissionName] != "" {
+					imgUrlResp = mapChart[v.ChartPermissionName]
+				}
+			}
+			v.SourceType = 1
+			v.Expert, _ = GetReportContentTextSub(v.Expert)
+			mapItems[fmt.Sprint("activity", v.ActivityId)].Activity = 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_id = 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(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_id > 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
+		}
+		mapIndustrial := make(map[string]int)
+		for _, v := range listSubjcet {
+			for k2, v2 := range listIndustrialResourceIds {
+				if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] == 0 {
+					listIndustrialResourceIds[k2].IndustrialSubjectList = append(listIndustrialResourceIds[k2].IndustrialSubjectList, v)
+				}
+			}
+		}
+		for _, v := range listIndustrialResourceIds {
+			v.Source = 2
+			mapItems[fmt.Sprint("industrialsourceYx", v.IndustrialManagementId)].IndustrialResource = v
+		}
+	}
+
+	//处理图表
+	if len(newchartIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = ` AND a.chart_id IN (` + utils.GetOrmInReplace(len(newchartIds)) + `)`
+		pars = append(pars, newchartIds)
+		chartDateList, e := models.GetChartListCollectionNew(condition, pars, uid, 0, len(newchartIds))
+		if e != nil {
+			err = errors.New("GetResourceDataList, Err: " + e.Error())
+			return
+		}
+		for _, v := range chartDateList {
+			mapItems[fmt.Sprint("newchart", v.ChartId)].Newchart = v
+		}
+	}
+
+	//处理专项调研
+	if len(activityspecialIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = ` AND art.activity_id IN (` + utils.GetOrmInReplace(len(activityspecialIds)) + `)`
+		pars = append(pars, activityspecialIds)
+		activitySpeciallist, e := models.GetCygxActivitySpecialDetailList(condition, pars, user.UserId, 0, len(activityspecialIds))
+		if e != nil {
+			err = errors.New("GetCygxActivitySpecialDetailList, Err: " + e.Error())
+			return
+		}
+		UserMap, e := GetSpecialTripUserMap(activityIds, user.UserId)
+		if e != nil {
+			err = errors.New("GetSpecialTripUserMap, Err: " + e.Error())
+			return
+		}
+		for _, v := range activitySpeciallist {
+			if mapChart[v.ChartPermissionName] != "" {
+				imgUrlResp = mapChart[v.ChartPermissionName]
+			}
+			if _, ok := UserMap[v.ActivityId]; ok {
+				v.IsTrip = 1
+			}
+			if v.Days == 0 {
+				v.TripStatus = 1
+				v.TripImgLink = v.TripImgLink
+			} else {
+				v.TripStatus = 2
+				v.TripImgLink = v.TripImgLinkFix
+				v.ActivityTimeText = v.ActivityTimeTextByDay
+			}
+			resultTimeStart := utils.StrTimeToTime(v.ActivityTime)  //时间字符串格式转时间格式
+			resultTimeEnd := utils.StrTimeToTime(v.ActivityTimeEnd) //时间字符串格式转时间格式
+			if resultTimeStart.After(time.Now()) {
+				v.ActiveState = 1
+			} else if time.Now().After(resultTimeEnd) {
+				v.ActiveState = 3
+			} else {
+				v.ActiveState = 2
+			}
+			v.ImgUrl = imgUrlResp
+			mapItems[fmt.Sprint("activityspecial", v.ActivityId)].Activityspecial = v
+
+		}
+	}
+
+	if len(roadshowIds)+len(activityvideoIds)+len(activityvoiceIds) > 0 {
+
+		audioIdstr := strings.Join(activityvoiceIds, ",")
+		ideoIdsStr := strings.Join(roadshowIds, ",")
+		activityVideoIdsStr := strings.Join(activityvideoIds, ",")
+
+		list, _, e := GetMicroRoadShowMycollect(len(roadshowIds)+len(activityvideoIds)+len(activityvoiceIds), 0, audioIdstr, ideoIdsStr, activityVideoIdsStr)
+		if e != nil {
+			err = errors.New("GetMicroRoadShowMycollect, Err: " + e.Error())
+			return
+		}
+
+		for _, item := range list {
+			if item.Type == 1 {
+				//音频
+				count, e := models.GetVoiceCollectCount(user.UserId, item.Id)
+				if e != nil {
+					err = errors.New("GetVoiceCollectCount, Err: " + e.Error())
+					return
+				}
+				if count > 0 {
+					item.IsCollect = true
+				}
+			} else if item.Type == 2 {
+				//活动视频
+				count, e := models.GetActivityVideoCollectCount(user.UserId, item.Id)
+				if e != nil {
+					err = errors.New("GetActivityVideoCollectCount, Err: " + e.Error())
+					return
+				}
+				if count > 0 {
+					item.IsCollect = true
+				}
+			} else if item.Type == 3 {
+				//微路演视频
+				count, e := models.GetVideoCollectCount(user.UserId, item.Id)
+				if e != nil {
+					err = errors.New("GetVideoCollectCount, Err: " + e.Error())
+					return
+				}
+				if count > 0 {
+					item.IsCollect = true
+				}
+			}
+		}
+		// 用户权限
+		authInfo, permissionArr, e := GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
+		if e != nil {
+			err = errors.New("GetUserRaiPermissionInfo, Err: " + e.Error())
+			return
+		}
+
+		// 获取默认图配置
+		audioMap, videoMap, audioShareMap, videoShareMap, e := GetMicroRoadShowDefaultImgConfig()
+		if e != nil {
+			err = errors.New("GetMicroRoadShowDefaultImgConfig, Err: " + e.Error())
+			return
+		}
+		//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
+		for i := range list {
+			// 权限
+			au := new(models.UserPermissionAuthInfo)
+			au.SellerName = authInfo.SellerName
+			au.SellerMobile = authInfo.SellerMobile
+			au.HasPermission = authInfo.HasPermission
+			au.OperationMode = authInfo.OperationMode
+			if au.HasPermission == 1 {
+				// 非宏观权限进一步判断是否有权限
+				if list[i].ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, list[i].ChartPermissionName) {
+					au.HasPermission = 2
+				}
+			}
+			// 无权限的弹框提示
+			if au.HasPermission != 1 {
+				if au.OperationMode == UserPermissionOperationModeCall {
+					if list[i].Type == 1 {
+						au.PopupMsg = UserPermissionPopupMsgCallActivity
+					} else {
+						au.PopupMsg = UserPermissionPopupMsgCallMicroVideo
+					}
+				} else {
+					if list[i].Type == 1 {
+						au.PopupMsg = UserPermissionPopupMsgApplyActivity
+					} else {
+						au.PopupMsg = UserPermissionPopupMsgApplyMicroVideo
+					}
+				}
+			}
+			list[i].AuthInfo = au
+			list[i].PublishTime = utils.StrTimeToTime(list[i].PublishTime).Format(utils.FormatDate)
+			// 默认图
+			if list[i].BackgroundImg == "" {
+				if list[i].Type == 1 {
+					list[i].BackgroundImg = audioMap[list[i].ChartPermissionId]
+				} else {
+					list[i].BackgroundImg = videoMap[list[i].ChartPermissionId]
+				}
+			}
+			// 分享图
+			if list[i].ShareImg == "" {
+				if list[i].Type == 1 {
+					list[i].ShareImg = audioShareMap[list[i].ChartPermissionId]
+				} else {
+					list[i].ShareImg = videoShareMap[list[i].ChartPermissionId]
+				}
+			}
+		}
+		//Type                int    `description:"类型: 1-音频; 2-活动视频; 3-产业视频"`
+		for _, item := range list {
+			if item.Type == 1 {
+				mapItems[fmt.Sprint("activityvoice", item.Id)].Activityvoice = item
+			} else if item.Type == 2 {
+				mapItems[fmt.Sprint("activityvideo", item.Id)].Activityvideo = item
+			} else if item.Type == 3 {
+				mapItems[fmt.Sprint("roadshow", item.Id)].Roadshow = item
+			}
+		}
+	}
+
+	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.SourceId == vList.SourceId {
+				v.Article.Title = vList.Title
+			}
+			if v.Newchart != nil && v.SourceId == vList.SourceId {
+				v.Newchart.Title = vList.Title
+			}
+			if v.Roadshow != nil && v.SourceId == vList.SourceId {
+				v.Roadshow.Title = vList.Title
+			}
+			if v.Activity != nil && v.SourceId == vList.SourceId {
+				v.Activity.ActivityName = vList.Title
+			}
+			if v.Activityvideo != nil && v.SourceId == vList.SourceId {
+				v.Activityvideo.Title = vList.Title
+			}
+			if v.Activityvoice != nil && v.SourceId == vList.SourceId {
+				v.Activityvoice.Title = vList.Title
+			}
+
+			if v.Activityspecial != nil && v.SourceId == vList.SourceId {
+				v.Activityspecial.ResearchTheme = vList.Title
+			}
+			if v.Researchsummary != nil && v.SourceId == vList.SourceId {
+				v.Researchsummary.Title = vList.Title
+			}
+			if v.Minutessummary != nil && v.SourceId == vList.SourceId {
+				v.Minutessummary.Title = vList.Title
+			}
+			if v.ProductInterior != nil && v.SourceId == vList.SourceId {
+				v.ProductInterior.Title = vList.Title
+			}
+			//if v.IndustrialResource != nil && v.SourceId == vList.SourceId {
+			//	v.IndustrialResource.UpdateTime = vList.PublishDate
+			//}
+			if v.SourceId == vList.SourceId && v.Source == vList.Source {
+				items = append(items, v)
+			}
+		}
+	}
+	for _, v := range items {
+		if v.IndustrialResource != nil {
+			v.Source = "industrialsource"
+		}
+	}
+	return
+}

+ 47 - 1
services/industrial_management.go

@@ -41,7 +41,7 @@ func UpdateIndustrialManagementLabel(cont context.Context) (err error) {
 	return
 }
 
-// 修改活动状态
+// 修改状态
 func UpdateIndustrialManagementSubjectNnames() (err error) {
 	defer func() {
 		if err != nil {
@@ -750,3 +750,49 @@ func GetLyjhArticleMap() (mapResp map[int]bool, err error) {
 	}
 	return
 }
+
+// 获取所有的产业id与名称的map关联
+func GetIndustrialManagementRespMap() (itemMap map[int]string, err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("GetIndustrialManagementRespMap ErrMsg:"+err.Error(), 2)
+		}
+	}()
+	var condition string
+	var pars []interface{}
+	itemMap = make(map[int]string, 0)
+	industrialList, e := models.GetIndustrialManagementRepList(condition, pars, 0, 999999)
+	if e != nil {
+		err = errors.New("GetIndustrialManagementRepList, Err: " + e.Error())
+		return
+	}
+	if len(industrialList) > 0 {
+		for _, v := range industrialList {
+			itemMap[v.IndustrialManagementId] = v.IndustryName
+		}
+	}
+	return
+}
+
+// 获取所有的标的id与名称的map关联
+func GetCygxIndustrialSubjectMap() (itemMap map[int]string, err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("GetCygxIndustrialSubjectMap ErrMsg:"+err.Error(), 2)
+		}
+	}()
+	var condition string
+	var pars []interface{}
+	itemMap = make(map[int]string, 0)
+	list, e := models.GetCygxIndustrialSubjectListCondition(condition, pars)
+	if e != nil {
+		err = errors.New("GetIndustrialManagementRepList, Err: " + e.Error())
+		return
+	}
+	if len(list) > 0 {
+		for _, v := range list {
+			itemMap[v.IndustrialSubjectId] = v.SubjectName
+		}
+	}
+	return
+}

+ 3 - 0
services/keyword.go

@@ -96,6 +96,9 @@ func SearchKeywordUserRmind(user *models.WxUserItem, keyWord string) (err error)
 			err = errors.New("GetSellerByAdminId, Err: " + e.Error())
 			return
 		}
+		if len(openIdList) == 0 {
+			return
+		}
 		first = fmt.Sprint("互动:搜索,", user.RealName, "--", user.CompanyName)
 		keyword1 = "搜索关键词:" + keyWord
 		keyword2 = first

+ 3 - 0
utils/config.go

@@ -58,6 +58,7 @@ var (
 var (
 	IndexName                 string
 	IndexNameArticleHistory   string //文章阅读记录Es索引
+	IndexNameComprehensive    string //综合搜索Es索引
 	OnlineTime                string
 	SummaryArticleId          int
 	YanxSummaryPermissionId   int    //研选纪要分类ID
@@ -163,6 +164,7 @@ func init() {
 		WxPublicId = "gh_b67e0049fb8c"
 		IndexName = "cygx_article_v03_23"
 		IndexNameArticleHistory = "cygx_article_history_v07_08"
+		IndexNameComprehensive = "cygx_comprehensive"
 
 		//接收附件邮箱
 		EmailTechnology = "mlluo@hzinsights.com;jxu@hzinsights.com;tshen@hzinsights.com;cxzhang@hzinsights.com;jhwang@hzinsights.com;hwang@hzinsights.com;rli@hzinsights.com"       //科技行业专家邮箱
@@ -199,6 +201,7 @@ func init() {
 		WxPublicId = "gh_5dc508325c6f"
 		IndexName = "cygx_article_v1"
 		IndexNameArticleHistory = "cygx_article_history_v1"
+		IndexNameComprehensive = "cygx_comprehensive_test"
 
 		//接收附件邮箱
 		EmailTechnology = "jhwang@hzinsights.com;cxzhang@hzinsights.com"  //科技行业专家邮箱

+ 11 - 0
utils/elastic.go

@@ -14,9 +14,20 @@ const (
 )
 
 func init() {
+	//errorlog := log.New(os.Stdout, "APP", log.LstdFlags)
+	//file := ""
+	//if RunMode == "release" {
+	//	//file = `/data/rdlucklog/hongze_cygx/eslog.log`
+	//	file = `./rdlucklog/eslog.log`
+	//} else {
+	//	file = `./rdlucklog/eslog.log`
+	//}
+	//logFile, _ := os.OpenFile(file, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0766)
 	client, err := elastic.NewClient(
 		elastic.SetURL(ES_URL),
 		elastic.SetBasicAuth(ES_USERNAME, ES_PASSWORD),
+		//elastic.SetTraceLog(log.New(logFile, "ES-TRACE: ", 0)),
+		//elastic.SetSniff(false), elastic.SetErrorLog(errorlog))
 		elastic.SetSniff(false))
 	Client = client
 	if err != nil {