瀏覽代碼

增加版头版尾资源

kobe6258 4 天之前
父節點
當前提交
0a0bffd742

+ 24 - 16
controllers/report_chapter.go

@@ -170,7 +170,9 @@ func (this *ReportController) AddChapter() {
 		br.ErrMsg = "保存失败,Err:" + err.Error()
 		return
 	}
-
+	if reportInfo.ReportLayout == 3 {
+		br.Data = reportInfo.FreeLayoutConfig
+	}
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "保存成功"
@@ -312,10 +314,6 @@ func (this *ReportController) EditDayWeekChapter() {
 		br.Msg = "报告章节ID有误"
 		return
 	}
-	if req.Content == "" {
-		br.Msg = "请输入内容"
-		return
-	}
 
 	// 获取章节详情
 	reportChapterInfo, err := models.GetReportChapterInfoById(reportChapterId)
@@ -332,7 +330,14 @@ func (this *ReportController) EditDayWeekChapter() {
 		br.ErrMsg = "报告信息有误, Err: " + err.Error()
 		return
 	}
-
+	if req.Content == "" && reportInfo.ReportLayout != 3 {
+		br.Msg = "请输入内容"
+		return
+	}
+	if reportInfo.ReportLayout == 3 && req.FreeLayoutConfig == "" {
+		br.Msg = "请输入自由布局配置"
+		return
+	}
 	// 操作权限校验
 	hasAuth, msg, errMsg, isSendEmail := checkOpPermission(sysUser, reportInfo, reportChapterInfo, true, this.Lang)
 	if !hasAuth {
@@ -457,8 +462,8 @@ func (this *ReportController) EditDayWeekChapter() {
 					}
 					content = contentClean
 					if v.ContentStruct != `` {
-						v.ContentStruct = services.HandleReportContentStructTable(reportChapterInfo.ReportId, req.ContentStruct)
-						v.ContentStruct = services.HandleReportContentStruct(req.ContentStruct, "del", nil)
+						v.ContentStruct = services.HandleReportContentStructTable(reportChapterInfo.ReportId, v.ContentStruct)
+						v.ContentStruct = services.HandleReportContentStruct(v.ContentStruct, "del", nil)
 					}
 					v.Content = html.EscapeString(content)
 					v.ContentStruct = html.EscapeString(v.ContentStruct)
@@ -466,6 +471,7 @@ func (this *ReportController) EditDayWeekChapter() {
 			}(v)
 		}
 		wg.Wait()
+		reportInfo.FreeLayoutConfig = req.FreeLayoutConfig
 		err = models.UpdateChapterFreeLayoutContentPage(reportInfo, reportChapterInfo, updateCols, tickerList, ormList)
 		if err != nil {
 			br.Msg = "保存失败"
@@ -580,7 +586,9 @@ func (this *ReportController) DelChapter() {
 		br.ErrMsg = "删除失败,Err:" + err.Error()
 		return
 	}
-
+	if reportInfo.ReportLayout == 3 {
+		go report.DeleteChapters(reportInfo.Id, reportChapterInfo.ReportChapterId)
+	}
 	// 备份关键数据
 	chapters := make([]*models.ReportChapter, 0)
 	chapters = append(chapters, reportChapterInfo)
@@ -832,8 +840,8 @@ func (this *ReportController) GetDayWeekChapter() {
 		for _, page := range pages {
 			page.Content = html.UnescapeString(page.Content)
 			page.ContentStruct = html.UnescapeString(page.ContentStruct)
-			page.Content = services.HandleReportContentTable(page.ReportId, chapterItem.Content)
-			page.ContentStruct = services.HandleReportContentStructTable(page.ReportId, chapterItem.ContentStruct)
+			page.Content = services.HandleReportContentTable(page.ReportId, page.Content)
+			page.ContentStruct = services.HandleReportContentStructTable(page.ReportId, page.ContentStruct)
 		}
 	}
 	chapterItem.Content = html.UnescapeString(chapterItem.Content)
@@ -841,7 +849,6 @@ func (this *ReportController) GetDayWeekChapter() {
 	chapterItem.ContentStruct = html.UnescapeString(chapterItem.ContentStruct)
 	chapterItem.Content = services.HandleReportContentTable(chapterItem.ReportId, chapterItem.Content)
 	chapterItem.ContentStruct = services.HandleReportContentStructTable(chapterItem.ReportId, chapterItem.ContentStruct)
-
 	businessConf, err := models.GetBusinessConfByKey(models.BusinessConfIsOpenChartExpired)
 	if err != nil {
 		br.Msg = "获取失败"
@@ -896,10 +903,11 @@ func (this *ReportController) GetDayWeekChapter() {
 	}
 
 	resp := models.ReportChapterItemResp{
-		FreeLayoutPages:   pages,
-		ReportChapterItem: *chapterItem,
-		GrandAdminIdList:  chapterGrantIdList,
-		PermissionIdList:  chapterPermissionIdList,
+		FreeLayoutContentPages: pages,
+		FreeLayoutConfig:       reportInfo.FreeLayoutConfig,
+		ReportChapterItem:      *chapterItem,
+		GrandAdminIdList:       chapterGrantIdList,
+		PermissionIdList:       chapterPermissionIdList,
 	}
 
 	// 获取当前编辑状态

+ 59 - 6
controllers/report_v2.go

@@ -699,7 +699,7 @@ func (this *ReportController) Detail() {
 			}
 		}
 		//item.Abstract = item.Title
-	}else{
+	} else {
 		if item.ReportLayout == 3 {
 			pages, err := report.GetFreeLayoutPagesByReportId(item.Id)
 			if err != nil {
@@ -850,7 +850,7 @@ func (this *ReportController) SaveReportContent() {
 			content = this.GetString("Content")
 		}
 		content = services.HandleReportContent(content, "del", nil)
-		if content != "" {
+		if content != "" || reportInfo.ReportLayout == 3 {
 			e := utils.ContentXssCheck(content)
 			if e != nil {
 				br.Msg = "存在非法标签"
@@ -907,7 +907,7 @@ func (this *ReportController) SaveReportContent() {
 								return
 							}
 							content = contentClean
-							v.ContentStruct = services.HandleReportContentStruct(req.ContentStruct, "del", nil)
+							v.ContentStruct = services.HandleReportContentStruct(v.ContentStruct, "del", nil)
 							v.Content = html.EscapeString(content)
 							v.ContentStruct = html.EscapeString(v.ContentStruct)
 						}
@@ -1139,7 +1139,28 @@ func (this *ReportController) BaseDetail() {
 
 	reportInfo.Content = html.UnescapeString(reportInfo.Content)
 	reportInfo.ContentSub = html.UnescapeString(reportInfo.ContentSub)
-
+	if reportInfo.ReportLayout == 3 {
+		if reportInfo.HeadResourceId > 0 {
+			headResource, err := smart_report.GetResourceItemById(reportInfo.HeadResourceId)
+			if err != nil {
+				br.Msg = "操作失败"
+				br.ErrMsg = "获取资源库版头失败, Err: " + err.Error()
+				return
+			}
+			reportInfo.HeadImg = headResource.ImgUrl
+			reportInfo.HeadStyle = headResource.Style
+		}
+		if reportInfo.EndResourceId > 0 {
+			headResource, err := smart_report.GetResourceItemById(reportInfo.EndResourceId)
+			if err != nil {
+				br.Msg = "操作失败"
+				br.ErrMsg = "获取资源库版尾失败, Err: " + err.Error()
+				return
+			}
+			reportInfo.EndImg = headResource.ImgUrl
+			reportInfo.EndStyle = headResource.Style
+		}
+	}
 	grandAdminList := make([]models.ReportDetailViewAdmin, 0)
 	permissionList := make([]models.ReportDetailViewPermission, 0)
 
@@ -1539,10 +1560,26 @@ func (this *ReportController) PrePublishReport() {
 			}
 		}
 	} else {
-		if reportDetail.Content == "" {
+		if reportDetail.Content == "" && reportDetail.ReportLayout != 3 {
 			br.Msg = "报告内容为空,不可设置定时发布"
 			br.ErrMsg = "报告内容为空,不可设置定时发布,report_id:" + strconv.Itoa(reportDetail.Id)
 			return
+		} else {
+			pages, err := report.GetFreeLayoutChapterPagesByReportId(reportDetail.Id)
+			if err != nil {
+				br.Msg = "获取自由布局报告失败,不可设置定时发布"
+				br.ErrMsg = "获取自由布局报告失败,不可设置定时发布,Err:" + err.Error()
+				return
+			}
+			var content string
+			for _, page := range pages {
+				content += page.Content
+			}
+			if content == "" {
+				br.Msg = "自由布局报告内容为空,不可设置定时发布"
+				br.ErrMsg = "自由布局报告内容为空,不可设置定时发布,report_id:" + strconv.Itoa(reportDetail.Id)
+				return
+			}
 		}
 	}
 
@@ -1641,10 +1678,26 @@ func (this *ReportController) SubmitApprove() {
 			}
 		}
 	} else {
-		if reportItem.Content == "" {
+		if reportItem.Content == "" && reportItem.ReportLayout != 3 {
 			br.Msg = "报告内容为空,不可提交"
 			br.ErrMsg = "报告内容为空,不可提交,report_id:" + strconv.Itoa(reportItem.Id)
 			return
+		} else {
+			pages, err := report.GetFreeLayoutChapterPagesByReportId(reportItem.Id)
+			if err != nil {
+				br.Msg = "获取自由布局报告失败,不可提交"
+				br.ErrMsg = "获取自由布局报告失败,不可提交,Err:" + err.Error()
+				return
+			}
+			var content string
+			for _, page := range pages {
+				content += page.Content
+			}
+			if content == "" {
+				br.Msg = "自由布局报告内容为空,不可提交"
+				br.ErrMsg = "自由布局报告内容为空,不可提交,report_id:" + strconv.Itoa(reportItem.Id)
+				return
+			}
 		}
 	}
 

+ 26 - 25
models/report.go

@@ -446,6 +446,7 @@ type ReportDetail struct {
 	ReportLayout        int8      `description:"报告布局,1:常规布局,2:智能布局。默认:1"`
 	IsPublicPublish     int8      `description:"是否公开发布,1:是,2:否"`
 	ReportCreateTime    time.Time `description:"报告时间创建时间"`
+	FreeLayoutConfig    string    `description:"'自由布局配置"`
 }
 
 func (m *ReportDetail) AfterFind(db *gorm.DB) (err error) {
@@ -643,31 +644,31 @@ func AddReport(item *Report) (lastId int64, err error) {
 }
 
 type EditReq struct {
-	ReportId               int64                `description:"报告id"`
-	ClassifyIdFirst        int                  `description:"一级分类id"`
-	ClassifyNameFirst      string               `description:"一级分类名称"`
-	ClassifyIdSecond       int                  `description:"二级分类id"`
-	ClassifyNameSecond     string               `description:"二级分类名称"`
-	ClassifyIdThird        int                  `description:"三级分类id"`
-	ClassifyNameThird      string               `description:"三级分类名称"`
-	Title                  string               `description:"标题"`
-	Abstract               string               `description:"摘要"`
-	Author                 string               `description:"作者"`
-	Frequency              string               `description:"频度"`
-	State                  int                  `description:"状态:1:未发布,2:已发布"`
-	Content                string               `description:"内容"`
-	CreateTime             string               `description:"创建时间"`
-	ContentStruct          string               `description:"内容组件"`
-	HeadImg                string               `description:"报告头图地址"`
-	EndImg                 string               `description:"报告尾图地址"`
-	CanvasColor            string               `description:"画布颜色"`
-	NeedSplice             int                  `description:"是否拼接版头版位的标记,主要是为了兼容历史报告。0-不需要 1-需要"`
-	HeadResourceId         int                  `description:"版头资源ID"`
-	EndResourceId          int                  `description:"版尾资源ID"`
+	ReportId           int64  `description:"报告id"`
+	ClassifyIdFirst    int    `description:"一级分类id"`
+	ClassifyNameFirst  string `description:"一级分类名称"`
+	ClassifyIdSecond   int    `description:"二级分类id"`
+	ClassifyNameSecond string `description:"二级分类名称"`
+	ClassifyIdThird    int    `description:"三级分类id"`
+	ClassifyNameThird  string `description:"三级分类名称"`
+	Title              string `description:"标题"`
+	Abstract           string `description:"摘要"`
+	Author             string `description:"作者"`
+	Frequency          string `description:"频度"`
+	State              int    `description:"状态:1:未发布,2:已发布"`
+	Content            string `description:"内容"`
+	CreateTime         string `description:"创建时间"`
+	ContentStruct      string `description:"内容组件"`
+	HeadImg            string `description:"报告头图地址"`
+	EndImg             string `description:"报告尾图地址"`
+	CanvasColor        string `description:"画布颜色"`
+	NeedSplice         int    `description:"是否拼接版头版位的标记,主要是为了兼容历史报告。0-不需要 1-需要"`
+	HeadResourceId     int    `description:"版头资源ID"`
+	EndResourceId      int    `description:"版尾资源ID"`
 	//CollaborateType    int8   `description:"协作方式,1:个人,2:多人协作。默认:1"`
 	//ReportLayout       int8   `description:"报告布局,1:常规布局,2:智能布局,3:自由布局。默认:1"`
-	IsPublicPublish  int8   `description:"是否公开发布,1:是,2:否"`
-	GrantAdminIdList []int  `description:"授权用户id列表"`
+	IsPublicPublish  int8  `description:"是否公开发布,1:是,2:否"`
+	GrantAdminIdList []int `description:"授权用户id列表"`
 }
 
 type EditResp struct {
@@ -1705,7 +1706,7 @@ func InsertOrUpdateReportFreeLayoutContentPage(reportInfo *Report, ormList []*re
 		}
 		_ = tx.Commit()
 	}()
-	reportUpdateCols := []string{"Content", "ContentSub", "ContentStruct", "HeadImg", "EndImg", "CanvasColor", "HeadResourceId", "EndResourceId", "ModifyTime", "ContentModifyTime"}
+	reportUpdateCols := []string{"Content", "ContentSub", "ContentStruct", "HeadImg", "EndImg", "CanvasColor", "HeadResourceId", "EndResourceId", "ModifyTime", "ContentModifyTime","FreeLayoutConfig"}
 	err = tx.Model(&reportInfo).Select(reportUpdateCols).Updates(reportInfo).Error
 	return report.BatchInsertOrUpdatePages(tx, ormList, false, reportInfo.Id, 0)
 }
@@ -1719,7 +1720,7 @@ func UpdateChapterFreeLayoutContentPage(reportInfo *Report, chapterInfo *ReportC
 		_ = tx.Commit()
 	}()
 
-	if err = tx.Model(&reportInfo).Select([]string{"LastModifyAdminId", "LastModifyAdminName", "ModifyTime"}).Updates(reportInfo).Error; err != nil {
+	if err = tx.Model(&reportInfo).Select([]string{"LastModifyAdminId", "LastModifyAdminName", "ModifyTime","FreeLayoutConfig"}).Updates(reportInfo).Error; err != nil {
 		return
 	}
 	// 更新章节

+ 87 - 15
models/report/report_free_layout.go

@@ -16,7 +16,6 @@ type ReportFreeLayout struct {
 	IsChapter       int       `gorm:"column:is_chapter"`                  // 是否多章节
 	Content         string    `gorm:"column:content;size:255"`            // 内容
 	ContentStruct   string    `gorm:"column:content_struct;size:255"`     // 内容
-	IsDeleted       int       `gorm:"column:is_deleted"`                  //是否删除
 	CreateTime      time.Time `gorm:"column:create_time"`                 // 创建时间
 	ModifyTime      time.Time `gorm:"column:modify_time"`                 // 修改时间
 }
@@ -29,6 +28,7 @@ const (
 )
 
 type ContentPage struct {
+	Id              int    `json:"Id"`
 	Page            int    `json:"Page"`
 	Content         string `json:"Content"`
 	ContentStruct   string `json:"ContentStruct"`
@@ -87,32 +87,104 @@ func (*ReportFreeLayout) TableName() string {
 	return "report_free_layout"
 }
 
-func BatchInsertOrUpdatePages(tx *gorm.DB, list []*ReportFreeLayout, isChapter bool, reportId, chapterId int) (err error) {
+func SortPage(reportId int, tx *gorm.DB) (err error) {
+	if tx == nil {
+		tx = global.DbMap[utils.DbNameReport].Begin()
+		defer func() {
+			if err != nil {
+				_ = tx.Rollback()
+				return
+			}
+			_ = tx.Commit()
+		}()
+	}
+	sql := `select * from report_free_layout where report_id = ?  and is_chapter=1   order by page asc`
+	var ormList []*ReportFreeLayout
+	err = tx.Raw(sql, reportId).Find(&ormList).Error
+	if err != nil {
+		return
+	}
+	if len(ormList) == 0 {
+		return
+	}
+	chapterPages := make(map[int][]*ReportFreeLayout)
+	for _, v := range ormList {
+		chapterPages[v.ReportChapterId] = append(chapterPages[v.ReportChapterId], v)
+	}
 
+	chapterSql := `select report_chapter_id from report_chapter where report_id =? order by sort asc`
+	var chapterIds []int
+	err = tx.Raw(chapterSql, reportId).Scan(&chapterIds).Error
+	if err != nil {
+		return
+	}
+	initPage := 1
+	for _, chapter := range chapterIds {
+		chapterList := chapterPages[chapter]
+		for _, v := range chapterList {
+			v.Page = initPage
+			initPage++
+		}
+
+	}
+	var updateList []*ReportFreeLayout
+	for _, chapterList := range chapterPages {
+		updateList = append(updateList, chapterList...)
+	}
+	err = tx.Model(&ReportFreeLayout{}).Clauses(clause.OnConflict{
+		Columns:   []clause.Column{{Name: "Id"}},
+		DoUpdates: clause.AssignmentColumns([]string{"Page"}),
+	}).CreateInBatches(updateList, len(updateList)).Error
+	return
+}
+
+func DeleteChapters(reportId int, chapterId int) (err error) {
+	tx := global.DbMap[utils.DbNameReport].Begin()
+	defer func() {
+		if err != nil {
+			_ = tx.Rollback()
+			return
+		}
+		_ = tx.Commit()
+	}()
+	err = tx.Exec("delete from report_free_layout where   report_id = ?  and report_chapter_id=? and is_chapter=1", reportId, chapterId).Error
+	if err != nil {
+		return
+	}
+	err = SortPage(reportId, tx)
+	return
+}
+func BatchInsertOrUpdatePages(tx *gorm.DB, list []*ReportFreeLayout, isChapter bool, reportId, chapterId int) (err error) {
 	if isChapter {
-		err = tx.Model(&ReportFreeLayout{}).Where("report_id = ? and report_chapter_id=? and is_chapter=1", reportId, chapterId).Update("is_deleted", 1).Error
+		err = tx.Exec("delete from report_free_layout where   report_id = ?  and report_chapter_id=? and is_chapter=1", reportId, chapterId).Error
 		if err != nil {
 			return
 		}
-	} else {
-		err = tx.Model(&ReportFreeLayout{}).Where("report_id = ? and report_chapter_id=? and is_chapter=0", reportId, chapterId).Update("is_deleted", 1).Error
+		err = tx.Model(&ReportFreeLayout{}).Clauses(clause.OnConflict{
+			Columns:   []clause.Column{{Name: "id"}},
+			DoUpdates: clause.AssignmentColumns([]string{"content", "content_struct", "modify_time"}),
+		}).CreateInBatches(list, len(list)).Error
 		if err != nil {
 			return
 		}
-	}
-	if err != nil {
+		err = SortPage(reportId, tx)
 		return
+	} else {
+		err = tx.Exec("delete from  report_free_layout where report_id = ? and  is_chapter=0", reportId).Error
+		if err != nil {
+			return
+		}
+		err = tx.Model(&ReportFreeLayout{}).Clauses(clause.OnConflict{
+			Columns:   []clause.Column{{Name: "id"}},
+			DoUpdates: clause.AssignmentColumns([]string{"content", "content_struct", "page", "modify_time"}),
+		}).CreateInBatches(list, len(list)).Error
 	}
-	err = tx.Model(&ReportFreeLayout{}).Clauses(clause.OnConflict{
-		Columns:   []clause.Column{{Name: "report_id"}, {Name: "report_chapter_id"}, {Name: "page"}},
-		DoUpdates: clause.AssignmentColumns([]string{"content", "content_struct", "modify_time", "is_deleted"}),
-	}).CreateInBatches(list, len(list)).Error
 	return
 }
 
 func GetFreeLayoutChapterPagesByReportId(reportId int) (list []*ContentPage, err error) {
 	var ormList []*ReportFreeLayout
-	sql := `select rfl.*,rc.sort from report_free_layout rfl LEFT JOIN report_chapter rc on rc.report_id=rfl.report_id  where rfl.report_id =? and  is_deleted=0 order by rc.sort,rfl.page asc`
+	sql := `select rfl.*,rc.sort from report_free_layout rfl LEFT JOIN report_chapter rc on rc.report_id=rfl.report_id  where rfl.report_id =? order by rc.sort,rfl.page asc`
 	err = global.DbMap[utils.DbNameReport].Raw(sql, reportId).Find(&ormList).Error
 	if err != nil {
 		return nil, err
@@ -122,8 +194,8 @@ func GetFreeLayoutChapterPagesByReportId(reportId int) (list []*ContentPage, err
 }
 func GetSingleFreeLayoutChapterPagesByReportId(reportId, chapterId int) (list []*ContentPage, err error) {
 	var ormList []*ReportFreeLayout
-	sql := `select * from report_free_layout where report_id =? and report_chapter_id=? and  is_deleted=0 order by page asc`
-	err = global.DbMap[utils.DbNameReport].Raw(sql, reportId,chapterId).Find(&ormList).Error
+	sql := `select * from report_free_layout where report_id =? and report_chapter_id=? order by page asc`
+	err = global.DbMap[utils.DbNameReport].Raw(sql, reportId, chapterId).Find(&ormList).Error
 	if err != nil {
 		return nil, err
 	}
@@ -132,7 +204,7 @@ func GetSingleFreeLayoutChapterPagesByReportId(reportId, chapterId int) (list []
 }
 func GetFreeLayoutPagesByReportId(id int) (list []*ContentPage, err error) {
 	var ormList []*ReportFreeLayout
-	sql := `select * from report_free_layout   where report_id =? and is_deleted=0 and is_chapter=0 order by page asc`
+	sql := `select * from report_free_layout  where report_id =? and is_chapter=0 order by page asc`
 	err = global.DbMap[utils.DbNameReport].Raw(sql, id).Find(&ormList).Error
 	if err != nil {
 		return nil, err

+ 3 - 1
models/report_chapter.go

@@ -134,7 +134,8 @@ func (m *ReportChapterItem) ConvDateTimeStr() {
 // @Description: 章节详情(带有一些额外的数据)
 type ReportChapterItemResp struct {
 	ReportChapterItem
-	FreeLayoutPages  []*report.ContentPage
+	FreeLayoutContentPages  []*report.ContentPage
+	FreeLayoutConfig  string
 	GrandAdminIdList []int  `description:"授权的用户id列表"`
 	PermissionIdList []int  `description:"关联的品种id列表"`
 	CanEdit          bool   `description:"是否可编辑"`
@@ -225,6 +226,7 @@ type EditReportChapterReq struct {
 	EndResourceId  int    `description:"版尾资源ID"`
 	//自由布局研报相关
 	FreeLayoutContentPages []report.ContentPage `description:"自由布局内容"`
+	FreeLayoutConfig       string               `description:"'自由布局配置"`
 }
 
 type EditTickList struct {

+ 3 - 0
services/report_chapter.go

@@ -166,6 +166,9 @@ func moveReportChapter(reportChapter, prevReportChapter, nextReportChapter *mode
 			err = fmt.Errorf("修改失败,Err:" + err.Error())
 			return
 		}
+		go func() {
+			_ = report.SortPage(reportChapter.ReportId, nil)
+		}()
 	}
 	return
 }

+ 17 - 1
services/report_v2.go

@@ -1174,10 +1174,26 @@ func PublishReport(reportId int, reportUrl string, sysUser *system.Admin) (tips
 	}
 
 	// 普通报告
-	if reportInfo.Content == "" {
+	if reportInfo.Content == "" && reportInfo.ReportLayout != 3 {
 		errMsg = `报告内容为空,不可发布`
 		err = errors.New("报告内容为空,不需要生成,report_id:" + strconv.Itoa(reportId))
 		return
+	} else {
+		pages, pageErr := report.GetFreeLayoutChapterPagesByReportId(reportInfo.Id)
+		if pageErr != nil {
+			errMsg = "获取自由布局报告失败,不可发布"
+			err = errors.New("获取自由布局报告失败,不可发布,Err:" + pageErr.Error())
+			return
+		}
+		var content string
+		for _, page := range pages {
+			content += page.Content
+		}
+		if content == "" {
+			errMsg= "自由布局报告内容为空,不可设置定时发布"
+			err = errors.New("自由布局报告内容为空,不可设置定时发布,report_id:" + strconv.Itoa(reportInfo.Id))
+			return
+		}
 	}
 
 	// 根据审批开关及审批流判断当前报告状态