package services import ( "context" "fmt" "hongze/hongze_task/models/data_manage" "hongze/hongze_task/services/alarm_msg" "hongze/hongze_task/utils" "regexp" "strconv" "strings" "time" ) func CygxResearchSummary(cont context.Context) (err error) { defer func() { if err != nil { go alarm_msg.SendAlarmMsg("CygxResearchSummary-定时本周生成研究汇总失败, ErrMsg:\n"+err.Error(), 3) fmt.Println(err) } }() //content := "本周研究汇总" friday := utils.GetNowWeekFriday().Add(15 * time.Hour) lastfriday := utils.GetLastWeekFriday().Add(15 * time.Hour) lastMonth := int(lastfriday.Month()) month := int(friday.Month()) lastDay := lastfriday.Day() day := friday.Day() //friday, _ = time.Parse(utils.FormatDateTime, "2023-09-29 15:00:00") //lastfriday, _ = time.Parse(utils.FormatDateTime, "2023-09-22 15:00:00") itemCrs := new(data_manage.CygxResearchSummary) itemCrs.AdminId = 11 itemCrs.AdminName = "admin" itemCrs.Title = fmt.Sprintf("本周研究汇总(%d月%d日至%d月%d日)", lastMonth, lastDay, month, day) itemCrs.Department = "弘则产品组" itemCrs.Abstract = "" itemCrs.PublishStatus = 0 //itemCrs.Periods = strconv.Itoa(total + 1) itemCrs.CreateTime = time.Now() itemCrs.LastUpdatedTime = time.Now() itemCrs.PublishDate = time.Now() articleId, e := data_manage.AddCygxResearchSummaryOrm(itemCrs) if e != nil { err = e return } mappingList, err := data_manage.CygxReportMappingist() if err != nil { return } CategoryChartPermissionIdMap := make(map[int]int) for _, item := range mappingList { CategoryChartPermissionIdMap[item.CategoryId] = item.ChartPermissionId } yanxMappingList, err := data_manage.CygxArticleTypeMappingList() if err != nil { return } articleTypeChartPermissionIdMap := make(map[int]int) for _, item := range yanxMappingList { articleTypeChartPermissionIdMap[item.ArticleTypeId] = item.YanxPermissionId } //深度报告 { var condition string var pars []interface{} condition += ` AND publish_date < ? AND publish_date >= ? ` pars = append(pars, friday, lastfriday) sdbgList := make([]*data_manage.CygxArticle, 0) //医药 { newCondition := condition + ` AND category_id_two IN(65,102,1001)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { sdbgList = append(sdbgList, article) } } //消费 { newCondition := condition + ` AND category_id_two IN(67,1008,10075)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { sdbgList = append(sdbgList, article) } } //科技 { newCondition := condition + ` AND category_id_two IN(57,69,1009,64)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { sdbgList = append(sdbgList, article) } } //智造 { newCondition := condition + ` AND category_id_two IN(66,87)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { sdbgList = append(sdbgList, article) } } var logItems []*data_manage.CygxResearchSummaryLog for _, article := range sdbgList { head := "
\n 【" + article.Title + "】 " 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 = " " + company + "" } annotation := strings.ReplaceAll(article.Annotation, "", "") annotation = strings.ReplaceAll(annotation, "", "") annotation = strings.ReplaceAll(annotation, "", "
") annotation = strings.ReplaceAll(annotation, "
    ", "
    ") annotation = strings.ReplaceAll(annotation, "", "

    ") annotation = strings.ReplaceAll(annotation, "
  1. ", "

    ") re, _ := regexp.Compile("") annotation = re.ReplaceAllString(annotation, "") reLi, _ := regexp.Compile("") annotation = reLi.ReplaceAllString(annotation, "") logItem := data_manage.CygxResearchSummaryLog{ ArticleId: int(articleId), Type: "SDBG", ChartPermissionId: CategoryChartPermissionIdMap[article.CategoryIdTwo], CreateTime: time.Now(), Body: head + company + annotation, LinkArticleId: article.LinkArticleId, } if utils.RunMode == "debug" { logItem.ReportLink = "https://clpttest.hzinsights.com/material/info/" + strconv.Itoa(article.ArticleId) } else { logItem.ReportLink = "https://web.hzinsights.com/material/info/" + strconv.Itoa(article.ArticleId) } logItems = append(logItems, &logItem) } if len(logItems) > 0 { _, e := data_manage.AddCygxResearchSummaryLogOrm(logItems) if e != nil { err = e return } } } //产业调研纪要 { var condition string var pars []interface{} condition += ` AND publish_date < ? AND publish_date >= ? ` pars = append(pars, friday, lastfriday) cydyjyList := make([]*data_manage.CygxArticle, 0) //医药 { newCondition := condition + ` AND category_id_two IN(28,93,301,71)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { cydyjyList = append(cydyjyList, article) } } //消费 { newCondition := condition + ` AND category_id_two IN(32,58)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { cydyjyList = append(cydyjyList, article) } } //科技 { newCondition := condition + ` AND category_id_two IN(79)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { cydyjyList = append(cydyjyList, article) } } //智造 { newCondition := condition + ` AND category_id_two IN(84, 85)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { cydyjyList = append(cydyjyList, article) } } var logItems []*data_manage.CygxResearchSummaryLog for _, article := range cydyjyList { head := "

    \n 【" + article.Title + "】 " 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 = " " + company + "" } annotation := strings.ReplaceAll(article.Annotation, "", "") annotation = strings.ReplaceAll(annotation, "", "") annotation = strings.ReplaceAll(annotation, "
", "") annotation = strings.ReplaceAll(annotation, "
    ", "
    ") annotation = strings.ReplaceAll(annotation, "", "

    ") annotation = strings.ReplaceAll(annotation, "
  1. ", "

    ") re, _ := regexp.Compile("") annotation = re.ReplaceAllString(annotation, "") reLi, _ := regexp.Compile("") annotation = reLi.ReplaceAllString(annotation, "") logItem := data_manage.CygxResearchSummaryLog{ ArticleId: int(articleId), Type: "CYDYJY", ChartPermissionId: CategoryChartPermissionIdMap[article.CategoryIdTwo], CreateTime: time.Now(), Body: head + company + annotation, LinkArticleId: article.LinkArticleId, } if utils.RunMode == "debug" { logItem.ReportLink = "https://clpttest.hzinsights.com/material/info/" + strconv.Itoa(article.ArticleId) } else { logItem.ReportLink = "https://web.hzinsights.com/material/info/" + strconv.Itoa(article.ArticleId) } logItems = append(logItems, &logItem) } if len(logItems) > 0 { _, e := data_manage.AddCygxResearchSummaryLogOrm(logItems) if e != nil { err = e return } } } //上市公司调研纪要 { var condition string var pars []interface{} condition += ` AND publish_date < ? AND publish_date >= ? ` pars = append(pars, friday, lastfriday) ssgsdyjyList := make([]*data_manage.CygxArticle, 0) //医药 { newCondition := condition + ` AND category_id_two IN(74,96)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { ssgsdyjyList = append(ssgsdyjyList, article) } } //消费 { newCondition := condition + ` AND category_id_two IN(88)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { ssgsdyjyList = append(ssgsdyjyList, article) } } //科技 { newCondition := condition + ` AND category_id_two IN(45)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { ssgsdyjyList = append(ssgsdyjyList, article) } } //智造 { newCondition := condition + ` AND category_id_two IN(86)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { ssgsdyjyList = append(ssgsdyjyList, article) } } var logItems []*data_manage.CygxResearchSummaryLog for _, article := range ssgsdyjyList { head := "

    \n 【" + article.Title + "】 " 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 = " " + company + "" } annotation := strings.ReplaceAll(article.Annotation, "", "") annotation = strings.ReplaceAll(annotation, "", "") annotation = strings.ReplaceAll(annotation, "
", "") annotation = strings.ReplaceAll(annotation, "
    ", "
    ") annotation = strings.ReplaceAll(annotation, "", "

    ") annotation = strings.ReplaceAll(annotation, "
  1. ", "

    ") re, _ := regexp.Compile("") annotation = re.ReplaceAllString(annotation, "") reLi, _ := regexp.Compile("") annotation = reLi.ReplaceAllString(annotation, "") logItem := data_manage.CygxResearchSummaryLog{ ArticleId: int(articleId), Type: "SSGS", ChartPermissionId: CategoryChartPermissionIdMap[article.CategoryIdTwo], CreateTime: time.Now(), Body: head + company + annotation, LinkArticleId: article.LinkArticleId, } if utils.RunMode == "debug" { logItem.ReportLink = "https://clpttest.hzinsights.com/material/info/" + strconv.Itoa(article.ArticleId) } else { logItem.ReportLink = "https://web.hzinsights.com/material/info/" + strconv.Itoa(article.ArticleId) } logItems = append(logItems, &logItem) } if len(logItems) > 0 { _, e := data_manage.AddCygxResearchSummaryLogOrm(logItems) if e != nil { err = e return } } } //事件点评 之前叫事件点评,后来改成了 市场QA汇总 { var condition string var pars []interface{} condition += ` AND publish_date < ? AND publish_date >= ? ` pars = append(pars, friday, lastfriday) sjdpList := make([]*data_manage.CygxArticle, 0) //科技 { //10078:AI问答 newCondition := condition + ` AND category_id_two IN(10078) ` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { sjdpList = append(sjdpList, article) } } //医药 { //98:N问N答 newCondition := condition + ` AND category_id_two IN(98) ` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { sjdpList = append(sjdpList, article) } } //消费 { //10083:消费问答 newCondition := condition + ` AND category_id_two IN(10083) ` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { sjdpList = append(sjdpList, article) } } //智造 { //10084:问道 newCondition := condition + ` AND category_id_two IN(10084) ` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { sjdpList = append(sjdpList, article) } } var logItems []*data_manage.CygxResearchSummaryLog for _, article := range sjdpList { head := "

    \n 【" + article.Title + "】 " 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 = " " + company + "" } annotation := strings.ReplaceAll(article.Annotation, "", "") annotation = strings.ReplaceAll(annotation, "", "") annotation = strings.ReplaceAll(annotation, "
", "") annotation = strings.ReplaceAll(annotation, "
    ", "
    ") annotation = strings.ReplaceAll(annotation, "", "

    ") annotation = strings.ReplaceAll(annotation, "
  1. ", "

    ") re, _ := regexp.Compile("") annotation = re.ReplaceAllString(annotation, "") reLi, _ := regexp.Compile("") annotation = reLi.ReplaceAllString(annotation, "") logItem := data_manage.CygxResearchSummaryLog{ ArticleId: int(articleId), Type: "SJDP", ChartPermissionId: CategoryChartPermissionIdMap[article.CategoryIdTwo], CreateTime: time.Now(), Body: head + company + annotation, LinkArticleId: article.LinkArticleId, } if utils.RunMode == "debug" { logItem.ReportLink = "https://clpttest.hzinsights.com/material/info/" + strconv.Itoa(article.ArticleId) } else { logItem.ReportLink = "https://web.hzinsights.com/material/info/" + strconv.Itoa(article.ArticleId) } 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 := "

    \n 【" + article.Title + "】 " // body := strings.ReplaceAll(article.Body, "", "") // body = strings.ReplaceAll(body, "", "") // body = strings.ReplaceAll(body, "
", "") // body = strings.ReplaceAll(body, "
    ", "
    ") // body = strings.ReplaceAll(body, "", "

    ") // body = strings.ReplaceAll(body, "
  1. ", "

    ") // re, _ := regexp.Compile("") // body = re.ReplaceAllString(body, "") // reLi, _ := regexp.Compile("") // 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 = " " + company + "" // //} // if mapArticleSubject[article.ArticleId] != "" { // company = " " + "#" + mapArticleSubject[article.ArticleId] + "" // } // 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, "= ? ` pars = append(pars, tuesday, lastTuesday) cydyjyList := make([]*data_manage.CygxArticle, 0) //医药 { newCondition := condition + ` AND category_id_two IN(28,93,301,71)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { cydyjyList = append(cydyjyList, article) } } //消费 { newCondition := condition + ` AND category_id_two IN(32,58,62)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { cydyjyList = append(cydyjyList, article) } } //科技 { newCondition := condition + ` AND category_id_two IN(79)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { cydyjyList = append(cydyjyList, article) } } //智造 { newCondition := condition + ` AND category_id_two IN(84)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { cydyjyList = append(cydyjyList, article) } } var logItems []*data_manage.CygxMinutesSummaryLog for _, article := range cydyjyList { head := "

    \n 【" + article.Title + "】 " 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 = " " + company + "" } annotation := strings.ReplaceAll(article.Annotation, "", "") annotation = strings.ReplaceAll(annotation, "", "") annotation = strings.ReplaceAll(annotation, "
", "") annotation = strings.ReplaceAll(annotation, "
    ", "
    ") annotation = strings.ReplaceAll(annotation, "", "

    ") annotation = strings.ReplaceAll(annotation, "
  1. ", "

    ") re, _ := regexp.Compile("") annotation = re.ReplaceAllString(annotation, "") reLi, _ := regexp.Compile("") annotation = reLi.ReplaceAllString(annotation, "") logItem := data_manage.CygxMinutesSummaryLog{ ArticleId: int(articleId), Type: "CYDYJY", ChartPermissionId: CategoryChartPermissionIdMap[article.CategoryIdTwo], CreateTime: time.Now(), Body: head + company + annotation, LinkArticleId: article.LinkArticleId, } if utils.RunMode == "debug" { logItem.ReportLink = "https://clpttest.hzinsights.com/material/info/" + strconv.Itoa(article.ArticleId) } else { logItem.ReportLink = "https://web.hzinsights.com/material/info/" + strconv.Itoa(article.ArticleId) } 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) ssgsdyjyList := make([]*data_manage.CygxArticle, 0) //医药 { newCondition := condition + ` AND category_id_two IN(74,96)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { ssgsdyjyList = append(ssgsdyjyList, article) } } //消费 { newCondition := condition + ` AND category_id_two IN(88)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { ssgsdyjyList = append(ssgsdyjyList, article) } } //科技 { newCondition := condition + ` AND category_id_two IN(45)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { ssgsdyjyList = append(ssgsdyjyList, article) } } //智造 { newCondition := condition + ` AND category_id_two IN(86)` list, e := data_manage.GetReportArticleList(newCondition, pars) if e != nil { err = e fmt.Println("GetReportArticleList err:", e) return } for _, article := range list { ssgsdyjyList = append(ssgsdyjyList, article) } } var logItems []*data_manage.CygxMinutesSummaryLog for _, article := range ssgsdyjyList { head := "

    \n 【" + article.Title + "】 " 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 = " " + company + "" } annotation := strings.ReplaceAll(article.Annotation, "", "") annotation = strings.ReplaceAll(annotation, "", "") annotation = strings.ReplaceAll(annotation, "
", "") annotation = strings.ReplaceAll(annotation, "
    ", "
    ") annotation = strings.ReplaceAll(annotation, "", "

    ") annotation = strings.ReplaceAll(annotation, "
  1. ", "

    ") re, _ := regexp.Compile("") annotation = re.ReplaceAllString(annotation, "") reLi, _ := regexp.Compile("") annotation = reLi.ReplaceAllString(annotation, "") logItem := data_manage.CygxMinutesSummaryLog{ ArticleId: int(articleId), Type: "SSGS", ChartPermissionId: CategoryChartPermissionIdMap[article.CategoryIdTwo], CreateTime: time.Now(), Body: head + company + annotation, LinkArticleId: article.LinkArticleId, } if utils.RunMode == "debug" { logItem.ReportLink = "https://clpttest.hzinsights.com/material/info/" + strconv.Itoa(article.ArticleId) } else { logItem.ReportLink = "https://web.hzinsights.com/material/info/" + strconv.Itoa(article.ArticleId) } 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 := "

    \n 【" + article.Title + "】 " // body := strings.ReplaceAll(article.Body, "", "") // body = strings.ReplaceAll(body, "", "") // body = strings.ReplaceAll(body, "
", "") // body = strings.ReplaceAll(body, "
    ", "
    ") // body = strings.ReplaceAll(body, "", "

    ") // body = strings.ReplaceAll(body, "
  1. ", "

    ") // re, _ := regexp.Compile("") // body = re.ReplaceAllString(body, "") // reLi, _ := regexp.Compile("") // 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 = " " + company + "" // //} // if mapArticleSubject[article.ArticleId] != "" { // company = " " + "#" + mapArticleSubject[article.ArticleId] + "" // } // 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, "