Browse Source

研选文章模块

xingzai 2 years ago
parent
commit
9ff1d16543

+ 223 - 0
controllers/research.go

@@ -7,6 +7,7 @@ import (
 	"hongze/hongze_clpt/utils"
 	"strconv"
 	"strings"
+	"time"
 )
 
 type MobileResearchController struct {
@@ -204,3 +205,225 @@ func (this *MobileResearchController) KolList() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 主题热度/近期更新更多,列表
+// @Description 主题热度/近期更新更多,列表接口
+// @Param   ThemeType   query   int  true       "主题类型,1主题热度、2近期更新 默认1"
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Success 200 {object} models.IndustrialManagementHotListResp
+// @router /hotList [get]
+func (this *MobileResearchController) HotList() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	themeType, _ := this.GetInt("ThemeType", 1)
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize15
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+	var condition string
+	if themeType == 1 {
+		condition = `ORDER BY publish_date DESC `
+	} else {
+		condition = `ORDER BY sum_num DESC `
+	}
+	total, err := models.GetThemeHeatListCount("")
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	list, err := models.GetThemeHeatList(user.UserId, condition, startSize, pageSize)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+	condition = ` AND a.article_type_id > 0  `
+	listSubjcet, err := models.GetThemeHeatSubjectList(condition)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
+		return
+	}
+	mapHot := make(map[string]int)
+	condition = ` ORDER BY sum_num DESC `
+	listHot, err := models.GetThemeHeatList(user.UserId, condition, 0, 3)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+	for _, v := range listHot {
+		mapHot[v.IndustryName] = v.IndustrialManagementId
+	}
+	nowTime := time.Now().Local()
+	threeMonBefore := nowTime.AddDate(0, -3, 0)
+	for k, v := range list {
+		if v.MinReportTime != "" {
+			t, err := time.Parse(utils.FormatDateTime, v.MinReportTime)
+			if err != nil {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "报告最早发布时间有误,Err:" + err.Error()
+				return
+			}
+			if t.After(threeMonBefore) {
+				list[k].IsNew = true
+			}
+		}
+		if v.FllowNum > 0 {
+			list[k].IsFollw = true
+		}
+		for _, v2 := range listSubjcet {
+			if v2.IndustrialManagementId == v.IndustrialManagementId {
+				list[k].IndustrialSubjectList = append(list[k].IndustrialSubjectList, v2)
+			}
+		}
+		if mapHot[v.IndustryName] > 0 {
+			list[k].IsHot = true
+		}
+		list[k].PublishDate = utils.StrTimeToTime(v.PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
+	}
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp := new(models.IndustrialManagementHotListResp)
+	resp.Paging = page
+	resp.List = list
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 主题详情
+// @Description 主题详情接口
+// @Param   IndustrialManagementId   query   int  true       "分类ID"
+// @Success 200 {object} models.GetThemeDetailResp
+// @router /theme/detail [get]
+func (this *MobileResearchController) ThemeDetail() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	industrialManagementId, _ := this.GetInt("IndustrialManagementId")
+	if industrialManagementId < 1 {
+		br.Msg = "请输入产业ID"
+		return
+	}
+	detailIndustrial, err := models.GetIndustrialManagementDetail(industrialManagementId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取信息失败,Err:" + err.Error()
+		return
+	}
+	var condition string
+
+	articleTypeIds, err := services.GetYanXuanArticleTypeIds()
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetYanXuanArticleTypeIds,Err:" + err.Error()
+		return
+	}
+	if articleTypeIds != "" {
+		condition = ` AND a.article_type_id IN (` + articleTypeIds + `)  `
+	} else {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "研选分类ID不能为空"
+		return
+	}
+	resp := new(models.GetThemeDetailResp)
+	list, err := models.GetThemeDetail(user.UserId, industrialManagementId, condition)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+	list, err = services.HandleArticleCategoryImg(list)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "HandleArticleCategoryImg,Err:" + err.Error()
+		return
+	}
+	//处理对应的文章类型标签按钮
+	nameMap, styleMap, err := services.GetArticleTypeMap()
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetArticleTypeMap Err:" + err.Error()
+		return
+	}
+	var articleIds []int
+	for _, v := range list {
+		item := models.ArticleResearchResp{
+			ArticleId:       v.ArticleId,
+			ArticleTypeId:   v.ArticleTypeId,
+			Title:           v.Title,
+			PublishDate:     v.PublishDate,
+			DepartmentId:    v.DepartmentId,
+			NickName:        v.NickName,
+			IsCollect:       v.IsCollect,
+			Pv:              v.Pv,
+			CollectNum:      v.CollectNum,
+			Abstract:        v.Abstract,
+			Annotation:      v.Annotation,
+			ImgUrlPc:        v.ImgUrlPc,
+			ArticleTypeName: nameMap[v.ArticleTypeId],
+			ButtonStyle:     styleMap[v.ArticleTypeId],
+			List:            v.List,
+		}
+		resp.List = append(resp.List, &item)
+		articleIds = append(articleIds, v.ArticleId)
+	}
+
+	//处理用户数是否关注该产业
+	userFollowIndustrialMap, err := services.GetUserFollowIndustrialMap(user)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetArticleTypeMap Err:" + err.Error()
+		return
+	}
+	if _, ok := userFollowIndustrialMap[industrialManagementId]; ok {
+		resp.IsFollw = true
+	}
+
+	//处理文章关联的标的
+	articleGroupSubjectMap, listSubtect, err := services.GetArticleGroupSubjectMap(articleIds)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetArticleTypeMap Err:" + err.Error()
+		return
+	}
+	if len(articleGroupSubjectMap) > 0 {
+		for k, v := range resp.List {
+			resp.List[k].ListSubject = articleGroupSubjectMap[v.ArticleId]
+		}
+		resp.ListSubject = listSubtect
+	}
+
+	resp.IndustryName = detailIndustrial.IndustryName
+	resp.IndustrialManagementId = detailIndustrial.IndustrialManagementId
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 30 - 0
models/industrial_subject.go

@@ -0,0 +1,30 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+)
+
+type IndustrialSubjectByArticle struct {
+	IndustrialSubjectId    int    `description:"标的id"`
+	IndustrialManagementId int    `description:"产业id"`
+	SubjectName            string `description:"标的名称"`
+	IndustryName           string `description:"产业名称"`
+	ArticleId              int    `description:"文章ID"`
+}
+
+// 获取标的列表
+func GetArticleGroupSubjectList(pars []interface{}, condition string) (items []*IndustrialSubjectByArticle, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			s.subject_name,
+			s.industrial_subject_id,
+			s.industrial_management_id,
+			g.article_id 
+		FROM
+			cygx_industrial_article_group_subject AS g
+			INNER JOIN cygx_industrial_subject AS s ON s.industrial_subject_id = g.industrial_subject_id 
+		WHERE
+			1 = 1 ` + condition
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 125 - 0
models/report.go

@@ -270,6 +270,7 @@ type IndustrialManagementHotResp struct {
 	PublishDate            string               `description:"发布时间"`
 	ArticleReadNum         int                  `description:"文章阅读数量"`
 	Source                 int                  `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
+	MinReportTime          string               `description:"报告最早发布时间"`
 	IndustrialSubjectList  []*IndustrialSubject `description:"标的列表"`
 }
 
@@ -437,6 +438,7 @@ type ArticleResearchResp struct {
 	ButtonStyle     string                       `description:"按钮展示样式"`
 	ImgUrlPc        string                       `description:"图片链接"`
 	List            []*IndustrialManagementIdInt `description:"产业列表"`
+	ListSubject     []*IndustrialSubject         `description:"标的列表"`
 }
 
 // 获取数量
@@ -480,3 +482,126 @@ func GetArticleResearchList(condition string, pars []interface{}, startSize, pag
 	_, err = o.Raw(sql, userId, pars, startSize, pageSize).QueryRows(&items)
 	return
 }
+
+type IndustrialManagementHotListResp struct {
+	Paging *paging.PagingItem `description:"分页数据"`
+	List   []*IndustrialManagementHotResp
+}
+
+// 获取数量
+func GetThemeHeatListCount(condition string) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT   COUNT( DISTINCT m.industrial_management_id ) FROM
+			cygx_industrial_management AS m
+			LEFT JOIN cygx_industrial_article_group_management AS mg ON mg.industrial_management_id = m.industrial_management_id
+			LEFT JOIN cygx_article AS a ON a.article_id = mg.article_id 
+			LEFT JOIN cygx_industrial_activity_group_management as ag ON ag.industrial_management_id = mg.industrial_management_id
+		WHERE
+			1 = 1
+			AND a.article_type_id > 0 AND a.publish_status = 1  ` + condition
+	err = o.Raw(sql).QueryRow(&count)
+	return
+}
+
+// 产业列表
+func GetThemeHeatList(userId int, condition string, startSize, pageSize int) (items []*IndustrialManagementHotResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			m.industry_name,
+			m.industrial_management_id,
+			m.article_read_num,
+          	MAX( a.publish_date ) AS publish_date,
+			MIN(a.publish_date) AS min_report_time,
+			( SELECT count( 1 ) FROM cygx_industry_fllow AS f  WHERE f.industrial_management_id = m.industrial_management_id  AND user_id =? AND f.type = 1  ) AS fllow_num,
+			m.article_read_num + ( SELECT count( 1 ) FROM cygx_activity_meet_detail_log AS la  WHERE la.activity_id  IN  (SELECT activity_id FROM cygx_industrial_activity_group_management WHERE industrial_management_id = m.industrial_management_id  ) AND DATE_SUB( CURDATE(), INTERVAL 30 DAY ) <= date( la.activity_time ) ) AS sum_num
+		FROM
+			cygx_industrial_management AS m
+			LEFT JOIN cygx_industrial_article_group_management AS mg ON mg.industrial_management_id = m.industrial_management_id
+			LEFT JOIN cygx_article AS a ON a.article_id = mg.article_id 
+			LEFT JOIN cygx_industrial_activity_group_management as ag ON ag.industrial_management_id = mg.industrial_management_id
+		WHERE
+			1 = 1
+			AND a.article_type_id > 0
+			AND publish_status = 1 
+			GROUP BY m.industrial_management_id ` + condition + ` LIMIT ?,?`
+	_, err = o.Raw(sql, userId, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+type GetThemeAericleListResp struct {
+	ArticleId           int    `description:"文章id"`
+	Title               string `description:"标题"`
+	PublishDate         string `description:"发布时间"`
+	SubjectName         string `description:"标的名称"`
+	IndustrialSubjectId int    `description:"标的ID"`
+	DepartmentId        int    `description:"作者Id"`
+	NickName            string `description:"作者昵称"`
+	Pv                  int    `description:"PV"`
+	CollectNum          int    `description:"收藏人数"`
+	FllowNum            int    `description:"关注数量"`
+	MyCollectNum        int    `description:"本人是否收藏"`
+	IsCollect           bool   `description:"本人是否收藏"`
+}
+
+// 主题详情start
+type GetThemeDetailResp struct {
+	IndustrialManagementId int                  `description:"产业Id"`
+	IndustryName           string               `description:"产业名称"`
+	IsFollw                bool                 `description:"是否关注"`
+	ListSubject            []*IndustrialSubject `description:"标的列表"`
+	List                   []*ArticleResearchResp
+}
+
+// 主题详情start
+type GetThemeDetailListResp struct {
+	ArticleId              int    `description:"文章id"`
+	Title                  string `description:"标题"`
+	PublishDate            string `description:"发布时间"`
+	SubjectName            string `description:"标的名称"`
+	IndustrialSubjectId    int    `description:"标的id"`
+	DepartmentId           int    `description:"作者Id"`
+	NickName               string `description:"作者昵称"`
+	Pv                     int    `description:"PV"`
+	CollectNum             int    `description:"收藏人数"`
+	IndustrialManagementId int    `description:"产业Id"`
+	IndustryName           string `description:"产业名称"`
+	FllowNum               int    `description:"关注数量"`
+	MyCollectNum           int    `description:"本人是否收藏"`
+	IsCollect              bool   `description:"本人是否收藏"`
+}
+
+type GetThemeAericleListBuSubjectResp struct {
+	SubjectName string `description:"标的名称"`
+	List        []*GetThemeAericleListResp
+}
+
+// 列表
+func GetThemeDetail(userId, industrialManagementId int, condition string) (items []*ArticleListResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			a.article_id,
+			a.title,
+			a.body,
+			a.annotation,
+			a.abstract,
+			a.publish_date,
+			a.article_type_id,
+			d.nick_name,
+			d.department_id,
+			( SELECT count( 1 ) FROM cygx_article_history_record_newpv AS h WHERE h.article_id = a.article_id ) AS pv,
+			( SELECT count( 1 ) FROM cygx_article_collect AS ac WHERE ac.article_id = a.article_id ) AS collect_num,
+			( SELECT count( 1 ) FROM cygx_article_collect AS ac WHERE ac.article_id = a.article_id and user_id = ? ) AS my_collect_num
+		FROM
+			cygx_article AS a
+			INNER JOIN cygx_industrial_article_group_management AS mg ON mg.article_id = a.article_id
+			INNER JOIN cygx_industrial_management AS m ON m.industrial_management_id = mg.industrial_management_id
+			INNER JOIN cygx_article_department AS d ON d.department_id = a.department_id
+		WHERE
+			1 = 1
+			AND m.industrial_management_id = ? 
+			AND publish_status = 1 ` + condition + `
+		ORDER BY
+			publish_date DESC`
+	_, err = o.Raw(sql, userId, industrialManagementId).QueryRows(&items)
+	return
+} //end

+ 18 - 0
routers/commentsRouter.go

@@ -403,6 +403,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:MobileResearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:MobileResearchController"],
+        beego.ControllerComments{
+            Method: "HotList",
+            Router: `/hotList`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:MobileResearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:MobileResearchController"],
         beego.ControllerComments{
             Method: "KolList",
@@ -412,6 +421,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:MobileResearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:MobileResearchController"],
+        beego.ControllerComments{
+            Method: "ThemeDetail",
+            Router: `/theme/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:MobileSearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:MobileSearchController"],
         beego.ControllerComments{
             Method: "BrowseHistoryList",

+ 27 - 7
services/article.go

@@ -31,7 +31,7 @@ func FixArticleImgUrl(body string) (contentSub string, err error) {
 	return
 }
 
-//GetReportContentTextSubByarticle 解析文章内容
+// GetReportContentTextSubByarticle 解析文章内容
 func GetReportContentTextSubByarticle(content, abstract string, articleId int) (contentSub string, err error) {
 	var lenabstract int
 	//如果不是研选就这么展示
@@ -81,7 +81,7 @@ func GetReportContentTextArticleBody(content string) (contentSub string) {
 	return
 }
 
-//HandleArticleCategoryImg 预处理文章的封面图片
+// HandleArticleCategoryImg 预处理文章的封面图片
 func HandleArticleCategoryImg(list []*models.ArticleListResp) (items []*models.ArticleListResp, err error) {
 	//研选的五张图片
 	detailResearch, e := models.GetConfigByCode("category_research_img_url")
@@ -202,7 +202,7 @@ func HandleArticleCategoryImg(list []*models.ArticleListResp) (items []*models.A
 	return
 }
 
-//HandleArticleStock 处理报告关联的个股标签
+// HandleArticleStock 处理报告关联的个股标签
 func HandleArticleStock(stock string) (items []*models.ComapnyNameResp) {
 	sliceSubjects := strings.Split(stock, "/")
 	if len(sliceSubjects) > 0 {
@@ -216,7 +216,7 @@ func HandleArticleStock(stock string) (items []*models.ComapnyNameResp) {
 	return
 }
 
-//弘则报告发布日期在三个月以内的
+// 弘则报告发布日期在三个月以内的
 func GetArticNewLabelWhithActivity3Month() (labelMap map[int]bool, err error) {
 	var condition string
 	var pars []interface{}
@@ -265,7 +265,7 @@ func GetArticNewLabelWhithActivity3Month() (labelMap map[int]bool, err error) {
 	return
 }
 
-//GetSpecialArticleDetailUserPower 处理用户查看专项调研文章详情的权限
+// GetSpecialArticleDetailUserPower 处理用户查看专项调研文章详情的权限
 func GetSpecialArticleDetailUserPower(user *models.WxUserItem, articleInfo *models.ArticleDetail) (havePower bool, err error) {
 	permissionStr, e := GetCompanyPermissionUpgrade(user.CompanyId)
 	if e != nil {
@@ -316,7 +316,7 @@ func GetReportContentTextSubNew(content string) (contentSub string, err error) {
 	return
 }
 
-//处理核心观点的展示规则
+// 处理核心观点的展示规则
 func ArticleAnnotation(item *models.ArticleListResp) (annotation string) {
 	if item.ArticleId >= utils.SummaryArticleId {
 		item.Annotation = YxArticleAnnotation(item)
@@ -388,7 +388,7 @@ func ArticleAnnotation(item *models.ArticleListResp) (annotation string) {
 	return
 }
 
-//解析研选内容中的核心观点
+// 解析研选内容中的核心观点
 func YxArticleAnnotation(article *models.ArticleListResp) (annotation string) {
 	//如果不规范,就获取内容主体
 	if strings.Count(article.Body, "<hr") == 0 {
@@ -439,3 +439,23 @@ func YxArticleAnnotation(article *models.ArticleListResp) (annotation string) {
 	annotation = body
 	return
 }
+
+// 获取研选类型的文章分类Id
+func GetYanXuanArticleTypeIds() (articleTypeIds string, err error) {
+	var condition string
+	condition = " AND is_show_yanx  = 1 "
+	listType, e := models.GetCygxArticleTypeListCondition(condition)
+	if e != nil {
+		err = errors.New("GetCygxArticleTypeListCondition, Err: " + e.Error())
+		return
+	}
+	for _, v := range listType {
+		articleTypeIds += strconv.Itoa(v.ArticleTypeId) + ","
+	}
+	articleTypeIds = strings.TrimRight(articleTypeIds, ",")
+	if articleTypeIds == "" {
+		err = errors.New("研选分类ID不能为空")
+		return
+	}
+	return
+}

+ 18 - 0
services/industrial_management.go

@@ -249,6 +249,7 @@ func GetArticleIndustrialByArticleId(articleIds []int) (itemMap map[int][]*model
 	return
 }
 
+// 获取研选文章类型的配置信息
 func GetArticleTypeMap() (nameMapResp map[int]string, buttonStyleMapResp map[int]string, err error) {
 	condition := " AND is_show_yanx  = 1 "
 	list, e := models.GetCygxArticleTypeListCondition(condition)
@@ -268,3 +269,20 @@ func GetArticleTypeMap() (nameMapResp map[int]string, buttonStyleMapResp map[int
 	buttonStyleMapResp = buttonStyleMap
 	return
 }
+
+// GetUserFollowIndustrialMap获取用户关注的产业
+func GetUserFollowIndustrialMap(user *models.WxUserItem) (mapResp map[int]int, err error) {
+	list, e := models.GetUserFllowIndustrialList(user.UserId)
+	if e != nil {
+		err = errors.New("GetUserFllowIndustrialList " + e.Error())
+		return
+	}
+	fllowMap := make(map[int]int)
+	if len(list) > 0 {
+		for _, v := range list {
+			fllowMap[v.IndustrialManagementId] = v.IndustrialManagementId
+		}
+	}
+	mapResp = fllowMap
+	return
+}

+ 42 - 0
services/industrial_subject.go

@@ -0,0 +1,42 @@
+package services
+
+import (
+	"errors"
+	"hongze/hongze_clpt/models"
+	"hongze/hongze_clpt/utils"
+)
+
+// GetArticleGroupSubjectMap 获取文章所关联的标的
+func GetArticleGroupSubjectMap(articleIds []int) (mapResp map[int][]*models.IndustrialSubject, listSubtect []*models.IndustrialSubject, err error) {
+	lenArticleIds := len(articleIds)
+	if lenArticleIds == 0 {
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition = ` AND g.article_id IN (` + utils.GetOrmInReplace(len(articleIds)) + `)`
+	pars = append(pars, articleIds)
+	list, e := models.GetArticleGroupSubjectList(pars, condition)
+	if e != nil {
+		err = errors.New("GetArticleGroupSubjectList " + e.Error())
+		return
+	}
+	listMap := make(map[int][]*models.IndustrialSubject)
+	mapName := make(map[int]int)
+	if len(list) > 0 {
+		for _, v := range list {
+			item := models.IndustrialSubject{
+				IndustrialSubjectId:    v.IndustrialSubjectId,
+				IndustrialManagementId: v.IndustrialManagementId,
+				SubjectName:            v.SubjectName,
+			}
+			listMap[v.ArticleId] = append(listMap[v.ArticleId], &item)
+			if _, ok := mapName[v.IndustrialSubjectId]; !ok {
+				listSubtect = append(listSubtect, &item)
+			}
+			mapName[v.IndustrialSubjectId] = v.IndustrialManagementId
+		}
+	}
+	mapResp = listMap
+	return
+}