Просмотр исходного кода

Merge branch 'cygx_12.4.1' of http://8.136.199.33:3000/hongze/hongze_cygx

xingzai 1 год назад
Родитель
Сommit
26e3a2479c

+ 10 - 2
controllers/home.go

@@ -582,6 +582,7 @@ func (this *HomeController) ListHomeArtAndChart() {
 // @Title 首页列表接口
 // @Description 首页列表接口
 // @Param   TagIds   query   string  true       "标签选择"
+// @Param   ChartPermissionId   query   int	  false     "行业id"
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
 // @Success 200 {object} models.HomeArtAndChartListResp
@@ -602,6 +603,7 @@ func (this *HomeController) NewList() {
 	pageSize, _ := this.GetInt("PageSize")
 	currentIndex, _ := this.GetInt("CurrentIndex")
 	tagIds := this.GetString("TagIds")
+	chartPermissionId, _ := this.GetInt("ChartPermissionId")
 
 	var startSize int
 	if pageSize <= 0 {
@@ -837,9 +839,15 @@ func (this *HomeController) NewList() {
 			return
 		}
 		conditionInit += conditionTagIdsInit
-	} else {
+	}
+	//行业筛选
+	if chartPermissionId > 0 {
+		conditionInit += " AND chart_permission_id  =  " + strconv.Itoa(chartPermissionId)
+	}
+
+	if tagIds == "" && chartPermissionId == 0 {
 		//查询近一个月的数据
-		conditionInit = " AND publish_date  >   '" + time.Now().AddDate(0, 0, -30).Format(utils.FormatDateTime) + "'"
+		conditionInit += " AND publish_date  >   '" + time.Now().AddDate(0, 0, -30).Format(utils.FormatDateTime) + "'"
 	}
 
 	//conditionInit += `  AND source IN ('newchart')`

+ 14 - 5
controllers/tag.go

@@ -49,19 +49,15 @@ func (this *TagController) TagCustomizeList() {
 	list, err := models.GetCygxTagList(condition)
 	for _, v := range list {
 		if v.ArticleTypes != "" {
-			v.Atag = true
 			v.CheckList = append(v.CheckList, "A")
 		}
 		if v.ActivityTypes != "" {
-			v.Btag = true
 			v.CheckList = append(v.CheckList, "B")
 		}
 		if v.Industries != "" {
-			v.Ctag = true
 			v.CheckList = append(v.CheckList, "C")
 		}
 		if v.SubjectNames != "" {
-			v.Dtag = true
 			v.CheckList = append(v.CheckList, "D")
 		}
 	}
@@ -71,10 +67,23 @@ func (this *TagController) TagCustomizeList() {
 		return
 	}
 
+	//var condition string
+	condition = ` AND permission_name IN ('医药','消费','科技','智造','策略') `
+	listPermission, err := models.GetChartPermissionReportAll(condition)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+
+	resp := new(models.CygxTagListResp)
+
+	resp.List = list
+	resp.ListPermission = listPermission
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
-	br.Data = list
+	br.Data = resp
 }
 
 // @Title 记录点击信息

+ 25 - 0
models/article_category_mapping.go

@@ -2,6 +2,7 @@ package models
 
 import (
 	"github.com/beego/beego/v2/client/orm"
+	"time"
 	//"time"
 )
 
@@ -79,3 +80,27 @@ func GetCygxReportMappingCygxByCategoryId(categoryId int) (item *CygxReportMappi
 	err = o.Raw(sql, categoryId).QueryRow(&item)
 	return
 }
+
+type CygxReportMappingCelue struct {
+	Id                  int       `orm:"column(id);pk" description:"id"`
+	ChartPermissionId   int       `description:"行业ID"`
+	CategoryId          int       `description:"分类ID"`
+	ChartPermissionName string    `description:"行业名称"`
+	SubCategoryName     string    `description:"主题"`
+	ReportType          int       `description:"报告类型,2产业报告,1行业报告"`
+	Sort                int       `description:"排序"`
+	IsCustom            int       `description:"是否属于自定义的匹配类型 ,1是,0否"`
+	IsSummary           int       `description:"是否是纪要库,1是,0否"`
+	IsReport            int       `description:"是否是报告,1是,0否"`
+	PermissionType      int       `description:"1主观,2客观"`
+	CreateTime          time.Time `description:"创建时间"`
+	ModifyTime          time.Time `description:"更新时间"`
+}
+
+// 通过 categoryId 获取详情
+func GetCygxReportMappingCelueMaxDetailByCategoryId(categoryId int) (item *CygxReportMappingCelue, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT  * FROM cygx_report_mapping_celue  WHERE  category_id = ?  LIMIT 1 `
+	err = o.Raw(sql, categoryId).QueryRow(&item)
+	return
+}

+ 22 - 24
models/cygx_tag.go

@@ -20,13 +20,6 @@ type CygxTag struct {
 	Status        int       `orm:"column(status);NOT NULL"`         // 状态:0-禁用 1-启用
 }
 
-// 添加标签
-func AddCygxTag(item *CygxTag) (id int64, err error) {
-	o := orm.NewOrm()
-	id, err = o.Insert(item)
-	return
-}
-
 func (m *CygxTag) Update(cols []string) (err error) {
 	o := orm.NewOrm()
 	_, err = o.Update(m, cols...)
@@ -34,23 +27,28 @@ func (m *CygxTag) Update(cols []string) (err error) {
 }
 
 type CygxTagList struct {
-	TagId         int64    `orm:"column(tag_id);pk"`
-	TagName       string   `orm:"column(tag_name);NOT NULL"`       // 标签名
-	ArticleTypes  string   `orm:"column(article_types);NOT NULL"`  // 报告系列
-	ActivityTypes string   `orm:"column(activity_types);NOT NULL"` // 活动类型
-	Industries    string   `orm:"column(industries);NOT NULL"`     // 产业
-	SubjectNames  string   `orm:"column(subject_names);NOT NULL"`  // 标的
-	Sort          int      `orm:"column(sort);"`                   // 优先级
-	ModifyTime    string   `orm:"column(modify_time)"`             // 修改时间
-	CreateTime    string   `orm:"column(create_time)"`             // 创建时间
-	OnlineTime    string   `orm:"column(online_time)"`             // 上线时间
-	OfflineTime   string   `orm:"column(offline_time)"`            // 下线时间
-	Status        int      `orm:"column(status);NOT NULL"`         // 状态:0-禁用 1-启用
-	Atag          bool     // A标签是否有值
-	Btag          bool     // A标签是否有值
-	Ctag          bool     // A标签是否有值
-	Dtag          bool     // A标签是否有值
-	CheckList     []string // ABCD勾选了哪几列
+	TagId         int64  `orm:"column(tag_id);pk"`
+	TagName       string `orm:"column(tag_name);NOT NULL"`       // 标签名
+	ArticleTypes  string `orm:"column(article_types);NOT NULL"`  // 报告系列
+	ActivityTypes string `orm:"column(activity_types);NOT NULL"` // 活动类型
+	Industries    string `orm:"column(industries);NOT NULL"`     // 产业
+	SubjectNames  string `orm:"column(subject_names);NOT NULL"`  // 标的
+	Sort          int    `orm:"column(sort);"`                   // 优先级
+	ModifyTime    string `orm:"column(modify_time)"`             // 修改时间
+	CreateTime    string `orm:"column(create_time)"`             // 创建时间
+	OnlineTime    string `orm:"column(online_time)"`             // 上线时间
+	OfflineTime   string `orm:"column(offline_time)"`            // 下线时间
+	Status        int    `orm:"column(status);NOT NULL"`         // 状态:0-禁用 1-启用
+	//Atag          bool     // A标签是否有值
+	//Btag          bool     // A标签是否有值
+	//Ctag          bool     // A标签是否有值
+	//Dtag          bool     // A标签是否有值
+	CheckList []string // ABCD勾选了哪几列
+}
+
+type CygxTagListResp struct {
+	List           []*CygxTagList
+	ListPermission []*ChartPermission
 }
 
 // 列表

+ 10 - 9
models/resource_data.go

@@ -7,15 +7,16 @@ import (
 )
 
 type CygxResourceData struct {
-	Id          int       `orm:"column(id);pk"`
-	SourceId    int       `description:"资源ID"`
-	Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
-	Title       string    `description:"标题"`
-	Annotation  string    `description:"核心观点"`
-	CreateTime  time.Time `description:"创建时间"`
-	PublishDate string    `description:"发布时间"`
-	Abstract    string    `description:"摘要"`
-	SearchTag   string    `description:"搜索标签"`
+	Id                int       `orm:"column(id);pk"`
+	ChartPermissionId int       `description:"行业ID"`
+	SourceId          int       `description:"资源ID"`
+	Source            string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
+	Title             string    `description:"标题"`
+	Annotation        string    `description:"核心观点"`
+	CreateTime        time.Time `description:"创建时间"`
+	PublishDate       string    `description:"发布时间"`
+	Abstract          string    `description:"摘要"`
+	SearchTag         string    `description:"搜索标签"`
 }
 
 type CygxResourceDataResp struct {

+ 5 - 4
services/article.go

@@ -709,10 +709,11 @@ func GetArticleListByApi(cont context.Context) (err error) {
 //	//		HandleArticleListByApi(v.ArticleId)
 //	//	}
 //
-//	for i := 8648; i < 9004; i++ {
-//		HandleArticleListByApi(i)
-//	}
-//
+//	//for i := 8648; i < 9004; i++ {
+//	//	HandleArticleListByApi(9552)
+//	//}
+//	HandleArticleListByApi(9551)
+//	//UpdateArticleResourceData(9551)
 //}
 
 // 处理同步过来的文章

+ 5 - 0
services/resource_data.go

@@ -583,6 +583,11 @@ func UpdateArticleResourceData(sourceId int) {
 			item.SearchTag = detail.ArticleTypeName // 研选类型名称
 		} else {
 			item.SearchTag = detail.MatchTypeName
+			//获取文章分类详情
+			detailCategory, _ := models.GetCygxReportMappingCelueMaxDetailByCategoryId(detail.CategoryId)
+			if detailCategory != nil {
+				item.ChartPermissionId = detailCategory.ChartPermissionId
+			}
 		}
 		item.SourceId = sourceId
 		item.Source = source