|
@@ -45,31 +45,43 @@ type ElasticComprehensiveDetail struct {
|
|
|
SubjectNames string `description:"标的名称"`
|
|
|
}
|
|
|
|
|
|
-func init() {
|
|
|
- //AddComprehensiveArticle()
|
|
|
- //AddComprehensiveActivity()
|
|
|
- //AddComprehensiveIndustrialSource()
|
|
|
- // AddComprehensiveMeetingreviewchapt()
|
|
|
- // AddComprehensiveActivity()
|
|
|
- //
|
|
|
- // AddComprehensiveActivitySpecial()
|
|
|
- // AddComprehensiveActivityVideo()
|
|
|
- // AddComprehensiveActivityVoice()
|
|
|
- // AddComprehensiveRoadshow()
|
|
|
-}
|
|
|
+//func init() {
|
|
|
+//AddComprehensiveChart(5502)
|
|
|
+//AddComprehensiveActivity()
|
|
|
+//AddComprehensiveIndustrialSource()
|
|
|
+// AddComprehensiveMeetingreviewchapt()
|
|
|
+// AddComprehensiveActivity()
|
|
|
+//
|
|
|
+// AddComprehensiveActivitySpecial()
|
|
|
+// AddComprehensiveActivityVideo()
|
|
|
+// AddComprehensiveActivityVoice()
|
|
|
+// AddComprehensiveRoadshow()
|
|
|
+//}
|
|
|
|
|
|
// 添加文章:报告、纪要
|
|
|
-func AddComprehensiveArticle() {
|
|
|
- //endDate := time.Now().AddDate(0, 0, -30).Format(utils.FormatDate)
|
|
|
- allList, err := models.GetArticleAll()
|
|
|
- //allList, err := models.GetArticleAllDate(endDate)
|
|
|
- if err != nil {
|
|
|
- //fmt.Println()
|
|
|
- fmt.Println("GetArticleAll Err:", err.Error())
|
|
|
+func AddComprehensiveArticle(articleId int) {
|
|
|
+ var err error
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ go utils.SendAlarmMsg("删除数据综合页面数据Es失败"+err.Error(), 2)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ 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 allList {
|
|
|
+ //indexName := utils.IndexNameComprehensive
|
|
|
+ for _, v := range articleList {
|
|
|
content := html.UnescapeString(v.Body)
|
|
|
doc, err := goquery.NewDocumentFromReader(strings.NewReader(content))
|
|
|
if err != nil {
|
|
@@ -86,29 +98,40 @@ func AddComprehensiveArticle() {
|
|
|
item.BodyText = bodyText
|
|
|
item.Annotation, _ = GetReportContentTextSubNew(v.Annotation)
|
|
|
item.Abstract, _ = GetReportContentTextSubNew(v.Abstract)
|
|
|
- EsAddOrEditComprehensiveData(indexName, item)
|
|
|
+ EsAddOrEditComprehensiveData(item)
|
|
|
fmt.Println(v.ArticleId)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 添加图表
|
|
|
-func AddComprehensiveChart() {
|
|
|
+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{}
|
|
|
- list, err := models.GetChartList(condition, pars, 0, 1000000)
|
|
|
- if err != nil {
|
|
|
- //fmt.Println()
|
|
|
- fmt.Println("GetArticleAll Err:", err.Error())
|
|
|
+ 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
|
|
|
+ //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(indexName, item)
|
|
|
+ EsAddOrEditComprehensiveData(item)
|
|
|
fmt.Println(v.ChartId)
|
|
|
}
|
|
|
}
|
|
@@ -138,7 +161,7 @@ func AddComprehensiveIndustrialSource() {
|
|
|
fmt.Println(err)
|
|
|
return
|
|
|
}
|
|
|
- indexName := utils.IndexNameComprehensive
|
|
|
+ //indexName := utils.IndexNameComprehensive
|
|
|
for _, v := range list {
|
|
|
item := new(ElasticComprehensiveDetail)
|
|
|
item.SourceId = v.IndustrialManagementId
|
|
@@ -146,7 +169,7 @@ func AddComprehensiveIndustrialSource() {
|
|
|
item.IndustryName = v.IndustryName
|
|
|
item.SubjectNames = strings.Join(mapActivitySubject[v.IndustrialManagementId], ",")
|
|
|
item.PublishDate = v.PublishDate
|
|
|
- EsAddOrEditComprehensiveData(indexName, item)
|
|
|
+ EsAddOrEditComprehensiveData(item)
|
|
|
fmt.Println(item)
|
|
|
}
|
|
|
}
|
|
@@ -162,7 +185,7 @@ func AddComprehensiveMeetingreviewchapt() {
|
|
|
fmt.Println(err)
|
|
|
return
|
|
|
}
|
|
|
- indexName := utils.IndexNameComprehensive
|
|
|
+ //indexName := utils.IndexNameComprehensive
|
|
|
for _, v := range list {
|
|
|
content := html.UnescapeString(v.Content)
|
|
|
doc, err := goquery.NewDocumentFromReader(strings.NewReader(content))
|
|
@@ -177,7 +200,7 @@ func AddComprehensiveMeetingreviewchapt() {
|
|
|
item.IndustryName = IndustrialManagementRespMap[v.IndustryId]
|
|
|
item.PublishDate = v.PublishTime
|
|
|
item.BodyText = bodyText
|
|
|
- EsAddOrEditComprehensiveData(indexName, item)
|
|
|
+ EsAddOrEditComprehensiveData(item)
|
|
|
fmt.Println(item)
|
|
|
}
|
|
|
}
|
|
@@ -258,7 +281,7 @@ func AddComprehensiveActivitySpecial() {
|
|
|
fmt.Println(err)
|
|
|
return
|
|
|
}
|
|
|
- indexName := utils.IndexNameComprehensive
|
|
|
+ //indexName := utils.IndexNameComprehensive
|
|
|
IndustrialManagementRespMap, _ := GetIndustrialManagementRespMap() // 产业标签
|
|
|
IndustrialSubjectMap, _ := GetCygxIndustrialSubjectMap() // 标的标签
|
|
|
var condition1 string
|
|
@@ -296,7 +319,7 @@ func AddComprehensiveActivitySpecial() {
|
|
|
item.PublishDate = v.ActivityTime
|
|
|
item.SubjectNames = strings.Join(mapActivitySubject[v.ActivityId], ",")
|
|
|
item.IndustryName = strings.Join(mapActivityIndustrialManagement[v.ActivityId], ",")
|
|
|
- EsAddOrEditComprehensiveData(indexName, item)
|
|
|
+ EsAddOrEditComprehensiveData(item)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -371,7 +394,7 @@ func AddComprehensiveActivityVideo() {
|
|
|
mapActivitySubject[v.ActivityId] = append(mapActivitySubject[v.ActivityId], IndustrialSubjectMap[v.IndustrialSubjectId])
|
|
|
}
|
|
|
|
|
|
- indexName := utils.IndexNameComprehensive
|
|
|
+ //indexName := utils.IndexNameComprehensive
|
|
|
for _, v := range list {
|
|
|
item := new(ElasticComprehensiveDetail)
|
|
|
item.SourceId = v.ActivityId
|
|
@@ -381,7 +404,7 @@ func AddComprehensiveActivityVideo() {
|
|
|
item.BodyText = mapActivity[v.ActivityId]
|
|
|
item.SubjectNames = strings.Join(mapActivitySubject[v.ActivityId], ",")
|
|
|
item.IndustryName = strings.Join(mapActivityIndustrialManagement[v.ActivityId], ",")
|
|
|
- EsAddOrEditComprehensiveData(indexName, item)
|
|
|
+ EsAddOrEditComprehensiveData(item)
|
|
|
fmt.Println(item)
|
|
|
}
|
|
|
}
|
|
@@ -457,7 +480,7 @@ func AddComprehensiveActivityVoice() {
|
|
|
}
|
|
|
mapActivitySubject[v.ActivityId] = append(mapActivitySubject[v.ActivityId], IndustrialSubjectMap[v.IndustrialSubjectId])
|
|
|
}
|
|
|
- indexName := utils.IndexNameComprehensive
|
|
|
+ //indexName := utils.IndexNameComprehensive
|
|
|
for _, v := range list {
|
|
|
item := new(ElasticComprehensiveDetail)
|
|
|
item.SourceId = v.ActivityId
|
|
@@ -467,7 +490,7 @@ func AddComprehensiveActivityVoice() {
|
|
|
item.BodyText = mapActivity[v.ActivityId]
|
|
|
item.SubjectNames = strings.Join(mapActivitySubject[v.ActivityId], ",")
|
|
|
item.IndustryName = strings.Join(mapActivityIndustrialManagement[v.ActivityId], ",")
|
|
|
- EsAddOrEditComprehensiveData(indexName, item)
|
|
|
+ EsAddOrEditComprehensiveData(item)
|
|
|
fmt.Println(item)
|
|
|
}
|
|
|
}
|
|
@@ -482,7 +505,7 @@ func AddComprehensiveRoadshow() {
|
|
|
fmt.Println(err)
|
|
|
return
|
|
|
}
|
|
|
- indexName := utils.IndexNameComprehensive
|
|
|
+ //indexName := utils.IndexNameComprehensive
|
|
|
for _, v := range list {
|
|
|
item := new(ElasticComprehensiveDetail)
|
|
|
item.SourceId = v.VideoId
|
|
@@ -490,16 +513,18 @@ func AddComprehensiveRoadshow() {
|
|
|
item.IndustryName = IndustrialManagementRespMap[v.IndustryId]
|
|
|
item.Title = v.VideoName
|
|
|
item.PublishDate = v.PublishDate.Format(utils.FormatDateTime)
|
|
|
- EsAddOrEditComprehensiveData(indexName, item)
|
|
|
+ EsAddOrEditComprehensiveData(item)
|
|
|
fmt.Println(item)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 新增和修改数据
|
|
|
-func EsAddOrEditComprehensiveData(indexName string, item *ElasticComprehensiveDetail) (err error) {
|
|
|
+func EsAddOrEditComprehensiveData(item *ElasticComprehensiveDetail) (err error) {
|
|
|
+ indexName := utils.IndexNameComprehensive
|
|
|
//return
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
go utils.SendAlarmMsg("更新综合页面数据Es失败"+err.Error()+fmt.Sprint(item), 2)
|
|
|
}
|
|
|
}()
|