|
@@ -1502,3 +1502,333 @@ func (this *ReportController) CommentAdd() {
|
|
|
br.Success = true
|
|
|
br.Msg = "提交成功"
|
|
|
}
|
|
|
+
|
|
|
+// @Title 报告精选、本周研究汇总、上周纪要汇总列表
|
|
|
+// @Description 获取报告精选、本周研究汇总、上周纪要汇总列表接口
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
+// @Param ReportType string query true "报告类型 ,1报告精选、2本周研究汇总、3上周纪要汇总"
|
|
|
+// @Success 200 {object} models.CygxReportSelectionListPublicRep
|
|
|
+// @router /reportList/byType [get]
|
|
|
+func (this *ReportController) ReportListByType() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请重新登录"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ uid := user.UserId
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+ reportType := this.GetString("ReportType")
|
|
|
+ var condition string
|
|
|
+ var startSize int
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+ startSize = paging.StartIndex(currentIndex, pageSize)
|
|
|
+ var pars []interface{}
|
|
|
+ var total int
|
|
|
+ resp := new(models.CygxReportSelectionListPublicRep)
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+ var tbdb string
|
|
|
+ var readSql string
|
|
|
+ var reportTypeStr string
|
|
|
+ if reportType == "1" {
|
|
|
+ tbdb = "cygx_report_selection"
|
|
|
+ reportTypeStr = "bgjx"
|
|
|
+ } else if reportType == "2" {
|
|
|
+ tbdb = "cygx_research_summary"
|
|
|
+ reportTypeStr = "bzyjhz"
|
|
|
+ } else if reportType == "3" {
|
|
|
+ tbdb = "cygx_minutes_summary"
|
|
|
+ reportTypeStr = "szjyhz"
|
|
|
+ } else {
|
|
|
+ br.Msg = "请选择报告类型"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ condition = ` AND publish_status = 1 `
|
|
|
+ if user.CompanyId != utils.HZ_COMPANY_ID {
|
|
|
+ condition += ` AND visible_range = 1 `
|
|
|
+ }
|
|
|
+ total, err := models.GetCygxReportSelectionPublic(condition, tbdb, pars)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取帖子总数失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //研究汇总--报告精选 只显示最新一期,往期都隐藏
|
|
|
+ if reportType == "1" {
|
|
|
+ startSize = 0
|
|
|
+ pageSize = 1
|
|
|
+ total = 1
|
|
|
+ }
|
|
|
+ readSql = ` (SELECT COUNT(1) AS count FROM cygx_report_history_record AS h WHERE h.article_id = art.article_id AND report_type ='` + reportTypeStr + `' AND h.user_id = ` + strconv.Itoa(uid) + `) as read_num`
|
|
|
+ page = paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+ list, err := models.GetReportSelectionListPublic(condition, readSql, tbdb, pars, startSize, pageSize)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for k, v := range list {
|
|
|
+ if reportType == "1" {
|
|
|
+ list[k].Abstract = v.UpdateDescription
|
|
|
+ }
|
|
|
+ list[k].PublishDate = utils.StrTimeToTime(v.PublishDate).Format("2006-01-02")
|
|
|
+ if v.ReadNum == 0 {
|
|
|
+ list[k].IsRed = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ resp.List = list
|
|
|
+ resp.Paging = page
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 获取本周研究汇总详情
|
|
|
+// @Description 获取本周研究汇总详情接口
|
|
|
+// @Param ArticleId query int true "报告ID"
|
|
|
+// @Success 200 {object} models.ResearchSummaryLetailResp
|
|
|
+// @router /researchSummary/detail [get]
|
|
|
+func (this *ReportController) ResearchDetail() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请重新登录"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //uid := user.UserId
|
|
|
+ articleId, _ := this.GetInt("ArticleId")
|
|
|
+ if articleId < 0 {
|
|
|
+ br.Msg = "参数错误"
|
|
|
+ br.ErrMsg = "参数错误"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := new(models.ResearchSummaryLetailResp)
|
|
|
+ //判断用户权限
|
|
|
+ hasPermission, err := services.GetUserhasPermission(user)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
|
|
|
+ }
|
|
|
+ detail, err := models.GetCygxResearchSummaryInfoById(articleId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ //未设置全部可见的只能给弘则内部查看
|
|
|
+ if detail.VisibleRange == 1 || user.CompanyId == utils.HZ_COMPANY_ID {
|
|
|
+ resp.IsShow = true
|
|
|
+ }
|
|
|
+ resp.HasPermission = hasPermission
|
|
|
+ if hasPermission != 1 || !resp.IsShow {
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+ return
|
|
|
+ }
|
|
|
+ detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format(utils.FormatDate)
|
|
|
+ detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
|
|
|
+ listFirst, err := models.GetResearchSummarylogListFirst(articleId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ listArticleType, err := models.GetCygxArticleTypeList()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取文章类型数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for k, v := range listFirst {
|
|
|
+ listSecond, err := models.GetResearchSummarylogSonListSecond(articleId, v.Type)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for k2, v2 := range listSecond {
|
|
|
+ listThird, err := models.GetResearchSummarylogSonListThird(articleId, v2.ChartPermissionId, v.Type)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, vType := range listArticleType {
|
|
|
+ if v2.ChartPermissionId == vType.YanxPermissionId {
|
|
|
+ listSecond[k2].IcoLink = vType.IcoLinkM
|
|
|
+ listSecond[k2].PermissionName = vType.YanxPermissionName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(listThird) > 0 {
|
|
|
+ for k3, v3 := range listThird {
|
|
|
+ if v3.VideoUrl != "" {
|
|
|
+ listThird[k3].IsHaveVideo = true
|
|
|
+ }
|
|
|
+ if v3.ReportLink == "0" {
|
|
|
+ listThird[k3].ReportLink = ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+ listSecond[k2].List = listThird
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(listSecond) > 0 {
|
|
|
+ listFirst[k].List = listSecond
|
|
|
+ }
|
|
|
+ //`description:"类型'SDBG深度报告片篇,’CYDYJY:产业调研纪要’,’SJDP事件点评,’BZCHJH:本周晨会精华’"`
|
|
|
+ if v.Type == "SDBG" {
|
|
|
+ listFirst[k].ListName = "深度报告"
|
|
|
+ listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211027/le8AcRjDz0MhA72bVDiaf3d5ALSe.png"
|
|
|
+ } else if v.Type == "BZCHJH" {
|
|
|
+ listFirst[k].ListName = "本周晨会精华"
|
|
|
+ listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/DCfekcxaIKGePBsNVu1ULfmNcJBY.png"
|
|
|
+ } else if v.Type == "CYDYJY" {
|
|
|
+ listFirst[k].ListName = "产业调研纪要"
|
|
|
+ listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/UPAdozy96z9ypzY04vi0Y3Ogqzji.png"
|
|
|
+ } else if v.Type == "SSGS" {
|
|
|
+ listFirst[k].ListName = "上市公司调研纪要篇"
|
|
|
+ listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211101/ujHXB48I8ay9T0XoPRI7lorz7OkL.png"
|
|
|
+ } else if v.Type == "SJDP" {
|
|
|
+ listFirst[k].ListName = "市场QA汇总"
|
|
|
+ listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/2a5cXafO3Iws4QcFp1bd5WPdYikV.png"
|
|
|
+ } else if v.Type == "YANX" {
|
|
|
+ listFirst[k].ListName = "买方研选"
|
|
|
+ listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ go services.AddCygxReportHistoryRecord(user, articleId, "bzyjhz")
|
|
|
+ resp.List = listFirst
|
|
|
+ resp.Detail = detail
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 上周纪要汇总内容详情
|
|
|
+// @Description 获取上周纪要汇总内容详情接口
|
|
|
+// @Param ArticleId query int true "报告ID"
|
|
|
+// @Success 200 {object} models.MinutesSummaryLetailResp
|
|
|
+// @router /minutesSummary/detail [get]
|
|
|
+func (this *ReportController) MinutesDetail() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请重新登录"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ articleId, _ := this.GetInt("ArticleId")
|
|
|
+ if articleId < 0 {
|
|
|
+ br.Msg = "参数错误"
|
|
|
+ br.ErrMsg = "参数错误"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := new(models.MinutesSummaryLetailRespV4)
|
|
|
+ //判断用户权限
|
|
|
+ hasPermission, err := services.GetUserhasPermission(user)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
|
|
|
+ }
|
|
|
+
|
|
|
+ detail, err := models.GetCygxMinutesSummaryInfoById(articleId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //未设置全部可见的只能给弘则内部查看
|
|
|
+ if detail.VisibleRange == 1 || user.CompanyId == utils.HZ_COMPANY_ID {
|
|
|
+ resp.IsShow = true
|
|
|
+ }
|
|
|
+ resp.HasPermission = hasPermission
|
|
|
+ if hasPermission != 1 || !resp.IsShow {
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+ return
|
|
|
+ }
|
|
|
+ detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format(utils.FormatDate)
|
|
|
+ detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
|
|
|
+ listFirst, err := models.GetMinutesSummarylogListAllV4(articleId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for k, v := range listFirst {
|
|
|
+ listSecond, err := models.GetMinutesSummarylogSonListSecond(articleId, v.Type)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for k2, v2 := range listSecond {
|
|
|
+ listThird, err := models.GetMinutesSummarylogListThird(articleId, v2.ChartPermissionId, v.Type)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(listThird) > 0 {
|
|
|
+ for k3, v3 := range listThird {
|
|
|
+ if v3.VideoUrl != "" {
|
|
|
+ listThird[k3].IsHaveVideo = true
|
|
|
+ }
|
|
|
+ if v3.ReportLink == "0" {
|
|
|
+ listThird[k3].ReportLink = ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+ listSecond[k2].List = listThird
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(listSecond) > 0 {
|
|
|
+ listFirst[k].List = listSecond
|
|
|
+ }
|
|
|
+ //`description:"类型'SDBG深度报告片篇,’CYDYJY:产业调研纪要’,’SJDP事件点评,’BZCHJH:本周晨会精华’"`
|
|
|
+ if v.Type == "CYDYJY" {
|
|
|
+ listFirst[k].ListName = "产业调研纪要"
|
|
|
+ listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202110/20211020/UPAdozy96z9ypzY04vi0Y3Ogqzji.png"
|
|
|
+ } else if v.Type == "SSGS" {
|
|
|
+ listFirst[k].ListName = "上市公司调研纪要篇"
|
|
|
+ listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211101/ujHXB48I8ay9T0XoPRI7lorz7OkL.png"
|
|
|
+ } else if v.Type == "YANX" {
|
|
|
+ listFirst[k].ListName = "买方研选纪要"
|
|
|
+ listFirst[k].IcoLink = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202111/20211104/QbTGTNhD9MxYp24cJ7V5WpCN0oNl.png"
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ go services.AddCygxReportHistoryRecord(user, articleId, "szjyhz")
|
|
|
+ resp.List = listFirst
|
|
|
+ resp.Detail = detail
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|