Эх сурвалжийг харах

本周研究汇总和上周纪要汇总去掉买方研选内容

xingzai 2 жил өмнө
parent
commit
70135d3a5c
1 өөрчлөгдсөн 294 нэмэгдсэн , 294 устгасан
  1. 294 294
      services/cygx_research_summary.go

+ 294 - 294
services/cygx_research_summary.go

@@ -388,163 +388,163 @@ 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)
-
-		//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
-		}
-		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) + ","
-		}
-		mapArticleSubject := make(map[int]string)
-		articleIdStr = strings.TrimRight(articleIdStr, ",")
-		listSubject, e := data_manage.GetArticleSubjectList(articleIdStr)
-		if e != nil {
-			err = e
-			fmt.Println("GetArticleSubjectList err:", e)
-			return
-		}
-		for _, v := range listSubject {
-			mapArticleSubject[v.ArticleId] = v.SubjectName
-		}
-		var logItems []*data_manage.CygxResearchSummaryLog
-		for _, article := range mfyxList {
-			head := "<div class=\"title-content\">\n 【" + article.Title + "】    "
-			body := strings.ReplaceAll(article.Body, "<strong>", "")
-			body = strings.ReplaceAll(body, "</strong>", "")
-			body = strings.ReplaceAll(body, "</ol>", "</div>")
-			body = strings.ReplaceAll(body, "<ol>", "<div>")
-			body = strings.ReplaceAll(body, "</li>", "</p>")
-			body = strings.ReplaceAll(body, "<li>", "<p>")
-			re, _ := regexp.Compile("<strong.*?>")
-			body = re.ReplaceAllString(body, "")
-			reLi, _ := regexp.Compile("<li.*?>")
-			body = reLi.ReplaceAllString(body, "")
-			//研选的公司需要单独处理
-			//sliceSubjects := strings.Split(article.Stock, "/")
-			var company string
-			//if sliceSubjects[0] != "" {
-			//	for _, vSubject := range sliceSubjects {
-			//		sliceKuohao := strings.Split(vSubject, "(")           //过滤括号
-			//		sliceXiahuaxian := strings.Split(sliceKuohao[0], "-") //过滤下划线
-			//		subject := sliceXiahuaxian[0]
-			//		company += "#" + subject
-			//	}
-			//	company = "    <span style=\"color: #ff1720\">" + company + "</span>"
-			//}
-			if mapArticleSubject[article.ArticleId] != "" {
-				company = "    <span style=\"color: #ff1720\">" + "#" + mapArticleSubject[article.ArticleId] + "</span>"
-			}
-			var plus int
-			coreIndex := strings.Index(body, "核心观点:")
-			plus = 15
-			if coreIndex == -1 {
-				coreIndex = strings.Index(body, "核心观点:")
-				plus = 13
-			}
-			if coreIndex == -1 {
-				coreIndex = strings.Index(body, "核心观点")
-				plus = 12
-			}
-			if coreIndex == -1 {
-				coreIndex = strings.Index(body, "核心结论:")
-				plus = 15
-			}
-			if coreIndex == -1 {
-				coreIndex = strings.Index(body, "核心结论:")
-				plus = 13
-			}
-			if coreIndex == -1 {
-				coreIndex = strings.Index(body, "核心结论")
-				plus = 12
-			}
-			endIndex := strings.Index(body, "<hr")
-			fmt.Println("ID:", article.ArticleId)
-			fmt.Println("coreIndex:", coreIndex, endIndex)
-			if coreIndex != -1 && endIndex != -1 {
-				body = body[coreIndex+plus : endIndex]
-				logItem := data_manage.CygxResearchSummaryLog{
-					ArticleId:         int(articleId),
-					Type:              "YANX",
-					ChartPermissionId: articleTypeChartPermissionIdMap[article.ArticleTypeId],
-					CreateTime:        time.Now(),
-					Body:              head + company + body,
-					ReportLink:        "https://details.hzinsights.com/cygx/report?id=" + article.ArticleIdMd5,
-					LinkArticleId:     article.LinkArticleId,
-				}
-				logItems = append(logItems, &logItem)
-			}
-		}
-		if len(logItems) > 0 {
-			_, e := data_manage.AddCygxResearchSummaryLogOrm(logItems)
-			if e != nil {
-				err = e
-				return
-			}
-		}
-
-	}
+	//{
+	//	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)
+	//
+	//	//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
+	//	}
+	//	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) + ","
+	//	}
+	//	mapArticleSubject := make(map[int]string)
+	//	articleIdStr = strings.TrimRight(articleIdStr, ",")
+	//	listSubject, e := data_manage.GetArticleSubjectList(articleIdStr)
+	//	if e != nil {
+	//		err = e
+	//		fmt.Println("GetArticleSubjectList err:", e)
+	//		return
+	//	}
+	//	for _, v := range listSubject {
+	//		mapArticleSubject[v.ArticleId] = v.SubjectName
+	//	}
+	//	var logItems []*data_manage.CygxResearchSummaryLog
+	//	for _, article := range mfyxList {
+	//		head := "<div class=\"title-content\">\n 【" + article.Title + "】    "
+	//		body := strings.ReplaceAll(article.Body, "<strong>", "")
+	//		body = strings.ReplaceAll(body, "</strong>", "")
+	//		body = strings.ReplaceAll(body, "</ol>", "</div>")
+	//		body = strings.ReplaceAll(body, "<ol>", "<div>")
+	//		body = strings.ReplaceAll(body, "</li>", "</p>")
+	//		body = strings.ReplaceAll(body, "<li>", "<p>")
+	//		re, _ := regexp.Compile("<strong.*?>")
+	//		body = re.ReplaceAllString(body, "")
+	//		reLi, _ := regexp.Compile("<li.*?>")
+	//		body = reLi.ReplaceAllString(body, "")
+	//		//研选的公司需要单独处理
+	//		//sliceSubjects := strings.Split(article.Stock, "/")
+	//		var company string
+	//		//if sliceSubjects[0] != "" {
+	//		//	for _, vSubject := range sliceSubjects {
+	//		//		sliceKuohao := strings.Split(vSubject, "(")           //过滤括号
+	//		//		sliceXiahuaxian := strings.Split(sliceKuohao[0], "-") //过滤下划线
+	//		//		subject := sliceXiahuaxian[0]
+	//		//		company += "#" + subject
+	//		//	}
+	//		//	company = "    <span style=\"color: #ff1720\">" + company + "</span>"
+	//		//}
+	//		if mapArticleSubject[article.ArticleId] != "" {
+	//			company = "    <span style=\"color: #ff1720\">" + "#" + mapArticleSubject[article.ArticleId] + "</span>"
+	//		}
+	//		var plus int
+	//		coreIndex := strings.Index(body, "核心观点:")
+	//		plus = 15
+	//		if coreIndex == -1 {
+	//			coreIndex = strings.Index(body, "核心观点:")
+	//			plus = 13
+	//		}
+	//		if coreIndex == -1 {
+	//			coreIndex = strings.Index(body, "核心观点")
+	//			plus = 12
+	//		}
+	//		if coreIndex == -1 {
+	//			coreIndex = strings.Index(body, "核心结论:")
+	//			plus = 15
+	//		}
+	//		if coreIndex == -1 {
+	//			coreIndex = strings.Index(body, "核心结论:")
+	//			plus = 13
+	//		}
+	//		if coreIndex == -1 {
+	//			coreIndex = strings.Index(body, "核心结论")
+	//			plus = 12
+	//		}
+	//		endIndex := strings.Index(body, "<hr")
+	//		fmt.Println("ID:", article.ArticleId)
+	//		fmt.Println("coreIndex:", coreIndex, endIndex)
+	//		if coreIndex != -1 && endIndex != -1 {
+	//			body = body[coreIndex+plus : endIndex]
+	//			logItem := data_manage.CygxResearchSummaryLog{
+	//				ArticleId:         int(articleId),
+	//				Type:              "YANX",
+	//				ChartPermissionId: articleTypeChartPermissionIdMap[article.ArticleTypeId],
+	//				CreateTime:        time.Now(),
+	//				Body:              head + company + body,
+	//				ReportLink:        "https://details.hzinsights.com/cygx/report?id=" + article.ArticleIdMd5,
+	//				LinkArticleId:     article.LinkArticleId,
+	//			}
+	//			logItems = append(logItems, &logItem)
+	//		}
+	//	}
+	//	if len(logItems) > 0 {
+	//		_, e := data_manage.AddCygxResearchSummaryLogOrm(logItems)
+	//		if e != nil {
+	//			err = e
+	//			return
+	//		}
+	//	}
+	//
+	//}
 
 	return
 }
@@ -814,143 +814,143 @@ func CygxLastWeekSummary(cont context.Context) (err error) {
 	}
 
 	//买方研选
-	{
-		var condition string
-		var pars []interface{}
-		condition += ` AND publish_date < ?  AND publish_date >= ? `
-		pars = append(pars, tuesday, lastTuesday)
-		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)
-		//	}
-		//}
-		////沙龙
-		//{
-		//	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)
-		//	}
-		//}
-		fmt.Println("mfyxList:", len(mfyxList))
-		var articleIdStr string
-		for _, v := range mfyxList {
-			articleIdStr += strconv.Itoa(v.ArticleId) + ","
-		}
-		mapArticleSubject := make(map[int]string)
-		articleIdStr = strings.TrimRight(articleIdStr, ",")
-		listSubject, e := data_manage.GetArticleSubjectList(articleIdStr)
-		if e != nil {
-			err = e
-			fmt.Println("GetArticleSubjectList err:", e)
-			return
-		}
-		for _, v := range listSubject {
-			mapArticleSubject[v.ArticleId] = v.SubjectName
-		}
-		var logItems []*data_manage.CygxMinutesSummaryLog
-		for _, article := range mfyxList {
-			head := "<div class=\"title-content\">\n 【" + article.Title + "】    "
-			body := strings.ReplaceAll(article.Body, "<strong>", "")
-			body = strings.ReplaceAll(body, "</strong>", "")
-			body = strings.ReplaceAll(body, "</ol>", "</div>")
-			body = strings.ReplaceAll(body, "<ol>", "<div>")
-			body = strings.ReplaceAll(body, "</li>", "</p>")
-			body = strings.ReplaceAll(body, "<li>", "<p>")
-			re, _ := regexp.Compile("<strong.*?>")
-			body = re.ReplaceAllString(body, "")
-			reLi, _ := regexp.Compile("<li.*?>")
-			body = reLi.ReplaceAllString(body, "")
-			//研选的公司需要单独处理
-			//sliceSubjects := strings.Split(article.Stock, "/")
-			var company string
-			//if sliceSubjects[0] != "" {
-			//	for _, vSubject := range sliceSubjects {
-			//		sliceKuohao := strings.Split(vSubject, "(")           //过滤括号
-			//		sliceXiahuaxian := strings.Split(sliceKuohao[0], "-") //过滤下划线
-			//		subject := sliceXiahuaxian[0]
-			//		company += "#" + subject
-			//	}
-			//	company = "    <span style=\"color: #ff1720\">" + company + "</span>"
-			//}
-			if mapArticleSubject[article.ArticleId] != "" {
-				company = "    <span style=\"color: #ff1720\">" + "#" + mapArticleSubject[article.ArticleId] + "</span>"
-			}
-			var plus int
-			coreIndex := strings.Index(body, "核心观点:")
-			plus = 15
-			if coreIndex == -1 {
-				coreIndex = strings.Index(body, "核心观点:")
-				plus = 13
-			}
-			if coreIndex == -1 {
-				coreIndex = strings.Index(body, "核心观点")
-				plus = 12
-			}
-			if coreIndex == -1 {
-				coreIndex = strings.Index(body, "核心结论:")
-				plus = 15
-			}
-			if coreIndex == -1 {
-				coreIndex = strings.Index(body, "核心结论:")
-				plus = 13
-			}
-			if coreIndex == -1 {
-				coreIndex = strings.Index(body, "核心结论")
-				plus = 12
-			}
-			endIndex := strings.Index(body, "<hr")
-			if coreIndex != -1 && endIndex != -1 {
-				body = body[coreIndex+plus : endIndex]
-				logItem := data_manage.CygxMinutesSummaryLog{
-					ArticleId:         int(articleId),
-					Type:              "YANX",
-					ChartPermissionId: articleTypeChartPermissionIdMap[article.ArticleTypeId],
-					CreateTime:        time.Now(),
-					Body:              head + company + body,
-					ReportLink:        "https://details.hzinsights.com/cygx/report?id=" + article.ArticleIdMd5,
-					LinkArticleId:     article.LinkArticleId,
-				}
-				logItems = append(logItems, &logItem)
-			}
-		}
-		if len(logItems) > 0 {
-			_, e := data_manage.AddCygxMinutesSummaryLogOrm(logItems)
-			if e != nil {
-				err = e
-				return
-			}
-		}
-
-	}
+	//{
+	//	var condition string
+	//	var pars []interface{}
+	//	condition += ` AND publish_date < ?  AND publish_date >= ? `
+	//	pars = append(pars, tuesday, lastTuesday)
+	//	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)
+	//	//	}
+	//	//}
+	//	////沙龙
+	//	//{
+	//	//	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)
+	//	//	}
+	//	//}
+	//	fmt.Println("mfyxList:", len(mfyxList))
+	//	var articleIdStr string
+	//	for _, v := range mfyxList {
+	//		articleIdStr += strconv.Itoa(v.ArticleId) + ","
+	//	}
+	//	mapArticleSubject := make(map[int]string)
+	//	articleIdStr = strings.TrimRight(articleIdStr, ",")
+	//	listSubject, e := data_manage.GetArticleSubjectList(articleIdStr)
+	//	if e != nil {
+	//		err = e
+	//		fmt.Println("GetArticleSubjectList err:", e)
+	//		return
+	//	}
+	//	for _, v := range listSubject {
+	//		mapArticleSubject[v.ArticleId] = v.SubjectName
+	//	}
+	//	var logItems []*data_manage.CygxMinutesSummaryLog
+	//	for _, article := range mfyxList {
+	//		head := "<div class=\"title-content\">\n 【" + article.Title + "】    "
+	//		body := strings.ReplaceAll(article.Body, "<strong>", "")
+	//		body = strings.ReplaceAll(body, "</strong>", "")
+	//		body = strings.ReplaceAll(body, "</ol>", "</div>")
+	//		body = strings.ReplaceAll(body, "<ol>", "<div>")
+	//		body = strings.ReplaceAll(body, "</li>", "</p>")
+	//		body = strings.ReplaceAll(body, "<li>", "<p>")
+	//		re, _ := regexp.Compile("<strong.*?>")
+	//		body = re.ReplaceAllString(body, "")
+	//		reLi, _ := regexp.Compile("<li.*?>")
+	//		body = reLi.ReplaceAllString(body, "")
+	//		//研选的公司需要单独处理
+	//		//sliceSubjects := strings.Split(article.Stock, "/")
+	//		var company string
+	//		//if sliceSubjects[0] != "" {
+	//		//	for _, vSubject := range sliceSubjects {
+	//		//		sliceKuohao := strings.Split(vSubject, "(")           //过滤括号
+	//		//		sliceXiahuaxian := strings.Split(sliceKuohao[0], "-") //过滤下划线
+	//		//		subject := sliceXiahuaxian[0]
+	//		//		company += "#" + subject
+	//		//	}
+	//		//	company = "    <span style=\"color: #ff1720\">" + company + "</span>"
+	//		//}
+	//		if mapArticleSubject[article.ArticleId] != "" {
+	//			company = "    <span style=\"color: #ff1720\">" + "#" + mapArticleSubject[article.ArticleId] + "</span>"
+	//		}
+	//		var plus int
+	//		coreIndex := strings.Index(body, "核心观点:")
+	//		plus = 15
+	//		if coreIndex == -1 {
+	//			coreIndex = strings.Index(body, "核心观点:")
+	//			plus = 13
+	//		}
+	//		if coreIndex == -1 {
+	//			coreIndex = strings.Index(body, "核心观点")
+	//			plus = 12
+	//		}
+	//		if coreIndex == -1 {
+	//			coreIndex = strings.Index(body, "核心结论:")
+	//			plus = 15
+	//		}
+	//		if coreIndex == -1 {
+	//			coreIndex = strings.Index(body, "核心结论:")
+	//			plus = 13
+	//		}
+	//		if coreIndex == -1 {
+	//			coreIndex = strings.Index(body, "核心结论")
+	//			plus = 12
+	//		}
+	//		endIndex := strings.Index(body, "<hr")
+	//		if coreIndex != -1 && endIndex != -1 {
+	//			body = body[coreIndex+plus : endIndex]
+	//			logItem := data_manage.CygxMinutesSummaryLog{
+	//				ArticleId:         int(articleId),
+	//				Type:              "YANX",
+	//				ChartPermissionId: articleTypeChartPermissionIdMap[article.ArticleTypeId],
+	//				CreateTime:        time.Now(),
+	//				Body:              head + company + body,
+	//				ReportLink:        "https://details.hzinsights.com/cygx/report?id=" + article.ArticleIdMd5,
+	//				LinkArticleId:     article.LinkArticleId,
+	//			}
+	//			logItems = append(logItems, &logItem)
+	//		}
+	//	}
+	//	if len(logItems) > 0 {
+	//		_, e := data_manage.AddCygxMinutesSummaryLogOrm(logItems)
+	//		if e != nil {
+	//			err = e
+	//			return
+	//		}
+	//	}
+	//
+	//}
 
 	return
 }