zhangchuanxing hace 3 días
padre
commit
a3c7e804fe
Se han modificado 1 ficheros con 159 adiciones y 0 borrados
  1. 159 0
      controllers/cygx/report_article.go

+ 159 - 0
controllers/cygx/report_article.go

@@ -7770,3 +7770,162 @@ func initActComapnyIds() {
 	}
 	fmt.Println("end")
 }
+
+// 固收类型互动记录
+func initActMobiles() {
+
+	mopbiles := "15669219918,96582719,56955949,90009909988,909808783909,22388888,67644885,55295728,4157460042,22388696,14714925361,90445630,22388817,22388806"
+	var condition string
+	mapuserMapbil := make(map[int]*models.WxUserSller)
+
+	//创建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 = "1月份活动参与次数"
+
+	cellActime := rowTitle.AddCell()
+	cellActime.Value = "2月份活动参与次数"
+
+	cellD := rowTitle.AddCell()
+	cellD.Value = "3月份活动参与次数"
+
+	cellE := rowTitle.AddCell()
+	cellE.Value = "4月份活动参与次数"
+
+	cellE5 := rowTitle.AddCell()
+	cellE5.Value = "5月份活动参与次数"
+
+	cellE6 := rowTitle.AddCell()
+	cellE6.Value = "6月份活动参与次数"
+
+	cellE7 := rowTitle.AddCell()
+	cellE7.Value = "7月份活动参与次数"
+
+	cellE8 := rowTitle.AddCell()
+	cellE8.Value = "8月份活动参与次数"
+
+	cellE9 := rowTitle.AddCell()
+	cellE9.Value = "9月份活动参与次数"
+
+	cellE10 := rowTitle.AddCell()
+	cellE10.Value = "10月份活动参与次数"
+
+	cellE11 := rowTitle.AddCell()
+	cellE11.Value = "11月份活动参与次数"
+
+	cellE12 := rowTitle.AddCell()
+	cellE12.Value = "12月份活动参与次数"
+
+	cellArt1 := rowTitle.AddCell()
+	cellArt1.Value = "1月份阅读报告次数"
+
+	cellArt2 := rowTitle.AddCell()
+	cellArt2.Value = "2月份阅读报告次数"
+
+	cellArt3 := rowTitle.AddCell()
+	cellArt3.Value = "3月份阅读报告次数"
+
+	cellArt4 := rowTitle.AddCell()
+	cellArt4.Value = "4月份阅读报告次数"
+
+	cellArt5 := rowTitle.AddCell()
+	cellArt5.Value = "5月份阅读报告次数"
+
+	cellArt6 := rowTitle.AddCell()
+	cellArt6.Value = "6月份阅读报告次数"
+
+	cellArt7 := rowTitle.AddCell()
+	cellArt7.Value = "7月份阅读报告次数"
+
+	cellArt8 := rowTitle.AddCell()
+	cellArt8.Value = "8月份阅读报告次数"
+
+	cellArt9 := rowTitle.AddCell()
+	cellArt9.Value = "9月份阅读报告次数"
+
+	cellArt10 := rowTitle.AddCell()
+	cellArt10.Value = "10月份阅读报告次数"
+
+	cellArt11 := rowTitle.AddCell()
+	cellArt11.Value = "11月份阅读报告次数"
+
+	cellArt12 := rowTitle.AddCell()
+	cellArt12.Value = "12月份阅读报告次数"
+
+	row := sheet.AddRow()
+
+	for i := 1; i < 13; i++ {
+		//var statrDate, endDate string
+		statrDate := fmt.Sprint("2024-", i, "-01")
+		endDate := fmt.Sprint("2024-", i, "-31 23:59:59")
+		condition = `  AND  ( is_meeting  = 1  OR    duration != '' )  AND  a.activity_time >= '` + statrDate + `'  AND  a.activity_time <='` + endDate + `' AND  s.mobile IN (` + mopbiles + `) `
+		listData, err := cygx.GetActivityMeetByUser(condition, 0, 99999)
+		if err != nil {
+			fmt.Println(err)
+			return
+		}
+		cellActData := row.AddCell()
+		cellActData.Value = strconv.Itoa(len((listData)))
+	}
+
+	for i := 1; i < 13; i++ {
+		//var statrDate, endDate string
+		statrDate := fmt.Sprint("2024-", i, "-01")
+		endDate := fmt.Sprint("2024-", i, "-31 23:59:59")
+
+		var conditionArt string
+		var parsArt []interface{}
+		conditionArt = ` AND r.source = 'article'   AND  r.create_time >=  ?  AND  r.create_time <= ? AND  r.mobile IN (` + mopbiles + `) `
+		parsArt = append(parsArt, statrDate, endDate)
+		listTotal, err := cygx.GetCygxArticleAndYanxuanRecordCount(conditionArt, parsArt)
+		if err != nil {
+			fmt.Println(err)
+			return
+		}
+		cellArtData := row.AddCell()
+		cellArtData.Value = strconv.Itoa(listTotal)
+		fmt.Println((listTotal))
+	}
+
+	err = xlsxFile.Save(downLoadnFilePath)
+	if err != nil {
+		fmt.Println(err)
+		return
+	}
+	fmt.Println("end")
+}