|
@@ -129,37 +129,6 @@ func (this *ReportController) IndustryList() {
|
|
|
condition += ` AND is_deep_label = ` + isDeepLabel
|
|
|
}
|
|
|
if keyWord != "" {
|
|
|
- //keyWordArr, err := services.GetIndustryMapNameSliceV2(keyWord)
|
|
|
- //if err != nil {
|
|
|
- // br.Msg = "获取信息失败"
|
|
|
- // br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
- // return
|
|
|
- //}
|
|
|
- //var conditionkeyWord string
|
|
|
- //conditionkeyWord += ` subject_names LIKE '%` + keyWord + `%'`
|
|
|
- //keyWordArr = services.RemoveDuplicatesAndEmpty(keyWordArr)
|
|
|
- //keyWordLen := len(keyWordArr)
|
|
|
- //if keyWordLen <= 0 {
|
|
|
- // keyWordArr = append(keyWordArr, keyWord)
|
|
|
- // keyWordLen = len(keyWordArr)
|
|
|
- //}
|
|
|
- //for _, v := range keyWordArr {
|
|
|
- // conditionkeyWord += ` OR subject_names LIKE '%` + v + `%'`
|
|
|
- //}
|
|
|
- //industrialManagementIds, err := models.GetIndustrialManagementIdsBykeyWord(conditionkeyWord)
|
|
|
- //if err != nil {
|
|
|
- // br.Msg = "获取信息失败"
|
|
|
- // br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
- // return
|
|
|
- //}
|
|
|
- //if industrialManagementIds == "" {
|
|
|
- // br.Ret = 200
|
|
|
- // br.Success = true
|
|
|
- // br.Msg = "获取成功"
|
|
|
- // br.Data = resp
|
|
|
- // return
|
|
|
- //}
|
|
|
- //condition += ` AND man.industrial_management_id IN (` + industrialManagementIds + `)`
|
|
|
condition += ` AND subject_names LIKE '%` + keyWord + `%'`
|
|
|
}
|
|
|
var sqlChartPermissionId string
|
|
@@ -237,173 +206,12 @@ func (this *ReportController) IndustryList() {
|
|
|
// 获取近一个月产业报告阅读次数最多的产业
|
|
|
var topCond string
|
|
|
var topPars []interface{}
|
|
|
- topReadIndustryId := 0
|
|
|
+ //topReadIndustryId := 0
|
|
|
if ChartPermissionId > 0 {
|
|
|
topCond += ` AND chart_permission_id = ?`
|
|
|
topPars = append(topPars, ChartPermissionId)
|
|
|
}
|
|
|
- topReadIndustry, e := models.GetTopOneMonthArtReadNumIndustry(topCond, topPars)
|
|
|
- if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取近一个月报告阅读次数最多的产业失败, Err: " + e.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if topReadIndustry != nil {
|
|
|
- topReadIndustryId = topReadIndustry.IndustrialManagementId
|
|
|
- }
|
|
|
-
|
|
|
- //查询产业视频
|
|
|
- industrialVideoMap := make(map[int]*models.MicroVideoSimpleInfo)
|
|
|
- var industrialManagementIds []int
|
|
|
- for _, v := range list {
|
|
|
- if v.IndustrialManagementId > 0 {
|
|
|
- industrialManagementIds = append(industrialManagementIds, v.IndustrialManagementId)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 用户权限
|
|
|
- authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
|
|
|
- if e != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- mapUPdateTime := make(map[int]string)
|
|
|
-
|
|
|
- if len(industrialManagementIds) > 0 {
|
|
|
- // 获取默认图配置
|
|
|
- _, videoMap, _, _, e := services.GetMicroRoadShowDefaultImgConfig()
|
|
|
- if e != nil {
|
|
|
- br.Msg = "获取视频默认配置图失败"
|
|
|
- br.ErrMsg = "获取视频默认配置图失败, Err: " + e.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- videoList, err := models.GetMicroRoadshowVideoByIndustryIds(industrialManagementIds)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "产业视频列表失败"
|
|
|
- br.ErrMsg = "产业视频列表失败, Err: " + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- for _, v := range videoList {
|
|
|
- tmp := &models.MicroVideoSimpleInfo{
|
|
|
- Id: v.VideoId,
|
|
|
- Title: "5min逻辑【" + v.IndustryName + "】解析",
|
|
|
- ResourceUrl: v.VideoUrl,
|
|
|
- BackgroundImg: v.ImgUrl,
|
|
|
- PlaySeconds: v.VideoDuration,
|
|
|
- DetailImgUrl: v.DetailImgUrl,
|
|
|
- ChartPermissionId: v.ChartPermissionId,
|
|
|
- ChartPermissionName: v.ChartPermissionName,
|
|
|
- }
|
|
|
- if tmp.BackgroundImg == "" {
|
|
|
- tmp.BackgroundImg = videoMap[v.ChartPermissionId]
|
|
|
- }
|
|
|
- industrialVideoMap[v.IndustryId] = tmp
|
|
|
- }
|
|
|
- //获取这些产业下最新更新的文章
|
|
|
- listUpdateTime, err := models.GetNewArticleDetailByIndustrialIds(industrialManagementIds)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- return
|
|
|
- }
|
|
|
- for _, v := range listUpdateTime {
|
|
|
- mapUPdateTime[v.IndustrialManagementId] = v.PublishDate
|
|
|
- }
|
|
|
-
|
|
|
- //时间线的更新时间
|
|
|
- // maptimelineUPdateTime := make(map[int]string)
|
|
|
- listtimelinePublishdate, err := models.GetTimeLineReportIndustrialPublishdateList(industrialManagementIds)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- return
|
|
|
- }
|
|
|
- for _, v := range listtimelinePublishdate {
|
|
|
- if mapUPdateTime[v.IndustrialManagementId] != "" {
|
|
|
- if utils.StrTimeToTime(v.PublishDate).After(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
|
|
|
- mapUPdateTime[v.IndustrialManagementId] = v.PublishDate
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- nowTime := time.Now().Local()
|
|
|
- threeMonBefore := nowTime.AddDate(0, -3, 0)
|
|
|
- for k, v := range list {
|
|
|
- industrialSubjectList, err := models.GetIndustrialSubjectAll(v.IndustrialManagementId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- list[k].IndustrialSubjectList = industrialSubjectList
|
|
|
- list[k].LayoutTime = utils.TimeRemoveHms(v.LayoutTime)
|
|
|
- newArtinfo, err := models.GetIndustrialNewArticleDetail(v.IndustrialManagementId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- list[k].UpdateTime = utils.TimeRemoveHms(mapUPdateTime[v.IndustrialManagementId])
|
|
|
- recordCount, err := models.GetUserToArticleCount(uid, newArtinfo.ArticleId)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取信息失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(newArtinfo.ArticleId)
|
|
|
- return
|
|
|
- }
|
|
|
- if recordCount == 0 && user.CreatedTime.Before(utils.StrTimeToTime(newArtinfo.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(newArtinfo.PublishDate)) {
|
|
|
- list[k].IsRed = true
|
|
|
- }
|
|
|
- // 原:关联的报告阅读量大于等于阅读第三的产业,则标记热门
|
|
|
- //if v.ArticleReadNum >= detailHot3.ArticleReadNum {
|
|
|
- // list[k].IsHot = true
|
|
|
- //}
|
|
|
-
|
|
|
- // 近一个月报告阅读次数最多的产业标记Hot
|
|
|
- if topReadIndustryId > 0 && list[k].IndustrialManagementId == topReadIndustryId {
|
|
|
- list[k].IsHot = true
|
|
|
- }
|
|
|
-
|
|
|
- // 关联报告发布时间均在3个月内则标记New
|
|
|
- if v.MinReportTime != "" {
|
|
|
- t, e := time.Parse(utils.FormatDateTime, v.MinReportTime)
|
|
|
- if e != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "报告最早发布时间有误, Err: " + e.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if t.After(threeMonBefore) {
|
|
|
- list[k].IsNew = true
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //展示产业视频
|
|
|
- if video, ok := industrialVideoMap[v.IndustrialManagementId]; ok {
|
|
|
- //控制用户权限
|
|
|
- // 权限
|
|
|
- au := new(models.UserPermissionAuthInfo)
|
|
|
- au.SellerName = authInfo.SellerName
|
|
|
- au.SellerMobile = authInfo.SellerMobile
|
|
|
- au.HasPermission = authInfo.HasPermission
|
|
|
- au.OperationMode = authInfo.OperationMode
|
|
|
- if au.HasPermission == 1 {
|
|
|
- // 非宏观权限进一步判断是否有权限
|
|
|
- if video.ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, video.ChartPermissionName) {
|
|
|
- au.HasPermission = 2
|
|
|
- }
|
|
|
- }
|
|
|
- // 无权限的弹框提示
|
|
|
- if au.HasPermission != 1 {
|
|
|
- if au.OperationMode == services.UserPermissionOperationModeCall {
|
|
|
- au.PopupMsg = services.UserPermissionPopupMsgCallMicroVideo
|
|
|
- } else {
|
|
|
- au.PopupMsg = services.UserPermissionPopupMsgApplyMicroVideo
|
|
|
- }
|
|
|
- video.ResourceUrl = ""
|
|
|
- }
|
|
|
- list[k].AuthInfo = au
|
|
|
- list[k].IndustryVideo = video
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- //记录用户搜索的筛选条件
|
|
|
+ list, err = services.HandleIndustryList(list, user)
|
|
|
if orderColumnNew != "" {
|
|
|
item := new(models.CygxReportIndustrialSeaarchHistory)
|
|
|
item.UserId = user.UserId
|
|
@@ -3017,10 +2825,26 @@ func (this *ReportController) SearchReportAndResource() {
|
|
|
br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ //严选的产业只关联研选下面的标的
|
|
|
+ var yxcondition string
|
|
|
+ var yxPer []interface{}
|
|
|
+ yxcondition = ` AND ag.article_id >= ?`
|
|
|
+ yxPer = append(yxPer, utils.SummaryArticleId)
|
|
|
+ listYxAticleSubject, err := models.GetSubjectArticleGroupManagementList(yxcondition, yxPer)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取研选报告关联的标的信息失败,GetSubjectArticleGroupManagementListErr:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapYxSubject := make(map[int]int)
|
|
|
+ for _, v := range listYxAticleSubject {
|
|
|
+ mapYxSubject[v.IndustrialSubjectId] = v.IndustrialSubjectId
|
|
|
+ }
|
|
|
+
|
|
|
mapIndustrial := make(map[string]int)
|
|
|
for _, v := range listSubjcet {
|
|
|
for k2, v2 := range listYxResource {
|
|
|
- if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] == 0 {
|
|
|
+ if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] == 0 && mapYxSubject[v.IndustrialSubjectId] > 0 {
|
|
|
listYxResource[k2].IndustrialSubjectList = append(listYxResource[k2].IndustrialSubjectList, v)
|
|
|
mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Yx", v.SubjectName)] = v2.IndustrialManagementId
|
|
|
}
|
|
@@ -3032,7 +2856,6 @@ func (this *ReportController) SearchReportAndResource() {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
resp := new(models.SearchReportAndResourceResp)
|