ziwen %!s(int64=2) %!d(string=hai) anos
pai
achega
67afb846de
Modificáronse 2 ficheiros con 71 adicións e 44 borrados
  1. 8 0
      models/data_manage/cygx_article.go
  2. 63 44
      services/cygx_research_summary.go

+ 8 - 0
models/data_manage/cygx_article.go

@@ -58,3 +58,11 @@ func GetReportArticleList(condition string, pars []interface{}) (list []*CygxArt
 	_, err = o.Raw(sql, pars).QueryRows(&list)
 	return
 }
+
+func GetYanXuanArticleIdList() (list *string, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT GROUP_CONCAT(DISTINCT article_type_id  SEPARATOR ',') FROM  cygx_article_type `
+
+	err = o.Raw(sql).QueryRow(&list)
+	return
+}

+ 63 - 44
services/cygx_research_summary.go

@@ -389,51 +389,70 @@ func CygxResearchSummary(cont context.Context) (err error) {
 
 	//买方研选
 	{
+		ids, e := data_manage.GetYanXuanArticleIdList()
+		if e != nil {
+			err = e
+			fmt.Println("GetReportArticleList err:", e)
+			return
+		}
+
 		var condition string
 		var pars []interface{}
 		condition += ` AND publish_date < ?  AND publish_date >= ? `
 		pars = append(pars, friday, lastfriday)
 		mfyxList := make([]*data_manage.CygxArticle, 0)
 
-		//纪要
-		{
-			newCondition := condition + ` AND article_type_id = 1 `
-			list, e := data_manage.GetReportArticleList(newCondition, pars)
-			if e != nil {
-				err = e
-				fmt.Println("GetReportArticleList err:", e)
-				return
-			}
-			for _, article := range list {
-				mfyxList = append(mfyxList, article)
-			}
-		}
-		//观点
-		{
-			newCondition := condition + ` AND article_type_id = 2 `
-			list, e := data_manage.GetReportArticleList(newCondition, pars)
-			if e != nil {
-				err = e
-				fmt.Println("GetReportArticleList err:", e)
-				return
-			}
-			for _, article := range list {
-				mfyxList = append(mfyxList, article)
-			}
+		//9.23新增研选所有类型的报告都要
+		newCondition := condition + ` AND article_type_id IN (`+ *ids +`) `
+		list, e := data_manage.GetReportArticleList(newCondition, pars)
+		if e != nil {
+			err = e
+			fmt.Println("GetReportArticleList err:", e)
+			return
 		}
-		//沙龙
-		{
-			newCondition := condition + ` AND article_type_id = 13 `
-			list, e := data_manage.GetReportArticleList(newCondition, pars)
-			if e != nil {
-				err = e
-				fmt.Println("GetReportArticleList err:", e)
-				return
-			}
-			for _, article := range list {
-				mfyxList = append(mfyxList, article)
-			}
+		for _, article := range list {
+			mfyxList = append(mfyxList, article)
 		}
+
+		////纪要
+		//{
+		//	newCondition := condition + ` AND article_type_id = 1 `
+		//	list, e := data_manage.GetReportArticleList(newCondition, pars)
+		//	if e != nil {
+		//		err = e
+		//		fmt.Println("GetReportArticleList err:", e)
+		//		return
+		//	}
+		//	for _, article := range list {
+		//		mfyxList = append(mfyxList, article)
+		//	}
+		//}
+		////观点
+		//{
+		//	newCondition := condition + ` AND article_type_id = 2 `
+		//	list, e := data_manage.GetReportArticleList(newCondition, pars)
+		//	if e != nil {
+		//		err = e
+		//		fmt.Println("GetReportArticleList err:", e)
+		//		return
+		//	}
+		//	for _, article := range list {
+		//		mfyxList = append(mfyxList, article)
+		//	}
+		//}
+		////沙龙
+		//{
+		//	newCondition := condition + ` AND article_type_id = 13 `
+		//	list, e := data_manage.GetReportArticleList(newCondition, pars)
+		//	if e != nil {
+		//		err = e
+		//		fmt.Println("GetReportArticleList err:", e)
+		//		return
+		//	}
+		//	for _, article := range list {
+		//		mfyxList = append(mfyxList, article)
+		//	}
+		//}
 		var articleIdStr string
 		for _, v := range mfyxList {
 			articleIdStr += strconv.Itoa(v.ArticleId) + ","
@@ -474,8 +493,8 @@ func CygxResearchSummary(cont context.Context) (err error) {
 			//	}
 			//	company = "    <span style=\"color: #ff1720\">" + company + "</span>"
 			//}
-			if mapArticleSubject[article.ArticleId] != ""{
-				company = "    <span style=\"color: #ff1720\">"+"#"+mapArticleSubject[article.ArticleId]+"</span>"
+			if mapArticleSubject[article.ArticleId] != "" {
+				company = "    <span style=\"color: #ff1720\">" + "#" + mapArticleSubject[article.ArticleId] + "</span>"
 			}
 			var plus int
 			coreIndex := strings.Index(body, "核心观点:")
@@ -501,7 +520,7 @@ func CygxResearchSummary(cont context.Context) (err error) {
 				plus = 12
 			}
 			endIndex := strings.Index(body, "<hr")
-			fmt.Println("ID:",article.ArticleId)
+			fmt.Println("ID:", article.ArticleId)
 			fmt.Println("coreIndex:", coreIndex, endIndex)
 			if coreIndex != -1 && endIndex != -1 {
 				body = body[coreIndex+plus : endIndex]
@@ -882,8 +901,8 @@ func CygxLastWeekSummary(cont context.Context) (err error) {
 			//	}
 			//	company = "    <span style=\"color: #ff1720\">" + company + "</span>"
 			//}
-			if mapArticleSubject[article.ArticleId] != ""{
-				company = "    <span style=\"color: #ff1720\">"+"#"+mapArticleSubject[article.ArticleId]+"</span>"
+			if mapArticleSubject[article.ArticleId] != "" {
+				company = "    <span style=\"color: #ff1720\">" + "#" + mapArticleSubject[article.ArticleId] + "</span>"
 			}
 			var plus int
 			coreIndex := strings.Index(body, "核心观点:")
@@ -910,7 +929,7 @@ func CygxLastWeekSummary(cont context.Context) (err error) {
 			}
 			endIndex := strings.Index(body, "<hr")
 			if coreIndex != -1 && endIndex != -1 {
-				body = body[coreIndex+plus:endIndex]
+				body = body[coreIndex+plus : endIndex]
 				logItem := data_manage.CygxMinutesSummaryLog{
 					ArticleId:         int(articleId),
 					Type:              "YANX",
@@ -934,4 +953,4 @@ func CygxLastWeekSummary(cont context.Context) (err error) {
 	}
 
 	return
-}
+}