Browse Source

no message

xingzai 1 year ago
parent
commit
b93f0ea25a

+ 10 - 12
controllers/morning_meeting.go

@@ -169,18 +169,16 @@ func (this *MorningMeetingController) GatherDetail() {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取失败,Err:" + err.Error()
 		}
-		detailResp.List = listMeet
-		//for _, v := range listMeet {
-		//	detailResp.List = append(detailResp.List, &models.CygxMorningMeetingGatherDetailListResp{
-		//		Id:                  v.Id,
-		//		IndustryId:          v.IndustryId,
-		//		IndustryName:        v.IndustryName,
-		//		ChartPermissionName: v.ChartPermissionName,
-		//		ChartPermissionId:   v.ChartPermissionId,
-		//		MeetingId:           int(v.MeetingId),
-		//		Content:             v.Content,
-		//	})
-		//}
+
+		var meetingreviewchaptIds []int
+		for _, v := range listMeet {
+			meetingreviewchaptIds = append(meetingreviewchaptIds, v.Id)
+		}
+		detailResp.List, err = services.GetCygxMorningMeetingReviewChapterListByIds(meetingreviewchaptIds)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "GetCygxMorningMeetingReviewChapterListByIds,Err:" + err.Error()
+		}
 	} else {
 		detailResp.List = make([]*models.CygxMorningMeetingGatherDetailListResp, 0)
 	}

+ 23 - 0
controllers/report.go

@@ -650,6 +650,25 @@ func (this *ReportController) List() {
 			br.ErrMsg = "获取帖子数据失败,Err:" + err.Error()
 			return
 		}
+
+		//处理晨会精华关联的标的,以及要跳转的文章ID
+		var meetingreviewchaptIds []int
+		mapchaptIdAndArticleId := make(map[int]int)                            // 晨会精华ID与跳转文章ID的映射关系
+		mapchaptIdListSubject := make(map[int][]*models.CygxIndustrialSubject) // 晨会精华ID与标的列表的映射关系
+		for _, v := range list {
+			if v.Resource == 3 {
+				meetingreviewchaptIds = append(meetingreviewchaptIds, v.Id)
+			}
+			listMeet, err := services.GetCygxMorningMeetingReviewChapterListByIds(meetingreviewchaptIds)
+			if err != nil {
+				br.Msg = "获取失败"
+				br.ErrMsg = "GetCygxMorningMeetingReviewChapterListByIds,Err:" + err.Error()
+			}
+			for _, v := range listMeet {
+				mapchaptIdAndArticleId[v.Id] = v.LinkArticleId
+				mapchaptIdListSubject[v.Id] = v.ListSubject
+			}
+		}
 		//对应分类的所图片
 		detailCategoryUrl, err := models.GetConfigByCode("category_map_img_url")
 		if err != nil {
@@ -719,6 +738,10 @@ func (this *ReportController) List() {
 					}
 				}
 			}
+			if v.Resource == 3 {
+				v.LinkArticleId = mapchaptIdAndArticleId[v.Id]
+				v.ListSubject = mapchaptIdListSubject[v.Id]
+			}
 		}
 
 		resp := new(models.TimeLineReportListResp)

+ 1 - 1
models/cygx_morning_meeting_gather.go

@@ -76,7 +76,7 @@ type CygxMorningMeetingGatherDetailListResp struct {
 	Content              string                   `description:"内容"`   // 内容
 	PublishTime          string                   `description:"发布日期"`
 	ReportLink           string                   `description:"报告链接"`
-	LinkArticleId        string                   `description:"报告ID链接"`
+	LinkArticleId        int                      `description:"报告ID链接"`
 	Title                string                   `description:"标题"`
 	IndustrialSubjectIds string                   `description:"标的id"`
 	ListSubject          []*CygxIndustrialSubject `description:"标的列表"`

+ 5 - 6
models/industrial_subject.go

@@ -2,15 +2,14 @@ package models
 
 import (
 	"github.com/beego/beego/v2/client/orm"
-	"time"
 )
 
 type CygxIndustrialSubject struct {
-	IndustrialSubjectId    int       `orm:"column(industrial_subject_id);pk" description:"标的id"`
-	IndustrialManagementId int       `description:"产业id"`
-	SubjectName            string    `description:"标的名称"`
-	CreateTime             time.Time `description:"创建时间"`
-	Source                 int       `description:"来源,1正常添加,2:通过文章添加,3通过活动添加(默认为1)"`
+	IndustrialSubjectId    int    `orm:"column(industrial_subject_id);pk" description:"标的id"`
+	IndustrialManagementId int    `description:"产业id"`
+	SubjectName            string `description:"标的名称"`
+	CreateTime             string `description:"创建时间"`
+	Source                 int    `description:"来源,1正常添加,2:通过文章添加,3通过活动添加(默认为1)"`
 }
 
 // 获取标的列表

+ 16 - 14
models/report.go

@@ -1248,19 +1248,21 @@ WHERE
 }
 
 type TimeLineReportItem struct {
-	Id               int    `description:"文章或晨报点评id"`
-	Title            string `description:"标题"`
-	PublishTime      string `description:"发布时间"`
-	Content          string `description:"内容"`
-	VideoUrl         string `description:"视频链接"`
-	VoiceUrl         string `description:"音频链接"`
-	VoicePlaySeconds string `description:"音频时长"`
-	IsHaveVideo      bool   `description:"是否包含视频"`
-	ImgUrlPc         string `description:"pc图片"`
-	SubCategoryName  string `description:"二级分类"`
-	IsRed            bool   `description:"是否标红"`
-	Readnum          int    `description:"阅读数量"`
-	Resource         int    `description:"来源类型,1:文章、2:产品内测、3:晨报点评 4:活动回放视频 5:活动回放音频 "`
+	Id               int                      `description:"文章或晨报点评id"`
+	Title            string                   `description:"标题"`
+	PublishTime      string                   `description:"发布时间"`
+	Content          string                   `description:"内容"`
+	VideoUrl         string                   `description:"视频链接"`
+	VoiceUrl         string                   `description:"音频链接"`
+	VoicePlaySeconds string                   `description:"音频时长"`
+	IsHaveVideo      bool                     `description:"是否包含视频"`
+	ImgUrlPc         string                   `description:"pc图片"`
+	SubCategoryName  string                   `description:"二级分类"`
+	IsRed            bool                     `description:"是否标红"`
+	Readnum          int                      `description:"阅读数量"`
+	Resource         int                      `description:"来源类型,1:文章、2:产品内测、3:晨报点评 4:活动回放视频 5:活动回放音频 "`
+	LinkArticleId    int                      `description:"晨会精华报告ID链接"`
+	ListSubject      []*CygxIndustrialSubject `description:"标的列表"`
 }
 
 // 获取产业报告+晨会点评列表
@@ -1290,7 +1292,7 @@ FROM
 		AND man_g.industrial_management_id = ? GROUP BY id UNION ALL
 	SELECT
 		mmc.id,
-		'' AS title,
+		mmc.title,
 		mm.publish_time AS publish_time,
 		'' AS video_url,
 		'' AS voice_url,

+ 4 - 4
services/es_comprehensive.go

@@ -1069,11 +1069,11 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 
 	//处理晨会精华
 	if len(meetingreviewchaptIds) > 0 {
-		pars = make([]interface{}, 0)
-		condition = ` AND c.id IN (` + utils.GetOrmInReplace(len(meetingreviewchaptIds)) + `)`
-		pars = append(pars, meetingreviewchaptIds)
+		//pars = make([]interface{}, 0)
+		//condition = ` AND c.id IN (` + utils.GetOrmInReplace(len(meetingreviewchaptIds)) + `)`
+		//pars = append(pars, meetingreviewchaptIds)
 
-		listrMeet, e := models.GetCygxMorningMeetingReviewChapterList(condition, pars)
+		listrMeet, e := GetCygxMorningMeetingReviewChapterListByIds(meetingreviewchaptIds)
 		if e != nil {
 			err = errors.New("GetResourceDataList, Err: " + e.Error())
 			return

+ 34 - 23
services/morning_meeting.go

@@ -114,14 +114,14 @@ func AddCygxMorningMeetingReviewChapterHistory(user *models.WxUserItem, articleI
 }
 
 // 通过晨会精华子ID,获取出参列表详情
-func GetCygxMorningMeetingReviewChapterListByIds(meetingreviewchaptIds []int) (err error) {
+func GetCygxMorningMeetingReviewChapterListByIds(meetingreviewchaptIds []int) (items []*models.CygxMorningMeetingGatherDetailListResp, err error) {
 	lenArr := len(meetingreviewchaptIds)
 	if lenArr == 0 {
 		return
 	}
 	defer func() {
 		if err != nil {
-			go utils.SendAlarmMsg(fmt.Sprint("通过晨会精华子ID,获取出参列表详情失败 ,GetCygxMorningMeetingReviewChapterListByIds err"+err.Error(), "通过晨会精华子ID,获取出参列表详情:", "meetingreviewchaptIds:", meetingreviewchaptIds), 2)
+			go utils.SendAlarmMsg(fmt.Sprint("通过晨会精华子ID,获取出参列表详情失败 ,GetCygxMorningMeetingReviewChapterListByIds err"+err.Error(), "meetingreviewchaptIds:", meetingreviewchaptIds), 2)
 		}
 	}()
 	var condition string
@@ -131,42 +131,53 @@ func GetCygxMorningMeetingReviewChapterListByIds(meetingreviewchaptIds []int) (e
 	condition = ` AND c.id IN (` + utils.GetOrmInReplace(lenArr) + `)`
 	pars = append(pars, meetingreviewchaptIds)
 
+	//查询晨会
 	listrMeet, e := models.GetCygxMorningMeetingReviewChapterList(condition, pars)
 	if e != nil {
 		err = errors.New("GetCygxMorningMeetingReviewChapterList, Err: " + e.Error())
 		return
 	}
 
+	//获取晨会相关的标的
 	var subjectIds []string
-	var subjectIdsMap = make(map[int][]string) // 晨会ID与标的ID字符串的map映射
 	for _, v := range listrMeet {
 		if v.IndustrialSubjectIds != "" {
 			slice := strings.Split(v.IndustrialSubjectIds, ",")
-			subjectIdsMap[v.Id] = slice
-			for _, v := range slice {
-				subjectIds = append(subjectIds, v)
+			for _, vS := range slice {
+				subjectIds = append(subjectIds, vS)
 			}
 		}
 	}
 
-	//lensubjectIds := len(subjectIds)
+	lensubjectIds := len(subjectIds)
+	if lensubjectIds > 0 {
+		//获取标的信息
+		pars = make([]interface{}, 0)
+		condition = ` AND industrial_subject_id  IN (` + utils.GetOrmInReplace(lensubjectIds) + `)`
+		pars = append(pars, subjectIds)
+		listsubject, e := models.GetCygxIndustrialSubjectListCondition(condition, pars)
+		if e != nil {
+			err = errors.New("GetCygxIndustrialSubjectListCondition, Err: " + e.Error())
+			return
+		}
 
-	//if lensubjectIds > 0 {
-	//	pars = make([]interface{}, 0)
-	//	condition = ` AND industrial_subject_id  IN (` + utils.GetOrmInReplace(lensubjectIds) + `)`
-	//
-	//	listsubject, e := models.GetCygxIndustrialSubjectListCondition(condition, pars)
-	//	if e != nil {
-	//		err = errors.New("GetCygxIndustrialSubjectListCondition, Err: " + e.Error())
-	//		return
-	//	}
-	//
-	//	var meetSubjectItems = make(map[int][]*models.CygxIndustrialSubject)
-	//
-	//	for _,v:= range listsubject{
-	//		if utils.InArrayByStr()
-	//	}
-	//}
+		var meetSubjectItems = make(map[string]*models.CygxIndustrialSubject)
+		for _, v := range listsubject {
+			meetSubjectItems[strconv.Itoa(v.IndustrialSubjectId)] = v
+		}
 
+		//建立标的与晨会的映射关系
+		for _, v := range listrMeet {
+			if v.IndustrialSubjectIds != "" {
+				slice := strings.Split(v.IndustrialSubjectIds, ",")
+				for _, vS := range slice {
+					if meetSubjectItems[vS] != nil {
+						v.ListSubject = append(v.ListSubject, meetSubjectItems[vS])
+					}
+				}
+			}
+		}
+	}
+	items = listrMeet
 	return
 }

+ 6 - 5
services/resource_data.go

@@ -102,15 +102,16 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 
 	//处理晨会精华
 	if len(meetingreviewchaptIds) > 0 {
-		pars = make([]interface{}, 0)
-		condition = ` AND c.id IN (` + utils.GetOrmInReplace(len(meetingreviewchaptIds)) + `)`
-		pars = append(pars, meetingreviewchaptIds)
+		//pars = make([]interface{}, 0)
+		//condition = ` AND c.id IN (` + utils.GetOrmInReplace(len(meetingreviewchaptIds)) + `)`
+		//pars = append(pars, meetingreviewchaptIds)
 
-		listrMeet, e := models.GetCygxMorningMeetingReviewChapterList(condition, pars)
+		listrMeet, e := GetCygxMorningMeetingReviewChapterListByIds(meetingreviewchaptIds)
 		if e != nil {
-			err = errors.New("GetResourceDataList, Err: " + e.Error())
+			err = errors.New("GetCygxMorningMeetingReviewChapterListByIds, Err: " + e.Error())
 			return
 		}
+
 		for _, v := range listrMeet {
 			v.Content = AnnotationHtml(v.Content)
 			v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)