|
@@ -15,6 +15,10 @@ type ReportController struct {
|
|
|
BaseAuthController
|
|
|
}
|
|
|
|
|
|
+type ReportNoAuthController struct {
|
|
|
+ BaseCommonController
|
|
|
+}
|
|
|
+
|
|
|
// @Title 研报详情
|
|
|
// @Description 研报详情接口
|
|
|
// @Param ReportId query int true "报告id"
|
|
@@ -744,3 +748,92 @@ func (this *ReportController) Search() {
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
}
|
|
|
+
|
|
|
+// @Title 研报列表
|
|
|
+// @Description 研报列表
|
|
|
+// @Param ChartPermissionId query int true "品种ID"
|
|
|
+// @Param Level query int true "品种层级"
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
+// @Param RangeType query string true "范围类型,1-一天内,2-一周内,3-半年内"
|
|
|
+// @Param ClassifyId query int true "分类id"
|
|
|
+// @Success 200 {object} response.ReportList
|
|
|
+// @router /list [get]
|
|
|
+func (this *ReportNoAuthController) List() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+ chartPermissionId, _ := this.GetInt("ChartPermissionId")
|
|
|
+ level, _ := this.GetInt("Level")
|
|
|
+ rangeType, _ := this.GetInt("RangeType")
|
|
|
+ classifyId, _ := this.GetInt("ClassifyId")
|
|
|
+ reports, err := services.GetNoAuthReportList(chartPermissionId, level, rangeType, classifyId, currentIndex, pageSize)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "研报列表查询失败"
|
|
|
+ br.ErrMsg = "研报列表查询失败,系统异常,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if reports.Ret != 200 {
|
|
|
+ br.Msg = reports.Msg
|
|
|
+ br.ErrMsg = reports.ErrMsg
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Data = reports.Data
|
|
|
+ br.Msg = "查询成功"
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 研报详情
|
|
|
+// @Description 研报详情接口
|
|
|
+// @Param ReportId query int true "报告id"
|
|
|
+// @Success 200 {object} models.ReportDetailResp
|
|
|
+// @router /detail [get]
|
|
|
+func (this *ReportNoAuthController) Detail() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ reportId, _ := this.GetInt("ReportId")
|
|
|
+ if reportId <= 0 {
|
|
|
+ br.Msg = "报告不存在"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ reportPush, err := models.GetReportPushStatusByReportId(reportId, utils.ReportTypeEta)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查询报告失败"
|
|
|
+ br.ErrMsg = "查询报告推送状态失败,系统异常,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if reportPush.State != utils.ReportStatePush {
|
|
|
+ br.Msg = "报告未推送或已删除,请刷新重试"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ 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 = "查询成功"
|
|
|
+ br.Success = true
|
|
|
+ br.Ret = 200
|
|
|
+ br.Data = result.Data
|
|
|
+}
|