Browse Source

no message

zhangchuanxing 1 month ago
parent
commit
8f7c41cb02
3 changed files with 53 additions and 3 deletions
  1. 7 0
      models/article.go
  2. 1 1
      models/ficc_report/report_chapter.go
  3. 45 2
      services/ficc_report.go

+ 7 - 0
models/article.go

@@ -794,6 +794,13 @@ func ModifyArticleTitleByarticleId(articleId int, title string) (err error) {
 	return
 }
 
+func ModifyArticleFiccBodyByreport_id(report_id int, body string) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_article SET body= ?  WHERE report_id=? `
+	_, err = o.Raw(sql, body, report_id).Exec()
+	return
+}
+
 // 获取数量
 func GetCygxArticleCount(condition string, pars []interface{}) (count int, err error) {
 	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_article as art WHERE 1= 1  `

+ 1 - 1
models/ficc_report/report_chapter.go

@@ -85,7 +85,7 @@ func GetListByReportId(reportId int, classifyNameFirst string) (items []*ReportC
 		where = " AND  report_id = ? AND publish_state = 2"
 	}
 	o := orm.NewOrmUsingDB("rddp")
-	sql := `SELECT report_chapter_id, report_id, type_id, type_name, abstract, title, author, publish_time, trend,video_url,video_name,video_play_seconds,video_size
+	sql := `SELECT report_chapter_id, report_id, type_id, type_name, abstract, title, author, publish_time, trend,video_url,video_name,video_play_seconds,video_size,content
 			FROM  report_chapter
 			WHERE 1=1 ` + where + `   ORDER  BY  sort asc, report_chapter_id asc  `
 	_, err = o.Raw(sql, reportId).QueryRows(&items)

+ 45 - 2
services/ficc_report.go

@@ -432,10 +432,48 @@ func GetChapterListByReportChapterIdList(classifyNameFirst string, reportId int,
 }
 
 //func init() {
-//	GetFiccRreportToCygxArticle()
+//	var condition string
+//	var pars []interface{}
+//	condition += ` AND  report_id > 0 AND body = ''   `
+//	articleList, e := models.GetCygxCygxArticleList(condition, pars, 0, 99)
+//	if e != nil {
+//		fmt.Println(e)
+//		return
+//	}
+//	for k, v := range articleList {
+//		fmt.Println("kkk", k)
+//		content := GetReportChapterPermissionMappingItemListByReportId(v.ReportId, "晨会纪要")
+//		e = models.ModifyArticleFiccBodyByreport_id(v.ReportId, content)
+//		if e != nil {
+//			fmt.Println(e)
+//			return
+//		}
+//	}
 //	//UpdateFICCReportResourceData(5542)
 //}
 
+// 根据ID获取FICC研报章节内容详情
+func GetReportChapterPermissionMappingItemListByReportId(reportId int, classifyNameFirst string) (content string) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg(fmt.Sprint("根据ID获取FICC研报章节内容详情失败 ,GetReportChapterPermissionMappingItemListByReportId err:", err.Error()), 2)
+		}
+	}()
+	chapterList, e := ficc_report.GetListByReportId(reportId, classifyNameFirst)
+	if e != nil {
+		err = errors.New("GetListByReportId, Err: " + e.Error())
+		return
+	}
+	for _, v := range chapterList {
+		bodyText, _ := GetReportContentTextSubNew(v.Content)
+		content += bodyText
+	}
+	fmt.Println(content)
+	return
+}
+
 // 获取FICC研报到查研观向数据库中
 func GetFiccRreportToCygxArticle(cont context.Context) (err error) {
 	//func GetFiccRreportToCygxArticle() (err error) {
@@ -501,7 +539,12 @@ func GetFiccRreportToCygxArticle(cont context.Context) (err error) {
 				item.Title = "FICC/周期品晨会纪要"
 			}
 			item.CategoryName = utils.ZHOU_QI_NAME
-			item.Body = v.Content
+
+			if v.Content == "" {
+				item.Body = GetReportChapterPermissionMappingItemListByReportId(v.Id, v.ClassifyNameFirst)
+			} else {
+				item.Body = v.Content
+			}
 			item.Abstract = v.Abstract
 			item.FieldName = v.ClassifyNameSecond
 			item.CreateDate = time.Now().Format(utils.FormatDate)