|
@@ -696,8 +696,9 @@ func (this *EnglishReportController) PublishReport() {
|
|
|
}()
|
|
|
|
|
|
// 生成报告pdf和长图
|
|
|
- if req.ReportUrl != "" {
|
|
|
- go services.Report2pdfAndJpeg(req.ReportUrl, report.Id, 2)
|
|
|
+ pdfUrl := services.GetGeneralEnglishReportPdfUrl(report.Id, report.ReportCode)
|
|
|
+ if pdfUrl != "" {
|
|
|
+ go services.Report2pdfAndJpeg(pdfUrl, report.Id, 2)
|
|
|
}
|
|
|
} else {
|
|
|
// 从无审批切换为有审批, 状态重置
|
|
@@ -799,8 +800,9 @@ func (this *EnglishReportController) PrePublishReport() {
|
|
|
}
|
|
|
|
|
|
// 生成报告pdf和长图
|
|
|
- if req.ReportUrl != "" {
|
|
|
- go services.Report2pdfAndJpeg(req.ReportUrl, report.Id, 2)
|
|
|
+ pdfUrl := services.GetGeneralEnglishReportPdfUrl(report.Id, report.ReportCode)
|
|
|
+ if pdfUrl != "" {
|
|
|
+ go services.Report2pdfAndJpeg(pdfUrl, report.Id, 2)
|
|
|
}
|
|
|
|
|
|
br.Ret = 200
|
|
@@ -1448,3 +1450,63 @@ func (this *EnglishReportController) CancelApprove() {
|
|
|
br.Success = true
|
|
|
br.Msg = "操作成功"
|
|
|
}
|
|
|
+
|
|
|
+// @Title 获取报告分享链接
|
|
|
+// @Description 获取报告分享链接
|
|
|
+// @Param ReportId query int true "报告id"
|
|
|
+// @Success 200 {object} models.EnglishReportDetailView
|
|
|
+// @router /share_url [get]
|
|
|
+func (this *EnglishReportController) GetShareUrl() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ /*var req models.ReportDetailReq
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.ReportId <= 0 {
|
|
|
+ br.Msg = "参数错误"
|
|
|
+ return
|
|
|
+ }*/
|
|
|
+ reportId, err := this.GetInt("ReportId")
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取参数失败!"
|
|
|
+ br.ErrMsg = "获取参数失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if reportId <= 0 {
|
|
|
+ br.Msg = "参数错误"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ item, err := models.GetEnglishReportById(reportId)
|
|
|
+ if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ br.Msg = "报告已被删除"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ token, err := services.GetEnglishReportToken(reportId, item.ReportCode)
|
|
|
+ if err != nil {
|
|
|
+ if err.Error() == utils.ErrNoRow() {
|
|
|
+ br.Msg = "报告已被删除"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Data = token
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+}
|