|
@@ -762,6 +762,7 @@ func (this *ReportController) Search() {
|
|
|
// @Param PageSize query int true "每页数据条数"
|
|
|
// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
// @Param RangeType query string true "范围类型,1-一天内,2-一周内,3-半年内"
|
|
|
+// @Param ReportType query string true "报告类型,1-eta报告,2-pdf报告"
|
|
|
// @Param ClassifyId query int true "分类id"
|
|
|
// @Success 200 {object} response.ReportList
|
|
|
// @router /list [get]
|
|
@@ -777,8 +778,21 @@ func (this *ReportNoAuthController) List() {
|
|
|
chartPermissionId, _ := this.GetInt("ChartPermissionId")
|
|
|
level, _ := this.GetInt("Level")
|
|
|
rangeType, _ := this.GetInt("RangeType")
|
|
|
+ reportType, _ := this.GetInt("ReportType")
|
|
|
classifyId, _ := this.GetInt("ClassifyId")
|
|
|
- reports, err := services.GetNoAuthReportList(chartPermissionId, level, rangeType, classifyId, currentIndex, pageSize)
|
|
|
+ switch rangeType {
|
|
|
+ case 1, 2, 3:
|
|
|
+ default:
|
|
|
+ br.Msg = "查询失败"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ switch reportType {
|
|
|
+ case utils.ReportTypeEta, utils.ReportTypePdf:
|
|
|
+ default:
|
|
|
+ br.Msg = "报告不存在"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ reports, err := services.GetNoAuthReportList(reportType, chartPermissionId, level, rangeType, classifyId, currentIndex, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "研报列表查询失败"
|
|
|
br.ErrMsg = "研报列表查询失败,系统异常,Err:" + err.Error()
|
|
@@ -799,6 +813,7 @@ func (this *ReportNoAuthController) List() {
|
|
|
// @Title 研报详情
|
|
|
// @Description 研报详情接口
|
|
|
// @Param ReportId query int true "报告id"
|
|
|
+// @Param ReportType query int true "报告类型:1-eta,2-pdf"
|
|
|
// @Success 200 {object} models.ReportDetailResp
|
|
|
// @router /detail [get]
|
|
|
func (this *ReportNoAuthController) Detail() {
|
|
@@ -808,11 +823,19 @@ func (this *ReportNoAuthController) Detail() {
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
reportId, _ := this.GetInt("ReportId")
|
|
|
+ reportType, _ := this.GetInt("ReportType")
|
|
|
if reportId <= 0 {
|
|
|
br.Msg = "报告不存在"
|
|
|
return
|
|
|
}
|
|
|
- reportPush, err := models.GetReportPushStatusByReportId(reportId, utils.ReportTypeEta)
|
|
|
+ switch reportType {
|
|
|
+ case utils.ReportTypeEta, utils.ReportTypePdf:
|
|
|
+ default:
|
|
|
+ br.Msg = "报告不存在"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ reportPush, err := models.GetReportPushStatusByReportId(reportId, reportType)
|
|
|
if err != nil {
|
|
|
br.Msg = "查询报告失败"
|
|
|
br.ErrMsg = "查询报告推送状态失败,系统异常,Err:" + err.Error()
|
|
@@ -822,28 +845,50 @@ func (this *ReportNoAuthController) Detail() {
|
|
|
br.Msg = "报告未推送或已删除,请刷新重试"
|
|
|
return
|
|
|
}
|
|
|
- result, err := services.GetNoAuthReportDetail(reportId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "查询报告详情失败"
|
|
|
- br.ErrMsg = "查询报告失败,系统异常,Err:" + err.Error()
|
|
|
+ switch reportType {
|
|
|
+ case utils.ReportTypeEta:
|
|
|
+ result, err := services.GetNoAuthReportDetail(reportId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查询报告详情失败"
|
|
|
+ br.ErrMsg = "查询报告失败,系统异常,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if result.Ret != 200 {
|
|
|
+ br.Msg = result.Msg
|
|
|
+ br.ErrMsg = result.ErrMsg
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if result.Ret == 200 && result.Data.Report == nil {
|
|
|
+ // 报告不存在, 就尝试删除推送的记录
|
|
|
+ models.DeleteReportPushStatusByReportId(reportId, utils.ReportTypeEta)
|
|
|
+ br.Msg = "报告已删除或未发布,请刷新重试"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Msg = "查询成功"
|
|
|
+ br.Success = true
|
|
|
+ br.Ret = 200
|
|
|
+ br.Data = result.Data
|
|
|
return
|
|
|
- }
|
|
|
- if result.Ret != 200 {
|
|
|
- br.Msg = result.Msg
|
|
|
- br.ErrMsg = result.ErrMsg
|
|
|
+ case utils.ReportTypePdf:
|
|
|
+ reportPdf, err := models.GetReportPdfById(reportId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查询报告详情失败"
|
|
|
+ br.ErrMsg = "查询报告失败,系统异常,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Msg = "查询成功"
|
|
|
+ br.Success = true
|
|
|
+ br.Ret = 200
|
|
|
+ br.Data = reportPdf
|
|
|
return
|
|
|
- }
|
|
|
- if result.Ret == 200 && result.Data.Report == nil {
|
|
|
- // 报告不存在, 就尝试删除推送的记录
|
|
|
- models.DeleteReportPushStatusByReportId(reportId, utils.ReportTypeEta)
|
|
|
- br.Msg = "报告已删除或未发布,请刷新重试"
|
|
|
+ default:
|
|
|
+ br.Msg = "报告不存在"
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- br.Msg = "查询成功"
|
|
|
- br.Success = true
|
|
|
- br.Ret = 200
|
|
|
- br.Data = result.Data
|
|
|
}
|
|
|
|
|
|
// @Title 研报搜索
|
|
@@ -866,13 +911,17 @@ func (this *ReportNoAuthController) Search() {
|
|
|
if pageSize <= 0 {
|
|
|
pageSize = utils.PageSize30
|
|
|
}
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+ startSize := utils.StartIndex(currentIndex, pageSize)
|
|
|
|
|
|
if keyWord == "" {
|
|
|
br.Msg = "请输入关键字"
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- reports, total, err := services.SearchReportPush(keyWord, currentIndex, pageSize)
|
|
|
+ reports, total, err := services.SearchReportPush(keyWord, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "研报列表查询失败"
|
|
|
br.ErrMsg = "研报列表查询失败,系统异常,Err:" + err.Error()
|