|
@@ -258,6 +258,7 @@ func (this *ReportController) IndustryList() {
|
|
|
// @Description 产业下所关联的文章分类列表接口
|
|
|
// @Param IndustrialManagementId query int true "产业ID"
|
|
|
// @Param ShowTimeLine query int true "是否展示时间线 0不展示,1展示"
|
|
|
+// @Param IsSendWx query int false "是否是通过微信模版进来的 1是,其它否"
|
|
|
// @Success 200 {object} models.IndustrialToArticleCategoryListRep
|
|
|
// @router /toArticleCategoryList [get]
|
|
|
func (this *ReportController) ArticleCategoryList() {
|
|
@@ -279,6 +280,7 @@ func (this *ReportController) ArticleCategoryList() {
|
|
|
return
|
|
|
}
|
|
|
showTimeLine, _ := this.GetInt("ShowTimeLine", 0)
|
|
|
+ isSendWx, _ := this.GetInt("IsSendWx")
|
|
|
|
|
|
detail, err := models.GetIndustrialManagementDetail(industrialManagementId)
|
|
|
if err != nil {
|
|
@@ -440,7 +442,16 @@ func (this *ReportController) ArticleCategoryList() {
|
|
|
if videoSimple.Id > 0 {
|
|
|
resp.IndustryVideo = videoSimple
|
|
|
}
|
|
|
-
|
|
|
+ if isSendWx == 1 {
|
|
|
+ industryUserFollowMap, err := services.GetIndustryUserFollowMap(user)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "GetActivitySignupResp,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.IsFollowButton = industryUserFollowMap[industrialManagementId]
|
|
|
+ resp.IsShowFollowButton = true
|
|
|
+ }
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "获取成功"
|
|
@@ -1529,6 +1540,7 @@ func (this *ReportController) ReportListByType() {
|
|
|
// @Title 获取报告精选详情
|
|
|
// @Description 获取报告精选详情接口
|
|
|
// @Param ArticleId query int true "报告ID"
|
|
|
+// @Param IsBestNew query bool false "是否获取最新的一篇报告"
|
|
|
// @Success 200 {object} models.ReportSelectionLetailResp
|
|
|
// @router /reportSelection/detail [get]
|
|
|
func (this *ReportController) Detail() {
|
|
@@ -1543,11 +1555,32 @@ func (this *ReportController) Detail() {
|
|
|
br.Ret = 408
|
|
|
return
|
|
|
}
|
|
|
+ if user.CompanyId != utils.HZ_COMPANY_ID {
|
|
|
+ br.Msg = "报告编辑中,请稍后"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
uid := user.UserId
|
|
|
articleId, _ := this.GetInt("ArticleId")
|
|
|
- if articleId < 0 {
|
|
|
- br.Msg = "参数错误"
|
|
|
- br.ErrMsg = "参数错误"
|
|
|
+ isBestNew, _ := this.GetBool("IsBestNew")
|
|
|
+ if isBestNew {
|
|
|
+ tbdb := "cygx_report_selection"
|
|
|
+ //reportTypeStr := "bgjx"
|
|
|
+ condition := ` AND publish_status = 1 `
|
|
|
+ var pars []interface{}
|
|
|
+ list, err := models.GetReportSelectionListPublic(condition, "1", tbdb, pars, 0, 1)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range list {
|
|
|
+ articleId = v.ArticleId
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if articleId < 1 {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "报告ID错误" + strconv.Itoa(articleId)
|
|
|
return
|
|
|
}
|
|
|
resp := new(models.ReportSelectionLetailResp)
|
|
@@ -1571,21 +1604,69 @@ func (this *ReportController) Detail() {
|
|
|
br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ if detail.ReportLink != "" {
|
|
|
+ articleIdLink, _ := services.GetReportLinkToArticleid(detail.ReportLink)
|
|
|
+ detail.CeLueArticleId = articleIdLink
|
|
|
+ }
|
|
|
+
|
|
|
+ //较上一期有观点变化(后台填写的核心逻辑汇总内容、标签内容有更新),或者新增的公司,显示new标签
|
|
|
+ var isAllNew bool // 判断是否都打新的标签
|
|
|
+ lastPeriods := detail.Periods - 1
|
|
|
+ mapBodyChartSummary := make(map[int]string)
|
|
|
+ mapLabel := make(map[int]string)
|
|
|
+ if lastPeriods > 0 {
|
|
|
+ detailLast, err := models.GetCygxReportSelectionInfoByperiods(lastPeriods)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "报告不存在,Err:" + err.Error() + "Periods:" + strconv.Itoa(lastPeriods)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if detailLast != nil {
|
|
|
+ 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], _ = services.GetReportContentTextSubNew(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 +1675,15 @@ func (this *ReportController) Detail() {
|
|
|
return
|
|
|
}
|
|
|
for k2, v2 := range listSonLog {
|
|
|
+ var isNew bool
|
|
|
+ if isAllNew {
|
|
|
+ isNew = true
|
|
|
+ } else {
|
|
|
+ v2Body, _ := services.GetReportContentTextSubNew(v2.Body)
|
|
|
+ if mapBodyChartSummary[v2.IndustrialSubjectId] != v2Body || 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 +1691,24 @@ 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, "{|}")
|
|
|
+ }
|
|
|
}
|
|
|
+ isNew = false
|
|
|
+ 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 +1728,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
|
|
@@ -2905,6 +3006,12 @@ func (this *ReportController) SearchReportAndResource() {
|
|
|
|
|
|
condition = ` AND a.publish_status = 1 AND a.article_type_id IN (` + articleTypeIds + `) AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%' ) `
|
|
|
|
|
|
+ hotMapindustrial, e := services.IndustrialManagementHotMapGropuPermission()
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取hot标签失败,IndustrialManagementHotMapGropuPermission ,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
listYxResource, err := models.GetSearchResourceList(user.UserId, condition, 0, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
@@ -2962,6 +3069,7 @@ func (this *ReportController) SearchReportAndResource() {
|
|
|
if fllowMap[v.IndustrialManagementId] > 0 {
|
|
|
listHzResource[k].IsFollw = true
|
|
|
}
|
|
|
+ v.IsHot = hotMapindustrial[v.IndustrialManagementId]
|
|
|
industrialIdSlice := make([]int, 0)
|
|
|
articleIdArr := make([]int, 0)
|
|
|
industrialIdSlice = append(industrialIdSlice, v.IndustrialManagementId)
|
|
@@ -3137,6 +3245,7 @@ func (this *ReportController) SearchReportAndResource() {
|
|
|
if fllowMap[v.IndustrialManagementId] > 0 {
|
|
|
listYxResource[k].IsFollw = true
|
|
|
}
|
|
|
+ v.IsHot = hotMapindustrial[v.IndustrialManagementId]
|
|
|
industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
|
|
|
}
|
|
|
|