|
@@ -46,7 +46,7 @@ type ElasticComprehensiveDetail struct {
|
|
|
}
|
|
|
|
|
|
func init() {
|
|
|
- AddComprehensiveActivityVideo()
|
|
|
+ AddComprehensiveArticle()
|
|
|
//AddComprehensiveActivity()
|
|
|
//AddComprehensiveIndustrialSource()
|
|
|
// AddComprehensiveMeetingreviewchapt()
|
|
@@ -60,9 +60,9 @@ func init() {
|
|
|
|
|
|
// 添加文章:报告、纪要
|
|
|
func AddComprehensiveArticle() {
|
|
|
- endDate := time.Now().AddDate(0, 0, -30).Format(utils.FormatDate)
|
|
|
- //allList, err := models.GetArticleAll()
|
|
|
- allList, err := models.GetArticleAllDate(endDate)
|
|
|
+ //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())
|
|
@@ -103,22 +103,11 @@ func AddComprehensiveChart() {
|
|
|
}
|
|
|
indexName := utils.IndexNameComprehensive
|
|
|
for _, v := range list {
|
|
|
- //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.ChartId
|
|
|
- //item.IsSummary = v.IsSummary
|
|
|
item.Source = "newchart"
|
|
|
item.Title = v.Title
|
|
|
item.PublishDate = v.CreateDate
|
|
|
- //item.BodyText = bodyText
|
|
|
- //item.Annotation, _ = GetReportContentTextSubNew(v.Annotation)
|
|
|
- //item.Abstract, _ = GetReportContentTextSubNew(v.Abstract)
|
|
|
EsAddOrEditComprehensiveData(indexName, item)
|
|
|
fmt.Println(v.ChartId)
|
|
|
}
|
|
@@ -336,25 +325,62 @@ func AddComprehensiveActivityVideo() {
|
|
|
activityIds = append(activityIds, v.ActivityId)
|
|
|
}
|
|
|
|
|
|
- condition = ` AND publish_status = 1 `
|
|
|
- listAct, e := models.GetCygxActivityList(condition, pars, 0, 100000)
|
|
|
+ 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.ActivityId
|
|
|
- //item.IsSummary = v.IsSummary
|
|
|
item.Source = "activityvideo"
|
|
|
- //item.IndustryName = v.IndustryName
|
|
|
item.Title = v.Title
|
|
|
item.PublishDate = v.ActivityTime
|
|
|
- //item.BodyText = bodyText
|
|
|
- //item.Annotation, _ = GetReportContentTextSubNew(v.Annotation)
|
|
|
- //item.Abstract, _ = GetReportContentTextSubNew(v.Abstract)
|
|
|
-
|
|
|
+ item.BodyText = mapActivity[v.ActivityId]
|
|
|
+ item.SubjectNames = strings.Join(mapActivitySubject[v.ActivityId], ",")
|
|
|
+ item.IndustryName = strings.Join(mapActivityIndustrialManagement[v.ActivityId], ",")
|
|
|
EsAddOrEditComprehensiveData(indexName, item)
|
|
|
fmt.Println(item)
|
|
|
}
|
|
@@ -362,6 +388,13 @@ func AddComprehensiveActivityVideo() {
|
|
|
|
|
|
// 添加活动音频
|
|
|
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{}
|
|
|
|
|
@@ -370,18 +403,70 @@ func AddComprehensiveActivityVoice() {
|
|
|
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.ActivityId
|
|
|
- //item.IsSummary = v.IsSummary
|
|
|
item.Source = "activityvoice"
|
|
|
- //item.IndustryName = v.IndustryName
|
|
|
item.Title = v.VoiceName
|
|
|
item.PublishDate = v.ActivityTime
|
|
|
- //item.BodyText = bodyText
|
|
|
- //item.Annotation, _ = GetReportContentTextSubNew(v.Annotation)
|
|
|
- //item.Abstract, _ = GetReportContentTextSubNew(v.Abstract)
|
|
|
+ item.BodyText = mapActivity[v.ActivityId]
|
|
|
+ item.SubjectNames = strings.Join(mapActivitySubject[v.ActivityId], ",")
|
|
|
+ item.IndustryName = strings.Join(mapActivityIndustrialManagement[v.ActivityId], ",")
|
|
|
EsAddOrEditComprehensiveData(indexName, item)
|
|
|
fmt.Println(item)
|
|
|
}
|
|
@@ -391,7 +476,7 @@ func AddComprehensiveActivityVoice() {
|
|
|
func AddComprehensiveRoadshow() {
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
|
-
|
|
|
+ IndustrialManagementRespMap, _ := GetIndustrialManagementRespMap()
|
|
|
list, err := models.GetMicroRoadshowVideoListBycondition(condition, pars, 0, 100000)
|
|
|
if err != nil {
|
|
|
fmt.Println(err)
|
|
@@ -401,14 +486,10 @@ func AddComprehensiveRoadshow() {
|
|
|
for _, v := range list {
|
|
|
item := new(ElasticComprehensiveDetail)
|
|
|
item.SourceId = v.VideoId
|
|
|
- //item.IsSummary = v.IsSummary
|
|
|
item.Source = "roadshow"
|
|
|
- //item.IndustryName = v.IndustryName
|
|
|
+ item.IndustryName = IndustrialManagementRespMap[v.IndustryId]
|
|
|
item.Title = v.VideoName
|
|
|
item.PublishDate = v.PublishDate.Format(utils.FormatDateTime)
|
|
|
- //item.BodyText = bodyText
|
|
|
- //item.Annotation, _ = GetReportContentTextSubNew(v.Annotation)
|
|
|
- //item.Abstract, _ = GetReportContentTextSubNew(v.Abstract)
|
|
|
EsAddOrEditComprehensiveData(indexName, item)
|
|
|
fmt.Println(item)
|
|
|
}
|