|
@@ -3,6 +3,7 @@ package services
|
|
|
//FICC研报
|
|
|
import (
|
|
|
"context"
|
|
|
+ "encoding/json"
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
"hongze/hongze_cygx/models"
|
|
@@ -164,6 +165,10 @@ func GetReportDetail(userinfo *models.WxUserItem, reportId int) (reportDetail fi
|
|
|
reportItem.ArticleId = detailArticle.ArticleId
|
|
|
reportItem.Disclaimer = GetConfigCodeDisclaimer()
|
|
|
|
|
|
+ if reportInfo.ClassifyNameFirst == "晨会纪要" && reportInfo.ClassifyNameSecond == "晨会纪要" {
|
|
|
+ reportItem.Title = "FICC/周期品晨会纪要"
|
|
|
+ }
|
|
|
+
|
|
|
//版头版尾样式
|
|
|
{
|
|
|
if reportInfo.HeadResourceId > 0 {
|
|
@@ -433,6 +438,7 @@ func GetChapterListByReportChapterIdList(classifyNameFirst string, reportId int,
|
|
|
|
|
|
// 获取FICC研报到查研观向数据库中
|
|
|
func GetFiccRreportToCygxArticle(cont context.Context) (err error) {
|
|
|
+ //func GetFiccRreportToCygxArticle() (err error) {
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
|
fmt.Println(err)
|
|
@@ -453,6 +459,21 @@ func GetFiccRreportToCygxArticle(cont context.Context) (err error) {
|
|
|
//if len(reportList) == 0 {
|
|
|
// return
|
|
|
//}
|
|
|
+ //获取研报的匹配关系
|
|
|
+ conf, e := models.GetConfigByCode(utils.GET_FICC_REPORT_SET)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetConfigByCode, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if conf.ConfigValue == "" {
|
|
|
+ err = errors.New("同步FICC研报的规则配置值有误")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ listFiccSet := new(ficc_report.GetReporteSetListResp)
|
|
|
+ if e = json.Unmarshal([]byte(conf.ConfigValue), &listFiccSet); e != nil {
|
|
|
+ err = errors.New("同步FICC研报的规则配置值解析失败 Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
if len(reportList) > 0 {
|
|
|
var reportIds []int
|
|
@@ -476,6 +497,9 @@ func GetFiccRreportToCygxArticle(cont context.Context) (err error) {
|
|
|
item.ReportId = v.Id
|
|
|
item.PublishDate = v.PublishTime.Format(utils.FormatDateTime)
|
|
|
item.Title = v.Title
|
|
|
+ if v.ClassifyNameFirst == "晨会纪要" && v.ClassifyNameSecond == "晨会纪要" {
|
|
|
+ item.Title = "FICC/周期品晨会纪要"
|
|
|
+ }
|
|
|
item.Body = v.Content
|
|
|
item.Abstract = v.Abstract
|
|
|
item.CreateDate = time.Now().Format(utils.FormatDate)
|
|
@@ -483,12 +507,19 @@ func GetFiccRreportToCygxArticle(cont context.Context) (err error) {
|
|
|
item.IsReport = 1
|
|
|
item.IsClass = 1
|
|
|
|
|
|
- if (v.ClassifyNameFirst == "宏观报告" && v.ClassifyNameSecond == "大类资产周报") || (v.ClassifyNameFirst == "晨会纪要" && v.ClassifyNameSecond == "晨会纪要") || (v.ClassifyNameFirst == "调研纪要" && v.ClassifyNameSecond == "黑色调研") {
|
|
|
- item.SubCategoryName = v.ClassifyNameSecond
|
|
|
- item.MatchTypeName = v.ClassifyNameSecond
|
|
|
- } else {
|
|
|
+ var haveSet bool
|
|
|
+ for _, vSet := range listFiccSet.List {
|
|
|
+ if v.ClassifyNameFirst == vSet.ClassifyNameFirst && v.ClassifyNameSecond == vSet.ClassifyNameSecond {
|
|
|
+ haveSet = true
|
|
|
+ item.SubCategoryName = v.ClassifyNameSecond
|
|
|
+ item.MatchTypeName = v.ClassifyNameSecond
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if !haveSet {
|
|
|
continue
|
|
|
}
|
|
|
+
|
|
|
detailCategory, detailCategoryErr := models.GetCygxReportMappingCelueDetailByZhoQiCategoryName(item.SubCategoryName)
|
|
|
if detailCategoryErr != nil {
|
|
|
continue
|
|
@@ -531,7 +562,7 @@ func GetFiccRreportToCygxArticle(cont context.Context) (err error) {
|
|
|
return err
|
|
|
}
|
|
|
}
|
|
|
- UpdateFICCReportResourceData(v.Id)
|
|
|
+ UpdateFICCReportResourceData(v.Id, listFiccSet)
|
|
|
|
|
|
AddCygxReportMappingCategoryGroupByArticleId(articleIdMax)
|
|
|
}
|
|
@@ -545,7 +576,9 @@ func GetFiccRreportToCygxArticle(cont context.Context) (err error) {
|
|
|
}
|
|
|
var cygxFiccReportIds []int
|
|
|
for _, v := range listCygxFiccReport {
|
|
|
- cygxFiccReportIds = append(cygxFiccReportIds, v.ReportId)
|
|
|
+ if v.PublishStatus == 1 {
|
|
|
+ cygxFiccReportIds = append(cygxFiccReportIds, v.ReportId)
|
|
|
+ }
|
|
|
}
|
|
|
lenArr := len(cygxFiccReportIds)
|
|
|
if lenArr == 0 {
|