zwxi 10 hónapja
szülő
commit
6293627146

+ 10 - 0
controllers/english_report/report.go

@@ -765,6 +765,11 @@ func (this *EnglishReportController) PublishReport() {
 			go func() {
 				_ = services.UpdateEnglishReportEs(report.Id, 2)
 			}()
+
+			// 生成报告pdf和长图
+			if req.ReportUrl != "" {
+				go services.Report2pdfAndJpeg(req.ReportUrl, report.Id, 2)
+			}
 		} else {
 			// 从无审批切换为有审批, 状态重置
 			if e = models.ResetEnglishReportById(report.Id, state); tmpErr != nil {
@@ -864,6 +869,11 @@ func (this *EnglishReportController) PrePublishReport() {
 		return
 	}
 
+	// 生成报告pdf和长图
+	if req.ReportUrl != "" {
+		go services.Report2pdfAndJpeg(req.ReportUrl, report.Id, 2)
+	}
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "定时发布成功"

+ 9 - 2
controllers/report.go

@@ -367,10 +367,12 @@ func (this *ReportController) PublishReport() {
 				_, _ = models.AddReportStateRecord(recordItem)
 			}()
 
+			// 生成报告pdf和长图
+			if req.ReportUrl != "" {
+				go services.Report2pdfAndJpeg(req.ReportUrl, report.Id, 1)
+			}
 		}
 
-		// 生成报告pdf和长图
-		go services.Report2pdfAndJpeg(req.ReportUrl, report.Id, 1)
 	}
 	// 发布晨周报部分章节未发布的提示
 	if tips != "" {
@@ -3513,6 +3515,11 @@ func (this *ReportController) PrePublishReport() {
 		return
 	}
 
+	// 生成报告pdf和长图
+	if report.HasChapter == 1 && (report.ChapterType == utils.REPORT_TYPE_DAY || report.ChapterType == utils.REPORT_TYPE_WEEK) && req.ReportUrl != "" {
+		go services.Report2pdfAndJpeg(req.ReportUrl, report.Id, 1)
+	}
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "定时发布成功"

+ 8 - 1
controllers/smart_report/smart_report.go

@@ -545,7 +545,9 @@ func (this *SmartReportController) Publish() {
 		}()
 
 		// 生成报告pdf和长图
-		go services.Report2pdfAndJpeg(req.ReportUrl, req.SmartReportId, 3)
+		if req.ReportUrl != "" {
+			go services.Report2pdfAndJpeg(req.ReportUrl, item.SmartReportId, 3)
+		}
 	}
 	if state == smart_report.SmartReportStateWaitPublish {
 		// ES更新报告
@@ -659,6 +661,11 @@ func (this *SmartReportController) PrePublish() {
 		return
 	}
 
+	// 生成报告pdf和长图
+	if req.ReportUrl != "" {
+		go services.Report2pdfAndJpeg(req.ReportUrl, item.SmartReportId, 3)
+	}
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "操作成功"

+ 1 - 0
models/report.go

@@ -299,6 +299,7 @@ type PrePublishReq struct {
 	ReportId       int    `description:"报告id"`
 	PrePublishTime string `description:"预发布时间"`
 	PreMsgSend     int    `description:"定时发布成功后是否立即推送模版消息:0否,1是"`
+	ReportUrl      string `description:"报告Url"`
 }
 
 type AddResp struct {

+ 1 - 0
models/smart_report/smart_report.go

@@ -325,6 +325,7 @@ type SmartReportPrePublishReq struct {
 	SmartReportId  int    `description:"智能研报ID"`
 	PrePublishTime string `description:"预发布时间"`
 	PreMsgSend     int    `description:"定时发布成功后是否立即推送模版消息:0否,1是"`
+	ReportUrl      string `description:"报告Url"`
 }
 
 // SmartReportSaveContentReq 保存草稿请求体