|
@@ -15,7 +15,7 @@ import (
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
-//报告
|
|
|
+// 报告
|
|
|
type ReportController struct {
|
|
|
BaseAuthController
|
|
|
}
|
|
@@ -415,7 +415,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 {
|
|
@@ -683,7 +683,7 @@ func (this *ReportController) List() {
|
|
|
timeLineRed := false
|
|
|
if count < 2 {
|
|
|
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 {
|
|
@@ -2738,124 +2738,32 @@ func (this *ReportController) SearchReportAndResource() {
|
|
|
} else {
|
|
|
sqlGroup += ` LIMIT 100 `
|
|
|
}
|
|
|
- ListYxReport, err := models.GetArticleCollectionList(` AND a.article_id >= 1000000 `+condition+sqlGroup, user.UserId)
|
|
|
+ ListYxReport, err := models.GetArticleCollectionList(` AND a.article_type_id IN (`+utils.YAN_XUAN_ARTICLE_TYPE_IDS+`) `+condition+sqlGroup, user.UserId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取研选文章列表失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- ListHzReport, err := models.GetReoprtSearchList(` AND a.article_id < 1000000 `+condition+` OR ( article_type = 'lyjh' `+condition+` ) OR ( a.sub_category_name = '专项调研' `+condition+` ) `+sqlGroup, user.UserId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取弘则报告文章列表失败,Err:" + err.Error()
|
|
|
+ br.ErrMsg = "获取文章列表失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
- keyWordArr, err := services.GetIndustryMapNameSliceV3(keyWord)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取失败"
|
|
|
- br.ErrMsg = "获取分词失败,GetIndustryMapNameSliceV3 Err: " + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- keyWordArr = services.RemoveDuplicatesAndEmpty(keyWordArr)
|
|
|
- var keyWordIk string
|
|
|
- if len(keyWordArr) > 1 {
|
|
|
- keyWordIk = services.KeyWordArrSqlRegexp(keyWordArr)
|
|
|
- var conditionIk string
|
|
|
- var sqlGroupIk string
|
|
|
- conditionIk = `AND ( a.title REGEXP '` + keyWordIk + `' OR a.annotation REGEXP '` + keyWordIk + `' OR a.abstract REGEXP '` + keyWordIk + `') AND a.publish_status = 1 `
|
|
|
- sqlGroupIk = ` GROUP BY a.article_id ORDER BY a.publish_date DESC `
|
|
|
- if pageSize > 0 {
|
|
|
- sqlGroupIk += ` LIMIT 5 `
|
|
|
- } else {
|
|
|
- sqlGroupIk += ` LIMIT 20 `
|
|
|
- }
|
|
|
- //研选的联想词列表
|
|
|
- ListYxReportIk, err := models.GetArticleCollectionList(` AND a.article_id >= 1000000 `+conditionIk+sqlGroupIk, user.UserId)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取研选IK文章列表失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if len(ListYxReportIk) > 0 {
|
|
|
- for _, v := range ListYxReportIk {
|
|
|
- ListYxReport = append(ListYxReport, v)
|
|
|
- }
|
|
|
- }
|
|
|
- //弘则的联想词列表
|
|
|
- ListHzReportIk, err := models.GetReoprtSearchList(` AND a.article_id < 1000000 `+conditionIk+sqlGroupIk, user.UserId)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取研选IK文章列表失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if len(ListHzReportIk) > 0 {
|
|
|
- for _, v := range ListHzReportIk {
|
|
|
- ListHzReport = append(ListHzReport, v)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- for k, v := range ListHzReport {
|
|
|
- ListHzReport[k].Source = 1
|
|
|
- if v.MyCollectNum > 0 {
|
|
|
- ListHzReport[k].IsCollect = true
|
|
|
- }
|
|
|
- }
|
|
|
for k, v := range ListYxReport {
|
|
|
ListYxReport[k].Source = 2
|
|
|
if v.MyCollectNum > 0 {
|
|
|
ListYxReport[k].IsCollect = true
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- var articleIds string
|
|
|
- for _, v := range ListHzReport {
|
|
|
- articleIds += strconv.Itoa(v.ArticleId) + ","
|
|
|
- }
|
|
|
- for _, v := range ListYxReport {
|
|
|
- articleIds += strconv.Itoa(v.ArticleId) + ","
|
|
|
- }
|
|
|
- articleIds = strings.TrimRight(articleIds, ",")
|
|
|
- silcearticleIds := strings.Split(articleIds, ",")
|
|
|
- var parsindustrial []interface{}
|
|
|
- parsindustrial = make([]interface{}, 0)
|
|
|
- articleIdList := make([]string, 0)
|
|
|
- for _, v := range silcearticleIds {
|
|
|
- articleIdList = append(articleIdList, v)
|
|
|
- }
|
|
|
- conditionindustrial := ` AND mg.article_id IN ( ` + utils.GetOrmInReplace(len(silcearticleIds)) + ` ) `
|
|
|
- parsindustrial = append(parsindustrial, articleIdList)
|
|
|
- industrialList, err := models.GetIndustrialListByarticleId(parsindustrial, conditionindustrial)
|
|
|
+ //研选下面的报告又区分出了非研选,先根据 YAN_XUAN_ARTICLE_TYPE_IDS 这么处理吧
|
|
|
+ //ListHzReport, err := models.GetReoprtSearchList(` AND a.article_id < 1000000 `+condition+` OR ( article_type = 'lyjh' `+condition+` ) OR ( a.sub_category_name = '专项调研' `+condition+` ) `+sqlGroup, user.UserId)
|
|
|
+ ListHzReport, err := models.GetReoprtSearchList(` AND a.article_type_id NOT IN (`+utils.YAN_XUAN_ARTICLE_TYPE_IDS+`) `+condition+sqlGroup, user.UserId)
|
|
|
if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取文章列表失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- industrialMap := make(map[int][]*models.IndustrialManagementResp)
|
|
|
- if len(industrialList) > 0 {
|
|
|
- for _, v := range industrialList {
|
|
|
- item := new(models.IndustrialManagementResp)
|
|
|
- //item.ArticleId = v.ArticleId
|
|
|
- item.IndustrialManagementId = v.IndustrialManagementId
|
|
|
- item.IndustryName = v.IndustryName
|
|
|
- item.ChartPermissionId = v.ChartPermissionId
|
|
|
- industrialMap[v.ArticleId] = append(industrialMap[v.ArticleId], item)
|
|
|
- }
|
|
|
- }
|
|
|
for k, v := range ListHzReport {
|
|
|
- if len(industrialMap[v.ArticleId]) > 0 {
|
|
|
- ListHzReport[k].List = industrialMap[v.ArticleId]
|
|
|
- } else {
|
|
|
- ListHzReport[k].List = make([]*models.IndustrialManagementResp, 0)
|
|
|
- }
|
|
|
- }
|
|
|
- for k, v := range ListYxReport {
|
|
|
- if len(industrialMap[v.ArticleId]) > 0 {
|
|
|
- ListYxReport[k].List = industrialMap[v.ArticleId]
|
|
|
- } else {
|
|
|
- ListYxReport[k].List = make([]*models.IndustrialManagementResp, 0)
|
|
|
+ ListHzReport[k].Source = 1
|
|
|
+ if v.MyCollectNum > 0 {
|
|
|
+ ListHzReport[k].IsCollect = true
|
|
|
}
|
|
|
}
|
|
|
- //获取文章关联的产业
|
|
|
|
|
|
if len(ListYxReport) == 0 {
|
|
|
ListYxReport = make([]*models.ArticleCollectionResp, 0)
|
|
@@ -2877,9 +2785,9 @@ func (this *ReportController) SearchReportAndResource() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- var conditionOr string
|
|
|
- conditionOr += ` OR ( m.subject_names LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
|
|
|
- condition = ` AND m.industry_name LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + conditionOr
|
|
|
+ //var conditionOr string
|
|
|
+ //conditionOr += ` OR ( m.subject_names LIKE '%` + keyWord + `%' AND a.article_id < ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
|
|
|
+ condition = ` AND a.publish_status = 1 AND a.article_type_id NOT IN (` + utils.YAN_XUAN_ARTICLE_TYPE_IDS + `) AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%' ) `
|
|
|
|
|
|
listHzResource, err := models.GetSearchResourceList(user.UserId, condition, 0, pageSize)
|
|
|
if err != nil {
|
|
@@ -2888,9 +2796,9 @@ func (this *ReportController) SearchReportAndResource() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- conditionOr = ` OR ( m.subject_names LIKE '%` + keyWord + `%' AND a.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
|
|
|
- condition = ` AND m.industry_name LIKE '%` + keyWord + `%' AND a.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + conditionOr
|
|
|
-
|
|
|
+ //conditionOr = ` OR ( m.subject_names LIKE '%` + keyWord + `%' AND a.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + ` AND publish_status = 1 ) `
|
|
|
+ //condition = ` AND m.industry_name LIKE '%` + keyWord + `%' AND a.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + conditionOr
|
|
|
+ condition = ` AND a.publish_status = 1 AND a.article_type_id IN (` + utils.YAN_XUAN_ARTICLE_TYPE_IDS + `) AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%' ) `
|
|
|
listYxResource, err := models.GetSearchResourceList(user.UserId, condition, 0, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
@@ -3003,6 +2911,7 @@ func (this *ReportController) SearchReportAndResource() {
|
|
|
listYxResource[k].IsFollw = true
|
|
|
}
|
|
|
industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
if len(industrialIdArr) > 0 {
|
|
@@ -3130,7 +3039,7 @@ func (this *ReportController) SearchReportAndResource() {
|
|
|
keyWordItem.PageType = "ReortSearch"
|
|
|
keyWordItem.CreateTime = time.Now()
|
|
|
go models.AddUserSearchKeyWord(keyWordItem)
|
|
|
- //go services.AddUserSearchLog(user, keyWord, 5)
|
|
|
+ go services.AddUserSearchLog(user, keyWord, 5)
|
|
|
}
|
|
|
|
|
|
resp.ListHzResource = listHzResource
|