Browse Source

fix: 审批详情报告内容

hsun 1 year ago
parent
commit
7157462b2a
1 changed files with 5 additions and 38 deletions
  1. 5 38
      controllers/report_approve/report_approve.go

+ 5 - 38
controllers/report_approve/report_approve.go

@@ -5,7 +5,6 @@ import (
 	"eta/eta_api/controllers"
 	"eta/eta_api/models"
 	"eta/eta_api/models/report_approve"
-	"eta/eta_api/models/smart_report"
 	"eta/eta_api/services"
 	"eta/eta_api/utils"
 	"fmt"
@@ -501,48 +500,16 @@ func (this *ReportApproveController) Detail() {
 	detail.Report = new(report_approve.ReportApproveDetailReport)
 	detail.Report.ReportType = approveItem.ReportType
 	detail.Report.ReportId = approveItem.ReportId
+	detail.Report.ReportTitle = approveItem.ReportTitle
+	// 报告分类路由
 	if approveItem.ReportType == report_approve.FlowReportTypeChinese {
-		rp, e := models.GetReportById(approveItem.ReportId)
-		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
-				br.Msg = "报告已被删除, 请刷新页面"
-				return
-			}
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取中文研报失败, Err: " + e.Error()
-			return
-		}
-		detail.Report.ReportTitle = rp.Title
-		detail.Report.ReportClassify = fmt.Sprintf("%s/%s/%s", report_approve.FlowReportTypeMap[approveItem.ReportType], cnClassifyIdName[rp.ClassifyIdFirst], cnClassifyIdName[rp.ClassifyIdSecond])
+		detail.Report.ReportClassify = fmt.Sprintf("%s/%s/%s", report_approve.FlowReportTypeMap[approveItem.ReportType], cnClassifyIdName[approveItem.ClassifyFirstId], cnClassifyIdName[approveItem.ClassifySecondId])
 	}
 	if approveItem.ReportType == report_approve.FlowReportTypeEnglish {
-		rp, e := models.GetEnglishReportById(approveItem.ReportId)
-		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
-				br.Msg = "报告已被删除, 请刷新页面"
-				return
-			}
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取英文研报失败, Err: " + e.Error()
-			return
-		}
-		detail.Report.ReportTitle = rp.Title
-		detail.Report.ReportClassify = fmt.Sprintf("%s/%s/%s/%s", report_approve.FlowReportTypeMap[approveItem.ReportType], enClassifyIdName[enRootIdMap[rp.ClassifyIdSecond]], enClassifyIdName[rp.ClassifyIdFirst], enClassifyIdName[rp.ClassifyIdSecond])
+		detail.Report.ReportClassify = fmt.Sprintf("%s/%s/%s/%s", report_approve.FlowReportTypeMap[approveItem.ReportType], enClassifyIdName[enRootIdMap[approveItem.ClassifySecondId]], enClassifyIdName[approveItem.ClassifyFirstId], enClassifyIdName[approveItem.ClassifySecondId])
 	}
 	if approveItem.ReportType == report_approve.FlowReportTypeSmart {
-		smartOb := new(smart_report.SmartReport)
-		rp, e := smartOb.GetItemById(approveItem.ReportId)
-		if e != nil {
-			if e.Error() == utils.ErrNoRow() {
-				br.Msg = "报告已被删除, 请刷新页面"
-				return
-			}
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取智能研报失败, Err: " + e.Error()
-			return
-		}
-		detail.Report.ReportTitle = rp.Title
-		detail.Report.ReportClassify = fmt.Sprintf("%s/%s/%s", report_approve.FlowReportTypeMap[approveItem.ReportType], cnClassifyIdName[rp.ClassifyIdFirst], cnClassifyIdName[rp.ClassifyIdSecond])
+		detail.Report.ReportClassify = fmt.Sprintf("%s/%s/%s", report_approve.FlowReportTypeMap[approveItem.ReportType], cnClassifyIdName[approveItem.ClassifyFirstId], cnClassifyIdName[approveItem.ClassifySecondId])
 	}
 
 	br.Data = detail