Browse Source

no message

zhangchuanxing 3 days ago
parent
commit
c70595c356
2 changed files with 137 additions and 2 deletions
  1. 113 2
      controllers/cygx/report_article.go
  2. 24 0
      models/cygx/summary_manage.go

+ 113 - 2
controllers/cygx/report_article.go

@@ -7590,7 +7590,7 @@ func initgggg() {
 }
 }
 
 
 //func init() {
 //func init() {
-//	initActComapnyIds()
+//	initArticle()
 //}
 //}
 
 
 // 固收类型互动记录
 // 固收类型互动记录
@@ -7776,7 +7776,6 @@ func initActMobiles() {
 
 
 	mopbiles := "15669219918,96582719,56955949,90009909988,909808783909,22388888,67644885,55295728,4157460042,22388696,14714925361,90445630,22388817,22388806"
 	mopbiles := "15669219918,96582719,56955949,90009909988,909808783909,22388888,67644885,55295728,4157460042,22388696,14714925361,90445630,22388817,22388806"
 	var condition string
 	var condition string
-	mapuserMapbil := make(map[int]*models.WxUserSller)
 
 
 	//创建excel
 	//创建excel
 	dir, err := os.Executable()
 	dir, err := os.Executable()
@@ -7929,3 +7928,115 @@ func initActMobiles() {
 	}
 	}
 	fmt.Println("end")
 	fmt.Println("end")
 }
 }
+
+// 指定客户下固收阅读记录
+func initArticle() {
+
+	//创建excel
+	dir, err := os.Executable()
+	exPath := filepath.Dir(dir)
+	downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
+	xlsxFile := xlsx.NewFile()
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	style := xlsx.NewStyle()
+	alignment := xlsx.Alignment{
+		Horizontal: "center",
+		Vertical:   "center",
+		WrapText:   true,
+	}
+	style.Alignment = alignment
+	style.ApplyAlignment = true
+
+	redStyle := xlsx.NewStyle()
+	redStyle.Alignment = alignment
+	redStyle.ApplyAlignment = true
+	redStyle.Font.Color = "ff0000"
+	//定义底色需要标黄的 单元格颜色
+	redFill := xlsx.Fill{"solid", "ffff00", "ffff00"}
+	redStyle.Fill = redFill
+	//redStyle.Border = *border
+
+	var sheetName string
+	sheetName = "互动信息"
+	sheet, err := xlsxFile.AddSheet(sheetName)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	//标头
+	rowTitle := sheet.AddRow()
+
+	cellB := rowTitle.AddCell()
+	cellB.Value = "手机号"
+
+	cellActime := rowTitle.AddCell()
+	cellActime.Value = "姓名"
+
+	cellD := rowTitle.AddCell()
+	cellD.Value = "公司名"
+
+	cellE := rowTitle.AddCell()
+	cellE.Value = "阅读时间"
+
+	cellE5 := rowTitle.AddCell()
+	cellE5.Value = "报告标题"
+
+	cellE6 := rowTitle.AddCell()
+	cellE6.Value = "报告发布时间"
+
+	listData, err := cygx.GetArticleHistoryListInitss()
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	var mobils []string
+
+	for _, v := range listData {
+		mobils = append(mobils, v.Mobile)
+	}
+
+	listUserFicc, err := models.GetWxUserRaiSllerListByUserMobileFiic(mobils)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	mapUser := make(map[string]string)
+	for _, v := range listUserFicc {
+		mapUser[v.Mobile] = v.RealName
+	}
+
+	for _, v := range listData {
+		row := sheet.AddRow()
+		cellActData1 := row.AddCell()
+		cellActData1.Value = v.Mobile
+
+		cellActData2 := row.AddCell()
+		if v.RealName == "" {
+			v.RealName = mapUser[v.Mobile]
+		}
+		cellActData2.Value = v.RealName
+
+		cellActData3 := row.AddCell()
+		cellActData3.Value = v.CompanyName
+
+		cellActData4 := row.AddCell()
+		cellActData4.Value = v.CreateTime
+
+		cellActData5 := row.AddCell()
+		cellActData5.Value = v.Title
+
+		cellActData6 := row.AddCell()
+		cellActData6.Value = v.PublishDate
+	}
+
+	err = xlsxFile.Save(downLoadnFilePath)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	fmt.Println("end")
+}

+ 24 - 0
models/cygx/summary_manage.go

@@ -547,6 +547,8 @@ type ArticleHistoryRep struct {
 	CreateTime  string `description:"创建时间"`
 	CreateTime  string `description:"创建时间"`
 	Ly          string `description:"创建时间"`
 	Ly          string `description:"创建时间"`
 	Source      string `description:"创建时间"`
 	Source      string `description:"创建时间"`
+	PublishDate string `description:"创建时间"`
+	Title       string `description:"标题"`
 }
 }
 
 
 // 列表
 // 列表
@@ -566,6 +568,28 @@ func GetArticleHistoryList(articleId int, condition string) (items []*ArticleHis
 	return
 	return
 }
 }
 
 
+// 列表
+func GetArticleHistoryListInitss() (items []*ArticleHistoryRep, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT
+	s.mobile,
+	s.real_name,
+	s.company_name,
+	s.create_time,
+	a.title,
+	a.publish_date 
+FROM
+	cygx_article_history_record_all AS s
+	INNER JOIN cygx_article AS a ON a.article_id = s.article_id 
+WHERE
+	s.article_id IN ( SELECT article_id FROM cygx_article WHERE chart_permission_id = 53 AND publish_status = 1 ) 
+	AND s.company_id IN ( 1012, 5599, 15184, 5468, 8728 ) 
+	AND s.is_del = 0 
+	LIMIT 1000 `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
 // 列表
 // 列表
 func GetArticleHistoryList121(articleId int, condition string) (items []*ArticleHistoryRep, err error) {
 func GetArticleHistoryList121(articleId int, condition string) (items []*ArticleHistoryRep, err error) {
 	o := orm.NewOrmUsingDB("hz_cygx")
 	o := orm.NewOrmUsingDB("hz_cygx")