|
@@ -2,6 +2,7 @@ package controllers
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "fmt"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"hongze/hongze_cygx/models"
|
|
|
"hongze/hongze_cygx/services"
|
|
@@ -191,7 +192,6 @@ func (this *ResearchController) HotList() {
|
|
|
br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- condition = ` AND a.article_type_id > 0 `
|
|
|
listSubjcet, err := models.GetThemeHeatSubjectList(condition)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
@@ -213,6 +213,7 @@ func (this *ResearchController) HotList() {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+ fmt.Println(mapNew)
|
|
|
for k, v := range list {
|
|
|
list[k].IsNew = mapNew[v.IndustrialManagementId]
|
|
|
list[k].IsHot = mapHot[v.IndustrialManagementId]
|
|
@@ -374,11 +375,22 @@ func (this *ResearchController) ThemeDetail() {
|
|
|
source = 1
|
|
|
}
|
|
|
|
|
|
+ articleTypeIds, err := services.GetYanXuanArticleTypeIds()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "GetYanXuanArticleTypeIds,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if articleTypeIds == "" {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "研选分类ID不能为空"
|
|
|
+ return
|
|
|
+ }
|
|
|
var condition string
|
|
|
if source == 1 {
|
|
|
- condition = ` AND a.category_name LIKE '%研选%' `
|
|
|
+ condition = ` AND a.article_type_id IN (` + articleTypeIds + `) `
|
|
|
} else {
|
|
|
- condition = ` AND a.category_name NOT LIKE '%研选%' `
|
|
|
+ condition = ` AND a.article_type_id NOT IN (` + articleTypeIds + `) `
|
|
|
}
|
|
|
resp := new(models.GetThemeDetailResp)
|
|
|
list, err := models.GetThemeDetail(user.UserId, industrialManagementId, condition)
|
|
@@ -388,16 +400,27 @@ func (this *ResearchController) ThemeDetail() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ listSub, err := models.GetcygxIndustrialSubject(industrialManagementId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapSubjectlist := make(map[string]string)
|
|
|
+ for _, v := range listSub {
|
|
|
+ mapSubjectlist[v.SubjectName] = v.SubjectName
|
|
|
+ }
|
|
|
+
|
|
|
var itemsNull []*models.GetThemeAericleListResp
|
|
|
subjectMap := make(map[string]string)
|
|
|
- articleMap := make(map[int]int)
|
|
|
+ var articleIds []int
|
|
|
for _, v := range list {
|
|
|
resp.IndustryName = v.IndustryName
|
|
|
resp.IndustrialManagementId = v.IndustrialManagementId
|
|
|
itemSubJect := new(models.IndustrialSubject)
|
|
|
itemSubJect.SubjectName = v.SubjectName
|
|
|
itemSubJect.IndustrialSubjectId = v.IndustrialSubjectId
|
|
|
- if subjectMap[v.SubjectName] == "" && v.SubjectName != "" {
|
|
|
+ if subjectMap[v.SubjectName] == "" && v.SubjectName != "" && mapSubjectlist[v.SubjectName] != "" {
|
|
|
resp.ListSubject = append(resp.ListSubject, itemSubJect)
|
|
|
}
|
|
|
|
|
@@ -417,40 +440,33 @@ func (this *ResearchController) ThemeDetail() {
|
|
|
item.Pv = v.Pv
|
|
|
item.CollectNum = v.CollectNum
|
|
|
itemsNull = append(itemsNull, item)
|
|
|
-
|
|
|
}
|
|
|
+ articleIds = append(articleIds, v.ArticleId)
|
|
|
}
|
|
|
|
|
|
- for _, v := range resp.ListSubject {
|
|
|
- subjetcGroup := new(models.GetThemeAericleListBuSubjectResp)
|
|
|
- for _, v2 := range list {
|
|
|
- if v2.IndustrialSubjectId == v.IndustrialSubjectId && articleMap[v2.ArticleId] == 0 {
|
|
|
- item := new(models.GetThemeAericleListResp)
|
|
|
- item.ArticleId = v2.ArticleId
|
|
|
- item.Title = v2.Title
|
|
|
- item.PublishDate = v2.PublishDate
|
|
|
- item.SubjectName = v2.SubjectName
|
|
|
- item.IndustrialSubjectId = v2.IndustrialSubjectId
|
|
|
- for _, v3 := range list {
|
|
|
- if v3.ArticleId == v2.ArticleId && v3.SubjectName != v2.SubjectName && v3.SubjectName != "" {
|
|
|
- item.SubjectName += "/" + v3.SubjectName
|
|
|
- }
|
|
|
- }
|
|
|
- item.DepartmentId = v2.DepartmentId
|
|
|
- item.NickName = v2.NickName
|
|
|
- item.Pv = v2.Pv
|
|
|
- item.CollectNum = v2.CollectNum
|
|
|
- item.MyCollectNum = v2.MyCollectNum
|
|
|
- if v2.MyCollectNum > 0 {
|
|
|
- item.IsCollect = true
|
|
|
- }
|
|
|
- resp.List = append(resp.List, item)
|
|
|
- articleMap[v2.ArticleId] = v2.ArticleId
|
|
|
- //subjetcGroup.List = append(subjetcGroup.List, item)
|
|
|
- }
|
|
|
- subjetcGroup.SubjectName = v.SubjectName
|
|
|
+ mapArticleSubjectName, err := services.GetArticleSubjectName(articleIds)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v2 := range list {
|
|
|
+ item := new(models.GetThemeAericleListResp)
|
|
|
+ item.ArticleId = v2.ArticleId
|
|
|
+ item.Title = v2.Title
|
|
|
+ item.PublishDate = v2.PublishDate
|
|
|
+ item.SubjectName = v2.SubjectName
|
|
|
+ item.IndustrialSubjectId = v2.IndustrialSubjectId
|
|
|
+ item.DepartmentId = v2.DepartmentId
|
|
|
+ item.NickName = v2.NickName
|
|
|
+ item.Pv = v2.Pv
|
|
|
+ item.CollectNum = v2.CollectNum
|
|
|
+ item.MyCollectNum = v2.MyCollectNum
|
|
|
+ if v2.MyCollectNum > 0 {
|
|
|
+ item.IsCollect = true
|
|
|
}
|
|
|
-
|
|
|
+ item.SubjectName = mapArticleSubjectName[v2.ArticleId]
|
|
|
+ resp.List = append(resp.List, item)
|
|
|
}
|
|
|
//当标的为空时进行合并
|
|
|
if len(itemsNull) > 0 {
|