Browse Source

no message

xingzai 2 years ago
parent
commit
b4757d1e44
3 changed files with 45 additions and 18 deletions
  1. 41 17
      controllers/report.go
  2. 1 1
      controllers/research.go
  3. 3 0
      models/industrial_management.go

+ 41 - 17
controllers/report.go

@@ -2736,6 +2736,17 @@ func (this *ReportController) SearchReportAndResource() {
 	pageSize, _ := this.GetInt("PageSize")
 	var condition string
 	var sqlGroup string
+	articleTypeIds, err := services.GetYanXuanArticleTypeIds()
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetYanXuanArticleTypeIds,Err:" + err.Error()
+		return
+	}
+	if articleTypeIds == "" {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "研选分类ID不能为空"
+		return
+	}
 	//匹配报告标题、
 	condition = `AND ( a.title LIKE '%` + keyWord + `%' OR  a.body LIKE '%` + keyWord + `%' OR  a.annotation LIKE '%` + keyWord + `%' OR  a.abstract LIKE '%` + keyWord + `%') AND a.publish_status = 1 `
 	sqlGroup = ` GROUP BY  a.article_id  ORDER BY a.publish_date DESC  `
@@ -2744,14 +2755,13 @@ func (this *ReportController) SearchReportAndResource() {
 	} else {
 		sqlGroup += ` LIMIT 100 `
 	}
-	ListYxReport, err := models.GetArticleCollectionList(` AND a.article_type_id IN (`+utils.YAN_XUAN_ARTICLE_TYPE_IDS+`) `+condition+sqlGroup, user.UserId)
+	ListYxReport, err := models.GetArticleCollectionList(` AND a.article_type_id IN (`+articleTypeIds+`) `+condition+sqlGroup, user.UserId)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取研选文章列表失败,Err:" + err.Error()
 		return
 	}
-
-	ListHzReport, err := models.GetReoprtSearchList(` AND a.article_type_id NOT IN (`+utils.YAN_XUAN_ARTICLE_TYPE_IDS+`) `+condition+sqlGroup, user.UserId)
+	ListHzReport, err := models.GetReoprtSearchList(` AND a.article_type_id NOT IN (`+articleTypeIds+`) `+condition+sqlGroup, user.UserId)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取弘则报告文章列表失败,Err:" + err.Error()
@@ -2778,7 +2788,7 @@ func (this *ReportController) SearchReportAndResource() {
 			sqlGroupIk += ` LIMIT 20 `
 		}
 		//研选的联想词列表
-		ListYxReportIk, err := models.GetArticleCollectionList(` AND a.article_type_id IN (`+utils.YAN_XUAN_ARTICLE_TYPE_IDS+`) `+conditionIk+sqlGroupIk, user.UserId)
+		ListYxReportIk, err := models.GetArticleCollectionList(` AND a.article_type_id IN (`+articleTypeIds+`) `+conditionIk+sqlGroupIk, user.UserId)
 		if err != nil && err.Error() != utils.ErrNoRow() {
 			br.Msg = "获取信息失败"
 			br.ErrMsg = "获取研选IK文章列表失败,Err:" + err.Error()
@@ -2790,7 +2800,7 @@ func (this *ReportController) SearchReportAndResource() {
 			}
 		}
 		//弘则的联想词列表
-		ListHzReportIk, err := models.GetReoprtSearchList(`  AND a.article_type_id NOT IN (`+utils.YAN_XUAN_ARTICLE_TYPE_IDS+`) `+conditionIk+sqlGroupIk, user.UserId)
+		ListHzReportIk, err := models.GetReoprtSearchList(`  AND a.article_type_id NOT IN (`+articleTypeIds+`) `+conditionIk+sqlGroupIk, user.UserId)
 		if err != nil && err.Error() != utils.ErrNoRow() {
 			br.Msg = "获取信息失败"
 			br.ErrMsg = "获取研选IK文章列表失败,Err:" + err.Error()
@@ -2883,7 +2893,7 @@ func (this *ReportController) SearchReportAndResource() {
 		}
 	}
 
-	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 + `%'  )  `
+	condition = `  AND a.publish_status = 1 AND a.article_type_id NOT IN (` + articleTypeIds + `)  AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%'  )  `
 
 	listHzResource, err := models.GetSearchResourceList(user.UserId, condition, 0, pageSize)
 	if err != nil {
@@ -2892,7 +2902,7 @@ func (this *ReportController) SearchReportAndResource() {
 		return
 	}
 
-	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 + `%'  )  `
+	condition = `  AND a.publish_status = 1 AND a.article_type_id IN (` + articleTypeIds + `)  AND (m.industry_name LIKE '%` + keyWord + `%' OR m.subject_names LIKE '%` + keyWord + `%'  )  `
 
 	listYxResource, err := models.GetSearchResourceList(user.UserId, condition, 0, pageSize)
 	if err != nil {
@@ -2910,18 +2920,25 @@ func (this *ReportController) SearchReportAndResource() {
 	industrialIdArr := make([]int, 0)
 	nowTime := time.Now().Local()
 	threeMonBefore := nowTime.AddDate(0, -3, 0)
-	mapHot := make(map[string]int)
+	mapHot := make(map[int]bool)
 
-	conditionOrder := ` ORDER BY sum_num DESC  `
-	listHot, err := models.GetThemeHeatList(user.UserId, condition, conditionOrder, 0, 3)
+	//if themeType == 2 {
+	mapHot, err = services.GetYanXuanIndustrialManagementIdHotMap(articleTypeIds)
 	if err != nil {
 		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		br.ErrMsg = "GetYanXuanIndustrialManagementIdNewMap,Err:" + err.Error()
 		return
 	}
-	for _, v := range listHot {
-		industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
-		mapHot[v.IndustryName] = v.IndustrialManagementId
+
+	//conditionOrder := ` ORDER BY sum_num DESC  `
+	//listHot, err := models.GetThemeHeatList(user.UserId, condition, conditionOrder, 0, 3)
+	//if err != nil {
+	//	br.Msg = "获取信息失败"
+	//	br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+	//	return
+	//}
+	for k, _ := range mapHot {
+		industrialIdArr = append(industrialIdArr, k)
 	}
 	orderSrt := "man.recommended_index DESC,update_time DESC"
 	for k, v := range listHzResource {
@@ -2985,6 +3002,8 @@ func (this *ReportController) SearchReportAndResource() {
 		//	maptimelineUPdateTime := make(map[int]string)
 		listtimelinePublishdate, err := models.GetTimeLineReportIndustrialPublishdateList(industrialIdArr)
 		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "GetTimeLineReportIndustrialPublishdateList,Err:" + err.Error()
 			return
 		}
 		for _, v := range listtimelinePublishdate {
@@ -3013,6 +3032,11 @@ func (this *ReportController) SearchReportAndResource() {
 		}
 		industrialIds = strings.TrimRight(industrialIds, ",")
 		articleList, err := models.GetReportIndustrialReadNumList(user.UserId, industrialIds, user.CreatedTime)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "GetReportIndustrialReadNumList,Err:" + err.Error()
+			return
+		}
 		mapHistroyindustrialId := make(map[int]int)
 		for _, v := range articleList {
 			mapHistroyindustrialId[v.IndustrialManagementId] = v.Readnum
@@ -3025,6 +3049,8 @@ func (this *ReportController) SearchReportAndResource() {
 		//var morningMeetingTime string
 		recrodList, err := models.GetTimeLineRecordAllCount(user.UserId, time.Now().Format(utils.FormatDate))
 		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "GetTimeLineRecordAllCount,Err:" + err.Error()
 			return
 		}
 		var industrialManagementIdstr string
@@ -3105,9 +3131,7 @@ func (this *ReportController) SearchReportAndResource() {
 				listYxResource[k].IsNew = true
 			}
 		}
-		if mapHot[v.IndustryName] > 0 {
-			listYxResource[k].IsHot = true
-		}
+		listYxResource[k].IsHot = mapHot[v.IndustrialManagementId]
 		listYxResource[k].Source = 2
 		if fllowMap[v.IndustrialManagementId] > 0 {
 			listYxResource[k].IsFollw = true

+ 1 - 1
controllers/research.go

@@ -499,7 +499,7 @@ func (this *ResearchController) DepartmentIdDetail() {
 		resp.IsFllow = true
 	}
 	var condition string
-	condition = `  AND a.department_id = ` + strconv.Itoa(departmentId) + ` ORDER BY a.publish_date DESC  `
+	condition = `  AND a.department_id = ` + strconv.Itoa(departmentId) + `  GROUP BY a.article_id  ORDER BY a.publish_date DESC  `
 	list, err := models.GetArticleCollectionList(condition, user.UserId)
 	if err != nil {
 		br.Msg = "获取信息失败"

+ 3 - 0
models/industrial_management.go

@@ -640,6 +640,9 @@ type IndustrialManagementArticle struct {
 
 // 时间线的更新时间
 func GetTimeLineReportIndustrialPublishdateList(industrialIdArr []int) (items []*IndustrialManagementArticle, err error) {
+	if len(industrialIdArr) == 0 {
+		return
+	}
 	o := orm.NewOrm()
 	sql := `SELECT	
 			mmc.id,