Browse Source

no message

zhangchuanxing 14 hours ago
parent
commit
873c5ad80d
2 changed files with 271 additions and 1 deletions
  1. 248 1
      controllers/cygx/report_article.go
  2. 23 0
      models/cygx/summary_manage.go

+ 248 - 1
controllers/cygx/report_article.go

@@ -7590,7 +7590,8 @@ func initgggg() {
 }
 
 //func init() {
-//	initArticle()
+//	initArticle5349()
+//	initAct5349()
 //}
 
 // 固收类型互动记录
@@ -8040,3 +8041,249 @@ func initArticle() {
 	}
 	fmt.Println("end")
 }
+
+// 指定客户下固收阅读记录
+func initArticle5349() {
+
+	//创建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.GetArticleHistoryListInitss5349()
+	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")
+}
+
+func initAct5349() {
+	//行业
+	var condition string
+	var pars []interface{}
+	condition += ` AND  activity_time >  '2025-04-01' AND  activity_time <  '2025-05-01'  ORDER BY   activity_time  DESC   `
+	list, err := cygx.GetActivityListAll(condition, pars, 0, 9999)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+
+	var activityIds []int
+	for _, v := range list {
+		activityIds = append(activityIds, v.ActivityId)
+	}
+
+	condition = ""
+	pars = make([]interface{}, 0)
+
+	fmt.Println("list", len(list))
+
+	//创建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()
+
+	cellA := rowTitle.AddCell()
+	cellA.Value = "手机号"
+
+	cellA2 := rowTitle.AddCell()
+	cellA2.Value = "姓名"
+
+	cellA4 := rowTitle.AddCell()
+	cellA4.Value = "公司名"
+
+	cellB := rowTitle.AddCell()
+	cellB.Value = "活动名称"
+
+	cellAt := rowTitle.AddCell()
+	cellAt.Value = "活动时间"
+
+	cellUser := rowTitle.AddCell()
+	cellUser.Value = "入会时间"
+
+	cellCompany := rowTitle.AddCell()
+	cellCompany.Value = "退出时间"
+
+	cellTime := rowTitle.AddCell()
+	cellTime.Value = "参会时长"
+
+	for _, v := range list {
+		fmt.Println(v.ActivityId)
+		pars = make([]interface{}, 0)
+		condition = ` AND activity_id = ?  AND  ( is_meeting = 1  OR duration != "" )  AND  company_id = 5349  `
+		pars = append(pars, v.ActivityId)
+
+		signUpDetailList, err := cygx.GetSignupDetailList(condition, pars)
+		if err != nil {
+			fmt.Println(err)
+			return
+		}
+
+		for _, vs := range signUpDetailList {
+			if vs.CompanyName == "弘则研究" {
+				continue
+			}
+			row := sheet.AddRow()
+
+			cellA1Datatitle := row.AddCell()
+			cellA1Datatitle.Value = vs.Mobile
+
+			cellA2Datatitle := row.AddCell()
+			cellA2Datatitle.Value = vs.RealName
+
+			cellA4Datatitle := row.AddCell()
+			cellA4Datatitle.Value = vs.CompanyName
+
+			cellADatatitle := row.AddCell()
+			cellADatatitle.Value = v.ActivityName
+
+			cellADatatitle2 := row.AddCell()
+			cellADatatitle2.Value = v.ActivityTime
+
+			cellADataPd := row.AddCell()
+			cellADataPd.Value = vs.FirstMeetingTime
+
+			cellADataPd2 := row.AddCell()
+			cellADataPd2.Value = vs.LastMeetingTime
+
+			cellBData := row.AddCell()
+			cellBData.Value = vs.Duration
+		}
+	}
+
+	err = xlsxFile.Save(downLoadnFilePath)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	fmt.Println("end")
+}

+ 23 - 0
models/cygx/summary_manage.go

@@ -590,6 +590,29 @@ WHERE
 	return
 }
 
+func GetArticleHistoryListInitss5349() (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
+	1 = 1 
+	AND s.company_id IN ( 5349 ) 
+	AND s.create_time >= '2025-04-01' 
+	AND s.create_time <= '2025-05-01' 
+	AND s.is_del = 0 
+	LIMIT 1000 `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
 // 列表
 func GetArticleHistoryList121(articleId int, condition string) (items []*ArticleHistoryRep, err error) {
 	o := orm.NewOrmUsingDB("hz_cygx")