Browse Source

查研观向9.6

xingzai 2 years ago
parent
commit
9b04c315b9
5 changed files with 214 additions and 71 deletions
  1. 67 8
      controllers/report.go
  2. 25 0
      models/industrial_subject.go
  3. 37 46
      models/report.go
  4. 49 17
      models/report_selection.go
  5. 36 0
      models/report_selection_chart_log.go

+ 67 - 8
controllers/report.go

@@ -422,7 +422,7 @@ func (this *ReportController) ArticleCategoryList() {
 		timeLineRed := false
 		if count < 2 {
 			timeLineRed = true
-		} else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(morningMeetingTime)){
+		} else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(morningMeetingTime)) {
 			timeLineRed = true
 		}
 		if !timeLineItem.IsRed && timeLineRed && haveMorningMeeting {
@@ -689,7 +689,7 @@ func (this *ReportController) List() {
 			timeLineRed := false
 			if count < 2 && v.SubCategoryName == "时间线" {
 				timeLineRed = true
-			} else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(v.PublishTime)){
+			} else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(v.PublishTime)) {
 				timeLineRed = true
 			}
 			if v.SubCategoryName == "时间线" && timeLineRed {
@@ -1571,21 +1571,62 @@ func (this *ReportController) Detail() {
 		br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
 		return
 	}
+
+	//较上一期有观点变化(后台填写的核心逻辑汇总内容、标签内容有更新),或者新增的公司,显示new标签
+	var isAllNew bool // 判断是否都打新的标签
+	lastPeriods := detail.Periods - 1
+	mapBodyChartSummary := make(map[int]string)
+	mapLabel := make(map[int]string)
+	if lastPeriods > 0 {
+		detailLast, err := models.GetCygxReportSelectionInfoById(articleId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
+			return
+		}
+		articleIdLast := detailLast.ArticleId
+		listLogLast, err := models.GetReportSelectionlogListAll(articleIdLast)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
+			return
+		}
+		for _, v := range listLogLast {
+			mapBodyChartSummary[v.IndustrialSubjectId] = v.Body
+			mapLabel[v.IndustrialSubjectId] = v.Label
+		}
+	} else {
+		isAllNew = true
+	}
 	detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format("2006-01-02")
 	existMap := make(map[int]int)
 	var items []*models.ReportSelectionChartPermission
+	var itemsSubject []*models.ReportSelectionChartLogPermission
 	listLog, err := models.GetReportSelectionlogListAll(articleId)
-	detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
 	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
 		return
 	}
-	//var itemLogs []*models.CygxReportSelectionLogDetail
+	detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
+	//获取行业核心逻辑汇总
+	listChartLog, err := models.GetCygxReportSelectionChartLogRepList(articleId)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	mapChartLog := make(map[string]string)
+	for _, v := range listChartLog {
+		mapChartLog[v.ChartPermissionName] = v.BodyChartSummary
+	}
 	for _, v := range listLog {
 		item := new(models.ReportSelectionChartPermission)
+		itemSubject := new(models.ReportSelectionChartLogPermission)
+		itemSubject.PermissionName = v.PermissionName
 		if existMap[v.ChartPermissionId] == 0 {
-			item.PermissionName = v.PermissionName + "领域深度报告和调研"
+			//item.PermissionName = v.PermissionName + "领域深度报告和调研"
+			item.PermissionName = v.PermissionName
 			item.IcoLink = v.IcoLink
 			listSonLog, err := models.GetReportSelectionlogSonListAll(articleId, v.ChartPermissionId)
 			if err != nil && err.Error() != utils.ErrNoRow() {
@@ -1594,6 +1635,14 @@ func (this *ReportController) Detail() {
 				return
 			}
 			for k2, v2 := range listSonLog {
+				var isNew bool
+				if isAllNew {
+					isNew = true
+				} else {
+					if mapBodyChartSummary[v2.IndustrialSubjectId] != v2.Body || mapLabel[v2.IndustrialSubjectId] != v2.Label {
+						isNew = true
+					}
+				}
 				if v2.IndustrialManagementId != "" {
 					listIndustrial, err := models.GetIndustrialByIds(v2.IndustrialManagementId)
 					if err != nil && err.Error() != utils.ErrNoRow() {
@@ -1601,15 +1650,23 @@ func (this *ReportController) Detail() {
 						br.ErrMsg = "获取信息失败,Err:" + err.Error()
 						return
 					}
+					v2.IsNew = isNew
 					listSonLog[k2].List = listIndustrial
+					if v2.Label != "" {
+						v2.CompanyLabel = strings.Split(v2.Label, "{|}")
+					}
 				}
+				itemSubject.ListSubject = append(itemSubject.ListSubject, &models.ReportSelectionChartLogSubjectName{SubjectName: v2.SubjectName, IsNew: isNew, IndustrialSubjectId: v2.IndustrialSubjectId})
 			}
+			item.BodyChartSummary = mapChartLog[v.PermissionName]
 			item.List = listSonLog
 			items = append(items, item)
+			itemsSubject = append(itemsSubject, itemSubject)
 			//itemLogs = make([]*models.CygxReportSelectionLogDetail, 0)
 		}
 		existMap[v.ChartPermissionId] = v.ChartPermissionId
 	}
+
 	historyRecord := new(models.CygxReportHistoryRecord)
 	historyRecord.UserId = uid
 	historyRecord.ArticleId = articleId
@@ -1629,8 +1686,10 @@ func (this *ReportController) Detail() {
 	if sellerItem != nil {
 		historyRecord.SellerName = sellerItem.RealName
 	}
+
 	go models.AddCygxReportHistoryRecord(historyRecord)
 	resp.List = items
+	resp.ListPermissionSubject = itemsSubject
 	resp.Detail = detail
 	br.Ret = 200
 	br.Success = true
@@ -3031,11 +3090,11 @@ func (this *ReportController) SearchReportAndResource() {
 		industrialIdMap := make(map[string]time.Time)
 		for _, v := range recrodList {
 			industrialManagementIdstr = strings.TrimLeft(v.Parameter, "PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=")
-			if createTime, ok := industrialIdMap[industrialManagementIdstr]; ok{
+			if createTime, ok := industrialIdMap[industrialManagementIdstr]; ok {
 				if createTime.Before(v.CreateTime) {
 					industrialIdMap[industrialManagementIdstr] = v.CreateTime
 				}
-			}else {
+			} else {
 				industrialIdMap[industrialManagementIdstr] = v.CreateTime
 			}
 		}
@@ -3051,7 +3110,7 @@ func (this *ReportController) SearchReportAndResource() {
 		timeLineRedMap := make(map[int]bool, 0)
 
 		for _, industrialId := range industrialIdArr {
-			if createTime, ok := industrialIdMap[strconv.Itoa(industrialId)]; ok{
+			if createTime, ok := industrialIdMap[strconv.Itoa(industrialId)]; ok {
 				if createTime.Before(morningMeetingTimeMap[industrialId]) {
 					timeLineRedMap[industrialId] = true
 				}

+ 25 - 0
models/industrial_subject.go

@@ -0,0 +1,25 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"hongze/hongze_cygx/utils"
+)
+
+type IndustrialSubject struct {
+	IndustrialSubjectId    int    `orm:"column(industrial_subject_id);pk" description:"标的id"`
+	IndustrialManagementId int    `description:"产业id"`
+	SubjectName            string `description:"标的名称"`
+	IndustryName           string `description:"产业名称"`
+	LayoutTime             string `description:"产业布局时间"`
+}
+
+// 标的列表
+func GetIndustrialSubjectListById(subjectIdArr []int) (items []*IndustrialSubject, err error) {
+	if len(subjectIdArr) == 0 {
+		return
+	}
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_industrial_subject WHERE industrial_subject_id IN  (` + utils.GetOrmInReplace(len(subjectIdArr)) + `)   `
+	_, err = o.Raw(sql, subjectIdArr).QueryRows(&items)
+	return
+}

+ 37 - 46
models/report.go

@@ -5,7 +5,6 @@ import (
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"strconv"
 	"time"
-
 	//"github.com/rdlucklib/rdluck_tools/paging"
 )
 
@@ -56,15 +55,7 @@ type IndustrialAnalyst struct {
 	IndustrialManagementId int    `description:"产业id"`
 }
 
-type IndustrialSubject struct {
-	IndustrialSubjectId    int    `orm:"column(industrial_subject_id);pk" description:"标的id"`
-	IndustrialManagementId int    `description:"产业id"`
-	SubjectName            string `description:"标的名称"`
-	IndustryName           string `description:"产业名称"`
-	LayoutTime             string `description:"产业布局时间"`
-}
-
-//获取产业报告数量
+// 获取产业报告数量
 func GetReportIndustrialCount(categoryId, industrialManagementId int) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT COUNT(1) count 
@@ -86,7 +77,7 @@ WHERE
 	return
 }
 
-//获取产业报告列表
+// 获取产业报告列表
 func GetReportIndustrialList(pars []interface{}, categoryId, industrialManagementId, userId, startSize, pageSize int) (items []*ReportArticle, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT *,( SELECT COUNT( 1 ) FROM cygx_article_history_record AS rec WHERE rec.user_id = ` + strconv.Itoa(userId) + ` AND rec.article_id = a.article_id ) AS readnum 
@@ -109,7 +100,7 @@ WHERE
 	return
 }
 
-//产业下所关联的文章分类列表
+// 产业下所关联的文章分类列表
 func IndustrialToArticleCategory(industrialManagementId, chartPermissionId int) (items []*IndustrialToArticleCategoryRep, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT map.match_type_name,map.category_id
@@ -127,7 +118,7 @@ func IndustrialToArticleCategory(industrialManagementId, chartPermissionId int)
 	return
 }
 
-//产业下所关联的文章分类列表 2022-10-13
+// 产业下所关联的文章分类列表 2022-10-13
 func IndustrialToArticleCategoryNew(industrialManagementId int) (items []*IndustrialToArticleCategoryRep, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT map.match_type_name,map.category_id
@@ -144,7 +135,7 @@ func IndustrialToArticleCategoryNew(industrialManagementId int) (items []*Indust
 	return
 }
 
-//判断用户是否阅读该产业下,某一分类的文章
+// 判断用户是否阅读该产业下,某一分类的文章
 func IndustrialUserRecordArticleCount(userId, industrialManagementId, categoryId int) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -164,7 +155,7 @@ WHERE
 	return
 }
 
-//获取最新文章
+// 获取最新文章
 func GetNewIndustrialUserRecordArticle(industrialManagementId, categoryId int) (item *ArticleDetail, err error) {
 	o := orm.NewOrm()
 	//sql := ` SELECT * FROM cygx_article WHERE article_id IN (SELECT article_id FROM cygx_industrial_article_group_management WHERE industrial_management_id = ? ) AND match_type_name = any( SELECT match_type_name FROM cygx_report_mapping WHERE category_id = ? ) ORDER BY publish_date DESC LIMIT 0, 1`
@@ -179,7 +170,7 @@ WHERE
 	return
 }
 
-//获取最新文章
+// 获取最新文章
 func GetNewArticleByCategoryId(categoryId int) (item *ArticleDetail, err error) {
 	o := orm.NewOrm()
 	sql := ` SELECT * FROM cygx_article WHERE  category_id = ? ORDER BY publish_date DESC LIMIT 0, 1`
@@ -216,7 +207,7 @@ type ReportArticleWhichIndustrialRepList struct {
 	List         []*ReportArticleWhichIndustrial
 }
 
-//列表
+// 列表
 func IndustrialToArticleWhichDepartment(condition string, pars []interface{}, uid, startSize, pageSize int) (items []*ReportArticleWhichIndustrial, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -275,7 +266,7 @@ type SearchTxt struct {
 	TabSearch      string `description:"素材库搜索说明"`
 }
 
-//获取用户是否有查看权限
+// 获取用户是否有查看权限
 func GetUserIsAdminCount(mobile string) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT COUNT(1) count  FROM admin 
@@ -331,7 +322,7 @@ type CygxIndustrySearchListPc struct {
 	IndList        []*IndustrialManagement `description:"产业列表"`
 }
 
-//列表
+// 列表
 func GetCygxIndustryAndArticleList(keyWord string) (items []*CygxIndustryAndArticleList, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -362,7 +353,7 @@ func GetArticleIdsBySubId(subjectId string) (articleIds string, err error) {
 	return
 } //end
 
-//用户收藏榜start
+// 用户收藏榜start
 type ArticleCollectionResp struct {
 	ArticleId              int                         `description:"文章id"`
 	Title                  string                      `description:"标题"`
@@ -389,7 +380,7 @@ type ArticleCollectionLIstResp struct {
 	List []*ArticleCollectionResp
 }
 
-//列表
+// 列表
 func GetArticleCollectionList(condition string, userId int) (items []*ArticleCollectionResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -418,7 +409,7 @@ func GetArticleCollectionList(condition string, userId int) (items []*ArticleCol
 	return
 } //end
 
-//用户收藏榜start
+// 用户收藏榜start
 type IndustrialManagementHotResp struct {
 	IndustrialManagementId int                   `orm:"column(industrial_management_id);pk" description:"产业id"`
 	IndustryName           string                `description:"产业名称"`
@@ -442,7 +433,7 @@ type IndustrialManagementHotListResp struct {
 	List   []*IndustrialManagementHotResp
 }
 
-//产业列表
+// 产业列表
 func GetThemeHeatList(userId int, condition string, startSize, pageSize int) (items []*IndustrialManagementHotResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -467,7 +458,7 @@ func GetThemeHeatList(userId int, condition string, startSize, pageSize int) (it
 	return
 }
 
-//获取数量
+// 获取数量
 func GetThemeHeatListCount(condition string) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT   COUNT( DISTINCT m.industrial_management_id ) FROM
@@ -482,7 +473,7 @@ func GetThemeHeatListCount(condition string) (count int, err error) {
 	return
 }
 
-//标的列表
+// 标的列表
 func GetThemeHeatSubjectList(condition string) (items []*IndustrialSubject, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -507,7 +498,7 @@ func GetThemeHeatSubjectList(condition string) (items []*IndustrialSubject, err
 	return
 } //end
 
-//Kol sratr
+// Kol sratr
 type DepartmentResp struct {
 	DepartmentId int    `description:"作者Id"`
 	NickName     string `description:"作者昵称"`
@@ -526,7 +517,7 @@ type IndustrialDepartmentListResp struct {
 	DepartmentId           int    `description:"作者Id"`
 }
 
-//作者列表
+// 作者列表
 func GetDepartmentList(userId int) (items []*DepartmentResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -551,7 +542,7 @@ func GetDepartmentList(userId int) (items []*DepartmentResp, err error) {
 	return
 }
 
-//作者文章所关联的产业列表
+// 作者文章所关联的产业列表
 func GetIndustrialDepartmentList() (items []*IndustrialDepartmentListResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -575,7 +566,7 @@ func GetIndustrialDepartmentList() (items []*IndustrialDepartmentListResp, err e
 	return
 }
 
-//主题详情start
+// 主题详情start
 type GetThemeDetailListResp struct {
 	ArticleId              int    `description:"文章id"`
 	Title                  string `description:"标题"`
@@ -613,7 +604,7 @@ type GetThemeAericleListBuSubjectResp struct {
 	List        []*GetThemeAericleListResp
 }
 
-//主题详情start
+// 主题详情start
 type GetThemeDetailResp struct {
 	IndustrialManagementId int                  `description:"产业Id"`
 	IndustryName           string               `description:"产业名称"`
@@ -622,7 +613,7 @@ type GetThemeDetailResp struct {
 	List                   []*GetThemeAericleListResp
 }
 
-//列表
+// 列表
 func GetThemeDetail(userId, industrialManagementId int, condition string) (items []*GetThemeDetailListResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -656,7 +647,7 @@ func GetThemeDetail(userId, industrialManagementId int, condition string) (items
 	return
 } //end
 
-//用户收藏榜start
+// 用户收藏榜start
 type DepartmentDetailResp struct {
 	DepartmentId   int    `description:"作者Id"`
 	NickName       string `description:"作者昵称"`
@@ -680,7 +671,7 @@ type DepartmentDetail struct {
 	MyFllowNum   int    `description:"本人是否关注"`
 }
 
-//列表
+// 列表
 func GetDepartmentDetail(userId, departmentId int) (item DepartmentDetail, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -699,13 +690,13 @@ func GetDepartmentDetail(userId, departmentId int) (item DepartmentDetail, err e
 	return
 } //end
 
-//报告搜索start
+// 报告搜索start
 type ReoprtSearchResp struct {
 	ListYx []*ArticleCollectionResp `description:"研选报告"`
 	ListHz []*ArticleCollectionResp `description:"弘则报告"`
 }
 
-//列表
+// 列表
 func GetReoprtSearchList(condition string, userId int) (items []*ArticleCollectionResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -730,13 +721,13 @@ func GetReoprtSearchList(condition string, userId int) (items []*ArticleCollecti
 	return
 } //end
 
-//搜索资源包 start
+// 搜索资源包 start
 type SearchResourceResp struct {
 	ListHz []*IndustrialManagementHotResp `description:"弘则"`
 	ListYx []*IndustrialManagementHotResp `description:"研选"`
 }
 
-//搜索资源包 start
+// 搜索资源包 start
 type SearchReportAndResourceResp struct {
 	ListHzResource []*IndustrialManagementHotResp `description:"弘则资源包"`
 	ListYxResource []*IndustrialManagementHotResp `description:"研选资源包"`
@@ -744,7 +735,7 @@ type SearchReportAndResourceResp struct {
 	ListHzReport   []*ArticleCollectionResp       `description:"弘则报告"`
 }
 
-//产业列表
+// 产业列表
 func GetSearchResourceList(userId int, condition string, startSize, pageSize int) (items []*IndustrialManagementHotResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -769,19 +760,19 @@ func GetSearchResourceList(userId int, condition string, startSize, pageSize int
 	return
 }
 
-//切换列表
+// 切换列表
 type ReportBillboardTableResp struct {
 	Name   string `description:"名称"`
 	Source int    `description:"类型"`
 	List   []*ChartPermission
 }
 
-//切换列表
+// 切换列表
 type ReportBillboardTableListResp struct {
 	List []*ReportBillboardTableResp
 }
 
-//报告榜单start
+// 报告榜单start
 type ArticleReportBillboardResp struct {
 	ArticleId      int    `description:"文章id"`
 	Title          string `description:"标题"`
@@ -805,7 +796,7 @@ type ArticleReportBillboardLIstPageResp struct {
 	Paging *paging.PagingItem
 }
 
-//报告收藏榜单列表
+// 报告收藏榜单列表
 func GetReportCollectionBillboardList(limit int, pars []interface{}, condition string) (items []*ArticleReportBillboardResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -831,7 +822,7 @@ func GetReportCollectionBillboardList(limit int, pars []interface{}, condition s
 	return
 }
 
-//报告阅读榜单列表
+// 报告阅读榜单列表
 func GetReportPvBillboardList(pars []interface{}, condition string) (items []*ArticleReportBillboardResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -851,7 +842,7 @@ func GetReportPvBillboardList(pars []interface{}, condition string) (items []*Ar
 	return
 }
 
-//获取产业报告+晨会点评数量
+// 获取产业报告+晨会点评数量
 func GetTimeLineReportIndustrialCount(industrialManagementId int) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT SUM(count) AS count FROM (
@@ -891,7 +882,7 @@ type TimeLineReportItem struct {
 	Readnum         int    `description:"阅读数量"`
 }
 
-//获取产业报告+晨会点评列表
+// 获取产业报告+晨会点评列表
 func GetTimeLineReportIndustrialList(userId, industrialManagementId, startSize, pageSize int) (items []*TimeLineReportItem, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -947,7 +938,7 @@ type IndustrialReadNum struct {
 	Readnum                int `description:"阅读次数"`
 }
 
-//获取该产业下文章的用户阅读次数-小红点用
+// 获取该产业下文章的用户阅读次数-小红点用
 func GetReportIndustrialReadNumList(userId int, industrialIds string, createtime time.Time) (items []*IndustrialReadNum, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT a.industrial_management_id, MIN(a.readnum) AS readnum FROM (

+ 49 - 17
models/report_selection.go

@@ -30,31 +30,52 @@ type DetailCygxReportSelectionRep struct {
 	PublishDate        string `description:"发布时间"`
 	CreateTime         string `description:"创建时间"`
 	LastUpdatedTime    string `description:"最后一次更新时间"`
-	Periods            string `description:"期数"`
+	Periods            int    `description:"期数"`
 	VideoUrl           string `description:"链接"`
 	VideoPlaySeconds   string `description:"时长"`
 	VideoName          string `description:"音频名称"`
 	ProductDescription string `description:"产品说明"`
 	UpdateDescription  string `description:"更新说明"`
 	FocusOn            string `description:"近期重点关注方向"`
+	MarketStrategy     string `description:"市场策略核心逻辑汇总"`
+	ReportLink         string `description:"报告链接"`
+	CeLueArticleId     int    `description:"策略报告详情"`
 }
 
 type ReportSelectionLetailResp struct {
-	Detail        *DetailCygxReportSelectionRep
-	HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
-	List          []*ReportSelectionChartPermission
+	Detail                *DetailCygxReportSelectionRep
+	HasPermission         int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	List                  []*ReportSelectionChartPermission
+	ListPermissionSubject []*ReportSelectionChartLogPermission `description:"行业列表"`
 }
 
 type ReportSelectionChartPermission struct {
-	PermissionName string `description:"权限名称"`
-	IcoLink        string `orm:"column(image_url)"description:"图标链接"`
-	List           []*CygxReportSelectionLogDetail
+	PermissionName   string `description:"权限名称"`
+	IcoLink          string `orm:"column(image_url)"description:"图标链接"`
+	List             []*CygxReportSelectionLogDetail
+	BodyChartSummary string `description:"行业核心逻辑汇总"`
+}
+
+type ReportSelectionChartLogPermission struct {
+	PermissionName string                                `description:"权限名称"`
+	ListSubject    []*ReportSelectionChartLogSubjectName `description:"标的列表"`
+}
+
+type ReportSelectionChartLogSubjectName struct {
+	SubjectName         string `description:"标的名称"`
+	IndustrialSubjectId int    `description:"标的ID"`
+	IsNew               bool   `description:"是否展示新标签"`
 }
 
 type CygxReportSelectionLogDetail struct {
-	IndustrialManagementId string `description:"产业Id"`
-	SubjectName            string `description:"标的名称"`
-	Body                   string `description:"内容"`
+	IndustrialManagementId string   `description:"产业Id"`
+	IndustrialSubjectId    int      `description:"标的ID"`
+	SubjectName            string   `description:"标的名称"`
+	IsNew                  bool     `description:"是否展示新标签"`
+	Body                   string   `description:"内容"`
+	CompanyLabel           []string `description:"公司标签"`
+	Label                  string   `description:"公司标签"`
+	OverviewArticleId      int      `description:"综述报告Id"`
 	List                   []*IndustriaReportSelection
 }
 type IndustriaReportSelection struct {
@@ -66,7 +87,7 @@ type ReportSelectionId struct {
 	ArticleId int `description:"报告I"`
 }
 
-//获取数量
+// 获取数量
 func GetCygxReportSelectionPublic(condition, tbdb string, pars []interface{}) (count int, err error) {
 	sqlCount := ` SELECT COUNT(1) AS count  FROM ` + tbdb + ` as art WHERE 1= 1 AND art.publish_status = 1   `
 	if condition != "" {
@@ -77,7 +98,7 @@ func GetCygxReportSelectionPublic(condition, tbdb string, pars []interface{}) (c
 	return
 }
 
-//通过纪要ID获取活动详情
+// 通过ID获取详情
 func GetCygxReportSelectionInfoById(articleId int) (item *DetailCygxReportSelectionRep, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * FROM cygx_report_selection  WHERE article_id=? AND publish_status = 1 `
@@ -85,7 +106,15 @@ func GetCygxReportSelectionInfoById(articleId int) (item *DetailCygxReportSelect
 	return
 }
 
-//列表
+// 通过期数获取详情
+func GetCygxReportSelectionInfoByperiods(periods int) (item *DetailCygxReportSelectionRep, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_report_selection  WHERE periods=?  `
+	err = o.Raw(sql, periods).QueryRow(&item)
+	return
+}
+
+// 列表
 func GetReportSelectionListPublic(condition, readSql, tbdb string, pars []interface{}, startSize, pageSize int) (items []*CygxReportSelectionRep, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT * ,` + readSql + ` FROM  ` + tbdb + ` as art WHERE 1= 1 AND art.publish_status = 1  `
@@ -104,13 +133,16 @@ type CygxReportSelectionLog struct {
 	PermissionName         string    `description:"行业ID"`
 	CreateTime             time.Time `description:"创建时间"`
 	Body                   string    `description:"内容"`
-	IndustrialSubjectId    string    `description:"标的ID"`
+	IndustrialSubjectId    int       `description:"标的ID"`
 	IndustrialManagementId string    `description:"产业资源包Id  多个用 , 隔开"`
 	SubjectName            string    `description:"标的名称"`
 	IcoLink                string    `orm:"column(image_url)"description:"图标链接"`
+	CompanyLabel           []string  `description:"公司标签"`
+	Label                  string    `description:"公司标签"`
+	OverviewArticleId      int       `description:"综述报告Id"`
 }
 
-//列表
+// 列表
 func GetReportSelectionlogListAll(articleId int) (items []*CygxReportSelectionLog, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT c.permission_name ,c.image_url,s.subject_name , l.* 
@@ -123,10 +155,10 @@ func GetReportSelectionlogListAll(articleId int) (items []*CygxReportSelectionLo
 	return
 }
 
-//列表
+// 列表
 func GetReportSelectionlogSonListAll(articleId, chartPermissionId int) (items []*CygxReportSelectionLogDetail, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT c.permission_name , l.* 
+	sql := `SELECT c.permission_name , l.* ,l.company_label as label
 			FROM
 			cygx_report_selection_log AS l
 			INNER JOIN chart_permission AS c ON c.chart_permission_id = l.chart_permission_id 

+ 36 - 0
models/report_selection_chart_log.go

@@ -0,0 +1,36 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxReportSelectionChartLog struct {
+	ArticleSunId      int       `orm:"column(article_sun_id);pk"description:"子级报告id"`
+	ArticleId         int       `description:"父级报告Id"`
+	ChartPermissionId int       `description:"行业ID"`
+	CreateTime        time.Time `description:"创建时间"`
+	Body              string    `description:"内容"`
+}
+
+type CygxReportSelectionChartLogRep struct {
+	ChartPermissionId   int    `description:"行业ID"`
+	ChartPermissionName string `description:"行业ID"`
+	BodyChartSummary    string `orm:"column(body)"description:"内容"`
+}
+
+type AddCygxReportSelectionChartLog struct {
+	ChartPermissionId   int    `description:"行业ID"`
+	ChartPermissionName string `description:"行业ID"`
+	BodyChartSummary    string `orm:"column(body)"description:"内容"`
+}
+
+func GetCygxReportSelectionChartLogRepList(articleId int) (items []*CygxReportSelectionChartLogRep, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT l.*,c.chart_permission_name
+			FROM cygx_report_selection_chart_log AS l
+			LEFT JOIN chart_permission as c  ON c.chart_permission_id = l.chart_permission_id
+			WHERE  1= 1 AND article_id=?  `
+	_, err = o.Raw(sql, articleId).QueryRows(&items)
+	return
+}